semiotic 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CLAUDE.md +50 -8
  2. package/README.md +11 -11
  3. package/ai/examples.md +91 -0
  4. package/ai/schema.json +223 -9
  5. package/ai/system-prompt.md +12 -4
  6. package/dist/components/ChartContainer.d.ts +2 -0
  7. package/dist/components/DataSummaryContext.d.ts +12 -0
  8. package/dist/components/Tooltip/FlippingTooltip.d.ts +34 -0
  9. package/dist/components/charts/index.d.ts +4 -0
  10. package/dist/components/charts/ordinal/BarChart.d.ts +3 -1
  11. package/dist/components/charts/ordinal/BoxPlot.d.ts +3 -1
  12. package/dist/components/charts/ordinal/DonutChart.d.ts +0 -1
  13. package/dist/components/charts/ordinal/DotPlot.d.ts +3 -1
  14. package/dist/components/charts/ordinal/FunnelChart.d.ts +3 -1
  15. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -1
  16. package/dist/components/charts/ordinal/Histogram.d.ts +16 -2
  17. package/dist/components/charts/ordinal/LikertChart.d.ts +94 -0
  18. package/dist/components/charts/ordinal/PieChart.d.ts +0 -1
  19. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +11 -7
  20. package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -1
  21. package/dist/components/charts/ordinal/SwarmPlot.d.ts +14 -1
  22. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +65 -0
  23. package/dist/components/charts/ordinal/ViolinPlot.d.ts +16 -2
  24. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +20 -0
  25. package/dist/components/charts/shared/annotationResolvers.d.ts +28 -0
  26. package/dist/components/charts/shared/hooks.d.ts +23 -2
  27. package/dist/components/charts/shared/selectionUtils.d.ts +5 -1
  28. package/dist/components/charts/shared/statsTooltip.d.ts +11 -0
  29. package/dist/components/charts/shared/types.d.ts +22 -1
  30. package/dist/components/charts/shared/useChartSetup.d.ts +12 -2
  31. package/dist/components/charts/shared/useLikertAggregation.d.ts +51 -0
  32. package/dist/components/charts/shared/useOrdinalBrush.d.ts +28 -0
  33. package/dist/components/charts/shared/useOrdinalStreaming.d.ts +54 -0
  34. package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
  35. package/dist/components/charts/shared/validateProps.d.ts +2 -2
  36. package/dist/components/charts/shared/validationMap.d.ts +12 -0
  37. package/dist/components/charts/xy/AreaChart.d.ts +11 -0
  38. package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
  39. package/dist/components/charts/xy/StackedAreaChart.d.ts +11 -0
  40. package/dist/components/realtime/types.d.ts +4 -0
  41. package/dist/components/semiotic-ai.d.ts +1 -0
  42. package/dist/components/semiotic-ordinal.d.ts +2 -0
  43. package/dist/components/semiotic-themes.d.ts +16 -0
  44. package/dist/components/semiotic-utils.d.ts +30 -0
  45. package/dist/components/semiotic.d.ts +4 -4
  46. package/dist/components/store/LinkedCrosshairStore.d.ts +11 -0
  47. package/dist/components/store/useSelection.d.ts +1 -0
  48. package/dist/components/stream/AccessibleDataTable.d.ts +28 -6
  49. package/dist/components/stream/FocusRing.d.ts +33 -0
  50. package/dist/components/stream/OrdinalBrushOverlay.d.ts +43 -0
  51. package/dist/components/stream/OrdinalPipelineStore.d.ts +16 -0
  52. package/dist/components/stream/OrdinalSVGOverlay.d.ts +1 -1
  53. package/dist/components/stream/PipelineStore.d.ts +5 -47
  54. package/dist/components/stream/SVGOverlay.d.ts +4 -0
  55. package/dist/components/stream/SceneGraph.d.ts +6 -1
  56. package/dist/components/stream/XYBrushOverlay.d.ts +47 -0
  57. package/dist/components/stream/geoTypes.d.ts +5 -1
  58. package/dist/components/stream/keyboardNav.d.ts +85 -9
  59. package/dist/components/stream/layouts/hierarchySceneBuilders.d.ts +35 -0
  60. package/dist/components/stream/layouts/hierarchyUtils.d.ts +25 -0
  61. package/dist/components/stream/networkTypes.d.ts +5 -1
  62. package/dist/components/stream/ordinalSceneBuilders/swimlaneScene.d.ts +12 -0
  63. package/dist/components/stream/ordinalTypes.d.ts +15 -3
  64. package/dist/components/stream/pipelineDecay.d.ts +20 -0
  65. package/dist/components/stream/pipelinePulse.d.ts +24 -0
  66. package/dist/components/stream/pipelineTransitions.d.ts +59 -0
  67. package/dist/components/stream/renderers/pointCanvasRenderer.d.ts +2 -1
  68. package/dist/components/stream/types.d.ts +19 -1
  69. package/dist/components/stream/useMediaPreferences.d.ts +11 -0
  70. package/dist/components/stream/xySceneBuilders/areaScene.d.ts +13 -0
  71. package/dist/components/stream/xySceneBuilders/barScene.d.ts +18 -0
  72. package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +8 -0
  73. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +10 -0
  74. package/dist/components/stream/xySceneBuilders/emitPointNodes.d.ts +13 -0
  75. package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +3 -0
  76. package/dist/components/stream/xySceneBuilders/lineScene.d.ts +12 -0
  77. package/dist/components/stream/xySceneBuilders/pointScene.d.ts +12 -0
  78. package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +10 -0
  79. package/dist/components/stream/xySceneBuilders/types.d.ts +93 -0
  80. package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +12 -0
  81. package/dist/geo.min.js +1 -1
  82. package/dist/geo.module.min.js +1 -1
  83. package/dist/network.min.js +1 -1
  84. package/dist/network.module.min.js +1 -1
  85. package/dist/ordinal.min.js +1 -1
  86. package/dist/ordinal.module.min.js +1 -1
  87. package/dist/realtime.min.js +1 -1
  88. package/dist/realtime.module.min.js +1 -1
  89. package/dist/semiotic-ai.d.ts +1 -0
  90. package/dist/semiotic-ai.min.js +1 -1
  91. package/dist/semiotic-ai.module.min.js +1 -1
  92. package/dist/semiotic-ordinal.d.ts +2 -0
  93. package/dist/{semiotic-statisticalOverlays-D8LhSbQt.js → semiotic-statisticalOverlays-DGX_WWc5.js} +1 -1
  94. package/dist/semiotic-themes.d.ts +16 -0
  95. package/dist/semiotic-themes.min.js +1 -1
  96. package/dist/semiotic-themes.module.min.js +1 -1
  97. package/dist/semiotic-utils.d.ts +30 -0
  98. package/dist/semiotic-utils.min.js +1 -0
  99. package/dist/semiotic-utils.module.min.js +1 -0
  100. package/dist/semiotic.d.ts +4 -4
  101. package/dist/semiotic.min.js +1 -1
  102. package/dist/semiotic.module.min.js +1 -1
  103. package/dist/server.min.js +1 -1
  104. package/dist/server.module.min.js +1 -1
  105. package/dist/xy.min.js +1 -1
  106. package/dist/xy.module.min.js +1 -1
  107. package/package.json +15 -8
@@ -1 +1 @@
1
- import*as e from"react";import{useRef as t,useState as n,useEffect as o,useMemo as r,createContext as i,useContext as s,useCallback as a,useSyncExternalStore as l,forwardRef as c,useImperativeHandle as u,useId as h}from"react";import{brushX as d,brushY as g,brush as p}from"d3-brush";import{select as y}from"d3-selection";import{scaleOrdinal as f,scaleLinear as m,scaleSequential as v,scaleLog as b}from"d3-scale";import{schemeCategory10 as x,interpolatePlasma as k,interpolateViridis as w,interpolatePurples as A,interpolateOranges as O,interpolateGreens as S,interpolateReds as j,interpolateBlues as E,schemeSet3 as M,schemeTableau10 as C}from"d3-scale-chromatic";import{quadtree as P}from"d3-quadtree";import{bin as L}from"d3-array";import{packEnclose as _}from"d3-hierarchy";import{area as B,curveCatmullRom as N,curveCardinal as H,curveBasis as z,curveStepBefore as $,curveStepAfter as F,curveStep as W,curveMonotoneY as T,curveMonotoneX as D,curveLinear as I,line as R,curveNatural as G}from"d3-shape";import Y from"regression";class q{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class X{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}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 V{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function U(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function Q(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}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:r,datum:c,group:i}}function K(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const c=t.x(e),u=a?a(i):r;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:i,datum:e,group:s}}function Z(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(null==a||null==l||Number.isNaN(a)||Number.isNaN(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function J(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function ee(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function te(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function ne(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function oe(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function re(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}const ie={category10:x,tableau10:C,set3:M,blues:E,reds:j,greens:S,oranges:O,purples:A,viridis:w,plasma:k},se=x,ae=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],le=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 ce(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||le.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):se[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o+""))%se.length]}function ue(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return f().domain(o).range(n).unknown("#999");const i=ie[n]||ie.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:se;return f().domain(o).range(e).unknown("#999")}}function he(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}function de(e,t,n){return e+(t-e)*n}class ge{constructor(e){this.xExtent=new V,this.yExtent=new V,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,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.xIsDate=!1,this._quadtree=null,this.config=e,this.buffer=new X(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=ne(e.timeAccessor||e.xAccessor,"time"),this.getY=ne(e.valueAccessor||e.yAccessor,"value")):(this.getX=ne(e.xAccessor,"x"),this.getY=ne(e.yAccessor,"y")),this.getGroup=re(e.groupAccessor),this.getCategory=re(e.categoryAccessor),this.getSize=e.sizeAccessor?ne(e.sizeAccessor,"size"):void 0,this.getColor=re(e.colorAccessor),this.getBounds=e.boundsAccessor?ne(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?ne(e.y0Accessor,"y0"):void 0,this.getPointId=re(e.pointIdAccessor),"candlestick"===e.chartType&&(this.getOpen=ne(e.openAccessor,"open"),this.getHigh=ne(e.highAccessor,"high"),this.getLow=ne(e.lowAccessor,"low"),this.getClose=ne(e.closeAccessor,"close")),e.pulse&&(this.timestampBuffer=new X(e.windowSize))}ingest(e){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.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?ne(this.config.timeAccessor||this.config.xAccessor,"time"):ne(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n)))}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,n,o,r,i,s;const{config:a,buffer:l}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(l,this.getX),this.yExtent.dirty)if("candlestick"===a.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of l)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(l,this.getY);const c=this.getBufferArray(),u=this.xExtent.extent,h=this.yExtent.extent;let d=a.xExtent?[null!==(t=a.xExtent[0])&&void 0!==t?t:u[0],null!==(n=a.xExtent[1])&&void 0!==n?n:u[1]]:u,g=a.yExtent?[null!==(o=a.yExtent[0])&&void 0!==o?o:h[0],null!==(r=a.yExtent[1])&&void 0!==r?r:h[1]]:h;const p=a.yExtent&&null!=a.yExtent[0]&&null!=a.yExtent[1];if("stackedarea"===a.chartType&&!p&&l.size>0)if(a.normalize)g=[0,1+a.extentPadding];else{const e=`${l.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)g=this._stackExtentCache.yDomain;else{const t=this.groupData(c),n=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),o=this.getY(t);null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||n.set(e,(n.get(e)||0)+o)}let o=0;for(const e of n.values())e>o&&(o=e);g=[0,o+(o>0?o*a.extentPadding:1)],this._stackExtentCache={key:e,yDomain:g}}}else if("bar"===a.chartType&&a.binSize&&!p&&l.size>0){const[,e]=function(e,t,n,o,r){const i=U(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(l,this.getX,this.getY,a.binSize,this.getCategory);g=[0,e+e*a.extentPadding]}else if("waterfall"===a.chartType&&!p&&l.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(l,this.getY),n=t-e,o=n>0?n*a.extentPadding:1;g=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!p&&g[0]!==1/0){if(this.getBounds)for(const e of c){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>g[1]&&(g[1]=t+n),g[0]>t-n&&(g[0]=t-n))}const e=g[1]-g[0],t=e>0?e*a.extentPadding:1,n=null===(i=a.yExtent)||void 0===i?void 0:i[0],o=null===(s=a.yExtent)||void 0===s?void 0:s[1];g=[null!=n?g[0]:g[0]-t,null!=o?g[1]:g[1]+t],"log"===a.yScaleType&&0>=g[0]&&h[0]>0&&(g[0]=null!=n?g[0]:h[0]/(1+a.extentPadding))}if(d[0]!==1/0&&d[1]!==-1/0||(d=[0,1]),g[0]!==1/0&&g[1]!==-1/0||(g=[0,1]),"streaming"===a.runtimeMode)if("x"==("up"===(y=a.arrowOfTime)||"down"===y?"y":"x")){const t="right"===a.arrowOfTime?[0,e.width]:[e.width,0];this.scales={x:m().domain(d).range(t),y:m().domain(g).range([e.height,0])}}else{const t="down"===a.arrowOfTime?[0,e.height]:[e.height,0];this.scales={x:m().domain(g).range([0,e.width]),y:m().domain(d).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return b().domain(e).range(n).clamp(!0)}return m().domain(t).range(n)};this.scales={x:t(a.xScaleType,d,[0,e.width]),y:t(a.yScaleType,g,[e.height,0])}}var y;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,c),this.config.decay&&this.applyDecay(this.scene,c),this.config.pulse&&this.applyPulse(this.scene,c),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 void(this._quadtree=null);const t=this.scene.filter(e=>"point"===e.type);this._quadtree=t.length>ge.QUADTREE_THRESHOLD?P().x(e=>e.x).y(e=>e.y).addAll(t):null}get quadtree(){return this._quadtree}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return b().domain(e).range(n).clamp(!0)}return m().domain(t).range(n)};this.scales={x:a(this.config.xScaleType,o,[i[0]*t,i[1]*t]),y:a(this.config.yScaleType,r,[s[0]*n,s[1]*n])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){const{config:n,scales:o}=this;if(!o||0===t.length)return[];switch(n.chartType){case"line":return this.buildLineScene(t);case"area":return this.buildAreaScene(t);case"stackedarea":return this.buildStackedAreaScene(t);case"scatter":case"bubble":return this.buildPointScene(t);case"heatmap":return this.buildHeatmapScene(t,e);case"bar":return this.buildBarScene(t);case"swarm":return this.buildSwarmScene(t);case"waterfall":return this.buildWaterfallScene(t,e);case"candlestick":return this.buildCandlestickScene(t,e);default:return[]}}buildLineScene(e){var t;const n=this.groupData(e),o=[],r=null===(t=this.config.annotations)||void 0===t?void 0:t.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(this.getBounds)for(const e of n){const t=this.buildBoundsForGroup(e.data,e.key);t&&o.push(t)}for(const e of n){const t=this.resolveLineStyle(e.key,e.data[0]),n=Q(e.data,this.scales,this.getX,this.getY,t,e.key);r&&r.length>0&&(n.colorThresholds=r),this.config.curve&&"linear"!==this.config.curve&&(n.curve=this.config.curve),o.push(n)}return o}buildAreaScene(e){const t=this.groupData(e),n=[],o=this.scales.y.domain()[0];for(const e of t){const t=this.resolveAreaStyle(e.key,e.data[0]),r=K(e.data,this.scales,this.getX,this.getY,o,t,e.key,this.getY0);this.config.gradientFill&&(r.fillGradient=this.config.gradientFill),this.config.curve&&"linear"!==this.config.curve&&(r.curve=this.config.curve),n.push(r)}return n}buildStackedAreaScene(e){const t=this.groupData(e);return t.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0),function(e,t,n,o,r,i,s){var a;const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let h;if(i){h=new Map;for(const t of c){let n=0;for(const o of e)n+=(null===(a=u.get(o.key))||void 0===a?void 0:a.get(t))||0;h.set(t,n||1)}}const d=[],g=new Map;for(const e of c)g.set(e,0);for(const n of e){const e=u.get(n.key),o=[],a=[];for(const n of c){let r=e.get(n)||0;const s=g.get(n);i&&(r/=h.get(n));const l=t.x(n);a.push([l,t.y(s)]),o.push([l,t.y(s+r)]),g.set(n,s+r)}const l={type:"area",topPath:o,bottomPath:a,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(l.curve=s),d.push(l)}return d}(t,this.scales,this.getX,this.getY,(e,t)=>this.resolveAreaStyle(e,t),this.config.normalize,this.config.curve&&"linear"!==this.config.curve?this.config.curve:void 0)}buildPointScene(e){const t=[],n="bubble"===this.config.chartType?10:5,o=this.config.sizeRange||[3,15];let r=null;if(this.getSize&&!this.config.pointStyle){const t=e.map(e=>this.getSize(e)).filter(e=>null!=e&&!Number.isNaN(e));if(t.length>0){let e=1/0,n=-1/0;for(const o of t)e>o&&(e=o),o>n&&(n=o);r=t=>e===n?(o[0]+o[1])/2:o[0]+(t-e)/(n-e)*(o[1]-o[0])}}const i=this.getColor?this.resolveColorMap(e):null;for(const o of e){let e=this.config.pointStyle?this.config.pointStyle(o):{fill:"#4e79a7",opacity:.8},s=e.r||n;if(r&&this.getSize){const e=this.getSize(o);null==e||Number.isNaN(e)||(s=r(e))}if(i&&this.getColor&&!e.fill){const t=this.getColor(o);t&&i.has(t)&&(e=Object.assign(Object.assign({},e),{fill:i.get(t)}))}const a=this.getPointId?this.getPointId(o)+"":void 0,l=Z(o,this.scales,this.getX,this.getY,s,e,a);l&&t.push(l)}return t}buildHeatmapScene(e,t){const n=[];if(this.config.heatmapAggregation)return this.buildStreamingHeatmapScene(e,t);const o=ne(this.config.valueAccessor,"value"),r=oe(this.config.xAccessor,"x"),i=oe(this.config.yAccessor,"y"),s=new Set,a=new Set;for(const t of e)s.add(r(t)),a.add(i(t));const l=Array.from(s),c=Array.from(a),u=l.every(e=>"number"==typeof e&&!isNaN(e)),h=c.every(e=>"number"==typeof e&&!isNaN(e)),d=u?l.sort((e,t)=>e-t):l,g=h?c.sort((e,t)=>e-t):c;if(0===d.length||0===g.length)return n;const p=t.width/d.length,y=t.height/g.length,f=new Map;for(const t of e){const e=`${r(t)}\0${i(t)}`;f.set(e,{val:o(t),datum:t})}let m=1/0,b=-1/0;for(const{val:e}of f.values())m>e&&(m=e),e>b&&(b=e);const x=v({blues:E,reds:j,greens:S,viridis:w}["string"==typeof this.config.colorScheme?this.config.colorScheme:"blues"]||E).domain([m,b]);for(let e=0;d.length>e;e++)for(let t=0;g.length>t;t++){const o=f.get(`${d[e]}\0${g[t]}`);if(!o)continue;const r=x(o.val);n.push(ee(e*p,(g.length-1-t)*y,p,y,r,o.datum,this.config.showValues?{value:o.val,showValues:!0,valueFormat:this.config.heatmapValueFormat}:void 0))}return n}buildStreamingHeatmapScene(e,t){var n,o,r;const i=[],s=null!==(n=this.config.heatmapXBins)&&void 0!==n?n:20,a=null!==(o=this.config.heatmapYBins)&&void 0!==o?o:20,l=null!==(r=this.config.heatmapAggregation)&&void 0!==r?r:"count",c=ne(this.config.valueAccessor,"value");if(!this.scales||0===e.length)return i;const[u,h]=this.scales.x.domain(),[d,g]=this.scales.y.domain(),p=(h-u||1)/s,y=(g-d||1)/a,f=new Map;for(const t of e){const e=this.getX(t),n=this.getY(t),o=Math.min(Math.floor((e-u)/p),s-1),r=Math.min(Math.floor((n-d)/y),a-1);if(0>o||0>r)continue;const i=`${o}_${r}`;let l=f.get(i);l||(l={sum:0,count:0,data:[]},f.set(i,l)),l.count++,l.sum+=c(t),l.data.push(t)}let m=1/0,v=-1/0;const b=new Map;for(const[e,t]of f){let n;switch(l){case"sum":n=t.sum;break;case"mean":n=t.count>0?t.sum/t.count:0;break;default:n=t.count}b.set(e,n),m>n&&(m=n),n>v&&(v=n)}const x=v-m||1,k=t.width/s,w=t.height/a;for(const[e,t]of b){const[n,o]=e.split("_"),r=+n,s=+o,l=(t-m)/x,c=`rgb(${Math.round(220-180*l)},${Math.round(220-100*l)},${Math.round(255-50*l)})`,u=f.get(e);i.push(ee(r*k,(a-1-s)*w,k,w,c,{xi:r,yi:s,value:t,count:u.count,sum:u.sum,data:u.data},this.config.showValues?{value:t,showValues:!0,valueFormat:this.config.heatmapValueFormat}:void 0))}return i}buildBarScene(e){var t;if(!this.config.binSize)return[];const n=U(e,this.getX,this.getY,this.config.binSize,this.getCategory);if(0===n.size)return[];let o=null;if(this.getCategory){const e=new Set;for(const t of n.values())for(const n of t.categories.keys())e.add(n);const t=this.config.barColors?Object.keys(this.config.barColors):[],r=new Set(t),i=Array.from(e).filter(e=>!r.has(e)).sort(),s=t.filter(t=>e.has(t)),a=s.join("\0")+""+i.join("\0");this._barCategoryCache&&this._barCategoryCache.key===a?o=this._barCategoryCache.order:(o=[...s,...i],this._barCategoryCache={key:a,order:o})}const r=[],i=this.scales,[s,a]=i.x.domain();for(const e of n.values()){const n=Math.max(e.start,s),l=Math.min(e.end,a);if(n>=l)continue;const c=i.x(n),u=i.x(l),h=Math.abs(u-c),d=h>2?1:0,g=Math.min(c,u)+d/2,p=Math.max(h-d,1);if(p>0)if(o&&e.categories.size>0){let n=0;for(const s of o){const o=e.categories.get(s)||0;if(0===o)continue;const a=i.y(n),l=i.y(n+o);r.push(J(g,Math.min(a,l),p,Math.abs(a-l),{fill:(null===(t=this.config.barColors)||void 0===t?void 0:t[s])||"#4e79a7"},{binStart:e.start,binEnd:e.end,total:e.total,category:s,categoryValue:o},s)),n+=o}}else{const t=i.y(0),n=i.y(e.total);r.push(J(g,Math.min(t,n),p,Math.abs(t-n),{fill:"#007bff"},{binStart:e.start,binEnd:e.end,total:e.total}))}}return r}buildSwarmScene(e){var t,n,o,r;const i=[],s=this.config.swarmStyle||{},a=null!==(t=s.radius)&&void 0!==t?t:3,l=null!==(n=s.fill)&&void 0!==n?n:"#007bff",c=null!==(o=s.opacity)&&void 0!==o?o:.7,u=s.stroke,h=s.strokeWidth;for(const t of e){const e=this.getX(t),n=this.getY(t);if(null==n||Number.isNaN(n))continue;const o=this.scales.x(e),s=this.scales.y(n);let d=l;if(this.getCategory){const e=this.getCategory(t);d=(null===(r=this.config.barColors)||void 0===r?void 0:r[e])||d}const g={type:"point",x:o,y:s,r:a,style:{fill:d,opacity:c,stroke:u,strokeWidth:h},datum:t};this.getPointId&&(g.pointId=this.getPointId(t)+""),i.push(g)}return i}buildWaterfallScene(e,t){var n,o,r;const i=[],s=this.scales,a=this.config.waterfallStyle,l=e.filter(e=>{const t=this.getY(e);return null!=t&&!Number.isNaN(t)});if(0===l.length)return i;const c=null!==(n=null==a?void 0:a.positiveColor)&&void 0!==n?n:"#28a745",u=null!==(o=null==a?void 0:a.negativeColor)&&void 0!==o?o:"#dc3545",h=null!==(r=null==a?void 0:a.gap)&&void 0!==r?r:1,d=null==a?void 0:a.stroke,g=null==a?void 0:a.strokeWidth;let p=0;for(let e=0;l.length>e;e++){const n=l[e],o=this.getX(n),r=this.getY(n),y=p+r;let f;f=l.length-1>e?this.getX(l[e+1])-o:e>0?o-this.getX(l[e-1]):0;const m=s.x(o),v=0!==f?s.x(o+f):m+t.width/10,b=Math.min(m,v)+h/2,x=Math.max(m,v)-h/2-b;if(0>=x){p=y;continue}const k=s.y(p),w=s.y(y);i.push(J(b,Math.min(k,w),x,Math.abs(k-w),{fill:0>r?u:c,stroke:d,strokeWidth:g},Object.assign(Object.assign({},n),{baseline:p,cumEnd:y,delta:r,_connectorStroke:null==a?void 0:a.connectorStroke,_connectorWidth:null==a?void 0:a.connectorWidth}))),p=y}return i}buildCandlestickScene(e,t){if(!(this.getOpen&&this.getHigh&&this.getLow&&this.getClose&&this.scales))return[];const n=[],o=this.config.candlestickStyle||{},r=o.upColor||"#28a745",i=o.downColor||"#dc3545",s=o.wickColor||"#333",a=o.wickWidth||1,l=e.map(e=>this.getX(e)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let c=o.bodyWidth||6;if(!o.bodyWidth&&l.length>1){let e=1/0;for(let t=1;l.length>t;t++){const n=Math.abs(this.scales.x(l[t])-this.scales.x(l[t-1]));n>0&&e>n&&(e=n)}e!==1/0&&(c=Math.max(2,Math.min(.6*e,20)))}for(const t of e){const e=this.getX(t);if(null==e||Number.isNaN(e))continue;const o=this.getOpen(t),l=this.getHigh(t),u=this.getLow(t),h=this.getClose(t);if([o,l,u,h].some(e=>null==e||Number.isNaN(e)))continue;const d=h>=o;n.push({type:"candlestick",x:this.scales.x(e),openY:this.scales.y(o),closeY:this.scales.y(h),highY:this.scales.y(l),lowY:this.scales.y(u),bodyWidth:c,upColor:r,downColor:i,wickColor:s,wickWidth:a,isUp:d,datum:t})}return n}buildBoundsForGroup(e,t){if(!this.getBounds||!this.scales)return null;const n=[],o=[];for(const t of e){const e=this.getX(t),r=this.getY(t);if(null==e||null==r||Number.isNaN(e)||Number.isNaN(r))continue;const i=this.getBounds(t),s=this.scales.x(e);if(i&&0!==i)n.push([s,this.scales.y(r+i)]),o.push([s,this.scales.y(r-i)]);else{const e=this.scales.y(r);n.push([s,e]),o.push([s,e])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:o,style:this.resolveBoundsStyle(t,e[0]),datum:e,group:t,interactive:!1}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const s=null!==(n=i.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(i.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return s+Math.pow(.5,a/e)*(1-s)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>a?1:s;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("line"===t.type){const e=Array.isArray(t.datum)?t.datum:[];if(2>e.length)continue;const n=Array(e.length);let o=!1;for(let t=0;e.length>t;t++){const s=i.get(e[t]);null!=s?(n[t]=this.computeDecayOpacity(s,r),1>n[t]&&(o=!0)):n[t]=1}o&&(t._decayOpacities=n);continue}if("area"===t.type){const e=Array.isArray(t.datum)?t.datum:[],n=t.topPath?t.topPath.length:e.length;if(2>n)continue;if(e.length===n){const o=Array(n);let s=!1;for(let t=0;e.length>t;t++){const n=i.get(e[t]);null!=n?(o[t]=this.computeDecayOpacity(n,r),1>o[t]&&(s=!0)):o[t]=1}s&&(t._decayOpacities=o)}else{let o=1;for(const t of e){const e=i.get(t);if(null!=e){const t=this.computeDecayOpacity(e,r);o>t&&(o=t)}}if(1>o){const e=Array(n);e.fill(o),t._decayOpacities=e}}continue}const e=i.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,r);if("heatcell"===t.type)t.style={opacity:s};else if("candlestick"===t.type)t._decayOpacity=s;else{const e=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:e*s})}}}computePulseIntensity(e,t){var n;const o=this.config.pulse;if(!o)return 0;const r=null!==(n=o.duration)&&void 0!==n?n:500,i=t-e;return r>i?1-i/r:0}applyPulse(e,t){var n,o;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",s=null!==(o=this.config.pulse.glowRadius)&&void 0!==o?o:4,a=new Map;for(let e=0;t.length>e;e++)a.set(t[e],e);for(const t of e){if("line"===t.type)continue;if("area"===t.type){const e=Array.isArray(t.datum)?t.datum:[t.datum];let n=0;for(const t of e){const e=a.get(t);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=this.computePulseIntensity(o,r);i>n&&(n=i)}n>0&&(t._pulseIntensity=n,t._pulseColor=i);continue}const e=a.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const o=this.computePulseIntensity(n,r);o>0&&(t._pulseIntensity=o,t._pulseColor=i,t._pulseGlowRadius=s)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}snapshotPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();for(let o=0;this.scene.length>o;o++){const r=this.scene[o],i=this.getNodeIdentity(r,o);i&&("point"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,r:r.r,opacity:r.style.opacity}):"rect"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,w:r.w,h:r.h,opacity:r.style.opacity}):"heatcell"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,w:r.w,h:r.h,opacity:null===(e=r.style)||void 0===e?void 0:e.opacity}):"candlestick"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.openY}):"line"===r.type?this.prevPathMap.set(i,{path:r.path.map(e=>[e[0],e[1]]),opacity:null===(t=r.style)||void 0===t?void 0:t.opacity}):"area"===r.type&&this.prevPathMap.set(i,{topPath:r.topPath.map(e=>[e[0],e[1]]),bottomPath:r.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(n=r.style)||void 0===n?void 0:n.opacity}))}}getNodeIdentity(e,t){var n,o,r,i;switch(e.type){case"point":if(e.pointId)return"p:"+e.pointId;if("streaming"===this.config.runtimeMode&&e.datum){if(this.getCategory)return`p:${this.getCategory(e.datum)}:${this.getY(e.datum)}`;const t=this.getX(e.datum),n=this.getY(e.datum);if(null!=t&&null!=n)return`p:${t}:${n}`}return"p:"+t;case"rect":return`r:${e.group||""}:${null!==(i=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.binStart)&&void 0!==o?o:null===(r=e.datum)||void 0===r?void 0:r.category)&&void 0!==i?i:t}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+t:"c:"+this.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}startTransition(){var e,t,n,o,r,i,s,a,l,c,u,h,d,g,p,y,f,m,v,b,x,k,w,A,O,S;if(!this.config.transition||0===this.prevPositionMap.size&&0===this.prevPathMap.size)return;const j=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let E=!1;const M=new Set,C=new Set;for(let e=0;this.scene.length>e;e++){const f=this.scene[e],m=this.getNodeIdentity(f,e);if(!m)continue;if(f._transitionKey=m,"line"===f.type||"area"===f.type){const e=this.prevPathMap.get(m);if(e){if(C.add(m),"line"===f.type&&e.path&&e.path.length===f.path.length){f._targetPath=f.path.map(e=>[e[0],e[1]]),f._prevPath=e.path;for(let t=0;f.path.length>t;t++)f.path[t]=[e.path[t][0],e.path[t][1]];E=!0}else if("area"===f.type&&e.topPath&&e.bottomPath&&e.topPath.length===f.topPath.length&&e.bottomPath.length===f.bottomPath.length){f._targetTopPath=f.topPath.map(e=>[e[0],e[1]]),f._targetBottomPath=f.bottomPath.map(e=>[e[0],e[1]]),f._prevTopPath=e.topPath,f._prevBottomPath=e.bottomPath;for(let t=0;f.topPath.length>t;t++)f.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;f.bottomPath.length>t;t++)f.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];E=!0}f._targetOpacity=null!==(t=f.style.opacity)&&void 0!==t?t:1}else f._targetOpacity=null!==(n=f.style.opacity)&&void 0!==n?n:1,f.style=Object.assign(Object.assign({},f.style),{opacity:0}),E=!0;continue}const v=this.prevPositionMap.get(m);if("point"===f.type)if(v){M.add(m);const e={x:f.x,y:f.y,r:f.r};f._targetOpacity=null!==(o=f.style.opacity)&&void 0!==o?o:1,v.x===e.x&&v.y===e.y||(f._targetX=e.x,f._targetY=e.y,f._targetR=e.r,f.x=v.x,f.y=v.y,f.r=null!==(r=v.r)&&void 0!==r?r:f.r,E=!0)}else f._targetOpacity=null!==(i=f.style.opacity)&&void 0!==i?i:1,f.style=Object.assign(Object.assign({},f.style),{opacity:0}),E=!0;else if("rect"===f.type)if(v){M.add(m);const e={x:f.x,y:f.y,w:f.w,h:f.h};f._targetOpacity=null!==(s=f.style.opacity)&&void 0!==s?s:1,v.x===e.x&&v.y===e.y&&v.w===e.w&&v.h===e.h||(f._targetX=e.x,f._targetY=e.y,f._targetW=e.w,f._targetH=e.h,f.x=v.x,f.y=v.y,f.w=null!==(a=v.w)&&void 0!==a?a:f.w,f.h=null!==(l=v.h)&&void 0!==l?l:f.h,E=!0)}else f._targetOpacity=null!==(c=f.style.opacity)&&void 0!==c?c:1,f.style=Object.assign(Object.assign({},f.style),{opacity:0}),E=!0;else if("heatcell"===f.type)if(v){M.add(m);const e={x:f.x,y:f.y,w:f.w,h:f.h};f._targetOpacity=null!==(h=null===(u=f.style)||void 0===u?void 0:u.opacity)&&void 0!==h?h:1,v.x===e.x&&v.y===e.y||(f._targetX=e.x,f._targetY=e.y,f._targetW=e.w,f._targetH=e.h,f.x=v.x,f.y=v.y,f.w=null!==(d=v.w)&&void 0!==d?d:f.w,f.h=null!==(g=v.h)&&void 0!==g?g:f.h,E=!0)}else f._targetOpacity=null!==(y=null===(p=f.style)||void 0===p?void 0:p.opacity)&&void 0!==y?y:1,f.style=Object.assign(Object.assign({},f.style||{}),{opacity:0}),E=!0}for(const[e,t]of this.prevPathMap)if(!C.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!==(f=t.opacity)&&void 0!==f?f:1},_targetOpacity:0,_transitionKey:e,datum:null};this.exitNodes.push(n),E=!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!==(m=t.opacity)&&void 0!==m?m:1},_targetOpacity:0,_transitionKey:e,datum:null};this.exitNodes.push(n),E=!0}for(const[e,t]of this.prevPositionMap)if(!M.has(e)){if(e.startsWith("p:")){const n={type:"point",x:t.x,y:t.y,r:null!==(v=t.r)&&void 0!==v?v:3,style:{opacity:null!==(b=t.opacity)&&void 0!==b?b:1},datum:null,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}else if(e.startsWith("r:")){const n={type:"rect",x:t.x,y:t.y,w:null!==(x=t.w)&&void 0!==x?x:0,h:null!==(k=t.h)&&void 0!==k?k:0,style:{opacity:null!==(w=t.opacity)&&void 0!==w?w:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}else if(e.startsWith("h:")){const n={type:"heatcell",x:t.x,y:t.y,w:null!==(A=t.w)&&void 0!==A?A:0,h:null!==(O=t.h)&&void 0!==O?O:0,fill:"#999",datum:null,style:{opacity:null!==(S=t.opacity)&&void 0!==S?S:1},_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}E=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),E&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:j})}advanceTransition(e){var t,n,o,r,i,s;if(!this.activeTransition)return!1;const a=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),l=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(a,"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("point"===e.type){if(void 0!==e._targetOpacity){const o=t?this.prevPositionMap.get(t):void 0,r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=de(r,e._targetOpacity,l)}if(void 0===e._targetX)continue;if(!t)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=de(o.x,e._targetX,l),e.y=de(o.y,e._targetY,l),void 0!==e._targetR&&void 0!==o.r&&(e.r=de(o.r,e._targetR,l))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?this.prevPositionMap.get(t):void 0,r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=de(r,e._targetOpacity,l)}if(void 0===e._targetX)continue;if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=de(n.x,e._targetX,l),e.y=de(n.y,e._targetY,l),void 0!==n.w&&(e.w=de(n.w,e._targetW,l)),void 0!==n.h&&(e.h=de(n.h,e._targetH,l))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?this.prevPositionMap.get(t):void 0,o=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:de(o,e._targetOpacity,l)})}if(void 0===e._targetX)continue;if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=de(n.x,e._targetX,l),e.y=de(n.y,e._targetY,l),void 0!==n.w&&(e.w=de(n.w,e._targetW,l)),void 0!==n.h&&(e.h=de(n.h,e._targetH,l))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=void 0===e._prevPath&&e._targetOpacity>0?0:null!==(i=e.style.opacity)&&void 0!==i?i:1;e.style=Object.assign(Object.assign({},e.style),{opacity:de(t,e._targetOpacity,l)})}const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=de(t[o][0],n[o][0],l),e.path[o][1]=de(t[o][1],n[o][1],l)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=void 0===e._prevTopPath&&e._targetOpacity>0?0:null!==(s=e.style.opacity)&&void 0!==s?s:1;e.style=Object.assign(Object.assign({},e.style),{opacity:de(t,e._targetOpacity,l)})}const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=de(t[n][0],o[n][0],l),e.topPath[n][1]=de(t[n][1],o[n][1],l);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=de(n[t][0],r[t][0],l),e.bottomPath[t][1]=de(n[t][1],r[t][1],l)}}if(a>=1){for(const e of this.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("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0}}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}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.map;const r=Array.isArray(this.config.colorScheme)?this.config.colorScheme:ae,i=new Map;for(let e=0;n.length>e;e++)i.set(n[e],r[e%r.length]);return this._colorMapCache={key:o,map:i},i}resolveLineStyle(e,t){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}return n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}return o&&"object"==typeof o?{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2}:{fill:"#4e79a7",fillOpacity:.7,stroke:"#4e79a7",strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:ae,o=n[this._groupColorMap.size%n.length];return this._groupColorMap.set(e,o),o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}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.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,r;const i=Object.assign({},this.config);void 0!==e.colorScheme&&(this._colorMapCache=null,this._groupColorMap=new Map),void 0===e.barColors&&void 0===e.colorScheme||(this._barCategoryCache=null),void 0===e.normalize&&void 0===e.extentPadding&&void 0===e.xAccessor&&void 0===e.yAccessor&&void 0===e.groupAccessor&&void 0===e.categoryAccessor&&void 0===e.chartType||(this._stackExtentCache=null);let s=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==i.chartType||"runtimeMode"in e&&e.runtimeMode!==i.runtimeMode;if(a||void 0!==e.xAccessor||void 0!==e.yAccessor||void 0!==e.timeAccessor||void 0!==e.valueAccessor){const l=a||!te(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=i.xAccessor)&&void 0!==n?n:i.timeAccessor),c=a||!te(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(r=i.yAccessor)&&void 0!==r?r:i.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=ne(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=ne(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=ne(this.config.xAccessor,"x"),this.getY=ne(this.config.yAccessor,"y")),s=!0)}if("groupAccessor"in e&&!te(e.groupAccessor,i.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?re(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!te(e.categoryAccessor,i.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?re(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!te(e.sizeAccessor,i.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?ne(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!te(e.colorAccessor,i.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?re(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!te(e.y0Accessor,i.y0Accessor)&&(this.getY0=this.config.y0Accessor?ne(this.config.y0Accessor,"y0"):void 0,s=!0),"pointIdAccessor"in e&&!te(e.pointIdAccessor,i.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?re(this.config.pointIdAccessor):void 0,s=!0),!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==i[n]){s=!0;break}}s&&(this.needsFullRebuild=!0)}}function pe(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function ye(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>e.r+5?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:i}}function fe(e,t,n){var o,r,i,s;if(0===e.path.length)return null;const a=we(e.path,t);if(0>a)return null;const[l,c]=e.path[a];let u;if(e.path.length>1){let o=1/0;const r=Math.max(0,a-1),i=Math.min(e.path.length-2,a);for(let s=r;i>=s;s++){const[r,i]=e.path[s],[a,l]=e.path[s+1],c=me(t,n,r,i,a,l);o>c&&(o=c)}u=o}else{const e=t-l,o=n-c;u=Math.sqrt(e*e+o*o)}const h=null!==(s=null!==(r=null===(o=e.style)||void 0===o?void 0:o.strokeWidth)&&void 0!==r?r:null===(i=e.style)||void 0===i?void 0:i.lineWidth)&&void 0!==s?s:1;return u>Math.max(5,h/2+2)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:l,y:c,distance:u}}function me(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function ve(e,t,n){const o=pe(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function be(e,t,n){const o=pe(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function xe(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function ke(e,t,n){if(0===e.topPath.length)return null;const o=we(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function we(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}ge.QUADTREE_THRESHOLD=500;const Ae={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function Oe(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,Ae[n])(o(e,t)),r}function Se(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function je(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function Ee({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),s&&e.createElement("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},s&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function Me(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:h="vertical"}=t,[d,g]=e.useState(0),[p,y]=e.useState(0),f=e.useCallback((e,t)=>{g(e),y(t)},[]),m="vertical"===h?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let h=24;const d=[];return t.forEach((t,g)=>{h+=5,d.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:h,x2:n,y2:h})),h+=8,t.label&&(h+=16,d.push(e.createElement("text",{key:"legend-text-"+g,y:h,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),h+=8),d.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${h})`},((t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:g}=t,p=[];let y=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=Oe(t,u,h,d),b=je(t,r,i),x=i&&i.size>0&&i.has(t.label);p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${y})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===s&&u===a?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(Se,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),y+=22}),p})(t,o,r,i,s,a,l,g,c,u))),h+=22*t.items.length+8}),d})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:d,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:h})=>{let d=0;const g=[];t.forEach((t,n)=>{let o=0;t.label&&(o+=16);const p=((t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:g}=t,p=[];let y=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=Oe(t,u,h,d),b=je(t,r,i),x=i&&i.size>0&&i.has(t.label);p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${y},0)`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===s&&u===a?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(Se,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),y+=26+7*t.label.length}),{items:p,offset:y}})(t,r,i,s,a,l,c,n,u,h);o+=p.offset+5,g.push(Object.assign(Object.assign({label:t.label},p),{offset:o})),d+=o+12});let p=Math.max(0,(o-d)/2);const y=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(y.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),p+=16),y.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${p},0)`},o.items)),p+=o.offset+5,t[r+1]&&y.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:p,y1:-8,x2:p,y2:n+0+8})),p+=12}),e.createElement("g",null,y)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:d,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===h&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},l),m)}function Ce(e){return"string"==typeof e?{type:e}:e}function Pe({orient:t,config:n,values:o,scale:i,size:s,length:a}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(n),c="top"===t||"bottom"===t,u=r(()=>{if(0===o.length)return null;const n=i.domain(),r=s-8;if("boxplot"===l.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(o);if(!n)return null;const{q1:s,median:a,q3:u,whiskerLow:h,whiskerHigh:d}=n,g=Math.min(.5*r,20),p=(r-g)/2+4;if(c){const n=i(s),o=i(u),r=i(a),c=i(h),y=i(d),f="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+f*(p+g/2),x2:y,y2:m+f*(p+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+f*p,x2:c,y2:m+f*(p+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:y,y1:m+f*p,x2:y,y2:m+f*(p+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-p-g:m+p,width:Math.abs(o-n),height:g,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===t?m-p-g:m+p,x2:r,y2:"top"===t?m-p:m+p+g,stroke:l.fill,strokeWidth:2}))}{const n=i(s),o=i(u),r=i(a),c=i(h),y=i(d),f="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+f*(p+g/2),y1:c,x2:m+f*(p+g/2),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*p,y1:c,x2:m+f*(p+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*p,y1:y,x2:m+f*(p+g),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-p-g:m+p,y:Math.min(n,o),width:g,height:Math.abs(o-n),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===t?m-p-g:m+p,y1:r,x2:"left"===t?m-p:m+p+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=L().domain(n).thresholds(l.bins)(o);if(0===u.length)return null;const h=Math.max(...u.map(e=>e.length));if(0===h)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((n,o)=>{if(null==n.x0||null==n.x1)return null;const s=n.length/h*r;if(c){const r=i(n.x0),a=i(n.x1)-i(n.x0);return e.createElement("rect",{key:o,x:r,y:"top"===t?-4-s:4,width:Math.max(a,.5),height:s,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const r=i(n.x0),a=i(n.x1)-i(n.x0);return e.createElement("rect",{key:o,x:"left"===t?-4-s:4,y:Math.min(r,r+a),width:s,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const n=r/2+4,o=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const s=e.length/h*(r/2),a=i((e.x0+e.x1)/2);o.push(c?`${a},${"top"===t?-(n-s):n-s}`:`${"left"===t?-(n-s):n-s},${a}`)}for(let e=u.length-1;e>=0;e--){const s=u[e];if(null==s.x0||null==s.x1)continue;const a=s.length/h*(r/2),l=i((s.x0+s.x1)/2);o.push(c?`${l},${"top"===t?-(n+a):n+a}`:`${"left"===t?-(n+a):n+a},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+t},e.createElement("polygon",{points:o.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const n=[];if(c){const e=0,o=null!=u[0].x0?i(u[0].x0):0;n.push(`M${o},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,s=i((e.x0+e.x1)/2);n.push(`L${s},${"top"===t?-o-4:o+4}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;n.push(`L${s},${e}`),n.push("Z")}else{const e=0,o=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${o}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,s=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-o-4:o+4},${s}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;n.push(`L${e},${s}`),n.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+t},e.createElement("path",{d:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[o,i,l,s,a,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function Le(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function _e(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Be(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:h,color:d,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=i||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof h?h:"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.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y),!m.has("connector")&&function(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,h=o/2,d=t*h>n*u?u/t:h/n;l=r+s*d,c=i+a*d}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},a)}(v,b,c,d,x,u),!m.has("subject")&&function(t,n,o,r,i){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.createElement("path",{key:"bracket-path",d:_e((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"currentColor"}));break}}return e.createElement("g",{className:"annotation-subject"},a)}(x,u,d,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!s)return e.createElement("g",{className:"annotation-note"});let h=a;h||(h=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let d=l;d&&"dynamic"!==d||(d="topBottom"===h?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===h?"right"===d?g="end":"middle"===d&&(g="middle"):g=0>n?"end":"start";const p=16,y=s?u?[s]:Le(s,c):[],f=i?u?[i]:Le(i,c):[],m="leftRight"===h?"end"===g?-4:4:0;let v=0;const b=[];y.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:g,fontWeight:"bold"},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t)))),v=y.length*p),f.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:g,y:v},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t))));let x=null;if((s||i)&&(0!==n||0!==o))if("topBottom"===h){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(y.length+f.length)*p+(f.length>0?p:0);let n=0,o=t;"bottom"===d?(n=-t,o=0):"middle"===d&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const k=Math.max(0,y.length+f.length-1)*p;let w=0;return"topBottom"===h?w=0>o?-(k+2):18:"leftRight"===h&&(w="middle"===d?-(k+p+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===d||0>o?-(k+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0},b),x)}(l,v,b,d))}function Ne(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,s="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.createElement(Be,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:s}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Be,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:a},r,{type:s}))}const He={linear:I,monotoneX:D,monotoneY:T,step:W,stepAfter:F,stepBefore:$,basis:z,cardinal:H,catmullRom:N};function ze(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function $e(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function Fe(e,t,n){var o,r,i,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const h=l[e.xAccessor||"x"],d=l[e.yAccessor||"y"];return null==h||null==d?null:{x:c(h),y:u(d)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=ze(e,n),c=$e(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function We(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Te(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function De(t){const{width:n,height:o,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,axes:u,showGrid:h,xFormat:d,yFormat:g}=t,p=r(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),o=(null==t?void 0:t.tickFormat)||d||Ie,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=l.x.ticks(Math.min(r,Math.max(2,Math.floor(n/70)))),s=i.map(e=>e.valueOf()),a=i.map((e,t)=>({value:e,pixel:l.x(e),label:o(e,t,s)})),c=a.reduce((e,t)=>Math.max(e,6.5*t.label.length),0);return Re(a,Math.max(55,c+8))},[l,u,d,n]),y=r(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||g||Ie,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return Re(l.y.ticks(Math.min(r,Math.max(2,Math.floor(o/30)))).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,o]),f=h&&l,m=c&&l;if(!f&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,A=(null==b?void 0:b.jaggedBase)||!1,O="var(--semiotic-border, #ccc)";return e.createElement("svg",{width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},f&&e.createElement("g",{className:"stream-grid"},p.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),y.map((t,o)=>e.createElement("line",{key:"ygrid-"+o,x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),x&&!w&&e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:O,strokeWidth:1}),w&&e.createElement("path",{d:Te("bottom",n,o),fill:"none",stroke:O,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:O,strokeWidth:1}),A&&e.createElement("path",{d:Te("left",n,o),fill:"none",stroke:O,strokeWidth:1})))}function Ie(e,t,n){return Math.round(100*e)/100+""}function Re(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function Ge(e,t){return e instanceof Date&&(!(t&&t instanceof Date)||e.getFullYear()!==t.getFullYear()||e.getMonth()!==t.getMonth()||e.getDate()!==t.getDate())}function Ye(n){var o,i;const{width:s,height:a,totalWidth:l,totalHeight:c,margin:u,scales:h,showAxes:d,axes:g,xLabel:p,yLabel:y,yLabelRight:f,xFormat:m,yFormat:v,showGrid:b,title:x,legend:k,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S,legendPosition:j="right",foregroundGraphics:E,marginalGraphics:M,xValues:C,yValues:P,annotations:L,svgAnnotationRules:N,xAccessor:H,yAccessor:z,annotationData:$,pointNodes:F,curve:W,underlayRendered:T,children:D}=n,R=r(()=>{var e;if(!d||!h)return[];const t=null==g?void 0:g.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||m||Ie,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=h.x.ticks(Math.min(o,Math.max(2,Math.floor(s/70)))),i=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:h.x(e),label:n(e,t,i)})),l=a.reduce((e,t)=>Math.max(e,6.5*t.label.length),0);return Re(a,Math.max(55,l+8))},[d,h,g,m,s]),G=r(()=>{var e;if(!d||!h)return[];const t=null==g?void 0:g.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||v||Ie,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return Re(h.y.ticks(Math.min(o,Math.max(2,Math.floor(a/30)))).map(e=>({value:e,pixel:h.y(e),label:n(e)})),22)},[d,h,g,v,a]),q=r(()=>{var e;if(!d||!h)return[];const t=null==g?void 0:g.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||v||Ie,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Re(h.y.ticks(Math.min(o,Math.max(2,Math.floor(a/30)))).map(e=>({value:e,pixel:h.y(e),label:n(e)})),22)},[d,h,g,v,a]),X=t(new Map),V=t(null!==(o=null==L?void 0:L.length)&&void 0!==o?o:0),U=null!==(i=null==L?void 0:L.length)&&void 0!==i?i:0;V.current!==U&&(V.current=U,X.current=new Map);const Q=r(()=>{if(!L||0===L.length)return null;const t=function(t,n,o){var r,i,s,a,l,c,u,h,d,g,p,y,f,m,v,b,x,k,w,A,O,S,j,E,M,C,P,L,N,H,z,$,F,W,T,D,R,G,q,X,V,U,Q,K;switch(t.type){case"label":{const r=Fe(t,n,o);if(!r)return null;const{x:i,y:s}=r;return We(i,s,o)?e.createElement(Ne,{key:"ann-"+n,noteData:{x:i,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}}):null}case"callout":{const r=Fe(t,n,o);if(!r)return null;const{x:i,y:s}=r;return We(i,s,o)?e.createElement(Ne,{key:"ann-"+n,noteData:{x:i,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}}):null}case"x-threshold":{const r=ze(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:12,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=$e(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:r-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:ze(Object.assign(Object.assign({},e),{type:"point"}),o),y:$e(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=_(r),s=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.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.createElement("text",{x:i.x,y:i.y-i.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:ze(Object.assign(Object.assign({},e),{type:"point"}),o),y:$e(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...s)-i,c=Math.max(...s)+i,u=Math.min(...a)-i,h=Math.max(...a)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:h-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.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=ze(n,o),a=$e(n,o);if(null==i||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:a,r:l},c))}))}case"bracket":{const r=ze(t,o),i=$e(t,o);return e.createElement(Ne,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i: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}})}case"trend":{const h=o.data||[];if(2>h.length)return null;const d=o.xAccessor||"x",g=o.yAccessor||"y",p=h.map(e=>[e[d],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(s=o.scales)||void 0===s?void 0:s.time,f=null!==(l=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!y||!f)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,h=0,d=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*r[e],d+=t*i[e],g+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*g-h*h;if(1e-12>Math.abs(y))a.push([t,d/u]);else{const e=(u*p-h*d)/y;a.push([t,(d-e*h)/u+e*t])}}return a}(p,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?Y.polynomial(p,{order:t.order||2}):Y.linear(p)).points;const b=v.map(([e,t])=>`${y(e)},${f(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:y(v[v.length-1][0])+4,y:f(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(d=null===(h=o.scales)||void 0===h?void 0:h.y)&&void 0!==d?d:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(p=null==r?void 0:r(t.y0))&&void 0!==p?p:0,s=null!==(y=null==r?void 0:r(t.y1))&&void 0!==y?y:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,s),width:o.width||0,height:Math.abs(s-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",s=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,a=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.value;if(!s||!a)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,h=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>h.length)return null;const d=He[o.curve||"linear"]||I,g=B().x(e=>s(e[i])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(d)(h);if(!g)return null;const p=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:p,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&h.length>0&&e.createElement("text",{x:s(h[h.length-1][i])+4,y:a(h[h.length-1][l])-4,fill:p,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",s=null!==(O=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==O?O:null===(S=o.scales)||void 0===S?void 0:S.time,a=null!==(E=null===(j=o.scales)||void 0===j?void 0:j.y)&&void 0!==E?E:null===(M=o.scales)||void 0===M?void 0:M.value;if(!s||!a)return null;const l=r.map(e=>e[i]).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,h=Math.sqrt(u),d=null!==(C=t.threshold)&&void 0!==C?C:2,g=c-d*h,p=!1!==t.showBand,y=t.fill||"#6366f1",f=null!==(P=t.fillOpacity)&&void 0!==P?P:.1,m=t.anomalyColor||"#ef4444",v=null!==(L=t.anomalyRadius)&&void 0!==L?L:6,b=a(c+d*h),x=a(g),k=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>d*h});return e.createElement("g",{key:"ann-"+n},p&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:y,fillOpacity:f}),k.map((t,n)=>{const r=ze(t,o),i=$e(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(H=null===(N=o.scales)||void 0===N?void 0:N.x)&&void 0!==H?H:null===(z=o.scales)||void 0===z?void 0:z.time,l=null!==(F=null===($=o.scales)||void 0===$?void 0:$.y)&&void 0!==F?F:null===(W=o.scales)||void 0===W?void 0:W.value;if(!a||!l)return null;const c=r.map(e=>[e[i],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.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;u=e=>a+s*e}const h=c.length,d=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(d/Math.max(h-2,1)),p=c.reduce((e,t)=>e+t[0],0)/h,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),f=null!==(T=t.confidence)&&void 0!==T?T:.95,m=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,v=null!==(D=t.steps)&&void 0!==D?D:5,b=c[h-1][0],x=(b-c[0][0])/Math.max(h-1,1),k=[];for(let e=1;v>=e;e++)k.push(b+e*x);const w=[];for(const e of k){const t=u(e),n=g*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=w.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(b)},${l(u(b))}`,j=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(R=t.fillOpacity)&&void 0!==R?R:.15,stroke:"none"}),e.createElement("polyline",{points:`${S} ${O}`,fill:"none",stroke:j,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(q=t.strokeDasharray)&&void 0!==q?q:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:a(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:j,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=Fe(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!We(r,i,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,a=null!==(V=t.dy)&&void 0!==V?V:0,l=null!==(U=t.width)&&void 0!==U?U:32,c=null!==(Q=t.height)&&void 0!==Q?Q:32,u=null!==(K=t.content)&&void 0!==K?K:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=Fe(t,n,o);if(!r)return null;const{x:i,y:s}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:H,yAccessor:z,width:s,height:a,data:$,frameType:"xy",pointNodes:F,curve:W,stickyPositionCache:X.current};return L.map((e,o)=>{if(N){const r=N(e,o,n);return null!=r?r:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[L,N,s,a,H,z,$,h,F,W]);return d||x||k||E||M||Q&&Q.length>0||b||D?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof x?x:"XY Chart"),e.createElement("desc",null,"string"==typeof x?x+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},b&&h&&!T&&e.createElement("g",{className:"stream-grid"},R.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:a,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),G.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:s,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),d&&h&&(()=>{const t=null==g?void 0:g.find(e=>"left"===e.orient),n=null==g?void 0:g.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=(null==t?void 0:t.jaggedBase)||!1,i=(null==n?void 0:n.jaggedBase)||!1,l=null==n?void 0:n.landmarkTicks,c=null==t?void 0:t.landmarkTicks,h="var(--semiotic-border, #ccc)",d="var(--semiotic-text-secondary, var(--semiotic-text, #666))",m="var(--semiotic-text, #333)";return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!T&&(!n||!1!==n.baseline)&&!i&&e.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:h,strokeWidth:1}),!T&&i&&e.createElement("path",{d:Te("bottom",s,a),fill:"none",stroke:h,strokeWidth:1}),R.map((t,n)=>{const o=!!l&&("function"==typeof l?l(t.value,n):Ge(t.value,n>0?R[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${a})`},e.createElement("line",{y2:5,stroke:h,strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:d,style:{userSelect:"none"}},t.label))}),p&&e.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:m,style:{userSelect:"none"}},p),!T&&o&&!r&&e.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:h,strokeWidth:1}),!T&&r&&e.createElement("path",{d:Te("left",s,a),fill:"none",stroke:h,strokeWidth:1}),G.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):Ge(t.value,n>0?G[n-1].value:void 0));return e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:h,strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:d,style:{userSelect:"none"}},t.label))}),(()=>{const n=(null==t?void 0:t.label)||y;return n?e.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:m,transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==g?void 0:g.find(e=>"right"===e.orient);if(!t||0===q.length)return null;const n=t.landmarkTicks,o=t.label||f;return e.createElement(e.Fragment,null,!1!==t.baseline&&e.createElement("line",{x1:s,y1:0,x2:s,y2:a,stroke:h,strokeWidth:1}),q.map((t,o)=>{const r=!!n&&("function"==typeof n?n(t.value,o):Ge(t.value,o>0?q[o-1].value:void 0));return e.createElement("g",{key:"ytick-r-"+o,transform:`translate(${s},${t.pixel})`},e.createElement("line",{x2:5,stroke:h,strokeWidth:1}),e.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:d,style:{userSelect:"none"}},t.label))}),o&&e.createElement("text",{x:s+u.right-15,y:a/2,textAnchor:"middle",fontSize:12,fill:m,transform:`rotate(90, ${s+u.right-15}, ${a/2})`,style:{userSelect:"none"}},o))})())})(),Q,M&&h&&C&&P&&e.createElement(e.Fragment,null,M.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Pe,{orient:"top",config:Ce(M.top),values:C,scale:h.x,size:u.top,length:s})),M.bottom&&e.createElement("g",{transform:`translate(0, ${a})`},e.createElement(Pe,{orient:"bottom",config:Ce(M.bottom),values:C,scale:h.x,size:u.bottom,length:s})),M.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Pe,{orient:"left",config:Ce(M.left),values:P,scale:h.y,size:u.left,length:a})),M.right&&e.createElement("g",{transform:`translate(${s}, 0)`},e.createElement(Pe,{orient:"right",config:Ce(M.right),values:P,scale:h.y,size:u.right,length:a}))),E,D),x&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof x?x:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=i.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=r-i.bottom+50):(p=o-i.right+10,y=i.top),e.createElement("g",{transform:`translate(${p}, ${y})`},"object"==typeof(f=n)&&null!==f&&"gradient"in f?e.createElement(Ee,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(Me,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):n);var f}({legend:k,totalWidth:l,totalHeight:c,margin:u,legendPosition:j,title:x,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S})):null}function qe(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Xe="undefined"==typeof window||"undefined"==typeof document,Ve={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ue(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks"},i=["point","line","area","rect","heatcell","circle","candlestick"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function Qe({scene:t,chartType:n}){var o,r,i,s;const a=[];for(const e of t){if(a.length>=50)break;"point"===e.type?a.push({label:"Point",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+""}}):"rect"===e.type?a.push({label:"Bar",values:{category:(null===(o=e.datum)||void 0===o?void 0:o.category)||"",value:Math.round(100*(null!==(i=null===(r=e.datum)||void 0===r?void 0:r.value)&&void 0!==i?i:0))/100+""}}):"heatcell"===e.type&&a.push({label:"Cell",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+"",value:Math.round(100*(null!==(s=e.value)&&void 0!==s?s:0))/100+""}})}if(0===a.length)return null;const l=new Set;for(const e of a)for(const t of Object.keys(e.values))l.add(t);const c=Array.from(l);return e.createElement("table",{style:Ve,role:"table","aria-label":"Data table for "+n},e.createElement("thead",null,e.createElement("tr",null,c.map(t=>e.createElement("th",{key:t},t)))),e.createElement("tbody",null,a.map((t,n)=>e.createElement("tr",{key:n},c.map(n=>{var o;return e.createElement("td",{key:n},null!==(o=t.values[n])&&void 0!==o?o:"")}))),t.length>50&&e.createElement("tr",null,e.createElement("td",{colSpan:c.length},"...and ",t.length-50," more items"))))}function Ke({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:Ve},n)}function Ze(n){const o=i(null),c=Je(n);return[function({children:t}){const i=r(()=>Je(n),[]);return e.createElement(o.Provider,{value:i,children:t})},e=>{var n;const r=null!==(n=s(o))&&void 0!==n?n:c,i=t(e);i.current=e;const u=a(()=>i.current(r.getState()),[r]),h=a(()=>i.current(r.getState()),[r]);return l(r.subscribe,u,h)}]}function Je(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const et={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},tt={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},nt={mode:"light",colors:{primary:"#0000cc",categorical:["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},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"},[ot,rt]=Ze(e=>({theme:et,setTheme(t){e(e=>{if("light"===t)return{theme:et};if("dark"===t)return{theme:tt};if("high-contrast"===t)return{theme:nt};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?tt:et;return{theme:Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})})}}return{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}}));function it(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function st(e){switch(e){case"monotoneX":return D;case"monotoneY":return T;case"cardinal":return H;case"catmullRom":return N;case"step":return W;case"stepBefore":return $;case"stepAfter":return F;case"basis":return z;case"natural":return G;default:return null}}function at(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function lt(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function ct(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function ut(e,t,n=.3){ct(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function ht(e,t,n=.6){var o,r,i,s,a;if(!ct(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,h=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,h,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function dt(e,t,n,o=.35){ct(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function gt(e){switch(e){case"monotoneX":return D;case"monotoneY":return T;case"cardinal":return H;case"catmullRom":return N;case"step":return W;case"stepBefore":return $;case"stepAfter":return F;case"basis":return z;case"natural":return G;default:return null}}function pt(e){if(e.startsWith("#")){const t=4===e.length?e[1]+e[1]+e[2]+e[2]+e[3]+e[3]:e.slice(1,7);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[78,121,167]}function yt(e,t){const n=gt(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=B().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const ft=(e,t,n,o)=>{var r,i,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;const n=t.style.fill||"#4e79a7",o=t._decayOpacities;if(o&&o.length===t.topPath.length){const i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;e.fillStyle=n;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(o[n]+o[n+1])*i,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=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(o[n]+o[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=null!==(i=t.style.opacity)&&void 0!==i?i:1;if(yt(e,t),t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let r=-1/0;for(const e of t.bottomPath)e[1]>r&&(r=e[1]);const i=pt("string"==typeof n?n:"#4e79a7"),s=t.fillGradient.topOpacity,l=t.fillGradient.bottomOpacity,c=e.createLinearGradient(0,o,0,r);c.addColorStop(0,`rgba(${i[0]},${i[1]},${i[2]},${s})`),c.addColorStop(1,`rgba(${i[0]},${i[1]},${i[2]},${l})`),e.fillStyle=c,e.globalAlpha=a}else{const o=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=o*a,e.fillStyle=n}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(yt(e,t),dt(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a,e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=gt(t.curve);if(e.beginPath(),n)R().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 n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}e.globalAlpha=1}},mt=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),ht(e,t),e.globalAlpha=1}}finally{e.restore()}},vt=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?bt(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),ut(e,t),e.globalAlpha=1};function bt(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}function xt(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function kt(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const wt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function At(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${wt[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${wt[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Ot={line:[ft,(e,t,n,o)=>{var r,i;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a.style.stroke||"#007bff",c=a.style.strokeWidth||2,u=a.colorThresholds,h=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=c,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const y=null!==(r=a.style.opacity)&&void 0!==r?r:1;lt(e,a.path,l,c,y,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const d=st(a.curve),g=u&&u.length>0&&h&&h.length===a.path.length,p=a._decayOpacities;if(p&&p.length===a.path.length&&!g){e.strokeStyle=l;const f=null!==(i=a.style.opacity)&&void 0!==i?i:1;for(let m=0;a.path.length-1>m;m++)e.globalAlpha=.5*(p[m]+p[m+1])*f,e.beginPath(),e.moveTo(a.path[m][0],a.path[m][1]),e.lineTo(a.path[m+1][0],a.path[m+1][1]),e.stroke()}else if(g){let v=null,b=null,x=null,k=null,w=!1;function A(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),w=!0}function O(){w&&(e.stroke(),w=!1)}for(let S=0;a.path.length>S;S++){const[j,E]=a.path[S],M=h[S],C=at(M,u,l);if(null!==v&&null!==k&&null!==x){if(C===k)e.lineTo(j,E);else{const P=[];for(const L of u){const _=L.value;(x>_||_>M)&&(_>x||M>_)||x===_||M===_||P.push({t:(_-x)/(M-x)})}P.sort((e,t)=>e.t-t.t);for(const B of P){const N=v+(j-v)*B.t,H=b+(E-b)*B.t,z=at(x+(M-x)*Math.min(B.t+1e-4,1),u,l);e.lineTo(N,H),O(),A(z,N,H)}e.lineTo(j,E)}v=j,b=E,x=M,k=C}else A(C,j,E),v=j,b=E,x=M,k=C}O()}else{if(e.beginPath(),e.strokeStyle=l,d)R().x(e=>e[0]).y(e=>e[1]).curve(d).context(e)(a.path);else{const[$,F]=a.path[0];e.moveTo($,F);for(let W=1;a.path.length>W;W++)e.lineTo(a.path[W][0],a.path[W][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=a.style.fill,d&&!g)R().x(e=>e[0]).y(e=>e[1]).curve(d).context(e)(a.path);else{const[D,I]=a.path[0];e.moveTo(D,I);for(let G=1;a.path.length>G;G++)e.lineTo(a.path[G][0],a.path[G][1])}const T=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(T,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}}],area:[ft],stackedarea:[ft],scatter:[mt],bubble:[mt],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle="#fff",e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),ut(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):kt(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=xt(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[vt],swarm:[mt],waterfall:[(e,t,n,o)=>{var r,i,s;vt(e,t);const a=t.filter(e=>"rect"===e.type);if(2>a.length)return;const l=a[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=c,e.lineWidth=null!==(r=null==l?void 0:l._connectorWidth)&&void 0!==r?r:1,e.setLineDash([]);for(let t=0;a.length-1>t;t++){const o=a[t],r=a[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(s=r.datum)||void 0===s?void 0:s.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=r.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const o=t._decayOpacity;null!=o&&1!==o&&(e.globalAlpha=o),e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke();const r=Math.min(t.openY,t.closeY),i=Math.abs(t.openY-t.closeY),s=t.isUp?t.upColor:t.downColor;e.fillStyle=s,e.fillRect(t.x-t.bodyWidth/2,r,t.bodyWidth,Math.max(i,1)),e.strokeStyle=s,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,r,t.bodyWidth,Math.max(i,1)),e.restore()}}]},St={top:20,right:20,bottom:30,left:40},jt={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"},Et={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 Mt({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:Et},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}function Ct({width:n,height:r,totalWidth:i,totalHeight:s,margin:a,dimension:l,scales:c,onBrush:u}){const h=t(null),f=t(null),m=t(u);m.current=u;const v=t(c);return v.current=c,o(()=>{if(!h.current)return;const e=y(h.current).select(".brush-g"),t="x"===l?d():"y"===l?g():p();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{const t=v.current;if(!t)return;if(!e.selection)return void m.current(null);let o,i;if("x"===l){const[n,s]=e.selection;o=[t.x.invert(n),t.x.invert(s)],i=[t.y.invert(r),t.y.invert(0)]}else if("y"===l){const[r,s]=e.selection;o=[t.x.invert(0),t.x.invert(n)],i=[t.y.invert(s),t.y.invert(r)]}else{const[[n,r],[s,a]]=e.selection;o=[t.x.invert(n),t.x.invert(s)],i=[t.y.invert(a),t.y.invert(r)]}m.current({x:o,y:i})}),e.call(t),f.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),f.current=null}},[n,r,l]),e.createElement("svg",{ref:h,width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`}))}const Pt=c(function(i,s){var l,c,h,d,g,p,y,f,m;const{chartType:v,runtimeMode:b,data:x,chunkThreshold:k,chunkSize:w,xAccessor:A,yAccessor:O,colorAccessor:S,sizeAccessor:j,groupAccessor:E,lineDataAccessor:M,curve:C,normalize:P,binSize:L,valueAccessor:_,arrowOfTime:B="right",windowMode:N="sliding",windowSize:H=200,timeAccessor:z,xExtent:$,yExtent:F,extentPadding:W=.1,sizeRange:T,size:D=[500,300],responsiveWidth:I,responsiveHeight:R,margin:G,className:Y,background:X,lineStyle:V,pointStyle:U,areaStyle:Q,waterfallStyle:K,swarmStyle:Z,barColors:J,colorScheme:ee,boundsAccessor:te,boundsStyle:ne,y0Accessor:oe,gradientFill:re,openAccessor:ie,highAccessor:se,lowAccessor:ae,closeAccessor:le,candlestickStyle:ce,showAxes:ue=!0,axes:he,xLabel:de,yLabel:pe,yLabelRight:me,xFormat:we,yFormat:Ae,tickFormatTime:Oe,tickFormatValue:Se,hoverAnnotation:je,tooltipContent:Ee,customHoverBehavior:Me,enableHover:Ce,annotations:Pe,svgAnnotationRules:Le,showGrid:_e,legend:Be,legendHoverBehavior:Ne,legendClickBehavior:He,legendHighlightedCategory:ze,legendIsolatedCategories:$e,legendPosition:Fe,backgroundGraphics:We,foregroundGraphics:Te,canvasPreRenderers:Ie,svgPreRenderers:Re,title:Ge,categoryAccessor:Ve,brush:Ze,onBrush:Je,decay:et,pulse:tt,transition:nt,staleness:ot,heatmapAggregation:st,heatmapXBins:at,heatmapYBins:lt,showValues:ct,heatmapValueFormat:ut,marginalGraphics:ht,pointIdAccessor:dt,xScaleType:gt,yScaleType:pt,accessibleTable:yt}=i,[ft,mt]=function(e,r,i){const s=t(null),[a,l]=n(null);return o(()=>{if(!r&&!i)return;const e=s.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[r,i]),[s,[r&&a?a.w:e[0],i&&a?a.h:e[1]]]}(D,I,R),vt=Object.assign(Object.assign({},St),G);if(ht){const e=60;ht.top&&e>vt.top&&(vt.top=e),ht.bottom&&e>vt.bottom&&(vt.bottom=e),ht.left&&e>vt.left&&(vt.left=e),ht.right&&e>vt.right&&(vt.right=e)}const bt=mt[0]-vt.left-vt.right,xt=mt[1]-vt.top-vt.bottom,kt="function"==typeof Te?Te({size:mt,margin:vt}):Te,wt="function"==typeof We?We({size:mt,margin:vt}):We,Et=null!=je?je:Ce,Pt=t(null),Lt=t(null),_t=t(0),Bt=t(!1),Nt=rt(e=>e.theme),[Ht,zt]=n(0),[$t,Ft]=n(null),Wt=t(null),Tt=t(null),[Dt,It]=n(null),[Rt,Gt]=n(!1),[Yt,qt]=n([]),[Xt,Vt]=n([]),Ut=t(()=>{}),Qt="streaming"===b||["bar","swarm","waterfall"].includes(v),Kt=r(()=>({chartType:v,runtimeMode:Qt?"streaming":"bounded",windowSize:H,windowMode:N,arrowOfTime:Qt?B:"right",extentPadding:W,xAccessor:Qt?void 0:A,yAccessor:Qt?void 0:O,timeAccessor:Qt?z:void 0,valueAccessor:_,colorAccessor:S,sizeAccessor:j,groupAccessor:E,categoryAccessor:Ve,lineDataAccessor:M,xScaleType:gt,yScaleType:pt,xExtent:$,yExtent:F,sizeRange:T,binSize:L,normalize:P,boundsAccessor:te,boundsStyle:ne,y0Accessor:oe,gradientFill:"boolean"==typeof re?re?{topOpacity:.8,bottomOpacity:.05}:void 0:re,openAccessor:ie,highAccessor:se,lowAccessor:ae,closeAccessor:le,candlestickStyle:ce,lineStyle:V,pointStyle:U,areaStyle:Q,swarmStyle:Z,waterfallStyle:K,colorScheme:ee,barColors:J,annotations:Pe,decay:et,pulse:tt,transition:nt,staleness:ot,heatmapAggregation:st,heatmapXBins:at,heatmapYBins:lt,showValues:ct,heatmapValueFormat:ut,pointIdAccessor:dt,curve:C}),[v,H,N,B,W,A,O,z,_,gt,pt,S,j,E,Ve,M,$,F,T,L,P,te,ne,oe,re,ie,se,ae,le,ce,V,U,Q,Z,K,ee,J,Pe,et,tt,nt,ot,st,at,lt,ct,ut,Qt,dt,C]),Zt=t(null);Zt.current||(Zt.current=new ge(Kt));const Jt=a(()=>{_t.current||(_t.current=requestAnimationFrame(()=>Ut.current()))},[]);o(()=>{var e;null===(e=Zt.current)||void 0===e||e.updateConfig(Kt),Bt.current=!0,Jt()},[Kt,Jt]),o(()=>{Bt.current=!0,Jt()},[Nt,Jt]);const en=t(null);en.current||(en.current=new q(e=>{const t=Zt.current;t&&t.ingest(e)&&(Bt.current=!0,Jt())},{chunkThreshold:k,chunkSize:w})),o(()=>{var e;null===(e=en.current)||void 0===e||e.updateChunkOptions({chunkThreshold:k,chunkSize:w})},[k,w]);const tn=a(e=>{var t;null===(t=en.current)||void 0===t||t.push(e)},[]),nn=a(e=>{var t;null===(t=en.current)||void 0===t||t.pushMany(e)},[]),on=a(()=>{var e,t;null===(e=en.current)||void 0===e||e.clear(),null===(t=Zt.current)||void 0===t||t.clear(),Bt.current=!0,Jt()},[Jt]);u(s,()=>({push:tn,pushMany:nn,clear:on,getData:()=>{var e,t,n;return null===(e=en.current)||void 0===e||e.flush(),null!==(n=null===(t=Zt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Zt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Zt.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[tn,nn,on]),o(()=>{var e;x&&(null===(e=en.current)||void 0===e||e.setBoundedData(x))},[x]);const rn=t(()=>{}),sn=t(()=>{});rn.current=e=>{if(!Et)return;const t=Pt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-vt.left,r=e.clientY-n.top-vt.top;if(0>o||o>bt||0>r||r>xt)return void(Wt.current&&(Wt.current=null,Tt.current=null,It(null),Me&&(Me(null),Bt.current=!0),Jt()));const i=Zt.current;if(!i||0===i.scene.length)return;const s=function(e,t,n,o=30,r){let i=null,s=!1;if(r){const e=r.find(t,n,o);if(e){const r=ye(e,t,n);r&&o>r.distance&&(i=r,s=!0)}}for(const a of e){let e=null;switch(a.type){case"point":if(r&&s)break;e=ye(a,t,n);break;case"line":e=fe(a,t,n);break;case"rect":e=ve(a,t,n);break;case"heatcell":e=be(a,t,n);break;case"area":if(!1===a.interactive)break;e=ke(a,t,n);break;case"candlestick":e=xe(a,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(i.scene,o,r,30,i.quadtree);if(!s)return void(Wt.current&&(Wt.current=null,Tt.current=null,It(null),Me&&Me(null),Jt()));const a=s.datum||{},l=Object.assign(Object.assign({},"object"!=typeof a||null===a||Array.isArray(a)?{}:a),{data:a,time:s.x,value:s.y,x:s.x,y:s.y});Wt.current=l,Tt.current=s.node,It(l),Me&&(Me(l),Bt.current=!0),Jt()},sn.current=()=>{Wt.current&&(Wt.current=null,Tt.current=null,It(null),Me&&(Me(null),Bt.current=!0),Jt())},a(e=>rn.current(e),[]);const an=a(()=>sn.current(),[]),ln=t(-1),cn=a(e=>{const t=Zt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum});break;case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[];for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n]});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[];for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n]});break}case"rect":case"heatcell":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=0>ln.current?-1:ln.current,r=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return ln.current=-1,Wt.current=null,Tt.current=null,It(null),Me&&Me(null),void Jt();const i=0>o?0:r;ln.current=i;const s=function(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}(n[i]);Wt.current=s,It(s),Me&&Me(s),Jt()},[Me,Jt]),un=a(e=>{ln.current=-1,rn.current(e)},[]);Ut.current=()=>{var e,t;_t.current=0;const n=Pt.current,o=Lt.current;if(!n||!o)return;const r=Zt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(i),a=Bt.current||s;a&&!s&&r.computeScene({width:bt,height:xt});const l="undefined"!=typeof window&&window.devicePixelRatio||1,c=function(e){if(!e)return jt;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=o||t.getPropertyValue("--text-secondary").trim(),s=t.getPropertyValue("--text-primary").trim(),a=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||s||n?{axisStroke:a||jt.axisStroke,tickText:i||jt.tickText,crosshair:i?i+"66":jt.crosshair,hoverFill:l?l+"4D":jt.hoverFill,hoverStroke:i?i+"99":jt.hoverStroke,pointRing:l||jt.pointRing}:jt}(n),u=null!==(e=null==ot?void 0:ot.threshold)&&void 0!==e?e:5e3,h=ot&&r.lastIngestTime>0&&i-r.lastIngestTime>u;if(a){const e=it(n,mt,vt,l);if(e){e.clearRect(-vt.left,-vt.top,mt[0],mt[1]),h&&(e.globalAlpha=null!==(t=null==ot?void 0:ot.dimOpacity)&&void 0!==t?t:.5);const o=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=X||(o&&"transparent"!==o?o:null);if(i&&(e.fillStyle=i,e.fillRect(-vt.left,-vt.top,mt[0],mt[1])),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,bt,xt),e.clip()),Ie&&r.scales)for(const t of Ie)e.save(),t(e,r.scene,r.scales,{width:bt,height:xt}),e.restore();const s=Ot[v];if(s&&r.scales)for(const t of s)t(e,r.scene,r.scales,{width:bt,height:xt});e.restore(),h&&(e.globalAlpha=1)}}{const e=it(o,mt,vt,l);if(e&&(e.clearRect(-vt.left,-vt.top,mt[0],mt[1]),Et&&Wt.current&&r.scales&&function(e,t,n,o,r,i,s){var a;if(!1===r.crosshair)return;e.save();const l="object"==typeof r.crosshair?r.crosshair:{};e.strokeStyle=l.stroke||s.crosshair,e.lineWidth=l.strokeWidth||1,e.setLineDash(l.strokeDasharray?l.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(t.x,0),e.lineTo(t.x,o),e.stroke(),e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke(),e.restore();let c="";try{(null===(a=e.canvas)||void 0===a?void 0:a.parentElement)&&(c=getComputedStyle(e.canvas).getPropertyValue("--semiotic-primary").trim())}catch(e){}const u=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||c||"#007bff";e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=u,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}(e,Wt.current,bt,xt,"object"==typeof Et?Et:{},Tt.current,c),Tt.current&&Array.isArray(je))){const t=je.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o){var r;if(!n)return;const i=n.group;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?o.style(n.datum):o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||"#007bff",e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,r.scene,Tt.current,t)}}a&&n&&n.setAttribute("aria-label",Ue(r.scene,v+" chart"));const d=Bt.current;if(Bt.current=!1,d&&r.scales&&((!$t||$t.x.domain()[0]!==r.scales.x.domain()[0]||$t.x.domain()[1]!==r.scales.x.domain()[1]||$t.y.domain()[0]!==r.scales.y.domain()[0]||$t.y.domain()[1]!==r.scales.y.domain()[1]||$t.x.range()[0]!==r.scales.x.range()[0]||$t.x.range()[1]!==r.scales.x.range()[1]||$t.y.range()[0]!==r.scales.y.range()[0]||$t.y.range()[1]!==r.scales.y.range()[1])&&Ft(r.scales),ht)){const e=r.getData(),t="function"==typeof A?A:e=>e[A||"x"],n="function"==typeof O?O:e=>e[O||"y"];qt(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Vt(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}d&&Pe&&Pe.length>0&&zt(e=>e+1),(null==ot?void 0:ot.showBadge)&&Gt(!!h),(s||r.hasActivePulses)&&(_t.current=requestAnimationFrame(()=>Ut.current()))},o(()=>(Jt(),()=>{_t.current&&(cancelAnimationFrame(_t.current),_t.current=0)}),[Jt]),o(()=>{Bt.current=!0,Jt()},[v,bt,xt,ue,X,V,Ie,Jt]),function(e,t,n,r,i,s){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}(ot,Zt,Bt,Jt,Rt,Gt);const hn=r(()=>{if(we||Oe)return;const e=Zt.current;return(null==e?void 0:e.xIsDate)&&$t?At($t.x.domain()):void 0},[we,Oe,$t]),dn=we||Oe||hn,gn=Et&&Dt?Ee?Ee(Dt):e.createElement(Mt,{hover:Dt}):null,pn=gn?e.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:vt.left+Dt.x,top:vt.top+Dt.y,transform:`translate(${Dt.x>.7*bt?"calc(-100% - 12px)":"12px"}, ${.3*xt>Dt.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1,width:"max-content"}},gn):null,yn=ln.current>=0&&Dt?e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:mt[0],height:mt[1],pointerEvents:"none",zIndex:2}},e.createElement("circle",{cx:Dt.x+vt.left,cy:Dt.y+vt.top,r:8,fill:"none",stroke:"var(--accent, #6366f1)",strokeWidth:2,strokeDasharray:"4,2"})):null;if(Xe){const t=Zt.current;t&&x&&(t.ingest({inserts:x,bounded:!0}),t.computeScene({width:bt,height:xt}));const n=null!==(l=null==t?void 0:t.scene)&&void 0!==l?l:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r=dn||(()=>{if((null==t?void 0:t.xIsDate)&&o)return At(o.x.domain())})();return e.createElement("div",{className:"stream-xy-frame"+(Y?" "+Y:""),role:"img","aria-label":"string"==typeof Ge?Ge:"XY chart",style:{position:"relative",width:mt[0],height:mt[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:mt[0],height:mt[1],style:{position:"absolute",left:0,top:0}},wt,e.createElement("g",{transform:`translate(${vt.left},${vt.top})`},X&&e.createElement("rect",{x:0,y:0,width:bt,height:xt,fill:X}),Re&&o&&Re.map((t,r)=>e.createElement(e.Fragment,{key:"svgpre-"+r},t(n,o,{width:bt,height:xt}))),n.map((t,n)=>function(t,n){var o,r,i;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const r="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"line-"+n,d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})}case"area":{const i=t;if(0===i.topPath.length)return null;const s=i.topPath.map(([e,t])=>`${e},${t}`).join("L"),a=[...i.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"area-"+n,d:`M${s}L${a}Z`,fill:qe(i.style.fill),fillOpacity:null!==(r=null!==(o=i.style.fillOpacity)&&void 0!==o?o:i.style.opacity)&&void 0!==r?r:.7,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})}case"point":{const o=t;return e.createElement("circle",{key:"point-"+n,cx:o.x,cy:o.y,r:o.r,fill:qe(o.style.fill),opacity:null!==(i=o.style.opacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"rect":{const o=t;return e.createElement("rect",{key:"rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:qe(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[r,i,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]}(o.fill),a=.299*r+.587*i+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.createElement("g",{key:"heatcell-"+n},e.createElement("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.createElement("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px"},t))}return e.createElement("rect",{key:"heatcell-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill})}case"candlestick":{const o=t,r=Math.min(o.openY,o.closeY),i=Math.max(Math.abs(o.openY-o.closeY),1),s=o.isUp?o.upColor:o.downColor;return e.createElement("g",{key:"candle-"+n},e.createElement("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.createElement("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:i,fill:s,stroke:s,strokeWidth:1}))}default:return null}}(t,n)).filter(Boolean))),e.createElement(Ye,{width:bt,height:xt,totalWidth:mt[0],totalHeight:mt[1],margin:vt,scales:o,showAxes:ue,axes:he,xLabel:de,yLabel:pe,yLabelRight:me,xFormat:r,yFormat:Ae||Se,showGrid:_e,title:Ge,legend:Be,legendHoverBehavior:Ne,legendClickBehavior:He,legendHighlightedCategory:ze,legendIsolatedCategories:$e,legendPosition:Fe,foregroundGraphics:kt,marginalGraphics:ht,xValues:[],yValues:[],annotations:Pe,svgAnnotationRules:Le,annotationFrame:0,xAccessor:"string"==typeof A?A:"string"==typeof z?z:void 0,yAccessor:"string"==typeof O?O:"string"==typeof _?_:void 0,annotationData:null==t?void 0:t.getData(),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof C?C:void 0}))}return e.createElement("div",{ref:ft,className:"stream-xy-frame"+(Y?" "+Y:""),role:"img","aria-label":"string"==typeof Ge?Ge:"XY chart",tabIndex:0,style:{position:"relative",width:I?"100%":mt[0],height:R?"100%":mt[1],overflow:"visible"},onMouseMove:Et?un:void 0,onMouseLeave:Et?an:void 0,onKeyDown:cn},wt&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:mt[0],height:mt[1],pointerEvents:"none"}},wt),e.createElement(De,{width:bt,height:xt,totalWidth:mt[0],totalHeight:mt[1],margin:vt,scales:$t,showAxes:ue,axes:he,showGrid:_e,xFormat:dn,yFormat:Ae||Se}),e.createElement("canvas",{ref:Pt,"aria-label":Ue(null!==(d=null===(h=Zt.current)||void 0===h?void 0:h.scene)&&void 0!==d?d:[],v+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:Lt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(Ke,{hoverPoint:Dt}),yt&&e.createElement(Qe,{scene:null!==(p=null===(g=Zt.current)||void 0===g?void 0:g.scene)&&void 0!==p?p:[],chartType:v+" chart"}),e.createElement(Ye,{width:bt,height:xt,totalWidth:mt[0],totalHeight:mt[1],margin:vt,scales:$t,showAxes:ue,axes:he,xLabel:de,yLabel:pe,yLabelRight:me,xFormat:dn,yFormat:Ae||Se,showGrid:_e,title:Ge,legend:Be,legendHoverBehavior:Ne,legendClickBehavior:He,legendHighlightedCategory:ze,legendIsolatedCategories:$e,legendPosition:Fe,foregroundGraphics:kt,marginalGraphics:ht,xValues:Yt,yValues:Xt,annotations:Pe,svgAnnotationRules:Le,annotationFrame:Ht,xAccessor:"string"==typeof A?A:"string"==typeof z?z:void 0,yAccessor:"string"==typeof O?O:"string"==typeof _?_:void 0,annotationData:null===(y=Zt.current)||void 0===y?void 0:y.getData(),pointNodes:null===(f=Zt.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type),curve:"string"==typeof C?C:void 0,underlayRendered:!0}),(Ze||Je)&&e.createElement(Ct,{width:bt,height:xt,totalWidth:mt[0],totalHeight:mt[1],margin:vt,dimension:null!==(m=null==Ze?void 0:Ze.dimension)&&void 0!==m?m:"xy",scales:$t,onBrush:null!=Je?Je:()=>{}}),(null==ot?void 0:ot.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ot.badgePosition?{top:4,left:4}:"bottom-left"===ot.badgePosition?{bottom:4,left:4}:"bottom-right"===ot.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Rt?"#dc3545":"#28a745",color:"white"})},Rt?"STALE":"LIVE"),yn,pn)});Pt.displayName="StreamXYFrame";const Lt=i(null);function _t(){return s(Lt)}function Bt(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Nt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Ht,zt]=Ze(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Nt(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Nt(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[$t,Ft]=Ze(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Wt(e){const t=h(),n=e.clientId||t,{name:o}=e,i=zt(e=>e.selections.get(o)),s=zt(e=>e.setClause),l=zt(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Bt(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:a(()=>{l(o,n)},[l,o,n]),clientId:n}}function Tt(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Wt({name:t});return{onHover:a(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,s,t]),predicate:o,isActive:r}}function Dt(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:l,clear:c}=Wt({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",h=a(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,n,o,l,c]);return{brushInteraction:r(()=>({brush:u,during:h,end:h}),[u,h]),predicate:i,isActive:s,clear:c}}const It=i(!1);function Rt({selections:e}){const t=zt(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function Gt({categoryColors:r,interaction:i,selectionName:s,field:l}){const c=Object.entries(r);if(0===c.length)return null;const u=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],d=Tt({name:s,fields:[l]}),g=Wt({name:s,clientId:"__linked-legend-isolate__"}),[p,y]=n(new Set),[f,m]=n(null),v=t(g.selectPoints);v.current=g.selectPoints;const b=t(g.clear);b.current=g.clear,o(()=>{"isolate"===i&&(p.size>0?v.current({[l]:Array.from(p)}):b.current())},[i,p,l]);const x=a(e=>{"highlight"===i&&(e?(m(e.label),d.onHover({[l]:e.label})):(m(null),d.onHover(null)))},[i,l,d]),k=a(e=>{"isolate"===i&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[i,u.length]);return e.createElement("svg",{width:"100%",height:30,style:{display:"block",overflow:"visible"}},e.createElement(Me,{legendGroups:h,title:!1,orientation:"horizontal",height:20,customHoverBehavior:"highlight"===i?x:void 0,customClickBehavior:"isolate"===i?k:void 0,highlightedCategory:f,isolatedCategories:p}))}function Yt({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:s="legend",legendField:a="category"}){const l=_t(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(Ht,null,e.createElement($t,null,n&&e.createElement(Rt,{selections:n}),e.createElement(It.Provider,{value:c},c&&"top"===r&&l&&e.createElement(Gt,{categoryColors:l,interaction:i,selectionName:s,field:a}),t,c&&"bottom"===r&&l&&e.createElement(Gt,{categoryColors:l,interaction:i,selectionName:s,field:a}))))}function qt({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):ae[i%ae.length];return{label:r+"",color:a}}),label:""}]}}function Xt(e){return e?"string"==typeof e?{name:e}:e:null}function Vt(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}e.createContext(void 0);const Ut="#007bff";function Qt(e){return"function"==typeof e?e:t=>t[e]}function Kt(e,t,n="category10"){const o=_t();return r(()=>{if(t){if(0===e.length)return o&&Object.keys(o).length>0?e=>o[e]||"#999":void 0;if("function"==typeof t){const r=Array.from(new Set(e.map(e=>t(e)+"")));return o&&Object.keys(o).length>0?e=>o[e]||"#999":ue(r.map(e=>({_cat:e})),"_cat",n)}if(o&&Object.keys(o).length>0){const r=ue(e,t,n);return e=>o[e]||r(e)}return ue(e,t,n)}},[e,t,n,o])}function Zt({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:i,chartId:s}){const l=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}:null}(t,n),c=Wt({name:(null==e?void 0:e.name)||"__unused__"}),u=Tt({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||n||[]}),h=Ft(e=>e.pushObservation),d=e?{isActive:c.isActive,predicate:c.predicate}:null,g=a(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(r||h){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const s=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),h&&h(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),h&&h(e)}}},[t,u,r,i,s,h]),p=a(e=>{var t,n;if(r||h){const o={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const s=Object.assign(Object.assign({},o),{type:"click",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),h&&h(s)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),h&&h(e)}}},[r,h,i,s]);return{activeSelectionHook:d,customHoverBehavior:g,customClickBehavior:p}}function Jt({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(It),h=void 0!==o?o:!u&&!!t,d=r(()=>{if(h&&t)return qt({data:e,colorBy:t,colorScale:n,getColor:ce,categories:c})},[h,t,e,n,c]),g=r(()=>{const e=Object.assign(Object.assign({},l),a);return d&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[l,a,d,i]);return{legend:d,margin:g,legendPosition:i}}function en(e,t,o){const[i,s]=n(null),[l,c]=n(new Set),u=a(t=>{"highlight"===e&&s(t?t.label:null)},[e]),h=a(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),d=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===i}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,i,l]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:u,onLegendClick:h,legendSelectionHook:d}}const tn={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function nn(e,t,n){var o,r,i,s,a,l;const c=tn[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?c.width:n.width,height:null!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?c.height:n.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||c.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:on(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function on(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}const rn={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function sn(e,t){return"function"==typeof t?t(e):e[t]}function an(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":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 ln(t={}){const{fields:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=sn(t,o);a=an(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=sn(t,o);l.push({label:n,value:an(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=an(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=an(t[e[0]],r))}}const c=Object.assign(Object.assign({},rn),i);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},a&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&a?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function cn(t){if(!0===t)return ln();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:rn},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?ln(t):ln())}function un(e){return"string"==typeof e?e:"value"}function hn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function dn(e,t){return"function"==typeof t?t(e):e[t]}function gn(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const r=t.data;if(!r)return null;const i=n?hn(dn(r,n.accessor)):null;return e.createElement("div",{className:"semiotic-tooltip",style:rn},i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=hn(dn(r,t.accessor));return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.7}},t.label,": "),e.createElement("span",null,o))}))}}function pn({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,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"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("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}},o)))}class yn extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(pn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function fn(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function mn(e,t,n=3){let o,r=n+1;for(const n of t){const t=fn(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function vn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function bn(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=mn(e,t,3))&&void 0!==n?n:null)}function xn({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=vn(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=bn(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const kn={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"}},wn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},An={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},On=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Sn=["vertical","horizontal"],jn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),wn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:On},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),wn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:On},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),wn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:On},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),wn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),wn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),wn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),wn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),wn),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),wn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),An),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Sn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),An),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Sn},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),An),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Sn},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),An),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Sn},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),An),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Sn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),An),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),An),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Sn},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),An),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),An),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Sn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},kn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},kn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},kn),An),{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"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},kn),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},kn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Sn},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},kn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},kn),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},kn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},kn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},kn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function En(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Mn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Cn=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Pn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Ln=new Set(["LineChart","AreaChart","StackedAreaChart"]),_n=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Bn(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function Nn(e,t){const n=Bn(e),o=Bn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Hn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function zn(e,t){const n=[],o=function(e,t){const n=[],o=jn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(jn).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!En(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=mn(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const s=xn({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=vn(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=bn(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return jn[e]?(function(e,t,n){const o=jn[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=jn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Mn.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){Cn.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=jn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=t.xAccessor;"string"==typeof s&&i[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!Pn.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!Ln.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(r=t.height)&&void 0!==r?r:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=jn[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(i.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!_n.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Nn(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=[];for(const e of Hn)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var $n;const Fn="undefined"!=typeof process&&"production"!==(null===($n=process.env)||void 0===$n?void 0:$n.NODE_ENV);function Wn({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(yn,{fallback:i=>{let s="";if(Fn&&r)try{const e=zn(t,r);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(pn,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})}},i)}const Tn={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Dn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function In(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},Tn),{width:n,height:o})},r||"No data available"):null}function Rn(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Dn),{position:"absolute",top:a+o*(i+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function Gn(e,t,n,o){if(!Fn)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Yn(e,t,n,o){return new(n||(n=Promise))(function(r,i){function s(e){try{l(o.next(e))}catch(e){i(e)}}function a(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const qn="__forecastSegment";let Xn=null;function Vn(){return Yn(this,void 0,void 0,function*(){return Xn||(Xn=yield import("./xy-statisticalOverlays-C2PPlmXv.js")),Xn})}const Un=c(function(i,s){var l,c;const h=t(null);u(s,()=>({push:e=>{var t;return null===(t=h.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=h.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=h.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=h.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const d=nn(i.mode,{width:i.width,height:i.height,showGrid:i.showGrid,enableHover:i.enableHover,showLegend:i.showLegend,title:i.title,xLabel:i.xLabel,yLabel:i.yLabel}),{data:g,margin:p,className:y,xFormat:f,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A="category10",curve:O="linear",showPoints:S=!1,pointRadius:j=3,fillArea:E=!1,areaOpacity:M=.3,lineWidth:C=2,tooltip:P,pointIdAccessor:L,annotations:_,directLabel:B,gapStrategy:N="break",anomaly:H,forecast:z,frameProps:$={},selection:F,linkedHover:W,onObservation:T,chartId:D,loading:I,emptyContent:R,legendInteraction:G,legendPosition:Y,xScaleType:q,yScaleType:X}=i,V=d.width,U=d.height,Q=d.enableHover,K=d.showGrid,Z=d.showLegend,J=d.title,ee=d.xLabel,te=d.yLabel,ne=Rn(I,V,U),oe=ne?null:In(g,V,U,R),re=g||[];Gn("LineChart",re,"xAccessor",v),Gn("LineChart",re,"yAccessor",b);const ie="string"==typeof v?v:"__semiotic_resolvedX",se="string"==typeof b?b:"__semiotic_resolvedY",[ae,le]=n(null),[ue,he]=n([]),de=r(()=>{if(!z&&!H)return re;const e="function"==typeof v,t="function"==typeof b;return e||t?re.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=v(n)),t&&(o.__semiotic_resolvedY=b(n)),o}):re},[re,z,H,v,b]);o(()=>{if(!z&&!H)return;let e=!1;if(le(null),he([]),z){const t=x&&"string"==typeof x&&"object"==typeof z?Object.assign(Object.assign({},z),{_groupBy:x}):z;(function(...e){return Yn(this,void 0,void 0,function*(){return(yield Vn()).buildForecast(...e)})})(de,ie,se,t,H).then(t=>{e||(le(t),he(t.annotations))}).catch(()=>{e||(le(null),he([]))})}else H&&function(...e){return Yn(this,void 0,void 0,function*(){return(yield Vn()).buildAnomalyAnnotations(...e)})}(H).then(t=>{e||(le(null),he(t))}).catch(()=>{e||he([])});return()=>{e=!0}},[de,z,H,ie,se]);const ge=ae?ae.processedData:re,pe="__compoundGroup",ye=!(!z||!x),fe=ye?pe:z?qn:x,me=r(()=>{if(!ye)return ge;const e="function"==typeof x?x:e=>e[x];return ge.map(t=>{const n=Object.assign({},t);return n[pe]=`${e(t)}__${t[qn]||"observed"}`,n})},[ge,ye,x]),ve=ye?me:ge,be=r(()=>{if(!z)return;const e=z.upperBounds,t=z.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=ae?ae.processedData:re;for(const e of s){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[z,ae,re,b]),{activeSelectionHook:xe,customHoverBehavior:ke}=Zt({selection:F,linkedHover:W,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:T,chartType:"LineChart",chartId:D}),we=a(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),Ae=void 0!==(null===(l=ve[0])||void 0===l?void 0:l[k]),Oe=r(()=>{if(Ae)return ve;if(fe){const e=ve.reduce((e,t)=>{const n="function"==typeof fe?fe(t):t[fe];if(!e[n]){const o={[k]:[]};"string"==typeof fe&&(o[fe]=n),ye&&(o[qn]=t[qn],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:ve}]},[ve,fe,k,Ae]),{gapProcessedLineData:Se,hasGaps:je}=r(()=>{if("interpolate"===N){let e=!1;const t=[];for(const n of Oe){const o=(n[k]||[]).filter(t=>!we(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===N){let e=!1;const t=[];for(const n of Oe){const o=n[k]||[];let r=[],i=0;const s=fe&&"string"==typeof fe?n[fe]:void 0;for(const a of o)if(we(a))e=!0,r.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:r})),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}r.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===N){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of Oe){const r=o[k]||[],i=[];for(const n of r)we(n)?(e=!0,i.push(Object.assign(Object.assign({},n),{[t]:0}))):i.push(n);n.push(Object.assign(Object.assign({},o),{[k]:i}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Oe,hasGaps:!1}},[Oe,N,k,we,fe,b]),Ee=Kt(ge,w,A),Me=r(()=>{if(!w)return[];const e=new Set;for(const t of ge){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[ge,w]),Ce=en(G,w,Me),Pe=r(()=>Ce.legendSelectionHook?Ce.legendSelectionHook:xe,[Ce.legendSelectionHook,xe]),Le=r(()=>e=>{const t={strokeWidth:C};return w?Ee&&(t.stroke=ce(e,w,Ee),E&&(t.fill=t.stroke,t.fillOpacity=M)):(t.stroke=Ut,E&&(t.fill=Ut,t.fillOpacity=M)),t},[w,Ee,C,E,M]),[_e,Be]=n(null);o(()=>{if(!z)return void Be(null);let e=!1;return function(...e){return Yn(this,void 0,void 0,function*(){return(yield Vn()).createSegmentLineStyle(...e)})}(Le,z).then(t=>{e||Be(()=>t)}).catch(()=>{e||Be(null)}),()=>{e=!0}},[Le,z]);const Ne=_e||Le,He=r(()=>Vt(Ne,Pe,F),[Ne,Pe,F]),ze=r(()=>{if(S)return e=>{const t={r:j,fillOpacity:1};return w?Ee&&(t.fill=ce(e.parentLine||e,w,Ee)):t.fill=Ut,t}},[S,j,w,Ee]),$e=E?"area":"line",Fe="object"==typeof B?B:{},We=Fe.position||"end",Te=Fe.fontSize||11,De=r(()=>{var e,t;if(!B||!w)return[];const n="function"==typeof v?v:e=>e[v],o="function"==typeof b?b:e=>e[b],r="function"==typeof w?w:e=>e[w],i=new Map;for(const n of Se){const o=n[k]||[];if(0===o.length)continue;const s="end"===We?o[o.length-1]:o[0],a=null!==(t=null!==(e=r(s))&&void 0!==e?e:r(n))&&void 0!==t?t:"";a&&!i.has(a+"")&&i.set(a+"",s)}const s=Array.from(i.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof v?v:"x"]:n(t),["string"==typeof b?b:"y"]:o(t),dx:"end"===We?6:-6,dy:0,color:Ee?Ee(e):Ut,fontSize:Te}));s.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;s.length>e;e++){const t="string"==typeof b?b:"y",n=s[e-1],o=s[e];Te+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Te+2)}return s},[B,w,Ee,Se,k,v,b,We,Te]),Ie=(!B||void 0!==Z)&&Z,Re=r(()=>{if(!B)return d.marginDefaults;const e=De.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*Te);return Math.max(e,o)},0),t=e+10,n="end"===We?"right":"left";return Object.assign(Object.assign({},d.marginDefaults),{[n]:Math.max(d.marginDefaults[n]||0,t)})},[B,De,Te,We,d.marginDefaults]),{legend:Ge,margin:Ye,legendPosition:qe}=Jt({data:Se,colorBy:w,colorScale:Ee,showLegend:Ie,legendPosition:Y,userMargin:p,defaults:Re}),Xe=x||w,Ve=r(()=>gn([{label:ee||un(v),accessor:v,role:"x"},{label:te||un(b),accessor:b,role:"y"},...Xe?[{label:un(Xe),accessor:Xe,role:"group"}]:[]]),[v,b,ee,te,Xe]),Ue=xn({componentName:"LineChart",data:Ae?(null===(c=ge[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}}),Qe=r(()=>Ae||fe||je?Se.flatMap(e=>{const t=e[k]||[];return fe&&"string"==typeof fe?t.map(t=>Object.assign(Object.assign({},t),{[fe]:e[fe]})):t}):ve,[Se,k,Ae,fe,ve,je]),Ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:$e},null!=g&&{data:Qe}),{xAccessor:v,yAccessor:b,xScaleType:q,yScaleType:X}),be&&{yExtent:be}),{groupAccessor:"break"===N&&je?"_gapSegment":fe||void 0,curve:O,lineStyle:He}),S&&{pointStyle:ze}),{size:[V,U],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:Ye,showAxes:d.showAxes,xLabel:ee,yLabel:te,xFormat:f,yFormat:m,enableHover:Q,showGrid:K}),Ge&&{legend:Ge,legendPosition:qe}),G&&"none"!==G&&{legendHoverBehavior:Ce.onLegendHover,legendClickBehavior:Ce.onLegendClick,legendHighlightedCategory:Ce.highlightedCategory,legendIsolatedCategories:Ce.isolatedCategories}),J&&{title:J}),y&&{className:y}),{tooltipContent:!1===P?()=>null:cn(P)||Ve}),(W||T)&&{customHoverBehavior:ke}),L&&{pointIdAccessor:L}),((null==_?void 0:_.length)||ue.length||De.length)&&{annotations:[..._||[],...ue,...De]}),$);return ne||oe||(Ue?e.createElement(pn,{componentName:"LineChart",message:Ue,width:V,height:U}):e.createElement(Wn,{componentName:"LineChart",width:V,height:U},e.createElement(Pt,Object.assign({ref:h},Ke))))});Un.displayName="LineChart";const Qn=c(function(n,o){var i;const s=t(null);u(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=nn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:l,margin:c,className:h,xFormat:d,yFormat:g,xAccessor:p="x",yAccessor:y="y",areaBy:f,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k="category10",curve:w="monotoneX",areaOpacity:A=.7,showLine:O=!0,lineWidth:S=2,tooltip:j,annotations:E,frameProps:M={},selection:C,linkedHover:P,onObservation:L,chartId:_,loading:B,emptyContent:N,legendInteraction:H,legendPosition:z}=n,$=a.width,F=a.height,W=a.enableHover,T=a.showGrid,D=a.showLegend,I=a.title,R=a.xLabel,G=a.yLabel,Y=Rn(B,$,F),q=Y?null:In(l,$,F,N),X=l||[];Gn("AreaChart",X,"xAccessor",p),Gn("AreaChart",X,"yAccessor",y);const{activeSelectionHook:V,customHoverBehavior:U}=Zt({selection:C,linkedHover:P,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:L,chartType:"AreaChart",chartId:_}),Q=void 0!==(null===(i=X[0])||void 0===i?void 0:i[b]),K=r(()=>{if(Q)return X;if(f){const e=X.reduce((e,t)=>{const n="function"==typeof f?f(t):t[f];if(!e[n]){const t={[b]:[]};"string"==typeof f&&(t[f]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:X}]},[X,f,b,Q]),Z=Kt(X,x,k),J=r(()=>{if(!x)return[];const e=new Set;for(const t of X){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[X,x]),ee=en(H,x,J),te=r(()=>ee.legendSelectionHook?ee.legendSelectionHook:V,[ee.legendSelectionHook,V]),ne=r(()=>e=>{const t={};if(x){if(Z){const n=ce(e,x,Z);t.fill=n,O?(t.stroke=n,t.strokeWidth=S):t.stroke="none"}}else t.fill=Ut,O?(t.stroke=Ut,t.strokeWidth=S):t.stroke="none";return t.fillOpacity=A,t},[x,Z,A,O,S]),oe=r(()=>Vt(ne,te,C),[ne,te,C]),{legend:re,margin:ie,legendPosition:se}=Jt({data:K,colorBy:x,colorScale:Z,showLegend:D,legendPosition:z,userMargin:c,defaults:a.marginDefaults}),ae=f||x,le=r(()=>gn([{label:R||un(p),accessor:p,role:"x"},{label:G||un(y),accessor:y,role:"y"},...ae?[{label:un(ae),accessor:ae,role:"group"}]:[]]),[p,y,R,G,ae]),ue=xn({componentName:"AreaChart",data:l,accessors:{xAccessor:p,yAccessor:y}}),he=r(()=>Q||f?K.flatMap(e=>{const t=e[b]||[];return f&&"string"==typeof f?t.map(t=>Object.assign(Object.assign({},t),{[f]:e[f]})):t}):X,[K,b,Q,f,X]),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({chartType:"area"},null!=l&&{data:he}),{xAccessor:p,yAccessor:y,groupAccessor:f||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),{curve:w,lineStyle:oe,size:[$,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie,showAxes:a.showAxes,xLabel:R,yLabel:G,xFormat:d,yFormat:g,enableHover:W,showGrid:T}),re&&{legend:re,legendPosition:se}),H&&"none"!==H&&{legendHoverBehavior:ee.onLegendHover,legendClickBehavior:ee.onLegendClick,legendHighlightedCategory:ee.highlightedCategory,legendIsolatedCategories:ee.isolatedCategories}),I&&{title:I}),h&&{className:h}),{tooltipContent:!1===j?()=>null:cn(j)||le}),(P||L)&&{customHoverBehavior:U}),E&&E.length>0&&{annotations:E}),M);return Y||q||(ue?e.createElement(pn,{componentName:"AreaChart",message:ue,width:$,height:F}):e.createElement(Wn,{componentName:"AreaChart",width:$,height:F},e.createElement(Pt,Object.assign({ref:s},de))))});function Kn({isPushMode:e,colorBy:o,colorScheme:i,showLegend:s,legendPosition:l="right"}){const c=t(new Set),u=t([]),[h,d]=n(0),g=a(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),p=a(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),n=!0)}n&&d(e=>e+1)},[e,o,g]),y=a(e=>t=>{p([t]),e(t)},[p]),f=a(e=>t=>{p(t),e(t)},[p]),m=a(()=>{c.current=new Set,u.current=[],d(e=>e+1)},[]),v=r(()=>{if(!e||!o||!1===s)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:ae,r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],n[e%n.length]);const a="string"==typeof o?o:"__streamCat";return qt({data:t.map(e=>({[a]:e})),colorBy:a,colorScale:e=>r.get(e)||"#999",getColor:ce})},[e,o,s,i,h]),b=r(()=>{if(v)return"right"===l?{right:110}:"left"===l?{left:110}:"top"===l?{top:50}:"bottom"===l?{bottom:80}:{right:110}},[v,l]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}Qn.displayName="AreaChart";const Zn=c(function(n,o){var i;const s=t(null),l=nn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:h,className:d,xFormat:g,yFormat:p,xAccessor:y="x",yAccessor:f="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x="category10",curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:O=2,normalize:S=!1,tooltip:j,annotations:E,frameProps:M={},selection:C,linkedHover:P,onObservation:L,chartId:_,loading:B,emptyContent:N,legendInteraction:H,legendPosition:z}=n,$=l.width,F=l.height,W=l.enableHover,T=l.showGrid,D=l.showLegend,I=l.title,R=l.xLabel,G=l.yLabel,Y=Rn(B,$,F),q=Y?null:In(c,$,F,N),X=c||[],V=Kn({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:D,legendPosition:z}),U=a(V.wrapPush(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)}),[V.wrapPush]),Q=a(V.wrapPushMany(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)}),[V.wrapPushMany]);u(o,()=>({push:U,pushMany:Q,clear:()=>{var e;V.resetCategories(),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[U,Q,V.resetCategories]);const{activeSelectionHook:K,customHoverBehavior:Z}=Zt({selection:C,linkedHover:P,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:L,chartType:"StackedAreaChart",chartId:_}),J=void 0!==(null===(i=X[0])||void 0===i?void 0:i[v]),ee=r(()=>{if(J)return X;if(m){const e=X.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:X}]},[X,m,v,J]),te=Kt(X,b,x),ne=r(()=>{if(!b)return[];const e=new Set;for(const t of X){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[X,b]),oe=en(H,b,ne),re=r(()=>oe.legendSelectionHook?oe.legendSelectionHook:K,[oe.legendSelectionHook,K]),ie=r(()=>e=>{const t={};if(b&&te){const n=ce(e,b,te);t.fill=n,A?(t.stroke=n,t.strokeWidth=O):t.stroke="none"}else b||(t.fill=Ut,t.stroke=A?Ut:"none",A&&(t.strokeWidth=O));return t.fillOpacity=w,t},[b,te,w,A,O]),se=r(()=>Vt(ie,re,C),[ie,re,C]),{legend:ae,margin:le,legendPosition:ue}=Jt({data:ee,colorBy:b,colorScale:te,showLegend:D,legendPosition:z,userMargin:h,defaults:l.marginDefaults}),he=V.streamingLegend||ae,de=z||ue,ge=r(()=>{if(V.streamingMarginAdjust){const e=Object.assign({},le);for(const[t,n]of Object.entries(V.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return le},[le,V.streamingMarginAdjust]),pe=m||b,ye=r(()=>gn([{label:R||un(y),accessor:y,role:"x"},{label:G||un(f),accessor:f,role:"y"},...pe?[{label:un(pe),accessor:pe,role:"group"}]:[]]),[y,f,R,G,pe]),fe=xn({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:y,yAccessor:f}}),me=r(()=>J||m?ee.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):X,[ee,v,J,m,X]),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=c&&{data:me}),{xAccessor:y,yAccessor:f,groupAccessor:m||void 0,curve:k,normalize:S,lineStyle:se,size:[$,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ge,showAxes:l.showAxes,xLabel:R,yLabel:G,xFormat:g,yFormat:p,enableHover:W,showGrid:T}),he&&{legend:he,legendPosition:de}),H&&"none"!==H&&{legendHoverBehavior:oe.onLegendHover,legendClickBehavior:oe.onLegendClick,legendHighlightedCategory:oe.highlightedCategory,legendIsolatedCategories:oe.isolatedCategories}),I&&{title:I}),d&&{className:d}),{tooltipContent:!1===j?()=>null:cn(j)||ye}),(P||L)&&{customHoverBehavior:Z}),E&&E.length>0&&{annotations:E}),M);return Y||q||(fe?e.createElement(pn,{componentName:"StackedAreaChart",message:fe,width:$,height:F}):e.createElement(Wn,{componentName:"StackedAreaChart",width:$,height:F},e.createElement(Pt,Object.assign({ref:s},ve))))});function Jn(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:h=!1,onObservation:d,chartType:g,chartId:p,showLegend:y,userMargin:f,marginDefaults:m,loading:v,emptyContent:b,width:x,height:k}=e,{activeSelectionHook:w,customHoverBehavior:A,customClickBehavior:O}=Zt({selection:l,linkedHover:c,fallbackFields:u,unwrapData:h,onObservation:d,chartType:g,chartId:p}),S=Kt(t,o,i),j=r(()=>{if(!o)return[];const e=new Set;for(const n of t){const t="function"==typeof o?o(n):n[o];null!=t&&e.add(t+"")}return Array.from(e)},[t,o]),E=en(s,o,j),M=r(()=>E.legendSelectionHook?E.legendSelectionHook:w,[E.legendSelectionHook,w]),{legend:C,margin:P,legendPosition:L}=Jt({data:t,colorBy:o,colorScale:S,showLegend:y,legendPosition:a,userMargin:f,defaults:m}),_=r(()=>{const e={};return C&&(e.legend=C,e.legendPosition=L),s&&"none"!==s&&(e.legendHoverBehavior=E.onLegendHover,e.legendClickBehavior=E.onLegendClick,e.legendHighlightedCategory=E.highlightedCategory,e.legendIsolatedCategories=E.isolatedCategories),e},[C,L,s,E.onLegendHover,E.onLegendClick,E.highlightedCategory,E.isolatedCategories]),B=Rn(v,x,k),N=B?null:In(n,x,k,b);return{colorScale:S,allCategories:j,legendState:E,effectiveSelectionHook:M,activeSelectionHook:w,customHoverBehavior:A,customClickBehavior:O,legend:C,margin:P,legendPosition:L,earlyReturn:B||N||null,legendBehaviorProps:_}}Zn.displayName="StackedAreaChart";const eo=c(function(n,o){const i=t(null);u(o,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=nn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:l,margin:c,className:h,xFormat:d,yFormat:g,xAccessor:p="x",yAccessor:y="y",colorBy:f,colorScheme:m="category10",sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:O,annotations:S,frameProps:j={},selection:E,linkedHover:M,linkedBrush:C,onObservation:P,chartId:L,loading:_,emptyContent:B,legendInteraction:N,legendPosition:H}=n,z=s.width,$=s.height,F=s.enableHover,W=s.showGrid,T=s.title,D=s.xLabel,I=s.yLabel,R=l||[],G=Jn({data:R,rawData:l,colorBy:f,colorScheme:m,legendInteraction:N,legendPosition:H,selection:E,linkedHover:M,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:P,chartType:"Scatterplot",chartId:L,showLegend:s.showLegend,userMargin:c,marginDefaults:s.marginDefaults,loading:_,emptyContent:B,width:z,height:$}),Y=Xt(C),q=Dt({name:(null==Y?void 0:Y.name)||"__unused_brush__",xField:(null==Y?void 0:Y.xField)||("string"==typeof p?p:void 0),yField:(null==Y?void 0:Y.yField)||("string"==typeof y?y:void 0)}),X=Y?"xyBrush"===q.brushInteraction.brush?"xy":"xBrush"===q.brushInteraction.brush?"x":"y":void 0,V=e.useRef(q.brushInteraction);V.current=q.brushInteraction;const U=a(e=>{const t=V.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(G.earlyReturn)return G.earlyReturn;Gn("Scatterplot",R,"xAccessor",p),Gn("Scatterplot",R,"yAccessor",y);const Q=r(()=>{if(!v||0===R.length)return;const e=R.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[R,v]),K=r(()=>e=>{const t={fillOpacity:k};return f?G.colorScale&&(t.fill=ce(e,f,G.colorScale)):t.fill=Ut,t.r=v?he(e,v,b,Q):x,t},[f,G.colorScale,v,b,Q,x,k]),Z=r(()=>Vt(K,G.effectiveSelectionHook,E),[K,G.effectiveSelectionHook,E]),J=r(()=>gn([{label:D||un(p),accessor:p,role:"x"},{label:I||un(y),accessor:y,role:"y"},...f?[{label:un(f),accessor:f,role:"color"}]:[],...v?[{label:un(v),accessor:v,role:"size"}]:[]]),[p,y,D,I,f,v]),ee=xn({componentName:"Scatterplot",data:l,accessors:{xAccessor:p,yAccessor:y}});if(ee)return e.createElement(pn,{componentName:"Scatterplot",message:ee,width:z,height:$});const 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:"scatter"},null!=l&&{data:R}),{xAccessor:p,yAccessor:y,colorAccessor:f||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:Z,colorScheme:m,size:[z,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:G.margin,showAxes:s.showAxes,xLabel:D,yLabel:I,xFormat:d,yFormat:g,enableHover:F,showGrid:W}),G.legendBehaviorProps),T&&{title:T}),h&&{className:h}),{tooltipContent:!1===w?()=>null:cn(w)||J}),(M||P)&&{customHoverBehavior:G.customHoverBehavior}),A&&{marginalGraphics:A}),O&&{pointIdAccessor:O}),S&&S.length>0&&{annotations:S}),Y&&{brush:{dimension:X},onBrush:U}),j);return e.createElement(Wn,{componentName:"Scatterplot",width:z,height:$},e.createElement(Pt,Object.assign({ref:i},te)))});function to(e,t){return w(1===t?.5:e/(t-1))}eo.displayName="Scatterplot";const no=c(function(n,o){const i=t(null);u(o,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=nn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,className:l,xFormat:c,yFormat:h,xAccessor:d="x",yAccessor:g="y",orderAccessor:p,orderLabel:y,pointRadius:f=4,tooltip:m,pointIdAccessor:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,chartId:O,loading:S,emptyContent:j,legendInteraction:E}=n,M=s.width,C=s.height,P=s.enableHover,L=s.showGrid,_=s.title,B=s.xLabel,N=s.yLabel,H=a||[],{safeData:z,orderMap:$}=r(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof g?g:e=>e[g];let n=H;if(p&&H.length>0){const e="function"==typeof p?p:e=>e[p];n=[...H].sort((t,n)=>{const o=e(t),r=e(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const o=new WeakMap;let r=0;for(const o of n){const n=e(o),i=t(o);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let i=0;for(const s of n){const n=e(s),a=t(s);null!=n&&null!=a&&isFinite(n)&&isFinite(a)&&o.set(s,{idx:i++,total:r})}return{safeData:n,orderMap:o}},[H,p,d,g]);Gn("ConnectedScatterplot",z,"xAccessor",d),Gn("ConnectedScatterplot",z,"yAccessor",g);const{activeSelectionHook:F,customHoverBehavior:W}=Zt({selection:k,linkedHover:w,fallbackFields:[],onObservation:A,chartType:"ConnectedScatterplot",chartId:O}),T=en(E,void 0,[]),D=r(()=>T.legendSelectionHook?T.legendSelectionHook:F,[T.legendSelectionHook,F]),I=r(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==D?void 0:D.isActive,s=null==D?void 0:D.predicate,a=100>r.length,l=r.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=r[t],u=r[t+1],h=to(t,l),d=!i||!s||s(null!==(n=c.datum)&&void 0!==n?n:c)||s(null!==(o=u.datum)&&void 0!==o?o:u),g=i?d?1:.2:1;a&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=f+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=h,e.lineWidth=f,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[f,D]),R=r(()=>[I],[I]),G=r(()=>(t,n,o)=>{var r,i;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 n=s[t],o=s[t+1],u=to(t,a),h="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,d="number"==typeof(null===(i=o.style)||void 0===i?void 0:i.opacity)?o.style.opacity:1,g=Math.min(h,d);l&&c.push(e.createElement("line",{key:"halo-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:f+2,strokeLinecap:"round",opacity:.5*g})),c.push(e.createElement("line",{key:"seg-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:f,strokeLinecap:"round",opacity:g}))}return e.createElement(e.Fragment,null,c)},[f]),Y=r(()=>[G],[G]),q=r(()=>e=>{var t,n;const o=$.get(e),r=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,i=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:i>0?to(r,i):"#6366f1",stroke:"white",strokeWidth:1,r:f,fillOpacity:1}},[f,$]),X=r(()=>Vt(q,D,k),[q,D,k]),V=Object.assign({top:50,right:40,bottom:60,left:70},n.margin),U=y||("string"==typeof p?p:"Order"),Q=r(()=>gn([{label:B||un(d),accessor:d,role:"x"},{label:N||un(g),accessor:g,role:"y"},...p?[{label:U,accessor:p,role:"group"}]:[]]),[d,g,B,N,p,U]),K=xn({componentName:"ConnectedScatterplot",data:a,accessors:{xAccessor:d,yAccessor:g}}),Z=Rn(S,M,C),J=Z?null:In(a,M,C,j),ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=a&&{data:z}),{xAccessor:d,yAccessor:g,pointStyle:X,size:[M,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V,showAxes:s.showAxes,xLabel:B,yLabel:N,xFormat:c,yFormat:h,enableHover:P,showGrid:L}),_&&{title:_}),l&&{className:l}),{tooltipContent:!1===m?()=>null:cn(m)||Q}),(w||A)&&{customHoverBehavior:W}),v&&{pointIdAccessor:v}),{canvasPreRenderers:R,svgPreRenderers:Y}),b&&b.length>0&&{annotations:b}),x);return Z||J||(K?e.createElement(pn,{componentName:"ConnectedScatterplot",message:K,width:M,height:C}):e.createElement(Wn,{componentName:"ConnectedScatterplot",width:M,height:C},e.createElement(Pt,Object.assign({ref:i},ee))))});no.displayName="ConnectedScatterplot";const oo=c(function(o,i){const s=t(null),l=nn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:h,className:d,xFormat:g,yFormat:p,xAccessor:y="x",yAccessor:f="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x="category10",bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:O,marginalGraphics:S,pointIdAccessor:j,annotations:E,frameProps:M={},selection:C,linkedHover:P,linkedBrush:L,onObservation:_,chartId:B,loading:N,emptyContent:H,legendInteraction:z,legendPosition:$}=o,F=l.width,W=l.height,T=l.enableHover,D=l.showGrid,I=l.showLegend,R=l.title,G=l.xLabel,Y=l.yLabel,q=Rn(N,F,W),X=q?null:In(c,F,W,H),V=c||[],U=void 0===c,Q=t(null),[K,Z]=n(0),J=a(e=>{if(!U)return;let t=!1;for(const n of e){const e="function"==typeof m?m(n):n[m];null!=e&&isFinite(e)&&(Q.current?(Q.current[0]>e&&(Q.current[0]=e,t=!0),e>Q.current[1]&&(Q.current[1]=e,t=!0)):(Q.current=[e,e],t=!0))}t&&Z(e=>e+1)},[U,m]),ee=Kn({isPushMode:U,colorBy:b,colorScheme:x,showLegend:I,legendPosition:$}),te=a(ee.wrapPush(e=>{var t;J([e]),null===(t=s.current)||void 0===t||t.push(e)}),[ee.wrapPush,J]),ne=a(ee.wrapPushMany(e=>{var t;J(e),null===(t=s.current)||void 0===t||t.pushMany(e)}),[ee.wrapPushMany,J]);u(i,()=>({push:te,pushMany:ne,clear:()=>{var e;ee.resetCategories(),Q.current=null,Z(e=>e+1),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[te,ne,ee.resetCategories]);const{activeSelectionHook:oe,customHoverBehavior:re}=Zt({selection:C,linkedHover:P,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:_,chartType:"BubbleChart",chartId:B}),ie=Xt(L);Dt({name:(null==ie?void 0:ie.name)||"__unused_brush__",xField:(null==ie?void 0:ie.xField)||("string"==typeof y?y:void 0),yField:(null==ie?void 0:ie.yField)||("string"==typeof f?f:void 0)});const se=Kt(V,b,x),ae=r(()=>{if(!b)return[];const e=new Set;for(const t of V){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[V,b]),le=en(z,b,ae),ue=r(()=>le.legendSelectionHook?le.legendSelectionHook:oe,[le.legendSelectionHook,oe]),de=r(()=>{if(U)return Q.current||[0,1];const e=V.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[V,m,U,K]),ge=r(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?se&&(t.fill=ce(e,b,se)):t.fill=Ut,t.r=he(e,m,v,de),t},[b,se,m,v,de,k,w,A]),pe=r(()=>Vt(ge,ue,C),[ge,ue,C]),{legend:ye,margin:fe,legendPosition:me}=Jt({data:V,colorBy:b,colorScale:se,showLegend:I,legendPosition:$,userMargin:h,defaults:l.marginDefaults}),ve=ee.streamingLegend||ye,be=$||me,xe=r(()=>{if(ee.streamingMarginAdjust){const e=Object.assign({},fe);for(const[t,n]of Object.entries(ee.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return fe},[fe,ee.streamingMarginAdjust]),ke=r(()=>gn([{label:G||un(y),accessor:y,role:"x"},{label:Y||un(f),accessor:f,role:"y"},{label:un(m),accessor:m,role:"size"},...b?[{label:un(b),accessor:b,role:"color"}]:[]]),[y,f,G,Y,m,b]),we=xn({componentName:"BubbleChart",data:c,accessors:{xAccessor:y,yAccessor:f},requiredProps:{sizeBy:m}});if(we)return e.createElement(pn,{componentName:"BubbleChart",message:we,width:F,height:W});const Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=c&&{data:V}),{xAccessor:y,yAccessor:f,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:pe,colorScheme:x,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:xe,showAxes:l.showAxes,xLabel:G,yLabel:Y,xFormat:g,yFormat:p,enableHover:T,showGrid:D}),ve&&{legend:ve,legendPosition:be}),z&&"none"!==z&&{legendHoverBehavior:le.onLegendHover,legendClickBehavior:le.onLegendClick,legendHighlightedCategory:le.highlightedCategory,legendIsolatedCategories:le.isolatedCategories}),R&&{title:R}),d&&{className:d}),{tooltipContent:!1===O?()=>null:cn(O)||ke}),(P||_)&&{customHoverBehavior:re}),S&&{marginalGraphics:S}),j&&{pointIdAccessor:j}),E&&E.length>0&&{annotations:E}),M);return q||X||e.createElement(Wn,{componentName:"BubbleChart",width:F,height:W},e.createElement(Pt,Object.assign({ref:s},Ae)))});oo.displayName="BubbleChart";const ro=c(function(n,o){const i=t(null);u(o,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=nn(n.mode,{width:n.width,height:n.height,showGrid:void 0,enableHover:n.enableHover,showLegend:void 0,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:l,className:c,xAccessor:h="x",yAccessor:d="y",valueAccessor:g="value",xFormat:p,yFormat:y,colorScheme:f="blues",customColorScale:m,showValues:b=!1,valueFormat:x,cellBorderColor:k="#fff",cellBorderWidth:A=1,tooltip:O,annotations:M,frameProps:C={},selection:P,linkedHover:L,onObservation:_,chartId:B,loading:N,emptyContent:H,showLegend:z,legendPosition:$,legendInteraction:F}=n,W=s.width,T=s.height,D=s.enableHover,I=s.title,R=s.xLabel,G=s.yLabel,Y=Rn(N,W,T),q=Y?null:In(a,W,T,H),X=a||[],V=null!=z&&z,U=null!=$?$:"right",{margin:Q}=Jt({data:X,colorBy:V?"value":void 0,colorScale:void 0,showLegend:V,legendPosition:U,userMargin:l,defaults:s.marginDefaults}),{activeSelectionHook:K,customHoverBehavior:Z}=Zt({selection:P,linkedHover:L,fallbackFields:[],onObservation:_,chartType:"Heatmap",chartId:B}),J=en(F,void 0,[]),ee=r(()=>J.legendSelectionHook?J.legendSelectionHook:K,[J.legendSelectionHook,K]),te=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ne=r(()=>{const e=X.map(te);return[Math.min(...e),Math.max(...e)]},[X,te]),oe=r(()=>"custom"===f&&m?m:v({blues:E,reds:j,greens:S,viridis:w}[f]||E).domain(ne),[f,m,ne]);r(()=>{const e=Qt(h),t=Qt(d);return{xBinCount:new Set(X.map(e)).size,yBinCount:new Set(X.map(t)).size}},[X,h,d]),r(()=>({coordinates:X}),[X]);const re=r(()=>e=>{const t=te(e);return{fill:oe(t),stroke:k,strokeWidth:A}},[te,oe,k,A]);r(()=>Vt(re,ee,P),[re,ee,P]);const ie=r(()=>gn([{label:R||un(h),accessor:h,role:"x"},{label:G||un(d),accessor:d,role:"y"},{label:un(g),accessor:g,role:"value"}]),[h,d,R,G,g]),se=xn({componentName:"Heatmap",data:a,accessors:{xAccessor:h,yAccessor:d,valueAccessor:g}}),ae=r(()=>{if(V)return{gradient:{colorFn:e=>oe(e),domain:ne,label:"string"==typeof g?g:"value",format:x}}},[V,oe,ne,g,x]),le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=a&&{data:X}),{xAccessor:h,yAccessor:d,valueAccessor:g,colorScheme:"custom"!==f?f:void 0,showValues:b,heatmapValueFormat:x,size:[W,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q,showAxes:s.showAxes,xLabel:R,yLabel:G,xFormat:p,yFormat:y,enableHover:D}),ae&&{legend:ae,legendPosition:U}),I&&{title:I}),c&&{className:c}),{tooltipContent:!1===O?()=>null:cn(O)||ie}),(L||_)&&{customHoverBehavior:Z}),M&&M.length>0&&{annotations:M}),C);return Y||q||(se?e.createElement(pn,{componentName:"Heatmap",message:se,width:W,height:T}):e.createElement(Wn,{componentName:"Heatmap",width:W,height:T},e.createElement(Pt,Object.assign({ref:i},le))))});ro.displayName="Heatmap";const io="__splomIdx",so={top:4,bottom:4,left:4,right:4};function ao({frameRef:n,cellSize:r,onBrush:i}){const s=t(null),a=r-so.left-so.right,l=r-so.top-so.bottom;return o(()=>{if(!s.current)return;const e=y(s.current).select(".brush-g"),t=p().extent([[0,0],[a,l]]).on("brush end",e=>{var t;const o=null===(t=n.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void i(null);const[[r,s],[a,l]]=e.selection,c=[[o.x.invert(r),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];i(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)}},[a,l,n,i]),e.createElement("svg",{ref:s,width:r,height:r,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${so.left},${so.top})`}))}function lo({data:n,xField:o,yField:r,cellSize:i,pointRadius:s,pointOpacity:l,colorBy:c,colorScale:u,brushSelectionName:h,hoverSelectionName:d,unselectedOpacity:g,mode:p,onPointHover:y}){const f=t(null),m=Wt({name:h,clientId:`splom-${o}-${r}`}),v=Dt({name:h,xField:o,yField:r}),b=Wt({name:d,clientId:"splom-hover-source"}),x=b.selectPoints,k=a(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),w=a(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[io];void 0!==n&&(x({[io]:[n]}),null==y||y(t,e.x+so.left,e.y+so.top))},[x,y]),A=a(e=>{const t={opacity:l,r:s};return t.fill=c?ce(e,c,u):Ut,"hover"===p?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*l):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,l,s,p,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(Pt,{ref:f,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:so,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?w:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e.createElement(ao,{frameRef:f,cellSize:i,xField:o,yField:r,onBrush:k}))}function co({data:t,field:n,label:o,cellSize:i,bins:s,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:h}){const d=Wt({name:c,clientId:"splom-diag-"+n}),g=Wt({name:u,clientId:`splom-diag-${n}-hover`}),p="hover"===h?g:d,y=p.isActive,f=p.predicate,m=r(()=>{const e=t.map(e=>e[n]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const o=Math.min(...e),r=(Math.max(...e)-o)/s||1,l="string"==typeof a?a:null,c=l?[...new Set(t.map(e=>e[l]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),h=Array(s).fill(0),d=Array(s).fill(0),g=Array.from({length:s},()=>Array(c.length).fill(0)),p=Array.from({length:s},()=>Array(c.length).fill(0));for(const e of t){const t=e[n];if(null==t||isNaN(t))continue;const i=Math.min(Math.floor((t-o)/r),s-1);if(h[i]++,y&&!f(e)||d[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,y&&!f(e)||p[i][t]++)}}const m=Math.max(...h,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),a={x:t/s*i,w:i/s-1,h:r,y0:n,category:c[o]};return n+=r,a})}),b=p.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),a={x:t/s*i,w:i/s-1,h:r,y0:n,category:c[o]};return n+=r,a})});return{bars:h.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/m*(i-24),count:e})),selectedBars:d.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/m*(i-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[t,n,s,i,y,f,a]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},o),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`bg-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Ut,opacity:y?.3:.6}))):m.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Ut,opacity:y?.3:.6})),y&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`sel-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Ut,opacity:.7}))):m.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Ut,opacity:.7}))))}function uo({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function ho(t){const{data:o,fields:i,fieldLabels:s={},colorBy:l,colorScheme:c="category10",cellSize:u=150,cellGap:h=4,pointRadius:d=2,pointOpacity:g=.5,diagonal:p="histogram",histogramBins:y=20,brushMode:f="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:O,chartId:S}=t,j="splom",E="splom-hover",M=m?"hover":f?"brush":"hover",C=zt(e=>e.clearSelection),[P,L]=n(null),_=a(()=>{C(E),L(null)},[C,E]),B=r(()=>(o||[]).map((e,t)=>void 0!==e[io]?e:Object.assign(Object.assign({},e),{[io]:t})),[o]),N=Kt(B,l,c),H=void 0!==k?k:!!l,z=r(()=>{if(!H||!l)return null;const e="string"==typeof l?l:null;return e?[...new Set(B.map(t=>t[e]))].map(e=>({label:e+"",color:N?N(e+""):Ut})):null},[H,l,B,N]),$=r(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>u+"px").join(" "),gridTemplateRows:i.map(()=>u+"px").join(" ")+" 40px",gap:h+"px",width:"fit-content"}),[i,u,h,40]);return e.createElement("div",{className:A,style:{position:"relative"}},z&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},z.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:$,onMouseLeave:"hover"===M?_:void 0},i.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},s[t]||t),i.map((o,r)=>n===r?"label"===p?e.createElement(uo,{key:"diag-"+t,label:s[t]||t,cellSize:u}):e.createElement(co,{key:"diag-"+t,data:B,field:t,label:s[t]||t,cellSize:u,bins:y,colorBy:l,colorScale:N,brushSelectionName:j,hoverSelectionName:E,unselectedOpacity:v,mode:M}):e.createElement(lo,{key:`cell-${t}-${o}`,data:B,xField:o,yField:t,fieldLabels:s,cellSize:u,pointRadius:d,pointOpacity:g,colorBy:l,colorScale:N,brushSelectionName:j,hoverSelectionName:E,unselectedOpacity:v,showGrid:b,tooltip:x,mode:M,onPointHover:"hover"===M?(e,i,s)=>{e?(L({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=s?s:0}),O&&O({type:"hover",datum:e,x:null!=i?i:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})):(L(null),O&&O({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S}))}:void 0})))),e.createElement("div",null)," ",i.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},s[t]||t))),P&&"hover"===M&&(()=>{const t=P.datum,n=s[P.xField]||P.xField,o=s[P.yField]||P.yField,r=l?"function"==typeof l?l(t):t[l]:null,i=w?"function"==typeof w?w(t):t[w]:"Row "+t[io];return e.createElement("div",{style:{position:"absolute",left:40+P.colIndex*(u+h)+P.px,top:P.rowIndex*(u+h)+P.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}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},i+""),e.createElement("div",null,n,": ",null!=t[P.xField]?Number(t[P.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[P.yField]?Number(t[P.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof l?l:"group",": ",r+""))})())}function go(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(Yt,{selections:r},e.createElement(ho,Object.assign({},t)))}function po({width:n,height:r,margin:i,scales:s,brushDirection:a,extent:l,onBrush:c}){const u=t(null),h=t(null),p=t(!1),f=n+i.left+i.right,m=r+i.top+i.bottom;return o(()=>{if(!u.current||!s)return;const e=y(u.current).select(".brush-group"),t="x"===a?d().extent([[0,0],[n,r]]):g().extent([[0,0],[n,r]]);return t.on("brush end",e=>{if(p.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===a?s.x:s.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),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)}},[s,n,r,a,c]),o(()=>{if(!h.current||!s||!u.current)return;const e=y(u.current).select(".brush-group"),t="x"===a?s.x:s.y;if(p.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(h.current.move,n)}else e.call(h.current.move,null);p.current=!1},[l,s,a]),e.createElement("svg",{ref:u,width:f,height:m,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-group",transform:`translate(${i.left},${i.top})`}))}function yo(i){var s,l;const{data:c,width:u=600,height:h=400,margin:d,className:g,title:p,xLabel:y,yLabel:f,xFormat:m,yFormat:v,xAccessor:b="x",yAccessor:x="y",lineBy:k,lineDataAccessor:w="coordinates",colorBy:A,colorScheme:O="category10",curve:S="linear",lineWidth:j=2,fillArea:E=!1,areaOpacity:M=.3,showPoints:C=!1,pointRadius:P=3,enableHover:L=!0,showGrid:_=!1,showLegend:B,legendPosition:N,tooltip:H,minimap:z={},renderBefore:$=!1,onBrush:F,brushExtent:W,frameProps:T={},loading:D,emptyContent:I}=i,R=Rn(D,u,h),G=R?null:In(c,u,h,I),Y=c||[],[q,X]=n(null),V=null!=W?W:q,U=a(e=>{W||X(e),null==F||F(e)},[W,F]),Q=t(null),[K,Z]=n(null);o(()=>{const e=()=>{var t,n;const o=null===(n=null===(t=Q.current)||void 0===t?void 0:t.getScales)||void 0===n?void 0:n.call(t);o?Z(o):requestAnimationFrame(e)};requestAnimationFrame(e)},[c]);const J=void 0!==(null===(s=Y[0])||void 0===s?void 0:s[w]),ee=r(()=>{if(J)return Y;if(k){const e=Y.reduce((e,t)=>{const n="function"==typeof k?k(t):t[k];if(!e[n]){const t={[w]:[]};"string"==typeof k&&(t[k]=n),e[n]=t}return e[n][w].push(t),e},{});return Object.values(e)}return[{[w]:Y}]},[Y,k,w,J]),te=r(()=>J||k?ee.flatMap(e=>{const t=e[w]||[];return k&&"string"==typeof k?t.map(t=>Object.assign(Object.assign({},t),{[k]:e[k]})):t}):Y,[ee,w,J,k,Y]),ne=Kt(Y,A,O),oe=r(()=>e=>{const t={strokeWidth:j};return t.stroke=A?ce(e,A,ne):Ut,E&&(t.fill=t.stroke,t.fillOpacity=M),t},[A,ne,j,E,M]),re=r(()=>z.lineStyle?z.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=A?ce(e,A,ne):Ut,t},[A,ne,z.lineStyle]),ie=r(()=>{if(C)return e=>{const t={r:P,fillOpacity:1};return t.fill=A?ce(e.parentLine||e,A,ne):Ut,t}},[C,P,A,ne]),{legend:se,margin:ae,legendPosition:le}=Jt({data:ee,colorBy:A,colorScale:ne,showLegend:B,legendPosition:N,userMargin:d}),ue=z.height||60,he=r(()=>{var e,t,n,o,r,i,s,a;return{top:null!==(t=null===(e=z.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=z.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(i=null===(r=z.margin)||void 0===r?void 0:r.left)&&void 0!==i?i:ae.left,right:null!==(a=null===(s=z.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ae.right}},[z.margin,ae]),de=z.brushDirection||"x",ge=xn({componentName:"MinimapChart",data:c,accessors:{xAccessor:b,yAccessor:x}});if(ge)return e.createElement(pn,{componentName:"MinimapChart",message:ge,width:u,height:h});const pe=E?"area":"line",ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:pe,data:te,xAccessor:b,yAccessor:x,groupAccessor:k||void 0,curve:S,lineStyle:oe},C&&{pointStyle:ie}),{size:[u,h],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:ae,showAxes:!0,xLabel:y,yLabel:f,xFormat:m,yFormat:v,enableHover:L,showGrid:_}),se&&{legend:se,legendPosition:le}),p&&{title:p}),H&&{tooltipContent:cn(H)||void 0}),V&&{xExtent:V}),T),fe={chartType:pe,data:te,xAccessor:b,yAccessor:x,groupAccessor:k||void 0,curve:S,lineStyle:re,size:[u,ue+he.top+he.bottom],margin:he,showAxes:null!==(l=z.showAxes)&&void 0!==l&&l,background:z.background,enableHover:!1},me=e.createElement("div",{key:"minimap",style:{position:"relative",width:u,overflow:"hidden"}},e.createElement(Pt,Object.assign({ref:Q},fe)),e.createElement(po,{width:u-he.left-he.right,height:ue,margin:he,scales:K,brushDirection:de,extent:V,onBrush:U})),ve=e.createElement("div",{key:"main",style:{overflow:"hidden"}},e.createElement(Pt,Object.assign({},ye)));return R||G||e.createElement(Wn,{componentName:"MinimapChart",width:u,height:h},e.createElement("div",{className:"minimap-chart"+(g?" "+g:"")},$?me:ve,$?ve:me))}go.displayName="ScatterplotMatrix",yo.displayName="MinimapChart";const fo=c(function(n,o){const i=t(null);u(o,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=nn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:l,className:c,xFormat:h,yFormat:d,xAccessor:g="x",yAccessor:p="y",xCenter:y,yCenter:f,quadrants:m,centerlineStyle:v={},showQuadrantLabels:b=!0,quadrantLabelSize:x=12,colorBy:k,colorScheme:w="category10",sizeBy:A,sizeRange:O=[3,15],pointRadius:S=5,pointOpacity:j=.8,tooltip:E,pointIdAccessor:M,annotations:C,frameProps:P={},selection:L,linkedHover:_,onObservation:B,chartId:N,loading:H,emptyContent:z,legendInteraction:$,legendPosition:F}=n,W=s.width,T=s.height,D=s.enableHover,I=s.showGrid,R=s.showLegend,G=s.title,Y=s.xLabel,q=s.yLabel,X=Rn(H,W,T),V=X?null:In(a,W,T,z),U=a||[];Gn("QuadrantChart",U,"xAccessor",g),Gn("QuadrantChart",U,"yAccessor",p);const{activeSelectionHook:Q,customHoverBehavior:K}=Zt({selection:L,linkedHover:_,fallbackFields:"string"==typeof k?[k]:[],onObservation:B,chartType:"QuadrantChart",chartId:N}),Z=Kt(U,k,w),J=r(()=>{if(!k)return[];const e=new Set;for(const t of U){const n="function"==typeof k?k(t):t[k];null!=n&&e.add(n+"")}return Array.from(e)},[U,k]),ee=en($,k,J),te=r(()=>ee.legendSelectionHook?ee.legendSelectionHook:Q,[ee.legendSelectionHook,Q]),ne=r(()=>{if(!U.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of U){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=y&&isFinite(y)&&(n>y&&(n=y),y>o&&(o=y)),null!=f&&isFinite(f)&&(r>f&&(r=f),f>i&&(i=f)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[U,g,p,y,f]),oe=r(()=>{if(!A||0===U.length)return;const e=U.map(e=>"function"==typeof A?A(e):e[A]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[U,A]),re=r(()=>"function"==typeof g?g:e=>+e[g],[g]),ie=r(()=>"function"==typeof p?p:e=>+e[p],[p]),se=r(()=>e=>{const t={fillOpacity:j};if(k)Z&&(t.fill=ce(e,k,Z));else{const n=re(e),o=ie(e),r=null!=y?n>=y:void 0,i=null!=f?o>=f:void 0;t.fill=void 0===i||void 0===r?Ut:i&&r?m.topRight.color:i&&!r?m.topLeft.color:!i&&r?m.bottomRight.color:m.bottomLeft.color}return t.r=A?he(e,A,O,oe):S,t},[k,Z,A,O,oe,S,j,re,ie,y,f,m]),ae=r(()=>Vt(se,te,L),[se,te,L]),{legend:le,margin:ue,legendPosition:de}=Jt({data:U,colorBy:k,colorScale:Z,showLegend:R,legendPosition:F,userMargin:l,defaults:s.marginDefaults}),ge=r(()=>{if(!U.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof p&&e.add(p),"string"==typeof k&&e.add(k),"string"==typeof A&&e.add(A);const t=U[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[U,g,p,k,A]),pe=r(()=>gn([...ge?[{label:ge,accessor:ge,role:"title"}]:[],{label:Y||un(g),accessor:g,role:"x"},{label:q||un(p),accessor:p,role:"y"},...k?[{label:un(k),accessor:k,role:"color"}]:[],...A?[{label:un(A),accessor:A,role:"size"}]:[]]),[ge,g,p,Y,q,k,A]),ye=xn({componentName:"QuadrantChart",data:a,accessors:{xAccessor:g,yAccessor:p}}),fe=r(()=>{var e;const t={stroke:v.stroke||"#999",strokeWidth:null!==(e=v.strokeWidth)&&void 0!==e?e:1,dashArray:v.strokeDasharray||[]};return[(e,n,o,r)=>{var i;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=r.width,a=r.height,l=null!=y?o.x(y):s/2,c=null!=f?o.y(f):a/2;if(null!=y&&!isFinite(l))return;if(null!=f&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),h=Math.max(0,Math.min(a,c)),d=[{config:m.topLeft,x:0,y:0,w:u,h:h},{config:m.topRight,x:u,y:0,w:s-u,h:h},{config:m.bottomLeft,x:0,y:h,w:u,h:a-h},{config:m.bottomRight,x:u,y:h,w:s-u,h:a-h}];for(const t of d)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(i=t.config.opacity)&&void 0!==i?i:.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,h),e.lineTo(s,h),e.stroke(),e.setLineDash([])}]},[y,f,m,v]),me=r(()=>b?[...fe,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const r=o.width,i=o.height,s=null!=y?n.x(y):r/2,a=null!=f?n.y(f):i/2;(null==y||isFinite(s))&&(null==f||isFinite(a))&&(e.font=`600 ${x}px sans-serif`,e.globalAlpha=.5,e.fillStyle=m.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(m.topLeft.label,8,8),e.fillStyle=m.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(m.topRight.label,r-8,8),e.fillStyle=m.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(m.bottomLeft.label,8,i-8),e.fillStyle=m.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(m.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:fe,[fe,b,x,m,y,f]),ve=r(()=>{const e=P.canvasPreRenderers||[];return[...me,...e]},[me,P.canvasPreRenderers]),be=r(()=>{var t;const n={stroke:v.stroke||"#999",strokeWidth:null!==(t=v.strokeWidth)&&void 0!==t?t:1,dashArray:v.strokeDasharray?Array.isArray(v.strokeDasharray)?v.strokeDasharray.join(","):v.strokeDasharray:void 0};return[(t,o,r)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const i=r.width,s=r.height,a=null!=y?o.x(y):i/2,l=null!=f?o.y(f):s/2;if(null!=y&&!isFinite(a))return null;if(null!=f&&!isFinite(l))return null;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l));return e.createElement(e.Fragment,null,[{config:m.topLeft,x:0,y:0,w:c,h:u},{config:m.topRight,x:c,y:0,w:i-c,h:u},{config:m.bottomLeft,x:0,y:u,w:c,h:s-u},{config:m.bottomRight,x:c,y:u,w:i-c,h:s-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.createElement("rect",{key:"qf-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08}):null}),e.createElement("line",{x1:c,y1:0,x2:c,y2:s,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.createElement("line",{x1:0,y1:u,x2:i,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),b&&e.createElement(e.Fragment,null,e.createElement("text",{x:8,y:8+x,fill:m.topLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.topLeft.label),e.createElement("text",{x:i-8,y:8+x,fill:m.topRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.topRight.label),e.createElement("text",{x:8,y:s-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.bottomLeft.label),e.createElement("text",{x:i-8,y:s-8,fill:m.bottomRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.bottomRight.label)))}]},[y,f,m,v,b,x]),xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=a&&{data:U}),{xAccessor:g,yAccessor:p,colorAccessor:k||void 0,sizeAccessor:A||void 0,sizeRange:O,pointStyle:ae,colorScheme:w,size:[W,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ue,showAxes:s.showAxes,xLabel:Y,yLabel:q,xFormat:h,yFormat:d,enableHover:D,showGrid:I}),ne&&{xExtent:ne.xExtent,yExtent:ne.yExtent}),le&&{legend:le,legendPosition:de}),$&&"none"!==$&&{legendHoverBehavior:ee.onLegendHover,legendClickBehavior:ee.onLegendClick,legendHighlightedCategory:ee.highlightedCategory,legendIsolatedCategories:ee.isolatedCategories}),G&&{title:G}),c&&{className:c}),{tooltipContent:!1===E?()=>null:!0===E||void 0===E?pe:cn(E)||pe}),(_||B)&&{customHoverBehavior:K}),M&&{pointIdAccessor:M}),C&&C.length>0&&{annotations:C}),{canvasPreRenderers:ve}),P),ve.length>0&&{canvasPreRenderers:ve}),{svgPreRenderers:be});return X||V||(ye?e.createElement(pn,{componentName:"QuadrantChart",message:ye,width:W,height:T}):e.createElement(Wn,{componentName:"QuadrantChart",width:W,height:T},e.createElement(Pt,Object.assign({ref:i},xe))))});fo.displayName="QuadrantChart";const mo="__ma_unitized",vo="__ma_series";function bo(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function xo(e,t){return t[0]+e*(t[1]-t[0])}const ko=c(function(n,o){var i,s;const a=t(null),l=t([]);u(o,()=>({push:e=>{if(!a.current)return;const t=e;for(let e=0;n.series.length>e&&2>e;e++){const o=n.series[e],r=o.extent||l.current[e];if(!r)continue;const i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(t);null!=i&&isFinite(i)&&a.current.push(Object.assign(Object.assign({},t),{[mo]:bo(i,r),[vo]:o.label||"Series "+(e+1)}))}},pushMany:e=>{if(!a.current)return;const t=[];for(const o of e)for(let e=0;n.series.length>e&&2>e;e++){const r=n.series[e],i=r.extent||l.current[e];if(!i)continue;const s=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(o);null!=s&&isFinite(s)&&t.push(Object.assign(Object.assign({},o),{[mo]:bo(s,i),[vo]:r.label||"Series "+(e+1)}))}a.current.pushMany(t)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const c=nn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel},{width:800,height:400}),{data:h,margin:d,className:g,xFormat:p,xAccessor:y="x",series:f,colorScheme:m="category10",curve:v="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:O,onObservation:S,chartId:j,loading:E,emptyContent:M,legendInteraction:C,legendPosition:P}=n,L=c.width,_=c.height,B=c.enableHover,N=c.showGrid,H=null===(i=c.showLegend)||void 0===i||i,z=c.title,$=c.xLabel,F=2===f.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||F||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${f.length}. Rendering as a standard multi-line chart.`);const W=Rn(E,L,_),T=W?null:In(h,L,_,M),D=h||[],I=function(){var e;const t=rt(e=>e.theme),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}(),R=r(()=>{let e;if(Array.isArray(m))e=m;else if(I&&I.length>0)e=I;else{const t=ie[m];e=Array.isArray(t)?t:se}return f.map((t,n)=>t.color||e[n%e.length])},[f,m,I]),G=r(()=>f.map((e,t)=>e.label||"Series "+(t+1)),[f]),{unitizedData:Y,extents:q}=r(()=>{if(0===D.length){const e=f.map(e=>e.extent||null).filter(Boolean);return e.length===f.length&&(l.current=e),{unitizedData:[],extents:e.length===f.length?e:[]}}const e=f.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(D,e.yAccessor));if(l.current=e,!F){const t=[];for(const e of D)for(let n=0;f.length>n;n++){const o=f[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push(Object.assign(Object.assign({},e),{[mo]:r,[vo]:G[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of D)for(let o=0;2>o;o++){const r=f[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push(Object.assign(Object.assign({},n),{[mo]:bo(i,e[o]),[vo]:G[o]}))}return{unitizedData:t,extents:e}},[D,f,F,G]),X=r(()=>{if(F&&q.length>=2)return[{orient:"left",label:G[0],tickFormat:f[0].format||(e=>{const t=xo(e,q[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:G[1],tickFormat:f[1].format||(e=>{const t=xo(e,q[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[F,q,f,G]),V=Jn({data:r(()=>Y.length>0?Y:G.map(e=>({[vo]:e})),[Y,G]),rawData:h,colorBy:vo,colorScheme:R,legendInteraction:C,legendPosition:P,selection:A,linkedHover:O,fallbackFields:[vo],unwrapData:!1,onObservation:S,chartType:"MultiAxisLineChart",chartId:j,showLegend:H,userMargin:d,marginDefaults:F?Object.assign(Object.assign({},c.marginDefaults),{left:70,right:70}):c.marginDefaults,loading:E,emptyContent:M,width:L,height:_});if(V.earlyReturn)return V.earlyReturn;const U=r(()=>{const e=new Map;return G.forEach((t,n)=>e.set(t,R[n])),t=>({stroke:e.get(t[vo])||R[0],strokeWidth:b,fill:"none"})},[G,R,b]),Q=r(()=>Vt(U,V.effectiveSelectionHook,A),[U,V.effectiveSelectionHook,A]),K=r(()=>{if(!1===x)return()=>null;return cn(x)||(t=>{var n;const o=t.data||t,r=o[vo],i=G.indexOf(r),s=o[mo],a=F&&i>=0&&q[i]?xo(s,q[i]):s,l=i>=0&&(null===(n=f[i])||void 0===n?void 0:n.format)?f[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof y?y(o):o[y];return e.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},e.createElement("div",{style:{fontWeight:600,marginBottom:4,color:R[i]||"inherit"}},r),e.createElement("div",null,`${"string"==typeof y?y:"x"}: ${c}`),e.createElement("div",null,`${r}: ${l(a)}`))})},[x,G,R,q,F,f,y]),Z=xn({componentName:"MultiAxisLineChart",data:h,accessors:{xAccessor:y}}),J=F?[0,1]:void 0,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(Object.assign(Object.assign({chartType:"line"},null!=h&&{data:Y}),{xAccessor:y,yAccessor:mo,groupAccessor:vo,lineStyle:Q,colorScheme:R,size:[L,_],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V.margin,showAxes:c.showAxes}),X&&{axes:X}),{xLabel:$}),F?{}:{yLabel:G[0]}),{xFormat:p}),F&&J&&{yExtent:J}),{enableHover:B,showGrid:N,curve:v}),V.legendBehaviorProps),z&&{title:z}),g&&{className:g}),{tooltipContent:K}),k&&{annotations:k}),(O||S)&&{customHoverBehavior:V.customHoverBehavior}),S&&{customClickBehavior:V.customClickBehavior}),w);return W||T||(Z?e.createElement(pn,{componentName:"MultiAxisLineChart",message:Z,width:L,height:_}):e.createElement(Wn,{componentName:"MultiAxisLineChart",width:L,height:_},e.createElement(Pt,Object.assign({ref:a},ee))))});ko.displayName="MultiAxisLineChart";export{Qn as AreaChart,oo as BubbleChart,no as ConnectedScatterplot,ro as Heatmap,Un as LineChart,yo as MinimapChart,ko as MultiAxisLineChart,fo as QuadrantChart,eo as Scatterplot,go as ScatterplotMatrix,Zn as StackedAreaChart,Pt as StreamXYFrame};
1
+ import*as e from"react";import{useRef as t,useMemo as n,useEffect as o,useState as r,useSyncExternalStore as i,createContext as s,useContext as a,useCallback as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{select as h}from"d3-selection";import{brushX as g,brushY as p,brush as y}from"d3-brush";import{scaleOrdinal as f,scaleSequential as m,scaleLinear as v,scaleLog as b}from"d3-scale";import{quadtree as x}from"d3-quadtree";import{schemeCategory10 as k,interpolatePlasma as w,interpolateViridis as A,interpolatePurples as O,interpolateOranges as S,interpolateGreens as j,interpolateReds as E,interpolateBlues as C,schemeSet3 as M,schemeTableau10 as _}from"d3-scale-chromatic";import{bin as P}from"d3-array";import{packEnclose as B}from"d3-hierarchy";import{area as L,curveCatmullRom as N,curveCardinal as T,curveBasis as I,curveStepBefore as z,curveStepAfter as H,curveStep as $,curveMonotoneY as F,curveMonotoneX as W,curveLinear as D,line as R,curveNatural as G}from"d3-shape";import Y from"regression";function q(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function X(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function V({width:r,height:i,totalWidth:s,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:f,snap:m,binBoundaries:v,snapDuring:b,streaming:x}){const k=t(null),w=t(null),A=t(d);A.current=d;const O=t(u);O.current=u;const S=n(()=>v?[...v].sort((e,t)=>e-t):void 0,[v]),j=t(S);j.current=S;const E=t(!1),C=t(null);return o(()=>{if(!k.current)return;const e=h(k.current).select(".brush-g"),t="x"===c?g():"y"===c?p():y();return t.extent([[0,0],[r,i]]),t.on("brush end",n=>{if(E.current)return;const o=O.current;if(!o)return;if(!n.selection)return C.current=null,void A.current(null);let s,a;if("x"===c){const[e,t]=n.selection;s=[o.x.invert(e),o.x.invert(t)],a=[o.y.invert(i),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;s=[o.x.invert(0),o.x.invert(r)],a=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[r,i]]=n.selection;s=[o.x.invert(e),o.x.invert(r)],a=[o.y.invert(i),o.y.invert(t)]}if("bin"===m&&"y"!==c&&("end"===n.type||"brush"===n.type&&b)){const r=j.current;r&&r.length>0?s=function(e,t){return 0===t.length?e:[q(e[0],t),X(e[1],t)]}(s,r):f&&f>0&&(s=[Math.floor(s[0]/f)*f,Math.ceil(s[1]/f)*f]);const i=o.x(s[0]),a=o.x(s[1]);if(E.current=!0,"x"===c)e.call(t.move,[i,a]);else if("xy"===c){const o=n.selection;e.call(t.move,[[i,o[0][1]],[a,o[1][1]]])}E.current=!1}const l={x:s,y:a};C.current=l,A.current(l)}),e.call(t),w.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),w.current=null}},[r,i,c,m,f,b]),o(()=>{if(!(x&&u&&w.current&&C.current))return;if(!k.current)return;if("y"===c)return;const e=C.current,t=u.x.domain()[0],n=h(k.current).select(".brush-g");if(t>=e.x[1])return E.current=!0,n.call(w.current.move,null),E.current=!1,C.current=null,void A.current(null);let o=e.x[0],r=!1;if(t>e.x[0]){if(o=t,"bin"===m){const e=j.current;e&&e.length>0?o=X(t,e):f&&f>0&&(o=Math.ceil(t/f)*f)}if(o>=e.x[1])return E.current=!0,n.call(w.current.move,null),E.current=!1,C.current=null,void A.current(null);r=!0}const i=u.x(o),s=u.x(e.x[1]);if(E.current=!0,"x"===c)n.call(w.current.move,[i,s]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[i,t],[s,o]])}if(E.current=!1,r){const t={x:[o,e.x[1]],y:e.y};C.current=t,A.current(t)}},[u,x,c,m,f]),e.createElement("svg",{ref:k,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`}))}class U{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class Q{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}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 K{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function J(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function Z(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function ee(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function te(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ne(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}const oe={category10:k,tableau10:_,set3:M,blues:C,reds:E,greens:j,oranges:S,purples:O,viridis:A,plasma:w},re=k,ie=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],se=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 ae(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||se.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):re[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o+""))%re.length]}function le(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return f().domain(o).range(n).unknown("#999");const i=oe[n]||oe.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:re;return f().domain(o).range(e).unknown("#999")}}function ce(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}function ue(e,t,n){var o,r,i;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>a?1:s;default:return 1}}function de(e,t,n){var o;const r=null!==(o=e.duration)&&void 0!==o?o:500,i=n-t;return r>i?1-i/r:0}function he(e,t,n){return e+(t-e)*n}function ge(e,t,n){var o,r,i,s;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(s=null!==(r=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==r?r:null===(i=t.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function pe(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}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:r,datum:c,group:i}}function ye(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const c=t.x(e),u=a?a(i):r;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:i,datum:e,group:s}}function fe(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(null==a||null==l||Number.isNaN(a)||Number.isNaN(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function me(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function ve(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function be(e,t,n){if(!e.getBounds||!e.scales)return null;const o=[],r=[];for(const n of t){const t=e.getX(n),i=e.getY(n);if(null==t||null==i||Number.isNaN(t)||Number.isNaN(i))continue;const s=e.getBounds(n),a=e.scales.x(t);if(s&&0!==s)o.push([a,e.scales.y(i+s)]),r.push([a,e.scales.y(i-s)]);else{const t=e.scales.y(i);o.push([a,t]),r.push([a,t])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:r,style:e.resolveBoundsStyle(n,t[0]),datum:t,group:n,interactive:!1}}function xe(e,t,n,o){var r;if(!e.config.pointStyle)return;const i=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const s of o.data){let o=e.config.pointStyle(s);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const a=null!==(r=o.r)&&void 0!==r?r:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=fe(s,e.scales,e.getX,i,a,o,l);c&&n.push(c)}}}const ke={blues:C,reds:E,greens:j,viridis:A};class we{constructor(e){this.xExtent=new K,this.yExtent=new K,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,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.xIsDate=!1,this._quadtree=null,this.config=e,this.buffer=new Q(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=ee(e.timeAccessor||e.xAccessor,"time"),this.getY=ee(e.valueAccessor||e.yAccessor,"value")):(this.getX=ee(e.xAccessor,"x"),this.getY=ee(e.yAccessor,"y")),this.getGroup=ne(e.groupAccessor),this.getCategory=ne(e.categoryAccessor),this.getSize=e.sizeAccessor?ee(e.sizeAccessor,"size"):void 0,this.getColor=ne(e.colorAccessor),this.getBounds=e.boundsAccessor?ee(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?ee(e.y0Accessor,"y0"):void 0,this.getPointId=ne(e.pointIdAccessor),"candlestick"===e.chartType&&(this.getOpen=ee(e.openAccessor,"open"),this.getHigh=ee(e.highAccessor,"high"),this.getLow=ee(e.lowAccessor,"low"),this.getClose=ee(e.closeAccessor,"close")),e.pulse&&(this.timestampBuffer=new Q(e.windowSize))}ingest(e){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.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?ee(this.config.timeAccessor||this.config.xAccessor,"time"):ee(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n)))}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,n,o,r,i,s;const{config:a,buffer:l}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(l,this.getX),this.yExtent.dirty)if("candlestick"===a.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of l)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(l,this.getY);const c=this.getBufferArray(),u=this.xExtent.extent,d=this.yExtent.extent;let h=a.xExtent?[null!==(t=a.xExtent[0])&&void 0!==t?t:u[0],null!==(n=a.xExtent[1])&&void 0!==n?n:u[1]]:u,g=a.yExtent?[null!==(o=a.yExtent[0])&&void 0!==o?o:d[0],null!==(r=a.yExtent[1])&&void 0!==r?r:d[1]]:d;const p=a.yExtent&&null!=a.yExtent[0]&&null!=a.yExtent[1];if("stackedarea"===a.chartType&&!p&&l.size>0)if(a.normalize)g=[0,1+a.extentPadding];else{const e=`${l.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)g=this._stackExtentCache.yDomain;else{const t=this.groupData(c),n=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),o=this.getY(t);null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||n.set(e,(n.get(e)||0)+o)}let o=0;for(const e of n.values())e>o&&(o=e);g=[0,o+(o>0?o*a.extentPadding:1)],this._stackExtentCache={key:e,yDomain:g}}}else if("bar"===a.chartType&&a.binSize&&!p&&l.size>0){const[,e]=function(e,t,n,o,r){const i=J(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(l,this.getX,this.getY,a.binSize,this.getCategory);g=[0,e+e*a.extentPadding]}else if("waterfall"===a.chartType&&!p&&l.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(l,this.getY),n=t-e,o=n>0?n*a.extentPadding:1;g=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!p&&g[0]!==1/0){if(this.getBounds)for(const e of c){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>g[1]&&(g[1]=t+n),g[0]>t-n&&(g[0]=t-n))}const e=g[1]-g[0],t=e>0?e*a.extentPadding:1,n=null===(i=a.yExtent)||void 0===i?void 0:i[0],o=null===(s=a.yExtent)||void 0===s?void 0:s[1];g=[null!=n?g[0]:g[0]-t,null!=o?g[1]:g[1]+t],"log"===a.yScaleType&&0>=g[0]&&d[0]>0&&(g[0]=null!=n?g[0]:d[0]/(1+a.extentPadding))}if(h[0]!==1/0&&h[1]!==-1/0||(h=[0,1]),g[0]!==1/0&&g[1]!==-1/0||(g=[0,1]),"streaming"===a.runtimeMode)if("x"==("up"===(y=a.arrowOfTime)||"down"===y?"y":"x")){const t="right"===a.arrowOfTime?[0,e.width]:[e.width,0];this.scales={x:v().domain(h).range(t),y:v().domain(g).range([e.height,0])}}else{const t="down"===a.arrowOfTime?[0,e.height]:[e.height,0];this.scales={x:v().domain(g).range([0,e.width]),y:v().domain(h).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return b().domain(e).range(n).clamp(!0)}return v().domain(t).range(n)};this.scales={x:t(a.xScaleType,h,[0,e.width]),y:t(a.yScaleType,g,[e.height,0])}}var y;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,c),this.config.decay&&this.applyDecay(this.scene,c),this.config.pulse&&this.applyPulse(this.scene,c),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 void(this._quadtree=null);const t=this.scene.filter(e=>"point"===e.type);this._quadtree=t.length>we.QUADTREE_THRESHOLD?x().x(e=>e.x).y(e=>e.y).addAll(t):null}get quadtree(){return this._quadtree}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return b().domain(e).range(n).clamp(!0)}return v().domain(t).range(n)};this.scales={x:a(this.config.xScaleType,o,[i[0]*t,i[1]*t]),y:a(this.config.yScaleType,r,[s[0]*n,s[1]*n])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n;const{config:o,scales:r}=this;if(!r||0===t.length)return[];const i={scales:r,config:o,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(o.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),r=[],i=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.getBounds)for(const t of o){const n=be(e,t.data,t.key);n&&r.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=pe(t.data,e.scales,e.getX,e.getY,n,t.key);i&&i.length>0&&(o.colorThresholds=i),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),r.push(o)}return xe(e,o,r),r}(i,t);case"area":return function(e,t){const n=e.groupData(t),o=[],r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=ye(t.data,e.scales,e.getX,e.getY,r,n,t.key,i);e.config.gradientFill&&(s.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),o.push(s)}return xe(e,n,o),o}(i,t);case"stackedarea":return function(e,t){const n=e.groupData(t);n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);const o=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,{nodes:r,stackedTops:i}=function(e,t,n,o,r,i,s){var a;const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let d;if(i){d=new Map;for(const t of c){let n=0;for(const o of e)n+=(null===(a=u.get(o.key))||void 0===a?void 0:a.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,p=new Map;for(const e of c)p.set(e,0);for(const n of e){const e=u.get(n.key),o=[],a=[],l=new Map;for(const n of c){let r=e.get(n)||0;const s=p.get(n);i&&(r/=d.get(n));const c=s+r,u=t.x(n);a.push([u,t.y(s)]),o.push([u,t.y(c)]),p.set(n,c),l.set(n,c)}g.set(n.key,l);const y={type:"area",topPath:o,bottomPath:a,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(y.curve=s),h.push(y)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),s=r;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=i.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};xe(e,n,s,o)}return s}(i,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null;for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:"#4e79a7",opacity:.8},a=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(a=i(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(r);n&&s.has(n)&&(t=Object.assign(Object.assign({},t),{fill:s.get(n)}))}const l=e.getPointId?e.getPointId(r)+"":void 0,c=fe(r,e.scales,e.getX,e.getY,a,t,l);c&&n.push(c)}return n}(i,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,r,i;const s=[],a=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),l=Math.max(1,Math.floor(null!==(r=e.config.heatmapYBins)&&void 0!==r?r:20)),c=null!==(i=e.config.heatmapAggregation)&&void 0!==i?i:"count",u=ee(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return s;const[d,h]=e.scales.x.domain(),[g,p]=e.scales.y.domain(),y=(h-d||1)/a,f=(p-g||1)/l,m=new Map;for(const n of t){const t=e.getX(n),o=e.getY(n);if(!isFinite(t)||!isFinite(o))continue;const r=Math.min(Math.floor((t-d)/y),a-1),i=Math.min(Math.floor((o-g)/f),l-1);if(0>r||0>i)continue;const s=u(n),c=`${r}_${i}`;let h=m.get(c);h||(h={sum:0,count:0,data:[]},m.set(c,h)),h.count++,h.sum+=isFinite(s)?s:0,h.data.push(n)}let v=1/0,b=-1/0;const x=new Map;for(const[e,t]of m){let n;switch(c){case"sum":n=t.sum;break;case"mean":n=t.count>0?t.sum/t.count:0;break;default:n=t.count}x.set(e,n),v>n&&(v=n),n>b&&(b=n)}const k=b-v||1,w=n.width/a,A=n.height/l;for(const[t,n]of x){const[o,r]=t.split("_"),i=+o,a=+r,c=(n-v)/k,u=`rgb(${Math.round(220-180*c)},${Math.round(220-100*c)},${Math.round(255-50*c)})`,d=m.get(t);s.push(ve(i*w,(l-1-a)*A,w,A,u,{xi:i,yi:a,value:n,count:d.count,sum:d.sum,data:d.data},e.config.showValues?{value:n,showValues:!0,valueFormat:e.config.heatmapValueFormat}:void 0))}return s}(e,t,n);const o=[],r=ee(e.config.valueAccessor,"value"),i=te(e.config.xAccessor,"x"),s=te(e.config.yAccessor,"y"),a=new Set,l=new Set;for(const e of t)a.add(i(e)),l.add(s(e));const c=Array.from(a),u=Array.from(l),d=c.every(e=>"number"==typeof e&&!isNaN(e)),h=u.every(e=>"number"==typeof e&&!isNaN(e)),g=d?c.sort((e,t)=>e-t):c,p=h?u.sort((e,t)=>e-t):u;if(0===g.length||0===p.length)return o;const y=n.width/g.length,f=n.height/p.length,v=new Map;for(const e of t){const t=`${i(e)}\0${s(e)}`;v.set(t,{val:r(e),datum:e})}let b=1/0,x=-1/0;for(const{val:e}of v.values())isFinite(e)&&(b>e&&(b=e),e>x&&(x=e));if(!isFinite(b)||!isFinite(x))return o;const k=m(ke["string"==typeof e.config.colorScheme?e.config.colorScheme:"blues"]||C).domain([b,x]);for(let t=0;g.length>t;t++)for(let n=0;p.length>n;n++){const r=v.get(`${g[t]}\0${p[n]}`);if(!r||!isFinite(r.val))continue;const i=k(r.val);o.push(ve(t*y,(p.length-1-n)*f,y,f,i,r.datum,e.config.showValues?{value:r.val,showValues:!0,valueFormat:e.config.heatmapValueFormat}:void 0))}return o}(i,t,e);case"bar":{const e=function(e,t){var n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=J(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of o.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(n),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=n.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const i=[],s=e.scales,[a,l]=s.x.domain();for(const t of o.values()){const o=Math.max(t.start,a),c=Math.min(t.end,l);if(o>=c)continue;const u=s.x(o),d=s.x(c),h=Math.abs(d-u),g=h>2?1:0,p=Math.min(u,d)+g/2,y=Math.max(h-g,1);if(y>0)if(r&&t.categories.size>0){let o=0;for(const a of r){const r=t.categories.get(a)||0;if(0===r)continue;const l=s.y(o),c=s.y(o+r);i.push(me(p,Math.min(l,c),y,Math.abs(l-c),{fill:(null===(n=e.config.barColors)||void 0===n?void 0:n[a])||"#4e79a7"},{binStart:t.start,binEnd:t.end,total:t.total,category:a,categoryValue:r},a)),o+=r}}else{const e=s.y(0),n=s.y(t.total);i.push(me(p,Math.min(e,n),y,Math.abs(e-n),{fill:"#007bff"},{binStart:t.start,binEnd:t.end,total:t.total}))}}const c=new Set;for(const e of o.values())c.add(e.start),c.add(e.end);return{nodes:i,binBoundaries:Array.from(c).sort((e,t)=>e-t)}}(i,t);return this._barCategoryCache=null!==(n=i.barCategoryCache)&&void 0!==n?n:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,r,i;const s=[],a=e.config.swarmStyle||{},l=null!==(n=a.radius)&&void 0!==n?n:3,c=null!==(o=a.fill)&&void 0!==o?o:"#007bff",u=null!==(r=a.opacity)&&void 0!==r?r:.7,d=a.stroke,h=a.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const r=e.scales.x(t),a=e.scales.y(o);let g=c;if(e.getCategory){const t=e.getCategory(n);g=(null===(i=e.config.barColors)||void 0===i?void 0:i[t])||g}const p={type:"point",x:r,y:a,r:l,style:{fill:g,opacity:u,stroke:d,strokeWidth:h},datum:n};e.getPointId&&(p.pointId=e.getPointId(n)+""),s.push(p)}return s}(i,t);case"waterfall":return function(e,t,n){var o,r,i;const s=[],a=e.scales,l=e.config.waterfallStyle,c=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===c.length)return s;const u=null!==(o=null==l?void 0:l.positiveColor)&&void 0!==o?o:"#28a745",d=null!==(r=null==l?void 0:l.negativeColor)&&void 0!==r?r:"#dc3545",h=null!==(i=null==l?void 0:l.gap)&&void 0!==i?i:1,g=null==l?void 0:l.stroke,p=null==l?void 0:l.strokeWidth;let y=0;for(let t=0;c.length>t;t++){const o=c[t],r=e.getX(o),i=e.getY(o),f=y+i;let m;m=c.length-1>t?e.getX(c[t+1])-r:t>0?r-e.getX(c[t-1]):0;const v=a.x(r),b=0!==m?a.x(r+m):v+n.width/10,x=Math.min(v,b)+h/2,k=Math.max(v,b)-h/2-x;if(0>=k){y=f;continue}const w=a.y(y),A=a.y(f);s.push(me(x,Math.min(w,A),k,Math.abs(w-A),{fill:0>i?d:u,stroke:g,strokeWidth:p},Object.assign(Object.assign({},o),{baseline:y,cumEnd:f,delta:i,_connectorStroke:null==l?void 0:l.connectorStroke,_connectorWidth:null==l?void 0:l.connectorWidth}))),y=f}return s}(i,t,e);case"candlestick":return function(e,t){if(!(e.getOpen&&e.getHigh&&e.getLow&&e.getClose&&e.scales))return[];const n=[],o=e.config.candlestickStyle||{},r=o.upColor||"#28a745",i=o.downColor||"#dc3545",s=o.wickColor||"#333",a=o.wickWidth||1,l=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let c=o.bodyWidth||6;if(!o.bodyWidth&&l.length>1){let t=1/0;for(let n=1;l.length>n;n++){const o=Math.abs(e.scales.x(l[n])-e.scales.x(l[n-1]));o>0&&t>o&&(t=o)}t!==1/0&&(c=Math.max(2,Math.min(.6*t,20)))}for(const o of t){const t=e.getX(o);if(null==t||Number.isNaN(t))continue;const l=e.getOpen(o),u=e.getHigh(o),d=e.getLow(o),h=e.getClose(o);if([l,u,d,h].some(e=>null==e||Number.isNaN(e)))continue;const g=h>=l;n.push({type:"candlestick",x:e.scales.x(t),openY:e.scales.y(l),closeY:e.scales.y(h),highY:e.scales.y(u),lowY:e.scales.y(d),bodyWidth:c,upColor:r,downColor:i,wickColor:s,wickWidth:a,isUp:g,datum:o})}return n}(i,t);default:return[]}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?ue(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,r;const i=n.length;if(1>=i)return;const s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let r=!1;for(let n=0;t.length>n;n++){const a=s.get(t[n]);null!=a?(o[n]=ue(e,a,i),1>o[n]&&(r=!0)):o[n]=1}r&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const r=Array(o);let a=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(r[n]=ue(e,o,i),1>r[n]&&(a=!0)):r[n]=1}a&&(n._decayOpacities=r)}else{let r=1;for(const n of t){const t=s.get(n);if(null!=t){const n=ue(e,t,i);r>n&&(r=n)}}if(1>r){const e=Array(o);e.fill(r),n._decayOpacities=e}}continue}const t=s.get(n.datum);if(null==t)continue;const a=ue(e,t,i);if("heatcell"===n.type)n.style={opacity:a};else if("candlestick"===n.type)n._decayOpacity=a;else{const e=null!==(r=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==r?r:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var r,i;const s="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(r=e.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",l=null!==(i=e.glowRadius)&&void 0!==i?i:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0;for(const n of t){const t=c.get(n);if(null==t)continue;const i=o.get(t);if(null==i)continue;const a=de(e,i,s);a>r&&(r=a)}r>0&&(n._pulseIntensity=r,n._pulseColor=a);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);if(null==r)continue;const i=de(e,r,s);i>0&&(n._pulseIntensity=i,n._pulseColor=a,n._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),r=null!==(n=e.duration)&&void 0!==n?n:500,i=t.peek();return null!=i&&r>o-i}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var r,i,s;n.clear(),o.clear();for(let a=0;t.length>a;a++){const l=t[a],c=ge(e,l,a);c&&("point"===l.type?n.set(c,{x:l.x,y:l.y,r:l.r,opacity:l.style.opacity}):"rect"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:l.style.opacity}):"heatcell"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:null===(r=l.style)||void 0===r?void 0:r.opacity}):"candlestick"===l.type?n.set(c,{x:l.x,y:l.openY}):"line"===l.type?o.set(c,{path:l.path.map(e=>[e[0],e[1]]),opacity:null===(i=l.style)||void 0===i?void 0:i.opacity}):"area"===l.type&&o.set(c,{topPath:l.topPath.map(e=>[e[0],e[1]]),bottomPath:l.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(s=l.style)||void 0===s?void 0:s.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r){var i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,k,w,A,O,S,j,E,C,M,_,P,B;if(0===o.size&&0===r.size)return n;const L=null!==(i=t.duration)&&void 0!==i?i:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let N=!1;const T=new Set,I=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],A=ge(e,i,t);if(!A)continue;if(i._transitionKey=A,"line"===i.type||"area"===i.type){const e=r.get(A);if(e){if(I.add(A),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];N=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];N=!0}i._targetOpacity=null!==(s=i.style.opacity)&&void 0!==s?s:1,i._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:i.style.opacity)&&void 0!==l?l:1}else i._targetOpacity=null!==(c=i.style.opacity)&&void 0!==c?c:1,i._startOpacity=0,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),N=!0;continue}const O=o.get(A);if("point"===i.type)if(O){T.add(A);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=null!==(u=i.style.opacity)&&void 0!==u?u:1,O.x===e.x&&O.y===e.y&&O.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=O.x,i.y=O.y,i.r=null!==(d=O.r)&&void 0!==d?d:i.r,N=!0)}else i._targetOpacity=null!==(h=i.style.opacity)&&void 0!==h?h:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),N=!0;else if("rect"===i.type)if(O){T.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(g=i.style.opacity)&&void 0!==g?g:1,O.x===e.x&&O.y===e.y&&O.w===e.w&&O.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=O.x,i.y=O.y,i.w=null!==(p=O.w)&&void 0!==p?p:i.w,i.h=null!==(y=O.h)&&void 0!==y?y:i.h,N=!0)}else i._targetOpacity=null!==(f=i.style.opacity)&&void 0!==f?f:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),N=!0;else if("heatcell"===i.type)if(O){T.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(v=null===(m=i.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,O.x===e.x&&O.y===e.y&&O.w===e.w&&O.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=O.x,i.y=O.y,i.w=null!==(b=O.w)&&void 0!==b?b:i.w,i.h=null!==(x=O.h)&&void 0!==x?x:i.h,N=!0)}else i._targetOpacity=null!==(w=null===(k=i.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,i.style=Object.assign(Object.assign({},i.style||{}),{opacity:0}),N=!0}for(const[e,t]of r)if(!I.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(A=t.opacity)&&void 0!==A?A:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),N=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(O=t.opacity)&&void 0!==O?O:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),N=!0}for(const[e,t]of o)if(!T.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(S=t.r)&&void 0!==S?S:3,style:{opacity:null!==(j=t.opacity)&&void 0!==j?j:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(E=t.w)&&void 0!==E?E:0,h:null!==(C=t.h)&&void 0!==C?C:0,style:{opacity:null!==(M=t.opacity)&&void 0!==M?M:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(_=t.w)&&void 0!==_?_:0,h:null!==(P=t.h)&&void 0!==P?P:0,fill:"#999",datum:null,style:{opacity:null!==(B=t.opacity)&&void 0!==B?B:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}N=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),N&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:L}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var r,i,s,a,l;if(!n.activeTransition)return!1;const c=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),u=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(c,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=he(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=he(n.x,e._targetX,u),e.y=he(n.y,e._targetY,u),void 0!==e._targetR&&void 0!==n.r&&(e.r=he(n.r,e._targetR,u))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=he(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=he(n.x,e._targetX,u),e.y=he(n.y,e._targetY,u),void 0!==n.w&&(e.w=he(n.w,e._targetW,u)),void 0!==n.h&&(e.h=he(n.h,e._targetH,u))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:he(r,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=he(n.x,e._targetX,u),e.y=he(n.y,e._targetY,u),void 0!==n.w&&(e.w=he(n.w,e._targetW,u)),void 0!==n.h&&(e.h=he(n.h,e._targetH,u))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(a=e._startOpacity)&&void 0!==a?a:0;e.style=Object.assign(Object.assign({},e.style),{opacity:he(t,e._targetOpacity,u)})}const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=he(t[o][0],n[o][0],u),e.path[o][1]=he(t[o][1],n[o][1],u)}else if("area"===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:he(t,e._targetOpacity,u)})}const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=he(t[n][0],o[n][0],u),e.topPath[n][1]=he(t[n][1],o[n][1],u);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=he(n[t][0],r[t][0],u),e.bottomPath[t][1]=he(n[t][1],r[t][1],u)}}if(c>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.map;const r=Array.isArray(this.config.colorScheme)?this.config.colorScheme:ie,i=new Map;for(let e=0;n.length>e;e++)i.set(n[e],r[e%r.length]);return this._colorMapCache={key:o,map:i},i}resolveLineStyle(e,t){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}return n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}return o&&"object"==typeof o?{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2}:{fill:"#4e79a7",fillOpacity:.7,stroke:"#4e79a7",strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:ie,o=n[this._groupColorMap.size%n.length];return this._groupColorMap.set(e,o),o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}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.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,r;const i=Object.assign({},this.config);void 0!==e.colorScheme&&(this._colorMapCache=null,this._groupColorMap=new Map),void 0===e.barColors&&void 0===e.colorScheme||(this._barCategoryCache=null),void 0===e.normalize&&void 0===e.extentPadding&&void 0===e.xAccessor&&void 0===e.yAccessor&&void 0===e.groupAccessor&&void 0===e.categoryAccessor&&void 0===e.chartType||(this._stackExtentCache=null);let s=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==i.chartType||"runtimeMode"in e&&e.runtimeMode!==i.runtimeMode;if(a||void 0!==e.xAccessor||void 0!==e.yAccessor||void 0!==e.timeAccessor||void 0!==e.valueAccessor){const l=a||!Z(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=i.xAccessor)&&void 0!==n?n:i.timeAccessor),c=a||!Z(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(r=i.yAccessor)&&void 0!==r?r:i.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=ee(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=ee(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=ee(this.config.xAccessor,"x"),this.getY=ee(this.config.yAccessor,"y")),s=!0)}if("groupAccessor"in e&&!Z(e.groupAccessor,i.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?ne(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!Z(e.categoryAccessor,i.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?ne(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!Z(e.sizeAccessor,i.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?ee(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!Z(e.colorAccessor,i.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ne(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!Z(e.y0Accessor,i.y0Accessor)&&(this.getY0=this.config.y0Accessor?ee(this.config.y0Accessor,"y0"):void 0,s=!0),"pointIdAccessor"in e&&!Z(e.pointIdAccessor,i.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?ne(this.config.pointIdAccessor):void 0,s=!0),!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==i[n]){s=!0;break}}s&&(this.needsFullRebuild=!0)}}function Ae(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function Oe(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r+5,12)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:i}}function Se(e,t,n){var o,r,i,s;if(0===e.path.length)return null;const a=Pe(e.path,t);if(0>a)return null;const[l,c]=e.path[a];let u;if(e.path.length>1){let o=1/0;const r=Math.max(0,a-1),i=Math.min(e.path.length-2,a);for(let s=r;i>=s;s++){const[r,i]=e.path[s],[a,l]=e.path[s+1],c=je(t,n,r,i,a,l);o>c&&(o=c)}u=o}else{const e=t-l,o=n-c;u=Math.sqrt(e*e+o*o)}const d=null!==(s=null!==(r=null===(o=e.style)||void 0===o?void 0:o.strokeWidth)&&void 0!==r?r:null===(i=e.style)||void 0===i?void 0:i.lineWidth)&&void 0!==s?s:1;return u>Math.max(5,d/2+2)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:l,y:c,distance:u}}function je(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function Ee(e,t,n){const o=Ae(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ce(e,t,n){const o=Ae(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Me(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function _e(e,t,n){if(0===e.topPath.length)return null;const o=Pe(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function Pe(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function Be(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function Le(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}we.QUADTREE_THRESHOLD=500;const Ne={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function Te(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,Ne[n])(o(e,t)),r}function Ie(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ze(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function He({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),s&&e.createElement("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},s&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function $e(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[p,y]=e.useState(0),f=e.useCallback((e,t)=>{g(e),y(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let y=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=Te(t,u,d,h),b=ze(t,r,i),x=i&&i.size>0&&i.has(t.label);p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${y})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===s&&u===a?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(Ie,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),y+=22}),p})(t,o,r,i,s,a,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const y=((t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,y=[];let f=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;p.forEach((t,u)=>{const x=Te(t,u,h,g),k=ze(t,r,i),w=i&&i.size>0&&i.has(t.label),A=26+7*t.label.length;d&&d>0&&f>0&&f+A>d&&(m++,f=0),y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${f},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===s&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.createElement(Ie,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),f+=A});let x=0,k=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&k>0&&k+t>d?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:y,offset:x,totalRows:w,totalHeight:22*w}})(t,r,i,s,a,l,c,n,u,d,o);p+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const y=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(y.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),p+=16),y.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${p},0)`},o.items)),p+=o.offset+5,t[r+1]&&y.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8})),p+=12}),e.createElement("g",null,y)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},l),m)}function Fe(e){return"string"==typeof e?{type:e}:e}function We({orient:t,config:o,values:r,scale:i,size:s,length:a}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===t||"bottom"===t,u=n(()=>{if(0===r.length)return null;const n=i.domain(),o=s-8;if("boxplot"===l.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(r);if(!n)return null;const{q1:s,median:a,q3:u,whiskerLow:d,whiskerHigh:h}=n,g=Math.min(.5*o,20),p=(o-g)/2+4;if(c){const n=i(s),o=i(u),r=i(a),c=i(d),y=i(h),f="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+f*(p+g/2),x2:y,y2:m+f*(p+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+f*p,x2:c,y2:m+f*(p+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:y,y1:m+f*p,x2:y,y2:m+f*(p+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-p-g:m+p,width:Math.abs(o-n),height:g,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===t?m-p-g:m+p,x2:r,y2:"top"===t?m-p:m+p+g,stroke:l.fill,strokeWidth:2}))}{const n=i(s),o=i(u),r=i(a),c=i(d),y=i(h),f="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+f*(p+g/2),y1:c,x2:m+f*(p+g/2),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*p,y1:c,x2:m+f*(p+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*p,y1:y,x2:m+f*(p+g),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-p-g:m+p,y:Math.min(n,o),width:g,height:Math.abs(o-n),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===t?m-p-g:m+p,y1:r,x2:"left"===t?m-p:m+p+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=P().domain(n).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((n,r)=>{if(null==n.x0||null==n.x1)return null;const s=n.length/d*o;if(c){const o=i(n.x0),a=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:o,y:"top"===t?-4-s:4,width:Math.max(a,.5),height:s,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(n.x0),a=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:"left"===t?-4-s:4,y:Math.min(o,o+a),width:s,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const n=o/2+4,r=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const s=e.length/d*(o/2),a=i((e.x0+e.x1)/2);r.push(c?`${a},${"top"===t?-(n-s):n-s}`:`${"left"===t?-(n-s):n-s},${a}`)}for(let e=u.length-1;e>=0;e--){const s=u[e];if(null==s.x0||null==s.x1)continue;const a=s.length/d*(o/2),l=i((s.x0+s.x1)/2);r.push(c?`${l},${"top"===t?-(n+a):n+a}`:`${"left"===t?-(n+a):n+a},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+t},e.createElement("polygon",{points:r.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const n=[];if(c){const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${r},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,s=i((e.x0+e.x1)/2);n.push(`L${s},${"top"===t?-r-4:r+4}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;n.push(`L${s},${e}`),n.push("Z")}else{const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${r}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,s=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-r-4:r+4},${s}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;n.push(`L${e},${s}`),n.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+t},e.createElement("path",{d:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,s,a,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function De(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Re(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Ge(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=i||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y),!m.has("connector")&&function(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+s*h,c=i+a*h}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},a)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.createElement("path",{key:"bracket-path",d:Re((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"currentColor"}));break}}return e.createElement("g",{className:"annotation-subject"},a)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!s)return e.createElement("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const p=16,y=s?u?[s]:De(s,c):[],f=i?u?[i]:De(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];y.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:g,fontWeight:"bold"},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t)))),v=y.length*p),f.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:g,y:v},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t))));let x=null;if((s||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(y.length+f.length)*p+(f.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const k=Math.max(0,y.length+f.length-1)*p;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===h?-(k+p+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0},b),x)}(l,v,b,h))}function Ye(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,s="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.createElement(Ge,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:s}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Ge,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:a},r,{type:s}))}function qe(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function Xe(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function Ve(e,t,n){var o,r,i,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=qe(e,n),c=Xe(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ue(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Qe={linear:D,monotoneX:W,monotoneY:F,step:$,stepAfter:H,stepBefore:z,basis:I,cardinal:T,catmullRom:N};let Ke={positions:new Map};const Je=new Set;function Ze(){for(const e of Je)e()}function et(e,t){const n=Ke.positions.get(e);if(!n||n.sourceId!==t)return;const o=new Map(Ke.positions);o.delete(e),Ke={positions:o},Ze()}function tt(){return Ke}function nt(e){return Je.add(e),()=>Je.delete(e)}const ot={positions:new Map};function rt(){return()=>{}}function it(){return ot}function st(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function at(t){const{width:o,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=t,p=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||h||lt,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=l.x.ticks(Math.min(r,Math.max(2,Math.floor(o/70)))),s=i.map(e=>e.valueOf()),a=i.map((e,t)=>({value:e,pixel:l.x(e),label:n(e,t,s)})),c=a.reduce((e,t)=>Math.max(e,6.5*t.label.length),0);return ct(a,Math.max(55,c+8))},[l,u,h,o]),y=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||g||lt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return ct(l.y.ticks(Math.min(o,Math.max(2,Math.floor(r/30)))).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,r]),f=d&&l,m=c&&l;if(!f&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,A=(null==b?void 0:b.jaggedBase)||!1,O="var(--semiotic-border, #ccc)";return e.createElement("svg",{width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},f&&e.createElement("g",{className:"stream-grid"},p.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:r,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),y.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),x&&!w&&e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:O,strokeWidth:1}),w&&e.createElement("path",{d:st("bottom",o,r),fill:"none",stroke:O,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:O,strokeWidth:1}),A&&e.createElement("path",{d:st("left",o,r),fill:"none",stroke:O,strokeWidth:1})))}function lt(e,t,n){return Math.round(100*e)/100+""}function ct(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function ut(e,t){return e instanceof Date&&(!(t&&t instanceof Date)||e.getFullYear()!==t.getFullYear()||e.getMonth()!==t.getMonth()||e.getDate()!==t.getDate())}function dt(o){var r,s;const{width:a,height:l,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:g,axes:p,xLabel:y,yLabel:f,yLabelRight:m,xFormat:v,yFormat:b,showGrid:x,title:k,legend:w,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:S,legendIsolatedCategories:j,legendPosition:E="right",foregroundGraphics:C,marginalGraphics:M,xValues:_,yValues:P,annotations:N,svgAnnotationRules:T,xAccessor:I,yAccessor:z,annotationData:H,pointNodes:$,curve:F,underlayRendered:W,linkedCrosshairName:R,linkedCrosshairSourceId:G,children:q}=o,X=n(()=>{var e;if(!g||!h)return[];const t=null==p?void 0:p.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||v||lt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=h.x.ticks(Math.min(o,Math.max(2,Math.floor(a/70)))),i=r.map(e=>e.valueOf()),s=r.map((e,t)=>({value:e,pixel:h.x(e),label:n(e,t,i)})),l=s.reduce((e,t)=>Math.max(e,6.5*t.label.length),0);return ct(s,Math.max(55,l+8))},[g,h,p,v,a]),V=n(()=>{var e;if(!g||!h)return[];const t=null==p?void 0:p.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||b||lt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return ct(h.y.ticks(Math.min(o,Math.max(2,Math.floor(l/30)))).map(e=>({value:e,pixel:h.y(e),label:n(e)})),22)},[g,h,p,b,l]),U=n(()=>{var e;if(!g||!h)return[];const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||b||lt,o=null!==(e=t.ticks)&&void 0!==e?e:5;return ct(h.y.ticks(Math.min(o,Math.max(2,Math.floor(l/30)))).map(e=>({value:e,pixel:h.y(e),label:n(e)})),22)},[g,h,p,b,l]),Q=t(new Map),K=t(null!==(r=null==N?void 0:N.length)&&void 0!==r?r:0),J=null!==(s=null==N?void 0:N.length)&&void 0!==s?s:0;K.current!==J&&(K.current=J,Q.current=new Map);const Z=n(()=>{if(!N||0===N.length)return null;const t=function(t,n,o){var r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,k,w,A,O,S,j,E,C,M,_,P,N,T,I,z,H,$,F,W,R,G,q,X,V,U,Q,K,J,Z,ee,te;switch(t.type){case"label":{const r=Ve(t,n,o);if(!r)return null;const{x:i,y:s}=r;return Ue(i,s,o)?e.createElement(Ye,{key:"ann-"+n,noteData:{x:i,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}}):null}case"callout":{const r=Ve(t,n,o);if(!r)return null;const{x:i,y:s}=r;return Ue(i,s,o)?e.createElement(Ye,{key:"ann-"+n,noteData:{x:i,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}}):null}case"x-threshold":{const r=qe(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:a,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=Xe(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:a,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:qe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Xe(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=B(r),s=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.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.createElement("text",{x:i.x,y:i.y-i.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:qe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Xe(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...s)-i,c=Math.max(...s)+i,u=Math.min(...a)-i,d=Math.max(...a)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("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.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=qe(n,o),a=Xe(n,o);if(null==i||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:a,r:l},c))}))}case"bracket":{const r=qe(t,o),i=Xe(t,o);return e.createElement(Ye,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i: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}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",p=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(s=o.scales)||void 0===s?void 0:s.time,f=null!==(l=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!y||!f)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?Y.polynomial(p,{order:t.order||2}):Y.linear(p)).points;const b=v.map(([e,t])=>`${y(e)},${f(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:y(v[v.length-1][0])+4,y:f(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(p=null==r?void 0:r(t.y0))&&void 0!==p?p:0,s=null!==(y=null==r?void 0:r(t.y1))&&void 0!==y?y:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,s),width:o.width||0,height:Math.abs(s-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",s=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,a=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.value;if(!s||!a)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=Qe[o.curve||"linear"]||D,g=L().x(e=>s(e[i])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(h)(d);if(!g)return null;const p=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:p,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:s(d[d.length-1][i])+4,y:a(d[d.length-1][l])-4,fill:p,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",s=null!==(O=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==O?O:null===(S=o.scales)||void 0===S?void 0:S.time,a=null!==(E=null===(j=o.scales)||void 0===j?void 0:j.y)&&void 0!==E?E:null===(C=o.scales)||void 0===C?void 0:C.value;if(!s||!a)return null;const l=r.map(e=>e[i]).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!==(M=t.threshold)&&void 0!==M?M:2,g=c-h*d,p=!1!==t.showBand,y=t.fill||"#6366f1",f=null!==(_=t.fillOpacity)&&void 0!==_?_:.1,m=t.anomalyColor||"#ef4444",v=null!==(P=t.anomalyRadius)&&void 0!==P?P:6,b=a(c+h*d),x=a(g),k=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},p&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:y,fillOpacity:f}),k.map((t,n)=>{const r=qe(t,o),i=Xe(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(T=null===(N=o.scales)||void 0===N?void 0:N.x)&&void 0!==T?T:null===(I=o.scales)||void 0===I?void 0:I.time,l=null!==(H=null===(z=o.scales)||void 0===z?void 0:z.y)&&void 0!==H?H:null===($=o.scales)||void 0===$?void 0:$.value;if(!a||!l)return null;const c=r.map(e=>[e[i],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.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-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)),p=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),f=null!==(F=t.confidence)&&void 0!==F?F:.95,m=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,v=null!==(W=t.steps)&&void 0!==W?W:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;v>=e;e++)k.push(b+e*x);const w=[];for(const e of k){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-p,2)/y:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=w.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(b)},${l(u(b))}`,j=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(R=t.fillOpacity)&&void 0!==R?R:.15,stroke:"none"}),e.createElement("polyline",{points:`${S} ${O}`,fill:"none",stroke:j,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(q=t.strokeDasharray)&&void 0!==q?q:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:a(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:j,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=Ve(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Ue(r,i,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,a=null!==(V=t.dy)&&void 0!==V?V:0,l=null!==(U=t.width)&&void 0!==U?U:32,c=null!==(Q=t.height)&&void 0!==Q?Q:32,u=null!==(K=t.content)&&void 0!==K?K:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=Ve(t,n,o);if(!r)return null;const{x:i,y:s}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(J=o.scales)||void 0===J?void 0:J.o,s=null===(Z=o.scales)||void 0===Z?void 0:Z.x,a=null===(ee=o.scales)||void 0===ee?void 0:ee.y,l=(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(te=t.opacity)&&void 0!==te?te:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===s)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},g)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},g))}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:I,yAccessor:z,width:a,height:l,data:H,frameType:"xy",pointNodes:$,curve:F,stickyPositionCache:Q.current};return N.map((e,o)=>{if(T){const r=T(e,o,n);return null!=r?r:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[N,T,a,l,I,z,H,h,$,F]),ee=function(e){var t;const n=i(e?nt:rt,e?tt:it,e?tt:it);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(R);return g||k||w||C||M||Z&&Z.length>0||x||q||ee?e.createElement("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof k?k:"XY Chart"),e.createElement("desc",null,"string"==typeof k?k+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${d.left},${d.top})`},x&&h&&!W&&e.createElement("g",{className:"stream-grid"},X.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:l,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),V.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:a,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),g&&h&&(()=>{const t=null==p?void 0:p.find(e=>"left"===e.orient),n=null==p?void 0:p.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=(null==t?void 0:t.jaggedBase)||!1,i=(null==n?void 0:n.jaggedBase)||!1,s=null==n?void 0:n.landmarkTicks,c=null==t?void 0:t.landmarkTicks,u="var(--semiotic-border, #ccc)",h="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)";return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!W&&(!n||!1!==n.baseline)&&!i&&e.createElement("line",{x1:0,y1:l,x2:a,y2:l,stroke:u,strokeWidth:1}),!W&&i&&e.createElement("path",{d:st("bottom",a,l),fill:"none",stroke:u,strokeWidth:1}),X.map((t,n)=>{const o=!!s&&("function"==typeof s?s(t.value,n):ut(t.value,n>0?X[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${l})`},e.createElement("line",{y2:5,stroke:u,strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:h,style:{userSelect:"none"}},t.label))}),y&&e.createElement("text",{x:a/2,y:l+40,textAnchor:"middle",fontSize:12,fill:g,style:{userSelect:"none"}},y),!W&&o&&!r&&e.createElement("line",{x1:0,y1:0,x2:0,y2:l,stroke:u,strokeWidth:1}),!W&&r&&e.createElement("path",{d:st("left",a,l),fill:"none",stroke:u,strokeWidth:1}),V.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):ut(t.value,n>0?V[n-1].value:void 0));return e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:u,strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:h,style:{userSelect:"none"}},t.label))}),(()=>{const n=(null==t?void 0:t.label)||f;return n?e.createElement("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:g,transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t||0===U.length)return null;const n=t.landmarkTicks,o=t.label||m;return e.createElement(e.Fragment,null,!1!==t.baseline&&e.createElement("line",{x1:a,y1:0,x2:a,y2:l,stroke:u,strokeWidth:1}),U.map((t,o)=>{const r=!!n&&("function"==typeof n?n(t.value,o):ut(t.value,o>0?U[o-1].value:void 0));return e.createElement("g",{key:"ytick-r-"+o,transform:`translate(${a},${t.pixel})`},e.createElement("line",{x2:5,stroke:u,strokeWidth:1}),e.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:h,style:{userSelect:"none"}},t.label))}),o&&e.createElement("text",{x:a+d.right-15,y:l/2,textAnchor:"middle",fontSize:12,fill:g,transform:`rotate(90, ${a+d.right-15}, ${l/2})`,style:{userSelect:"none"}},o))})())})(),Z,M&&h&&_&&P&&e.createElement(e.Fragment,null,M.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(We,{orient:"top",config:Fe(M.top),values:_,scale:h.x,size:d.top,length:a})),M.bottom&&e.createElement("g",{transform:`translate(0, ${l})`},e.createElement(We,{orient:"bottom",config:Fe(M.bottom),values:_,scale:h.x,size:d.bottom,length:a})),M.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(We,{orient:"left",config:Fe(M.left),values:P,scale:h.y,size:d.left,length:l})),M.right&&e.createElement("g",{transform:`translate(${a}, 0)`},e.createElement(We,{orient:"right",config:Fe(M.right),values:P,scale:h.y,size:d.right,length:l}))),C,ee&&ee.sourceId!==G&&(null==h?void 0:h.x)&&(()=>{const t=h.x(ee.xValue);return null==t||0>t||t>a?null:e.createElement("line",{x1:t,y1:0,x2:t,y2:l,stroke:"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:1,strokeDasharray:"4,4",pointerEvents:"none"})})(),q),k&&e.createElement("text",{x:c/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof k?k:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=i.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=r-i.bottom+50):(p=o-i.right+10,y=i.top),e.createElement("g",{transform:`translate(${p}, ${y})`},"object"==typeof(f=n)&&null!==f&&"gradient"in f?e.createElement(He,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement($e,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n);var f}({legend:w,totalWidth:c,totalHeight:u,margin:d,legendPosition:E,title:k,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:S,legendIsolatedCategories:j})):null}function ht(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const gt="undefined"==typeof window||"undefined"==typeof document,pt=e.createContext(null),yt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ft(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const mt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},vt={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},bt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},xt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},kt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},wt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},At={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Ot={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function St({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[s,a]=e.useState(!1),l=e.useContext(pt),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=s||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{s||c||a(!0)},[s,c]),p=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:yt}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:yt,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",t.length," elements)"));const y=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,k,w,A,O,S;const j=[];if(!Array.isArray(e))return j;for(const E of e)if(E&&"object"==typeof E)try{switch(E.type){case"point":j.push({label:"Point",values:{x:E.x,y:E.y}});break;case"line":{const e=E.path,t=Array.isArray(E.datum)?E.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&j.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=E.topPath,t=Array.isArray(E.datum)?E.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&j.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=E.datum&&"object"==typeof E.datum?E.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:E.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;j.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":j.push({label:"Cell",values:{x:E.x,y:E.y,value:E.value}});break;case"wedge":j.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=E.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=E.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=E.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":j.push({label:"Node",values:{id:null!==(h=null===(d=E.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=E.cx)&&void 0!==g?g:E.x,y:null!==(p=E.cy)&&void 0!==p?p:E.y}});break;case"arc":j.push({label:"Arc",values:{id:null!==(f=null===(y=E.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=E.cx)&&void 0!==m?m:E.x,y:null!==(v=E.cy)&&void 0!==v?v:E.y}});break;case"candlestick":j.push({label:"Candlestick",values:{x:E.x,open:E.open,high:E.high,low:E.low,close:E.close}});break;case"geoarea":j.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=E.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=E.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(S=null===(O=E.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return j}(t),f=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${mt(e.min)} to ${mt(e.max)}, mean ${mt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,f),v=y.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:p,style:vt,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:xt},"×"),e.createElement("div",{role:"note",style:bt},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:kt},e.createElement("caption",{style:Ot},"First ",v.length," of ",y.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:wt},"type"),x.map(t=>e.createElement("th",{key:t,style:wt},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:At},t.label),x.map(n=>{return e.createElement("td",{key:n,style:At},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":mt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function jt({summary:t}){return t?e.createElement("div",{role:"note",style:yt},t):null}function Et({tableId:t}){return e.createElement("a",{href:"#"+t,style:yt,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,yt)}},"Skip to data table")}function Ct({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:yt},n)}const Mt="var(--semiotic-focus, #005fcc)";function _t({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.createElement("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Mt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Mt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Mt,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function Pt({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.createElement("div",{ref:c,className:a,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},s)}function Bt(o){const r=s(null),c=Lt(o);return[function({children:t}){const i=n(()=>Lt(o),[]);return e.createElement(r.Provider,{value:i,children:t})},e=>{var n;const o=null!==(n=a(r))&&void 0!==n?n:c,s=t(e);s.current=e;const u=l(()=>s.current(o.getState()),[o]),d=l(()=>s.current(o.getState()),[o]);return i(o.subscribe,u,d)}]}function Lt(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const Nt={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Tt={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},It={mode:"light",colors:{primary:"#0000cc",categorical:["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},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"},[zt,Ht]=Bt(e=>({theme:Nt,setTheme(t){e(e=>{if("light"===t)return{theme:Nt};if("dark"===t)return{theme:Tt};if("high-contrast"===t)return{theme:It};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Tt:Nt;return{theme:Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})})}}return{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}}));function $t(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function Ft(e){switch(e){case"monotoneX":return W;case"monotoneY":return F;case"cardinal":return T;case"catmullRom":return N;case"step":return $;case"stepBefore":return z;case"stepAfter":return H;case"basis":return I;case"natural":return G;default:return null}}function Wt(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Dt(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function Rt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Gt(e,t,n=.3){Rt(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Yt(e,t,n=.6){var o,r,i,s,a;if(!Rt(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function qt(e,t,n,o=.35){Rt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Xt(e){switch(e){case"monotoneX":return W;case"monotoneY":return F;case"cardinal":return T;case"catmullRom":return N;case"step":return $;case"stepBefore":return z;case"stepAfter":return H;case"basis":return I;case"natural":return G;default:return null}}function Vt(e){if(e.startsWith("#")){const t=4===e.length?e[1]+e[1]+e[2]+e[2]+e[3]+e[3]:e.slice(1,7);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[78,121,167]}function Ut(e,t){const n=Xt(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=L().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const Qt=(e,t,n,o)=>{var r,i,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;const n=t.style.fill||"#4e79a7",o=t._decayOpacities;if(o&&o.length===t.topPath.length){const i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;e.fillStyle=n;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(o[n]+o[n+1])*i,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=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(o[n]+o[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=null!==(i=t.style.opacity)&&void 0!==i?i:1;if(Ut(e,t),t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let r=-1/0;for(const e of t.bottomPath)e[1]>r&&(r=e[1]);const i=Vt("string"==typeof n?n:"#4e79a7"),s=t.fillGradient.topOpacity,l=t.fillGradient.bottomOpacity,c=e.createLinearGradient(0,o,0,r);c.addColorStop(0,`rgba(${i[0]},${i[1]},${i[2]},${s})`),c.addColorStop(1,`rgba(${i[0]},${i[1]},${i[2]},${l})`),e.fillStyle=c,e.globalAlpha=a}else{const o=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=o*a,e.fillStyle=n}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Ut(e,t),qt(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a,e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=Xt(t.curve);if(e.beginPath(),n)R().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 n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}e.globalAlpha=1}},Kt=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Yt(e,t),e.globalAlpha=1}}finally{e.restore()}}},Jt=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?Zt(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),Gt(e,t),e.globalAlpha=1};function Zt(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}function en(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function tn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const nn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function on(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${nn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${nn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const rn={line:[Qt,(e,t,n,o)=>{var r,i;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a.style.stroke||"#007bff",c=a.style.strokeWidth||2,u=a.colorThresholds,d=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=c,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const y=null!==(r=a.style.opacity)&&void 0!==r?r:1;Dt(e,a.path,l,c,y,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=Ft(a.curve),g=u&&u.length>0&&d&&d.length===a.path.length,p=a._decayOpacities;if(p&&p.length===a.path.length&&!g){e.strokeStyle=l;const f=null!==(i=a.style.opacity)&&void 0!==i?i:1;for(let m=0;a.path.length-1>m;m++)e.globalAlpha=.5*(p[m]+p[m+1])*f,e.beginPath(),e.moveTo(a.path[m][0],a.path[m][1]),e.lineTo(a.path[m+1][0],a.path[m+1][1]),e.stroke()}else if(g){let v=null,b=null,x=null,k=null,w=!1;function A(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),w=!0}function O(){w&&(e.stroke(),w=!1)}for(let S=0;a.path.length>S;S++){const[j,E]=a.path[S],C=d[S],M=Wt(C,u,l);if(null!==v&&null!==k&&null!==x){if(M===k)e.lineTo(j,E);else{const _=[];for(const P of u){const B=P.value;(x>B||B>C)&&(B>x||C>B)||x===B||C===B||_.push({t:(B-x)/(C-x)})}_.sort((e,t)=>e.t-t.t);for(const L of _){const N=v+(j-v)*L.t,T=b+(E-b)*L.t,I=Wt(x+(C-x)*Math.min(L.t+1e-4,1),u,l);e.lineTo(N,T),O(),A(I,N,T)}e.lineTo(j,E)}v=j,b=E,x=C,k=M}else A(M,j,E),v=j,b=E,x=C,k=M}O()}else{if(e.beginPath(),e.strokeStyle=l,h)R().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(a.path);else{const[z,H]=a.path[0];e.moveTo(z,H);for(let $=1;a.path.length>$;$++)e.lineTo(a.path[$][0],a.path[$][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=a.style.fill,h&&!g)R().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(a.path);else{const[W,D]=a.path[0];e.moveTo(W,D);for(let G=1;a.path.length>G;G++)e.lineTo(a.path[G][0],a.path[G][1])}const F=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(F,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}},Kt],area:[Qt,Kt],stackedarea:[Qt,Kt],scatter:[Kt],bubble:[Kt],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle="#fff",e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Gt(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):tn(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=en(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[Jt],swarm:[Kt],waterfall:[(e,t,n,o)=>{var r,i,s;Jt(e,t);const a=t.filter(e=>"rect"===e.type);if(2>a.length)return;const l=a[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=c,e.lineWidth=null!==(r=null==l?void 0:l._connectorWidth)&&void 0!==r?r:1,e.setLineDash([]);for(let t=0;a.length-1>t;t++){const o=a[t],r=a[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(s=r.datum)||void 0===s?void 0:s.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=r.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const o=t._decayOpacity;null!=o&&1!==o&&(e.globalAlpha=o),e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke();const r=Math.min(t.openY,t.closeY),i=Math.abs(t.openY-t.closeY),s=t.isUp?t.upColor:t.downColor;e.fillStyle=s,e.fillRect(t.x-t.bodyWidth/2,r,t.bodyWidth,Math.max(i,1)),e.strokeStyle=s,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,r,t.bodyWidth,Math.max(i,1)),e.restore()}}]},sn={top:20,right:20,bottom:30,left:40},an={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"},ln={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 cn({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:ln},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}const un=c(function(i,s){var a,c,d,h,g,p,y,f,m,v,b;const{chartType:x,runtimeMode:k,data:w,chunkThreshold:A,chunkSize:O,xAccessor:S,yAccessor:j,colorAccessor:E,sizeAccessor:C,groupAccessor:M,lineDataAccessor:_,curve:P,normalize:B,binSize:L,valueAccessor:N,arrowOfTime:T="right",windowMode:I="sliding",windowSize:z=200,timeAccessor:H,xExtent:$,yExtent:F,extentPadding:W=.1,sizeRange:D,size:R=[500,300],responsiveWidth:G,responsiveHeight:Y,margin:q,className:X,background:Q,lineStyle:K,pointStyle:J,areaStyle:Z,waterfallStyle:ee,swarmStyle:te,barColors:ne,colorScheme:oe,boundsAccessor:re,boundsStyle:ie,y0Accessor:se,gradientFill:ae,openAccessor:le,highAccessor:ce,lowAccessor:ue,closeAccessor:de,candlestickStyle:he,showAxes:ge=!0,axes:pe,xLabel:ye,yLabel:fe,yLabelRight:me,xFormat:ve,yFormat:be,tickFormatTime:xe,tickFormatValue:ke,hoverAnnotation:Ae,tooltipContent:je,customHoverBehavior:Pe,enableHover:Ne,annotations:Te,svgAnnotationRules:Ie,showGrid:ze,legend:He,legendHoverBehavior:$e,legendClickBehavior:Fe,legendHighlightedCategory:We,legendIsolatedCategories:De,legendPosition:Re,backgroundGraphics:Ge,foregroundGraphics:Ye,canvasPreRenderers:qe,svgPreRenderers:Xe,title:Ve,categoryAccessor:Ue,brush:Qe,onBrush:Ke,decay:Je,pulse:Ze,transition:et,staleness:tt,heatmapAggregation:nt,heatmapXBins:ot,heatmapYBins:rt,showValues:it,heatmapValueFormat:st,marginalGraphics:lt,pointIdAccessor:ct,xScaleType:ut,yScaleType:pt,accessibleTable:yt=!0,description:mt,summary:vt,linkedCrosshairName:bt,linkedCrosshairSourceId:xt}=i,kt=function(){const[e,t]=r(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return o(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),wt=t(kt);wt.current=kt;const[At,Ot]=function(e,n,i){const s=t(null),[a,l]=r(null);return o(()=>{if(!n&&!i)return;const e=s.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,i]),[s,[n&&a?a.w:e[0],i&&a?a.h:e[1]]]}(R,G,Y),Mt=Object.assign(Object.assign({},sn),q);if(lt){const e=60;lt.top&&e>Mt.top&&(Mt.top=e),lt.bottom&&e>Mt.bottom&&(Mt.bottom=e),lt.left&&e>Mt.left&&(Mt.left=e),lt.right&&e>Mt.right&&(Mt.right=e)}const Bt=Ot[0]-Mt.left-Mt.right,Lt=Ot[1]-Mt.top-Mt.bottom,Nt="function"==typeof Ye?Ye({size:Ot,margin:Mt}):Ye,Tt="function"==typeof Ge?Ge({size:Ot,margin:Mt}):Ge,It=null!=Ae?Ae:Ne,zt=t(null),Ft=t(null),Wt=t(0),Dt=t(!1),Rt=Ht(e=>e.theme),[Gt,Yt]=r(0),[qt,Xt]=r(null),Vt=t(null),Ut=t(null),[Qt,Kt]=r(null),[Jt,Zt]=r(!1),[en,tn]=r([]),[nn,ln]=r([]),un=t(()=>{}),dn="streaming"===k||["bar","swarm","waterfall"].includes(x),hn=n(()=>({chartType:x,runtimeMode:dn?"streaming":"bounded",windowSize:z,windowMode:I,arrowOfTime:dn?T:"right",extentPadding:W,xAccessor:dn?void 0:S,yAccessor:dn?void 0:j,timeAccessor:dn?H:void 0,valueAccessor:N,colorAccessor:E,sizeAccessor:C,groupAccessor:M,categoryAccessor:Ue,lineDataAccessor:_,xScaleType:ut,yScaleType:pt,xExtent:$,yExtent:F,sizeRange:D,binSize:L,normalize:B,boundsAccessor:re,boundsStyle:ie,y0Accessor:se,gradientFill:"boolean"==typeof ae?ae?{topOpacity:.8,bottomOpacity:.05}:void 0:ae,openAccessor:le,highAccessor:ce,lowAccessor:ue,closeAccessor:de,candlestickStyle:he,lineStyle:K,pointStyle:J,areaStyle:Z,swarmStyle:te,waterfallStyle:ee,colorScheme:oe,barColors:ne,annotations:Te,decay:Je,pulse:Ze,transition:et,staleness:tt,heatmapAggregation:nt,heatmapXBins:ot,heatmapYBins:rt,showValues:it,heatmapValueFormat:st,pointIdAccessor:ct,curve:P}),[x,z,I,T,W,S,j,H,N,ut,pt,E,C,M,Ue,_,$,F,D,L,B,re,ie,se,ae,le,ce,ue,de,he,K,J,Z,te,ee,oe,ne,Te,Je,Ze,et,tt,nt,ot,rt,it,st,dn,ct,P]),gn=t(null);gn.current||(gn.current=new we(hn));const pn=l(()=>{Wt.current||(Wt.current=requestAnimationFrame(()=>un.current()))},[]);o(()=>{var e;null===(e=gn.current)||void 0===e||e.updateConfig(hn),Dt.current=!0,pn()},[hn,pn]),o(()=>{Dt.current=!0,pn()},[Rt,pn]);const yn=t(null);yn.current||(yn.current=new U(e=>{const t=gn.current;t&&t.ingest(e)&&(Dt.current=!0,pn())},{chunkThreshold:A,chunkSize:O})),o(()=>{var e;null===(e=yn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:A,chunkSize:O})},[A,O]);const fn=l(e=>{var t;null===(t=yn.current)||void 0===t||t.push(e)},[]),mn=l(e=>{var t;null===(t=yn.current)||void 0===t||t.pushMany(e)},[]),vn=l(()=>{var e,t;null===(e=yn.current)||void 0===e||e.clear(),null===(t=gn.current)||void 0===t||t.clear(),Dt.current=!0,pn()},[pn]);u(s,()=>({push:fn,pushMany:mn,clear:vn,getData:()=>{var e,t,n;return null===(e=yn.current)||void 0===e||e.flush(),null!==(n=null===(t=gn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=gn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=gn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[fn,mn,vn]),o(()=>{var e;w&&(null===(e=yn.current)||void 0===e||e.setBoundedData(w))},[w]);const bn=t(()=>{}),xn=t(()=>{});bn.current=e=>{if(!It)return;const t=zt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Mt.left,r=e.clientY-n.top-Mt.top;if(0>o||o>Bt||0>r||r>Lt)return void(Vt.current&&(Vt.current=null,Ut.current=null,Kt(null),Pe&&(Pe(null),Dt.current=!0),pn()));const i=gn.current;if(!i||0===i.scene.length)return;const s=function(e,t,n,o=30,r){let i=null,s=!1;if(r){const e=r.find(t,n,o);if(e){const r=Oe(e,t,n);r&&o>r.distance&&(i=r,s=!0)}}for(const a of e){let e=null;switch(a.type){case"point":if(r&&s)break;e=Oe(a,t,n);break;case"line":e=Se(a,t,n);break;case"rect":e=Ee(a,t,n);break;case"heatcell":e=Ce(a,t,n);break;case"area":if(!1===a.interactive)break;e=_e(a,t,n);break;case"candlestick":e=Me(a,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(i.scene,o,r,30,i.quadtree);if(!s)return void(Vt.current&&(Vt.current=null,Ut.current=null,Kt(null),Pe&&Pe(null),pn()));const a=s.datum||{},l=Object.assign(Object.assign({},"object"!=typeof a||null===a||Array.isArray(a)?{}:a),{data:a,time:s.x,value:s.y,x:s.x,y:s.y});Vt.current=l,Ut.current=s.node,Kt(l),Pe&&(Pe(l),Dt.current=!0),pn()},xn.current=()=>{Vt.current&&(Vt.current=null,Ut.current=null,Kt(null),Pe&&(Pe(null),Dt.current=!0),pn())},l(e=>bn.current(e),[]);const kn=l(()=>xn.current(),[]),wn=t(-1),An=t(null),On=t(null),Sn=l(e=>{const t=gn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(On.current&&On.current.version===n)o=On.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const s of e)switch(s.type){case"point":i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(t=s.group)&&void 0!==t?t:"_default"});break;case"line":{const e=s,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.path.length>n&&t.length>n;n++)i.push({x:e.path[n][0],y:e.path[n][1],datum:t[n],shape:"circle",group:o});break}case"area":{const e=s,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:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(r=s.group)&&void 0!==r?r:"_default"});break;case"heatcell":i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:s}}(e),On.current={version:n,graph:o}}const r=wn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),wn.current=0;const t=o.flat[0];An.current={shape:t.shape,w:t.w,h:t.h};const n=Le(t);return Vt.current=n,Kt(n),Pe&&Pe(n),void pn()}const i=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}(o,r),s=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Be(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Be(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,i,o);if(null===s)return;if(e.preventDefault(),0>s)return wn.current=-1,An.current=null,Vt.current=null,Ut.current=null,Kt(null),Pe&&Pe(null),void pn();wn.current=s;const a=o.flat[s];An.current={shape:a.shape,w:a.w,h:a.h};const l=Le(a);Vt.current=l,Kt(l),Pe&&Pe(l),pn()},[Pe,pn]),jn=l(e=>{wn.current=-1,An.current=null,bn.current(e)},[]);un.current=()=>{var e,t;Wt.current=0;const n=zt.current,o=Ft.current;if(!n||!o)return;const r=gn.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(wt.current?i+1e6:i),a=!wt.current&&s,l=Dt.current||s;l&&!a&&r.computeScene({width:Bt,height:Lt});const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return an;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=o||t.getPropertyValue("--text-secondary").trim(),s=t.getPropertyValue("--text-primary").trim(),a=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||s||n?{axisStroke:a||an.axisStroke,tickText:i||an.tickText,crosshair:i?i+"66":an.crosshair,hoverFill:l?l+"4D":an.hoverFill,hoverStroke:i?i+"99":an.hoverStroke,pointRing:l||an.pointRing}:an}(n),d=null!==(e=null==tt?void 0:tt.threshold)&&void 0!==e?e:5e3,h=tt&&r.lastIngestTime>0&&i-r.lastIngestTime>d;if(l){const e=$t(n,Ot,Mt,c);if(e){e.clearRect(-Mt.left,-Mt.top,Ot[0],Ot[1]),h&&(e.globalAlpha=null!==(t=null==tt?void 0:tt.dimOpacity)&&void 0!==t?t:.5);const o=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=Q||(o&&"transparent"!==o?o:null);if(i&&(e.fillStyle=i,e.fillRect(-Mt.left,-Mt.top,Ot[0],Ot[1])),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Bt,Lt),e.clip()),qe&&r.scales)for(const t of qe)e.save(),t(e,r.scene,r.scales,{width:Bt,height:Lt}),e.restore();const s=rn[x];if(s&&r.scales)for(const t of s)t(e,r.scene,r.scales,{width:Bt,height:Lt});e.restore(),h&&(e.globalAlpha=1)}}{const e=$t(o,Ot,Mt,c);if(e&&(e.clearRect(-Mt.left,-Mt.top,Ot[0],Ot[1]),It&&Vt.current&&r.scales&&function(e,t,n,o,r,i,s){var a;if(!1===r.crosshair)return;e.save();const l="object"==typeof r.crosshair?r.crosshair:{};e.strokeStyle=l.stroke||s.crosshair,e.lineWidth=l.strokeWidth||1,e.setLineDash(l.strokeDasharray?l.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(t.x,0),e.lineTo(t.x,o),e.stroke(),e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke(),e.restore();let c="";try{(null===(a=e.canvas)||void 0===a?void 0:a.parentElement)&&(c=getComputedStyle(e.canvas).getPropertyValue("--semiotic-primary").trim())}catch(e){}const u=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||c||"#007bff";e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=u,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}(e,Vt.current,Bt,Lt,"object"==typeof It?It:{},Ut.current,u),Ut.current&&Array.isArray(Ae))){const t=Ae.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o){var r;if(!n)return;const i=n.group;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?o.style(n.datum):o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||"#007bff",e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,r.scene,Ut.current,t)}}l&&n&&n.setAttribute("aria-label",ft(r.scene,x+" chart"));const g=Dt.current;if(Dt.current=!1,g&&r.scales&&((!qt||qt.x.domain()[0]!==r.scales.x.domain()[0]||qt.x.domain()[1]!==r.scales.x.domain()[1]||qt.y.domain()[0]!==r.scales.y.domain()[0]||qt.y.domain()[1]!==r.scales.y.domain()[1]||qt.x.range()[0]!==r.scales.x.range()[0]||qt.x.range()[1]!==r.scales.x.range()[1]||qt.y.range()[0]!==r.scales.y.range()[0]||qt.y.range()[1]!==r.scales.y.range()[1])&&Xt(r.scales),lt)){const e=r.getData(),t="function"==typeof S?S:e=>e[S||"x"],n="function"==typeof j?j:e=>e[j||"y"];tn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),ln(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}g&&Te&&Te.length>0&&Yt(e=>e+1),(null==tt?void 0:tt.showBadge)&&Zt(!!h),(a||r.hasActivePulses)&&(Wt.current=requestAnimationFrame(()=>un.current()))},o(()=>(pn(),()=>{Wt.current&&(cancelAnimationFrame(Wt.current),Wt.current=0)}),[pn]),o(()=>{Dt.current=!0,pn()},[x,Bt,Lt,ge,Q,K,qe,pn]),function(e,t,n,r,i,s){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}(tt,gn,Dt,pn,Jt,Zt);const En=n(()=>{if(ve||xe)return;const e=gn.current;return(null==e?void 0:e.xIsDate)&&qt?on(qt.x.domain()):void 0},[ve,xe,qt]),Cn=ve||xe||En,Mn=It&&Qt?je?je(Qt):e.createElement(cn,{hover:Qt}):null,_n=Mn?e.createElement(Pt,{x:Qt.x,y:Qt.y,containerWidth:Bt,containerHeight:Lt,margin:Mt,className:"stream-frame-tooltip"},Mn):null,Pn=An.current,Bn=e.createElement(_t,{active:wn.current>=0,hoverPoint:Qt,margin:Mt,size:Ot,shape:null==Pn?void 0:Pn.shape,width:null==Pn?void 0:Pn.w,height:null==Pn?void 0:Pn.h}),Ln=(e,t,n,o)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null},Nn=Ln(S,H,"__semiotic_resolvedX","__semiotic_resolvedTime"),Tn=Ln(j,N,"__semiotic_resolvedY","__semiotic_resolvedValue"),In=Nn.key,zn=Tn.key,Hn=Te&&Te.length>0,$n=e=>{if(!e||!Hn||!Nn.fn&&!Tn.fn)return e;let t=!1;const n=e.map(e=>{const n=Nn.fn&&Nn.key&&!(Nn.key in e),o=Tn.fn&&Tn.key&&!(Tn.key in e);if(!n&&!o)return e;t=!0;const r=Object.assign({},e);return n&&(r[Nn.key]=Nn.fn(e)),o&&(r[Tn.key]=Tn.fn(e)),r});return t?n:e};if(gt){const t=gn.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:Bt,height:Lt}));const n=null!==(a=null==t?void 0:t.scene)&&void 0!==a?a:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r=Cn||(()=>{if((null==t?void 0:t.xIsDate)&&o)return on(o.x.domain())})();return e.createElement("div",{className:"stream-xy-frame"+(X?" "+X:""),role:"img","aria-label":mt||("string"==typeof Ve?Ve:"XY chart"),style:{position:"relative",width:Ot[0],height:Ot[1]}},e.createElement(jt,{summary:vt}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ot[0],height:Ot[1],style:{position:"absolute",left:0,top:0}},e.createElement("g",{transform:`translate(${Mt.left},${Mt.top})`},Tt),e.createElement("g",{transform:`translate(${Mt.left},${Mt.top})`},Q&&e.createElement("rect",{x:0,y:0,width:Bt,height:Lt,fill:Q}),Xe&&o&&Xe.map((t,r)=>e.createElement(e.Fragment,{key:"svgpre-"+r},t(n,o,{width:Bt,height:Lt}))),n.map((t,n)=>function(t,n){var o,r,i;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const r="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"line-"+n,d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})}case"area":{const i=t;if(0===i.topPath.length)return null;const s=i.topPath.map(([e,t])=>`${e},${t}`).join("L"),a=[...i.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"area-"+n,d:`M${s}L${a}Z`,fill:ht(i.style.fill),fillOpacity:null!==(r=null!==(o=i.style.fillOpacity)&&void 0!==o?o:i.style.opacity)&&void 0!==r?r:.7,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})}case"point":{const o=t;return e.createElement("circle",{key:"point-"+n,cx:o.x,cy:o.y,r:o.r,fill:ht(o.style.fill),opacity:null!==(i=o.style.opacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"rect":{const o=t;return e.createElement("rect",{key:"rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:ht(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[r,i,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]}(o.fill),a=.299*r+.587*i+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.createElement("g",{key:"heatcell-"+n},e.createElement("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.createElement("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px"},t))}return e.createElement("rect",{key:"heatcell-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill})}case"candlestick":{const o=t,r=Math.min(o.openY,o.closeY),i=Math.max(Math.abs(o.openY-o.closeY),1),s=o.isUp?o.upColor:o.downColor;return e.createElement("g",{key:"candle-"+n},e.createElement("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.createElement("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:i,fill:s,stroke:s,strokeWidth:1}))}default:return null}}(t,n)).filter(Boolean))),e.createElement(dt,{width:Bt,height:Lt,totalWidth:Ot[0],totalHeight:Ot[1],margin:Mt,scales:o,showAxes:ge,axes:pe,xLabel:ye,yLabel:fe,yLabelRight:me,xFormat:r,yFormat:be||ke,showGrid:ze,title:Ve,legend:He,legendHoverBehavior:$e,legendClickBehavior:Fe,legendHighlightedCategory:We,legendIsolatedCategories:De,legendPosition:Re,foregroundGraphics:Nt,marginalGraphics:lt,xValues:[],yValues:[],annotations:Te,svgAnnotationRules:Ie,annotationFrame:0,xAccessor:In,yAccessor:zn,annotationData:$n(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof P?P:void 0,linkedCrosshairName:bt,linkedCrosshairSourceId:xt}))}const Fn="semiotic-table-"+e.useId();return e.createElement("div",{ref:At,className:"stream-xy-frame"+(X?" "+X:""),role:"group","aria-label":mt||("string"==typeof Ve?Ve:"XY chart"),tabIndex:0,style:{position:"relative",width:G?"100%":Ot[0],height:Y?"100%":Ot[1],overflow:"visible"},onKeyDown:Sn},yt&&e.createElement(Et,{tableId:Fn}),yt&&e.createElement(St,{scene:null!==(h=null===(d=gn.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:x+" chart",tableId:Fn,chartTitle:"string"==typeof Ve?Ve:void 0}),e.createElement(jt,{summary:vt}),e.createElement("div",{role:"img","aria-label":mt||("string"==typeof Ve?Ve:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:It?jn:void 0,onMouseLeave:It?kn:void 0},Tt&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Ot[0],height:Ot[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Mt.left},${Mt.top})`},Tt)),e.createElement(at,{width:Bt,height:Lt,totalWidth:Ot[0],totalHeight:Ot[1],margin:Mt,scales:qt,showAxes:ge,axes:pe,showGrid:ze,xFormat:Cn,yFormat:be||ke}),e.createElement("canvas",{ref:zt,"aria-label":ft(null!==(p=null===(g=gn.current)||void 0===g?void 0:g.scene)&&void 0!==p?p:[],x+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:Ft,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(Ct,{hoverPoint:Qt}),e.createElement(dt,{width:Bt,height:Lt,totalWidth:Ot[0],totalHeight:Ot[1],margin:Mt,scales:qt,showAxes:ge,axes:pe,xLabel:ye,yLabel:fe,yLabelRight:me,xFormat:Cn,yFormat:be||ke,showGrid:ze,title:Ve,legend:He,legendHoverBehavior:$e,legendClickBehavior:Fe,legendHighlightedCategory:We,legendIsolatedCategories:De,legendPosition:Re,foregroundGraphics:Nt,marginalGraphics:lt,xValues:en,yValues:nn,annotations:Te,svgAnnotationRules:Ie,annotationFrame:Gt,xAccessor:In,yAccessor:zn,annotationData:$n(null===(y=gn.current)||void 0===y?void 0:y.getData()),pointNodes:null===(f=gn.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type),curve:"string"==typeof P?P:void 0,underlayRendered:!0,linkedCrosshairName:bt,linkedCrosshairSourceId:xt}),(Qe||Ke)&&e.createElement(V,{width:Bt,height:Lt,totalWidth:Ot[0],totalHeight:Ot[1],margin:Mt,dimension:null!==(m=null==Qe?void 0:Qe.dimension)&&void 0!==m?m:"xy",scales:qt,onBrush:null!=Ke?Ke:()=>{},binSize:L,snap:null==Qe?void 0:Qe.snap,binBoundaries:null!==(v=null==Qe?void 0:Qe.binBoundaries)&&void 0!==v?v:"bar"===x?null===(b=gn.current)||void 0===b?void 0:b.getBinBoundaries():void 0,snapDuring:null==Qe?void 0:Qe.snapDuring,streaming:"streaming"===k}),(null==tt?void 0:tt.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===tt.badgePosition?{top:4,left:4}:"bottom-left"===tt.badgePosition?{bottom:4,left:4}:"bottom-right"===tt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Jt?"#dc3545":"#28a745",color:"white"})},Jt?"STALE":"LIVE"),Bn,_n))});un.displayName="StreamXYFrame";const dn=s(null);function hn(){return a(dn)}function gn(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function pn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[yn,fn]=Bt(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=pn(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=pn(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[mn,vn]=Bt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function bn(e){const t=d(),o=e.clientId||t,{name:r}=e,i=fn(e=>e.selections.get(r)),s=fn(e=>e.setClause),a=fn(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(gn(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:c,selectPoints:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(r,{clientId:o,type:"point",fields:t})},[o,r,s]),selectInterval:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(r,{clientId:o,type:"interval",fields:t})},[o,r,s]),clear:l(()=>{a(r,o)},[a,r,o]),clientId:o}}function xn(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=bn({name:t});return{onHover:l(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,s,t]),predicate:o,isActive:r}}function kn(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:s,selectInterval:a,clear:c}=bn({name:t}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=l(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,o,r,a,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:c}}const wn=s(!1);function An({selections:e}){const t=fn(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function On({categoryColors:n,interaction:i,selectionName:s,field:a}){const c=Object.entries(n);if(0===c.length)return null;const u=c.map(([e])=>e),d=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],h=xn({name:s,fields:[a]}),g=bn({name:s,clientId:"__linked-legend-isolate__"}),[p,y]=r(new Set),[f,m]=r(null),v=t(g.selectPoints);v.current=g.selectPoints;const b=t(g.clear);b.current=g.clear,o(()=>{"isolate"===i&&(p.size>0?v.current({[a]:Array.from(p)}):b.current())},[i,p,a]);const x=l(e=>{"highlight"===i&&(e?(m(e.label),h.onHover({[a]:e.label})):(m(null),h.onHover(null)))},[i,a,h]),k=l(e=>{"isolate"===i&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[i,u.length]);return e.createElement("svg",{width:"100%",height:30,style:{display:"block",overflow:"visible"}},e.createElement($e,{legendGroups:d,title:!1,orientation:"horizontal",height:20,customHoverBehavior:"highlight"===i?x:void 0,customClickBehavior:"isolate"===i?k:void 0,highlightedCategory:f,isolatedCategories:p}))}function Sn({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:s="legend",legendField:a="category"}){const l=hn(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(yn,null,e.createElement(mn,null,n&&e.createElement(An,{selections:n}),e.createElement(wn.Provider,{value:c},c&&"top"===r&&l&&e.createElement(On,{categoryColors:l,interaction:i,selectionName:s,field:a}),t,c&&"bottom"===r&&l&&e.createElement(On,{categoryColors:l,interaction:i,selectionName:s,field:a}))))}function jn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):ie[i%ie.length];return{label:r+"",color:a}}),label:""}]}}function En(e){return e?"string"==typeof e?{name:e}:e:null}function Cn(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}e.createContext(void 0);const Mn="#007bff";function _n(){var e;const t=Ht(e=>e.theme),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Pn(e){return"function"==typeof e?e:t=>t[e]}function Bn(e,t,o){const r=hn(),i=_n();return n(()=>{var n;if(!t)return;const s=null!==(n=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==n?n:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(r&&Object.keys(r).length>0){const e=le(n.map(e=>({_cat:e})),"_cat",s);return t=>r[t]||e(t)}return le(n.map(e=>({_cat:e})),"_cat",s)}if(r&&Object.keys(r).length>0){const n=le(e,t,s);return e=>r[e]||n(e)}return le(e,t,s)}if(r&&Object.keys(r).length>0){const e=le([{_:"a"}],"_",s);return t=>r[t]||e(t)}},[e,t,o,r,i])}function Ln({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:r=!1,onObservation:i,chartType:s,chartId:a,onClick:c}){const u=d(),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}(t,n),g=bn({name:(null==e?void 0:e.name)||"__unused__"}),p=xn({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||n||[]}),y=vn(e=>e.pushObservation),f=e?{isActive:g.isActive,predicate:g.predicate}:null,m=l(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const e=null==t?void 0:t[h.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=Ke.positions.get(e);o&&o.xValue===t&&o.sourceId===n||(Ke={positions:new Map(Ke.positions).set(e,{xValue:t,sourceId:n})},Ze())}(h.name||"hover",Number(e),u)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&et(h.name||"hover",u),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(i||y){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const s=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(s),y&&y(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),y&&y(e)}}},[t,p,h,u,i,s,a,y]),v=l(e=>{var t,n,o,r;if(e&&c){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),c(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||y){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),y&&y(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),y&&y(e)}}},[c,i,y,s,a]);return o(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{et(e,u)}},[null==h?void 0:h.mode,null==h?void 0:h.name,u]),{activeSelectionHook:f,customHoverBehavior:m,customClickBehavior:v,crosshairSourceId:u}}function Nn(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Tn({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=a(wn),d=void 0!==r?r:!u&&!!t,h=n(()=>{if(d&&t)return jn({data:e,colorBy:t,colorScale:o,getColor:ae,categories:c})},[d,t,e,o,c]),g=n(()=>{const e=Object.assign(Object.assign({},l),s);return h&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[l,s,h,i]);return{legend:h,margin:g,legendPosition:i}}function In(e,t,o){const[i,s]=r(null),[a,c]=r(new Set),u=l(t=>{"highlight"===e&&s(t?t.label:null)},[e]),d=l(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=n(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===i}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return a.has(o)}}:null},[e,t,i,a]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?a:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}const zn={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 Hn(e,t,n){var o,r,i,s,a,l;const c=zn[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?c.width:n.width,height:null!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?c.height:n.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||c.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:$n(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function $n(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}const Fn={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 Wn(e,t){return"function"==typeof t?t(e):e[t]}function Dn(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":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 Rn(t={}){const{fields:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=Wn(t,o);a=Dn(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=Wn(t,o);l.push({label:n,value:Dn(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=Dn(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=Dn(t[e[0]],r))}}const c=Object.assign(Object.assign({},Fn),i);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},a&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&a?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function Gn(t){if(!0===t)return Rn();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:Fn},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Rn(t):Rn())}function Yn(e){return"string"==typeof e?e:"value"}function qn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Xn(e,t){return"function"==typeof t?t(e):e[t]}function Vn(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const r=t.data;if(!r)return null;const i=n?qn(Xn(r,n.accessor)):null;return e.createElement("div",{className:"semiotic-tooltip",style:Fn},i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=qn(Xn(r,t.accessor));return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.7}},t.label,": "),e.createElement("span",null,o))}))}}function Un({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,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"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("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}},o)))}class Qn extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(Un,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Kn(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Jn(e,t,n=3){let o,r=n+1;for(const n of t){const t=Kn(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Zn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function eo(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=Jn(e,t,3))&&void 0!==n?n:null)}function to({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=Zn(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=eo(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const no={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},oo={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},ro={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},io=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],so=["vertical","horizontal"],ao={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},no),oo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:io},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},no),oo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:io},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},no),oo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:io},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({},no),oo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},no),oo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},no),oo),{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({},no),oo),{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({},no),oo),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},no),oo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},no),ro),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:so},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},no),ro),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:so},normalize:{type:"boolean"},barPadding:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},no),ro),{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:so},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},no),ro),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:so},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},no),ro),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:so},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({},no),ro),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:so},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},no),ro),{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({},no),ro),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:so},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({},no),ro),{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({},no),ro),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:so},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},no),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},no),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},no),ro),{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({},no),ro),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},no),{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({},no),{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:so},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},no),{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({},no),{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({},no),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},no),{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({},no),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function lo(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const co=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),uo=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),ho=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),go=new Set(["LineChart","AreaChart","StackedAreaChart"]),po=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function yo(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function fo(e,t){const n=yo(e),o=yo(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const mo=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function vo(e,t){const n=[],o=function(e,t){const n=[],o=ao[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(ao).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!lo(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=Jn(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const s=to({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=Zn(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=eo(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return ao[e]?(function(e,t,n){const o=ao[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=ao[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){co.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){uo.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=ao[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=t.xAccessor;"string"==typeof s&&i[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!ho.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!go.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(r=t.height)&&void 0!==r?r:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=ao[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(i.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!po.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=fo(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=fo(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of mo)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var bo;const xo="undefined"!=typeof process&&"production"!==(null===(bo=process.env)||void 0===bo?void 0:bo.NODE_ENV);function ko({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(Qn,{fallback:i=>{let s="";if(xo&&r)try{const e=vo(t,r);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(Un,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})}},i)}const wo={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"},Ao={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Oo(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},wo),{width:n,height:o})},r||"No data available"):null}function So(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Ao),{position:"absolute",top:a+o*(i+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function jo(e,t,n,o){if(!xo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Eo(e,t,n,o){return new(n||(n=Promise))(function(r,i){function s(e){try{l(o.next(e))}catch(e){i(e)}}function a(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Co="__forecastSegment";let Mo=null;function _o(){return Eo(this,void 0,void 0,function*(){return Mo||(Mo=yield import("./xy-statisticalOverlays-C2PPlmXv.js")),Mo})}const Po=c(function(i,s){var a,c;const d=t(null);u(s,()=>({push:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=d.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=d.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const h=Hn(i.mode,{width:i.width,height:i.height,showGrid:i.showGrid,enableHover:i.enableHover,showLegend:i.showLegend,title:i.title,description:i.description,summary:i.summary,accessibleTable:i.accessibleTable,xLabel:i.xLabel,yLabel:i.yLabel}),{data:g,margin:p,className:y,xFormat:f,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:O="linear",showPoints:S=!1,pointRadius:j=3,fillArea:E=!1,areaOpacity:C=.3,lineWidth:M=2,tooltip:_,pointIdAccessor:P,annotations:B,directLabel:L,gapStrategy:N="break",anomaly:T,forecast:I,frameProps:z={},selection:H,linkedHover:$,onObservation:F,onClick:W,chartId:D,loading:R,emptyContent:G,legendInteraction:Y,legendPosition:q,xScaleType:X,yScaleType:V}=i,U=h.width,Q=h.height,K=h.enableHover,J=h.showGrid,Z=h.showLegend,ee=h.title,te=h.description,ne=h.summary,oe=h.accessibleTable,re=h.xLabel,ie=h.yLabel,se=So(R,U,Q),le=se?null:Oo(g,U,Q,G),ce=g||[];jo("LineChart",ce,"xAccessor",v),jo("LineChart",ce,"yAccessor",b);const ue="string"==typeof v?v:"__semiotic_resolvedX",de="string"==typeof b?b:"__semiotic_resolvedY",[he,ge]=r(null),[pe,ye]=r([]),fe=n(()=>{if(!I&&!T)return ce;const e="function"==typeof v,t="function"==typeof b;return e||t?ce.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=v(n)),t&&(o.__semiotic_resolvedY=b(n)),o}):ce},[ce,I,T,v,b]),me=t(I),ve=t(T);o(()=>{if(!I&&!T)return void((me.current||ve.current)&&(ge(null),ye([]),me.current=I,ve.current=T));let e=!1;const t=I!==me.current||T!==ve.current;if(me.current=I,ve.current=T,t&&(ge(null),ye([])),I){const t=x&&"string"==typeof x&&"object"==typeof I?Object.assign(Object.assign({},I),{_groupBy:x}):I;(function(...e){return Eo(this,void 0,void 0,function*(){return(yield _o()).buildForecast(...e)})})(fe,ue,de,t,T).then(t=>{e||(ge(t),ye(t.annotations))}).catch(()=>{e||(ge(null),ye([]))})}else T&&function(...e){return Eo(this,void 0,void 0,function*(){return(yield _o()).buildAnomalyAnnotations(...e)})}(T).then(t=>{e||(ge(null),ye(t))}).catch(()=>{e||ye([])});return()=>{e=!0}},[fe,I,T,ue,de]);const be=he?he.processedData:ce,xe="__compoundGroup",ke=!(!I||!x),we=ke?xe:I?Co:x,Ae=n(()=>{if(!ke)return be;const e="function"==typeof x?x:e=>e[x];return be.map(t=>{const n=Object.assign({},t);return n[xe]=`${e(t)}__${t[Co]||"observed"}`,n})},[be,ke,x]),Oe=ke?Ae:be,Se=n(()=>{if(!I)return;const e=I.upperBounds,t=I.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=he?he.processedData:ce;for(const e of s){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[I,he,ce,b]),{activeSelectionHook:je,customHoverBehavior:Ee,customClickBehavior:Ce,crosshairSourceId:Me}=Ln({selection:H,linkedHover:$,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:F,onClick:W,chartType:"LineChart",chartId:D}),_e=Nn($,Me),Pe=l(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),Be=void 0!==(null===(a=Oe[0])||void 0===a?void 0:a[k]),Le=n(()=>{if(Be)return Oe;if(we){const e=Oe.reduce((e,t)=>{const n="function"==typeof we?we(t):t[we];if(!e[n]){const o={[k]:[]};"string"==typeof we&&(o[we]=n),ke&&(o[Co]=t[Co],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:Oe}]},[Oe,we,k,Be]),{gapProcessedLineData:Ne,hasGaps:Te}=n(()=>{if("interpolate"===N){let e=!1;const t=[];for(const n of Le){const o=(n[k]||[]).filter(t=>!Pe(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===N){let e=!1;const t=[];for(const n of Le){const o=n[k]||[];let r=[],i=0;const s=we&&"string"==typeof we?n[we]:void 0;for(const a of o)if(Pe(a))e=!0,r.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:r})),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}r.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===N){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of Le){const r=o[k]||[],i=[];for(const n of r)Pe(n)?(e=!0,i.push(Object.assign(Object.assign({},n),{[t]:0}))):i.push(n);n.push(Object.assign(Object.assign({},o),{[k]:i}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Le,hasGaps:!1}},[Le,N,k,Pe,we,b]),Ie=Bn(be,w,A),ze=n(()=>{if(!w)return[];const e=new Set;for(const t of be){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[be,w]),He=In(Y,w,ze),$e=n(()=>He.legendSelectionHook?He.legendSelectionHook:je,[He.legendSelectionHook,je]),Fe=n(()=>e=>{const t={strokeWidth:M};return w?Ie&&(t.stroke=ae(e,w,Ie),E&&(t.fill=t.stroke,t.fillOpacity=C)):(t.stroke=Mn,E&&(t.fill=Mn,t.fillOpacity=C)),t},[w,Ie,M,E,C]),[We,De]=r(null);o(()=>{if(!I)return void De(null);let e=!1;return function(...e){return Eo(this,void 0,void 0,function*(){return(yield _o()).createSegmentLineStyle(...e)})}(Fe,I).then(t=>{e||De(()=>t)}).catch(()=>{e||De(null)}),()=>{e=!0}},[Fe,I]);const Re=We||Fe,Ge=n(()=>Cn(Re,$e,H),[Re,$e,H]),Ye=n(()=>{if(S)return e=>{const t={r:j,fillOpacity:1};return w?Ie&&(t.fill=ae(e.parentLine||e,w,Ie)):t.fill=Mn,t}},[S,j,w,Ie]),qe=E?"area":"line",Xe="object"==typeof L?L:{},Ve=Xe.position||"end",Ue=Xe.fontSize||11,Qe=n(()=>{var e,t;if(!L||!w)return[];const n="function"==typeof v?v:e=>e[v],o="function"==typeof b?b:e=>e[b],r="function"==typeof w?w:e=>e[w],i=new Map;for(const n of Ne){const o=n[k]||[];if(0===o.length)continue;const s="end"===Ve?o[o.length-1]:o[0],a=null!==(t=null!==(e=r(s))&&void 0!==e?e:r(n))&&void 0!==t?t:"";a&&!i.has(a+"")&&i.set(a+"",s)}const s=Array.from(i.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof v?v:"x"]:n(t),["string"==typeof b?b:"y"]:o(t),dx:"end"===Ve?6:-6,dy:0,color:Ie?Ie(e):Mn,fontSize:Ue}));s.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;s.length>e;e++){const t="string"==typeof b?b:"y",n=s[e-1],o=s[e];Ue+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Ue+2)}return s},[L,w,Ie,Ne,k,v,b,Ve,Ue]),Ke=(!L||void 0!==Z)&&Z,Je=n(()=>{if(!L)return h.marginDefaults;const e=Qe.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*Ue);return Math.max(e,o)},0),t=e+10,n="end"===Ve?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[L,Qe,Ue,Ve,h.marginDefaults]),{legend:Ze,margin:et,legendPosition:tt}=Tn({data:Ne,colorBy:w,colorScale:Ie,showLegend:Ke,legendPosition:q,userMargin:p,defaults:Je}),nt=x||w,ot=n(()=>Vn([{label:re||Yn(v),accessor:v,role:"x"},{label:ie||Yn(b),accessor:b,role:"y"},...nt?[{label:Yn(nt),accessor:nt,role:"group"}]:[]]),[v,b,re,ie,nt]),rt=to({componentName:"LineChart",data:Be?(null===(c=be[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}}),it=n(()=>Be||we||Te?Ne.flatMap(e=>{const t=e[k]||[];return we&&"string"==typeof we?t.map(t=>Object.assign(Object.assign({},t),{[we]:e[we]})):t}):Oe,[Ne,k,Be,we,Oe,Te]),st=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:qe},null!=g&&{data:it}),{xAccessor:v,yAccessor:b,xScaleType:X,yScaleType:V}),Se&&{yExtent:Se}),{groupAccessor:"break"===N&&Te?"_gapSegment":we||void 0,curve:O,lineStyle:Ge}),S&&{pointStyle:Ye}),{size:[U,Q],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:et,showAxes:h.showAxes,xLabel:re,yLabel:ie,xFormat:f,yFormat:m,enableHover:K,showGrid:J}),Ze&&{legend:Ze,legendPosition:tt}),Y&&"none"!==Y&&{legendHoverBehavior:He.onLegendHover,legendClickBehavior:He.onLegendClick,legendHighlightedCategory:He.highlightedCategory,legendIsolatedCategories:He.isolatedCategories}),ee&&{title:ee}),te&&{description:te}),ne&&{summary:ne}),void 0!==oe&&{accessibleTable:oe}),y&&{className:y}),{tooltipContent:!1===_?()=>null:Gn(_)||ot}),($||F||W)&&{customHoverBehavior:Ee}),(F||W)&&{customClickBehavior:Ce}),P&&{pointIdAccessor:P}),((null==B?void 0:B.length)||pe.length||Qe.length)&&{annotations:[...B||[],...pe,...Qe]}),_e),z);return se||le||(rt?e.createElement(Un,{componentName:"LineChart",message:rt,width:U,height:Q}):e.createElement(ko,{componentName:"LineChart",width:U,height:Q},e.createElement(un,Object.assign({ref:d},st))))});Po.displayName="LineChart";const Bo=c(function(o,r){var i;const s=t(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=Hn(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:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:p="x",yAccessor:y="y",areaBy:f,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,showLine:O=!0,lineWidth:S=2,showPoints:j=!1,pointRadius:E=3,tooltip:C,annotations:M,frameProps:_={},selection:P,linkedHover:B,onObservation:L,onClick:N,chartId:T,loading:I,emptyContent:z,legendInteraction:H,legendPosition:$}=o,F=a.width,W=a.height,D=a.enableHover,R=a.showGrid,G=a.showLegend,Y=a.title,q=a.description,X=a.summary,V=a.accessibleTable,U=a.xLabel,Q=a.yLabel,K=So(I,F,W),J=K?null:Oo(l,F,W,z),Z=l||[];jo("AreaChart",Z,"xAccessor",p),jo("AreaChart",Z,"yAccessor",y);const{activeSelectionHook:ee,customHoverBehavior:te,customClickBehavior:ne,crosshairSourceId:oe}=Ln({selection:P,linkedHover:B,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:L,onClick:N,chartType:"AreaChart",chartId:T}),re=Nn(B,oe),ie=void 0!==(null===(i=Z[0])||void 0===i?void 0:i[b]),se=n(()=>{if(ie)return Z;if(f){const e=Z.reduce((e,t)=>{const n="function"==typeof f?f(t):t[f];if(!e[n]){const t={[b]:[]};"string"==typeof f&&(t[f]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:Z}]},[Z,f,b,ie]),le=Bn(Z,x,k),ce=n(()=>{if(!x)return[];const e=new Set;for(const t of Z){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[Z,x]),ue=In(H,x,ce),de=n(()=>ue.legendSelectionHook?ue.legendSelectionHook:ee,[ue.legendSelectionHook,ee]),he=n(()=>e=>{const t={};if(x){if(le){const n=ae(e,x,le);t.fill=n,O?(t.stroke=n,t.strokeWidth=S):t.stroke="none"}}else t.fill=Mn,O?(t.stroke=Mn,t.strokeWidth=S):t.stroke="none";return t.fillOpacity=A,t},[x,le,A,O,S]),ge=n(()=>Cn(he,de,P),[he,de,P]),pe=n(()=>{if(j)return e=>{const t={r:E,fillOpacity:1};return x?le&&(t.fill=ae(e.parentLine||e,x,le)):t.fill=Mn,t}},[j,E,x,le]),{legend:ye,margin:fe,legendPosition:me}=Tn({data:se,colorBy:x,colorScale:le,showLegend:G,legendPosition:$,userMargin:c,defaults:a.marginDefaults}),ve=f||x,be=n(()=>Vn([{label:U||Yn(p),accessor:p,role:"x"},{label:Q||Yn(y),accessor:y,role:"y"},...ve?[{label:Yn(ve),accessor:ve,role:"group"}]:[]]),[p,y,U,Q,ve]),xe=to({componentName:"AreaChart",data:l,accessors:{xAccessor:p,yAccessor:y}}),ke=n(()=>ie||f?se.flatMap(e=>{const t=e[b]||[];return f&&"string"==typeof f?t.map(t=>Object.assign(Object.assign({},t),{[f]:e[f]})):t}):Z,[se,b,ie,f,Z]),we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:ke}),{xAccessor:p,yAccessor:y,groupAccessor:f||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),{curve:w,lineStyle:ge}),j&&pe&&{pointStyle:pe}),{size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:fe,showAxes:a.showAxes,xLabel:U,yLabel:Q,xFormat:h,yFormat:g,enableHover:D,showGrid:R}),ye&&{legend:ye,legendPosition:me}),H&&"none"!==H&&{legendHoverBehavior:ue.onLegendHover,legendClickBehavior:ue.onLegendClick,legendHighlightedCategory:ue.highlightedCategory,legendIsolatedCategories:ue.isolatedCategories}),Y&&{title:Y}),q&&{description:q}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),d&&{className:d}),{tooltipContent:!1===C?()=>null:Gn(C)||be}),(B||L||N)&&{customHoverBehavior:te}),(L||N)&&{customClickBehavior:ne}),M&&M.length>0&&{annotations:M}),re),_);return K||J||(xe?e.createElement(Un,{componentName:"AreaChart",message:xe,width:F,height:W}):e.createElement(ko,{componentName:"AreaChart",width:F,height:W},e.createElement(un,Object.assign({ref:s},we))))});function Lo({isPushMode:e,colorBy:o,colorScheme:i,showLegend:s,legendPosition:a="right"}){const c=t(new Set),u=t([]),[d,h]=r(0),g=l(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),p=l(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),n=!0)}n&&h(e=>e+1)},[e,o,g]),y=l(e=>t=>{p([t]),e(t)},[p]),f=l(e=>t=>{p(t),e(t)},[p]),m=l(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=n(()=>{if(!e||!o||!1===s)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:ie,r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],n[e%n.length]);const a="string"==typeof o?o:"__streamCat";return jn({data:t.map(e=>({[a]:e})),colorBy:a,colorScale:e=>r.get(e)||"#999",getColor:ae})},[e,o,s,i,d]),b=n(()=>{if(v)return"right"===a?{right:110}:"left"===a?{left:110}:"top"===a?{top:50}:"bottom"===a?{bottom:80}:{right:110}},[v,a]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}Bo.displayName="AreaChart";const No=c(function(o,r){var i;const s=t(null),a=Hn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:p,xAccessor:y="x",yAccessor:f="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:O=2,showPoints:S=!1,pointRadius:j=3,normalize:E=!1,tooltip:C,annotations:M,frameProps:_={},selection:P,linkedHover:B,onObservation:L,onClick:N,chartId:T,loading:I,emptyContent:z,legendInteraction:H,legendPosition:$}=o,F=a.width,W=a.height,D=a.enableHover,R=a.showGrid,G=a.showLegend,Y=a.title,q=a.description,X=a.summary,V=a.accessibleTable,U=a.xLabel,Q=a.yLabel,K=So(I,F,W),J=K?null:Oo(c,F,W,z),Z=c||[],ee=Lo({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:G,legendPosition:$}),te=l(ee.wrapPush(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)}),[ee.wrapPush]),ne=l(ee.wrapPushMany(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)}),[ee.wrapPushMany]);u(r,()=>({push:te,pushMany:ne,clear:()=>{var e;ee.resetCategories(),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[te,ne,ee.resetCategories]);const{activeSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:se}=Ln({selection:P,linkedHover:B,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:L,onClick:N,chartType:"StackedAreaChart",chartId:T}),le=Nn(B,se),ce=void 0!==(null===(i=Z[0])||void 0===i?void 0:i[v]),ue=n(()=>{if(ce)return Z;if(m){const e=Z.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:Z}]},[Z,m,v,ce]),de=Bn(Z,b,x),he=n(()=>{if(!b)return[];const e=new Set;for(const t of Z){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[Z,b]),ge=In(H,b,he),pe=n(()=>ge.legendSelectionHook?ge.legendSelectionHook:oe,[ge.legendSelectionHook,oe]),ye=n(()=>e=>{const t={};if(b&&de){const n=ae(e,b,de);t.fill=n,A?(t.stroke=n,t.strokeWidth=O):t.stroke="none"}else b||(t.fill=Mn,t.stroke=A?Mn:"none",A&&(t.strokeWidth=O));return t.fillOpacity=w,t},[b,de,w,A,O]),fe=n(()=>Cn(ye,pe,P),[ye,pe,P]),me=n(()=>{if(S)return e=>{const t={r:j,fillOpacity:1};return b?de&&(t.fill=ae(e.parentLine||e,b,de)):t.fill=Mn,t}},[S,j,b,de]),{legend:ve,margin:be,legendPosition:xe}=Tn({data:ue,colorBy:b,colorScale:de,showLegend:G,legendPosition:$,userMargin:d,defaults:a.marginDefaults}),ke=ee.streamingLegend||ve,we=$||xe,Ae=n(()=>{if(ee.streamingMarginAdjust){const e=Object.assign({},be);for(const[t,n]of Object.entries(ee.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return be},[be,ee.streamingMarginAdjust]),Oe=m||b,Se=n(()=>Vn([{label:U||Yn(y),accessor:y,role:"x"},{label:Q||Yn(f),accessor:f,role:"y"},...Oe?[{label:Yn(Oe),accessor:Oe,role:"group"}]:[]]),[y,f,U,Q,Oe]),je=to({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:y,yAccessor:f}}),Ee=n(()=>ce||m?ue.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):Z,[ue,v,ce,m,Z]),Ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=c&&{data:Ee}),{xAccessor:y,yAccessor:f,groupAccessor:m||void 0,curve:k,normalize:E,lineStyle:fe}),S&&me&&{pointStyle:me}),{size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ae,showAxes:a.showAxes,xLabel:U,yLabel:Q,xFormat:g,yFormat:p,enableHover:D,showGrid:R}),ke&&{legend:ke,legendPosition:we}),H&&"none"!==H&&{legendHoverBehavior:ge.onLegendHover,legendClickBehavior:ge.onLegendClick,legendHighlightedCategory:ge.highlightedCategory,legendIsolatedCategories:ge.isolatedCategories}),Y&&{title:Y}),q&&{description:q}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),h&&{className:h}),{tooltipContent:!1===C?()=>null:Gn(C)||Se}),(B||L||N)&&{customHoverBehavior:re}),(L||N)&&{customClickBehavior:ie}),M&&M.length>0&&{annotations:M}),le),_);return K||J||(je?e.createElement(Un,{componentName:"StackedAreaChart",message:je,width:F,height:W}):e.createElement(ko,{componentName:"StackedAreaChart",width:F,height:W},e.createElement(un,Object.assign({ref:s},Ce))))});function To(e){const{data:t,rawData:o,colorBy:r,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:p,showLegend:y,userMargin:f,marginDefaults:m,onClick:v,loading:b,emptyContent:x,width:k,height:w}=e,{activeSelectionHook:A,customHoverBehavior:O,customClickBehavior:S,crosshairSourceId:j}=Ln({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:p,onClick:v}),E=Nn(c,j),C=Bn(t,r,i),M=n(()=>{if(!r)return[];const e=new Set;for(const n of t){const t="function"==typeof r?r(n):n[r];null!=t&&e.add(t+"")}return Array.from(e)},[t,r]),_=In(s,r,M),P=n(()=>_.legendSelectionHook?_.legendSelectionHook:A,[_.legendSelectionHook,A]),{legend:B,margin:L,legendPosition:N}=Tn({data:t,colorBy:r,colorScale:C,showLegend:y,legendPosition:a,userMargin:f,defaults:m}),T=n(()=>{const e={};return B&&(e.legend=B,e.legendPosition=N),s&&"none"!==s&&(e.legendHoverBehavior=_.onLegendHover,e.legendClickBehavior=_.onLegendClick,e.legendHighlightedCategory=_.highlightedCategory,e.legendIsolatedCategories=_.isolatedCategories),e},[B,N,s,_.onLegendHover,_.onLegendClick,_.highlightedCategory,_.isolatedCategories]),I=So(b,k,w),z=I?null:Oo(o,k,w,x);return{colorScale:C,allCategories:M,legendState:_,effectiveSelectionHook:P,activeSelectionHook:A,customHoverBehavior:O,customClickBehavior:S,legend:B,margin:L,legendPosition:N,earlyReturn:I||z||null,legendBehaviorProps:T,crosshairProps:E}}No.displayName="StackedAreaChart";const Io=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Hn(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:a,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:p="x",yAccessor:y="y",colorBy:f,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:O,annotations:S,frameProps:j={},selection:E,linkedHover:C,linkedBrush:M,onObservation:_,onClick:P,chartId:B,loading:L,emptyContent:N,legendInteraction:T,legendPosition:I}=o,z=s.width,H=s.height,$=s.enableHover,F=s.showGrid,W=s.title,D=s.description,R=s.summary,G=s.accessibleTable,Y=s.xLabel,q=s.yLabel,X=a||[],V=To({data:X,rawData:a,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:I,selection:E,linkedHover:C,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:_,onClick:P,chartType:"Scatterplot",chartId:B,showLegend:s.showLegend,userMargin:c,marginDefaults:s.marginDefaults,loading:L,emptyContent:N,width:z,height:H}),U=En(M),Q=kn({name:(null==U?void 0:U.name)||"__unused_brush__",xField:(null==U?void 0:U.xField)||("string"==typeof p?p:void 0),yField:(null==U?void 0:U.yField)||("string"==typeof y?y:void 0)}),K=U?"xyBrush"===Q.brushInteraction.brush?"xy":"xBrush"===Q.brushInteraction.brush?"x":"y":void 0,J=e.useRef(Q.brushInteraction);J.current=Q.brushInteraction;const Z=l(e=>{const t=J.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(V.earlyReturn)return V.earlyReturn;jo("Scatterplot",X,"xAccessor",p),jo("Scatterplot",X,"yAccessor",y);const ee=n(()=>{if(!v||0===X.length)return;const e=X.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[X,v]),te=n(()=>e=>{const t={fillOpacity:k};return f?V.colorScale&&(t.fill=ae(e,f,V.colorScale)):t.fill=Mn,t.r=v?ce(e,v,b,ee):x,t},[f,V.colorScale,v,b,ee,x,k]),ne=n(()=>Cn(te,V.effectiveSelectionHook,E),[te,V.effectiveSelectionHook,E]),oe=n(()=>Vn([{label:Y||Yn(p),accessor:p,role:"x"},{label:q||Yn(y),accessor:y,role:"y"},...f?[{label:Yn(f),accessor:f,role:"color"}]:[],...v?[{label:Yn(v),accessor:v,role:"size"}]:[]]),[p,y,Y,q,f,v]),re=to({componentName:"Scatterplot",data:a,accessors:{xAccessor:p,yAccessor:y}});if(re)return e.createElement(Un,{componentName:"Scatterplot",message:re,width:z,height:H});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=a&&{data:X}),{xAccessor:p,yAccessor:y,colorAccessor:f||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:ne,colorScheme:m,size:[z,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:V.margin,showAxes:s.showAxes,xLabel:Y,yLabel:q,xFormat:h,yFormat:g,enableHover:$,showGrid:F}),V.legendBehaviorProps),W&&{title:W}),D&&{description:D}),R&&{summary:R}),void 0!==G&&{accessibleTable:G}),d&&{className:d}),{tooltipContent:!1===w?()=>null:Gn(w)||oe}),(C||_||P)&&{customHoverBehavior:V.customHoverBehavior}),(_||P)&&{customClickBehavior:V.customClickBehavior}),A&&{marginalGraphics:A}),O&&{pointIdAccessor:O}),S&&S.length>0&&{annotations:S}),U&&{brush:{dimension:K},onBrush:Z}),V.crosshairProps),j);return e.createElement(ko,{componentName:"Scatterplot",width:z,height:H},e.createElement(un,Object.assign({ref:i},ie)))});function zo(e,t){return A(1===t?.5:e/(t-1))}Io.displayName="Scatterplot";const Ho=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Hn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:a,className:l,xFormat:c,yFormat:d,xAccessor:h="x",yAccessor:g="y",orderAccessor:p,orderLabel:y,pointRadius:f=4,tooltip:m,pointIdAccessor:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:O,chartId:S,loading:j,emptyContent:E,legendInteraction:C}=o,M=s.width,_=s.height,P=s.enableHover,B=s.showGrid,L=s.title,N=s.description,T=s.summary,I=s.accessibleTable,z=s.xLabel,H=s.yLabel,$=a||[],{safeData:F,orderMap:W}=n(()=>{const e="function"==typeof h?h:e=>e[h],t="function"==typeof g?g:e=>e[g];let n=$;if(p&&$.length>0){const e="function"==typeof p?p:e=>e[p];n=[...$].sort((t,n)=>{const o=e(t),r=e(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const o=new WeakMap;let r=0;for(const o of n){const n=e(o),i=t(o);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let i=0;for(const s of n){const n=e(s),a=t(s);null!=n&&null!=a&&isFinite(n)&&isFinite(a)&&o.set(s,{idx:i++,total:r})}return{safeData:n,orderMap:o}},[$,p,h,g]);jo("ConnectedScatterplot",F,"xAccessor",h),jo("ConnectedScatterplot",F,"yAccessor",g);const{activeSelectionHook:D,customHoverBehavior:R,customClickBehavior:G,crosshairSourceId:Y}=Ln({selection:k,linkedHover:w,fallbackFields:[],onObservation:A,onClick:O,chartType:"ConnectedScatterplot",chartId:S}),q=Nn(w,Y),X=In(C,void 0,[]),V=n(()=>X.legendSelectionHook?X.legendSelectionHook:D,[X.legendSelectionHook,D]),U=n(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==V?void 0:V.isActive,s=null==V?void 0:V.predicate,a=100>r.length,l=r.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=r[t],u=r[t+1],d=zo(t,l),h=!i||!s||s(null!==(n=c.datum)&&void 0!==n?n:c)||s(null!==(o=u.datum)&&void 0!==o?o:u),g=i?h?1:.2:1;a&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=f+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=d,e.lineWidth=f,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[f,V]),Q=n(()=>[U],[U]),K=n(()=>(t,n,o)=>{var r,i;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 n=s[t],o=s[t+1],u=zo(t,a),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(i=o.style)||void 0===i?void 0:i.opacity)?o.style.opacity:1,g=Math.min(d,h);l&&c.push(e.createElement("line",{key:"halo-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:f+2,strokeLinecap:"round",opacity:.5*g})),c.push(e.createElement("line",{key:"seg-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:f,strokeLinecap:"round",opacity:g}))}return e.createElement(e.Fragment,null,c)},[f]),J=n(()=>[K],[K]),Z=n(()=>e=>{var t,n;const o=W.get(e),r=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,i=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:i>0?zo(r,i):"#6366f1",stroke:"white",strokeWidth:1,r:f,fillOpacity:1}},[f,W]),ee=n(()=>Cn(Z,V,k),[Z,V,k]),te=Object.assign({top:50,right:40,bottom:60,left:70},o.margin),ne=y||("string"==typeof p?p:"Order"),oe=n(()=>Vn([{label:z||Yn(h),accessor:h,role:"x"},{label:H||Yn(g),accessor:g,role:"y"},...p?[{label:ne,accessor:p,role:"group"}]:[]]),[h,g,z,H,p,ne]),re=to({componentName:"ConnectedScatterplot",data:a,accessors:{xAccessor:h,yAccessor:g}}),ie=So(j,M,_),se=ie?null:Oo(a,M,_,E),ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=a&&{data:F}),{xAccessor:h,yAccessor:g,pointStyle:ee,size:[M,_],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te,showAxes:s.showAxes,xLabel:z,yLabel:H,xFormat:c,yFormat:d,enableHover:P,showGrid:B}),L&&{title:L}),N&&{description:N}),T&&{summary:T}),void 0!==I&&{accessibleTable:I}),l&&{className:l}),{tooltipContent:!1===m?()=>null:Gn(m)||oe}),(w||A||O)&&{customHoverBehavior:R}),(A||O)&&{customClickBehavior:G}),v&&{pointIdAccessor:v}),{canvasPreRenderers:Q,svgPreRenderers:J}),b&&b.length>0&&{annotations:b}),q),x);return ie||se||(re?e.createElement(Un,{componentName:"ConnectedScatterplot",message:re,width:M,height:_}):e.createElement(ko,{componentName:"ConnectedScatterplot",width:M,height:_},e.createElement(un,Object.assign({ref:i},ae))))});Ho.displayName="ConnectedScatterplot";const $o=c(function(o,i){const s=t(null),a=Hn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:p,xAccessor:y="x",yAccessor:f="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:O,marginalGraphics:S,pointIdAccessor:j,annotations:E,frameProps:C={},selection:M,linkedHover:_,linkedBrush:P,onObservation:B,onClick:L,chartId:N,loading:T,emptyContent:I,legendInteraction:z,legendPosition:H}=o,$=a.width,F=a.height,W=a.enableHover,D=a.showGrid,R=a.showLegend,G=a.title,Y=a.description,q=a.summary,X=a.accessibleTable,V=a.xLabel,U=a.yLabel,Q=So(T,$,F),K=Q?null:Oo(c,$,F,I),J=c||[],Z=void 0===c,ee=t(null),[te,ne]=r(0),oe=l(e=>{if(!Z)return;let t=!1;for(const n of e){const e="function"==typeof m?m(n):n[m];null!=e&&isFinite(e)&&(ee.current?(ee.current[0]>e&&(ee.current[0]=e,t=!0),e>ee.current[1]&&(ee.current[1]=e,t=!0)):(ee.current=[e,e],t=!0))}t&&ne(e=>e+1)},[Z,m]),re=Lo({isPushMode:Z,colorBy:b,colorScheme:x,showLegend:R,legendPosition:H}),ie=l(re.wrapPush(e=>{var t;oe([e]),null===(t=s.current)||void 0===t||t.push(e)}),[re.wrapPush,oe]),se=l(re.wrapPushMany(e=>{var t;oe(e),null===(t=s.current)||void 0===t||t.pushMany(e)}),[re.wrapPushMany,oe]);u(i,()=>({push:ie,pushMany:se,clear:()=>{var e;re.resetCategories(),ee.current=null,ne(e=>e+1),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[ie,se,re.resetCategories]);const{activeSelectionHook:le,customHoverBehavior:ue,customClickBehavior:de,crosshairSourceId:he}=Ln({selection:M,linkedHover:_,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:B,onClick:L,chartType:"BubbleChart",chartId:N}),ge=Nn(_,he),pe=En(P);kn({name:(null==pe?void 0:pe.name)||"__unused_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof y?y:void 0),yField:(null==pe?void 0:pe.yField)||("string"==typeof f?f:void 0)});const ye=Bn(J,b,x),fe=n(()=>{if(!b)return[];const e=new Set;for(const t of J){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[J,b]),me=In(z,b,fe),ve=n(()=>me.legendSelectionHook?me.legendSelectionHook:le,[me.legendSelectionHook,le]),be=n(()=>{if(Z)return ee.current||[0,1];const e=J.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[J,m,Z,te]),xe=n(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?ye&&(t.fill=ae(e,b,ye)):t.fill=Mn,t.r=ce(e,m,v,be),t},[b,ye,m,v,be,k,w,A]),ke=n(()=>Cn(xe,ve,M),[xe,ve,M]),{legend:we,margin:Ae,legendPosition:Oe}=Tn({data:J,colorBy:b,colorScale:ye,showLegend:R,legendPosition:H,userMargin:d,defaults:a.marginDefaults}),Se=re.streamingLegend||we,je=H||Oe,Ee=n(()=>{if(re.streamingMarginAdjust){const e=Object.assign({},Ae);for(const[t,n]of Object.entries(re.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Ae},[Ae,re.streamingMarginAdjust]),Ce=n(()=>Vn([{label:V||Yn(y),accessor:y,role:"x"},{label:U||Yn(f),accessor:f,role:"y"},{label:Yn(m),accessor:m,role:"size"},...b?[{label:Yn(b),accessor:b,role:"color"}]:[]]),[y,f,V,U,m,b]),Me=to({componentName:"BubbleChart",data:c,accessors:{xAccessor:y,yAccessor:f},requiredProps:{sizeBy:m}});if(Me)return e.createElement(Un,{componentName:"BubbleChart",message:Me,width:$,height:F});const _e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=c&&{data:J}),{xAccessor:y,yAccessor:f,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:ke,colorScheme:x,size:[$,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ee,showAxes:a.showAxes,xLabel:V,yLabel:U,xFormat:g,yFormat:p,enableHover:W,showGrid:D}),Se&&{legend:Se,legendPosition:je}),z&&"none"!==z&&{legendHoverBehavior:me.onLegendHover,legendClickBehavior:me.onLegendClick,legendHighlightedCategory:me.highlightedCategory,legendIsolatedCategories:me.isolatedCategories}),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),h&&{className:h}),{tooltipContent:!1===O?()=>null:Gn(O)||Ce}),(_||B||L)&&{customHoverBehavior:ue}),(B||L)&&{customClickBehavior:de}),S&&{marginalGraphics:S}),j&&{pointIdAccessor:j}),E&&E.length>0&&{annotations:E}),ge),C);return Q||K||e.createElement(ko,{componentName:"BubbleChart",width:$,height:F},e.createElement(un,Object.assign({ref:s},_e)))});$o.displayName="BubbleChart";const Fo=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Hn(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:a,margin:l,className:c,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:p,yFormat:y,colorScheme:f="blues",customColorScale:v,showValues:b=!1,valueFormat:x,cellBorderColor:k="#fff",cellBorderWidth:w=1,tooltip:O,annotations:S,frameProps:M={},selection:_,linkedHover:P,onObservation:B,onClick:L,chartId:N,loading:T,emptyContent:I,showLegend:z,legendPosition:H,legendInteraction:$}=o,F=s.width,W=s.height,D=s.enableHover,R=s.title,G=s.description,Y=s.summary,q=s.accessibleTable,X=s.xLabel,V=s.yLabel,U=So(T,F,W),Q=U?null:Oo(a,F,W,I),K=a||[],J=null!=z&&z,Z=null!=H?H:"right",{margin:ee}=Tn({data:K,colorBy:J?"value":void 0,colorScale:void 0,showLegend:J,legendPosition:Z,userMargin:l,defaults:s.marginDefaults}),{activeSelectionHook:te,customHoverBehavior:ne,customClickBehavior:oe,crosshairSourceId:re}=Ln({selection:_,linkedHover:P,fallbackFields:[],onObservation:B,onClick:L,chartType:"Heatmap",chartId:N}),ie=Nn(P,re),se=In($,void 0,[]),ae=n(()=>se.legendSelectionHook?se.legendSelectionHook:te,[se.legendSelectionHook,te]),le=n(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ce=n(()=>{const e=K.map(le);return[Math.min(...e),Math.max(...e)]},[K,le]),ue=n(()=>"custom"===f&&v?v:m({blues:C,reds:E,greens:j,viridis:A}[f]||C).domain(ce),[f,v,ce]);n(()=>{const e=Pn(d),t=Pn(h);return{xBinCount:new Set(K.map(e)).size,yBinCount:new Set(K.map(t)).size}},[K,d,h]),n(()=>({coordinates:K}),[K]);const de=n(()=>e=>{const t=le(e);return{fill:ue(t),stroke:k,strokeWidth:w}},[le,ue,k,w]);n(()=>Cn(de,ae,_),[de,ae,_]);const he=n(()=>Vn([{label:X||Yn(d),accessor:d,role:"x"},{label:V||Yn(h),accessor:h,role:"y"},{label:Yn(g),accessor:g,role:"value"}]),[d,h,X,V,g]),ge=to({componentName:"Heatmap",data:a,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),pe=n(()=>{if(J)return{gradient:{colorFn:e=>ue(e),domain:ce,label:"string"==typeof g?g:"value",format:x}}},[J,ue,ce,g,x]),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({chartType:"heatmap"},null!=a&&{data:K}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==f?f:void 0,showValues:b,heatmapValueFormat:x,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee,showAxes:s.showAxes,xLabel:X,yLabel:V,xFormat:p,yFormat:y,enableHover:D}),pe&&{legend:pe,legendPosition:Z}),R&&{title:R}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),{tooltipContent:!1===O?()=>null:Gn(O)||he}),(P||B||L)&&{customHoverBehavior:ne}),(B||L)&&{customClickBehavior:oe}),S&&S.length>0&&{annotations:S}),ie),M);return U||Q||(ge?e.createElement(Un,{componentName:"Heatmap",message:ge,width:F,height:W}):e.createElement(ko,{componentName:"Heatmap",width:F,height:W},e.createElement(un,Object.assign({ref:i},ye))))});Fo.displayName="Heatmap";const Wo="__splomIdx",Do={top:4,bottom:4,left:4,right:4};function Ro({frameRef:n,cellSize:r,onBrush:i}){const s=t(null),a=r-Do.left-Do.right,l=r-Do.top-Do.bottom;return o(()=>{if(!s.current)return;const e=h(s.current).select(".brush-g"),t=y().extent([[0,0],[a,l]]).on("brush end",e=>{var t;const o=null===(t=n.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void i(null);const[[r,s],[a,l]]=e.selection,c=[[o.x.invert(r),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];i(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)}},[a,l,n,i]),e.createElement("svg",{ref:s,width:r,height:r,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${Do.left},${Do.top})`}))}function Go({data:n,xField:o,yField:r,cellSize:i,pointRadius:s,pointOpacity:a,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:p,onPointHover:y}){const f=t(null),m=bn({name:d,clientId:`splom-${o}-${r}`}),v=kn({name:d,xField:o,yField:r}),b=bn({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,k=l(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),w=l(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[Wo];void 0!==n&&(x({[Wo]:[n]}),null==y||y(t,e.x+Do.left,e.y+Do.top))},[x,y]),A=l(e=>{const t={opacity:a,r:s};return t.fill=c?ae(e,c,u):Mn,"hover"===p?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*a):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,a,s,p,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(un,{ref:f,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:Do,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?w:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e.createElement(Ro,{frameRef:f,cellSize:i,xField:o,yField:r,onBrush:k}))}function Yo({data:t,field:o,label:r,cellSize:i,bins:s,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=bn({name:c,clientId:"splom-diag-"+o}),g=bn({name:u,clientId:`splom-diag-${o}-hover`}),p="hover"===d?g:h,y=p.isActive,f=p.predicate,m=n(()=>{const e=t.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const n=Math.min(...e),r=(Math.max(...e)-n)/s||1,l="string"==typeof a?a:null,c=l?[...new Set(t.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)),p=Array.from({length:s},()=>Array(c.length).fill(0));for(const e of t){const t=e[o];if(null==t||isNaN(t))continue;const i=Math.min(Math.floor((t-n)/r),s-1);if(d[i]++,y&&!f(e)||h[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,y&&!f(e)||p[i][t]++)}}const m=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),a={x:t/s*i,w:i/s-1,h:r,y0:n,category:c[o]};return n+=r,a})}),b=p.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),a={x:t/s*i,w:i/s-1,h:r,y0:n,category:c[o]};return n+=r,a})});return{bars:d.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/m*(i-24),count:e})),selectedBars:h.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/m*(i-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[t,o,s,i,y,f,a]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},r),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`bg-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Mn,opacity:y?.3:.6}))):m.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Mn,opacity:y?.3:.6})),y&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`sel-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Mn,opacity:.7}))):m.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Mn,opacity:.7}))))}function qo({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function Xo(t){const{data:o,fields:i,fieldLabels:s={},colorBy:a,colorScheme:c,cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:p="histogram",histogramBins:y=20,brushMode:f="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:O,chartId:S}=t,j="splom",E="splom-hover",C=m?"hover":f?"brush":"hover",M=fn(e=>e.clearSelection),[_,P]=r(null),B=l(()=>{M(E),P(null)},[M,E]),L=n(()=>(o||[]).map((e,t)=>void 0!==e[Wo]?e:Object.assign(Object.assign({},e),{[Wo]:t})),[o]),N=Bn(L,a,c),T=void 0!==k?k:!!a,I=n(()=>{if(!T||!a)return null;const e="string"==typeof a?a:null;return e?[...new Set(L.map(t=>t[e]))].map(e=>({label:e+"",color:N?N(e+""):Mn})):null},[T,a,L,N]),z=n(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>u+"px").join(" "),gridTemplateRows:i.map(()=>u+"px").join(" ")+" 40px",gap:d+"px",width:"fit-content"}),[i,u,d,40]);return e.createElement("div",{className:A,style:{position:"relative"}},I&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},I.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:z,onMouseLeave:"hover"===C?B:void 0},i.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},s[t]||t),i.map((o,r)=>n===r?"label"===p?e.createElement(qo,{key:"diag-"+t,label:s[t]||t,cellSize:u}):e.createElement(Yo,{key:"diag-"+t,data:L,field:t,label:s[t]||t,cellSize:u,bins:y,colorBy:a,colorScale:N,brushSelectionName:j,hoverSelectionName:E,unselectedOpacity:v,mode:C}):e.createElement(Go,{key:`cell-${t}-${o}`,data:L,xField:o,yField:t,fieldLabels:s,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:a,colorScale:N,brushSelectionName:j,hoverSelectionName:E,unselectedOpacity:v,showGrid:b,tooltip:x,mode:C,onPointHover:"hover"===C?(e,i,s)=>{e?(P({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=s?s:0}),O&&O({type:"hover",datum:e,x:null!=i?i:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})):(P(null),O&&O({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S}))}:void 0})))),e.createElement("div",null)," ",i.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},s[t]||t))),_&&"hover"===C&&(()=>{const t=_.datum,n=s[_.xField]||_.xField,o=s[_.yField]||_.yField,r=a?"function"==typeof a?a(t):t[a]:null,i=w?"function"==typeof w?w(t):t[w]:"Row "+t[Wo];return e.createElement("div",{style:{position:"absolute",left:40+_.colIndex*(u+d)+_.px,top:_.rowIndex*(u+d)+_.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}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},i+""),e.createElement("div",null,n,": ",null!=t[_.xField]?Number(t[_.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[_.yField]?Number(t[_.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof a?a:"group",": ",r+""))})())}function Vo(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(Sn,{selections:r},e.createElement(Xo,Object.assign({},t)))}function Uo({width:n,height:r,margin:i,scales:s,brushDirection:a,extent:l,onBrush:c}){const u=t(null),d=t(null),y=t(!1),f=n+i.left+i.right,m=r+i.top+i.bottom;return o(()=>{if(!u.current||!s)return;const e=h(u.current).select(".brush-group"),t="x"===a?g().extent([[0,0],[n,r]]):p().extent([[0,0],[n,r]]);return t.on("brush end",e=>{if(y.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===a?s.x:s.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[s,n,r,a,c]),o(()=>{if(!d.current||!s||!u.current)return;const e=h(u.current).select(".brush-group"),t="x"===a?s.x:s.y;if(y.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);y.current=!1},[l,s,a]),e.createElement("svg",{ref:u,width:f,height:m,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-group",transform:`translate(${i.left},${i.top})`}))}function Qo(i){var s,a;const{data:c,width:u=600,height:d=400,margin:h,className:g,title:p,description:y,summary:f,xLabel:m,yLabel:v,xFormat:b,yFormat:x,xAccessor:k="x",yAccessor:w="y",lineBy:A,lineDataAccessor:O="coordinates",colorBy:S,colorScheme:j,curve:E="linear",lineWidth:C=2,fillArea:M=!1,areaOpacity:_=.3,showPoints:P=!1,pointRadius:B=3,enableHover:L=!0,showGrid:N=!1,showLegend:T,legendPosition:I,tooltip:z,minimap:H={},renderBefore:$=!1,onBrush:F,brushExtent:W,frameProps:D={},loading:R,emptyContent:G}=i,Y=So(R,u,d),q=Y?null:Oo(c,u,d,G),X=c||[],[V,U]=r(null),Q=null!=W?W:V,K=l(e=>{W||U(e),null==F||F(e)},[W,F]),J=t(null),[Z,ee]=r(null);o(()=>{const e=()=>{var t,n;const o=null===(n=null===(t=J.current)||void 0===t?void 0:t.getScales)||void 0===n?void 0:n.call(t);o?ee(o):requestAnimationFrame(e)};requestAnimationFrame(e)},[c]);const te=void 0!==(null===(s=X[0])||void 0===s?void 0:s[O]),ne=n(()=>{if(te)return X;if(A){const e=X.reduce((e,t)=>{const n="function"==typeof A?A(t):t[A];if(!e[n]){const t={[O]:[]};"string"==typeof A&&(t[A]=n),e[n]=t}return e[n][O].push(t),e},{});return Object.values(e)}return[{[O]:X}]},[X,A,O,te]),oe=n(()=>te||A?ne.flatMap(e=>{const t=e[O]||[];return A&&"string"==typeof A?t.map(t=>Object.assign(Object.assign({},t),{[A]:e[A]})):t}):X,[ne,O,te,A,X]),re=Bn(X,S,j),ie=n(()=>e=>{const t={strokeWidth:C};return t.stroke=S?ae(e,S,re):Mn,M&&(t.fill=t.stroke,t.fillOpacity=_),t},[S,re,C,M,_]),se=n(()=>H.lineStyle?H.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=S?ae(e,S,re):Mn,t},[S,re,H.lineStyle]),le=n(()=>{if(P)return e=>{const t={r:B,fillOpacity:1};return t.fill=S?ae(e.parentLine||e,S,re):Mn,t}},[P,B,S,re]),{legend:ce,margin:ue,legendPosition:de}=Tn({data:ne,colorBy:S,colorScale:re,showLegend:T,legendPosition:I,userMargin:h}),he=H.height||60,ge=n(()=>{var e,t,n,o,r,i,s,a;return{top:null!==(t=null===(e=H.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=H.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(i=null===(r=H.margin)||void 0===r?void 0:r.left)&&void 0!==i?i:ue.left,right:null!==(a=null===(s=H.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ue.right}},[H.margin,ue]),pe=H.brushDirection||"x",ye=to({componentName:"MinimapChart",data:c,accessors:{xAccessor:k,yAccessor:w}});if(ye)return e.createElement(Un,{componentName:"MinimapChart",message:ye,width:u,height:d});const fe=M?"area":"line",me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:fe,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:E,lineStyle:ie},P&&{pointStyle:le}),{size:[u,d],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:ue,showAxes:!0,xLabel:m,yLabel:v,xFormat:b,yFormat:x,enableHover:L,showGrid:N}),ce&&{legend:ce,legendPosition:de}),p&&{title:p}),y&&{description:y}),f&&{summary:f}),z&&{tooltipContent:Gn(z)||void 0}),Q&&{xExtent:Q}),D),ve={chartType:fe,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:E,lineStyle:se,size:[u,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(a=H.showAxes)&&void 0!==a&&a,background:H.background,enableHover:!1},be=e.createElement("div",{key:"minimap",style:{position:"relative",width:u,overflow:"hidden"}},e.createElement(un,Object.assign({ref:J},ve)),e.createElement(Uo,{width:u-ge.left-ge.right,height:he,margin:ge,scales:Z,brushDirection:pe,extent:Q,onBrush:K})),xe=e.createElement("div",{key:"main",style:{overflow:"hidden"}},e.createElement(un,Object.assign({},me)));return Y||q||e.createElement(ko,{componentName:"MinimapChart",width:u,height:d},e.createElement("div",{className:"minimap-chart"+(g?" "+g:"")},$?be:xe,$?xe:be))}Vo.displayName="ScatterplotMatrix",Qo.displayName="MinimapChart";const Ko=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Hn(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:a,margin:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:p="y",xCenter:y,yCenter:f,quadrants:m,centerlineStyle:v={},showQuadrantLabels:b=!0,quadrantLabelSize:x=12,colorBy:k,colorScheme:w,sizeBy:A,sizeRange:O=[3,15],pointRadius:S=5,pointOpacity:j=.8,tooltip:E,pointIdAccessor:C,annotations:M,frameProps:_={},selection:P,linkedHover:B,onObservation:L,onClick:N,chartId:T,loading:I,emptyContent:z,legendInteraction:H,legendPosition:$}=o,F=s.width,W=s.height,D=s.enableHover,R=s.showGrid,G=s.showLegend,Y=s.title,q=s.description,X=s.summary,V=s.accessibleTable,U=s.xLabel,Q=s.yLabel,K=So(I,F,W),J=K?null:Oo(a,F,W,z),Z=a||[];jo("QuadrantChart",Z,"xAccessor",g),jo("QuadrantChart",Z,"yAccessor",p);const{activeSelectionHook:ee,customHoverBehavior:te,customClickBehavior:ne,crosshairSourceId:oe}=Ln({selection:P,linkedHover:B,fallbackFields:"string"==typeof k?[k]:[],onObservation:L,onClick:N,chartType:"QuadrantChart",chartId:T}),re=Nn(B,oe),ie=Bn(Z,k,w),se=n(()=>{if(!k)return[];const e=new Set;for(const t of Z){const n="function"==typeof k?k(t):t[k];null!=n&&e.add(n+"")}return Array.from(e)},[Z,k]),le=In(H,k,se),ue=n(()=>le.legendSelectionHook?le.legendSelectionHook:ee,[le.legendSelectionHook,ee]),de=n(()=>{if(!Z.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of Z){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=y&&isFinite(y)&&(n>y&&(n=y),y>o&&(o=y)),null!=f&&isFinite(f)&&(r>f&&(r=f),f>i&&(i=f)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[Z,g,p,y,f]),he=n(()=>{if(!A||0===Z.length)return;const e=Z.map(e=>"function"==typeof A?A(e):e[A]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[Z,A]),ge=n(()=>"function"==typeof g?g:e=>+e[g],[g]),pe=n(()=>"function"==typeof p?p:e=>+e[p],[p]),ye=n(()=>e=>{const t={fillOpacity:j};if(k)ie&&(t.fill=ae(e,k,ie));else{const n=ge(e),o=pe(e),r=null!=y?n>=y:void 0,i=null!=f?o>=f:void 0;t.fill=void 0===i||void 0===r?Mn:i&&r?m.topRight.color:i&&!r?m.topLeft.color:!i&&r?m.bottomRight.color:m.bottomLeft.color}return t.r=A?ce(e,A,O,he):S,t},[k,ie,A,O,he,S,j,ge,pe,y,f,m]),fe=n(()=>Cn(ye,ue,P),[ye,ue,P]),{legend:me,margin:ve,legendPosition:be}=Tn({data:Z,colorBy:k,colorScale:ie,showLegend:G,legendPosition:$,userMargin:l,defaults:s.marginDefaults}),xe=n(()=>{if(!Z.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof p&&e.add(p),"string"==typeof k&&e.add(k),"string"==typeof A&&e.add(A);const t=Z[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[Z,g,p,k,A]),ke=n(()=>Vn([...xe?[{label:xe,accessor:xe,role:"title"}]:[],{label:U||Yn(g),accessor:g,role:"x"},{label:Q||Yn(p),accessor:p,role:"y"},...k?[{label:Yn(k),accessor:k,role:"color"}]:[],...A?[{label:Yn(A),accessor:A,role:"size"}]:[]]),[xe,g,p,U,Q,k,A]),we=to({componentName:"QuadrantChart",data:a,accessors:{xAccessor:g,yAccessor:p}}),Ae=n(()=>{var e;const t={stroke:v.stroke||"#999",strokeWidth:null!==(e=v.strokeWidth)&&void 0!==e?e:1,dashArray:v.strokeDasharray||[]};return[(e,n,o,r)=>{var i;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=r.width,a=r.height,l=null!=y?o.x(y):s/2,c=null!=f?o.y(f):a/2;if(null!=y&&!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:m.topLeft,x:0,y:0,w:u,h:d},{config:m.topRight,x:u,y:0,w:s-u,h:d},{config:m.bottomLeft,x:0,y:d,w:u,h:a-d},{config:m.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!==(i=t.config.opacity)&&void 0!==i?i:.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([])}]},[y,f,m,v]),Oe=n(()=>b?[...Ae,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const r=o.width,i=o.height,s=null!=y?n.x(y):r/2,a=null!=f?n.y(f):i/2;(null==y||isFinite(s))&&(null==f||isFinite(a))&&(e.font=`600 ${x}px sans-serif`,e.globalAlpha=.5,e.fillStyle=m.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(m.topLeft.label,8,8),e.fillStyle=m.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(m.topRight.label,r-8,8),e.fillStyle=m.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(m.bottomLeft.label,8,i-8),e.fillStyle=m.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(m.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:Ae,[Ae,b,x,m,y,f]),Se=n(()=>{const e=_.canvasPreRenderers||[];return[...Oe,...e]},[Oe,_.canvasPreRenderers]),je=n(()=>{var t;const n={stroke:v.stroke||"#999",strokeWidth:null!==(t=v.strokeWidth)&&void 0!==t?t:1,dashArray:v.strokeDasharray?Array.isArray(v.strokeDasharray)?v.strokeDasharray.join(","):v.strokeDasharray:void 0};return[(t,o,r)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const i=r.width,s=r.height,a=null!=y?o.x(y):i/2,l=null!=f?o.y(f):s/2;if(null!=y&&!isFinite(a))return null;if(null!=f&&!isFinite(l))return null;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l));return e.createElement(e.Fragment,null,[{config:m.topLeft,x:0,y:0,w:c,h:u},{config:m.topRight,x:c,y:0,w:i-c,h:u},{config:m.bottomLeft,x:0,y:u,w:c,h:s-u},{config:m.bottomRight,x:c,y:u,w:i-c,h:s-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.createElement("rect",{key:"qf-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08}):null}),e.createElement("line",{x1:c,y1:0,x2:c,y2:s,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.createElement("line",{x1:0,y1:u,x2:i,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),b&&e.createElement(e.Fragment,null,e.createElement("text",{x:8,y:8+x,fill:m.topLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.topLeft.label),e.createElement("text",{x:i-8,y:8+x,fill:m.topRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.topRight.label),e.createElement("text",{x:8,y:s-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.bottomLeft.label),e.createElement("text",{x:i-8,y:s-8,fill:m.bottomRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.bottomRight.label)))}]},[y,f,m,v,b,x]),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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=a&&{data:Z}),{xAccessor:g,yAccessor:p,colorAccessor:k||void 0,sizeAccessor:A||void 0,sizeRange:O,pointStyle:fe,colorScheme:w,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ve,showAxes:s.showAxes,xLabel:U,yLabel:Q,xFormat:d,yFormat:h,enableHover:D,showGrid:R}),de&&{xExtent:de.xExtent,yExtent:de.yExtent}),me&&{legend:me,legendPosition:be}),H&&"none"!==H&&{legendHoverBehavior:le.onLegendHover,legendClickBehavior:le.onLegendClick,legendHighlightedCategory:le.highlightedCategory,legendIsolatedCategories:le.isolatedCategories}),Y&&{title:Y}),q&&{description:q}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),{tooltipContent:!1===E?()=>null:!0===E||void 0===E?ke:Gn(E)||ke}),(B||L||N)&&{customHoverBehavior:te}),(L||N)&&{customClickBehavior:ne}),C&&{pointIdAccessor:C}),M&&M.length>0&&{annotations:M}),{canvasPreRenderers:Se}),re),_),Se.length>0&&{canvasPreRenderers:Se}),{svgPreRenderers:je});return K||J||(we?e.createElement(Un,{componentName:"QuadrantChart",message:we,width:F,height:W}):e.createElement(ko,{componentName:"QuadrantChart",width:F,height:W},e.createElement(un,Object.assign({ref:i},Ee))))});Ko.displayName="QuadrantChart";const Jo="__ma_unitized",Zo="__ma_series";function er(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function tr(e,t){return t[0]+e*(t[1]-t[0])}const nr=c(function(o,r){var i,s;const a=t(null),l=t([]);u(r,()=>({push:e=>{if(!a.current)return;const t=e;for(let e=0;o.series.length>e&&2>e;e++){const n=o.series[e],r=n.extent||l.current[e];if(!r)continue;const i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(t);null!=i&&isFinite(i)&&a.current.push(Object.assign(Object.assign({},t),{[Jo]:er(i,r),[Zo]:n.label||"Series "+(e+1)}))}},pushMany:e=>{if(!a.current)return;const t=[];for(const n of e)for(let e=0;o.series.length>e&&2>e;e++){const r=o.series[e],i=r.extent||l.current[e];if(!i)continue;const s=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=s&&isFinite(s)&&t.push(Object.assign(Object.assign({},n),{[Jo]:er(s,i),[Zo]:r.label||"Series "+(e+1)}))}a.current.pushMany(t)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const c=Hn(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:d,margin:h,className:g,xFormat:p,xAccessor:y="x",series:f,colorScheme:m,curve:v="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:O,onObservation:S,onClick:j,chartId:E,loading:C,emptyContent:M,legendInteraction:_,legendPosition:P}=o,B=c.width,L=c.height,N=c.enableHover,T=c.showGrid,I=null===(i=c.showLegend)||void 0===i||i,z=c.title,H=c.description,$=c.summary,F=c.accessibleTable,W=c.xLabel,D=2===f.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||D||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${f.length}. Rendering as a standard multi-line chart.`);const R=So(C,B,L),G=R?null:Oo(d,B,L,M),Y=d||[],q=_n(),X=n(()=>{let e;if(Array.isArray(m))e=m;else if(q&&q.length>0)e=q;else{const t=oe[m];e=Array.isArray(t)?t:re}return f.map((t,n)=>t.color||e[n%e.length])},[f,m,q]),V=n(()=>f.map((e,t)=>e.label||"Series "+(t+1)),[f]),{unitizedData:U,extents:Q}=n(()=>{if(0===Y.length){const e=f.map(e=>e.extent||null).filter(Boolean);return e.length===f.length&&(l.current=e),{unitizedData:[],extents:e.length===f.length?e:[]}}const e=f.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(Y,e.yAccessor));if(l.current=e,!D){const t=[];for(const e of Y)for(let n=0;f.length>n;n++){const o=f[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push(Object.assign(Object.assign({},e),{[Jo]:r,[Zo]:V[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of Y)for(let o=0;2>o;o++){const r=f[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push(Object.assign(Object.assign({},n),{[Jo]:er(i,e[o]),[Zo]:V[o]}))}return{unitizedData:t,extents:e}},[Y,f,D,V]),K=n(()=>{if(D&&Q.length>=2)return[{orient:"left",label:V[0],tickFormat:f[0].format||(e=>{const t=tr(e,Q[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:V[1],tickFormat:f[1].format||(e=>{const t=tr(e,Q[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[D,Q,f,V]),J=To({data:n(()=>U.length>0?U:V.map(e=>({[Zo]:e})),[U,V]),rawData:d,colorBy:Zo,colorScheme:X,legendInteraction:_,legendPosition:P,selection:A,linkedHover:O,fallbackFields:[Zo],unwrapData:!1,onObservation:S,onClick:j,chartType:"MultiAxisLineChart",chartId:E,showLegend:I,userMargin:h,marginDefaults:D?Object.assign(Object.assign({},c.marginDefaults),{left:70,right:70}):c.marginDefaults,loading:C,emptyContent:M,width:B,height:L});if(J.earlyReturn)return J.earlyReturn;const Z=n(()=>{const e=new Map;return V.forEach((t,n)=>e.set(t,X[n])),t=>({stroke:e.get(t[Zo])||X[0],strokeWidth:b,fill:"none"})},[V,X,b]),ee=n(()=>Cn(Z,J.effectiveSelectionHook,A),[Z,J.effectiveSelectionHook,A]),te=n(()=>{if(!1===x)return()=>null;return Gn(x)||(t=>{var n;const o=t.data||t,r=o[Zo],i=V.indexOf(r),s=o[Jo],a=D&&i>=0&&Q[i]?tr(s,Q[i]):s,l=i>=0&&(null===(n=f[i])||void 0===n?void 0:n.format)?f[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof y?y(o):o[y];return e.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},e.createElement("div",{style:{fontWeight:600,marginBottom:4,color:X[i]||"inherit"}},r),e.createElement("div",null,`${"string"==typeof y?y:"x"}: ${c}`),e.createElement("div",null,`${r}: ${l(a)}`))})},[x,V,X,Q,D,f,y]),ne=to({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:y}}),ie=D?[0,1]:void 0,se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:U}),{xAccessor:y,yAccessor:Jo,groupAccessor:Zo,lineStyle:ee,colorScheme:X,size:[B,L],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,showAxes:c.showAxes}),K&&{axes:K}),{xLabel:W}),D?{}:{yLabel:V[0]}),{xFormat:p}),D&&ie&&{yExtent:ie}),{enableHover:N,showGrid:T,curve:v}),J.legendBehaviorProps),z&&{title:z}),H&&{description:H}),$&&{summary:$}),void 0!==F&&{accessibleTable:F}),g&&{className:g}),{tooltipContent:te}),k&&{annotations:k}),(O||S||j)&&{customHoverBehavior:J.customHoverBehavior}),(S||j)&&{customClickBehavior:J.customClickBehavior}),J.crosshairProps),w);return R||G||(ne?e.createElement(Un,{componentName:"MultiAxisLineChart",message:ne,width:B,height:L}):e.createElement(ko,{componentName:"MultiAxisLineChart",width:B,height:L},e.createElement(un,Object.assign({ref:a},se))))});nr.displayName="MultiAxisLineChart";export{Bo as AreaChart,$o as BubbleChart,Ho as ConnectedScatterplot,Fo as Heatmap,Po as LineChart,Qo as MinimapChart,nr as MultiAxisLineChart,Ko as QuadrantChart,Io as Scatterplot,Vo as ScatterplotMatrix,No as StackedAreaChart,un as StreamXYFrame};