semiotic 3.0.1 → 3.1.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 (129) hide show
  1. package/CLAUDE.md +227 -27
  2. package/README.md +147 -11
  3. package/ai/dist/componentRegistry.js +5 -0
  4. package/ai/dist/mcp-server.js +305 -30
  5. package/ai/examples.md +358 -18
  6. package/ai/schema.json +64 -2
  7. package/ai/system-prompt.md +50 -12
  8. package/dist/components/Legend.d.ts +7 -1
  9. package/dist/components/charts/geo/ChoroplethMap.d.ts +53 -0
  10. package/dist/components/charts/geo/DistanceCartogram.d.ts +90 -0
  11. package/dist/components/charts/geo/FlowMap.d.ts +83 -0
  12. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +67 -0
  13. package/dist/components/charts/geo/index.d.ts +8 -0
  14. package/dist/components/charts/index.d.ts +2 -0
  15. package/dist/components/charts/network/ChordDiagram.d.ts +6 -5
  16. package/dist/components/charts/network/CirclePack.d.ts +2 -2
  17. package/dist/components/charts/network/ForceDirectedGraph.d.ts +9 -7
  18. package/dist/components/charts/network/OrbitDiagram.d.ts +21 -20
  19. package/dist/components/charts/network/SankeyDiagram.d.ts +6 -5
  20. package/dist/components/charts/network/TreeDiagram.d.ts +2 -2
  21. package/dist/components/charts/network/Treemap.d.ts +2 -2
  22. package/dist/components/charts/ordinal/BarChart.d.ts +7 -5
  23. package/dist/components/charts/ordinal/BoxPlot.d.ts +8 -6
  24. package/dist/components/charts/ordinal/DonutChart.d.ts +8 -6
  25. package/dist/components/charts/ordinal/DotPlot.d.ts +8 -6
  26. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +7 -5
  27. package/dist/components/charts/ordinal/Histogram.d.ts +8 -5
  28. package/dist/components/charts/ordinal/PieChart.d.ts +8 -6
  29. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +2 -0
  30. package/dist/components/charts/ordinal/StackedBarChart.d.ts +7 -5
  31. package/dist/components/charts/ordinal/SwarmPlot.d.ts +8 -6
  32. package/dist/components/charts/ordinal/ViolinPlot.d.ts +8 -5
  33. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +24 -6
  34. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +28 -7
  35. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +23 -5
  36. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +24 -6
  37. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +23 -5
  38. package/dist/components/charts/shared/ChartError.d.ts +3 -1
  39. package/dist/components/charts/shared/colorUtils.d.ts +5 -0
  40. package/dist/components/charts/shared/hooks.d.ts +13 -1
  41. package/dist/components/charts/shared/legendUtils.d.ts +2 -3
  42. package/dist/components/charts/shared/statisticalOverlays.d.ts +1 -2
  43. package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +10 -0
  44. package/dist/components/charts/shared/tooltipUtils.d.ts +1 -1
  45. package/dist/components/charts/shared/types.d.ts +10 -4
  46. package/dist/components/charts/shared/useChartSetup.d.ts +112 -0
  47. package/dist/components/charts/shared/useStreamingLegend.d.ts +65 -0
  48. package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
  49. package/dist/components/charts/xy/AreaChart.d.ts +11 -6
  50. package/dist/components/charts/xy/BubbleChart.d.ts +11 -6
  51. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -6
  52. package/dist/components/charts/xy/Heatmap.d.ts +16 -5
  53. package/dist/components/charts/xy/LineChart.d.ts +21 -5
  54. package/dist/components/charts/xy/MinimapChart.d.ts +3 -0
  55. package/dist/components/charts/xy/QuadrantChart.d.ts +120 -0
  56. package/dist/components/charts/xy/Scatterplot.d.ts +9 -6
  57. package/dist/components/charts/xy/StackedAreaChart.d.ts +11 -6
  58. package/dist/components/geo/mergeData.d.ts +18 -0
  59. package/dist/components/geo/referenceGeography.d.ts +10 -0
  60. package/dist/components/geo/useReferenceAreas.d.ts +13 -0
  61. package/dist/components/realtime/RingBuffer.d.ts +1 -0
  62. package/dist/components/realtime/types.d.ts +17 -0
  63. package/dist/components/semiotic-data.d.ts +1 -0
  64. package/dist/components/semiotic-geo.d.ts +16 -0
  65. package/dist/components/semiotic-server.d.ts +1 -1
  66. package/dist/components/semiotic-xy.d.ts +1 -0
  67. package/dist/components/semiotic.d.ts +4 -4
  68. package/dist/components/server/renderToStaticSVG.d.ts +4 -2
  69. package/dist/components/stream/AccessibleDataTable.d.ts +50 -0
  70. package/dist/components/stream/CanvasHitTester.d.ts +8 -2
  71. package/dist/components/stream/DataSourceAdapter.d.ts +33 -4
  72. package/dist/components/stream/GeoCanvasHitTester.d.ts +19 -0
  73. package/dist/components/stream/GeoParticlePool.d.ts +46 -0
  74. package/dist/components/stream/GeoPipelineStore.d.ts +81 -0
  75. package/dist/components/stream/GeoTileRenderer.d.ts +31 -0
  76. package/dist/components/stream/NetworkPipelineStore.d.ts +16 -4
  77. package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -1
  78. package/dist/components/stream/OrdinalPipelineStore.d.ts +8 -4
  79. package/dist/components/stream/OrdinalSVGOverlay.d.ts +23 -1
  80. package/dist/components/stream/PipelineStore.d.ts +57 -5
  81. package/dist/components/stream/SVGOverlay.d.ts +28 -1
  82. package/dist/components/stream/SceneGraph.d.ts +7 -3
  83. package/dist/components/stream/SceneToSVG.d.ts +2 -0
  84. package/dist/components/stream/StreamGeoFrame.d.ts +4 -0
  85. package/dist/components/stream/accessorUtils.d.ts +1 -0
  86. package/dist/components/stream/canvasSetup.d.ts +26 -0
  87. package/dist/components/stream/geoTypes.d.ts +186 -0
  88. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +0 -7
  89. package/dist/components/stream/layouts/index.d.ts +2 -1
  90. package/dist/components/stream/layouts/orbitLayoutPlugin.d.ts +2 -0
  91. package/dist/components/stream/legendRenderer.d.ts +33 -0
  92. package/dist/components/stream/networkTypes.d.ts +49 -1
  93. package/dist/components/stream/ordinalTypes.d.ts +10 -0
  94. package/dist/components/stream/pipelineTransitionUtils.d.ts +42 -0
  95. package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +9 -0
  96. package/dist/components/stream/renderers/heatmapCanvasRenderer.d.ts +2 -1
  97. package/dist/components/stream/renderers/lineCanvasRenderer.d.ts +1 -0
  98. package/dist/components/stream/renderers/renderPulse.d.ts +50 -0
  99. package/dist/components/stream/types.d.ts +77 -3
  100. package/dist/components/types/legendTypes.d.ts +27 -3
  101. package/dist/geo.min.js +1 -0
  102. package/dist/geo.module.min.js +1 -0
  103. package/dist/network.min.js +1 -1
  104. package/dist/network.module.min.js +1 -1
  105. package/dist/ordinal.min.js +1 -1
  106. package/dist/ordinal.module.min.js +1 -1
  107. package/dist/realtime.min.js +1 -1
  108. package/dist/realtime.module.min.js +1 -1
  109. package/dist/semiotic-ai-statisticalOverlays-C1f7TYyD.js +1 -0
  110. package/dist/semiotic-ai.min.js +1 -1
  111. package/dist/semiotic-ai.module.min.js +1 -1
  112. package/dist/semiotic-data.d.ts +1 -0
  113. package/dist/semiotic-data.min.js +1 -1
  114. package/dist/semiotic-data.module.min.js +1 -1
  115. package/dist/semiotic-geo.d.ts +16 -0
  116. package/dist/semiotic-server.d.ts +1 -1
  117. package/dist/semiotic-statisticalOverlays-C1f7TYyD.js +1 -0
  118. package/dist/semiotic-xy.d.ts +1 -0
  119. package/dist/semiotic.d.ts +4 -4
  120. package/dist/semiotic.min.js +1 -1
  121. package/dist/semiotic.module.min.js +1 -1
  122. package/dist/server.min.js +1 -1
  123. package/dist/server.module.min.js +1 -1
  124. package/dist/test-utils/canvasMock.d.ts +3 -0
  125. package/dist/xy-statisticalOverlays-C1f7TYyD.js +1 -0
  126. package/dist/xy.min.js +1 -1
  127. package/dist/xy.module.min.js +1 -1
  128. package/package.json +76 -8
  129. package/dist/test/canvasMock.d.ts +0 -2
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react"),t=require("d3-geo"),n=require("d3-scale"),o=require("d3-array"),r=require("d3-hierarchy"),i=require("d3-shape"),a=require("regression"),s=require("d3-zoom"),l=require("d3-selection"),c=require("d3-scale-chromatic");function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const p=d(e),h=u(a);class g{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function f(e,t,n){return e+(t-e)*n}const y={mercator:t.geoMercator,equalEarth:t.geoEqualEarth,albersUsa:t.geoAlbersUsa,orthographic:t.geoOrthographic,naturalEarth:t.geoNaturalEarth1,equirectangular:t.geoEquirectangular};function m(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function b(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function v(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):n}const x={fill:"#e0e0e0",stroke:"#999",strokeWidth:.5,fillOpacity:1},k={fill:"#4e79a7",r:4,fillOpacity:.8},w={stroke:"#4e79a7",strokeWidth:1.5,fill:"none"};function A(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 j(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 E(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 O(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 S{constructor(e){this.scene=[],this.scales=null,this.version=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.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 g(e),this.timestampBuffer=new g(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}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this.version++}computeScene(e){const{config:n}=this;this.projection=function(e){if(!e)return t.geoEqualEarth();if("string"==typeof e){const n=y[e];return n?n():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),t.geoEqualEarth())}if("object"==typeof e&&"type"in e){const n=y[e.type],o=n?n():t.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(n.projection),this.geoPath=t.geoPath(this.projection),this.fitProjection(e),this.geoPath=t.geoPath(this.projection);const o=this.projection;this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null};const r=this.scene;this.scene=this.buildSceneNodes(e),n.projectionTransform&&this.applyCartogramTransform(n.projectionTransform,e),n.decay&&this.streaming&&this.applyDecay(),n.pulse&&this.streaming&&this.applyPulse(),n.transition&&r.length>0&&this.startTransition(r),this.version++}fitProjection(e){var t,n,o,r,i;const a=this.projection,s=this.config,l=[...this.areas],c=m(s.xAccessor,"lon"),u=m(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=b(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,n){const o=this.projection;o&&(o.scale(this.baseScale*e.k),o.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=t.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}applyZoomScale(e,n){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=t.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}applyRotation(e,n){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=t.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),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}buildSceneNodes(e){var n,o,r;const i=[],{config:a}=this,s=this.projection,l=this.geoPath,c=m(a.xAccessor,"lon"),u=m(a.yAccessor,"lat");if(a.graticule){const n=!0===a.graticule?{}:a.graticule,o=t.geoGraticule();n.step&&o.step(n.step);const r=l(o())||"";r&&i.push({type:"geoarea",pathData:r,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:n.stroke||"#e0e0e0",strokeWidth:n.strokeWidth||.5,strokeDasharray:n.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=l(e);if(!t)continue;const n=l.centroid(e),o=l.bounds(e),r=l.area(e),s=v(a.areaStyle,e,x);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:r,style:s,datum:e,interactive:!0})}const d=b(a.lineDataAccessor);for(const n of this.lineData){const o=d(n);if(!o||2>o.length)continue;const r=o.map(e=>[c(e),u(e)]);let l;if("geo"===a.lineType){const e=[];for(let n=0;r.length-1>n;n++){const o=r[n],i=r[n+1],a=t.geoDistance(o,i)||0,s=Math.max(2,Math.ceil(a/(Math.PI/180))),l=t.geoInterpolate(o,i);for(let t=0;s>=t;t++)n>0&&0===t||e.push(l(t/s))}l=e.map(([e,t])=>s([e,t])).filter(e=>null!=e)}else l=r.map(([e,t])=>s([e,t])).filter(e=>null!=e);if(2>l.length)continue;const p=v(a.lineStyle,n,w),h="number"==typeof p.strokeWidth?p.strokeWidth:1;2!==r.length||2>l.length||"arc"!==a.flowStyle?2!==r.length||2>l.length||"offset"!==a.flowStyle||(l="geo"===a.lineType?E(l,h):O(l[0],l[l.length-1],0,0,h)):l=j(l[0],l[l.length-1]);const g=A(l,e.width);if(g.length>1)for(const e of g){if(2>e.length)continue;const t={type:"line",path:e,style:Object.assign(Object.assign({},p),{_edgeFade:!0}),datum:n};i.push(t)}else i.push({type:"line",path:2>l.length&&g[0]||l,style:p,datum:n})}const p=this.getPoints(),h=a.pointIdAccessor?"function"==typeof a.pointIdAccessor?a.pointIdAccessor:e=>e[a.pointIdAccessor]:null,g=s.clipAngle&&null!==(n=s.clipAngle())&&void 0!==n?n:0,f=g>0?g*Math.PI/180:null,y=s.rotate?s.rotate():[0,0,0],S="function"==typeof s.center?s.center():[0,0],M=[(null!==(o=S[0])&&void 0!==o?o:0)-y[0],(null!==(r=S[1])&&void 0!==r?r:0)-y[1]];for(let e=0;p.length>e;e++){const n=p[e],o=c(n),r=u(n);if(null!=f&&t.geoDistance([o,r],M)>f)continue;const l=s([o,r]);if(!l)continue;const d=a.pointStyle?a.pointStyle(n):Object.assign({},k),g={type:"point",x:l[0],y:l[1],r:d.r||4,style:d,datum:n,pointId:h?h(n)+"":void 0};i.push(g)}return i}applyCartogramTransform(e,t){var o,r,i;const a=this.scene.filter(e=>"point"===e.type);if(2>a.length)return;const s=null!==(o=e.strength)&&void 0!==o?o:1;if(0===s)return;const l=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,c="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],u=a.find(t=>l(t.datum)+""==e.center+"");if(!u)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const d=u.x,p=u.y,h=a.map(e=>c(e.datum)).filter(e=>isFinite(e)&&e>=0),g=Math.max(...h,1),f=Math.min(t.width,t.height)/2,y=n.scaleLinear().domain([0,g]).range([0,f]);this.cartogramLayout={cx:d,cy:p,maxCost:g,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 a){if(e===u)continue;const t=Math.atan2(e.y-p,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-p,2)),o=c(e.datum),r=n+((isFinite(o)?y(o):n)-n)*s;e.x=d+Math.cos(t)*r,e.y=p+Math.sin(t)*r}const m=t.width/2,b=t.height/2,v=m-u.x,x=b-u.y;if(Math.abs(v)>.5||Math.abs(x)>.5)for(const e of a)e.x+=v,e.y+=x;this.cartogramLayout={cx:m,cy:b,maxCost:g,availableRadius:f};const k=this.scene.filter(e=>"line"===e.type);if(k.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of a)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of k){const n=null===(r=t.datum)||void 0===r?void 0:r.source,o=null===(i=t.datum)||void 0===i?void 0:i.target;if(n&&o){const r=e.get(n+""),i=e.get(o+"");r&&i&&(t.path=[r,i])}}}}applyDecay(){var e,t,n;const o=this.config.decay;if(!o||!this.pointBuffer)return;const r=this.pointBuffer.size;if(0===r)return;const i=null!==(e=o.minOpacity)&&void 0!==e?e:.1,a=null!==(t=o.halfLife)&&void 0!==t?t:r/2,s=null!==(n=o.stepThreshold)&&void 0!==n?n:.5*r,l=this.scene.filter(e=>"point"===e.type);for(let e=0;l.length>e;e++){const t=r-1-e;let n;switch(o.type){case"exponential":n=i+Math.pow(.5,t/a)*(1-i);break;case"step":n=s>t?1:i;break;default:n=i+(r>1?1-t/(r-1):1)*(1-i)}l[e]._decayOpacity=n,l[e].style=Object.assign(Object.assign({},l[e].style),{opacity:n})}}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=f(e.x,e._targetX,n),e.y=f(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 M(e,t,n,o,r,i){const a=e.filter(e=>"point"===e.type);let s=null,l=o;for(const e of a){const o=e.x-t,r=e.y-n,i=Math.sqrt(o*o+r*r);(e.r||4)+4>=i&&l>i&&(s=e,l=i)}if(s)return{node:s,distance:l};const c=e.filter(e=>"geoarea"===e.type&&!1!==e.interactive);for(let e=c.length-1;e>=0;e--){const o=c[e],[[i,a],[s,l]]=o.bounds;if(!(i>t||t>s||a>n||n>l)&&(o._cachedPath2D||(o._cachedPath2D=new Path2D(o.pathData)),r.isPointInPath(o._cachedPath2D,t,n)))return{node:o,distance:0}}const u=e.filter(e=>"line"===e.type);let d=null,p=o;for(const e of u){const{path:o}=e;for(let r=0;o.length-1>r;r++){const[i,a]=o[r],[s,l]=o[r+1],c=C(t,n,i,a,s,l);Math.max((e.style.strokeWidth||2)+4,5)>=c&&p>c&&(d=e,p=c)}}return d?{node:d,distance:p}:null}function C(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))}const P={fill:e=>p.createElement("rect",{style:e,width:16,height:16}),line:e=>p.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function $(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,P[n])(o(e,t)),r}function z(){return p.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function L(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function R({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+p.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(p.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return p.createElement("g",{"aria-label":i||"Gradient legend"},p.createElement("defs",null,p.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},c)),i&&p.createElement("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),p.createElement("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),p.createElement("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])),p.createElement("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])))}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(p.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return p.createElement("g",{"aria-label":i||"Gradient legend"},i&&p.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),p.createElement("defs",null,p.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},c)),p.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),p.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])),p.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])))}function D(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical"}=e,[d,h]=p.useState(0),[g,f]=p.useState(0),y=p.useCallback((e,t)=>{h(e),f(t)},[]),m="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c})=>{let u=24;const d=[];return e.forEach((e,h)=>{u+=5,d.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+h,stroke:"gray",x1:0,y1:u,x2:t,y2:u})),u+=8,e.label&&(u+=16,d.push(p.createElement("text",{key:"legend-text-"+h,y:u,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label)),u+=8),d.push(p.createElement("g",{key:"legend-group-"+h,className:"legend-item",transform:`translate(0,${u})`},((e,t,n,o,r,i,a,s,l,c)=>{const{type:u="fill",styleFn:d,items:h}=e,g=[];let f=0;const y=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return h.forEach((e,c)=>{const b=$(e,c,u,d),v=L(e,o,r),x=r&&r.size>0&&r.has(e.label);g.push(p.createElement("g",{key:"legend-item-"+c,transform:`translate(0,${f})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?s===i&&c===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+h.length)%h.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},y&&p.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&p.createElement(z,null),p.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),f+=22}),g})(e,n,o,r,i,a,s,h,l,c))),u+=22*e.items.length+8}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:a}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=0;const h=[];e.forEach((e,t)=>{let n=0;e.label&&(n+=16);const g=((e,t,n,o,r,i,a,s,l,c)=>{const{type:u="fill",styleFn:d,items:h}=e,g=[];let f=0;const y=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return h.forEach((e,c)=>{const b=$(e,c,u,d),v=L(e,o,r),x=r&&r.size>0&&r.has(e.label);g.push(p.createElement("g",{key:"legend-item-"+c,transform:`translate(${f},0)`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?s===i&&c===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(c+("ArrowRight"===n.key?1:-1)+h.length)%h.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},y&&p.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&p.createElement(z,null),p.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),f+=26+7*e.label.length}),{items:g,offset:f}})(e,o,r,i,a,s,l,t,c,u);n+=g.offset+5,h.push(Object.assign(Object.assign({label:e.label},g),{offset:n})),d+=n+12});let g=Math.max(0,(n-d)/2);const f=[];return h.forEach((n,o)=>{const r=e[o];r.label&&(f.push(p.createElement("text",{key:"legend-text-"+o,transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),g+=16),f.push(p.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${g},0)`},n.items)),g+=n.offset+5,e[o+1]&&f.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:g,y1:-8,x2:g,y2:t+0+8})),g+=12}),p.createElement("g",null,f)})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:a}),b=!(!n&&!o);return p.createElement("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend"},void 0!==s&&""!==s&&"vertical"===u&&p.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},s),m)}function I(e){return"string"==typeof e?{type:e}:e}function B({orient:t,config:n,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}}(n),c="top"===t||"bottom"===t,u=e.useMemo(()=>{if(0===r.length)return null;const e=i.domain(),n=a-8;if("boxplot"===l.type){const e=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(!e)return null;const{q1:o,median:a,q3:s,whiskerLow:u,whiskerHigh:d}=e,h=Math.min(.5*n,20),g=(n-h)/2+4;if(c){const e=i(o),n=i(s),r=i(a),c=i(u),f=i(d),y="top"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:c,y1:m+y*(g+h/2),x2:f,y2:m+y*(g+h/2),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:c,y1:m+y*g,x2:c,y2:m+y*(g+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:f,y1:m+y*g,x2:f,y2:m+y*(g+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:Math.min(e,n),y:"top"===t?m-g-h:m+g,width:Math.abs(n-e),height:h,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:r,y1:"top"===t?m-g-h:m+g,x2:r,y2:"top"===t?m-g:m+g+h,stroke:l.fill,strokeWidth:2}))}{const e=i(o),n=i(s),r=i(a),c=i(u),f=i(d),y="left"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:m+y*(g+h/2),y1:c,x2:m+y*(g+h/2),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+y*g,y1:c,x2:m+y*(g+h),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+y*g,y1:f,x2:m+y*(g+h),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:"left"===t?m-g-h:m+g,y:Math.min(e,n),width:h,height:Math.abs(n-e),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:"left"===t?m-g-h:m+g,y1:r,x2:"left"===t?m-g:m+g+h,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=o.bin().domain(e).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 p.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((e,o)=>{if(null==e.x0||null==e.x1)return null;const r=e.length/d*n;if(c){const n=i(e.x0),a=i(e.x1)-i(e.x0);return p.createElement("rect",{key:o,x:n,y:"top"===t?-4-r:4,width:Math.max(a,.5),height:r,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const n=i(e.x0),a=i(e.x1)-i(e.x0);return p.createElement("rect",{key:o,x:"left"===t?-4-r:4,y:Math.min(n,n+a),width:r,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const e=n/2+4,o=[];for(const r of u){if(null==r.x0||null==r.x1)continue;const a=r.length/d*(n/2),s=i((r.x0+r.x1)/2);o.push(c?`${s},${"top"===t?-(e-a):e-a}`:`${"left"===t?-(e-a):e-a},${s}`)}for(let r=u.length-1;r>=0;r--){const a=u[r];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(n/2),l=i((a.x0+a.x1)/2);o.push(c?`${l},${"top"===t?-(e+s):e+s}`:`${"left"===t?-(e+s):e+s},${l}`)}return p.createElement("g",{"data-testid":"marginal-violin-"+t},p.createElement("polygon",{points:o.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const e=[];if(c){const o=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${r},${o}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,a=i((o.x0+o.x1)/2);e.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;e.push(`L${a},${o}`),e.push("Z")}else{const o=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${o},${r}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,a=i((o.x0+o.x1)/2);e.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;e.push(`L${o},${a}`),e.push("Z")}return p.createElement("g",{"data-testid":"marginal-ridgeline-"+t},p.createElement("path",{d:e.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?p.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function N(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 W(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 T(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:g,events:f={},"data-testid":y}=e,m=new Set(Array.isArray(g)?g:[]);let b=o||0,v=r||0;null!=i&&(b=i-t),null!=a&&(v=a-n);const x="string"==typeof u?u:"label";if("bracket"===x&&c&&0===b&&0===v)if(void 0!==c.width){b=c.width/2;const e=c.depth||30;v=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;b=e+(0>e?-5:5),v=c.height/2}return p.createElement("g",Object.assign({className:("annotation "+(h||"")).trim(),transform:`translate(${t},${n})`,"data-testid":y},f),!m.has("connector")&&function(e,t,n,o,r,i){const a=[];let s=0,l=0;if("callout-circle"!==r&&"label"!==r||!(null==i?void 0:i.radius)){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=o/2,p=e*d>t*u?u/e:d/t;s=r+a*p,l=i+c*p}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);s=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-s,2)+Math.pow(t-l,2))>.5&&(a.push(p.createElement("line",{key:"connector-line",x1:s,y1:l,x2:e,y2:t,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,i=Math.atan2(t-l,e-s);a.push(p.createElement("path",{key:"connector-arrow",d:`M${s},${l}L${s+n*Math.cos(i+r)},${l+n*Math.sin(i+r)}L${s+n*Math.cos(i-r)},${l+n*Math.sin(i-r)}Z`,fill:o||"currentColor",stroke:"none"}))}return p.createElement("g",{className:"annotation-connector"},a)}(b,v,l,d,x,c),!m.has("subject")&&function(e,t,n,o,r){var i;const a=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&a.push(p.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&a.push(p.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&a.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,i=r||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;a.push(p.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;a.push(p.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?a.push(p.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||a.push(p.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&a.push(p.createElement("path",{key:"bracket-path",d:W((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"currentColor"}));break}}return p.createElement("g",{className:"annotation-subject"},a)}(x,c,d,t,n),!m.has("note")&&function(e,t,n,o){if(!e)return p.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return p.createElement("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const g=16,f=i?c?[i]:N(i,l):[],y=r?c?[r]:N(r,l):[],m="leftRight"===u?"end"===h?-4:4:0;let b=0;const v=[];f.length>0&&(v.push(p.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:h,fontWeight:"bold"},f.map((e,t)=>p.createElement("tspan",{key:t,x:m,dy:0===t?0:g},e)))),b=f.length*g),y.length>0&&v.push(p.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:h,y:b},y.map((e,t)=>p.createElement("tspan",{key:t,x:m,dy:0===t?0:g},e))));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=p.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(f.length+y.length)*g+(y.length>0?g:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=p.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const k=Math.max(0,f.length+y.length-1)*g;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===d?-(k+g+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===d||0>n?-(k+2):18),p.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},p.createElement("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0},v),x)}(s,b,v,d))}function _(e){var t,n;const{noteData:o}=e,{screenCoordinates:r}=o,i="string"==typeof o.type?o.type:"label",a=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),a=o.ny||r[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),s=r.map((t,n)=>{const r=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:a});return p.createElement(T,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return p.createElement("g",null,s)}const s=o.note||{title:"none",label:o.label};return p.createElement(T,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${o.i}`,events:a},o,{type:i}))}const H={linear:i.curveLinear,monotoneX:i.curveMonotoneX,monotoneY:i.curveMonotoneY,step:i.curveStep,stepAfter:i.curveStepAfter,stepBefore:i.curveStepBefore,basis:i.curveBasis,cardinal:i.curveCardinal,catmullRom:i.curveCatmullRom};function F(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 q(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 G(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=F(e,n),c=q(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 V(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Z(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 U(e){return Math.round(100*e)/100+""}function Y(e,t){return e instanceof Date&&(!(t&&t instanceof Date)||e.getFullYear()!==t.getFullYear()||e.getMonth()!==t.getMonth()||e.getDate()!==t.getDate())}function X(t){var n,o;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:g,axes:f,xLabel:y,yLabel:m,xFormat:b,yFormat:v,showGrid:x,title:k,legend:w,legendHoverBehavior:A,legendClickBehavior:j,legendHighlightedCategory:E,legendIsolatedCategories:O,legendPosition:S="right",foregroundGraphics:M,marginalGraphics:C,xValues:P,yValues:$,annotations:z,svgAnnotationRules:L,xAccessor:N,yAccessor:W,annotationData:T,pointNodes:X,curve:K,underlayRendered:J,children:Q}=t,ee=e.useMemo(()=>{var e;if(!g||!d)return[];const t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||U,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return d.x.ticks(Math.min(o,Math.max(2,Math.floor(a/70)))).map(e=>({value:e,pixel:d.x(e),label:n(e)}))},[g,d,f,b,a]),te=e.useMemo(()=>{var e;if(!g||!d)return[];const t=null==f?void 0:f.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||v||U,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)}))},[g,d,f,v,s]),ne=e.useRef(new Map),oe=e.useRef(null!==(n=null==z?void 0:z.length)&&void 0!==n?n:0),re=null!==(o=null==z?void 0:z.length)&&void 0!==o?o:0;oe.current!==re&&(oe.current=re,ne.current=new Map);const ie=e.useMemo(()=>{if(!z||0===z.length)return null;const e=function(e,t,n){var o,a,s,l,c,u,d,g,f,y,m,b,v,x,k,w,A,j,E,O,S,M,C,P,$,z,L,R,D,I,B,N,W,T,Z,U,Y,X,K,J,Q,ee,te,ne;switch(e.type){case"label":{const o=G(e,t,n);if(!o)return null;const{x:r,y:i}=o;return V(r,i,n)?p.createElement(_,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{const o=G(e,t,n);if(!o)return null;const{x:r,y:i}=o;return V(r,i,n)?p.createElement(_,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=F(e,n);if(null==o)return null;const r=e.color||"#f97316";return p.createElement("g",{key:"ann-"+t},p.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:o+4,y:12,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=q(e,n);if(null==o)return null;const r=e.color||"#f97316";return p.createElement("g",{key:"ann-"+t},p.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:o-4,textAnchor:"end",fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:F(Object.assign(Object.assign({},e),{type:"point"}),n),y:q(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const i=r.packEnclose(o),a=e.padding||10;return p.createElement("g",{key:"ann-"+t},p.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&p.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:F(Object.assign(Object.assign({},e),{type:"point"}),n),y:q(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=e.padding||10,i=o.map(e=>e.x),a=o.map(e=>e.y),s=Math.min(...i)-r,l=Math.max(...i)+r,c=Math.min(...a)-r,u=Math.max(...a)+r;return p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:s,y:c,width:l-s,height:u-c,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&p.createElement("text",{x:(s+l)/2,y:c-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i=e.style||{stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return p.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=F(t,n),a=q(t,n);return null==r||null==a?null:p.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:a,r:e.r||6},i))}))}case"bracket":{const o=F(e,n),r=q(e,n);return p.createElement(_,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=r?r:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const r=n.data||[];if(2>r.length)return null;const i=n.xAccessor||"x",g=n.yAccessor||"y",f=r.map(e=>[e[i],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(a=null===(o=n.scales)||void 0===o?void 0:o.x)&&void 0!==a?a:null===(s=n.scales)||void 0===s?void 0:s.time,m=null!==(c=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=n.scales)||void 0===u?void 0:u.value;if(!y||!m)return null;const b=e.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]),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,g=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],g+=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*g-d*p)/f;s.push([t,(p-e*d)/u+e*t])}}return s}(f,null!==(d=e.bandwidth)&&void 0!==d?d:.3):("polynomial"===b?h.default.polynomial(f,{order:e.order||2}):h.default.linear(f)).points;const x=v.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),k=e.color||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("polyline",{points:x,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:y(v[v.length-1][0])+4,y:m(v[v.length-1][1])-4,fill:k,fontSize:11},e.label))}case"band":{const o=null!==(f=null===(g=n.scales)||void 0===g?void 0:g.y)&&void 0!==f?f:null===(y=n.scales)||void 0===y?void 0:y.value,r=null!==(m=null==o?void 0:o(e.y0))&&void 0!==m?m:0,i=null!==(b=null==o?void 0:o(e.y1))&&void 0!==b?b:n.height||0;return p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity||.1}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:Math.min(r,i)-4,textAnchor:"end",fill:e.color||"#6366f1",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",a=null!==(x=null===(v=n.scales)||void 0===v?void 0:v.x)&&void 0!==x?x:null===(k=n.scales)||void 0===k?void 0:k.time,s=null!==(A=null===(w=n.scales)||void 0===w?void 0:w.y)&&void 0!==A?A:null===(j=n.scales)||void 0===j?void 0:j.value;if(!a||!s)return null;const l=e.upperAccessor||"upperBounds",c=e.lowerAccessor||"lowerBounds",u=e.filter,d=o.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[r]-t[r]);if(2>d.length)return null;const h=H[n.curve||"linear"]||i.curveLinear,g=i.area().x(e=>a(e[r])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!g)return null;const f=e.fill||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("path",{d:g,fill:f,fillOpacity:null!==(E=e.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.label&&d.length>0&&p.createElement("text",{x:a(d[d.length-1][r])+4,y:s(d[d.length-1][l])-4,fill:f,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(S=null===(O=n.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(M=n.scales)||void 0===M?void 0:M.time,a=null!==(P=null===(C=n.scales)||void 0===C?void 0:C.y)&&void 0!==P?P:null===($=n.scales)||void 0===$?void 0:$.value;if(!i||!a)return null;const s=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+Math.pow(t-l,2),0)/s.length,u=Math.sqrt(c),d=null!==(z=e.threshold)&&void 0!==z?z:2,h=l-d*u,g=!1!==e.showBand,f=e.fill||"#6366f1",y=null!==(L=e.fillOpacity)&&void 0!==L?L:.1,m=e.anomalyColor||"#ef4444",b=null!==(R=e.anomalyRadius)&&void 0!==R?R:6,v=a(l+d*u),x=a(h),k=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return p.createElement("g",{key:"ann-"+t},g&&p.createElement("rect",{x:0,y:Math.min(v,x),width:n.width||0,height:Math.abs(x-v),fill:f,fillOpacity:y}),k.map((e,t)=>{const o=F(e,n),r=q(e,n);return null==o||null==r?null:p.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:Math.min(v,x)-4,textAnchor:"end",fill:f,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",a=null!==(I=null===(D=n.scales)||void 0===D?void 0:D.x)&&void 0!==I?I:null===(B=n.scales)||void 0===B?void 0:B.time,s=null!==(W=null===(N=n.scales)||void 0===N?void 0:N.y)&&void 0!==W?W:null===(T=n.scales)||void 0===T?void 0:T.value;if(!a||!s)return null;const l=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=h.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)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;c=e=>s+a*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(d/Math.max(u-2,1)),f=l.reduce((e,t)=>e+t[0],0)/u,y=l.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(Z=e.confidence)&&void 0!==Z?Z:.95,b=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,v=null!==(U=e.steps)&&void 0!==U?U:5,x=l[u-1][0],k=(x-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;v>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=c(e),n=g*Math.sqrt(1+1/u+(y>0?Math.pow(e-f,2)/y:0))*b;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${A.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,E=A.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),O=`${a(x)},${s(c(x))}`,S=e.strokeColor||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:null!==(Y=e.fillOpacity)&&void 0!==Y?Y:.15,stroke:"none"}),p.createElement("polyline",{points:`${O} ${E}`,fill:"none",stroke:S,strokeWidth:null!==(X=e.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(K=e.strokeDasharray)&&void 0!==K?K:"6,3"}),e.label&&A.length>0&&p.createElement("text",{x:a(A[A.length-1].x)+4,y:s(A[A.length-1].yCenter)-4,fill:S,fontSize:11},e.label))}case"widget":{let o=null,r=null;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=G(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!V(o,r,n))return null;const i=null!==(J=e.dx)&&void 0!==J?J:0,a=null!==(Q=e.dy)&&void 0!==Q?Q:0,s=null!==(ee=e.width)&&void 0!==ee?ee:32,l=null!==(te=e.height)&&void 0!==te?te:32,c=null!==(ne=e.content)&&void 0!==ne?ne:p.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return p.createElement("foreignObject",{key:"ann-"+t,x:o+i-s/2,y:r+a-l/2,width:s,height:l,style:{overflow:"visible",pointerEvents:"auto"}},p.createElement("div",{style:{width:s,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},c))}case"text":{const o=G(e,t,n);if(!o)return null;const{x:r,y:i}=o;return p.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}default:return null}},t={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:N,yAccessor:W,width:a,height:s,data:T,frameType:"xy",pointNodes:X,curve:K,stickyPositionCache:ne.current};return z.map((n,o)=>{if(L){const r=L(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[z,L,a,s,N,W,T,d,X,K]);return g||k||w||M||C||ie&&ie.length>0||x||Q?p.createElement("svg",{role:"img",width:l,height:c,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},p.createElement("title",null,"string"==typeof k?k:"XY Chart"),p.createElement("desc",null,"string"==typeof k?k+" — XY data visualization":"XY data visualization"),p.createElement("g",{transform:`translate(${u.left},${u.top})`},x&&d&&!J&&p.createElement("g",{className:"stream-grid"},ee.map((e,t)=>p.createElement("line",{key:"xgrid-"+t,x1:e.pixel,y1:0,x2:e.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),te.map((e,t)=>p.createElement("line",{key:"ygrid-"+t,x1:0,y1:e.pixel,x2:a,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),g&&d&&(()=>{const e=null==f?void 0:f.find(e=>"left"===e.orient),t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=!e||!1!==e.baseline,o=(null==e?void 0:e.jaggedBase)||!1,r=(null==t?void 0:t.jaggedBase)||!1,i=null==t?void 0:t.landmarkTicks,l=null==e?void 0:e.landmarkTicks,c="var(--semiotic-border, #ccc)",d="var(--semiotic-text-secondary, #666)",h="var(--semiotic-text, #333)";return p.createElement("g",{className:"stream-axes"},!J&&(!t||!1!==t.baseline)&&!r&&p.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:c,strokeWidth:1}),!J&&r&&p.createElement("path",{d:Z("bottom",a,s),fill:"none",stroke:c,strokeWidth:1}),ee.map((e,t)=>{const n=!!i&&("function"==typeof i?i(e.value,t):Y(e.value,t>0?ee[t-1].value:void 0));return p.createElement("g",{key:"xtick-"+t,transform:`translate(${e.pixel},${s})`},p.createElement("line",{y2:5,stroke:c,strokeWidth:1}),p.createElement("text",{y:18,textAnchor:"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:d,style:{userSelect:"none"}},e.label))}),y&&p.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:h,style:{userSelect:"none"}},y),!J&&n&&!o&&p.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:c,strokeWidth:1}),!J&&o&&p.createElement("path",{d:Z("left",a,s),fill:"none",stroke:c,strokeWidth:1}),te.map((e,t)=>{const n=!!l&&("function"==typeof l?l(e.value,t):Y(e.value,t>0?te[t-1].value:void 0));return p.createElement("g",{key:"ytick-"+t,transform:`translate(0,${e.pixel})`},p.createElement("line",{x2:-5,stroke:c,strokeWidth:1}),p.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:d,style:{userSelect:"none"}},e.label))}),m&&p.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:h,transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},m))})(),ie,C&&d&&P&&$&&p.createElement(p.Fragment,null,C.top&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(B,{orient:"top",config:I(C.top),values:P,scale:d.x,size:u.top,length:a})),C.bottom&&p.createElement("g",{transform:`translate(0, ${s})`},p.createElement(B,{orient:"bottom",config:I(C.bottom),values:P,scale:d.x,size:u.bottom,length:a})),C.left&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(B,{orient:"left",config:I(C.left),values:$,scale:d.y,size:u.left,length:s})),C.right&&p.createElement("g",{transform:`translate(${a}, 0)`},p.createElement(B,{orient:"right",config:I(C.right),values:$,scale:d.y,size:u.right,length:s}))),M,Q),k&&p.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof k?k:null),function(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",title:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const h="top"===i||"bottom"===i;let g,f;return"left"===i?(g=4,f=r.top):"top"===i?(g=0,f=a?32:8):"bottom"===i?(g=0,f=o-r.bottom+50):(g=n-r.right+10,f=r.top),p.createElement("g",{transform:`translate(${g}, ${f})`},"object"==typeof(y=t)&&null!==y&&"gradient"in y?p.createElement(R,{config:t.gradient,orientation:h?"horizontal":"vertical",width:h?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?p.createElement(D,{legendGroups:t.legendGroups,title:"",width:h?n:100,orientation:h?"horizontal":"vertical",customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t);var y}({legend:w,totalWidth:l,totalHeight:c,margin:u,legendPosition:S,title:k,legendHoverBehavior:A,legendClickBehavior:j,legendHighlightedCategory:E,legendIsolatedCategories:O})):null}const K="undefined"==typeof window||"undefined"==typeof document,J={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Q(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks"},i=["point","line","area","rect","heatcell","circle","candlestick"],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(", ")}`}function ee({scene:e,chartType:t}){var n,o,r,i;const a=[];for(const t of e){if(a.length>=50)break;"point"===t.type?a.push({label:"Point",values:{x:Math.round(100*t.x)/100+"",y:Math.round(100*t.y)/100+""}}):"rect"===t.type?a.push({label:"Bar",values:{category:(null===(n=t.datum)||void 0===n?void 0:n.category)||"",value:Math.round(100*(null!==(r=null===(o=t.datum)||void 0===o?void 0:o.value)&&void 0!==r?r:0))/100+""}}):"heatcell"===t.type&&a.push({label:"Cell",values:{x:Math.round(100*t.x)/100+"",y:Math.round(100*t.y)/100+"",value:Math.round(100*(null!==(i=t.value)&&void 0!==i?i:0))/100+""}})}if(0===a.length)return null;const s=new Set;for(const e of a)for(const t of Object.keys(e.values))s.add(t);const l=Array.from(s);return p.createElement("table",{style:J,role:"table","aria-label":"Data table for "+t},p.createElement("thead",null,p.createElement("tr",null,l.map(e=>p.createElement("th",{key:e},e)))),p.createElement("tbody",null,a.map((e,t)=>p.createElement("tr",{key:t},l.map(t=>{var n;return p.createElement("td",{key:t},null!==(n=e.values[t])&&void 0!==n?n:"")}))),e.length>50&&p.createElement("tr",null,p.createElement("td",{colSpan:l.length},"...and ",e.length-50," more items"))))}function te({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Focused on data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+n}return p.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:J},t)}function ne(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function oe(e,t,n=.6){var o,r,i,a,s;if(!ne(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 re(e,t,n,o=.35){ne(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function ie(e){switch(e){case"monotoneX":return i.curveMonotoneX;case"monotoneY":return i.curveMonotoneY;case"cardinal":return i.curveCardinal;case"catmullRom":return i.curveCatmullRom;case"step":return i.curveStep;case"stepBefore":return i.curveStepBefore;case"stepAfter":return i.curveStepAfter;case"basis":return i.curveBasis;case"natural":return i.curveNatural;default:return null}}function ae(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 se(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 le(e){return e.k}function ce(e){return[e.x,e.y]}function ue(e){return function(){return e}}function de([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function pe(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 he(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function ge(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 fe{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 ye{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=me(a),l=be(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 me(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 be(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}}function ve(t){const n=e.createContext(null),o=xe(t);return[function({children:o}){const r=e.useMemo(()=>xe(t),[]);return p.createElement(n.Provider,{value:r,children:o})},t=>{var r;const i=null!==(r=e.useContext(n))&&void 0!==r?r:o,a=e.useRef(t);a.current=t;const s=e.useCallback(()=>a.current(i.getState()),[i]),l=e.useCallback(()=>a.current(i.getState()),[i]);return e.useSyncExternalStore(i.subscribe,s,l)}]}function xe(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const ke={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},we={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},[Ae,je]=ve(e=>({theme:ke,setTheme(t){e(e=>"light"===t?{theme:ke}:"dark"===t?{theme:we}:{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})})}})),Ee={top:10,right:10,bottom:10,left:10},Oe={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"},Se={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 Me({data:e}){if(!e)return null;if(e.properties)return p.createElement("div",{className:"semiotic-tooltip",style:Oe},p.createElement("div",{style:{fontWeight:600}},e.properties.name||e.properties.NAME||e.properties.id||"Feature"));const t=Object.entries(e).slice(0,3);return p.createElement("div",{className:"semiotic-tooltip",style:Oe},t.map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,": "),p.createElement("span",{style:{fontWeight:600}},t+""))))}const Ce=e.forwardRef(function(t,n){var o,r,a,c,u,d,h;const{projection:g,projectionExtent:f,fitPadding:y,projectionTransform:m,areas:b,points:v,lines:x,xAccessor:k,yAccessor:w,lineDataAccessor:A,pointIdAccessor:j,lineType:E="geo",flowStyle:O="basic",graticule:C,zoomable:P,zoomExtent:$,onZoom:z,dragRotate:L,showParticles:R,particleStyle:D,tileURL:I,tileAttribution:B,tileCacheSize:N,size:W,width:T,height:_,responsiveWidth:H,responsiveHeight:F,margin:q,className:G,background:V,areaStyle:Z,pointStyle:U,lineStyle:Y,colorScheme:J,enableHover:ne=!0,hoverAnnotation:me,tooltipContent:be,customClickBehavior:ve,customHoverBehavior:xe,annotations:ke,decay:we,pulse:Ae,transition:Oe,staleness:Ce,backgroundGraphics:Pe,foregroundGraphics:$e,title:ze,legend:Le,legendPosition:Re,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:Be,legendIsolatedCategories:Ne,showAxes:We,accessibleTable:Te}=t,_e=W||[T||600,_||400],[He,Fe]=function(t,n,o){const r=e.useRef(null),[i,a]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=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 t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&i?i.w:t[0],o&&i?i.h:t[1]]]}(_e,H,F),qe=e.useMemo(()=>Object.assign(Object.assign({},Ee),q),[q]),Ge=Fe[0]-qe.left-qe.right,Ve=Fe[1]-qe.top-qe.bottom,Ze="function"==typeof $e?$e({size:Fe,margin:qe}):$e,Ue="function"==typeof Pe?Pe({size:Fe,margin:qe}):Pe,Ye=e.useMemo(()=>null!=L?L:"orthographic"===("string"==typeof g?g:"object"==typeof g&&"type"in g?g.type:null),[L,g]),Xe=e.useMemo(()=>({projection:g,projectionExtent:f,fitPadding:y,xAccessor:k,yAccessor:w,lineDataAccessor:A,lineType:E,flowStyle:O,areaStyle:Z,pointStyle:U,lineStyle:Y,colorScheme:J,graticule:C,projectionTransform:m,decay:we,pulse:Ae,transition:Oe,annotations:ke,pointIdAccessor:j}),[g,f,y,k,w,A,E,O,Z,U,Y,J,C,m,we,Ae,Oe,ke,j]),Ke=e.useRef(null);Ke.current||(Ke.current=new S(Xe));const Je=e.useRef(null),Qe=e.useRef(null),et=e.useRef(null),tt=e.useRef(null),nt=e.useRef(null);I&&!nt.current&&(nt.current=new fe(N||256));const ot=e.useRef(0),rt=e.useRef(!0),it=je(e=>e.theme),at=e.useRef(ke),st=e.useRef(()=>{}),lt=e.useRef(null),ct=e.useRef(s.zoomIdentity),ut=e.useRef(!1),dt=e.useRef(null),pt=e.useRef(null),ht=e.useRef(null),gt=e.useRef(null),ft=e.useRef(0);if(R&&!gt.current){const e=null!==(o=null==D?void 0:D.maxPerLine)&&void 0!==o?o:30;gt.current=new ye(50*e)}const yt=e.useRef(null),mt=e.useRef(null),[bt,vt]=e.useState(null),[xt,kt]=e.useState(0),[wt,At]=e.useState(!1),jt=e.useCallback(()=>{ot.current||(ot.current=requestAnimationFrame(()=>st.current()))},[]);e.useEffect(()=>{rt.current=!0,jt()},[it,jt]),e.useEffect(()=>{var e;null===(e=Ke.current)||void 0===e||e.updateConfig(Xe),rt.current=!0,jt()},[Xe,jt]),e.useEffect(()=>{const e=Ke.current;e&&(b&&e.setAreas(b),v&&e.setPoints(v),x&&e.setLines(x),rt.current=!0,jt())},[b,v,x,jt]);const Et=e.useCallback(e=>{var t;null===(t=Ke.current)||void 0===t||t.pushPoint(e),rt.current=!0,jt()},[jt]),Ot=e.useCallback(e=>{var t;null===(t=Ke.current)||void 0===t||t.pushMany(e),rt.current=!0,jt()},[jt]),St=e.useCallback(()=>{var e;null===(e=Ke.current)||void 0===e||e.clear(),rt.current=!0,jt()},[jt]);e.useImperativeHandle(n,()=>({push:Et,pushMany:Ot,clear:St,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=Ke.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=Ke.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=Ke.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>ct.current.k,resetZoom:()=>{const e=dt.current;e&&lt.current&&l.select(e).call(lt.current.transform,s.zoomIdentity)},getData:()=>{const e=Ke.current;return e?e.scene.filter(e=>"point"===e.type).map(e=>e.datum).filter(Boolean):[]}}),[Et,Ot,St]);const Mt=e.useRef(()=>{});e.useEffect(()=>{Mt.current=e=>{if(!ne)return;const t=Ke.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-qe.left,r=e.clientY-n.top-qe.top;if(0>o||o>Ge||0>r||r>Ve)return yt.current=null,mt.current=null,vt(null),null==xe||xe(null),void jt();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=M(t.scene,o,r,30,i);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 i,s;"point"===e.type?(i=e.x,s=e.y):"geoarea"===e.type?(i=e.centroid[0],s=e.centroid[1]):(i=o,s=r);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,x:i,y:s,time:0});yt.current=l,mt.current=e,vt(l),null==xe||xe({type:e.type,data:n,x:i,y:s}),jt()}else yt.current&&(yt.current=null,mt.current=null,vt(null),null==xe||xe(null),jt())}},[ne,Ge,Ve,qe,xe,jt]);const Ct=e.useCallback(e=>Mt.current(e),[]),Pt=e.useCallback(()=>{yt.current=null,mt.current=null,vt(null),null==xe||xe(null),jt()},[xe,jt]),$t=e.useCallback(e=>{if(!ve)return;const t=Ke.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-qe.left,r=e.clientY-n.top-qe.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=M(t.scene,o,r,30,i);if(a){const e=a.node.datum;ve({type:a.node.type,data:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,x:o,y:r})}},[ve,qe]);st.current=()=>{var e,t,n,o,r,a,s;ot.current=0;const l=Qe.current,c=Ke.current;if(!l||!c)return;const u=performance.now();let d=!1;const p=ht.current;p&&(ht.current=null,c.applyRotation(p,{width:Ge,height:Ve}));const h=c.advanceTransition(u);if(rt.current&&!h){const e={width:Ge,height:Ve},t=Ye?c.getRotation():null;c.computeScene(e);const n=ct.current,o=1!==n.k||0!==n.x||0!==n.y;Ye&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),rt.current=!1,l.setAttribute("aria-label",Q(c.scene,"Geographic chart"))}const g=he();if(I&&nt.current){const t=Je.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=pe(t,Fe,qe,g);if(e){e.clearRect(-qe.left,-qe.top,Fe[0],Fe[1]),e.save(),e.beginPath(),e.rect(0,0,Ge,Ve),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=le,l=ce,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)),g=Math.pow(2,p-h)*a,f=+d[0]-u/2,y=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-f)/g)),b=Math.min(r?1<<h:1/0,Math.ceil((n-f)/g)),v=Math.max(i?0:-1/0,Math.floor((t-y)/g)),x=Math.min(i?1<<h:1/0,Math.ceil((o-y)/g)),k=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)k.push([t,e,h]);return k.translate=[f/g,y/g],k.scale=g,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:ue(+e),u):s},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:ue([+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=he();let h=!0;for(const t of d){const[o,r,i]=de(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=ge(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:I,projection:c.scales.projection,width:Ge,height:Ve,tileCache:nt.current,onTileLoad:()=>jt()});e.restore(),t||(d=!0)}}}const f=pe(l,Fe,qe,g);if(!f)return;f.clearRect(-qe.left,-qe.top,Fe[0],Fe[1]),V&&!I&&(f.fillStyle=V,f.fillRect(0,0,Ge,Ve)),f.save(),f.beginPath(),f.rect(0,0,Ge,Ve),f.clip();const y=c.scene,m={height:Ve};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=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)}re(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(f,y),((e,t,n,o)=>{var r,a;const s=t.filter(e=>"line"===e.type);for(const l of s){if(2>l.path.length)continue;const c=l.style.stroke||"#007bff",u=l.style.strokeWidth||2,d=l.colorThresholds,p=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=u,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const y=null!==(r=l.style.opacity)&&void 0!==r?r:1;se(e,l.path,c,u,y,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=ie(l.curve),g=d&&d.length>0&&p&&p.length===l.path.length,f=l._decayOpacities;if(f&&f.length===l.path.length&&!g){e.strokeStyle=c;const m=null!==(a=l.style.opacity)&&void 0!==a?a:1;for(let b=0;l.path.length-1>b;b++)e.globalAlpha=.5*(f[b]+f[b+1])*m,e.beginPath(),e.moveTo(l.path[b][0],l.path[b][1]),e.lineTo(l.path[b+1][0],l.path[b+1][1]),e.stroke()}else if(g){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 E(){A&&(e.stroke(),A=!1)}for(let O=0;l.path.length>O;O++){const[S,M]=l.path[O],C=p[O],P=ae(C,d,c);if(null!==v&&null!==w&&null!==k){if(P===w)e.lineTo(S,M);else{const $=[];for(const z of d){const L=z.value;(k>L||L>C)&&(L>k||C>L)||k===L||C===L||$.push({t:(L-k)/(C-k)})}$.sort((e,t)=>e.t-t.t);for(const R of $){const D=v+(S-v)*R.t,I=x+(M-x)*R.t,B=ae(k+(C-k)*Math.min(R.t+1e-4,1),d,c);e.lineTo(D,I),E(),j(B,D,I)}e.lineTo(S,M)}v=S,x=M,k=C,w=P}else j(P,S,M),v=S,x=M,k=C,w=P}E()}else{if(e.beginPath(),e.strokeStyle=c,h)i.line().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(l.path);else{const[N,W]=l.path[0];e.moveTo(N,W);for(let T=1;l.path.length>T;T++)e.lineTo(l.path[T][0],l.path[T][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=l.style.fill,h&&!g)i.line().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(l.path);else{const[H,F]=l.path[0];e.moveTo(H,F);for(let q=1;l.path.length>q;q++)e.lineTo(l.path[q][0],l.path[q][1])}const _=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(_,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(f,y,0,m),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);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=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),oe(e,t),e.globalAlpha=1}}finally{e.restore()}})(f,y),R&&gt.current){const e=gt.current,i=y.filter(e=>"line"===e.type);if(i.length>0){const s=D||{},l=.3*(null!==(t=s.speedMultiplier)&&void 0!==t?t:1),c=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,g=null!==(a=s.opacity)&&void 0!==a?a:.7,y=u/1e3,m=ft.current>0?Math.min(y-ft.current,.1):.016;ft.current=y;const b=i.map(e=>e.path),v=i.map(e=>e.style.strokeWidth||2);for(let t=0;i.length>t;t++)Math.random()<p&&e.countForLine(t)<c&&e.spawn(t);e.step(m,l,b,v),f.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=i[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,d=!0}}f.restore();const b=et.current;if(b){const e=pe(b,Fe,qe,g);if(e){e.clearRect(-qe.left,-qe.top,Fe[0],Fe[1]);const t=mt.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;e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill(),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(Ce){const e=performance.now()-c.lastIngestTime>(null!==(s=Ce.threshold)&&void 0!==s?s:5e3);e!==wt&&At(e)}const v=ke!==at.current;v&&(at.current=ke),(rt.current||v)&&kt(e=>e+1),(h||c.hasActivePulses||d)&&(ot.current=requestAnimationFrame(()=>st.current()))},e.useEffect(()=>(jt(),()=>{var e;ot.current&&(cancelAnimationFrame(ot.current),ot.current=0),null===(e=nt.current)||void 0===e||e.clear()}),[jt]),e.useEffect(()=>{rt.current=!0,jt()},[Ge,Ve,V,jt]),function(t,n,o,r,i,a){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const s=n.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),o.current=!0,r())},1e3);return()=>clearInterval(e)},[t,i,r])}(Ce,Ke,rt,jt,wt,At),e.useEffect(()=>{if("production"!==process.env.NODE_ENV&&I){const e="string"==typeof g?g:"object"==typeof g&&"type"in g?g.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.`)}},[I,g]),e.useEffect(()=>{const e=dt.current;if(!P||!e)return lt.current&&e&&(l.select(e).on(".zoom",null),lt.current=null),void(e&&l.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=$||[1,8],o={width:Ge,height:Ve};if(Ye){let r=ct.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),ct.current=s.zoomIdentity.scale(r);const a=Ke.current;a&&(a.applyZoomScale(r,o),rt.current=!1,jt(),null==z||z({projection:null===(i=a.scales)||void 0===i?void 0:i.projection,zoom:a.currentZoom}))};lt.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))},l=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",l);const c=.4,u=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=Ke.current;if(!o)return;const r=o.getRotation();pt.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=pt.current;t&&(ht.current=[t.rotation[0]+(e.clientX-t.x)*c,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*c)),t.rotation[2]],jt())},p=t=>{var n;if(!pt.current)return;pt.current=null,e.releasePointerCapture(t.pointerId);const r=ht.current;if(r){ht.current=null;const e=Ke.current;e&&(e.applyRotation(r,o),jt())}const i=Ke.current;i&&(null==z||z({projection:null===(n=i.scales)||void 0===n?void 0:n.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",p),e.addEventListener("pointercancel",p),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",l),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",p),e.removeEventListener("pointercancel",p),lt.current=null}}const r=s.zoom().scaleExtent([t,n]).extent([[0,0],[Fe[0],Fe[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;ct.current=t,ut.current=!0;const n=Ke.current;n&&(n.applyZoomTransform(t,o),rt.current=!1,jt())}).on("end",e=>{var t;ct.current=e.transform,ut.current=!1;const n=Ke.current;n&&(null==z||z({projection:null===(t=n.scales)||void 0===t?void 0:t.projection,zoom:n.currentZoom}))});return lt.current=r,l.select(e).call(r),()=>{l.select(e).on(".zoom",null)}},[P,$,Ye,Fe,Ge,Ve,qe,z,jt]);const zt=ne&&!1!==me,Lt=zt&&bt?be?be(bt):p.createElement(Me,{data:bt}):null,Rt=Lt?p.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:qe.left+bt.x,top:qe.top+bt.y,transform:`translate(${bt.x>.7*Ge?"calc(-100% - 12px)":"12px"}, ${.3*Ve>bt.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:10,width:"max-content"}},Lt):null;if(K){const e=Ke.current;e&&(b||v||x)&&(b&&e.setAreas(b),v&&e.setPoints(v),x&&e.setLines(x),e.computeScene({width:Ge,height:Ve}));const t=null!==(r=null==e?void 0:e.scene)&&void 0!==r?r:[];return p.createElement("div",{className:"stream-geo-frame"+(G?" "+G:""),role:"img","aria-label":"string"==typeof ze?ze:"Geographic chart",style:{position:"relative",width:Fe[0],height:Fe[1]}},p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Fe[0],height:Fe[1],style:{position:"absolute",left:0,top:0}},Ue,p.createElement("g",{transform:`translate(${qe.left},${qe.top})`},V&&p.createElement("rect",{x:0,y:0,width:Ge,height:Ve,fill:V}),t.map((e,t)=>function(e,t){var n,o,r,i,a,s;switch(e.type){case"geoarea":return e.pathData?p.createElement("path",{key:"geoarea-"+t,d:e.pathData,fill:e.style.fill||"#e0e0e0",fillOpacity:null!==(n=e.style.fillOpacity)&&void 0!==n?n:1,stroke:e.style.stroke||"none",strokeWidth:e.style.strokeWidth||.5,strokeDasharray:e.style.strokeDasharray,opacity:null!==(o=e._decayOpacity)&&void 0!==o?o:1}):null;case"point":return p.createElement("circle",{key:"point-"+t,cx:e.x,cy:e.y,r:e.r,fill:e.style.fill||"#4e79a7",fillOpacity:null!==(r=e.style.fillOpacity)&&void 0!==r?r:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:null!==(i=e._decayOpacity)&&void 0!==i?i:null!==(a=e.style.opacity)&&void 0!==a?a:1});case"line":{const n=e;if(2>n.path.length)return null;const o="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return p.createElement("path",{key:"line-"+t,d:o,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:null!==(s=n.style.opacity)&&void 0!==s?s:1})}default:return null}}(e,t)))),p.createElement(X,{width:Ge,height:Ve,totalWidth:Fe[0],totalHeight:Fe[1],margin:qe,scales:null,showAxes:!1,title:ze,legend:Le,legendPosition:Re,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:Be,legendIsolatedCategories:Ne,foregroundGraphics:Ze,annotations:ke,annotationFrame:0,xValues:[],yValues:[],pointNodes:t.filter(e=>"point"===e.type)}))}const Dt=e.useCallback(e=>{dt.current=e,He&&"object"==typeof He&&(He.current=e)},[He]);return p.createElement("div",{ref:Dt,className:"stream-geo-frame"+(G?" "+G:""),role:"img","aria-label":"string"==typeof ze?ze:"Geographic chart",tabIndex:0,style:Object.assign({position:"relative",width:H?"100%":Fe[0],height:F?"100%":Fe[1],overflow:"hidden"},P?{touchAction:"none"}:{}),onMouseMove:zt?Ct:void 0,onMouseLeave:zt?Pt:void 0,onClick:ve?$t:void 0},Ue&&p.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Fe[0],height:Fe[1],pointerEvents:"none"}},Ue),I&&p.createElement("canvas",{ref:Je,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),p.createElement("canvas",{ref:Qe,"aria-label":Q(null!==(c=null===(a=Ke.current)||void 0===a?void 0:a.scene)&&void 0!==c?c:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),p.createElement("canvas",{ref:et,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),p.createElement(te,{hoverPoint:bt}),Te&&p.createElement(ee,{scene:null!==(d=null===(u=Ke.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],chartType:"Geographic chart"}),p.createElement(X,{width:Ge,height:Ve,totalWidth:Fe[0],totalHeight:Fe[1],margin:qe,scales:null,showAxes:null!=We&&We,title:ze,legend:Le,legendPosition:Re,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:Be,legendIsolatedCategories:Ne,foregroundGraphics:Ze,annotations:ke,annotationFrame:xt,xValues:[],yValues:[],pointNodes:null===(h=Ke.current)||void 0===h?void 0:h.scene.filter(e=>"point"===e.type)}),(null==Ce?void 0:Ce.showBadge)&&p.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ce.badgePosition?{top:4,left:4}:"bottom-left"===Ce.badgePosition?{bottom:4,left:4}:"bottom-right"===Ce.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"})},wt?"STALE":"LIVE"),P&&p.createElement("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:qe.bottom+8,left:qe.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2}},p.createElement("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=dt.current,n=lt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(l.select(t),1.5)},style:Se},"+"),p.createElement("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=dt.current,n=lt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(l.select(t),1/1.5)},style:Se},"−")),B&&p.createElement("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:qe.bottom+2,right:qe.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}},B),Rt)});Ce.displayName="StreamGeoFrame";const Pe={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function $e(e,t){return"function"==typeof t?t(e):e[t]}function ze(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Le(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=$e(e,n);a=ze(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=$e(e,r);s.push({label:n,value:ze(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=ze(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=ze(e[t[0]],o))}}const l=Object.assign(Object.assign({},Pe),r);return p.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},a&&p.createElement("div",{style:{fontWeight:s.length>0?"bold":"normal"}},a),s.map((e,t)=>p.createElement("div",{key:t,style:{marginTop:0===t&&a?"4px":0}},e.label&&p.createElement("span",null,e.label,": "),e.value)))}}function Re(e){if(!0===e)return Le();if("function"==typeof e){const t=e;return e=>{const n=t(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==n?null:p.createElement("div",{className:"semiotic-tooltip",style:Pe},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Le(e):Le())}const De={category10:c.schemeCategory10,tableau10:c.schemeTableau10,set3:c.schemeSet3,blues:c.interpolateBlues,reds:c.interpolateReds,greens:c.interpolateGreens,oranges:c.interpolateOranges,purples:c.interpolatePurples,viridis:c.interpolateViridis,plasma:c.interpolatePlasma},Ie=c.schemeCategory10,Be=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 Ne(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")||Be.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):Ie[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+""))%Ie.length]}function We(e,t,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(r).range(o).unknown("#999");const a=De[o]||De.category10;if(i&&"function"==typeof a){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>a(Number(t)/e)}{const e=Array.isArray(a)?a:Ie;return n.scaleOrdinal().domain(r).range(e).unknown("#999")}}function Te(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):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 _e=e.createContext(null);function He(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 Fe(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[qe,Ge]=ve(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Fe(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=Fe(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}})}})),[Ve,Ze]=ve(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 Ue(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=Ge(e=>e.selections.get(r)),a=Ge(e=>e.setClause),s=Ge(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(He(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:e.useCallback(()=>{s(r,o)},[s,r,o]),clientId:o}}function Ye(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:a,clear:s}=Ue({name:n});return{onHover:e.useCallback(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&a(t)},[o,a,s,n]),predicate:r,isActive:i}}const Xe=e.createContext(!1);function Ke(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields}:null}function Je(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}const Qe="#007bff";function et(t,n,o="category10"){const r=e.useContext(_e);return e.useMemo(()=>{if(n){if(0===t.length)return r&&Object.keys(r).length>0?e=>r[e]||"#999":void 0;if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));return r&&Object.keys(r).length>0?e=>r[e]||"#999":We(e.map(e=>({_cat:e})),"_cat",o)}if(r&&Object.keys(r).length>0){const e=We(t,n,o);return t=>r[t]||e(t)}return We(t,n,o)}},[t,n,o,r])}function tt({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:a,chartId:s}){const l=Ke(n,o),c=Ue({name:(null==t?void 0:t.name)||"__unused__"}),u=Ye({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||o||[]}),d=Ze(e=>e.pushObservation),p=t?{isActive:c.isActive,predicate:c.predicate}:null,h=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(i||d){const n={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),d&&d(a)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),d&&d(e)}}},[n,u,i,a,s,d]),g=e.useCallback(e=>{var t,n;if(i||d){const o={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});i&&i(e),d&&d(e)}}},[i,d,a,s]);return{activeSelectionHook:p,customHoverBehavior:h,customClickBehavior:g}}function nt({data:t,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:s={top:50,bottom:60,left:70,right:40}}){const l=e.useContext(Xe),c=void 0!==r?r:!l&&!!n,u=e.useMemo(()=>{if(c&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){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:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:a}}),label:""}]}}({data:t,colorBy:n,colorScale:o,getColor:Ne})},[c,n,t,o]),d=e.useMemo(()=>{const e=Object.assign(Object.assign({},s),a);return u&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[s,a,u,i]);return{legend:u,margin:d,legendPosition:i}}const ot={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 rt(e,t,n){var o,r,i,a,s,l;const c=ot[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(r=t.height)&&void 0!==r?r:c.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}function it({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return p.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},p.createElement("div",{style:{textAlign:"center",maxWidth:400}},p.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),p.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&p.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}},n)))}class at extends p.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:p.createElement(it,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function st(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 lt(e,t,n=3){let o,r=n+1;for(const n of t){const t=st(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function ct(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function ut(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=lt(e,t,3))&&void 0!==n?n:null)}const dt={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"]},frameProps:{type:"object"}},pt={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},ht={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},gt=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],ft=["vertical","horizontal"],yt={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},dt),pt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:gt},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({},dt),pt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:gt},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},dt),pt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:gt},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({},dt),pt),{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({},dt),pt),{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({},dt),pt),{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({},dt),pt),{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"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},dt),pt),{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({},dt),ht),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ft},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},dt),ht),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ft},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},dt),ht),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ft},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},dt),ht),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ft},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},dt),ht),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ft},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},dt),ht),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},dt),ht),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ft},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},dt),ht),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ft},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},dt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},dt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},dt),{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({},dt),{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:ft},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({},dt),{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({},dt),{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({},dt),{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({},dt),{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({},dt),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function mt(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const bt=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),vt=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),xt=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),kt=new Set(["LineChart","AreaChart","StackedAreaChart"]),wt=new Set(["BarChart","StackedBarChart","GroupedBarChart"]);function At(e,t){const n=[],o=function(e,t){const n=[],o=yt[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(yt).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(!mt(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=lt(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=ct(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=ut(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=ct(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=ut(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 yt[e]?(function(e,t,n){const o=yt[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=yt[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){bt.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){vt.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=yt[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(!xt.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(!kt.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=yt[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(!wt.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),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var jt;const Et="undefined"!=typeof process&&"production"!==(null===(jt=process.env)||void 0===jt?void 0:jt.NODE_ENV);function Ot({componentName:e,width:t,height:n,chartProps:o,children:r}){return p.createElement(at,{fallback:r=>{let i="";if(Et&&o)try{const t=At(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return p.createElement(it,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const St={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"},Mt={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Ct(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?p.createElement("div",{style:Object.assign(Object.assign({},St),{width:t,height:n})},o||"No data available"):null}function Pt(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*o))),i=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(r+i)-i))/2);return p.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>p.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Mt),{position:"absolute",top:a+n*(r+i),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})})))}function $t(e,t,n,o){if(!Et)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 zt(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 Lt(e){return e}function Rt(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 Lt;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 Dt=new Map;function It(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function Bt(e){return zt(this,void 0,void 0,function*(){const t=Dt.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return zt(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:It(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:It(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:It(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:It(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 Rt(e,t)})}:Rt(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return Dt.set(e,i),i})}function Nt(t){const n=e.useMemo(()=>Array.isArray(t)?t:void 0,[t]),[o,r]=e.useState(null);return e.useEffect(()=>{if(t&&!Array.isArray(t)){if("string"==typeof(e=t)&&["world-110m","world-50m","land-110m","land-50m"].includes(e)){let e=!1;return r(null),Bt(t).then(t=>{e||r(t)}),()=>{e=!0}}var e;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${t}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),r(null)}else r(null)},[t]),void 0!==n?n:o}const Wt={blues:c.interpolateBlues,reds:c.interpolateReds,greens:c.interpolateGreens,viridis:c.interpolateViridis};function Tt(t){const r=rt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{areas:i,valueAccessor:a,colorScheme:s="blues",projection:l="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:g,onZoom:f,dragRotate:y,tileURL:m,tileAttribution:b,tileCacheSize:v,tooltip:x,areaOpacity:k=1,annotations:w,margin:A,className:j,selection:E,linkedHover:O,onObservation:S,chartId:M,loading:C,emptyContent:P,frameProps:$={}}=t,z=null!=h?h:!!m,L=Nt(i),R=e.useMemo(()=>"function"==typeof a?a:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[a])&&void 0!==n?n:null==e?void 0:e[a]},[a]),D=e.useMemo(()=>{if(!L)return n.scaleSequential(c.interpolateBlues).domain([0,1]);const e=L.map(e=>R(e)).filter(e=>null!=e&&isFinite(e)),[t,r]=o.extent(e);return n.scaleSequential(Wt[s]||c.interpolateBlues).domain([null!=t?t:0,null!=r?r:1])},[L,R,s]),{activeSelectionHook:I,customHoverBehavior:B}=tt({selection:E,linkedHover:O,onObservation:S,chartType:"ChoroplethMap",chartId:M}),N=e.useMemo(()=>{const e=e=>{const t=R(e);return{fill:null!=t&&isFinite(t)?D(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}};return I?Je(e,I,E):e},[R,D,I,E,k]),W=e.useMemo(()=>e=>{var t,n;const o=(null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.name)||(null===(n=null==e?void 0:e.properties)||void 0===n?void 0:n.NAME)||(null==e?void 0:e.name)||(null==e?void 0:e.NAME)||"Feature",r=R(e);return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},o),null!=r&&p.createElement("div",{style:{opacity:.7}},"number"==typeof(i=r)&&isFinite(i)?Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=i?i:"")+""));var i},[R]),T=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},A),[A]),_=Pt(C,r.width,r.height);if(_)return _;if(!L)return Pt(!0,r.width,r.height)||null;const H=Ct(L,r.width,r.height,P);if(H)return H;if(Array.isArray(L)&&L.length>0){const e=L[0];if(!e||"object"!=typeof e||!e.geometry)return p.createElement(it,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:r.width,height:r.height})}const F=Object.assign(Object.assign(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:l,areas:L,areaStyle:N,size:[r.width,r.height],margin:T,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?W:Re(x)||W},null!=u&&{graticule:u}),null!=d&&{fitPadding:d}),z&&{zoomable:!0}),g&&{zoomExtent:g}),f&&{onZoom:f}),null!=y&&{dragRotate:y}),m&&{tileURL:m}),b&&{tileAttribution:b}),v&&{tileCacheSize:v}),(O||S)&&{customHoverBehavior:B}),w&&w.length>0&&{annotations:w}),r.title&&{title:r.title}),j&&{className:j}),$);return p.createElement(Ot,{componentName:"ChoroplethMap",width:r.width,height:r.height},p.createElement(Ce,Object.assign({},F)))}Tt.displayName="ChoroplethMap";const _t=e.forwardRef(function(t,n){const o=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const r=rt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{points:i,xAccessor:a="lon",yAccessor:s="lat",sizeBy:l,sizeRange:c=[3,30],colorBy:u,colorScheme:d="category10",projection:h="equalEarth",graticule:g,fitPadding:f,zoomable:y,zoomExtent:m,onZoom:b,dragRotate:v,tileURL:x,tileAttribution:k,tileCacheSize:w,areas:A,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:E,annotations:O,margin:S,className:M,selection:C,linkedHover:P,onObservation:$,chartId:z,loading:L,emptyContent:R,legendInteraction:D,legendPosition:I,frameProps:B={}}=t,N=null!=y?y:!!x,W=Nt(A),T=i||[],{activeSelectionHook:_,customHoverBehavior:H}=tt({selection:C,linkedHover:P,fallbackFields:u?["string"==typeof u?u:""]:[],onObservation:$,chartType:"ProportionalSymbolMap",chartId:z}),F=et(T,u,d),q=e.useMemo(()=>{if(!l)return;const e="function"==typeof l?l:e=>e[l],t=T.map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[T,l]),G=e.useMemo(()=>{const e=e=>({fill:u?Ne(e,u,F):Qe,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:l?Te(e,l,c,q):6});return _?Je(e,_,C):e},[u,F,l,c,q,_,C]),V=e.useMemo(()=>{if(!u)return[];const e="function"==typeof u?u:e=>e[u],t=new Set;for(const n of T){const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[T,u]),Z=function(t,n,o){const[r,i]=e.useState(null),[a,s]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&i(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&s(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=r?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===r}:"isolate"===t&&a.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return a.has(o)}}:null},[t,n,r,a]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?a:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(D,u,V),{legend:U,margin:Y,legendPosition:X}=nt({data:T,colorBy:u,colorScale:F,showLegend:r.showLegend,legendPosition:I,userMargin:S,defaults:{top:10,bottom:10,left:10,right:10}}),K=e.useMemo(()=>e=>{const t=(null==e?void 0:e.name)||(null==e?void 0:e.label)||(null==e?void 0:e.NAME)||(null==e?void 0:e.id),n="string"==typeof l?l:null,o=("function"==typeof l?l:e=>e[l])(e),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",i="string"==typeof u?u:null,a=i?null==e?void 0:e[i]:null;return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},t&&p.createElement("div",{style:{fontWeight:600,marginBottom:2}},t),n&&null!=o&&p.createElement("div",null,p.createElement("span",{style:{opacity:.7}},n,": "),r(o)),i&&null!=a&&p.createElement("div",null,p.createElement("span",{style:{opacity:.7}},i,": "),a+""),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,": "),r(t))))},[l,u]),J=Pt(L,r.width,r.height);if(J)return J;const Q=Ct(i,r.width,r.height,R);if(Q)return Q;$t("ProportionalSymbolMap",T,"xAccessor",a),$t("ProportionalSymbolMap",T,"yAccessor",s);const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=i&&{points:T}),{xAccessor:a,yAccessor:s,pointStyle:G}),W&&{areas:W,areaStyle:j}),null!=g&&{graticule:g}),null!=f&&{fitPadding:f}),N&&{zoomable:!0}),m&&{zoomExtent:m}),b&&{onZoom:b}),null!=v&&{dragRotate:v}),x&&{tileURL:x}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[r.width,r.height],margin:Y,enableHover:!0,tooltipContent:!1===E?()=>null:Re(E)||K}),U&&{legend:U,legendPosition:X}),D&&"none"!==D&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories}),(P||$)&&{customHoverBehavior:H}),O&&O.length>0&&{annotations:O}),r.title&&{title:r.title}),M&&{className:M}),B);return p.createElement(Ot,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height},p.createElement(Ce,Object.assign({ref:o},ee)))});function Ht(t){const o=rt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{flows:r,nodes:i,nodeIdAccessor:a="id",xAccessor:s="lon",yAccessor:l="lat",valueAccessor:c="value",projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:g,zoomExtent:f,onZoom:y,dragRotate:m,tileURL:b,tileAttribution:v,tileCacheSize:x,lineType:k="geo",flowStyle:w="basic",areas:A,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:E,edgeOpacity:O=.6,edgeWidthRange:S=[1,8],edgeLinecap:M="round",colorScheme:C="category10",showParticles:P,particleStyle:$,tooltip:z,annotations:L,margin:R,className:D,selection:I,linkedHover:B,onObservation:N,chartId:W,loading:T,emptyContent:_,frameProps:H={}}=t,F=null!=g?g:!!b,q=Nt(A),G=Ke(B),V=Ue({name:(null==I?void 0:I.name)||"__unused__"}),Z=Ye({name:(null==G?void 0:G.name)||"hover",fields:(null==G?void 0:G.fields)||[]}),U=Ze(e=>e.pushObservation),Y=I?{isActive:V.isActive,predicate:V.predicate}:null,X=r||[],K=i||[],J=et(X,E,C),Q=e.useMemo(()=>{const e=new Map;for(const t of K)e.set(t[a]+"",t);return e},[K,a]),ee=e.useMemo(()=>{const e=new Map;for(const t of X)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},[X]),te=e.useCallback(e=>{var t,n;if(B)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=ee.get(t[a]+"");e&&Z.onHover(e)}else Z.onHover(t)}else Z.onHover(null);if(N||U){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:W};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});N&&N(i),U&&U(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});N&&N(e),U&&U(e)}}},[B,Z,a,ee,N,W,U]),ne=e.useMemo(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof l?l:e=>e[l];return X.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=Q.get(n.source+""),r=Q.get(n.target+"");return o&&r?Object.assign(Object.assign({},n),{coordinates:[{[s]:e(o),[l]:t(o)},{[s]:e(r),[l]:t(r)}]}):null}).filter(Boolean)},[X,Q,s,l]),oe=e.useMemo(()=>{const e=X.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[c])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>S[0]:n.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(S)},[X,c,S]),re=e.useMemo(()=>e=>{var t;return{stroke:E?Ne(e,E,J):Qe,strokeWidth:oe(null!==(t=e[c])&&void 0!==t?t:0),strokeLinecap:M,opacity:O}},[E,J,oe,c,O,M]),ie=e.useMemo(()=>Y?Je(re,Y,Object.assign(Object.assign({},I||{}),{unselectedStyle:{opacity:.15,strokeOpacity:.15,fillOpacity:0}})):re,[re,Y,I]),ae=e.useMemo(()=>()=>({fill:"#333",r:5,fillOpacity:.8}),[]),se=e.useMemo(()=>e=>{var t,n,o,r,i,s,l;if((null==e?void 0:e.geometry)||(null==e?void 0:e.properties)||(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.geometry)){const t=(null===(n=null==e?void 0:e.properties)||void 0===n?void 0:n.name)||(null===(o=null==e?void 0:e.properties)||void 0===o?void 0:o.NAME)||(null==e?void 0:e.name)||(null==e?void 0:e.NAME)||(null===(i=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.properties)||void 0===i?void 0:i.name)||(null===(l=null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.properties)||void 0===l?void 0:l.NAME);if(t)return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},t))}if(null!=(null==e?void 0:e.source)&&null!=(null==e?void 0:e.target)){const t=e[c];return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},e.source," → ",e.target),null!=t&&p.createElement("div",{style:{opacity:.7}},"number"==typeof t?t.toLocaleString():t))}const u=(null==e?void 0:e.name)||(null==e?void 0:e.label)||(null==e?void 0:e[a]);return null!=u?p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},u)):null},[c,a]),le=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},R),[R]),ce=Pt(T,o.width,o.height);if(ce)return ce;const ue=Ct(r,o.width,o.height,_);if(ue)return ue;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({projection:u,lines:ne,points:K,xAccessor:s,yAccessor:l,lineDataAccessor:"coordinates",lineType:k,flowStyle:w,lineStyle:ie,pointStyle:ae},q&&{areas:q,areaStyle:j}),null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),F&&{zoomable:!0}),f&&{zoomExtent:f}),y&&{onZoom:y}),null!=m&&{dragRotate:m}),P&&{showParticles:P}),$&&{particleStyle:$}),b&&{tileURL:b}),v&&{tileAttribution:v}),x&&{tileCacheSize:x}),{size:[o.width,o.height],margin:le,enableHover:!0,tooltipContent:!1===z?()=>null:Re(z)||se}),(B||N)&&{customHoverBehavior:te}),L&&L.length>0&&{annotations:L}),o.title&&{title:o.title}),D&&{className:D}),H);return p.createElement(Ot,{componentName:"FlowMap",width:o.width,height:o.height},p.createElement(Ce,Object.assign({},de)))}_t.displayName="ProportionalSymbolMap",Ht.displayName="FlowMap";const Ft=e.forwardRef(function(t,n){const o=rt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{points:r,lines:i,xAccessor:a="lon",yAccessor:s="lat",nodeIdAccessor:l="id",center:c,costAccessor:u,strength:d=1,lineMode:h="straight",projection:g="mercator",graticule:f,fitPadding:y,zoomable:m,zoomExtent:b,onZoom:v,dragRotate:x,tileURL:k,tileAttribution:w,tileCacheSize:A,transition:j,colorBy:E,colorScheme:O="category10",pointRadius:S=5,tooltip:M,showRings:C=!0,ringStyle:P,showNorth:$=!0,costLabel:z,annotations:L,margin:R,className:D,selection:I,linkedHover:B,onObservation:N,chartId:W,loading:T,emptyContent:_,legendPosition:H,frameProps:F={}}=t,q=null!=m?m:!!k,G=r||[],{activeSelectionHook:V,customHoverBehavior:Z}=tt({selection:I,linkedHover:B,fallbackFields:E?["string"==typeof E?E:""]:[],onObservation:N,chartType:"DistanceCartogram",chartId:W}),U=et(G,E,O),Y=e.useMemo(()=>{const e=e=>({fill:E?Ne(e,E,U):Qe,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:S});return V?Je(e,V,I):e},[E,U,S,V,I]),{legend:X,margin:K,legendPosition:J}=nt({data:G,colorBy:E,colorScale:U,showLegend:o.showLegend,legendPosition:H,userMargin:R,defaults:{top:10,bottom:10,left:10,right:10}}),Q=e.useMemo(()=>({center:c,centerAccessor:l,costAccessor:u,strength:d,lineMode:h}),[c,l,u,d,h]),ee=e.useMemo(()=>{if(!i)return;const e="function"==typeof a?a:e=>e[a],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of G)n.set(e[l]+"",e);return i.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:[{[a]:e(r),[s]:t(r)},{[a]:e(i),[s]:t(i)}]}):null}).filter(Boolean)},[i,G,a,s,l]),te=e.useMemo(()=>e=>{const t=("function"==typeof u?u:e=>e[u])(e);return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},e[l]||e.name||e.id||"Point"),null!=t&&p.createElement("div",{style:{opacity:.7}},"Cost: ","number"==typeof t?t.toFixed(1):t))},[u,l]),ne=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=ne.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ne.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=ne.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ne.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[oe,re]=e.useState(null),ie=e.useCallback(()=>{var e,t;const n=null===(t=null===(e=ne.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&re(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);e.useEffect(()=>{const e=requestAnimationFrame(ie);return()=>cancelAnimationFrame(e)},[ie,d,c,o.width,o.height,G]);const ae=e.useMemo(()=>{if(!C||!oe)return[];const{maxCost:e}=oe;if(0>=e)return[];if(Array.isArray(C))return C.filter(t=>t>0&&e>=t);const t="number"==typeof C?C: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},[C,oe]),se=e.useMemo(()=>{var e,t;if(!oe)return F.foregroundGraphics||null;const{cx:n,cy:o,maxCost:r,availableRadius:i}=oe,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},P),s=null!==(e=K.left)&&void 0!==e?e:10,l=null!==(t=K.top)&&void 0!==t?t:10;return p.createElement("g",null,ae.map(e=>{const t=e/r*i;return p.createElement("g",{key:e},p.createElement("circle",{cx:n+s,cy:o+l,r:t,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),p.createElement("text",{x:n+s+t+3,y:o+l-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif"},e,z?" "+z:""))}),$&&p.createElement("g",{transform:`translate(${s+24}, ${l+24})`},p.createElement("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),p.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"}),p.createElement("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif"},"N"),p.createElement("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),p.createElement("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),p.createElement("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})),F.foregroundGraphics)},[oe,ae,$,z,P,K,F.foregroundGraphics]),le=Pt(T,o.width,o.height);if(le)return le;const ce=Ct(r,o.width,o.height,_);if(ce)return ce;$t("DistanceCartogram",G,"xAccessor",a),$t("DistanceCartogram",G,"yAccessor",s);const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:g},null!=r&&{points:G}),ee&&{lines:ee,lineDataAccessor:"coordinates"}),{xAccessor:a,yAccessor:s,pointIdAccessor:l,pointStyle:Y,projectionTransform:Q}),j&&{transition:{duration:j}}),null!=f&&{graticule:f}),null!=y&&{fitPadding:y}),q&&{zoomable:!0}),b&&{zoomExtent:b}),v&&{onZoom:v}),null!=x&&{dragRotate:x}),k&&{tileURL:k}),w&&{tileAttribution:w}),A&&{tileCacheSize:A}),{size:[o.width,o.height],margin:K,enableHover:!0,tooltipContent:!1===M?()=>null:Re(M)||te}),X&&{legend:X,legendPosition:J}),(B||N)&&{customHoverBehavior:Z}),L&&L.length>0&&{annotations:L}),o.title&&{title:o.title}),D&&{className:D}),F),se&&{foregroundGraphics:se});return p.createElement(Ot,{componentName:"DistanceCartogram",width:o.width,height:o.height},p.createElement(Ce,Object.assign({ref:ne},ue)))});Ft.displayName="DistanceCartogram",exports.ChoroplethMap=Tt,exports.DistanceCartogram=Ft,exports.FlowMap=Ht,exports.ProportionalSymbolMap=_t,exports.StreamGeoFrame=Ce,exports.mergeData=function(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})},exports.resolveReferenceGeography=Bt;