semiotic 3.4.0 → 3.4.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 (187) hide show
  1. package/CLAUDE.md +16 -3
  2. package/ai/schema.json +42 -1
  3. package/ai/system-prompt.md +4 -0
  4. package/dist/components/Annotation.d.ts +42 -2
  5. package/dist/components/CategoryColors.d.ts +1 -1
  6. package/dist/components/ChartGrid.d.ts +1 -1
  7. package/dist/components/ContextLayout.d.ts +1 -1
  8. package/dist/components/DataSummaryContext.d.ts +1 -1
  9. package/dist/components/DetailsPanel.d.ts +3 -2
  10. package/dist/components/Legend.d.ts +2 -3
  11. package/dist/components/LinkedCharts.d.ts +1 -1
  12. package/dist/components/ThemeProvider.d.ts +1 -1
  13. package/dist/components/Tooltip/FlippingTooltip.d.ts +1 -1
  14. package/dist/components/Tooltip/Tooltip.d.ts +4 -3
  15. package/dist/components/charts/geo/ChoroplethMap.d.ts +4 -4
  16. package/dist/components/charts/geo/DistanceCartogram.d.ts +5 -4
  17. package/dist/components/charts/geo/FlowMap.d.ts +4 -4
  18. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +4 -3
  19. package/dist/components/charts/index.d.ts +2 -0
  20. package/dist/components/charts/network/ChordDiagram.d.ts +4 -3
  21. package/dist/components/charts/network/CirclePack.d.ts +3 -3
  22. package/dist/components/charts/network/ForceDirectedGraph.d.ts +3 -2
  23. package/dist/components/charts/network/OrbitDiagram.d.ts +6 -5
  24. package/dist/components/charts/network/SankeyDiagram.d.ts +4 -3
  25. package/dist/components/charts/network/TreeDiagram.d.ts +3 -3
  26. package/dist/components/charts/network/Treemap.d.ts +3 -3
  27. package/dist/components/charts/ordinal/BarChart.d.ts +24 -4
  28. package/dist/components/charts/ordinal/BoxPlot.d.ts +4 -3
  29. package/dist/components/charts/ordinal/DonutChart.d.ts +4 -3
  30. package/dist/components/charts/ordinal/DotPlot.d.ts +4 -3
  31. package/dist/components/charts/ordinal/FunnelChart.d.ts +4 -3
  32. package/dist/components/charts/ordinal/GaugeChart.d.ts +2 -1
  33. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +4 -3
  34. package/dist/components/charts/ordinal/Histogram.d.ts +4 -3
  35. package/dist/components/charts/ordinal/LikertChart.d.ts +4 -3
  36. package/dist/components/charts/ordinal/PieChart.d.ts +4 -3
  37. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +4 -3
  38. package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -3
  39. package/dist/components/charts/ordinal/SwarmPlot.d.ts +4 -3
  40. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -3
  41. package/dist/components/charts/ordinal/ViolinPlot.d.ts +4 -3
  42. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +7 -6
  43. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +10 -7
  44. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -6
  45. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +7 -6
  46. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -6
  47. package/dist/components/charts/shared/ChartError.d.ts +1 -2
  48. package/dist/components/charts/shared/annotationResolvers.d.ts +4 -3
  49. package/dist/components/charts/shared/annotationRules.d.ts +2 -1
  50. package/dist/components/charts/shared/colorUtils.d.ts +4 -3
  51. package/dist/components/charts/shared/datumTypes.d.ts +20 -0
  52. package/dist/components/charts/shared/diagnoseConfig.d.ts +2 -7
  53. package/dist/components/charts/shared/formatUtils.d.ts +4 -2
  54. package/dist/components/charts/shared/hooks.d.ts +27 -23
  55. package/dist/components/charts/shared/legendUtils.d.ts +3 -2
  56. package/dist/components/charts/shared/mergeShapeStyle.d.ts +43 -0
  57. package/dist/components/charts/shared/networkUtils.d.ts +7 -6
  58. package/dist/components/charts/shared/selectionUtils.d.ts +5 -4
  59. package/dist/components/charts/shared/statisticalOverlays.d.ts +14 -26
  60. package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +2 -2
  61. package/dist/components/charts/shared/statsTooltip.d.ts +3 -2
  62. package/dist/components/charts/shared/tooltipUtils.d.ts +7 -6
  63. package/dist/components/charts/shared/types.d.ts +22 -13
  64. package/dist/components/charts/shared/useChartSetup.d.ts +7 -6
  65. package/dist/components/charts/shared/useLikertAggregation.d.ts +18 -7
  66. package/dist/components/charts/shared/useOrdinalStreaming.d.ts +3 -2
  67. package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -1
  68. package/dist/components/charts/shared/validateChartData.d.ts +2 -1
  69. package/dist/components/charts/shared/validateProps.d.ts +2 -8
  70. package/dist/components/charts/shared/withChartWrapper.d.ts +1 -1
  71. package/dist/components/charts/xy/AreaChart.d.ts +4 -3
  72. package/dist/components/charts/xy/BubbleChart.d.ts +4 -3
  73. package/dist/components/charts/xy/CandlestickChart.d.ts +47 -0
  74. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +4 -3
  75. package/dist/components/charts/xy/Heatmap.d.ts +12 -7
  76. package/dist/components/charts/xy/LineChart.d.ts +4 -3
  77. package/dist/components/charts/xy/MinimapChart.d.ts +4 -4
  78. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +5 -4
  79. package/dist/components/charts/xy/QuadrantChart.d.ts +4 -3
  80. package/dist/components/charts/xy/Scatterplot.d.ts +4 -3
  81. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +3 -3
  82. package/dist/components/charts/xy/StackedAreaChart.d.ts +4 -3
  83. package/dist/components/data/transforms.d.ts +8 -7
  84. package/dist/components/export/chartConfig.d.ts +4 -3
  85. package/dist/components/geo/mergeData.d.ts +2 -1
  86. package/dist/components/realtime/BinAccumulator.d.ts +3 -2
  87. package/dist/components/realtime/renderers/types.d.ts +2 -1
  88. package/dist/components/realtime/renderers/waterfallRenderer.d.ts +2 -1
  89. package/dist/components/realtime/types.d.ts +20 -16
  90. package/dist/components/semiotic-themes.d.ts +2 -1
  91. package/dist/components/semiotic-xy.d.ts +2 -0
  92. package/dist/components/semiotic.d.ts +3 -3
  93. package/dist/components/server/animatedGif.d.ts +4 -18
  94. package/dist/components/server/renderToStaticSVG.d.ts +5 -4
  95. package/dist/components/server/serverChartConfigs.d.ts +2 -10
  96. package/dist/components/server/staticAnnotations.d.ts +2 -1
  97. package/dist/components/server/staticLegend.d.ts +2 -1
  98. package/dist/components/store/ObservationStore.d.ts +4 -3
  99. package/dist/components/store/SelectionStore.d.ts +3 -8
  100. package/dist/components/store/ThemeStore.d.ts +32 -4
  101. package/dist/components/store/TooltipStore.d.ts +1 -1
  102. package/dist/components/store/useSelection.d.ts +6 -5
  103. package/dist/components/stream/AccessibleDataTable.d.ts +5 -5
  104. package/dist/components/stream/CanvasHitTester.d.ts +2 -1
  105. package/dist/components/stream/DataSourceAdapter.d.ts +2 -1
  106. package/dist/components/stream/FocusRing.d.ts +1 -2
  107. package/dist/components/stream/GeoParticlePool.d.ts +2 -1
  108. package/dist/components/stream/GeoPipelineStore.d.ts +7 -6
  109. package/dist/components/stream/MarginalGraphics.d.ts +1 -2
  110. package/dist/components/stream/NetworkPipelineStore.d.ts +3 -2
  111. package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -4
  112. package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -19
  113. package/dist/components/stream/OrdinalPipelineStore.d.ts +6 -5
  114. package/dist/components/stream/OrdinalSVGOverlay.d.ts +6 -5
  115. package/dist/components/stream/PipelineStore.d.ts +63 -28
  116. package/dist/components/stream/SVGOverlay.d.ts +10 -10
  117. package/dist/components/stream/SceneGraph.d.ts +6 -5
  118. package/dist/components/stream/StreamGeoFrame.d.ts +2 -1
  119. package/dist/components/stream/StreamNetworkFrame.d.ts +2 -1
  120. package/dist/components/stream/StreamOrdinalFrame.d.ts +2 -1
  121. package/dist/components/stream/StreamXYFrame.d.ts +2 -1
  122. package/dist/components/stream/XYBrushOverlay.d.ts +1 -21
  123. package/dist/components/stream/devDataAccessWarning.d.ts +2 -11
  124. package/dist/components/stream/geoTypes.d.ts +25 -18
  125. package/dist/components/stream/hoverUtils.d.ts +2 -1
  126. package/dist/components/stream/layouts/hierarchySceneBuilders.d.ts +4 -3
  127. package/dist/components/stream/layouts/hierarchyUtils.d.ts +4 -3
  128. package/dist/components/stream/networkTypes.d.ts +33 -28
  129. package/dist/components/stream/ordinalSceneBuilders/barFunnelScene.d.ts +1 -1
  130. package/dist/components/stream/ordinalSceneBuilders/barScene.d.ts +2 -2
  131. package/dist/components/stream/ordinalSceneBuilders/connectorScene.d.ts +1 -1
  132. package/dist/components/stream/ordinalSceneBuilders/pointScene.d.ts +2 -2
  133. package/dist/components/stream/ordinalSceneBuilders/statisticalScene.d.ts +4 -4
  134. package/dist/components/stream/ordinalSceneBuilders/swimlaneScene.d.ts +1 -1
  135. package/dist/components/stream/ordinalSceneBuilders/timelineScene.d.ts +1 -1
  136. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +9 -8
  137. package/dist/components/stream/ordinalTypes.d.ts +54 -22
  138. package/dist/components/stream/pipelineDecay.d.ts +2 -1
  139. package/dist/components/stream/pipelinePulse.d.ts +2 -1
  140. package/dist/components/stream/pipelineTransitions.d.ts +16 -4
  141. package/dist/components/stream/renderers/colorUtils.d.ts +20 -0
  142. package/dist/components/stream/types.d.ts +45 -8
  143. package/dist/components/stream/xySceneBuilders/areaScene.d.ts +3 -2
  144. package/dist/components/stream/xySceneBuilders/barScene.d.ts +2 -1
  145. package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +2 -1
  146. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +2 -1
  147. package/dist/components/stream/xySceneBuilders/emitPointNodes.d.ts +3 -2
  148. package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +2 -1
  149. package/dist/components/stream/xySceneBuilders/lineScene.d.ts +2 -1
  150. package/dist/components/stream/xySceneBuilders/mixedScene.d.ts +2 -1
  151. package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -1
  152. package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +2 -1
  153. package/dist/components/stream/xySceneBuilders/types.d.ts +35 -26
  154. package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +2 -1
  155. package/dist/components/types/marginType.d.ts +15 -0
  156. package/dist/geo.min.js +1 -1
  157. package/dist/geo.module.min.js +1 -1
  158. package/dist/network.min.js +1 -1
  159. package/dist/network.module.min.js +1 -1
  160. package/dist/ordinal.min.js +1 -1
  161. package/dist/ordinal.module.min.js +1 -1
  162. package/dist/realtime.min.js +1 -1
  163. package/dist/realtime.module.min.js +1 -1
  164. package/dist/semiotic-ai.min.js +1 -1
  165. package/dist/semiotic-ai.module.min.js +1 -1
  166. package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +1 -0
  167. package/dist/semiotic-themes.d.ts +2 -1
  168. package/dist/semiotic-themes.min.js +1 -1
  169. package/dist/semiotic-themes.module.min.js +1 -1
  170. package/dist/semiotic-utils.min.js +1 -1
  171. package/dist/semiotic-utils.module.min.js +1 -1
  172. package/dist/semiotic-xy.d.ts +2 -0
  173. package/dist/semiotic.d.ts +3 -3
  174. package/dist/semiotic.min.js +1 -1
  175. package/dist/semiotic.module.min.js +1 -1
  176. package/dist/server.min.js +1 -1
  177. package/dist/server.module.min.js +1 -1
  178. package/dist/test-utils/canvasMock.d.ts +10 -2
  179. package/dist/xy.min.js +1 -1
  180. package/dist/xy.module.min.js +1 -1
  181. package/package.json +38 -31
  182. package/dist/components/types/annotationTypes.d.ts +0 -145
  183. package/dist/components/types/generalTypes.d.ts +0 -241
  184. package/dist/components/types/interactionTypes.d.ts +0 -72
  185. package/dist/components/types/networkTypes.d.ts +0 -174
  186. package/dist/components/types/ordinalTypes.d.ts +0 -112
  187. package/dist/semiotic-statisticalOverlays-DGX_WWc5.js +0 -1
@@ -1 +1 @@
1
- import*as e from"react";import{createContext as t,useMemo as n,useContext as o,useRef as r,useCallback as i,useSyncExternalStore as a,useState as s,useEffect as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{geoPath as p,geoGraticule as h,geoDistance as y,geoInterpolate as f,geoEqualEarth as g,geoEquirectangular as m,geoNaturalEarth1 as b,geoOrthographic as v,geoAlbersUsa as x,geoMercator as k}from"d3-geo";import{scaleLinear as w,scaleOrdinal as A,scaleSequential as j}from"d3-scale";import{quadtree as O}from"d3-quadtree";import{bin as E,extent as S}from"d3-array";import{packEnclose as M}from"d3-hierarchy";import{area as C,curveCatmullRom as $,curveCardinal as z,curveBasis as P,curveStepBefore as L,curveStepAfter as B,curveStep as I,curveMonotoneY as R,curveMonotoneX as D,curveLinear as N,line as T,curveNatural as W}from"d3-shape";import _ from"regression";import{zoomIdentity as F,zoom as H}from"d3-zoom";import{select as q}from"d3-selection";import{schemeCategory10 as G,interpolatePlasma as V,interpolateViridis as U,interpolatePurples as Z,interpolateOranges as Y,interpolateGreens as X,interpolateReds as Q,interpolateBlues as K,schemeSet3 as J,schemeTableau10 as ee}from"d3-scale-chromatic";class te{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}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:Object.assign({},a),n.push(e),this.buffer[i]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function ne(e,t,n){return e+(t-e)*n}function oe(e,t,n){var o,r,i;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>s?1:a;default:return 1}}const re={mercator:k,equalEarth:g,albersUsa:x,orthographic:v,naturalEarth:b,equirectangular:m};function ie(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function ae(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function se(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):n}const le={fill:"#e0e0e0",stroke:"#999",strokeWidth:.5,fillOpacity:1},ce={fill:"#4e79a7",r:4,fillOpacity:.8},ue={stroke:"#4e79a7",strokeWidth:1.5,fill:"none"};function de(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let r=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>r.length||o.push(r),r=[i]):r.push(i)}return 2>r.length||o.push(r),o}function pe(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const a=-r/i,s=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;d.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return d}function he(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,a;0===t?(i=e[1][0]-r[0],a=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],a=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(i*i+a*a)||1;o.push([r[0]+a/s*n,r[1]+-i/s*n])}return o}function ye(e,t,n,o,r){const i=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(i*i+a*a);if(0===s)return[e,t];const l=a/s,c=-i/s,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}class fe{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e}initStreaming(e=500){this.pointBuffer=new te(e),this.timestampBuffer=new te(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return g();if("string"==typeof e){const t=re[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),g())}if("object"==typeof e&&"type"in e){const t=re[e.type],n=t?t():g();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=p(this.projection),this.fitProjection(e),this.geoPath=p(this.projection);const n=this.projection;this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null};const o=this.scene;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&o.length>0&&this.startTransition(o),this.version++}fitProjection(e){var t,n,o,r,i;const a=this.projection,s=this.config,l=[...this.areas],c=ie(s.xAccessor,"lon"),u=ie(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const p=ae(s.lineDataAccessor);for(const e of this.lineData){const t=p(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==l.length){if(s.projectionExtent){const[[t,n],[o,r]]=s.projectionExtent;a.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,r],[t,r],[t,n]]]}})}else if(a.clipAngle&&(null!==(t=a.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=s.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);a.scale(o/2-o*t),a.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,r=e.height*t;a.fitExtent([[n,r],[e.width-n,e.height-r]],{type:"FeatureCollection",features:l})}this.baseScale=a.scale(),this.baseTranslate=a.translate(),this.baseRotation=null!==(i=null===(r=a.rotate)||void 0===r?void 0:r.call(a))&&void 0!==i?i:[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=p(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=p(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;n&&n.rotate&&(n.rotate(e),this.geoPath=p(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,fe.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._quadtree=O().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,n,o;const r=[],{config:i}=this,a=this.projection,s=this.geoPath,l=ie(i.xAccessor,"lon"),c=ie(i.yAccessor,"lat");if(i.graticule){const t=!0===i.graticule?{}:i.graticule,n=h();t.step&&n.step(t.step);const o=s(n())||"";o&&r.push({type:"geoarea",pathData:o,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=s(e);if(!t)continue;const n=s.centroid(e),o=s.bounds(e),a=s.area(e),l=se(i.areaStyle,e,le);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:a,style:l,datum:e,interactive:!0})}const u=ae(i.lineDataAccessor);for(const t of this.lineData){const n=u(t);if(!n||2>n.length)continue;let o=[];if("geo"===i.lineType){const e=Array(n.length);for(let t=0;n.length>t;t++)e[t]=[l(n[t]),c(n[t])];for(let t=0;e.length-1>t;t++){const n=e[t],r=e[t+1],i=y(n,r)||0,s=Math.max(2,Math.ceil(i/(Math.PI/180))),l=f(n,r);for(let e=0;s>=e;e++){if(t>0&&0===e)continue;const n=a(l(e/s));null!=n&&o.push(n)}}}else for(let e=0;n.length>e;e++){const t=n[e],r=a([l(t),c(t)]);null!=r&&o.push(r)}if(2>o.length)continue;const s=se(i.lineStyle,t,ue),d="number"==typeof s.strokeWidth?s.strokeWidth:1;2!==n.length||2>o.length||"arc"!==i.flowStyle?2!==n.length||2>o.length||"offset"!==i.flowStyle||(o="geo"===i.lineType?he(o,d):ye(o[0],o[o.length-1],0,0,d)):o=pe(o[0],o[o.length-1]);const p=de(o,e.width);if(p.length>1)for(const e of p){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},s),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>o.length&&p[0]||o,style:s,datum:t})}const d=this.getPoints(),p=i.pointIdAccessor?"function"==typeof i.pointIdAccessor?i.pointIdAccessor:e=>e[i.pointIdAccessor]:null,g=a.clipAngle&&null!==(t=a.clipAngle())&&void 0!==t?t:0,m=g>0?g*Math.PI/180:null,b=a.rotate?a.rotate():[0,0,0],v="function"==typeof a.center?a.center():[0,0],x=[(null!==(n=v[0])&&void 0!==n?n:0)-b[0],(null!==(o=v[1])&&void 0!==o?o:0)-b[1]];for(let e=0;d.length>e;e++){const t=d[e],n=l(t),o=c(t);if(null!=m&&y([n,o],x)>m)continue;const s=a([n,o]);if(!s)continue;const u=i.pointStyle?i.pointStyle(t):Object.assign({},ce),h={type:"point",x:s[0],y:s[1],r:u.r||4,style:u,datum:t,pointId:p?p(t)+"":void 0};r.push(h)}return r}applyCartogramTransform(e,t){var n,o,r;const i=this.scene.filter(e=>"point"===e.type);if(2>i.length)return;const a=null!==(n=e.strength)&&void 0!==n?n:1;if(0===a)return;const s=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,l="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=i.find(t=>s(t.datum)+""==e.center+"");if(!c)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const u=c.x,d=c.y,p=i.map(e=>l(e.datum)).filter(e=>isFinite(e)&&e>=0),h=Math.max(...p,1),y=Math.min(t.width,t.height)/2,f=w().domain([0,h]).range([0,y]);this.cartogramLayout={cx:u,cy:d,maxCost:h,availableRadius:y},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of i){if(e===c)continue;const t=Math.atan2(e.y-d,e.x-u),n=Math.sqrt(Math.pow(e.x-u,2)+Math.pow(e.y-d,2)),o=l(e.datum),r=n+((isFinite(o)?f(o):n)-n)*a;e.x=u+Math.cos(t)*r,e.y=d+Math.sin(t)*r}const g=t.width/2,m=t.height/2,b=g-c.x,v=m-c.y;if(Math.abs(b)>.5||Math.abs(v)>.5)for(const e of i)e.x+=b,e.y+=v;this.cartogramLayout={cx:g,cy:m,maxCost:h,availableRadius:y};const x=this.scene.filter(e=>"line"===e.type);if(x.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of i)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of x){const n=null===(o=t.datum)||void 0===o?void 0:o.source,i=null===(r=t.datum)||void 0===r?void 0:r.target;if(n&&i){const o=e.get(n+""),r=e.get(i+"");o&&r&&(t.path=[o,r])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const r=oe(e,o,t);n[o]._decayOpacity=r,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:r})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),a=this.timestampBuffer.toArray();for(let e=0;i.length>e&&a.length>e;e++){const s=r-a[e];o>s&&(i[e]._pulseIntensity=1-s/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of i)if(e.pointId){const t=r.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(a=!0))}a&&(this.activeTransition={startTime:performance.now(),duration:o})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=ne(e.x,e._targetX,n),e.y=ne(t,e._targetY,n)}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0);return this.activeTransition=null,!1}return!0}}function ge(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function me(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function be(e,t){const n=me(e);if(!n)return!1;const o=me(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function ve(e,t,n,o,r,i,a=0){if(i){const e=function(e,t,n,o,r){const i=Math.max(o,r+5,12),a=t-i,s=t+i,l=n-i,c=n+i;let u=null,d=1/0;return e.visit((e,r,i,p,h)=>{if(r>s||a>p||i>c||l>h)return!0;if(!e.length){let r=e;do{const e=r.data,i=e.x-t,a=e.y-n,s=Math.sqrt(i*i+a*a);ge(e.r,o)>=s&&d>s&&(u=e,d=s),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,a);if(e)return e}else{let r=null,i=o;for(const a of e){if("point"!==a.type)continue;const e=a.x-t,s=a.y-n,l=Math.sqrt(e*e+s*s);ge(a.r,o)>=l&&i>l&&(r=a,i=l)}if(r)return{node:r,distance:i}}for(let o=e.length-1;o>=0;o--){const i=e[o];if("geoarea"!==i.type)continue;const a=i;if(!1===a.interactive)continue;const[[s,l],[c,u]]=a.bounds;if(!(s>t||t>c||l>n||n>u)&&(a._cachedPath2D||(a._cachedPath2D=new Path2D(a.pathData)),r.isPointInPath(a._cachedPath2D,t,n)))return{node:a,distance:0}}let s=null,l=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:r}=e,i=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;r.length-1>o;o++){const[a,c]=r[o],[u,d]=r[o+1],p=xe(t,n,a,c,u,d);i>=p&&l>p&&(s=e,l=p)}}return s?{node:s,distance:l}:null}function xe(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}function ke(s){const l=t(null),c=we(s);return[function({children:t}){const o=n(()=>we(s),[]);return e.createElement(l.Provider,{value:o,children:t})},e=>{var t;const n=null!==(t=o(l))&&void 0!==t?t:c,s=r(e);s.current=e;const u=i(()=>s.current(n.getState()),[n]),d=i(()=>s.current(n.getState()),[n]);return a(n.subscribe,u,d)}]}function we(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function Ae(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:je})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}fe.QUADTREE_THRESHOLD=500;const je=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Oe={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Ee={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Se={mode:"light",colors:{primary:"#0000cc",categorical:je,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"},[Me,Ce]=ke(e=>({theme:Oe,setTheme(t){e(e=>{if("light"===t)return{theme:Oe};if("dark"===t)return{theme:Ee};if("high-contrast"===t)return{theme:Se};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Ee:Oe;return{theme:Ae(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:Ae(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const $e=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ze=new WeakMap;let Pe=0,Le=!1,Be=null,Ie=null,Re=null;function De(e,t){var n,o;if(!t)return t;const r=$e.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(Le)return;if("undefined"==typeof window||"undefined"==typeof document)return;Le=!0;const e=()=>{Pe++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Be=new MutationObserver(e),Be.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Ie=window.matchMedia("(prefers-color-scheme: dark)"),Re=e,"function"==typeof Ie.addEventListener?Ie.addEventListener("change",Re):"function"==typeof Ie.addListener&&Ie.addListener(Re)}catch(e){}}();let a=ze.get(i);a&&a.version===Pe||(a={version:Pe,map:new Map},ze.set(i,a));const s=a.map.get(t);if(void 0!==s)return s;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return a.map.set(t,l),l}function Ne(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Te(t){const o=function(){const[e,t]=s(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return l(()=>{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}(),a=r(o);a.current=o;const[c,u]=function(e,t,n){const o=r(null),[i,a]=s(null);return l(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&i?i.w:e[0],n&&i?i.h:e[1]]]}(t.sizeProp,t.responsiveWidth,t.responsiveHeight),d=n(()=>Object.assign(Object.assign({},t.marginDefault),t.userMargin),[t.marginDefault,t.userMargin]),p=u[0]-d.left-d.right,h=u[1]-d.top-d.bottom,y=Ne(t.foregroundGraphics,u,d),f=Ne(t.backgroundGraphics,u,d),g=Ce(e=>e.theme),{transition:m,introEnabled:b}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(r||!e||!0!==e&&!1===e.intro)}}(t.animate,t.transitionProp),v="semiotic-table-"+e.useId(),x=r(0),k=r(()=>{}),w=i(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);l(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=r(()=>{}),j=r(()=>{}),O=r(null),E=r(0),S=i(()=>{E.current=0;const e=O.current;O.current=null,e&&A.current(e)},[]),M=i(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===E.current&&(E.current=requestAnimationFrame(S))},[S]),C=i(()=>{O.current=null,0!==E.current&&(cancelAnimationFrame(E.current),E.current=0),j.current()},[]);l(()=>()=>{O.current=null,0!==E.current&&(cancelAnimationFrame(E.current),E.current=0)},[]);const $=t.themeDirtyRef;return l(()=>{$&&(Pe++,$.current=!0,w())},[g,w,$]),{reducedMotion:o,reducedMotionRef:a,responsiveRef:c,size:u,margin:d,adjustedWidth:p,adjustedHeight:h,resolvedForeground:y,resolvedBackground:f,currentTheme:g,transition:m,introEnabled:b,tableId:v,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:j,onPointerMove:M,onPointerLeave:C}}const We={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 _e(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,We[n])(o(e,t)),r}function Fe(){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 He(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function qe({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:a,format:s}=t,l=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=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":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:s+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":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),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 Ge(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[p,h]=e.useState(0),[y,f]=e.useState(0),g=e.useCallback((e,t)=>{h(e),f(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const p=[];return t.forEach((t,h)=>{d+=5,p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+h,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,p.push(e.createElement("text",{key:"legend-text-"+h,y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label)),d+=8),p.push(e.createElement("g",{key:"legend-group-"+h,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:p,items:h}=t,y=[];let f=0;const g=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return h.forEach((t,u)=>{const b=_e(t,u,d,p),v=He(t,r,i),x=i&&i.size>0&&i.has(t.label);y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${f})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:g?l===a&&u===s?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&m?x||!1:void 0,"aria-current":g&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:g?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)+h.length)%h.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:g?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:g?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},g&&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"}),b,x&&e.createElement(Fe,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),f+=22}),y})(t,o,r,i,a,s,l,h,c,u))),d+=22*t.items.length+8}),p})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let p=0;const h=[];t.forEach((t,n)=>{let y=0;t.label&&(y+=16);const f=((t,n,o,r,i,a,s,l,c,u,d)=>{const{type:p="fill",styleFn:h,items:y}=t,f=[];let g=0,m=0;const b=!(!n&&!o),v="isolate"===u||void 0===u&&null!=i;y.forEach((t,u)=>{const x=_e(t,u,p,h),k=He(t,r,i),w=i&&i.size>0&&i.has(t.label),A=26+7*t.label.length;d&&d>0&&g>0&&g+A>d&&(m++,g=0),f.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${g},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:b?l===a&&u===s?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&v?w||!1:void 0,"aria-current":b&&!v&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:b?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)+y.length)%y.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:b?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},b&&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(Fe,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),g+=A});let x=0,k=0;for(const e of y){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:f,offset:x,totalRows:w,totalHeight:22*w}})(t,r,i,a,s,l,c,n,u,d,o);y+=f.offset+5,h.push(Object.assign(Object.assign({label:t.label},f),{offset:y,totalRows:f.totalRows,totalHeight:f.totalHeight})),p+=y+12});let y=p>o?0:Math.max(0,(o-p)/2);const f=[];return h.forEach((o,r)=>{const i=t[r];i.label&&(f.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},i.label)),y+=16),f.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${y},0)`},o.items)),y+=o.offset+5,t[r+1]&&f.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:y,y1:-8,x2:y,y2:(o.totalHeight||n)+0+8})),y+=12}),e.createElement("g",null,f)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s}),b=!(!o&&!r);return e.createElement("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==s&&(void 0!==s||null==a))||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",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},l),m)}function Ve(e){return"string"==typeof e?{type:e}:e}function Ue({orient:t,config:o,values:r,scale:i,size:a,length:s}){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=a-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)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!n)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:p}=n,h=Math.min(.5*o,20),y=(o-h)/2+4;if(c){const n=i(a),o=i(u),r=i(s),c=i(d),f=i(p),g="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+g*(y+h/2),x2:f,y2:m+g*(y+h/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+g*y,x2:c,y2:m+g*(y+h),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:f,y1:m+g*y,x2:f,y2:m+g*(y+h),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-y-h:m+y,width:Math.abs(o-n),height:h,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-y-h:m+y,x2:r,y2:"top"===t?m-y:m+y+h,stroke:l.fill,strokeWidth:2}))}{const n=i(a),o=i(u),r=i(s),c=i(d),f=i(p),g="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+g*(y+h/2),y1:c,x2:m+g*(y+h/2),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+g*y,y1:c,x2:m+g*(y+h),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+g*y,y1:f,x2:m+g*(y+h),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-y-h:m+y,y:Math.min(n,o),width:h,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-y-h:m+y,y1:r,x2:"left"===t?m-y:m+y+h,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=E().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 a=n.length/d*o;if(c){const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:o,y:"top"===t?-4-a:4,width:Math.max(s,.5),height:a,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:"left"===t?-4-a:4,y:Math.min(o,o+s),width:a,height:Math.abs(s),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 a=e.length/d*(o/2),s=i((e.x0+e.x1)/2);r.push(c?`${s},${"top"===t?-(n-a):n-a}`:`${"left"===t?-(n-a):n-a},${s}`)}for(let e=u.length-1;e>=0;e--){const a=u[e];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(o/2),l=i((a.x0+a.x1)/2);r.push(c?`${l},${"top"===t?-(n+s):n+s}`:`${"left"===t?-(n+s):n+s},${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,a=i((e.x0+e.x1)/2);n.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${a},${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,a=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${e},${a}`),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,a,s,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function Ze(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Ye(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 Xe(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:p,className:h,disable:y,events:f={},"data-testid":g}=t,m=new Set(Array.isArray(y)?y:[]);let b=r||0,v=i||0;null!=a&&(b=a-n),null!=s&&(v=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===b&&0===v)if(void 0!==u.width){b=u.width/2;const e=u.depth||30;v=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;b=e+(0>e?-5:5),v=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(h||"")).trim(),transform:`translate(${n},${o})`,"data-testid":g},f),!m.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,p=t*d>n*u?u/t:d/n;l=r+a*p,c=i+s*p}}}else if("bracket"===i&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(a.radius||0)+(a.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&&(s.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(b,v,c,p,x,u),!m.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, 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)&&s.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-a;s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:Ye((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}}return e.createElement("g",{className:"annotation-subject"},s)}(x,u,p,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let p=l;p&&"dynamic"!==p||(p="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===d?"right"===p?h="end":"middle"===p&&(h="middle"):h=0>n?"end":"start";const y=16,f=a?u?[a]:Ze(a,c):[],g=i?u?[i]:Ze(i,c):[],m="leftRight"===d?"end"===h?-4:4:0;let b=0;const v=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";f.length>0&&(v.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:h,fontWeight:"bold"},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t)))),b=f.length*y),g.length>0&&v.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:h,y:b},g.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t))));let k=null;if((a||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(f.length+g.length)*y+(g.length>0?y:0);let n=0,o=t;"bottom"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,f.length+g.length-1)*y;let A=0;return"topBottom"===d?A=0>o?-(w+2):18:"leftRight"===d&&(A="middle"===p?-(w+y+(g.length>0&&f.length>0?2:0))/2+8:"bottom"===p||0>o?-(w+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},v),k)}(l,b,v,p))}function Qe(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=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:s});return e.createElement(Xe,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Xe,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}function Ke(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 Je(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 et(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){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,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.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===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],p=l[e.yAccessor||"y"];return null==d||null==p?null:{x:c(d),y:u(p)}}(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=Ke(e,n),c=Je(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"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function tt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const nt={linear:N,monotoneX:D,monotoneY:R,step:I,stepAfter:B,stepBefore:L,basis:P,cardinal:z,catmullRom:$};let ot={positions:new Map};const rt=new Set;function it(){for(const e of rt)e()}function at(e,t){const n=ot.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(ot.positions);o.delete(e),ot={positions:o},it()}function st(e,t){const n=ot.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(ot.positions);o.delete(e),ot={positions:o},it()}function lt(){return ot}function ct(e){return rt.add(e),()=>rt.delete(e)}const ut={positions:new Map};function dt(){return()=>{}}function pt(){return ut}function ht(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function yt(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 a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function ft(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function gt(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 mt(t){var o,i;const{width:s,height:c,totalWidth:u,totalHeight:d,margin:p,scales:h,showAxes:y,axes:f,xLabel:g,yLabel:m,yLabelRight:b,xFormat:v,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:j,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:S,legendPosition:$="right",foregroundGraphics:z,marginalGraphics:P,xValues:L,yValues:B,annotations:I,svgAnnotationRules:R,xAccessor:D,yAccessor:T,annotationData:W,pointNodes:F,curve:H,underlayRendered:q,linkedCrosshairName:G,linkedCrosshairSourceId:V,children:U}=t,Z=n(()=>{var e;if(!y||!h)return[];const t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||v||ft,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,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(l+8,55)):Math.max(55,l+8);let u=gt(a,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=h.x.domain()[1],t=h.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,i);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[y,h,f,v,s]),Y=n(()=>{var e;if(!y||!h)return[];const t=null==f?void 0:f.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=gt(h.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:h.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=h.y.domain()[1],t=h.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[y,h,f,x,c]),X=n(()=>{var e;if(!y||!h)return[];const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||ft,o=null!==(e=t.ticks)&&void 0!==e?e:5;return gt(h.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:h.y(e),label:n(e)})),22)},[y,h,f,x,c]),Q=r(new Map),K=r(null!==(o=null==I?void 0:I.length)&&void 0!==o?o:0),J=null!==(i=null==I?void 0:I.length)&&void 0!==i?i:0;K.current!==J&&(K.current=J,Q.current=new Map);const ee=n(()=>{if(!I||0===I.length)return null;const t=function(t,n,o){var r,i,a,s,l,c,u,d,p,h,y,f,g,m,b,v,x,k,w,A,j,O,E,S,$,z,P,L,B,I,R,D,T,W,F,H,q,G,V,U,Z,Y,X,Q,K,J,ee,te;switch(t.type){case"label":{const r=et(t,n,o);if(!r)return null;const{x:i,y:a}=r;return tt(i,a,o)?e.createElement(Qe,{key:"ann-"+n,noteData:{x:i,y:a,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=et(t,n,o);if(!r)return null;const{x:i,y:a}=r;return tt(i,a,o)?e.createElement(Qe,{key:"ann-"+n,noteData:{x:i,y:a,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=Ke(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"top";let s;return s="bottom"===a?(o.height||0)-4:"center"===a?(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:s,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=Je(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"right";let s,l;return"left"===a?(s=4,l="start"):"center"===a?(s=(o.width||0)/2,l="middle"):(s=(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:s,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Ke(Object.assign(Object.assign({},e),{type:"point"}),o),y:Je(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=M(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-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:Ke(Object.assign(Object.assign({},e),{type:"point"}),o),y:Je(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,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+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):[],a={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Ke(n,o),s=Je(n,o);if(null==i||null==s)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||a;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:l},c))}))}case"bracket":{const r=Ke(t,o),i=Je(t,o);return e.createElement(Qe,{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 p=o.xAccessor||"x",h=o.yAccessor||"y",y=d.map(e=>[e[p],e[h]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const f=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,g=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!f||!g)return null;const m=t.method||"linear";let b;b="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]),a=Math.max(2,Math.ceil(t*n)),s=[];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(a-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,p=0,h=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],p+=t*i[e],h+=t*r[e]*r[e],y+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const f=u*h-d*d;if(1e-12>Math.abs(f))s.push([t,p/u]);else{const e=(u*y-d*p)/f;s.push([t,(p-e*d)/u+e*t])}}return s}(y,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?_.polynomial(y,{order:t.order||2}):_.linear(y)).points;const v=b.map(([e,t])=>`${f(e)},${g(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:v,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:f(b[b.length-1][0])+4,y:g(b[b.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(p=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==p?p:null===(h=o.scales)||void 0===h?void 0:h.value,i=null!==(y=null==r?void 0:r(t.y0))&&void 0!==y?y:0,a=null!==(f=null==r?void 0:r(t.y1))&&void 0!==f?f:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-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,a)-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",a=null!==(m=null===(g=o.scales)||void 0===g?void 0:g.x)&&void 0!==m?m:null===(b=o.scales)||void 0===b?void 0:b.time,s=null!==(x=null===(v=o.scales)||void 0===v?void 0:v.y)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.value;if(!a||!s)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 p=nt[o.curve||"linear"]||N,h=C().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(p)(d);if(!h)return null;const y=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:h,fill:y,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:a(d[d.length-1][i])+4,y:s(d[d.length-1][l])-4,fill:y,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(j=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==j?j:null===(O=o.scales)||void 0===O?void 0:O.time,s=null!==(S=null===(E=o.scales)||void 0===E?void 0:E.y)&&void 0!==S?S:null===($=o.scales)||void 0===$?void 0:$.value;if(!a||!s)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),p=null!==(z=t.threshold)&&void 0!==z?z:2,h=c-p*d,y=!1!==t.showBand,f=t.fill||"#6366f1",g=null!==(P=t.fillOpacity)&&void 0!==P?P:.1,m=t.anomalyColor||"#ef4444",b=null!==(L=t.anomalyRadius)&&void 0!==L?L:6,v=s(c+p*d),x=s(h),k=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>p*d});return e.createElement("g",{key:"ann-"+n},y&&e.createElement("rect",{x:0,y:Math.min(v,x),width:o.width||0,height:Math.abs(x-v),fill:f,fillOpacity:g}),k.map((t,n)=>{const r=Ke(t,o),i=Je(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(v,x)-4,textAnchor:"end",fill:f,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(I=null===(B=o.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(R=o.scales)||void 0===R?void 0:R.time,l=null!==(T=null===(D=o.scales)||void 0===D?void 0:D.y)&&void 0!==T?T:null===(W=o.scales)||void 0===W?void 0:W.value;if(!s||!l)return null;const c=r.map(e=>[e[i],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=_.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 a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*e}const d=c.length,p=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),h=Math.sqrt(p/Math.max(d-2,1)),y=c.reduce((e,t)=>e+t[0],0)/d,f=c.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),g=null!==(F=t.confidence)&&void 0!==F?F:.95,m=.99>g?.95>g?.9>g?1:1.645:1.96:2.576,b=null!==(H=t.steps)&&void 0!==H?H:5,v=c[d-1][0],x=(v-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(v+e*x);const w=[];for(const e of k){const t=u(e),n=h*Math.sqrt(1+1/d+(f>0?Math.pow(e-y,2)/f:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,j=w.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),O=`${s(v)},${l(u(v))}`,E=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(q=t.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e.createElement("polyline",{points:`${O} ${j}`,fill:"none",stroke:E,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(V=t.strokeDasharray)&&void 0!==V?V:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:s(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:E,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=et(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!tt(r,i,o))return null;const a=null!==(U=t.dx)&&void 0!==U?U:0,s=null!==(Z=t.dy)&&void 0!==Z?Z:0,l=null!==(Y=t.width)&&void 0!==Y?Y:32,c=null!==(X=t.height)&&void 0!==X?X:32,u=null!==(Q=t.content)&&void 0!==Q?Q:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+a-l/2,y:i+s-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=et(t,n,o);if(!r)return null;const{x:i,y:a}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:a+(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===(K=o.scales)||void 0===K?void 0:K.o,a=null===(J=o.scales)||void 0===J?void 0:J.x,s=null===(ee=o.scales)||void 0===ee?void 0:ee.y,l=(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:(null==s?void 0:s.bandwidth)?s: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)",p=null!==(te=t.opacity)&&void 0!==te?te:.15,h=t.label;return(o.projection?"vertical"===o.projection:l===a)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:p}),h&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},h)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:p}),h&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},h))}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:D,yAccessor:T,width:s,height:c,data:W,frameType:"xy",pointNodes:F,curve:H,stickyPositionCache:Q.current};return I.map((e,o)=>{if(R){const r=R(e,o,n);return null!=r?r:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[I,R,s,c,D,T,W,h,F,H]),te=function(e){var t;const n=a(e?ct:dt,e?lt:pt,e?lt:pt);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(G);return l(()=>{if(!(null==te?void 0:te.locked)||!G)return;const e=e=>{"Escape"===e.key&&st(G)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==te?void 0:te.locked,G]),y||w||A||z||P||ee&&ee.length>0||k||U||te?e.createElement("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof w?w:"XY Chart"),e.createElement("desc",null,"string"==typeof w?w+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${p.left},${p.top})`},k&&h&&!q&&(()=>{var t,n;const o=ht(null===(t=null==f?void 0:f.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=ht(null===(n=null==f?void 0:f.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},Z.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:c,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o})),Y.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,strokeDasharray:r})))})(),y&&h&&(()=>{const t=null==f?void 0:f.find(e=>"left"===e.orient),n=null==f?void 0:f.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=!n||!1!==n.baseline,i=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,l=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",h="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",v=!!(null==n?void 0:n.autoRotate)&&Z.length>1&&(()=>{const e=s/Math.max(Z.length-1,1);return Z.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!q&&r&&!a&&e.createElement("line",{x1:0,y1:c,x2:s,y2:c,stroke:d,strokeWidth:1}),!q&&a&&e.createElement("path",{d:yt("bottom",s,c),fill:"none",stroke:d,strokeWidth:1}),Z.map((t,n)=>{const o=!!l&&("function"==typeof l?l(t.value,n):be(t.value,n>0?Z[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${c})`},e.createElement("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:v?10:18,textAnchor:v?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:h,style:{userSelect:"none"},transform:v?"rotate(-45)":void 0},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))}),g&&e.createElement("text",{x:s/2,y:c+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"}},g),!q&&o&&!i&&e.createElement("line",{x1:0,y1:0,x2:0,y2:c,stroke:d,strokeWidth:1}),!q&&i&&e.createElement("path",{d:yt("left",s,c),fill:"none",stroke:d,strokeWidth:1}),Y.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):be(t.value,n>0?Y[n-1].value:void 0));return e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:h,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.createElement("text",{x:15-p.left,y:c/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-p.left}, ${c/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t||0===X.length)return null;const n=t.landmarkTicks,o=t.label||b;return e.createElement(e.Fragment,null,!1!==t.baseline&&e.createElement("line",{x1:s,y1:0,x2:s,y2:c,stroke:d,strokeWidth:1}),X.map((t,o)=>{const r=!!n&&("function"==typeof n?n(t.value,o):be(t.value,o>0?X[o-1].value:void 0));return e.createElement("g",{key:"ytick-r-"+o,transform:`translate(${s},${t.pixel})`},e.createElement("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:h,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"}},t.label)))}),o&&e.createElement("text",{x:s+p.right-15,y:c/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${s+p.right-15}, ${c/2})`,style:{userSelect:"none"}},o))})())})(),ee,P&&h&&L&&B&&e.createElement(e.Fragment,null,P.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ue,{orient:"top",config:Ve(P.top),values:L,scale:h.x,size:p.top,length:s})),P.bottom&&e.createElement("g",{transform:`translate(0, ${c})`},e.createElement(Ue,{orient:"bottom",config:Ve(P.bottom),values:L,scale:h.x,size:p.bottom,length:s})),P.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ue,{orient:"left",config:Ve(P.left),values:B,scale:h.y,size:p.left,length:c})),P.right&&e.createElement("g",{transform:`translate(${s}, 0)`},e.createElement(Ue,{orient:"right",config:Ve(P.right),values:B,scale:h.y,size:p.right,length:c}))),z,te&&te.sourceId!==V&&(null==h?void 0:h.x)&&(()=>{const t=h.x(te.xValue);if(null==t||0>t||t>s)return null;const n=te.locked;return e.createElement("line",{x1:t,y1:0,x2:t,y2:c,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),U),w&&e.createElement("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:p}=t;if(!n)return null;const h="top"===a||"bottom"===a;let y,f;return"left"===a?(y=4,f=i.top):"top"===a?(y=0,f=s?32:8):"bottom"===a?(y=0,f=r-i.bottom+50):(y=o-i.right+10,f=i.top),e.createElement("g",{transform:`translate(${y}, ${f})`},"object"==typeof(g=n)&&null!==g&&"gradient"in g?e.createElement(qe,{config:n.gradient,orientation:h?"horizontal":"vertical",width:h?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(Ge,{legendGroups:n.legendGroups,title:"",width:h?o:100,orientation:h?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:p}):n);var g}({legend:A,totalWidth:u,totalHeight:d,margin:p,legendPosition:$,title:w,legendHoverBehavior:j,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:S})):null}function bt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const vt="undefined"==typeof window||"undefined"==typeof document,xt=e.createContext(null),kt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function wt(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"],a=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 a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const At=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},jt={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"},Ot={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Et={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},St={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Mt={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)"},Ct={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},$t={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function zt({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[a,s]=e.useState(!1),l=e.useContext(xt),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=a||c,d=e.useRef(null),p=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,h=e.useCallback(()=>{a||c||s(!0)},[a,c]),y=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:kt}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:h,style:kt,role:"region","aria-label":p},e.createElement("button",{type:"button",onClick:()=>s(!0)},"View data summary (",t.length," elements)"));const f=function(e){var t,n,o,r,i,a,s,l,c,u,d,p,h,y,f,g,m,b,v,x,k,w,A,j,O;const E=[];if(!Array.isArray(e))return E;for(const S of e)if(S&&"object"==typeof S)try{switch(S.type){case"point":E.push({label:"Point",values:{x:S.x,y:S.y}});break;case"line":{const e=S.path,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=S.topPath,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=S.datum&&"object"==typeof S.datum?S.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:S.group)&&void 0!==n?n:"",a=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;E.push({label:"Bar",values:{category:i,value:null!=a?a:""}});break}case"heatcell":E.push({label:"Cell",values:{x:S.x,y:S.y,value:S.value}});break;case"wedge":E.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(i=S.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:null===(s=S.datum)||void 0===s?void 0:s.label)&&void 0!==l?l:"",value:null!==(u=null===(c=S.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":E.push({label:"Node",values:{id:null!==(p=null===(d=S.datum)||void 0===d?void 0:d.id)&&void 0!==p?p:"",x:null!==(h=S.cx)&&void 0!==h?h:S.x,y:null!==(y=S.cy)&&void 0!==y?y:S.y}});break;case"arc":E.push({label:"Arc",values:{id:null!==(g=null===(f=S.datum)||void 0===f?void 0:f.id)&&void 0!==g?g:"",x:null!==(m=S.cx)&&void 0!==m?m:S.x,y:null!==(b=S.cy)&&void 0!==b?b:S.y}});break;case"candlestick":E.push({label:"Candlestick",values:{x:S.x,open:S.open,high:S.high,low:S.low,close:S.close}});break;case"geoarea":E.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(v=S.datum)||void 0===v?void 0:v.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=S.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(O=null===(j=S.datum)||void 0===j?void 0:j.value)&&void 0!==O?O:""}})}}catch(e){}return E}(t),g=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}(f),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${At(e.min)} to ${At(e.max)}, mean ${At(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(" ")}(f.length,g),b=f.slice(0,5),v=new Set;for(const e of b)for(const t of Object.keys(e.values))v.add(t);const x=Array.from(v);return e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:y,style:jt,role:"region","aria-label":p},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:Et},"×"),e.createElement("div",{role:"note",style:Ot},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:St},e.createElement("caption",{style:$t},"First ",b.length," of ",f.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:Mt},"type"),x.map(t=>e.createElement("th",{key:t,style:Mt},t)))),e.createElement("tbody",null,b.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:Ct},t.label),x.map(n=>{return e.createElement("td",{key:n,style:Ct},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":At(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function Pt({summary:t}){return t?e.createElement("div",{role:"note",style:kt},t):null}function Lt({tableId:t}){return e.createElement("a",{href:"#"+t,style:kt,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,kt)}},"Skip to data table")}function Bt({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:kt},n)}const It="var(--semiotic-focus, #005fcc)";function Rt({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:a,height:s}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=a&&null!=s){const t=Math.max(a,4),n=Math.max(s,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:It,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:It,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:It,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 Dt({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:a,className:s="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})},[a,s,o,r]);let p;return p=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:s,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:p,pointerEvents:"none",zIndex:l,width:"max-content"}},a)}function Nt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Tt(e,t,n=.6){var o,r,i,a,s;if(!Nt(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!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Wt(e,t,n,o=.35){Nt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function _t(e){switch(e){case"monotoneX":return D;case"monotoneY":return R;case"cardinal":return z;case"catmullRom":return $;case"step":return I;case"stepBefore":return L;case"stepAfter":return B;case"basis":return P;case"natural":return W;default:return null}}function Ft(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 Ht(e,t,n,o,r,i){if(2>t.length)return;const a=[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];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-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 qt(e){return e.k}function Gt(e){return[e.x,e.y]}function Vt(e){return function(){return e}}function Ut([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function Zt(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function Yt(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Xt(e,t,n,o,r){return"function"==typeof e?e(t,n,o,r):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",r>1?"@2x":"")}class Qt{constructor(e=256){this.cache=new Map,this.limit=e}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,o]of this.cache)t>o.lastUsed&&(t=o.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}}class Kt{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const a=n[i.lineIndex];if(!a||2>a.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const s=Jt(a),l=en(a,i.t*s),c=(o[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function Jt(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],r=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+r*r)}return t}function en(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],a=Math.sqrt(r*r+i*i);if(n+a>=t||o===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[o-1][0]+r*s,y:e[o-1][1]+i*s,nx:-i/l,ny:r/l}}n+=a}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const tn={top:10,right:10,bottom:10,left:10},nn={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"},on={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function rn({data:t}){if(!t)return null;if(t.properties)return e.createElement("div",{className:"semiotic-tooltip",style:nn},e.createElement("div",{style:{fontWeight:600}},t.properties.name||t.properties.NAME||t.properties.id||"Feature"));const n=Object.entries(t).slice(0,3);return e.createElement("div",{className:"semiotic-tooltip",style:nn},n.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,": "),e.createElement("span",{style:{fontWeight:600}},n+""))))}const an=c(function(t,o){var a,c,d,p,h,y,f,g,m,b;const{projection:v,projectionExtent:x,fitPadding:k,projectionTransform:w,areas:A,points:j,lines:O,xAccessor:E,yAccessor:S,lineDataAccessor:M,pointIdAccessor:C,lineType:$="geo",flowStyle:z="basic",graticule:P,zoomable:L,zoomExtent:B,onZoom:I,dragRotate:R,showParticles:D,particleStyle:N,tileURL:W,tileAttribution:_,tileCacheSize:G,size:V,width:U,height:Z,responsiveWidth:Y,responsiveHeight:X,margin:Q,className:K,background:J,areaStyle:ee,pointStyle:te,lineStyle:ne,colorScheme:oe,enableHover:re=!0,hoverAnnotation:ie,tooltipContent:ae,customClickBehavior:se,customHoverBehavior:le,annotations:ce,decay:ue,pulse:de,transition:pe,animate:he,staleness:ye,backgroundGraphics:ge,foregroundGraphics:me,title:be,legend:xe,legendPosition:ke,legendHoverBehavior:we,legendClickBehavior:Ae,legendHighlightedCategory:je,legendIsolatedCategories:Oe,showAxes:Ee,accessibleTable:Se=!0,description:Me,summary:Ce}=t,$e=V||[U||600,Z||400],ze=r(!0),Pe=Te({sizeProp:$e,responsiveWidth:Y,responsiveHeight:X,userMargin:Q,marginDefault:tn,foregroundGraphics:me,backgroundGraphics:ge,animate:he,transitionProp:pe,themeDirtyRef:ze}),{reducedMotionRef:Le,responsiveRef:Be,size:Ie,margin:Re,adjustedWidth:Ne,adjustedHeight:We,resolvedForeground:_e,resolvedBackground:Fe,transition:He,introEnabled:qe,tableId:Ge,rafRef:Ve,renderFnRef:Ue,scheduleRender:Ze}=Pe,Ye=n(()=>null!=R?R:"orthographic"===("string"==typeof v?v:"object"==typeof v&&"type"in v?v.type:null),[R,v]),Xe=n(()=>({projection:v,projectionExtent:x,fitPadding:k,xAccessor:E,yAccessor:S,lineDataAccessor:M,lineType:$,flowStyle:z,areaStyle:ee,pointStyle:te,lineStyle:ne,colorScheme:oe,graticule:P,projectionTransform:w,decay:ue,pulse:de,transition:He,introAnimation:qe,annotations:ce,pointIdAccessor:C}),[v,x,k,E,S,M,$,z,ee,te,ne,oe,P,w,ue,de,null==He?void 0:He.duration,null==He?void 0:He.easing,qe,ce,C]),Qe=r(null);Qe.current||(Qe.current=new fe(Xe));const Ke=r(null),Je=r(null),et=r(null),tt=r(null),nt=r(null);W&&!nt.current&&(nt.current=new Qt(G||256));const ot=r(ce),rt=r(null),it=r(F),at=r(!1),st=r(null),lt=r(null),ct=r(null),ut=r(null),dt=r(0);if(D&&!ut.current){const e=null!==(a=null==N?void 0:N.maxPerLine)&&void 0!==a?a:30;ut.current=new Kt(50*e)}const pt=r(null),ht=r(null),[yt,ft]=s(null),[gt,xt]=s(0),[kt,At]=s(!1);l(()=>{var e;null===(e=Qe.current)||void 0===e||e.updateConfig(Xe),ze.current=!0,Ze()},[Xe,Ze]),l(()=>{const e=Qe.current;e&&(A&&e.setAreas(A),j&&e.setPoints(j),O&&e.setLines(O),ze.current=!0,Ze())},[A,j,O,Ze]);const jt=i(e=>{var t;null===(t=Qe.current)||void 0===t||t.pushPoint(e),ze.current=!0,Ze()},[Ze]),Ot=i(e=>{var t;null===(t=Qe.current)||void 0===t||t.pushMany(e),ze.current=!0,Ze()},[Ze]),Et=i(()=>{var e;null===(e=Qe.current)||void 0===e||e.clear(),ze.current=!0,Ze()},[Ze]);u(o,()=>({push:jt,pushMany:Ot,removePoint:e=>{var t,n;const o=null!==(n=null===(t=Qe.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(ze.current=!0,Ze()),o},clear:Et,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=Qe.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.projection)&&void 0!==n?n:null},getGeoPath:()=>{var e,t,n;return null!==(n=null===(t=null===(e=Qe.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.geoPath)&&void 0!==n?n:null},getCartogramLayout:()=>{var e,t;return null!==(t=null===(e=Qe.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>it.current.k,resetZoom:()=>{const e=st.current;e&&rt.current&&q(e).call(rt.current.transform,F)},getData:()=>{var e,t;return null!==(t=null===(e=Qe.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[jt,Ot,Et,Ze]);const{hoverHandlerRef:St,onPointerMove:Mt,onPointerLeave:Ct}=Pe;l(()=>{St.current=e=>{if(!re)return;const t=Qe.current;if(!t||!t.scene.length)return;const n=Je.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Re.left,i=e.clientY-o.top-Re.top;if(0>r||r>Ne||0>i||i>We)return pt.current=null,ht.current=null,ft(null),null==le||le(null),void Ze();tt.current||(tt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const a=tt.current.getContext("2d");if(!a)return;const s=ve(t.scene,r,i,30,a,t.quadtree,t.maxPointRadius);if(s){const e=s.node,t=e.datum,n=(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,a;"point"===e.type?(o=e.x,a=e.y):"geoarea"===e.type?(o=e.centroid[0],a=e.centroid[1]):(o=r,a=i);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,x:o,y:a,time:o,value:a});pt.current=l,ht.current=e,ft(l),null==le||le(l),Ze()}else pt.current&&(pt.current=null,ht.current=null,ft(null),null==le||le(null),Ze())}},[re,Ne,We,Re,le,Ze]),Pe.hoverLeaveRef.current=()=>{pt.current=null,ht.current=null,ft(null),null==le||le(null),Ze()};const $t=i(e=>{if(!se)return;const t=Qe.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Re.left,r=e.clientY-n.top-Re.top;tt.current||(tt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=tt.current.getContext("2d");if(!i)return;const a=ve(t.scene,o,r,30,i,t.quadtree,t.maxPointRadius);if(a){const e=a.node.datum,t=(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;se(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,x:o,y:r,time:o,value:r}))}},[se,Re]),It=r(-1),Nt=r(null),Jt=i(e=>{const t=Qe.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)"point"===n.type&&null!=n.x?t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"}):"geoarea"===n.type&&n.centroid&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"circle"});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=It.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"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);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 It.current=-1,Nt.current=null,pt.current=null,ht.current=null,ft(null),null==le||le(null),void Ze();const i=0>o?0:r;It.current=i;const a=n[i];Nt.current={shape:a.shape,w:a.w,h:a.h};const s=a.datum;let l=s;s&&"object"==typeof s&&"geometry"in s&&s.properties&&"object"==typeof s.properties&&(l=Object.assign(Object.assign({},s),s.properties));const c=Object.assign(Object.assign({},l),{data:s,properties:null==s?void 0:s.properties,x:a.x,y:a.y,time:a.x,value:a.y});pt.current=c,ft(c),null==le||le(c),Ze()},[le,Ze]),en=i(e=>{It.current=-1,Nt.current=null,Mt(e)},[Mt]);Ue.current=()=>{var e,t,n,o,r,i,a;Ve.current=0;const s=Je.current,l=Qe.current;if(!s||!l)return;const c=performance.now();let u=!1;const d=ct.current;d&&(ct.current=null,l.applyRotation(d,{width:Ne,height:We}));const p=l.advanceTransition(Le.current?c+1e6:c),h=!Le.current&&p;if(ze.current&&!p){const e={width:Ne,height:We},t=Ye?l.getRotation():null;l.computeScene(e);const n=it.current,o=1!==n.k||0!==n.x||0!==n.y;Ye&&t?o?(l.setRotation(t),l.applyZoomScale(n.k,e)):l.applyRotation(t,e):o&&l.applyZoomTransform(n,e),ze.current=!1,s.setAttribute("aria-label",wt(l.scene,"Geographic chart"))}const y=Yt();if(W&&nt.current){const t=Ke.current;if(t&&(null===(e=l.scales)||void 0===e?void 0:e.projection)){const e=Zt(t,Ie,Re,y);if(e){e.clearRect(-Re.left,-Re.top,Ie[0],Ie[1]),e.save(),e.beginPath(),e.rect(0,0,Ne,We),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:a,onTileLoad:s}=t,l=o.scale(),c=o.translate(),u=2*l*Math.PI,d=function(){let e=0,t=0,n=960,o=500,r=!0,i=!0,a=256,s=qt,l=Gt,c=0;function u(){const u=+s.apply(this,arguments),d=l.apply(this,arguments),p=Math.log2(u/a),h=Math.round(Math.max(p+c,0)),y=Math.pow(2,p-h)*a,f=+d[0]-u/2,g=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-f)/y)),b=Math.min(r?1<<h:1/0,Math.ceil((n-f)/y)),v=Math.max(i?0:-1/0,Math.floor((t-g)/y)),x=Math.min(i?1<<h:1/0,Math.ceil((o-g)/y)),k=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)k.push([t,e,h]);return k.translate=[f/y,g/y],k.scale=y,k}return u.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],u):[n-e,o-t]},u.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],u):[[e,t],[n,o]]},u.scale=function(e){return arguments.length?(s="function"==typeof e?e:Vt(+e),u):s},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:Vt([+e[0],+e[1]]),u):l},u.zoomDelta=function(e){return arguments.length?(c=+e,u):c},u.tileSize=function(e){return arguments.length?(a=+e,u):a},u.clamp=function(e){return arguments.length?(r=i=!!e,u):r&&i},u.clampX=function(e){return arguments.length?(r=!!e,u):r},u.clampY=function(e){return arguments.length?(i=!!e,u):i},u}().size([r,i]).scale(u).translate(c).clamp(!0)(),p=Yt();let h=!0;for(const t of d){const[o,r,i]=Ut(t),l=`${i}/${o}/${r}`;let c=a.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};a.set(l,t),e.onload=()=>{t.loaded=!0,null==s||s()},e.onerror=()=>{t.loaded=!0},e.src=Xt(n,i,o,r,p),c=t}if(!c.loaded){h=!1;continue}const u=d.scale;e.drawImage(c.img,(t[0]+d.translate[0])*u-.5,(t[1]+d.translate[1])*u-.5,u+1,u+1)}return h}(e,{tileURL:W,projection:l.scales.projection,width:Ne,height:We,tileCache:nt.current,onTileLoad:()=>Ze()});e.restore(),t||(u=!0)}}}const f=Zt(s,Ie,Re,y);if(!f)return;f.clearRect(-Re.left,-Re.top,Ie[0],Ie[1]),J&&!W&&(f.fillStyle=J,f.fillRect(0,0,Ne,We)),f.save(),f.beginPath(),f.rect(0,0,Ne,We),f.clip();const g=l.scene,m={width:Ne,height:We};if(function(e,t){var n,o,r;const i=t.filter(e=>"geoarea"===e.type);for(const t of i){if(!t.pathData)continue;const i=new Path2D(t.pathData),a=t.style.fill||"#e0e0e0";if("none"!==a&&(e.fillStyle=a,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(i)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=De(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(r=t._decayOpacity)&&void 0!==r?r:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(i)}Wt(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(f,g),((e,t,n,o)=>{var r,i;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=s.style.stroke||"#007bff",u=s.style.strokeWidth||2,d=s.colorThresholds,p=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=u,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const g=null!==(r=s.style.opacity)&&void 0!==r?r:1;Ht(e,s.path,c,u,g,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=_t(s.curve),y=d&&d.length>0&&p&&p.length===s.path.length,f=s._decayOpacities;if(f&&f.length===s.path.length&&!y){e.strokeStyle=c;const m=null!==(i=s.style.opacity)&&void 0!==i?i:1;for(let b=0;s.path.length-1>b;b++)e.globalAlpha=.5*(f[b]+f[b+1])*m,e.beginPath(),e.moveTo(s.path[b][0],s.path[b][1]),e.lineTo(s.path[b+1][0],s.path[b+1][1]),e.stroke()}else if(y){let v=null,x=null,k=null,w=null,A=!1;function j(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),A=!0}function O(){A&&(e.stroke(),A=!1)}for(let E=0;s.path.length>E;E++){const[S,M]=s.path[E],C=p[E],$=Ft(C,d,c);if(null!==v&&null!==w&&null!==k){if($===w)e.lineTo(S,M);else{const z=[];for(const P of d){const L=P.value;(k>L||L>C)&&(L>k||C>L)||k===L||C===L||z.push({t:(L-k)/(C-k)})}z.sort((e,t)=>e.t-t.t);for(const B of z){const I=v+(S-v)*B.t,R=x+(M-x)*B.t,D=Ft(k+(C-k)*Math.min(B.t+1e-4,1),d,c);e.lineTo(I,R),O(),j(D,I,R)}e.lineTo(S,M)}v=S,x=M,k=C,w=$}else j($,S,M),v=S,x=M,k=C,w=$}O()}else{if(e.beginPath(),!s.strokeGradient||2>s.strokeGradient.colorStops.length||2>s.path.length)e.strokeStyle=c;else{const N=e.createLinearGradient(s.path[0][0],0,s.path[s.path.length-1][0],0);for(const W of s.strokeGradient.colorStops)N.addColorStop(Math.max(0,Math.min(1,W.offset)),W.color);e.strokeStyle=N}if(h)T().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[_,F]=s.path[0];e.moveTo(_,F);for(let H=1;s.path.length>H;H++)e.lineTo(s.path[H][0],s.path[H][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=("string"==typeof s.style.fill?De(e,s.style.fill):s.style.fill)||s.style.fill,h&&!y)T().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[G,V]=s.path[0];e.moveTo(G,V);for(let U=1;s.path.length>U;U++)e.lineTo(s.path[U][0],s.path[U][1])}const q=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(q,o.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(f,g,0,m),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=("string"==typeof t.style.fill?De(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?De(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Tt(e,t),e.globalAlpha=1}}finally{e.restore()}}})(f,g),D&&ut.current){const e=ut.current,a=g.filter(e=>"line"===e.type);if(a.length>0){const s=N||{},l=.3*(null!==(t=s.speedMultiplier)&&void 0!==t?t:1),d=null!==(n=s.maxPerLine)&&void 0!==n?n:30,p=null!==(o=s.spawnRate)&&void 0!==o?o:.15,h=null!==(r=s.radius)&&void 0!==r?r:2,y=null!==(i=s.opacity)&&void 0!==i?i:.7,g=c/1e3,m=dt.current>0?Math.min(g-dt.current,.1):.016;dt.current=g;const b=a.map(e=>e.path),v=a.map(e=>e.style.strokeWidth||2);for(let t=0;a.length>t;t++)Math.random()<p&&e.countForLine(t)<d&&e.spawn(t);e.step(m,l,b,v),f.globalAlpha=y;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=a[n.lineIndex],r="function"==typeof s.color?s.color(null==o?void 0:o.datum):"source"!==s.color&&s.color?s.color:(null==o?void 0:o.style.stroke)||"#fff";f.beginPath(),f.arc(n.x,n.y,h,0,2*Math.PI),f.fillStyle=r,f.fill()}f.globalAlpha=1,u=!0}}f.restore();const b=et.current;if(b){const e=Zt(b,Ie,Re,y);if(e){e.clearRect(-Re.left,-Re.top,Ie[0],Ie[1]);const t=ht.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof ie?ie:void 0,r=(null==o?void 0:o.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}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(ye){const e=performance.now()-l.lastIngestTime>(null!==(a=ye.threshold)&&void 0!==a?a:5e3);e!==kt&&At(e)}const v=ce!==ot.current;v&&(ot.current=ce),(ze.current||v)&&xt(e=>e+1),(h||null!=l.activeTransition||l.hasActivePulses||u)&&(Ve.current=requestAnimationFrame(()=>Ue.current()))},l(()=>(Ze(),()=>{var e;null===(e=nt.current)||void 0===e||e.clear()}),[Ze]),l(()=>{ze.current=!0,Ze()},[Ne,We,J,Ze]),function(e,t,n,o,r,i){l(()=>{if(!e)return;const a=setInterval(()=>{var a;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(a=e.threshold)&&void 0!==a?a:5e3,u=l-s.lastIngestTime>c;u!==r&&(i(u),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o])}(ye,Qe,ze,Ze,kt,At),l(()=>{if("production"!==process.env.NODE_ENV&&W){const e="string"==typeof v?v:"object"==typeof v&&"type"in v?v.type:null;e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[W,v]),l(()=>{const e=st.current;if(!L||!e)return rt.current&&e&&(q(e).on(".zoom",null),rt.current=null),void(e&&q(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=B||[1,8],o={width:Ne,height:We};if(Ye){let r=it.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),it.current=F.scale(r);const a=Qe.current;a&&(a.applyZoomScale(r,o),ze.current=!1,Ze(),null==I||I({projection:null===(i=a.scales)||void 0===i?void 0:i.projection,zoom:a.currentZoom}))};rt.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const a=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",s);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=Qe.current;if(!o)return;const r=o.getRotation();lt.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=lt.current;t&&(ct.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],Ze())},d=t=>{var n;if(!lt.current)return;lt.current=null,e.releasePointerCapture(t.pointerId);const r=ct.current;if(r){ct.current=null;const e=Qe.current;e&&(e.applyRotation(r,o),Ze())}const i=Qe.current;i&&(null==I||I({projection:null===(n=i.scales)||void 0===n?void 0:n.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),rt.current=null}}const r=H().scaleExtent([t,n]).extent([[0,0],[Ie[0],Ie[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;it.current=t,at.current=!0;const n=Qe.current;n&&(n.applyZoomTransform(t,o),ze.current=!1,Ze())}).on("end",e=>{var t;it.current=e.transform,at.current=!1;const n=Qe.current;n&&(null==I||I({projection:null===(t=n.scales)||void 0===t?void 0:t.projection,zoom:n.currentZoom}))});return rt.current=r,q(e).call(r),()=>{q(e).on(".zoom",null)}},[L,B,Ye,Ie,Ne,We,Re,I,Ze]);const nn=re&&!1!==ie,an=nn&&yt?ae?ae(yt):e.createElement(rn,{data:yt}):null,sn=an?e.createElement(Dt,{x:yt.x,y:yt.y,containerWidth:Ne,containerHeight:We,margin:Re,className:"stream-frame-tooltip",zIndex:10},an):null;if(vt){const t=Qe.current;t&&(A||j||O)&&(A&&t.setAreas(A),j&&t.setPoints(j),O&&t.setLines(O),t.computeScene({width:Ne,height:We}));const n=null!==(c=null==t?void 0:t.scene)&&void 0!==c?c:[];return e.createElement("div",{className:"stream-geo-frame"+(K?" "+K:""),role:"img","aria-label":Me||("string"==typeof be?be:"Geographic chart"),style:{position:"relative",width:Ie[0],height:Ie[1]}},e.createElement(Pt,{summary:Ce}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ie[0],height:Ie[1],style:{position:"absolute",left:0,top:0}},e.createElement("g",{transform:`translate(${Re.left},${Re.top})`},Fe),e.createElement("g",{transform:`translate(${Re.left},${Re.top})`},J&&e.createElement("rect",{x:0,y:0,width:Ne,height:We,fill:J}),n.map((t,n)=>function(t,n){var o,r,i,a,s,l;switch(t.type){case"geoarea":{const i=t;return i.pathData?e.createElement("path",{key:"geoarea-"+n,d:i.pathData,fill:bt(i.style.fill,"#e0e0e0"),fillOpacity:null!==(o=i.style.fillOpacity)&&void 0!==o?o:1,stroke:i.style.stroke||"none",strokeWidth:i.style.strokeWidth||.5,strokeDasharray:i.style.strokeDasharray,opacity:null!==(r=i._decayOpacity)&&void 0!==r?r:1}):null}case"point":{const o=t;return e.createElement("circle",{key:"point-"+n,cx:o.x,cy:o.y,r:o.r,fill:bt(o.style.fill),fillOpacity:null!==(i=o.style.fillOpacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(a=o._decayOpacity)&&void 0!==a?a:null!==(s=o.style.opacity)&&void 0!==s?s:1})}case"line":{const o=t;if(2>o.path.length)return null;const r="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e.createElement("path",{key:"line-"+n,d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(l=o.style.opacity)&&void 0!==l?l:1})}default:return null}}(t,n)))),e.createElement(mt,{width:Ne,height:We,totalWidth:Ie[0],totalHeight:Ie[1],margin:Re,scales:null,showAxes:!1,title:be,legend:xe,legendPosition:ke,legendHoverBehavior:we,legendClickBehavior:Ae,legendHighlightedCategory:je,legendIsolatedCategories:Oe,foregroundGraphics:_e,annotations:ce,annotationFrame:0,xValues:[],yValues:[],pointNodes:n.filter(e=>"point"===e.type)}))}const ln=i(e=>{st.current=e,Be&&"object"==typeof Be&&(Be.current=e)},[Be]);return e.createElement("div",{ref:ln,className:"stream-geo-frame"+(K?" "+K:""),role:"group","aria-label":Me||("string"==typeof be?be:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:Y?"100%":Ie[0],height:X?"100%":Ie[1],overflow:"hidden"},L?{touchAction:"none"}:{}),onKeyDown:Jt},Se&&e.createElement(Lt,{tableId:Ge}),Se&&e.createElement(zt,{scene:null!==(p=null===(d=Qe.current)||void 0===d?void 0:d.scene)&&void 0!==p?p:[],chartType:"Geographic chart",tableId:Ge,chartTitle:"string"==typeof be?be:void 0}),e.createElement(Pt,{summary:Ce}),e.createElement("div",{role:"img","aria-label":Me||("string"==typeof be?be:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:nn?en:void 0,onMouseLeave:nn?Ct:void 0,onClick:se?$t:void 0},Fe&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Ie[0],height:Ie[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Re.left},${Re.top})`},Fe)),W&&e.createElement("canvas",{ref:Ke,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement("canvas",{ref:Je,"aria-label":wt(null!==(y=null===(h=Qe.current)||void 0===h?void 0:h.scene)&&void 0!==y?y:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:et,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(Bt,{hoverPoint:yt}),e.createElement(mt,{width:Ne,height:We,totalWidth:Ie[0],totalHeight:Ie[1],margin:Re,scales:null,showAxes:null!=Ee&&Ee,title:be,legend:xe,legendPosition:ke,legendHoverBehavior:we,legendClickBehavior:Ae,legendHighlightedCategory:je,legendIsolatedCategories:Oe,foregroundGraphics:_e,annotations:ce,annotationFrame:gt,xValues:[],yValues:[],pointNodes:null===(f=Qe.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type)}),(null==ye?void 0:ye.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ye.badgePosition?{top:4,left:4}:"bottom-left"===ye.badgePosition?{bottom:4,left:4}:"bottom-right"===ye.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:kt?"#dc3545":"#28a745",color:"white"})},kt?"STALE":"LIVE"),L&&e.createElement("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Re.bottom+8,left:Re.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2}},e.createElement("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=st.current,n=rt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(q(t),1.5)},style:on},"+"),e.createElement("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=st.current,n=rt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(q(t),1/1.5)},style:on},"−")),_&&e.createElement("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Re.bottom+2,right:Re.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2}},_),e.createElement(Rt,{active:It.current>=0,hoverPoint:yt,margin:Re,size:Ie,shape:null===(g=Nt.current)||void 0===g?void 0:g.shape,width:null===(m=Nt.current)||void 0===m?void 0:m.w,height:null===(b=Nt.current)||void 0===b?void 0:b.h}),sn))});an.displayName="StreamGeoFrame";const sn={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 ln(e,t){return"function"==typeof t?t(e):e[t]}function cn(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function un(t={}){const{fields:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=ln(t,o);s=cn(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 a=ln(t,o);l.push({label:n,value:cn(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=cn(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=cn(t[e[0]],r))}}const c=Object.assign(Object.assign({},sn),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function dn(t){if(!0===t)return un();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:sn},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?un(t):un())}const pn={category10:G,tableau10:ee,set3:J,blues:K,reds:Q,greens:X,oranges:Y,purples:Z,viridis:U,plasma:V},hn=G,yn=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],fn=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 gn(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")||fn.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):hn[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+""))%hn.length]}function mn(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 A().domain(o).range(n).unknown("#999");const i=pn[n]||pn.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:hn;return A().domain(o).range(e).unknown("#999")}}function bn(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}const vn=t(null);function xn(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 kn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[wn,An]=ke(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=kn(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=kn(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}})}})),[jn,On]=ke(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 En(e){const t=d(),o=e.clientId||t,{name:r}=e,a=An(e=>e.selections.get(r)),s=An(e=>e.setClause),l=An(e=>e.clearClause),c=n(()=>!!a&&a.clauses.size>0,[a]);return{predicate:n(()=>a&&0!==a.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(xn(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(a,o):()=>!0,[a,o]),isActive:c,selectPoints:i(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:i(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:i(()=>{l(r,o)},[l,r,o]),clientId:o}}function Sn(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:a,clear:s}=En({name:t});return{onHover:i(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&&a(t)},[n,a,s,t]),predicate:o,isActive:r}}const Mn=t(!1);function Cn(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}function $n(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:.5;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 zn="#007bff";function Pn(e,t,r){const i=o(vn),a=function(){var e;const t=Ce(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}();return n(()=>{var n;if(!t)return;const o=null!==(n=null!=r?r:a&&a.length>0?a: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(i&&Object.keys(i).length>0){const e=mn(n.map(e=>({_cat:e})),"_cat",o);return t=>i[t]||e(t)}return mn(n.map(e=>({_cat:e})),"_cat",o)}if(i&&Object.keys(i).length>0){const n=mn(e,t,o);return e=>i[e]||n(e)}return mn(e,t,o)}if(i&&Object.keys(i).length>0){const e=mn([{_:"a"}],"_",o);return t=>i[t]||e(t)}},[e,t,r,i,a])}function Ln({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:r=!1,onObservation:a,chartType:c,chartId:u,onClick:p,hoverHighlight:h,colorByField:y}){const f=d(),g=Cn(t,o),m=En({name:(null==e?void 0:e.name)||"__unused__"}),b=Sn({name:(null==g?void 0:g.name)||"hover",fields:(null==g?void 0:g.fields)||o||[]}),v=On(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=s(null),A=y||o[0],j=n(()=>{if(!h||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,A]),O=i(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==g?void 0:g.mode)&&g.xField){const e=null==t?void 0:t[g.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=ot.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n})},it())}(g.name||"hover",Number(e),f)}"x-position"!==(null==g?void 0:g.mode)&&b.onHover(t)}else"x-position"===(null==g?void 0:g.mode)&&at(g.name||"hover",f),"x-position"!==(null==g?void 0:g.mode)&&b.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(a||v){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=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});a&&a(i),v&&v(i)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});a&&a(e),v&&v(e)}}},[t,b,g,f,a,c,u,v,h,A]),E=i(e=>{var t,n,o,r;if("x-position"===(null==g?void 0:g.mode)&&g.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[g.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=ot.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(ot.positions);return t.delete(e),ot={positions:t},it(),!1}ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n,locked:!0})},it()}(g.name||"hover",Number(n),f)}if(e&&p){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),p(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(a||v){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});a&&a(i),v&&v(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});a&&a(e),v&&v(e)}}},[p,a,v,c,u,g,f]);return l(()=>{if("x-position"!==(null==g?void 0:g.mode))return;const e=g.name||"hover";return()=>{st(e,f),at(e,f)}},[null==g?void 0:g.mode,null==g?void 0:g.name,f]),{activeSelectionHook:x,hoverSelectionHook:j,customHoverBehavior:O,customClickBehavior:E,crosshairSourceId:f}}function Bn({data:e,colorBy:t,colorScale:r,showLegend:i,legendPosition:a="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=o(Mn),d=void 0!==i?i:!u&&!!t,p=n(()=>{if(d&&t)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){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:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):yn[i%yn.length];return{label:r+"",color:s}}),label:""}]}}({data:e,colorBy:t,colorScale:r,getColor:gn,categories:c})},[d,t,e,r,c]),h=n(()=>{const e=Object.assign(Object.assign({},l),s);return p&&("right"===a&&110>e.right?e.right=110:"left"===a&&110>e.left?e.left=110:"top"===a&&50>e.top?e.top=50:"bottom"===a&&80>e.bottom&&(e.bottom=80)),e},[l,s,p,a]);return{legend:p,margin:h,legendPosition:a}}const In={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 Rn(e,t,n){var o,r,i,a,s,l,c;const u=In[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(r=t.height)&&void 0!==r?r:u.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Dn(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function Dn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Nn({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 Tn 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(Nn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Wn(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 a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function _n(e,t,n=3){let o,r=n+1;for(const n of t){const t=Wn(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Fn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Hn(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=_n(e,t,3))&&void 0!==n?n:null)}const qn={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"}},Gn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Vn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Un=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Zn=["vertical","horizontal"],Yn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},qn),Gn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Un},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({},qn),Gn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Un},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},qn),Gn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Un},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({},qn),Gn),{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({},qn),Gn),{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({},qn),Gn),{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({},qn),Gn),{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({},qn),Gn),{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({},qn),Gn),{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({},qn),Vn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Zn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qn),Vn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Zn},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},qn),Vn),{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:Zn},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qn),Vn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Zn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qn),Vn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Zn},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({},qn),Vn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Zn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qn),Vn),{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({},qn),Vn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Zn},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({},qn),Vn),{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({},qn),Vn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Zn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},qn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},qn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},qn),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},qn),Vn),{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({},qn),Vn),{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({},qn),{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({},qn),{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:Zn},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({},qn),{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({},qn),{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({},qn),{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({},qn),{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({},qn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},qn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},qn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},qn),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},qn),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},qn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},qn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function Xn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Qn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Kn=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Jn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),eo=new Set(["LineChart","AreaChart","StackedAreaChart"]),to=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function no(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 oo(e,t){const n=no(e),o=no(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const ro=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function io(e,t){const n=[],o=function(e,t){const n=[],o=Yn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Yn).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!Xn(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=_n(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 a=function({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=Fn(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=Hn(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}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=Fn(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=Hn(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 Yn[e]?(function(e,t,n){const o=Yn[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=Yn[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 a=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: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Qn.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){Kn.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=Yn[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 a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" 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(!Jn.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(!eo.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,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.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."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=Yn[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>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(!to.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=oo(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=oo(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 ro)"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 ao;const so="undefined"!=typeof process&&"production"!==(null===(ao=process.env)||void 0===ao?void 0:ao.NODE_ENV);function lo({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(Tn,{fallback:i=>{let a="";if(so&&r)try{const e=io(t,r);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(Nn,{componentName:t,message:i.message,diagnosticHint:a,width:n,height:o})}},i)}const co={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"},uo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function po(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({},co),{width:n,height:o})},r||"No data available"):null}function ho(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))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/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({},uo),{position:"absolute",top:s+o*(i+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function yo(e,t,n,o){if(!so)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 fo(e){const t=Ce(e=>e.theme.colors.selectionOpacity);return n(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function go(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(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(a,s)}l((o=o.apply(e,t||[])).next())})}function mo(e){return e}function bo(e,t){var n=t.id,o=t.bbox,r=null==t.properties?{}:t.properties,i=function(e,t){var n=function(e){if(null==e)return mo;var t,n,o=e.scale[0],r=e.scale[1],i=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var l=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+i,u[1]=(n+=e[1])*r+a;c>l;)u[l]=e[l],++l;return u}}(e.transform),o=e.arcs;function r(e,t){t.length&&t.pop();for(var r=o[0>e?~e:e],i=0,a=r.length;a>i;++i)t.push(n(r[i],i));0>e&&function(e,t){for(var n,o=e.length,r=o-t;r<--o;)n=e[r],e[r++]=e[o],e[o]=n}(t,a)}function i(e){return n(e)}function a(e){for(var t=[],n=0,o=e.length;o>n;++n)r(e[n],t);return 2>t.length&&t.push(t[0]),t}function s(e){for(var t=a(e);4>t.length;)t.push(t[0]);return t}function l(e){return e.map(s)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=i(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(i);break;case"LineString":n=a(t.arcs);break;case"MultiLineString":n=t.arcs.map(a);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:r,geometry:i}:null==o?{type:"Feature",id:n,properties:r,geometry:i}:{type:"Feature",id:n,bbox:o,properties:r,geometry:i}}"function"==typeof SuppressedError&&SuppressedError;const vo=new Map;function xo(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function ko(e){return go(this,void 0,void 0,function*(){const t=vo.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return go(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:xo(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:xo(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:xo(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:xo(yield import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}})}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const r=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return bo(e,t)})}:bo(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return vo.set(e,i),i})}function wo(e){const t=n(()=>Array.isArray(e)?e:void 0,[e]),[o,r]=s(null);return l(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return r(null),ko(e).then(e=>{t||r(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),r(null)}else r(null)},[e]),void 0!==t?t:o}const Ao={blues:K,reds:Q,greens:X,viridis:U};function jo(t){const o=Rn(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{areas:r,valueAccessor:i,colorScheme:a="blues",projection:s="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:p,dragRotate:h,tileURL:y,tileAttribution:f,tileCacheSize:g,tooltip:m,areaOpacity:b=1,annotations:v,margin:x,className:k,selection:w,linkedHover:A,onObservation:O,onClick:E,chartId:M,loading:C,emptyContent:$,frameProps:z={}}=t,P=null!=u?u:!!y,L=wo(r),B=n(()=>"function"==typeof i?i:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[i])&&void 0!==n?n:null==e?void 0:e[i]},[i]),I=n(()=>{if(!L)return j(K).domain([0,1]);const e=L.map(e=>B(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=S(e);return j(Ao[a]||K).domain([null!=t?t:0,null!=n?n:1])},[L,B,a]),{activeSelectionHook:R,customHoverBehavior:D,customClickBehavior:N}=Ln({selection:w,linkedHover:A,onObservation:O,onClick:E,chartType:"ChoroplethMap",chartId:M}),T=fo(w),W=n(()=>{const e=e=>{const t=B(e);return{fill:null!=t&&isFinite(t)?I(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:b}};return R?$n(e,R,T):e},[B,I,R,T,b]),_=n(()=>t=>{var n,o;const r=(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.name)||(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||"Feature",i=B(t);return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},r),null!=i&&e.createElement("div",{style:{opacity:.7}},"number"==typeof(a=i)&&isFinite(a)?Number.isInteger(a)?a.toLocaleString():a.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=a?a:"")+""));var a},[B]),F=n(()=>Object.assign({top:10,right:10,bottom:10,left:10},x),[x]),H=ho(C,o.width,o.height)||(L?null:ho(!0,o.width,o.height)),q=H?null:po(L,o.width,o.height,$);if(Array.isArray(L)&&L.length>0){const t=L[0];if(!t||"object"!=typeof t||!t.geometry)return e.createElement(Nn,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:o.width,height:o.height})}const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:s,areas:L,areaStyle:W,size:[o.width,o.height],margin:F,enableHover:!0,tooltipContent:!1===m?()=>null:!0===m?_:dn(m)||_},null!=l&&{graticule:l}),null!=c&&{fitPadding:c}),P&&{zoomable:!0}),d&&{zoomExtent:d}),p&&{onZoom:p}),null!=h&&{dragRotate:h}),y&&{tileURL:y}),f&&{tileAttribution:f}),g&&{tileCacheSize:g}),(A||O||E)&&{customHoverBehavior:D}),(O||E)&&{customClickBehavior:N}),v&&v.length>0&&{annotations:v}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),k&&{className:k}),null!=t.animate&&{animate:t.animate}),z);return H||q||e.createElement(lo,{componentName:"ChoroplethMap",width:o.width,height:o.height},e.createElement(an,Object.assign({},G)))}jo.displayName="ChoroplethMap";const Oo=c(function(t,o){const a=r(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,r;const i=null!==(o=null===(n=a.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of i)null===(r=a.current)||void 0===r||r.push(t(e));return i},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 l=Rn(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{points:c,xAccessor:d="lon",yAccessor:p="lat",sizeBy:h,sizeRange:y=[3,30],colorBy:f,colorScheme:g,projection:m="equalEarth",graticule:b,fitPadding:v,zoomable:x,zoomExtent:k,onZoom:w,dragRotate:A,tileURL:j,tileAttribution:O,tileCacheSize:E,areas:S,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:C,annotations:$,margin:z,className:P,selection:L,linkedHover:B,onObservation:I,onClick:R,chartId:D,loading:N,emptyContent:T,legendInteraction:W,legendPosition:_,frameProps:F={}}=t,H=null!=x?x:!!j,q=wo(S),G=c||[],{activeSelectionHook:V,customHoverBehavior:U,customClickBehavior:Z}=Ln({selection:L,linkedHover:B,fallbackFields:f?["string"==typeof f?f:""]:[],onObservation:I,onClick:R,chartType:"ProportionalSymbolMap",chartId:D}),Y=fo(L),X=Pn(G,f,g),Q=n(()=>{if(!h)return;const e="function"==typeof h?h:e=>null==e?void 0:e[h],t=G.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[G,h]),K=n(()=>{const e=e=>({fill:f?gn(e,f,X):zn,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:h?bn(e,h,y,Q):6});return V?$n(e,V,Y):e},[f,X,h,y,Q,V,Y]),J=n(()=>{if(!f)return[];const e="function"==typeof f?f:e=>null==e?void 0:e[f],t=new Set;for(const n of G){if(!n)continue;const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[G,f]),ee=function(e,t,o){const[r,a]=s(null),[l,c]=s(new Set),u=i(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=i(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]),p=n(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"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,r,l]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:p}}(W,f,J),{legend:te,margin:ne,legendPosition:oe}=Bn({data:G,colorBy:f,colorScale:X,showLegend:l.showLegend,legendPosition:_,userMargin:z,defaults:{top:10,bottom:10,left:10,right:10}}),re=n(()=>t=>{const n=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t.NAME)||(null==t?void 0:t.id),o="string"==typeof h?h:null,r=("function"==typeof h?h:e=>e[h])(t),i=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",a="string"==typeof f?f:null,s=a?null==t?void 0:t[a]:null;return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},n&&e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n),o&&null!=r&&e.createElement("div",null,e.createElement("span",{style:{opacity:.7}},o,": "),i(r)),a&&null!=s&&e.createElement("div",null,e.createElement("span",{style:{opacity:.7}},a,": "),s+""),!n&&!o&&Object.entries(t).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,": "),i(n))))},[h,f]),ie=ho(N,l.width,l.height),ae=ie?null:po(c,l.width,l.height,T);yo("ProportionalSymbolMap",G,"xAccessor",d),yo("ProportionalSymbolMap",G,"yAccessor",p);const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:m},null!=c&&{points:G}),{xAccessor:d,yAccessor:p,pointStyle:K}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),q&&{areas:q,areaStyle:M}),null!=b&&{graticule:b}),null!=v&&{fitPadding:v}),H&&{zoomable:!0}),k&&{zoomExtent:k}),w&&{onZoom:w}),null!=A&&{dragRotate:A}),j&&{tileURL:j}),O&&{tileAttribution:O}),E&&{tileCacheSize:E}),{size:[l.width,l.height],margin:ne,enableHover:!0,tooltipContent:!1===C?()=>null:dn(C)||re}),te&&{legend:te,legendPosition:oe}),W&&"none"!==W&&{legendHoverBehavior:ee.onLegendHover,legendClickBehavior:ee.onLegendClick,legendHighlightedCategory:ee.highlightedCategory,legendIsolatedCategories:ee.isolatedCategories}),(B||I||R)&&{customHoverBehavior:U}),(I||R)&&{customClickBehavior:Z}),$&&$.length>0&&{annotations:$}),l.title&&{title:l.title}),l.description&&{description:l.description}),l.summary&&{summary:l.summary}),void 0!==l.accessibleTable&&{accessibleTable:l.accessibleTable}),P&&{className:P}),null!=t.animate&&{animate:t.animate}),F);return ie||ae||e.createElement(lo,{componentName:"ProportionalSymbolMap",width:l.width,height:l.height},e.createElement(an,Object.assign({ref:a},se)))});function Eo(t){const o=Rn(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{flows:r,nodes:a,nodeIdAccessor:s="id",xAccessor:l="lon",yAccessor:c="lat",valueAccessor:u="value",projection:d="equalEarth",graticule:p,fitPadding:h,zoomable:y,zoomExtent:f,onZoom:g,dragRotate:m,tileURL:b,tileAttribution:v,tileCacheSize:x,lineType:k="geo",flowStyle:A="basic",areas:j,areaStyle:O={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:E,edgeOpacity:S=.6,edgeWidthRange:M=[1,8],edgeLinecap:C="round",colorScheme:$,showParticles:z,particleStyle:P,tooltip:L,annotations:B,margin:I,className:R,selection:D,linkedHover:N,onObservation:T,onClick:W,chartId:_,loading:F,emptyContent:H,frameProps:q={}}=t,G=null!=y?y:!!b,V=wo(j),U=Cn(N),Z=En({name:(null==D?void 0:D.name)||"__unused__"}),Y=Sn({name:(null==U?void 0:U.name)||"hover",fields:(null==U?void 0:U.fields)||[]}),X=On(e=>e.pushObservation),Q=D?{isActive:Z.isActive,predicate:Z.predicate}:null,K=r||[],J=a||[],ee=Pn(K,E,$),te=n(()=>{const e=new Map;for(const t of J)e.set(t[s]+"",t);return e},[J,s]),ne=n(()=>{const e=new Map;for(const t of K)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[K]),oe=i(e=>{var t,n;if(N)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=ne.get(t[s]+"");e&&Y.onHover(e)}else Y.onHover(t)}else Y.onHover(null);if(T||X){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:_};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},o),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});T&&T(i),X&&X(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});T&&T(e),X&&X(e)}}},[N,Y,s,ne,T,_,X]),re=i(e=>{var t,n,o,r;if(e&&W){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),W(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(e&&(T||X)){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n={timestamp:Date.now(),chartType:"FlowMap",chartId:_,type:"click",datum:t||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0};T&&T(n),X&&X(n)}},[W,T,X,_]),ie=n(()=>{const e="function"==typeof l?l:e=>e[l],t="function"==typeof c?c:e=>e[c];return K.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=te.get(n.source+""),r=te.get(n.target+"");return o&&r?Object.assign(Object.assign({},n),{coordinates:[{[l]:e(o),[c]:t(o)},{[l]:e(r),[c]:t(r)}]}):null}).filter(Boolean)},[K,te,l,c]),ae=n(()=>{const e=K.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[u])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>M[0]:w().domain([Math.min(...e),Math.max(...e)]).range(M)},[K,u,M]),se=n(()=>e=>{var t;return{stroke:E?gn(e,E,ee):zn,strokeWidth:ae(null!==(t=e[u])&&void 0!==t?t:0),strokeLinecap:C,opacity:S}},[E,ee,ae,u,S,C]),le=fo(D),ce=n(()=>{if(!Q)return se;const e=Object.assign(Object.assign({},(null==le?void 0:le.unselectedStyle)||{}),{fillOpacity:0});return $n(se,Q,Object.assign(Object.assign({},le||{}),{unselectedStyle:e}))},[se,Q,le]),ue=n(()=>()=>({fill:"#333",r:5,fillOpacity:.8}),[]),de=n(()=>t=>{var n,o,r,i,a,l,c;if((null==t?void 0:t.geometry)||(null==t?void 0:t.properties)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.geometry)){const n=(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.name)||(null===(r=null==t?void 0:t.properties)||void 0===r?void 0:r.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||(null===(a=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.properties)||void 0===a?void 0:a.name)||(null===(c=null===(l=null==t?void 0:t.data)||void 0===l?void 0:l.properties)||void 0===c?void 0:c.NAME);if(n)return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},n))}if(null!=(null==t?void 0:t.source)&&null!=(null==t?void 0:t.target)){const n=t[u];return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},t.source," → ",t.target),null!=n&&e.createElement("div",{style:{opacity:.7}},"number"==typeof n?n.toLocaleString():n))}const d=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t[s]);return null!=d?e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},d)):null},[u,s]),pe=n(()=>Object.assign({top:10,right:10,bottom:10,left:10},I),[I]),he=ho(F,o.width,o.height),ye=he?null:po(r,o.width,o.height,H),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:d,lines:ie,points:J,xAccessor:l,yAccessor:c,lineDataAccessor:"coordinates",lineType:k,flowStyle:A,lineStyle:ce,pointStyle:ue},V&&{areas:V,areaStyle:O}),null!=p&&{graticule:p}),null!=h&&{fitPadding:h}),G&&{zoomable:!0}),f&&{zoomExtent:f}),g&&{onZoom:g}),null!=m&&{dragRotate:m}),z&&{showParticles:z}),P&&{particleStyle:P}),b&&{tileURL:b}),v&&{tileAttribution:v}),x&&{tileCacheSize:x}),{size:[o.width,o.height],margin:pe,enableHover:!0,tooltipContent:!1===L?()=>null:dn(L)||de}),(N||T||W)&&{customHoverBehavior:oe}),(T||W)&&{customClickBehavior:re}),B&&B.length>0&&{annotations:B}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),R&&{className:R}),null!=t.animate&&{animate:t.animate}),q);return he||ye||e.createElement(lo,{componentName:"FlowMap",width:o.width,height:o.height},e.createElement(an,Object.assign({},fe)))}Oo.displayName="ProportionalSymbolMap",Eo.displayName="FlowMap";const So=c(function(t,o){const a=Rn(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{points:c,lines:d,xAccessor:p="lon",yAccessor:h="lat",nodeIdAccessor:y="id",center:f,costAccessor:g,strength:m=1,lineMode:b="straight",projection:v="mercator",graticule:x,fitPadding:k,zoomable:w,zoomExtent:A,onZoom:j,dragRotate:O,tileURL:E,tileAttribution:S,tileCacheSize:M,transition:C,colorBy:$,colorScheme:z,pointRadius:P=5,tooltip:L,showRings:B=!0,ringStyle:I,showNorth:R=!0,costLabel:D,annotations:N,margin:T,className:W,selection:_,linkedHover:F,onObservation:H,onClick:q,chartId:G,loading:V,emptyContent:U,legendPosition:Z,frameProps:Y={}}=t,X=null!=w?w:!!E,Q=c||[],{activeSelectionHook:K,customHoverBehavior:J,customClickBehavior:ee}=Ln({selection:_,linkedHover:F,fallbackFields:$?["string"==typeof $?$:""]:[],onObservation:H,onClick:q,chartType:"DistanceCartogram",chartId:G}),te=fo(_),ne=Pn(Q,$,z),oe=n(()=>{const e=e=>({fill:$?gn(e,$,ne):zn,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:P});return K?$n(e,K,te):e},[$,ne,P,K,te]),{legend:re,margin:ie,legendPosition:ae}=Bn({data:Q,colorBy:$,colorScale:ne,showLegend:a.showLegend,legendPosition:Z,userMargin:T,defaults:{top:10,bottom:10,left:10,right:10}}),se=n(()=>({center:f,centerAccessor:y,costAccessor:g,strength:m,lineMode:b}),[f,y,g,m,b]),le=n(()=>{if(!d)return;const e="function"==typeof p?p:e=>e[p],t="function"==typeof h?h:e=>e[h],n=new Map;for(const e of Q)n.set(e[y]+"",e);return d.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),i=n.get(o.target+"");return r&&i?Object.assign(Object.assign({},o),{coordinates:[{[p]:e(r),[h]:t(r)},{[p]:e(i),[h]:t(i)}]}):null}).filter(Boolean)},[d,Q,p,h,y]),ce=n(()=>t=>{const n=("function"==typeof g?g:e=>e[g])(t);return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},t[y]||t.name||t.id||"Point"),null!=n&&e.createElement("div",{style:{opacity:.7}},"Cost: ","number"==typeof n?n.toFixed(1):n))},[g,y]),ue=r(null);u(o,()=>({push:e=>{var t;return null===(t=ue.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ue.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ue.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,r;const i=null!==(o=null===(n=ue.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of i)null===(r=ue.current)||void 0===r||r.push(t(e));return i},clear:()=>{var e;return null===(e=ue.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ue.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[de,pe]=s(null),he=i(()=>{var e,t;const n=null===(t=null===(e=ue.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&pe(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);l(()=>{const e=requestAnimationFrame(he);return()=>cancelAnimationFrame(e)},[he,m,f,a.width,a.height,Q]);const ye=n(()=>{if(!B||!de)return[];const{maxCost:e}=de;if(0>=e)return[];if(Array.isArray(B))return B.filter(t=>t>0&&e>=t);const t="number"==typeof B?B:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[B,de]),fe=n(()=>{var t,n;if(!de)return Y.foregroundGraphics||null;const{cx:o,cy:r,maxCost:i,availableRadius:a}=de,s=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},I),l=null!==(t=ie.left)&&void 0!==t?t:10,c=null!==(n=ie.top)&&void 0!==n?n:10;return e.createElement("g",null,ye.map(t=>{const n=t/i*a;return e.createElement("g",{key:t},e.createElement("circle",{cx:o+l,cy:r+c,r:n,fill:"none",stroke:s.stroke,strokeWidth:s.strokeWidth,strokeDasharray:s.strokeDasharray,opacity:.5}),e.createElement("text",{x:o+l+n+3,y:r+c-2,fontSize:s.labelSize,fill:s.labelColor,fontFamily:"system-ui, sans-serif"},t,D?" "+D:""))}),R&&e.createElement("g",{transform:`translate(${l+24}, ${c+24})`},e.createElement("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e.createElement("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e.createElement("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif"},"N"),e.createElement("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.createElement("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.createElement("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})),Y.foregroundGraphics)},[de,ye,R,D,I,ie,Y.foregroundGraphics]),ge=ho(V,a.width,a.height),me=ge?null:po(c,a.width,a.height,U);yo("DistanceCartogram",Q,"xAccessor",p),yo("DistanceCartogram",Q,"yAccessor",h);const be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:v},null!=c&&{points:Q}),le&&{lines:le,lineDataAccessor:"coordinates"}),{xAccessor:p,yAccessor:h,pointIdAccessor:y,pointStyle:oe,projectionTransform:se}),C&&{transition:{duration:C}}),null!=x&&{graticule:x}),null!=k&&{fitPadding:k}),X&&{zoomable:!0}),A&&{zoomExtent:A}),j&&{onZoom:j}),null!=O&&{dragRotate:O}),E&&{tileURL:E}),S&&{tileAttribution:S}),M&&{tileCacheSize:M}),{size:[a.width,a.height],margin:ie,enableHover:!0,tooltipContent:!1===L?()=>null:dn(L)||ce}),re&&{legend:re,legendPosition:ae}),(F||H||q)&&{customHoverBehavior:J}),(H||q)&&{customClickBehavior:ee}),N&&N.length>0&&{annotations:N}),a.title&&{title:a.title}),a.description&&{description:a.description}),a.summary&&{summary:a.summary}),void 0!==a.accessibleTable&&{accessibleTable:a.accessibleTable}),W&&{className:W}),null!=t.animate&&{animate:t.animate}),Y),fe&&{foregroundGraphics:fe});return ge||me||e.createElement(lo,{componentName:"DistanceCartogram",width:a.width,height:a.height},e.createElement(an,Object.assign({ref:ue},be)))});function Mo(e,t,n){const{featureKey:o,dataKey:r}=n,i=new Map;for(const e of t)i.set(e[r]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=null==n?void 0:n[e];return(null!=n?n:"")+""})(e),n=i.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})}So.displayName="DistanceCartogram";export{jo as ChoroplethMap,So as DistanceCartogram,Eo as FlowMap,Oo as ProportionalSymbolMap,an as StreamGeoFrame,Mo as mergeData,ko as resolveReferenceGeography};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{createContext as r,useMemo as i,useContext as s,useRef as a,useCallback as l,useSyncExternalStore as c,useState as u,useEffect as d,forwardRef as h,useImperativeHandle as p,useId as f}from"react";import{geoPath as g,geoGraticule as y,geoDistance as m,geoInterpolate as b,geoEqualEarth as v,geoEquirectangular as x,geoNaturalEarth1 as w,geoOrthographic as A,geoAlbersUsa as k,geoMercator as j}from"d3-geo";import{scaleLinear as O,scaleOrdinal as S,scaleSequential as M}from"d3-scale";import{quadtree as C}from"d3-quadtree";import{bin as $,extent as z}from"d3-array";import{packEnclose as P}from"d3-hierarchy";import{area as L,curveCatmullRom as B,curveCardinal as I,curveBasis as R,curveStepBefore as D,curveStepAfter as N,curveStep as E,curveMonotoneY as T,curveMonotoneX as W,curveLinear as _,line as F,curveNatural as H}from"d3-shape";import q from"regression";import{zoomIdentity as G,zoom as V}from"d3-zoom";import{select as U}from"d3-selection";import{schemeCategory10 as Z,interpolatePlasma as Y,interpolateViridis as X,interpolatePurples as Q,interpolateOranges as K,interpolateGreens as J,interpolateReds as ee,interpolateBlues as te,schemeSet3 as ne,schemeTableau10 as oe,interpolateTurbo as re,interpolateCividis as ie,interpolateMagma as se,interpolateInferno as ae,interpolateGreys as le}from"d3-scale-chromatic";class ce{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function ue(e,t,n){return e+(t-e)*n}function de(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}}const he={mercator:j,equalEarth:v,albersUsa:k,orthographic:A,naturalEarth:w,equirectangular:x};function pe(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function fe(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function ge(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function ye(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let r=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>r.length||o.push(r),r=[i]):r.push(i)}return 2>r.length||o.push(r),o}function me(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const s=-r/i,a=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+s*l,u=(e[1]+t[1])/2+a*l,d=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;d.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return d}function be(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,s;0===t?(i=e[1][0]-r[0],s=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],s=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const a=Math.sqrt(i*i+s*s)||1;o.push([r[0]+s/a*n,r[1]+-i/a*n])}return o}function ve(e,t,n,o,r){const i=t[0]-e[0],s=t[1]-e[1],a=Math.sqrt(i*i+s*s);if(0===a)return[e,t];const l=s/a,c=-i/a,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}class xe{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e}initStreaming(e=500){this.pointBuffer=new ce(e),this.timestampBuffer=new ce(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return v();if("string"==typeof e){const t=he[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),v())}if("object"==typeof e&&"type"in e){const t=he[e.type],n=t?t():v();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=g(this.projection),this.fitProjection(e),this.geoPath=g(this.projection);const n=this.projection;this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null};const o=this.scene;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&o.length>0&&this.startTransition(o),this.version++}fitProjection(e){var t,n,o,r,i;const s=this.projection,a=this.config,l=[...this.areas],c=pe(a.xAccessor,"lon"),u=pe(a.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=fe(a.lineDataAccessor);for(const e of this.lineData){const t=h(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==l.length){if(a.projectionExtent){const[[t,n],[o,r]]=a.projectionExtent;s.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,r],[t,r],[t,n]]]}})}else if(s.clipAngle&&(null!==(t=s.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=a.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);s.scale(o/2-o*t),s.translate([e.width/2,e.height/2])}else{const t=null!==(o=a.fitPadding)&&void 0!==o?o:0,n=e.width*t,r=e.height*t;s.fitExtent([[n,r],[e.width-n,e.height-r]],{type:"FeatureCollection",features:l})}this.baseScale=s.scale(),this.baseTranslate=s.translate(),this.baseRotation=null!==(i=null===(r=s.rotate)||void 0===r?void 0:r.call(s))&&void 0!==i?i:[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=g(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=g(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;n&&n.rotate&&(n.rotate(e),this.geoPath=g(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,xe.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._quadtree=C().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,n,o;const r=[],{config:i}=this,s=this.projection,a=this.geoPath,l=pe(i.xAccessor,"lon"),c=pe(i.yAccessor,"lat"),u=function(e){var t,n;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.surface)||"#e0e0e0",stroke:(null===(n=e.themeSemantic)||void 0===n?void 0:n.border)||"#999",strokeWidth:.5,fillOpacity:1}}(i),d=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(i),h=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(i);if(i.graticule){const t=!0===i.graticule?{}:i.graticule,n=y();t.step&&n.step(t.step);const o=a(n())||"";o&&r.push({type:"geoarea",pathData:o,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=a(e);if(!t)continue;const n=a.centroid(e),o=a.bounds(e),s=a.area(e),l=ge(i.areaStyle,e,u);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:s,style:l,datum:e,interactive:!0})}const p=fe(i.lineDataAccessor);for(const t of this.lineData){const n=p(t);if(!n||2>n.length)continue;let o=[];if("geo"===i.lineType){const e=Array(n.length);for(let t=0;n.length>t;t++)e[t]=[l(n[t]),c(n[t])];for(let t=0;e.length-1>t;t++){const n=e[t],r=e[t+1],i=m(n,r)||0,a=Math.max(2,Math.ceil(i/(Math.PI/180))),l=b(n,r);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const n=s(l(e/a));null!=n&&o.push(n)}}}else for(let e=0;n.length>e;e++){const t=n[e],r=s([l(t),c(t)]);null!=r&&o.push(r)}if(2>o.length)continue;const a=ge(i.lineStyle,t,d),u="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==n.length||2>o.length||"arc"!==i.flowStyle?2!==n.length||2>o.length||"offset"!==i.flowStyle||(o="geo"===i.lineType?be(o,u):ve(o[0],o[o.length-1],0,0,u)):o=me(o[0],o[o.length-1]);const h=ye(o,e.width);if(h.length>1)for(const e of h){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},a),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>o.length&&h[0]||o,style:a,datum:t})}const f=this.getPoints(),g=i.pointIdAccessor?"function"==typeof i.pointIdAccessor?i.pointIdAccessor:e=>e[i.pointIdAccessor]:null,v=s.clipAngle&&null!==(t=s.clipAngle())&&void 0!==t?t:0,x=v>0?v*Math.PI/180:null,w=s.rotate?s.rotate():[0,0,0],A="function"==typeof s.center?s.center():[0,0],k=[(null!==(n=A[0])&&void 0!==n?n:0)-w[0],(null!==(o=A[1])&&void 0!==o?o:0)-w[1]];for(let e=0;f.length>e;e++){const t=f[e],n=l(t),o=c(t);if(null!=x&&m([n,o],k)>x)continue;const a=s([n,o]);if(!a)continue;const u=i.pointStyle?i.pointStyle(t):Object.assign({},h),d={type:"point",x:a[0],y:a[1],r:u.r||4,style:u,datum:t,pointId:g?g(t)+"":void 0};r.push(d)}return r}applyCartogramTransform(e,t){var n,o,r;const i=this.scene.filter(e=>"point"===e.type);if(2>i.length)return;const s=null!==(n=e.strength)&&void 0!==n?n:1;if(0===s)return;const a=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,l="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=i.find(t=>a(t.datum)+""==e.center+"");if(!c)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const u=c.x,d=c.y,h=i.map(e=>l(e.datum)).filter(e=>isFinite(e)&&e>=0),p=Math.max(...h,1),f=Math.min(t.width,t.height)/2,g=O().domain([0,p]).range([0,f]);this.cartogramLayout={cx:u,cy:d,maxCost:p,availableRadius:f},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of i){if(e===c)continue;const t=Math.atan2(e.y-d,e.x-u),n=Math.sqrt(Math.pow(e.x-u,2)+Math.pow(e.y-d,2)),o=l(e.datum),r=n+((isFinite(o)?g(o):n)-n)*s;e.x=u+Math.cos(t)*r,e.y=d+Math.sin(t)*r}const y=t.width/2,m=t.height/2,b=y-c.x,v=m-c.y;if(Math.abs(b)>.5||Math.abs(v)>.5)for(const e of i)e.x+=b,e.y+=v;this.cartogramLayout={cx:y,cy:m,maxCost:p,availableRadius:f};const x=this.scene.filter(e=>"line"===e.type);if(x.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of i)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of x){const n=null===(o=t.datum)||void 0===o?void 0:o.source,i=null===(r=t.datum)||void 0===r?void 0:r.target;if(n&&i){const o=e.get(n+""),r=e.get(i+"");o&&r&&(t.path=[o,r])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const r=de(e,o,t);n[o]._decayOpacity=r,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:r})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),s=this.timestampBuffer.toArray();for(let e=0;i.length>e&&s.length>e;e++){const a=r-s[e];o>a&&(i[e]._pulseIntensity=1-a/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let s=!1;for(const e of i)if(e.pointId){const t=r.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(s=!0))}s&&(this.activeTransition={startTime:performance.now(),duration:o})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=ue(e.x,e._targetX,n),e.y=ue(t,e._targetY,n)}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0);return this.activeTransition=null,!1}return!0}}function we(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Ae(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function ke(e,t){const n=Ae(e);if(!n)return!1;const o=Ae(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function je(e,t,n,o,r,i,s=0){if(i){const e=function(e,t,n,o,r){const i=Math.max(o,r+5,12),s=t-i,a=t+i,l=n-i,c=n+i;let u=null,d=1/0;return e.visit((e,r,i,h,p)=>{if(r>a||s>h||i>c||l>p)return!0;if(!e.length){let r=e;do{const e=r.data,i=e.x-t,s=e.y-n,a=Math.sqrt(i*i+s*s);we(e.r,o)>=a&&d>a&&(u=e,d=a),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,s);if(e)return e}else{let r=null,i=o;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,a=s.y-n,l=Math.sqrt(e*e+a*a);we(s.r,o)>=l&&i>l&&(r=s,i=l)}if(r)return{node:r,distance:i}}for(let o=e.length-1;o>=0;o--){const i=e[o];if("geoarea"!==i.type)continue;const s=i;if(!1===s.interactive)continue;const[[a,l],[c,u]]=s.bounds;if(!(a>t||t>c||l>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),r.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let a=null,l=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:r}=e,i=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;r.length-1>o;o++){const[s,c]=r[o],[u,d]=r[o+1],h=Oe(t,n,s,c,u,d);i>=h&&l>h&&(a=e,l=h)}}return a?{node:a,distance:l}:null}function Oe(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 Se(t){const n=r(null),o=Me(t);return[function({children:o}){const r=i(()=>Me(t),[]);return e(n.Provider,{value:r,children:o})},e=>{var t;const r=null!==(t=s(n))&&void 0!==t?t:o,i=a(e);i.current=e;const u=l(()=>i.current(r.getState()),[r]),d=l(()=>i.current(r.getState()),[r]);return c(r.subscribe,u,d)}]}function Me(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function Ce(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function $e(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:ze})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}xe.QUADTREE_THRESHOLD=500;const ze=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Pe={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Le={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Be={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ze,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[Ie,Re]=Se(e=>({theme:Pe,setTheme(t){e(e=>{if("light"===t)return{theme:Pe};if("dark"===t)return{theme:Le};if("high-contrast"===t)return{theme:Be};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Le:Pe;return{theme:$e(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:$e(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const De=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ne=new WeakMap;let Ee=0,Te=!1,We=null,_e=null,Fe=null;function He(e,t){var n,o;if(!t)return t;const r=De.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(Te)return;if("undefined"==typeof window||"undefined"==typeof document)return;Te=!0;const e=()=>{Ee++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(We=new MutationObserver(e),We.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{_e=window.matchMedia("(prefers-color-scheme: dark)"),Fe=e,"function"==typeof _e.addEventListener?_e.addEventListener("change",Fe):"function"==typeof _e.addListener&&_e.addListener(Fe)}catch(e){}}();let s=Ne.get(i);s&&s.version===Ee||(s={version:Ee,map:new Map},Ne.set(i,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function qe(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ge(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return d(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=a(t);n.current=t;const[r,s]=function(e,t,n){const o=a(null),[r,i]=u(null);return d(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),c=i(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=s[0]-c.left-c.right,p=s[1]-c.top-c.bottom,f=qe(e.foregroundGraphics,s,c),g=qe(e.backgroundGraphics,s,c),y=Re(e=>e.theme),{transition:m,introEnabled:b}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(r||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),v="semiotic-table-"+o.useId(),x=a(0),w=a(()=>{}),A=l(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);d(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const k=a(()=>{}),j=a(()=>{}),O=a(null),S=a(0),M=l(()=>{S.current=0;const e=O.current;O.current=null,e&&k.current(e)},[]),C=l(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===S.current&&(S.current=requestAnimationFrame(M))},[M]),$=l(()=>{O.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0),j.current()},[]);d(()=>()=>{O.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0)},[]);const z=e.themeDirtyRef;return d(()=>{z&&(Ee++,z.current=!0,A())},[y,A,z]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:s,margin:c,adjustedWidth:h,adjustedHeight:p,resolvedForeground:f,resolvedBackground:g,currentTheme:y,transition:m,introEnabled:b,tableId:v,rafRef:x,renderFnRef:w,scheduleRender:A,hoverHandlerRef:k,hoverLeaveRef:j,onPointerMove:C,onPointerLeave:$}}const Ve={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function Ue(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,Ve[n])(o(e,t)),r}function Ze(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ye(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Xe=(n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:p,items:f}=n,g=[];let y=0;const m=!(!o&&!r),b="isolate"===d||void 0===d&&null!=s;return f.forEach((n,d)=>{const v=Ue(n,d,h,p),x=Ye(n,i,s),w=s&&s.size>0&&s.has(n.label);g.push(t("g",{transform:`translate(0,${y})`,onClick:o?()=>o(n):void 0,onMouseEnter:r?()=>r(n):void 0,onMouseLeave:r?()=>r(null):void 0,tabIndex:m?c===a&&d===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&b?w||!1:void 0,"aria-current":m&&!b&&null!=i&&n.label===i||void 0,"aria-label":n.label,onKeyDown:m?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+f.length)%f.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{u(c,d),r&&r(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{r&&r(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,w&&e(Ze,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),y+=22}),g};function Qe({config:n,orientation:r="vertical",width:i=100}){const{colorFn:s,domain:a,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===r){const n=12,o=Math.min(i,200),r=Math.max(0,(i-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:r+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:r,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:r,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),e("text",{x:r+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])})]})}function Ke(n){const{legendGroups:r,customClickBehavior:i,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:p="vertical"}=n,[f,g]=o.useState(0),[y,m]=o.useState(0),b=o.useCallback((e,t)=>{g(e),m(t)},[]),v="vertical"===p?(({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,p)=>{d+=5,h.push(e("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+p)),d+=8,t.label&&(d+=16,h.push(e("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+p)),d+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${d})`,children:Xe(t,o,r,i,s,a,l,p,c,u)},"legend-group-"+p)),d+=22*t.items.length+8}),h})({legendGroups:r||[],width:d,customClickBehavior:i,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:c}):(({legendGroups:n,height:o,width:r,customClickBehavior:i,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let p=0;const f=[];n.forEach((n,o)=>{let g=0;n.label&&(g+=16);const y=((n,o,r,i,s,a,l,c,u,d,h)=>{const{type:p="fill",styleFn:f,items:g}=n,y=[];let m=0,b=0;const v=!(!o&&!r),x="isolate"===d||void 0===d&&null!=s;g.forEach((n,d)=>{const w=Ue(n,d,p,f),A=Ye(n,i,s),k=s&&s.size>0&&s.has(n.label),j=26+7*n.label.length;h&&h>0&&m>0&&m+j>h&&(b++,m=0),y.push(t("g",{transform:`translate(${m},${22*b})`,onClick:o?()=>o(n):void 0,onMouseEnter:r?()=>r(n):void 0,onMouseLeave:r?()=>r(null):void 0,tabIndex:v?c===a&&d===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&x?k||!1:void 0,"aria-current":v&&!x&&null!=i&&n.label===i||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+g.length)%g.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),r&&r(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{r&&r(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,k&&e(Ze,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=j});let w=0,A=0;for(const e of g){const t=26+7*e.label.length;h&&h>0&&A>0&&A+t>h?(w=Math.max(w,A),A=t):A+=t}w=Math.max(w,A);const k=b+1;return{items:y,offset:w,totalRows:k,totalHeight:22*k}})(n,i,s,a,l,c,u,o,d,h,r);g+=y.offset+5,f.push(Object.assign(Object.assign({label:n.label},y),{offset:g,totalRows:y.totalRows,totalHeight:y.totalHeight})),p+=g+12});let g=p>r?0:Math.max(0,(r-p)/2);const y=[];return f.forEach((t,r)=>{const i=n[r];i.label&&(y.push(e("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:i.label},"legend-text-"+r)),g+=16),y.push(e("g",{className:"legend-item",transform:`translate(${g},0)`,children:t.items},"legend-group-"+r)),g+=t.offset+5,n[r+1]&&y.push(e("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+r)),g+=12}),e("g",{children:y})})({legendGroups:r||[],title:u,height:h,width:d,customClickBehavior:i,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:c}),x=!(!i&&!s);return t("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===p&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),v]})}function Je(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function et(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 p="top"===s||"bottom"===s;let f,g;return"left"===s?(f=4,g=i.top):"top"===s?(f=0,g=a?32:8):"bottom"===s?(f=0,g=r-i.bottom+50):(f=o-i.right+10,g=i.top),e("g",{transform:`translate(${f}, ${g})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e(Qe,{config:n.gradient,orientation:p?"horizontal":"vertical",width:p?o:100}):Je(n)?e(Ke,{legendGroups:n.legendGroups,title:"",width:p?o:100,orientation:p?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function tt(e){return"string"==typeof e?{type:e}:e}function nt({orient:n,config:o,values:r,scale:s,size:a,length:l}){const c=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),u="top"===n||"bottom"===n,d=i(()=>{if(0===r.length)return null;const o=s.domain(),i=a-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],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(!o)return null;const{q1:a,median:l,q3:d,whiskerLow:h,whiskerHigh:p}=o,f=Math.min(.5*i,20),g=(i-f)/2+4;if(u){const o=s(a),r=s(d),i=s(l),u=s(h),y=s(p),m="top"===n?-1:1,b=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:b+m*(g+f/2),x2:y,y2:b+m*(g+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:b+m*g,x2:u,y2:b+m*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:b+m*g,x2:y,y2:b+m*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,r),y:"top"===n?b-g-f:b+g,width:Math.abs(r-o),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:i,y1:"top"===n?b-g-f:b+g,x2:i,y2:"top"===n?b-g:b+g+f,stroke:c.fill,strokeWidth:2})]})}{const o=s(a),r=s(d),i=s(l),u=s(h),y=s(p),m="left"===n?-1:1,b=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:b+m*(g+f/2),y1:u,x2:b+m*(g+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:b+m*g,y1:u,x2:b+m*(g+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:b+m*g,y1:y,x2:b+m*(g+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?b-g-f:b+g,y:Math.min(o,r),width:f,height:Math.abs(r-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?b-g-f:b+g,y1:i,x2:"left"===n?b-g:b+g+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=$().domain(o).thresholds(c.bins)(r);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/h*i;if(u){const i=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:i,y:"top"===n?-4-r:4,width:Math.max(a,.5),height:r,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const i=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:"left"===n?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=i/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*(i/2),a=s((e.x0+e.x1)/2);o.push(u?`${a},${"top"===n?-(t-r):t-r}`:`${"left"===n?-(t-r):t-r},${a}`)}for(let e=d.length-1;e>=0;e--){const r=d[e];if(null==r.x0||null==r.x1)continue;const a=r.length/h*(i/2),l=s((r.x0+r.x1)/2);o.push(u?`${l},${"top"===n?-(t+a):t+a}`:`${"left"===n?-(t+a):t+a},${l}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*i,r=s((e.x0+e.x1)/2);t.push(`L${r},${"top"===n?-o-4:o+4}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${r},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*i,r=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${r}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${e},${r}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[r,s,c,a,l,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function ot(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 rt(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 it(n,o,r,i){if(!n)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!a)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(r)?"leftRight":"topBottom");let p=c;p&&"dynamic"!==p||(p="topBottom"===h?0>o?"right":"left":0>r?"bottom":"top");let f="start";"topBottom"===h?"right"===p?f="end":"middle"===p&&(f="middle"):f=0>o?"end":"start";const g=16,y=a?d?[a]:ot(a,u):[],m=s?d?[s]:ot(s,u):[],b="leftRight"===h?"end"===f?-4:4:0;let v=0;const x=[],w=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:w,textAnchor:f,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:b,dy:0===n?0:g,children:t},n))},"annotation-note-title")),v=y.length*g),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:w,textAnchor:f,y:v,children:m.map((t,n)=>e("tspan",{x:b,dy:0===n?0:g,children:t},n))},"annotation-note-label"));let A=null;if((a||s)&&(0!==o||0!==r))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),A=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*g+(m.length>0?g:0);let n=0,o=t;"bottom"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),A=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+m.length-1)*g;let j=0;return"topBottom"===h?j=0>r?-(k+2):18:"leftRight"===h&&(j="middle"===p?-(k+g+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===p||0>r?-(k+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${r})`,children:[e("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:x}),A]})}function st(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("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e("rect",{width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e("line",{x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e("line",{x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e("path",{d:rt((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:a})}function at(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("line",{x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e("path",{d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e("g",{className:"annotation-connector",children:a})}function lt(e){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:p,disable:f,events:g={},"data-testid":y}=e,m=new Set(Array.isArray(f)?f:[]);let b=r||0,v=i||0;null!=s&&(b=s-n),null!=a&&(v=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===b&&0===v)if(void 0!==u.width){b=u.width/2;const e=u.depth||30;v=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;b=e+(0>e?-5:5),v=u.height/2}return t("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},g,{children:[!m.has("connector")&&at(b,v,c,h,x,u),!m.has("subject")&&st(x,u,h,n,o),!m.has("note")&&it(l,b,v,h)]}))}function ct(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(lt,Object.assign({"data-testid":"semiotic-annotation"},i,{type:s}),"multi-annotation-"+o)});return e("g",{children:l})}const l=r.note||{title:"none",label:r.label},c=`${l.label}-${l.title}-${r.i}`;return e(lt,Object.assign({"data-testid":"semiotic-annotation",events:a},r,{type:s}),c)}function ut(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 dt(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 ht(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=ut(e,n),c=dt(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 pt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const ft={linear:_,monotoneX:W,monotoneY:T,step:E,stepAfter:N,stepBefore:D,basis:R,cardinal:I,catmullRom:B};let gt={positions:new Map};const yt=new Set;function mt(){for(const e of yt)e()}function bt(e,t){const n=gt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(gt.positions);o.delete(e),gt={positions:o},mt()}function vt(e,t){const n=gt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(gt.positions);o.delete(e),gt={positions:o},mt()}function xt(){return gt}function wt(e){return yt.add(e),()=>yt.delete(e)}const At={positions:new Map};function kt(){return()=>{}}function jt(){return At}function Ot(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}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 Mt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}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 $t(o){var r,s;const{width:l,height:u,totalWidth:h,totalHeight:p,margin:f,scales:g,showAxes:y,axes:m,xLabel:b,yLabel:v,yLabelRight:x,xFormat:w,yFormat:A,showGrid:k,title:j,legend:O,legendHoverBehavior:S,legendClickBehavior:M,legendHighlightedCategory:C,legendIsolatedCategories:$,legendPosition:z="right",foregroundGraphics:B,marginalGraphics:I,xValues:R,yValues:D,annotations:N,svgAnnotationRules:E,xAccessor:T,yAccessor:W,annotationData:F,pointNodes:H,curve:G,underlayRendered:V,linkedCrosshairName:U,linkedCrosshairSourceId:Z,children:Y}=o,X=i(()=>{var e;if(!y||!g)return[];const t=null==m?void 0:m.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||w||Mt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=g.x.ticks(Math.min(o,Math.max(2,Math.floor(l/70)))),i=r.map(e=>e.valueOf()),s=r.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,i)})),a=s.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(a+8,55)):Math.max(55,a+8);let u=Ct(s,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=g.x.domain()[1],t=g.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,i);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[y,g,m,w,l]),Q=i(()=>{var e;if(!y||!g)return[];const t=null==m?void 0:m.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||A||Mt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=Ct(g.y.ticks(Math.min(o,Math.max(2,Math.floor(u/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=g.y.domain()[1],t=g.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[y,g,m,A,u]),K=i(()=>{var e;if(!y||!g)return[];const t=null==m?void 0:m.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||A||Mt,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Ct(g.y.ticks(Math.min(o,Math.max(2,Math.floor(u/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22)},[y,g,m,A,u]),J=a(new Map),ee=a(null!==(r=null==N?void 0:N.length)&&void 0!==r?r:0),te=null!==(s=null==N?void 0:N.length)&&void 0!==s?s:0;ee.current!==te&&(ee.current=te,J.current=new Map);const ne=i(()=>{if(!N||0===N.length)return null;const n=function(n,o,r){var i,s,a,l,c,u,d,h,p,f,g,y,m,b,v,x,w,A,k,j,O,S,M,C,$,z,B,I,R,D,N,E,T,W,F,H,G,V,U,Z,Y,X,Q,K,J,ee,te,ne;switch(n.type){case"label":{const t=ht(n,o,r);if(!t)return null;const{x:i,y:s}=t;return pt(i,s,r)?e(ct,{noteData:{x:i,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const t=ht(n,o,r);if(!t)return null;const{x:i,y:s}=t;return pt(i,s,r)?e(ct,{noteData:{x:i,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const i=ut(n,r);if(null==i)return null;const s=n.color||"#f97316",a=n.labelPosition||"top";let l;return l="bottom"===a?(r.height||0)-4:"center"===a?(r.height||0)/2:12,t("g",{children:[e("line",{x1:i,y1:0,x2:i,y2:r.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:i+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const i=dt(n,r);if(null==i)return null;const s=n.color||"#f97316",a=n.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(r.width||0)/2,c="middle"):(l=(r.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:i,x2:r.width||0,y2:i,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:l,y:i-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const i=(n.coordinates||[]).map(e=>({x:ut(Object.assign(Object.assign({},e),{type:"point"}),r),y:dt(Object.assign(Object.assign({},e),{type:"point"}),r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const s=P(i),a=n.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const i=(n.coordinates||[]).map(e=>({x:ut(Object.assign(Object.assign({},e),{type:"point"}),r),y:dt(Object.assign(Object.assign({},e),{type:"point"}),r)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const s=n.padding||10,a=i.map(e=>e.x),l=i.map(e=>e.y),c=Math.min(...a)-s,u=Math.max(...a)+s,d=Math.min(...l)-s,h=Math.max(...l)+s;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const t=r.data||[],i="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:i.map((t,o)=>{const i=ut(t,r),a=dt(t,r);if(null==i||null==a)return null;const l="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||s;return e("circle",Object.assign({cx:i,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const t=ut(n,r),i=dt(n,r);return e(ct,{noteData:{x:null!=t?t:0,y:null!=i?i:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=r.data||[];if(2>h.length)return null;const p=r.xAccessor||"x",f=r.yAccessor||"y",g=h.map(e=>[e[p],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>g.length)return null;const y=null!==(s=null===(i=r.scales)||void 0===i?void 0:i.x)&&void 0!==s?s:null===(a=r.scales)||void 0===a?void 0:a.time,m=null!==(c=null===(l=r.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=r.scales)||void 0===u?void 0:u.value;if(!y||!m)return null;const b=n.method||"linear";let v;v="loess"===b?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,p=0,f=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],p+=t*r[e]*r[e],f+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const g=u*p-d*d;if(1e-12>Math.abs(g))a.push([t,h/u]);else{const e=(u*f-d*h)/g;a.push([t,(h-e*d)/u+e*t])}}return a}(g,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===b?q.polynomial(g,{order:n.order||2}):q.linear(g)).points;const x=v.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),w=n.color||"#6366f1";return t("g",{children:[e("polyline",{points:x,fill:"none",stroke:w,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:y(v[v.length-1][0])+4,y:m(v[v.length-1][1])-4,fill:w,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const i=null!==(p=null===(h=r.scales)||void 0===h?void 0:h.y)&&void 0!==p?p:null===(f=r.scales)||void 0===f?void 0:f.value,s=null!==(g=null==i?void 0:i(n.y0))&&void 0!==g?g:0,a=null!==(y=null==i?void 0:i(n.y1))&&void 0!==y?y:r.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(s,a),width:r.width||0,height:Math.abs(a-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const i=r.data||[];if(2>i.length)return null;const s=r.xAccessor||"x",a=null!==(b=null===(m=r.scales)||void 0===m?void 0:m.x)&&void 0!==b?b:null===(v=r.scales)||void 0===v?void 0:v.time,l=null!==(w=null===(x=r.scales)||void 0===x?void 0:x.y)&&void 0!==w?w:null===(A=r.scales)||void 0===A?void 0:A.value;if(!a||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const p=ft[r.curve||"linear"]||_,f=L().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(p)(h);if(!f)return null;const g=n.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:g,fillOpacity:null!==(k=n.fillOpacity)&&void 0!==k?k:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:g,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const i=r.data||[];if(2>i.length)return null;const s=r.yAccessor||"y",a=null!==(O=null===(j=r.scales)||void 0===j?void 0:j.x)&&void 0!==O?O:null===(S=r.scales)||void 0===S?void 0:S.time,l=null!==(C=null===(M=r.scales)||void 0===M?void 0:M.y)&&void 0!==C?C:null===($=r.scales)||void 0===$?void 0:$.value;if(!a||!l)return null;const c=i.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),p=null!==(z=n.threshold)&&void 0!==z?z:2,f=u-p*h,g=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(B=n.fillOpacity)&&void 0!==B?B:.1,b=n.anomalyColor||"#ef4444",v=null!==(I=n.anomalyRadius)&&void 0!==I?I:6,x=l(u+p*h),w=l(f),A=i.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>p*h});return t("g",{children:[g&&e("rect",{x:0,y:Math.min(x,w),width:r.width||0,height:Math.abs(w-x),fill:y,fillOpacity:m}),A.map((t,n)=>{const o=ut(t,r),i=dt(t,r);return null==o||null==i?null:e("circle",{cx:o,cy:i,r:v,fill:b,fillOpacity:.7,stroke:b,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const i=r.data||[];if(3>i.length)return null;const s=r.xAccessor||"x",a=r.yAccessor||"y",l=null!==(D=null===(R=r.scales)||void 0===R?void 0:R.x)&&void 0!==D?D:null===(N=r.scales)||void 0===N?void 0:N.time,c=null!==(T=null===(E=r.scales)||void 0===E?void 0:E.y)&&void 0!==T?T:null===(W=r.scales)||void 0===W?void 0:W.value;if(!l||!c)return null;const u=i.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=q.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,r=0;for(const[e,i]of u)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;d=e=>a+s*e}const h=u.length,p=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(p/Math.max(h-2,1)),g=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),m=null!==(F=n.confidence)&&void 0!==F?F:.95,b=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,v=null!==(H=n.steps)&&void 0!==H?H:5,x=u[h-1][0],w=(x-u[0][0])/Math.max(h-1,1),A=[];for(let e=1;v>=e;e++)A.push(x+e*w);const k=[];for(const e of A){const t=d(e),n=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-g,2)/y:0))*b;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${k.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,O=k.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),S=`${l(x)},${c(d(x))}`,M=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:j,fill:n.fill||"#6366f1",fillOpacity:null!==(G=n.fillOpacity)&&void 0!==G?G:.15,stroke:"none"}),e("polyline",{points:`${S} ${O}`,fill:"none",stroke:M,strokeWidth:null!==(V=n.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(U=n.strokeDasharray)&&void 0!==U?U:"6,3"}),n.label&&k.length>0&&e("text",{x:l(k[k.length-1].x)+4,y:c(k[k.length-1].yCenter)-4,fill:M,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let t=null,i=null;if(null!=n.px&&null!=n.py)t=n.px,i=n.py;else{const e=ht(n,o,r);if(!e)return null;t=e.x,i=e.y}if(null==t||null==i)return null;if(!pt(t,i,r))return null;const s=null!==(Z=n.dx)&&void 0!==Z?Z:0,a=null!==(Y=n.dy)&&void 0!==Y?Y:0,l=null!==(X=n.width)&&void 0!==X?X:32,c=null!==(Q=n.height)&&void 0!==Q?Q:32,u=null!==(K=n.content)&&void 0!==K?K:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=ht(n,o,r);if(!t)return null;const{x:i,y:s}=t;return e("text",{x:i+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const i=n.category;if(null==i)return null;const s=null===(J=r.scales)||void 0===J?void 0:J.o,a=null===(ee=r.scales)||void 0===ee?void 0:ee.x,l=null===(te=r.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const u=c(i);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",p=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,f=n.label;return t("g",(r.projection?"vertical"===r.projection:c===a)?{children:[e("rect",{x:u,y:0,width:d,height:r.height||0,fill:h,fillOpacity:p}),f&&e("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e("rect",{x:0,y:u,width:r.width||0,height:d,fill:h,fillOpacity:p}),f&&e("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+o)}default:return null}},o={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:T,yAccessor:W,width:l,height:u,data:F,frameType:"xy",pointNodes:H,curve:G,stickyPositionCache:J.current};return N.map((e,t)=>{if(E){const r=E(e,t,o);return null!=r?r:n(e,t,o)}return n(e,t,o)}).filter(Boolean)},[N,E,l,u,T,W,F,g,H,G]),oe=function(e){var t;const n=c(e?wt:kt,e?xt:jt,e?xt:jt);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(U);return d(()=>{if(!(null==oe?void 0:oe.locked)||!U)return;const e=e=>{"Escape"===e.key&&vt(U)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,U]),y||j||O||B||I||ne&&ne.length>0||k||Y||oe?t("svg",{role:"img",width:h,height:p,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof j?j:"XY Chart"}),e("desc",{children:"string"==typeof j?j+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[k&&g&&!V&&(()=>{var n,o;const r=Ot(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),i=Ot(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[X.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:u,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"xgrid-"+n)),Q.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:l,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),y&&g&&(()=>{const o=null==m?void 0:m.find(e=>"left"===e.orient),r=null==m?void 0:m.find(e=>"bottom"===e.orient),i=!o||!1!==o.baseline,s=!r||!1!==r.baseline,a=(null==o?void 0:o.jaggedBase)||!1,c=(null==r?void 0:r.jaggedBase)||!1,d=null==r?void 0:r.landmarkTicks,h=null==o?void 0:o.landmarkTicks,p="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",w=!!(null==r?void 0:r.autoRotate)&&X.length>1&&(()=>{const e=l/Math.max(X.length-1,1);return X.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[!V&&s&&!c&&e("line",{x1:0,y1:u,x2:l,y2:u,stroke:p,strokeWidth:1}),!V&&c&&e("path",{d:St("bottom",l,u),fill:"none",stroke:p,strokeWidth:1}),X.map((n,o)=>{const r=!!d&&("function"==typeof d?d(n.value,o):ke(n.value,o>0?X[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${u})`,children:[e("line",{y2:5,stroke:p,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:w?10:18,textAnchor:w?"end":"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"},transform:w?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"xtick-"+o)}),b&&e("text",{x:l/2,y:u+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:b}),!V&&i&&!a&&e("line",{x1:0,y1:0,x2:0,y2:u,stroke:p,strokeWidth:1}),!V&&a&&e("path",{d:St("left",l,u),fill:"none",stroke:p,strokeWidth:1}),Q.map((n,o)=>{const r=!!h&&("function"==typeof h?h(n.value,o):ke(n.value,o>0?Q[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:p,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==o?void 0:o.label)||v;return t?e("text",{x:15-f.left,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-f.left}, ${u/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const o=null==m?void 0:m.find(e=>"right"===e.orient);if(!o||0===K.length)return null;const r=o.landmarkTicks,i=o.label||x;return t(n,{children:[!1!==o.baseline&&e("line",{x1:l,y1:0,x2:l,y2:u,stroke:p,strokeWidth:1}),K.map((n,o)=>{const i=!!r&&("function"==typeof r?r(n.value,o):ke(n.value,o>0?K[o-1].value:void 0));return t("g",{transform:`translate(${l},${n.pixel})`,children:[e("line",{x2:5,stroke:p,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:g,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-r-"+o)}),i&&e("text",{x:l+f.right-15,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${l+f.right-15}, ${u/2})`,style:{userSelect:"none"},children:i})]})})()]})})(),ne,I&&g&&R&&D&&t(n,{children:[I.top&&e("g",{transform:"translate(0, 0)",children:e(nt,{orient:"top",config:tt(I.top),values:R,scale:g.x,size:f.top,length:l})}),I.bottom&&e("g",{transform:`translate(0, ${u})`,children:e(nt,{orient:"bottom",config:tt(I.bottom),values:R,scale:g.x,size:f.bottom,length:l})}),I.left&&e("g",{transform:"translate(0, 0)",children:e(nt,{orient:"left",config:tt(I.left),values:D,scale:g.y,size:f.left,length:u})}),I.right&&e("g",{transform:`translate(${l}, 0)`,children:e(nt,{orient:"right",config:tt(I.right),values:D,scale:g.y,size:f.right,length:u})})]}),B,oe&&oe.sourceId!==Z&&(null==g?void 0:g.x)&&(()=>{const t=g.x(oe.xValue);if(null==t||0>t||t>l)return null;const n=oe.locked;return e("line",{x1:t,y1:0,x2:t,y2:u,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Y]}),j&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof j?j:null}),et({legend:O,totalWidth:h,totalHeight:p,margin:f,legendPosition:z,title:j,legendHoverBehavior:S,legendClickBehavior:M,legendHighlightedCategory:C,legendIsolatedCategories:$})]}):null}function zt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Pt="undefined"==typeof window||"undefined"==typeof document,Lt=o.createContext(null),Bt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function It(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 Rt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Dt={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"},Nt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Et={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)"},Tt={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)"},_t={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Ft={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Ht({scene:n,chartType:r,tableId:i,chartTitle:s}){var a;const[l,c]=o.useState(!1),u=o.useContext(Lt),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,p=o.useRef(null),f=s?"Data summary for "+s:i?`Data summary for ${r} ${i}`:"Data summary for "+r,g=o.useCallback(()=>{l||d||c(!0)},[l,d]),y=o.useCallback(e=>{var t;d||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return i?e("span",{id:i,tabIndex:-1,style:Bt}):null;if(!h)return e("div",{id:i,tabIndex:-1,onFocus:g,style:Bt,role:"region","aria-label":f,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,p,f,g,y,m,b,v,x,w,A,k,j,O;const S=[];if(!Array.isArray(e))return S;for(const M of e)if(M&&"object"==typeof M)try{switch(M.type){case"point":S.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=M.topPath,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=M.datum&&"object"==typeof M.datum?M.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=M.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=M.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=M.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=M.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(p=M.cx)&&void 0!==p?p:M.x,y:null!==(f=M.cy)&&void 0!==f?f:M.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(y=null===(g=M.datum)||void 0===g?void 0:g.id)&&void 0!==y?y:"",x:null!==(m=M.cx)&&void 0!==m?m:M.x,y:null!==(b=M.cy)&&void 0!==b?b:M.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(w=null===(x=null===(v=M.datum)||void 0===v?void 0:v.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(A=M.datum)||void 0===A?void 0:A.name)&&void 0!==k?k:"",value:null!==(O=null===(j=M.datum)||void 0===j?void 0:j.value)&&void 0!==O?O:""}})}}catch(e){}return S}(n),b=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}(m),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Rt(e.min)} to ${Rt(e.max)}, mean ${Rt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,b),x=m.slice(0,5),w=new Set;for(const e of x)for(const t of Object.keys(e.values))w.add(t);const A=Array.from(w);return t("div",{ref:p,id:i,tabIndex:-1,onBlur:y,style:Dt,role:"region","aria-label":f,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Et,children:"×"}),e("div",{role:"note",style:Nt,children:v}),t("table",{role:"table","aria-label":"Sample data for "+r,style:Tt,children:[t("caption",{style:Ft,children:["First ",x.length," of ",m.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Wt,children:"type"}),A.map(t=>e("th",{style:Wt,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:_t,children:n.label}),A.map(t=>{return e("td",{style:_t,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Rt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function qt({summary:t}){return t?e("div",{role:"note",style:Bt,children:t}):null}function Gt({tableId:t}){return e("a",{href:"#"+t,style:Bt,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,Bt)},children:"Skip to data table"})}function Vt({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Bt,children:n})}const Ut="var(--semiotic-focus, #005fcc)";function Zt({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("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Ut,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Ut,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ut,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Yt({x:t,y:n,containerWidth:r,containerHeight:i,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=o.useRef(null),[d,h]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,r,i]);let p;return p=d?`translate(${d.width+12>r-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*r?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:l,style:{position:"absolute",left:s.left+t,top:s.top+n,transform:p,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function Xt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Qt(e,t,n=.6){var o,r,i,s,a;if(!Xt(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 Kt(e,t,n,o=.35){Xt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Jt(e){switch(e){case"monotoneX":return W;case"monotoneY":return T;case"cardinal":return I;case"catmullRom":return B;case"step":return E;case"stepBefore":return D;case"stepAfter":return N;case"basis":return R;case"natural":return H;default:return null}}function en(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 tn(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 nn(e){return e.k}function on(e){return[e.x,e.y]}function rn(e){return function(){return e}}function sn([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function an(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 ln(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function cn(e,t,n,o,r){return"function"==typeof e?e(t,n,o,r):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",r>1?"@2x":"")}class un{constructor(e=256){this.cache=new Map,this.limit=e}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,o]of this.cache)t>o.lastUsed&&(t=o.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}}class dn{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const s=n[i.lineIndex];if(!s||2>s.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const a=hn(s),l=pn(s,i.t*a),c=(o[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function hn(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],r=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+r*r)}return t}function pn(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],s=Math.sqrt(r*r+i*i);if(n+s>=t||o===e.length-1){const a=s>0?(t-n)/s:0,l=s>.001?s:1;return{x:e[o-1][0]+r*a,y:e[o-1][1]+i*a,nx:-i/l,ny:r/l}}n+=s}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const fn={top:10,right:10,bottom:10,left:10},gn={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"},yn={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function mn({data:n}){if(!n)return null;if(n.properties)return e("div",{className:"semiotic-tooltip",style:gn,children:e("div",{style:{fontWeight:600},children:n.properties.name||n.properties.NAME||n.properties.id||"Feature"})});const o=Object.entries(n).slice(0,3);return e("div",{className:"semiotic-tooltip",style:gn,children:o.map(([n,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[n,": "]}),e("span",{style:{fontWeight:600},children:o+""})]},n))})}const bn=h(function(n,o){var r,s,c,h,f,g,y,m,b,v;const{projection:x,projectionExtent:w,fitPadding:A,projectionTransform:k,areas:j,points:O,lines:S,xAccessor:M,yAccessor:C,lineDataAccessor:$,pointIdAccessor:z,lineType:P="geo",flowStyle:L="basic",graticule:B,zoomable:I,zoomExtent:R,onZoom:D,dragRotate:N,showParticles:E,particleStyle:T,tileURL:W,tileAttribution:_,tileCacheSize:H,size:q,width:Z,height:Y,responsiveWidth:X,responsiveHeight:Q,margin:K,className:J,background:ee,areaStyle:te,pointStyle:ne,lineStyle:oe,colorScheme:re,enableHover:ie=!0,hoverAnnotation:se,tooltipContent:ae,customClickBehavior:le,customHoverBehavior:ce,annotations:ue,decay:de,pulse:he,transition:pe,animate:fe,staleness:ge,backgroundGraphics:ye,foregroundGraphics:me,title:be,legend:ve,legendPosition:we,legendHoverBehavior:Ae,legendClickBehavior:ke,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,showAxes:Me,accessibleTable:$e=!0,description:ze,summary:Pe}=n,Le=q||[Z||600,Y||400],Be=a(!0),Ie=Ge({sizeProp:Le,responsiveWidth:X,responsiveHeight:Q,userMargin:K,marginDefault:fn,foregroundGraphics:me,backgroundGraphics:ye,animate:fe,transitionProp:pe,themeDirtyRef:Be}),{reducedMotionRef:Re,responsiveRef:De,size:Ne,margin:Ee,adjustedWidth:Te,adjustedHeight:We,resolvedForeground:_e,resolvedBackground:Fe,transition:qe,introEnabled:Ve,tableId:Ue,rafRef:Ze,renderFnRef:Ye,scheduleRender:Xe,currentTheme:Qe}=Ie,Ke=i(()=>null!=N?N:"orthographic"===("string"==typeof x?x:"object"==typeof x&&"type"in x?x.type:null),[N,x]),Je=i(()=>{var e,t;return{projection:x,projectionExtent:w,fitPadding:A,xAccessor:M,yAccessor:C,lineDataAccessor:$,lineType:P,flowStyle:L,areaStyle:te,pointStyle:ne,lineStyle:oe,colorScheme:re,themeSemantic:Ce(Qe),themeSequential:null===(e=null==Qe?void 0:Qe.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==Qe?void 0:Qe.colors)||void 0===t?void 0:t.diverging,graticule:B,projectionTransform:k,decay:de,pulse:he,transition:qe,introAnimation:Ve,annotations:ue,pointIdAccessor:z}},[x,w,A,M,C,$,P,L,te,ne,oe,re,B,k,de,he,null==qe?void 0:qe.duration,null==qe?void 0:qe.easing,Ve,ue,z,Qe]),et=a(null);et.current||(et.current=new xe(Je));const tt=a(null),nt=a(null),ot=a(null),rt=a(null),it=a(null);W&&!it.current&&(it.current=new un(H||256));const st=a(ue),at=a(null),lt=a(G),ct=a(!1),ut=a(null),dt=a(null),ht=a(null),pt=a(null),ft=a(0);if(E&&!pt.current){const e=null!==(r=null==T?void 0:T.maxPerLine)&&void 0!==r?r:30;pt.current=new dn(50*e)}const gt=a(null),yt=a(null),[mt,bt]=u(null),[vt,xt]=u(0),[wt,At]=u(!1);d(()=>{var e;null===(e=et.current)||void 0===e||e.updateConfig(Je),Be.current=!0,Xe()},[Je,Xe]),d(()=>{const e=et.current;e&&(j&&e.setAreas(j),O&&e.setPoints(O),S&&e.setLines(S),Be.current=!0,Xe())},[j,O,S,Xe]);const kt=l(e=>{var t;null===(t=et.current)||void 0===t||t.pushPoint(e),Be.current=!0,Xe()},[Xe]),jt=l(e=>{var t;null===(t=et.current)||void 0===t||t.pushMany(e),Be.current=!0,Xe()},[Xe]),Ot=l(()=>{var e;null===(e=et.current)||void 0===e||e.clear(),Be.current=!0,Xe()},[Xe]);p(o,()=>({push:kt,pushMany:jt,removePoint:e=>{var t,n;const o=null!==(n=null===(t=et.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Be.current=!0,Xe()),o},clear:Ot,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=et.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.projection)&&void 0!==n?n:null},getGeoPath:()=>{var e,t,n;return null!==(n=null===(t=null===(e=et.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.geoPath)&&void 0!==n?n:null},getCartogramLayout:()=>{var e,t;return null!==(t=null===(e=et.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>lt.current.k,resetZoom:()=>{const e=ut.current;e&&at.current&&U(e).call(at.current.transform,G)},getData:()=>{var e,t;return null!==(t=null===(e=et.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[kt,jt,Ot,Xe]);const{hoverHandlerRef:St,onPointerMove:Mt,onPointerLeave:Ct}=Ie;d(()=>{St.current=e=>{if(!ie)return;const t=et.current;if(!t||!t.scene.length)return;const n=nt.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Ee.left,i=e.clientY-o.top-Ee.top;if(0>r||r>Te||0>i||i>We)return gt.current=null,yt.current=null,bt(null),null==ce||ce(null),void Xe();rt.current||(rt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=rt.current.getContext("2d");if(!s)return;const a=je(t.scene,r,i,30,s,t.quadtree,t.maxPointRadius);if(a){const e=a.node,t=e.datum,n=(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,s;"point"===e.type?(o=e.x,s=e.y):"geoarea"===e.type?(o=e.centroid[0],s=e.centroid[1]):(o=r,s=i);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,x:o,y:s,time:o,value:s});gt.current=l,yt.current=e,bt(l),null==ce||ce(l),Xe()}else gt.current&&(gt.current=null,yt.current=null,bt(null),null==ce||ce(null),Xe())}},[ie,Te,We,Ee,ce,Xe]),Ie.hoverLeaveRef.current=()=>{gt.current=null,yt.current=null,bt(null),null==ce||ce(null),Xe()};const Lt=l(e=>{if(!le)return;const t=et.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Ee.left,r=e.clientY-n.top-Ee.top;rt.current||(rt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=rt.current.getContext("2d");if(!i)return;const s=je(t.scene,o,r,30,i,t.quadtree,t.maxPointRadius);if(s){const e=s.node.datum,t=(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;le(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,x:o,y:r,time:o,value:r}))}},[le,Ee]),Bt=a(-1),Rt=a(null),Dt=l(e=>{const t=et.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)"point"===n.type&&null!=n.x?t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"}):"geoarea"===n.type&&n.centroid&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"circle"});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=Bt.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"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);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 Bt.current=-1,Rt.current=null,gt.current=null,yt.current=null,bt(null),null==ce||ce(null),void Xe();const i=0>o?0:r;Bt.current=i;const s=n[i];Rt.current={shape:s.shape,w:s.w,h:s.h};const a=s.datum;let l=a;a&&"object"==typeof a&&"geometry"in a&&a.properties&&"object"==typeof a.properties&&(l=Object.assign(Object.assign({},a),a.properties));const c=Object.assign(Object.assign({},l),{data:a,properties:null==a?void 0:a.properties,x:s.x,y:s.y,time:s.x,value:s.y});gt.current=c,bt(c),null==ce||ce(c),Xe()},[ce,Xe]),Nt=l(e=>{Bt.current=-1,Rt.current=null,Mt(e)},[Mt]);Ye.current=()=>{var e,t,n,o,r,i,s;Ze.current=0;const a=nt.current,l=et.current;if(!a||!l)return;const c=performance.now();let u=!1;const d=ht.current;d&&(ht.current=null,l.applyRotation(d,{width:Te,height:We}));const h=l.advanceTransition(Re.current?c+1e6:c),p=!Re.current&&h;if(Be.current&&!h){const e={width:Te,height:We},t=Ke?l.getRotation():null;l.computeScene(e);const n=lt.current,o=1!==n.k||0!==n.x||0!==n.y;Ke&&t?o?(l.setRotation(t),l.applyZoomScale(n.k,e)):l.applyRotation(t,e):o&&l.applyZoomTransform(n,e),Be.current=!1,a.setAttribute("aria-label",It(l.scene,"Geographic chart"))}const f=ln();if(W&&it.current){const t=tt.current;if(t&&(null===(e=l.scales)||void 0===e?void 0:e.projection)){const e=an(t,Ne,Ee,f);if(e){e.clearRect(-Ee.left,-Ee.top,Ne[0],Ne[1]),e.save(),e.beginPath(),e.rect(0,0,Te,We),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:s,onTileLoad:a}=t,l=o.scale(),c=o.translate(),u=2*l*Math.PI,d=function(){let e=0,t=0,n=960,o=500,r=!0,i=!0,s=256,a=nn,l=on,c=0;function u(){const u=+a.apply(this,arguments),d=l.apply(this,arguments),h=Math.log2(u/s),p=Math.round(Math.max(h+c,0)),f=Math.pow(2,h-p)*s,g=+d[0]-u/2,y=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-g)/f)),b=Math.min(r?1<<p:1/0,Math.ceil((n-g)/f)),v=Math.max(i?0:-1/0,Math.floor((t-y)/f)),x=Math.min(i?1<<p:1/0,Math.ceil((o-y)/f)),w=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)w.push([t,e,p]);return w.translate=[g/f,y/f],w.scale=f,w}return u.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],u):[n-e,o-t]},u.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],u):[[e,t],[n,o]]},u.scale=function(e){return arguments.length?(a="function"==typeof e?e:rn(+e),u):a},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:rn([+e[0],+e[1]]),u):l},u.zoomDelta=function(e){return arguments.length?(c=+e,u):c},u.tileSize=function(e){return arguments.length?(s=+e,u):s},u.clamp=function(e){return arguments.length?(r=i=!!e,u):r&&i},u.clampX=function(e){return arguments.length?(r=!!e,u):r},u.clampY=function(e){return arguments.length?(i=!!e,u):i},u}().size([r,i]).scale(u).translate(c).clamp(!0)(),h=ln();let p=!0;for(const t of d){const[o,r,i]=sn(t),l=`${i}/${o}/${r}`;let c=s.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};s.set(l,t),e.onload=()=>{t.loaded=!0,null==a||a()},e.onerror=()=>{t.loaded=!0},e.src=cn(n,i,o,r,h),c=t}if(!c.loaded){p=!1;continue}const u=d.scale;e.drawImage(c.img,(t[0]+d.translate[0])*u-.5,(t[1]+d.translate[1])*u-.5,u+1,u+1)}return p}(e,{tileURL:W,projection:l.scales.projection,width:Te,height:We,tileCache:it.current,onTileLoad:()=>Xe()});e.restore(),t||(u=!0)}}}const g=an(a,Ne,Ee,f);if(!g)return;g.clearRect(-Ee.left,-Ee.top,Ne[0],Ne[1]),ee&&!W&&(g.fillStyle=ee,g.fillRect(0,0,Te,We)),g.save(),g.beginPath(),g.rect(0,0,Te,We),g.clip();const y=l.scene,m={width:Te,height:We};if(function(e,t){var n,o,r;const i=t.filter(e=>"geoarea"===e.type);for(const t of i){if(!t.pathData)continue;const i=new Path2D(t.pathData),s=t.style.fill||"#e0e0e0";if("none"!==s&&(e.fillStyle=s,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(i)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=He(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(r=t._decayOpacity)&&void 0!==r?r:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(i)}Kt(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(g,y),((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._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=a.style.stroke||"#007bff",u=He(e,c)||c,d=a.style.strokeWidth||2,h=a.colorThresholds,p=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=d,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const m=null!==(r=a.style.opacity)&&void 0!==r?r:1;tn(e,a.path,u,d,m,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=Jt(a.curve),g=h&&h.length>0&&p&&p.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!g){e.strokeStyle=u;const b=null!==(i=a.style.opacity)&&void 0!==i?i:1;for(let v=0;a.path.length-1>v;v++)e.globalAlpha=.5*(y[v]+y[v+1])*b,e.beginPath(),e.moveTo(a.path[v][0],a.path[v][1]),e.lineTo(a.path[v+1][0],a.path[v+1][1]),e.stroke()}else if(g){let x=null,w=null,A=null,k=null,j=!1;function O(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),j=!0}function S(){j&&(e.stroke(),j=!1)}for(let M=0;a.path.length>M;M++){const[C,$]=a.path[M],z=p[M],P=en(z,h,u);if(null!==x&&null!==k&&null!==A){if(P===k)e.lineTo(C,$);else{const L=[];for(const B of h){const I=B.value;(A>I||I>z)&&(I>A||z>I)||A===I||z===I||L.push({t:(I-A)/(z-A)})}L.sort((e,t)=>e.t-t.t);for(const R of L){const D=x+(C-x)*R.t,N=w+($-w)*R.t,E=en(A+(z-A)*Math.min(R.t+1e-4,1),h,u);e.lineTo(D,N),S(),O(E,D,N)}e.lineTo(C,$)}x=C,w=$,A=z,k=P}else O(P,C,$),x=C,w=$,A=z,k=P}S()}else{if(e.beginPath(),!a.strokeGradient||2>a.strokeGradient.colorStops.length||2>a.path.length)e.strokeStyle=u;else{const T=e.createLinearGradient(a.path[0][0],0,a.path[a.path.length-1][0],0);for(const W of a.strokeGradient.colorStops)T.addColorStop(Math.max(0,Math.min(1,W.offset)),W.color);e.strokeStyle=T}if(f)F().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[_,H]=a.path[0];e.moveTo(_,H);for(let q=1;a.path.length>q;q++)e.lineTo(a.path[q][0],a.path[q][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=("string"==typeof a.style.fill?He(e,a.style.fill):a.style.fill)||a.style.fill,f&&!g)F().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[V,U]=a.path[0];e.moveTo(V,U);for(let Z=1;a.path.length>Z;Z++)e.lineTo(a.path[Z][0],a.path[Z][1])}const G=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(G,o.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(g,y,0,m),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=("string"==typeof t.style.fill?He(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?He(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Qt(e,t),e.globalAlpha=1}}finally{e.restore()}}})(g,y),E&&pt.current){const e=pt.current,s=y.filter(e=>"line"===e.type);if(s.length>0){const a=T||{},l=.3*(null!==(t=a.speedMultiplier)&&void 0!==t?t:1),d=null!==(n=a.maxPerLine)&&void 0!==n?n:30,h=null!==(o=a.spawnRate)&&void 0!==o?o:.15,p=null!==(r=a.radius)&&void 0!==r?r:2,f=null!==(i=a.opacity)&&void 0!==i?i:.7,y=c/1e3,m=ft.current>0?Math.min(y-ft.current,.1):.016;ft.current=y;const b=s.map(e=>e.path),v=s.map(e=>e.style.strokeWidth||2);for(let t=0;s.length>t;t++)Math.random()<h&&e.countForLine(t)<d&&e.spawn(t);e.step(m,l,b,v),g.globalAlpha=f;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=s[n.lineIndex],r="function"==typeof a.color?a.color(null==o?void 0:o.datum):"source"!==a.color&&a.color?a.color:(null==o?void 0:o.style.stroke)||"#fff";g.beginPath(),g.arc(n.x,n.y,p,0,2*Math.PI),g.fillStyle=r,g.fill()}g.globalAlpha=1,u=!0}}g.restore();const b=ot.current;if(b){const e=an(b,Ne,Ee,f);if(e){e.clearRect(-Ee.left,-Ee.top,Ne[0],Ne[1]);const t=yt.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof se?se:void 0,r=(null==o?void 0:o.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}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(ge){const e=performance.now()-l.lastIngestTime>(null!==(s=ge.threshold)&&void 0!==s?s:5e3);e!==wt&&At(e)}const v=ue!==st.current;v&&(st.current=ue),(Be.current||v)&&xt(e=>e+1),(p||null!=l.activeTransition||l.hasActivePulses||u)&&(Ze.current=requestAnimationFrame(()=>Ye.current()))},d(()=>(Xe(),()=>{var e;null===(e=it.current)||void 0===e||e.clear()}),[Xe]),d(()=>{Be.current=!0,Xe()},[Te,We,ee,Xe]),function(e,t,n,o,r,i){d(()=>{if(!e)return;const s=setInterval(()=>{var s;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(s=e.threshold)&&void 0!==s?s:5e3,u=l-a.lastIngestTime>c;u!==r&&(i(u),n.current=!0,o())},1e3);return()=>clearInterval(s)},[e,r,o])}(ge,et,Be,Xe,wt,At),d(()=>{if("production"!==process.env.NODE_ENV&&W){const e="string"==typeof x?x:"object"==typeof x&&"type"in x?x.type:null;e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[W,x]),d(()=>{const e=ut.current;if(!I||!e)return at.current&&e&&(U(e).on(".zoom",null),at.current=null),void(e&&U(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=R||[1,8],o={width:Te,height:We};if(Ke){let r=lt.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),lt.current=G.scale(r);const s=et.current;s&&(s.applyZoomScale(r,o),Be.current=!1,Xe(),(null===(i=s.scales)||void 0===i?void 0:i.projection)&&(null==D||D({projection:s.scales.projection,zoom:s.currentZoom})))};at.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const s=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},a=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",a);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=et.current;if(!o)return;const r=o.getRotation();dt.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=dt.current;t&&(ht.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],Xe())},d=t=>{var n;if(!dt.current)return;dt.current=null,e.releasePointerCapture(t.pointerId);const r=ht.current;if(r){ht.current=null;const e=et.current;e&&(e.applyRotation(r,o),Xe())}const i=et.current;(null===(n=null==i?void 0:i.scales)||void 0===n?void 0:n.projection)&&(null==D||D({projection:i.scales.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",a),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),at.current=null}}const r=V().scaleExtent([t,n]).extent([[0,0],[Ne[0],Ne[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;lt.current=t,ct.current=!0;const n=et.current;n&&(n.applyZoomTransform(t,o),Be.current=!1,Xe())}).on("end",e=>{var t;lt.current=e.transform,ct.current=!1;const n=et.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==D||D({projection:n.scales.projection,zoom:n.currentZoom}))});return at.current=r,U(e).call(r),()=>{U(e).on(".zoom",null)}},[I,R,Ke,Ne,Te,We,Ee,D,Xe]);const Et=ie&&!1!==se,Tt=Et&&mt?ae?ae(mt):e(mn,{data:mt}):null,Wt=Tt?e(Yt,{x:mt.x,y:mt.y,containerWidth:Te,containerHeight:We,margin:Ee,className:"stream-frame-tooltip",zIndex:10,children:Tt}):null;if(Pt){const n=et.current;n&&(j||O||S)&&(j&&n.setAreas(j),O&&n.setPoints(O),S&&n.setLines(S),n.computeScene({width:Te,height:We}));const o=null!==(s=null==n?void 0:n.scene)&&void 0!==s?s:[];return t("div",{className:"stream-geo-frame"+(J?" "+J:""),role:"img","aria-label":ze||("string"==typeof be?be:"Geographic chart"),style:{position:"relative",width:Ne[0],height:Ne[1]},children:[e(qt,{summary:Pe}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ne[0],height:Ne[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Ee.left},${Ee.top})`,children:Fe}),t("g",{transform:`translate(${Ee.left},${Ee.top})`,children:[ee&&e("rect",{x:0,y:0,width:Te,height:We,fill:ee}),o.map((t,n)=>function(t,n){var o,r,i,s,a,l;switch(t.type){case"geoarea":{const i=t;return i.pathData?e("path",{d:i.pathData,fill:zt(i.style.fill,"#e0e0e0"),fillOpacity:null!==(o=i.style.fillOpacity)&&void 0!==o?o:1,stroke:i.style.stroke||"none",strokeWidth:i.style.strokeWidth||.5,strokeDasharray:i.style.strokeDasharray,opacity:null!==(r=i._decayOpacity)&&void 0!==r?r:1},"geoarea-"+n):null}case"point":{const o=t;return e("circle",{cx:o.x,cy:o.y,r:o.r,fill:zt(o.style.fill),fillOpacity:null!==(i=o.style.fillOpacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(s=o._decayOpacity)&&void 0!==s?s:null!==(a=o.style.opacity)&&void 0!==a?a:1},"point-"+n)}case"line":{const o=t;if(2>o.path.length)return null;const r="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e("path",{d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(l=o.style.opacity)&&void 0!==l?l:1},"line-"+n)}default:return null}}(t,n))]})]}),e($t,{width:Te,height:We,totalWidth:Ne[0],totalHeight:Ne[1],margin:Ee,scales:null,showAxes:!1,title:be,legend:ve,legendPosition:we,legendHoverBehavior:Ae,legendClickBehavior:ke,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,foregroundGraphics:_e,annotations:ue,annotationFrame:0,xValues:[],yValues:[],pointNodes:o.filter(e=>"point"===e.type)})]})}const _t=l(e=>{ut.current=e,De&&"object"==typeof De&&(De.current=e)},[De]);return t("div",{ref:_t,className:"stream-geo-frame"+(J?" "+J:""),role:"group","aria-label":ze||("string"==typeof be?be:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:X?"100%":Ne[0],height:Q?"100%":Ne[1],overflow:"hidden"},I?{touchAction:"none"}:{}),onKeyDown:Dt,children:[$e&&e(Gt,{tableId:Ue}),$e&&e(Ht,{scene:null!==(h=null===(c=et.current)||void 0===c?void 0:c.scene)&&void 0!==h?h:[],chartType:"Geographic chart",tableId:Ue,chartTitle:"string"==typeof be?be:void 0}),e(qt,{summary:Pe}),t("div",{role:"img","aria-label":ze||("string"==typeof be?be:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Et?Nt:void 0,onMouseLeave:Et?Ct:void 0,onClick:le?Lt:void 0,children:[Fe&&e("svg",{style:{position:"absolute",left:0,top:0,width:Ne[0],height:Ne[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Ee.left},${Ee.top})`,children:Fe})}),W&&e("canvas",{ref:tt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e("canvas",{ref:nt,"aria-label":It(null!==(g=null===(f=et.current)||void 0===f?void 0:f.scene)&&void 0!==g?g:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:ot,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Vt,{hoverPoint:mt}),e($t,{width:Te,height:We,totalWidth:Ne[0],totalHeight:Ne[1],margin:Ee,scales:null,showAxes:null!=Me&&Me,title:be,legend:ve,legendPosition:we,legendHoverBehavior:Ae,legendClickBehavior:ke,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,foregroundGraphics:_e,annotations:ue,annotationFrame:vt,xValues:[],yValues:[],pointNodes:null===(y=et.current)||void 0===y?void 0:y.scene.filter(e=>"point"===e.type)}),(null==ge?void 0:ge.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ge.badgePosition?{top:4,left:4}:"bottom-left"===ge.badgePosition?{bottom:4,left:4}:"bottom-right"===ge.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:wt?"#dc3545":"#28a745",color:"white"}),children:wt?"STALE":"LIVE"}),I&&t("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Ee.bottom+8,left:Ee.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=ut.current,n=at.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(U(t),1.5)},style:yn,children:"+"}),e("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=ut.current,n=at.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(U(t),1/1.5)},style:yn,children:"−"})]}),_&&e("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Ee.bottom+2,right:Ee.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:_}),e(Zt,{active:Bt.current>=0,hoverPoint:mt,margin:Ee,size:Ne,shape:null===(m=Rt.current)||void 0===m?void 0:m.shape,width:null===(b=Rt.current)||void 0===b?void 0:b.w,height:null===(v=Rt.current)||void 0===v?void 0:v.h}),Wt]})]})});bn.displayName="StreamGeoFrame";const vn={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 xn(e,t){return"function"==typeof t?t(e):e[t]}function wn(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function An(n={}){const{fields:o,title:r,format:i,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(r){const e=xn(n,r);l=wn(e,i)}if(o&&o.length>0)o.forEach(e=>{let t,o,r;"string"==typeof e?(t=e,o=e,r=i):(t=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=xn(n,o);c.push({label:t,value:wn(s,r)})});else if(!r){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=wn(n[t],i);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=wn(n[e[0]],i))}}const u=Object.assign(Object.assign({},vn),s);return t("div",{className:("semiotic-tooltip "+a).trim(),style:u,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function kn(t){if(!0===t)return An();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("div",{className:"semiotic-tooltip",style:vn,children:o})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?An(t):An())}const jn={category10:Z,tableau10:oe,set3:ne,blues:te,reds:ee,greens:J,oranges:K,purples:Q,viridis:X,plasma:Y},On=Z,Sn=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Mn=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 Cn(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")||Mn.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):On[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+""))%On.length]}function $n(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 S().domain(o).range(n).unknown("#999");const i=jn[n]||jn.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:On;return S().domain(o).range(e).unknown("#999")}}function zn(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[i,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}const Pn=r(null);function Ln(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 Bn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[In,Rn]=Se(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Bn(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=Bn(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}})}})),[Dn,Nn]=Se(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 En(e){const t=f(),n=e.clientId||t,{name:o}=e,r=Rn(e=>e.selections.get(o)),s=Rn(e=>e.setClause),a=Rn(e=>e.clearClause),c=i(()=>!!r&&r.clauses.size>0,[r]);return{predicate:i(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Ln(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:c,selectPoints:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:l(()=>{a(o,n)},[a,o,n]),clientId:n}}function Tn(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=En({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}}const Wn=r(!1);function _n(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}function Fn(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:.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}function Hn(){return Re(e=>e.theme)}o.createContext(void 0);const qn="#007bff";function Gn(e,t,n){const o=s(Pn),r=function(){var e;const t=Hn(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}();return i(()=>{var i;if(!t)return;const s=null!==(i=null!=n?n:r&&r.length>0?r:void 0)&&void 0!==i?i:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=$n(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return $n(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=$n(e,t,s);return e=>o[e]||n(e)}return $n(e,t,s)}if(o&&Object.keys(o).length>0){const e=$n([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,r])}function Vn({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:s,chartId:a,onClick:c,hoverHighlight:h,colorByField:p}){const g=f(),y=_n(t,n),m=En({name:(null==e?void 0:e.name)||"__unused__"}),b=Tn({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),v=Nn(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,A]=u(null),k=p||n[0],j=i(()=>{if(!h||null==w||!k)return null;const e=w,t=k;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,w,k]),O=l(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const e=null==t?void 0:t[y.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=gt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(gt={positions:new Map(gt.positions).set(e,{xValue:t,sourceId:n})},mt())}(y.name||"hover",Number(e),g)}"x-position"!==(null==y?void 0:y.mode)&&b.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&bt(y.name||"hover",g),"x-position"!==(null==y?void 0:y.mode)&&b.onHover(null);if(h&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[k];A(null!=n?n+"":null)}else A(null);if(r||v){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};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),v&&v(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),v&&v(e)}}},[t,b,y,g,r,s,a,v,h,k]),S=l(e=>{var t,n,o,i;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[y.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=gt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(gt.positions);return t.delete(e),gt={positions:t},mt(),!1}gt={positions:new Map(gt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},mt()}(y.name||"hover",Number(n),g)}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(r||v){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!==(i=e.y)&&void 0!==i?i:0});r&&r(s),v&&v(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),v&&v(e)}}},[c,r,v,s,a,y,g]);return d(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{vt(e,g),bt(e,g)}},[null==y?void 0:y.mode,null==y?void 0:y.name,g]),{activeSelectionHook:x,hoverSelectionHook:j,customHoverBehavior:O,customClickBehavior:S,crosshairSourceId:g}}function Un({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(Wn),d=void 0!==o?o:!u&&!!t,h=i(()=>{if(!d||!t)return;const o=function({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):Sn[i%Sn.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Cn,categories:c});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[d,t,e,n,c]),p=i(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=Object.assign(Object.assign({},l),e);return h&&("right"===r&&110>t.right?t.right=110:"left"===r&&110>t.left?t.left=110:"top"===r&&50>t.top?t.top=50:"bottom"===r&&80>t.bottom&&(t.bottom=80)),t},[l,a,h,r]);return{legend:h,margin:p,legendPosition:r}}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 Yn(e,t,n){var o,r,i,s,a,l,c;const u=Zn[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(r=t.height)&&void 0!==r?r:u.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Xn(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Xn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Qn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function Kn({componentName:n,message:o,diagnosticHint:r,width:i,height:s}){return e("div",{role:"alert",style:{width:i,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),r&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:r})]})})}class Jn extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(Kn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function eo(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 to(e,t,n=3){let o,r=n+1;for(const n of t){const t=eo(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function no(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function oo(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=to(e,t,3))&&void 0!==n?n:null)}const ro={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"}},io={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},so={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},ao=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],lo=["vertical","horizontal"],co={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},ro),io),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ao},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({},ro),io),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ao},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},ro),io),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:ao},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({},ro),io),{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({},ro),io),{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({},ro),io),{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({},ro),io),{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({},ro),io),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},ro),io),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},ro),io),{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({},ro),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ro),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},ro),so),{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:lo},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ro),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ro),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},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({},ro),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ro),so),{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({},ro),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},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({},ro),so),{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({},ro),so),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:lo},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},ro),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},ro),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},ro),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ro),so),{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({},ro),so),{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({},ro),{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({},ro),{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:lo},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({},ro),{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({},ro),{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({},ro),{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({},ro),{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({},ro),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},ro),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},ro),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},ro),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},ro),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},ro),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},ro),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function uo(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const ho=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),po=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),fo=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),go=new Set(["LineChart","AreaChart","StackedAreaChart"]),yo=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function mo(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 bo(e,t){const n=mo(e),o=mo(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const vo=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function xo(e,t){const n=[],o=function(e,t){const n=[],o=co[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(co).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(!uo(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=to(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=function({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=no(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=oo(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}({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=no(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=oo(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 co[e]?(function(e,t,n){const o=co[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=co[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){ho.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){po.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=co[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(!fo.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=co[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(!yo.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=bo(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=bo(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 vo)"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 wo;const Ao="undefined"!=typeof process&&"production"!==(null===(wo=process.env)||void 0===wo?void 0:wo.NODE_ENV);function ko({componentName:t,width:n,height:o,chartProps:r,children:i}){return e(Jn,{fallback:i=>{let s="";if(Ao&&r)try{const e=xo(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(Kn,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})},children:i})}const jo={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"},Oo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function So(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},jo),{width:n,height:o}),children:r||"No data available"}):null}function Mo(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("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Oo),{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})},o))})}function Co(e,t,n,o){if(!Ao)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 $o(e){const t=Re(e=>e.theme.colors.selectionOpacity);return i(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function zo(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 Po(e){return e}function Lo(e,t){var n=t.id,o=t.bbox,r=null==t.properties?{}:t.properties,i=function(e,t){var n=function(e){if(null==e)return Po;var t,n,o=e.scale[0],r=e.scale[1],i=e.translate[0],s=e.translate[1];return function(e,a){a||(t=n=0);var l=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+i,u[1]=(n+=e[1])*r+s;c>l;)u[l]=e[l],++l;return u}}(e.transform),o=e.arcs;function r(e,t){t.length&&t.pop();for(var r=o[0>e?~e:e],i=0,s=r.length;s>i;++i)t.push(n(r[i],i));0>e&&function(e,t){for(var n,o=e.length,r=o-t;r<--o;)n=e[r],e[r++]=e[o],e[o]=n}(t,s)}function i(e){return n(e)}function s(e){for(var t=[],n=0,o=e.length;o>n;++n)r(e[n],t);return 2>t.length&&t.push(t[0]),t}function a(e){for(var t=s(e);4>t.length;)t.push(t[0]);return t}function l(e){return e.map(a)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=i(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(i);break;case"LineString":n=s(t.arcs);break;case"MultiLineString":n=t.arcs.map(s);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:r,geometry:i}:null==o?{type:"Feature",id:n,properties:r,geometry:i}:{type:"Feature",id:n,bbox:o,properties:r,geometry:i}}"function"==typeof SuppressedError&&SuppressedError;const Bo=new Map;function Io(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function Ro(e){return zo(this,void 0,void 0,function*(){const t=Bo.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return zo(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:Io(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Io(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Io(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Io(yield import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}})}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const r=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return Lo(e,t)})}:Lo(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return Bo.set(e,i),i})}function Do(e){const t=i(()=>Array.isArray(e)?e:void 0,[e]),[n,o]=u(null);return d(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return o(null),Ro(e).then(e=>{t||o(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),o(null)}else o(null)},[e]),void 0!==t?t:n}const No={blues:te,reds:ee,greens:J,viridis:X,oranges:K,purples:Q,greys:le,plasma:Y,inferno:ae,magma:se,cividis:ie,turbo:re};function Eo(n){var o;const r=Yn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),s=function(){var e;const t=Hn();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:a,valueAccessor:l,colorScheme:c,projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:p,zoomExtent:f,onZoom:g,dragRotate:y,tileURL:m,tileAttribution:b,tileCacheSize:v,tooltip:x,areaOpacity:w=1,annotations:A,margin:k,className:j,selection:O,linkedHover:S,onObservation:C,onClick:$,chartId:P,loading:L,emptyContent:B,frameProps:I={},stroke:R,strokeWidth:D,opacity:N}=n,E=null!=p?p:!!m,T=Do(a),W=i(()=>"function"==typeof l?l:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[l])&&void 0!==n?n:null==e?void 0:e[l]},[l]),_=null!==(o=null!=c?c:s)&&void 0!==o?o:"blues",F=i(()=>{if(!T)return M(te).domain([0,1]);const e=T.map(e=>W(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=z(e);return M(No[_]||te).domain([null!=t?t:0,null!=n?n:1])},[T,W,_]),{activeSelectionHook:H,customHoverBehavior:q,customClickBehavior:G}=Vn({selection:O,linkedHover:S,onObservation:C,onClick:$,chartType:"ChoroplethMap",chartId:P}),V=$o(O),U=i(()=>{const e=Qn(e=>{const t=W(e);return{fill:null!=t&&isFinite(t)?F(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:w}},{stroke:R,strokeWidth:D,opacity:N});return H?Fn(e,H,V):e},[W,F,H,V,w,R,D,N]),Z=i(()=>n=>{var o,r;const i=(null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.name)||(null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||"Feature",s=W(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:i}),null!=s&&e("div",{style:{opacity:.7},children:(a=s,"number"==typeof a&&isFinite(a)?Number.isInteger(a)?a.toLocaleString():a.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=a?a:"")+"")})]});var a},[W]),Y=i(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof k?{top:k,bottom:k,left:k,right:k}:k),[k]),X=Mo(L,r.width,r.height)||(T?null:Mo(!0,r.width,r.height)),Q=X?null:So(T,r.width,r.height,B);if(Array.isArray(T)&&T.length>0){const t=T[0];if(!t||"object"!=typeof t||!t.geometry)return e(Kn,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:r.width,height:r.height})}const K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:u,areas:T,areaStyle:U,size:[r.width,r.height],margin:Y,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?Z:kn(x)||Z},null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),E&&{zoomable:!0}),f&&{zoomExtent:f}),g&&{onZoom:g}),null!=y&&{dragRotate:y}),m&&{tileURL:m}),b&&{tileAttribution:b}),v&&{tileCacheSize:v}),(S||C||$)&&{customHoverBehavior:q}),(C||$)&&{customClickBehavior:G}),A&&A.length>0&&{annotations:A}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),j&&{className:j}),null!=n.animate&&{animate:n.animate}),I);return X||Q||e(ko,{componentName:"ChoroplethMap",width:r.width,height:r.height,children:e(bn,Object.assign({},K))})}Eo.displayName="ChoroplethMap";const To=h(function(n,o){const r=a(null);p(o,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,i;const s=null!==(o=null===(n=r.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of s)null===(i=r.current)||void 0===i||i.push(t(e));return s},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Yn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:c,xAccessor:d="lon",yAccessor:h="lat",sizeBy:f,sizeRange:g=[3,30],colorBy:y,colorScheme:m,projection:b="equalEarth",graticule:v,fitPadding:x,zoomable:w,zoomExtent:A,onZoom:k,dragRotate:j,tileURL:O,tileAttribution:S,tileCacheSize:M,areas:C,areaStyle:$={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:z,annotations:P,margin:L,className:B,selection:I,linkedHover:R,onObservation:D,onClick:N,chartId:E,loading:T,emptyContent:W,legendInteraction:_,legendPosition:F,frameProps:H={},stroke:q,strokeWidth:G,opacity:V}=n,U=null!=w?w:!!O,Z=Do(C),Y=c||[],{activeSelectionHook:X,customHoverBehavior:Q,customClickBehavior:K}=Vn({selection:I,linkedHover:R,fallbackFields:y?["string"==typeof y?y:""]:[],onObservation:D,onClick:N,chartType:"ProportionalSymbolMap",chartId:E}),J=$o(I),ee=Gn(Y,y,m),te=i(()=>{if(!f)return;const e="function"==typeof f?f:e=>null==e?void 0:e[f],t=Y.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[Y,f]),ne=i(()=>{const e=Qn(e=>({fill:y?Cn(e,y,ee):qn,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:f?zn(e,f,g,te):6}),{stroke:q,strokeWidth:G,opacity:V});return X?Fn(e,X,J):e},[y,ee,f,g,te,X,J,q,G,V]),oe=i(()=>{if(!y)return[];const e="function"==typeof y?y:e=>null==e?void 0:e[y],t=new Set;for(const n of Y){if(!n)continue;const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[Y,y]),re=function(e,t,n){const[o,r]=u(null),[s,a]=u(new Set),c=l(t=>{"highlight"===e&&r(t?t.label:null)},[e]),d=l(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=i(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(_,y,oe),{legend:ie,margin:se,legendPosition:ae}=Un({data:Y,colorBy:y,colorScale:ee,showLegend:s.showLegend,legendPosition:F,userMargin:L,defaults:{top:10,bottom:10,left:10,right:10}}),le=i(()=>n=>{const o=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n.NAME)||(null==n?void 0:n.id),r="string"==typeof f?f:null,i=("function"==typeof f?f:e=>e[f])(n),s=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",a="string"==typeof y?y:null,l=a?null==n?void 0:n[a]:null;return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[o&&e("div",{style:{fontWeight:600,marginBottom:2},children:o}),r&&null!=i&&t("div",{children:[t("span",{style:{opacity:.7},children:[r,": "]}),s(i)]}),a&&null!=l&&t("div",{children:[t("span",{style:{opacity:.7},children:[a,": "]}),l+""]}),!o&&!r&&Object.entries(n).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,": "]}),s(n)]},e))]})},[f,y]),ce=Mo(T,s.width,s.height),ue=ce?null:So(c,s.width,s.height,W);Co("ProportionalSymbolMap",Y,"xAccessor",d),Co("ProportionalSymbolMap",Y,"yAccessor",h);const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:b},null!=c&&{points:Y}),{xAccessor:d,yAccessor:h,pointStyle:ne}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),Z&&{areas:Z,areaStyle:$}),null!=v&&{graticule:v}),null!=x&&{fitPadding:x}),U&&{zoomable:!0}),A&&{zoomExtent:A}),k&&{onZoom:k}),null!=j&&{dragRotate:j}),O&&{tileURL:O}),S&&{tileAttribution:S}),M&&{tileCacheSize:M}),{size:[s.width,s.height],margin:se,enableHover:!0,tooltipContent:!1===z?()=>null:kn(z)||le}),ie&&{legend:ie,legendPosition:ae}),_&&"none"!==_&&{legendHoverBehavior:re.onLegendHover,legendClickBehavior:re.onLegendClick,legendHighlightedCategory:re.highlightedCategory,legendIsolatedCategories:re.isolatedCategories}),(R||D||N)&&{customHoverBehavior:Q}),(D||N)&&{customClickBehavior:K}),P&&P.length>0&&{annotations:P}),s.title&&{title:s.title}),s.description&&{description:s.description}),s.summary&&{summary:s.summary}),void 0!==s.accessibleTable&&{accessibleTable:s.accessibleTable}),B&&{className:B}),null!=n.animate&&{animate:n.animate}),H);return ce||ue||e(ko,{componentName:"ProportionalSymbolMap",width:s.width,height:s.height,children:e(bn,Object.assign({ref:r},de))})});function Wo(n){const o=Yn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:r,nodes:s,nodeIdAccessor:a="id",xAccessor:c="lon",yAccessor:u="lat",valueAccessor:d="value",projection:h="equalEarth",graticule:p,fitPadding:f,zoomable:g,zoomExtent:y,onZoom:m,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,lineType:A="geo",flowStyle:k="basic",areas:j,areaStyle:S={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:M,edgeOpacity:C=.6,edgeWidthRange:$=[1,8],edgeLinecap:z="round",colorScheme:P,showParticles:L,particleStyle:B,tooltip:I,annotations:R,margin:D,className:N,selection:E,linkedHover:T,onObservation:W,onClick:_,chartId:F,loading:H,emptyContent:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=n,Y=null!=g?g:!!v,X=Do(j),Q=_n(T),K=En({name:(null==E?void 0:E.name)||"__unused__"}),J=Tn({name:(null==Q?void 0:Q.name)||"hover",fields:(null==Q?void 0:Q.fields)||[]}),ee=Nn(e=>e.pushObservation),te=E?{isActive:K.isActive,predicate:K.predicate}:null,ne=r||[],oe=s||[],re=Gn(ne,M,P),ie=i(()=>{const e=new Map;for(const t of oe)e.set(t[a]+"",t);return e},[oe,a]),se=i(()=>{const e=new Map;for(const t of ne)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[ne]),ae=l(e=>{var t,n;if(T)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=se.get(t[a]+"");e&&J.onHover(e)}else J.onHover(t)}else J.onHover(null);if(W||ee){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:F};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},o),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});W&&W(i),ee&&ee(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});W&&W(e),ee&&ee(e)}}},[T,J,a,se,W,F,ee]),le=l(e=>{var t,n,o,r;if(e&&_){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),_(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(e&&(W||ee)){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n={timestamp:Date.now(),chartType:"FlowMap",chartId:F,type:"click",datum:t||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0};W&&W(n),ee&&ee(n)}},[_,W,ee,F]),ce=i(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];return ne.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ie.get(n.source+""),r=ie.get(n.target+"");return o&&r?Object.assign(Object.assign({},n),{coordinates:[{[c]:e(o),[u]:t(o)},{[c]:e(r),[u]:t(r)}]}):null}).filter(Boolean)},[ne,ie,c,u]),ue=i(()=>{const e=ne.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[d])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>$[0]:O().domain([Math.min(...e),Math.max(...e)]).range($)},[ne,d,$]),de=i(()=>e=>{var t;return{stroke:M?Cn(e,M,re):qn,strokeWidth:ue(null!==(t=e[d])&&void 0!==t?t:0),strokeLinecap:z,opacity:C}},[M,re,ue,d,C,z]),he=$o(E),pe=i(()=>{const e=Qn(de,{stroke:V,strokeWidth:U,opacity:Z});if(!te)return e;const t=Object.assign(Object.assign({},(null==he?void 0:he.unselectedStyle)||{}),{fillOpacity:0});return Fn(e,te,Object.assign(Object.assign({},he||{}),{unselectedStyle:t}))},[de,te,he,V,U,Z]),fe=i(()=>Qn(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:V,strokeWidth:U,opacity:Z}),[V,U,Z]),ge=i(()=>n=>{var o,r,i,s,l,c,u;if((null==n?void 0:n.geometry)||(null==n?void 0:n.properties)||(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.geometry)){const t=(null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r.name)||(null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||(null===(l=null===(s=null==n?void 0:n.data)||void 0===s?void 0:s.properties)||void 0===l?void 0:l.name)||(null===(u=null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.properties)||void 0===u?void 0:u.NAME);if(t)return e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:t})})}if(null!=(null==n?void 0:n.source)&&null!=(null==n?void 0:n.target)){const o=n[d];return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t("div",{style:{fontWeight:600},children:[n.source," → ",n.target]}),null!=o&&e("div",{style:{opacity:.7},children:"number"==typeof o?o.toLocaleString():o})]})}const h=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n[a]);return null!=h?e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:h})}):null},[d,a]),ye=i(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof D?{top:D,bottom:D,left:D,right:D}:D),[D]),me=Mo(H,o.width,o.height),be=me?null:So(r,o.width,o.height,q),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h,lines:ce,points:oe,xAccessor:c,yAccessor:u,lineDataAccessor:"coordinates",lineType:A,flowStyle:k,lineStyle:pe,pointStyle:fe},X&&{areas:X,areaStyle:S}),null!=p&&{graticule:p}),null!=f&&{fitPadding:f}),Y&&{zoomable:!0}),y&&{zoomExtent:y}),m&&{onZoom:m}),null!=b&&{dragRotate:b}),L&&{showParticles:L}),B&&{particleStyle:B}),v&&{tileURL:v}),x&&{tileAttribution:x}),w&&{tileCacheSize:w}),{size:[o.width,o.height],margin:ye,enableHover:!0,tooltipContent:!1===I?()=>null:kn(I)||ge}),(T||W||_)&&{customHoverBehavior:ae}),(W||_)&&{customClickBehavior:le}),R&&R.length>0&&{annotations:R}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),N&&{className:N}),null!=n.animate&&{animate:n.animate}),G);return me||be||e(ko,{componentName:"FlowMap",width:o.width,height:o.height,children:e(bn,Object.assign({},ve))})}To.displayName="ProportionalSymbolMap",Wo.displayName="FlowMap";const _o=h(function(n,o){const r=Yn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:s,lines:c,xAccessor:h="lon",yAccessor:f="lat",nodeIdAccessor:g="id",center:y,costAccessor:m,strength:b=1,lineMode:v="straight",projection:x="mercator",graticule:w,fitPadding:A,zoomable:k,zoomExtent:j,onZoom:O,dragRotate:S,tileURL:M,tileAttribution:C,tileCacheSize:$,transition:z,colorBy:P,colorScheme:L,pointRadius:B=5,tooltip:I,showRings:R=!0,ringStyle:D,showNorth:N=!0,costLabel:E,annotations:T,margin:W,className:_,selection:F,linkedHover:H,onObservation:q,onClick:G,chartId:V,loading:U,emptyContent:Z,legendPosition:Y,frameProps:X={},stroke:Q,strokeWidth:K,opacity:J}=n,ee=null!=k?k:!!M,te=s||[],{activeSelectionHook:ne,customHoverBehavior:oe,customClickBehavior:re}=Vn({selection:F,linkedHover:H,fallbackFields:P?["string"==typeof P?P:""]:[],onObservation:q,onClick:G,chartType:"DistanceCartogram",chartId:V}),ie=$o(F),se=Gn(te,P,L),ae=i(()=>{const e=Qn(e=>({fill:P?Cn(e,P,se):qn,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:B}),{stroke:Q,strokeWidth:K,opacity:J});return ne?Fn(e,ne,ie):e},[P,se,B,ne,ie,Q,K,J]),{legend:le,margin:ce,legendPosition:ue}=Un({data:te,colorBy:P,colorScale:se,showLegend:r.showLegend,legendPosition:Y,userMargin:W,defaults:{top:10,bottom:10,left:10,right:10}}),de=i(()=>({center:y,centerAccessor:g,costAccessor:m,strength:b,lineMode:v}),[y,g,m,b,v]),he=i(()=>{if(!c)return;const e="function"==typeof h?h:e=>e[h],t="function"==typeof f?f:e=>e[f],n=new Map;for(const e of te)n.set(e[g]+"",e);return c.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),i=n.get(o.target+"");return r&&i?Object.assign(Object.assign({},o),{coordinates:[{[h]:e(r),[f]:t(r)},{[h]:e(i),[f]:t(i)}]}):null}).filter(Boolean)},[c,te,h,f,g]),pe=i(()=>n=>{const o=("function"==typeof m?m:e=>e[m])(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:n[g]||n.name||n.id||"Point"}),null!=o&&t("div",{style:{opacity:.7},children:["Cost: ","number"==typeof o?o.toFixed(1):o]})]})},[m,g]),fe=a(null);p(o,()=>({push:e=>{var t;return null===(t=fe.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=fe.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=fe.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,r;const i=null!==(o=null===(n=fe.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of i)null===(r=fe.current)||void 0===r||r.push(t(e));return i},clear:()=>{var e;return null===(e=fe.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=fe.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[ge,ye]=u(null),me=l(()=>{var e,t;const n=null===(t=null===(e=fe.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ye(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);d(()=>{const e=requestAnimationFrame(me);return()=>cancelAnimationFrame(e)},[me,b,y,r.width,r.height,te]);const be=i(()=>{if(!R||!ge)return[];const{maxCost:e}=ge;if(0>=e)return[];if(Array.isArray(R))return R.filter(t=>t>0&&e>=t);const t="number"==typeof R?R:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[R,ge]),ve=i(()=>{var n,o;if(!ge)return X.foregroundGraphics||null;const{cx:r,cy:i,maxCost:s,availableRadius:a}=ge,l=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},D),c=null!==(n=ce.left)&&void 0!==n?n:10,u=null!==(o=ce.top)&&void 0!==o?o:10;return t("g",{children:[be.map(n=>{const o=n/s*a;return t("g",{children:[e("circle",{cx:r+c,cy:i+u,r:o,fill:"none",stroke:l.stroke,strokeWidth:l.strokeWidth,strokeDasharray:l.strokeDasharray,opacity:.5}),t("text",{x:r+c+o+3,y:i+u-2,fontSize:l.labelSize,fill:l.labelColor,fontFamily:"system-ui, sans-serif",children:[n,E?" "+E:""]})]},n)}),N&&t("g",{transform:`translate(${c+24}, ${u+24})`,children:[e("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),X.foregroundGraphics]})},[ge,be,N,E,D,ce,X.foregroundGraphics]),xe=Mo(U,r.width,r.height),we=xe?null:So(s,r.width,r.height,Z);Co("DistanceCartogram",te,"xAccessor",h),Co("DistanceCartogram",te,"yAccessor",f);const Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:x},null!=s&&{points:te}),he&&{lines:he,lineDataAccessor:"coordinates"}),{xAccessor:h,yAccessor:f,pointIdAccessor:g,pointStyle:ae,projectionTransform:de}),z&&{transition:{duration:z}}),null!=w&&{graticule:w}),null!=A&&{fitPadding:A}),ee&&{zoomable:!0}),j&&{zoomExtent:j}),O&&{onZoom:O}),null!=S&&{dragRotate:S}),M&&{tileURL:M}),C&&{tileAttribution:C}),$&&{tileCacheSize:$}),{size:[r.width,r.height],margin:ce,enableHover:!0,tooltipContent:!1===I?()=>null:kn(I)||pe}),le&&{legend:le,legendPosition:ue}),(H||q||G)&&{customHoverBehavior:oe}),(q||G)&&{customClickBehavior:re}),T&&T.length>0&&{annotations:T}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),_&&{className:_}),null!=n.animate&&{animate:n.animate}),X),ve&&{foregroundGraphics:ve});return xe||we||e(ko,{componentName:"DistanceCartogram",width:r.width,height:r.height,children:e(bn,Object.assign({ref:fe},Ae))})});function Fo(e,t,n){const{featureKey:o,dataKey:r}=n,i=new Map;for(const e of t)i.set(e[r]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=null==n?void 0:n[e];return(null!=n?n:"")+""})(e),n=i.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})}_o.displayName="DistanceCartogram";export{Eo as ChoroplethMap,_o as DistanceCartogram,Wo as FlowMap,To as ProportionalSymbolMap,bn as StreamGeoFrame,Fo as mergeData,Ro as resolveReferenceGeography};