semiotic 3.4.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +16 -3
- package/ai/schema.json +42 -1
- package/ai/system-prompt.md +4 -0
- package/dist/components/Annotation.d.ts +42 -2
- package/dist/components/CategoryColors.d.ts +1 -1
- package/dist/components/ChartGrid.d.ts +1 -1
- package/dist/components/ContextLayout.d.ts +1 -1
- package/dist/components/DataSummaryContext.d.ts +1 -1
- package/dist/components/DetailsPanel.d.ts +3 -2
- package/dist/components/Legend.d.ts +2 -3
- package/dist/components/LinkedCharts.d.ts +1 -1
- package/dist/components/ThemeProvider.d.ts +1 -1
- package/dist/components/Tooltip/FlippingTooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +4 -3
- package/dist/components/charts/geo/ChoroplethMap.d.ts +4 -4
- package/dist/components/charts/geo/DistanceCartogram.d.ts +5 -4
- package/dist/components/charts/geo/FlowMap.d.ts +4 -4
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +4 -3
- package/dist/components/charts/index.d.ts +2 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +4 -3
- package/dist/components/charts/network/CirclePack.d.ts +3 -3
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +3 -2
- package/dist/components/charts/network/OrbitDiagram.d.ts +6 -5
- package/dist/components/charts/network/SankeyDiagram.d.ts +4 -3
- package/dist/components/charts/network/TreeDiagram.d.ts +3 -3
- package/dist/components/charts/network/Treemap.d.ts +3 -3
- package/dist/components/charts/ordinal/BarChart.d.ts +24 -4
- package/dist/components/charts/ordinal/BoxPlot.d.ts +4 -3
- package/dist/components/charts/ordinal/DonutChart.d.ts +4 -3
- package/dist/components/charts/ordinal/DotPlot.d.ts +4 -3
- package/dist/components/charts/ordinal/FunnelChart.d.ts +4 -3
- package/dist/components/charts/ordinal/GaugeChart.d.ts +2 -1
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +4 -3
- package/dist/components/charts/ordinal/Histogram.d.ts +4 -3
- package/dist/components/charts/ordinal/LikertChart.d.ts +4 -3
- package/dist/components/charts/ordinal/PieChart.d.ts +4 -3
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +4 -3
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -3
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +4 -3
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -3
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +4 -3
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +7 -6
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +10 -7
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -6
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +7 -6
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -6
- package/dist/components/charts/shared/ChartError.d.ts +1 -2
- package/dist/components/charts/shared/annotationResolvers.d.ts +4 -3
- package/dist/components/charts/shared/annotationRules.d.ts +2 -1
- package/dist/components/charts/shared/colorUtils.d.ts +4 -3
- package/dist/components/charts/shared/datumTypes.d.ts +20 -0
- package/dist/components/charts/shared/diagnoseConfig.d.ts +2 -7
- package/dist/components/charts/shared/formatUtils.d.ts +4 -2
- package/dist/components/charts/shared/hooks.d.ts +27 -23
- package/dist/components/charts/shared/legendUtils.d.ts +3 -2
- package/dist/components/charts/shared/mergeShapeStyle.d.ts +43 -0
- package/dist/components/charts/shared/networkUtils.d.ts +7 -6
- package/dist/components/charts/shared/selectionUtils.d.ts +5 -4
- package/dist/components/charts/shared/statisticalOverlays.d.ts +14 -26
- package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +2 -2
- package/dist/components/charts/shared/statsTooltip.d.ts +3 -2
- package/dist/components/charts/shared/tooltipUtils.d.ts +7 -6
- package/dist/components/charts/shared/types.d.ts +22 -13
- package/dist/components/charts/shared/useChartSetup.d.ts +7 -6
- package/dist/components/charts/shared/useLikertAggregation.d.ts +18 -7
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +3 -2
- package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -1
- package/dist/components/charts/shared/validateChartData.d.ts +2 -1
- package/dist/components/charts/shared/validateProps.d.ts +2 -8
- package/dist/components/charts/shared/withChartWrapper.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.d.ts +4 -3
- package/dist/components/charts/xy/BubbleChart.d.ts +4 -3
- package/dist/components/charts/xy/CandlestickChart.d.ts +47 -0
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +4 -3
- package/dist/components/charts/xy/Heatmap.d.ts +12 -7
- package/dist/components/charts/xy/LineChart.d.ts +4 -3
- package/dist/components/charts/xy/MinimapChart.d.ts +4 -4
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +5 -4
- package/dist/components/charts/xy/QuadrantChart.d.ts +4 -3
- package/dist/components/charts/xy/Scatterplot.d.ts +4 -3
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +3 -3
- package/dist/components/charts/xy/StackedAreaChart.d.ts +4 -3
- package/dist/components/data/transforms.d.ts +8 -7
- package/dist/components/export/chartConfig.d.ts +4 -3
- package/dist/components/export/selectionSerializer.d.ts +1 -1
- package/dist/components/geo/mergeData.d.ts +2 -1
- package/dist/components/realtime/BinAccumulator.d.ts +3 -2
- package/dist/components/realtime/renderers/types.d.ts +2 -1
- package/dist/components/realtime/renderers/waterfallRenderer.d.ts +2 -1
- package/dist/components/realtime/types.d.ts +25 -21
- package/dist/components/semiotic-themes.d.ts +2 -1
- package/dist/components/semiotic-xy.d.ts +2 -0
- package/dist/components/semiotic.d.ts +3 -3
- package/dist/components/server/animatedGif.d.ts +4 -18
- package/dist/components/server/renderToStaticSVG.d.ts +5 -4
- package/dist/components/server/serverChartConfigs.d.ts +2 -10
- package/dist/components/server/staticAnnotations.d.ts +2 -1
- package/dist/components/server/staticLegend.d.ts +2 -1
- package/dist/components/store/ObservationStore.d.ts +4 -3
- package/dist/components/store/SelectionStore.d.ts +4 -9
- package/dist/components/store/ThemeStore.d.ts +32 -4
- package/dist/components/store/TooltipStore.d.ts +6 -2
- package/dist/components/store/useSelection.d.ts +13 -9
- package/dist/components/stream/AccessibleDataTable.d.ts +5 -5
- package/dist/components/stream/CanvasHitTester.d.ts +2 -1
- package/dist/components/stream/DataSourceAdapter.d.ts +2 -1
- package/dist/components/stream/FocusRing.d.ts +1 -2
- package/dist/components/stream/GeoParticlePool.d.ts +2 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +7 -6
- package/dist/components/stream/MarginalGraphics.d.ts +1 -2
- package/dist/components/stream/NetworkPipelineStore.d.ts +3 -2
- package/dist/components/stream/NetworkSVGOverlay.d.ts +21 -15
- package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -19
- package/dist/components/stream/OrdinalPipelineStore.d.ts +6 -5
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +6 -5
- package/dist/components/stream/PipelineStore.d.ts +63 -28
- package/dist/components/stream/SVGOverlay.d.ts +10 -10
- package/dist/components/stream/SceneGraph.d.ts +6 -5
- package/dist/components/stream/StreamGeoFrame.d.ts +2 -1
- package/dist/components/stream/StreamNetworkFrame.d.ts +2 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +2 -1
- package/dist/components/stream/StreamXYFrame.d.ts +2 -1
- package/dist/components/stream/XYBrushOverlay.d.ts +1 -21
- package/dist/components/stream/devDataAccessWarning.d.ts +2 -11
- package/dist/components/stream/geoTypes.d.ts +43 -24
- package/dist/components/stream/hoverUtils.d.ts +2 -1
- package/dist/components/stream/keyboardNav.d.ts +18 -6
- package/dist/components/stream/layouts/hierarchySceneBuilders.d.ts +4 -3
- package/dist/components/stream/layouts/hierarchyUtils.d.ts +4 -3
- package/dist/components/stream/networkTypes.d.ts +73 -47
- package/dist/components/stream/ordinalSceneBuilders/barFunnelScene.d.ts +1 -1
- package/dist/components/stream/ordinalSceneBuilders/barScene.d.ts +2 -2
- package/dist/components/stream/ordinalSceneBuilders/connectorScene.d.ts +1 -1
- package/dist/components/stream/ordinalSceneBuilders/pointScene.d.ts +2 -2
- package/dist/components/stream/ordinalSceneBuilders/statisticalScene.d.ts +4 -4
- package/dist/components/stream/ordinalSceneBuilders/swimlaneScene.d.ts +1 -1
- package/dist/components/stream/ordinalSceneBuilders/timelineScene.d.ts +1 -1
- package/dist/components/stream/ordinalSceneBuilders/types.d.ts +9 -8
- package/dist/components/stream/ordinalTypes.d.ts +65 -33
- package/dist/components/stream/pipelineDecay.d.ts +2 -1
- package/dist/components/stream/pipelinePulse.d.ts +2 -1
- package/dist/components/stream/pipelineTransitions.d.ts +16 -4
- package/dist/components/stream/renderers/colorUtils.d.ts +20 -0
- package/dist/components/stream/types.d.ts +58 -17
- package/dist/components/stream/xySceneBuilders/areaScene.d.ts +3 -2
- package/dist/components/stream/xySceneBuilders/barScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/emitPointNodes.d.ts +3 -2
- package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/lineScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/mixedScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +2 -1
- package/dist/components/stream/xySceneBuilders/types.d.ts +35 -26
- package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +2 -1
- package/dist/components/types/marginType.d.ts +15 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +1 -0
- package/dist/semiotic-themes.d.ts +2 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +2 -0
- package/dist/semiotic.d.ts +3 -3
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/canvasMock.d.ts +10 -2
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +38 -32
- package/dist/components/types/annotationTypes.d.ts +0 -145
- package/dist/components/types/generalTypes.d.ts +0 -241
- package/dist/components/types/interactionTypes.d.ts +0 -72
- package/dist/components/types/networkTypes.d.ts +0 -174
- package/dist/components/types/ordinalTypes.d.ts +0 -112
- package/dist/semiotic-statisticalOverlays-DGX_WWc5.js +0 -1
package/dist/geo.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react"),t=require("d3-geo"),n=require("d3-scale"),o=require("d3-quadtree"),r=require("d3-array"),i=require("d3-hierarchy"),a=require("d3-shape"),s=require("regression"),l=require("d3-zoom"),c=require("d3-selection"),u=require("d3-scale-chromatic");function d(e){return e&&e.__esModule?e:{default:e}}function p(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 h=p(e),f=d(s);class y{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:Object.assign({},a),n.push(e),this.buffer[i]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function g(e,t,n){return e+(t-e)*n}function m(e,t,n){var o,r,i;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>s?1:a;default:return 1}}const b={mercator:t.geoMercator,equalEarth:t.geoEqualEarth,albersUsa:t.geoAlbersUsa,orthographic:t.geoOrthographic,naturalEarth:t.geoNaturalEarth1,equirectangular:t.geoEquirectangular};function v(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function x(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function k(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):n}const w={fill:"#e0e0e0",stroke:"#999",strokeWidth:.5,fillOpacity:1},A={fill:"#4e79a7",r:4,fillOpacity:.8},j={stroke:"#4e79a7",strokeWidth:1.5,fill:"none"};function O(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 E(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 S(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 M(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 C{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e}initStreaming(e=500){this.pointBuffer=new y(e),this.timestampBuffer=new y(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:n}=this;this.projection=function(e){if(!e)return t.geoEqualEarth();if("string"==typeof e){const n=b[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=b[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;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),n.projectionTransform&&this.applyCartogramTransform(n.projectionTransform,e),n.decay&&this.streaming&&this.applyDecay(),n.pulse&&this.streaming&&this.applyPulse(),n.transition&&!this._hasRenderedOnce&&this.scene.length>0&&n.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,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=v(s.xAccessor,"lon"),u=v(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=x(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.rebuildQuadtree(),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.rebuildQuadtree(),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.rebuildQuadtree(),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}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,C.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let r=0;for(const e of this.scene)"point"===e.type&&(n[r++]=e);this._quadtree=o.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var n,o,r;const i=[],{config:a}=this,s=this.projection,l=this.geoPath,c=v(a.xAccessor,"lon"),u=v(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=k(a.areaStyle,e,w);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:r,style:s,datum:e,interactive:!0})}const d=x(a.lineDataAccessor);for(const n of this.lineData){const o=d(n);if(!o||2>o.length)continue;let r=[];if("geo"===a.lineType){const e=Array(o.length);for(let t=0;o.length>t;t++)e[t]=[c(o[t]),u(o[t])];for(let n=0;e.length-1>n;n++){const o=e[n],i=e[n+1],a=t.geoDistance(o,i)||0,l=Math.max(2,Math.ceil(a/(Math.PI/180))),c=t.geoInterpolate(o,i);for(let e=0;l>=e;e++){if(n>0&&0===e)continue;const t=s(c(e/l));null!=t&&r.push(t)}}}else for(let e=0;o.length>e;e++){const t=o[e],n=s([c(t),u(t)]);null!=n&&r.push(n)}if(2>r.length)continue;const l=k(a.lineStyle,n,j),p="number"==typeof l.strokeWidth?l.strokeWidth:1;2!==o.length||2>r.length||"arc"!==a.flowStyle?2!==o.length||2>r.length||"offset"!==a.flowStyle||(r="geo"===a.lineType?S(r,p):M(r[0],r[r.length-1],0,0,p)):r=E(r[0],r[r.length-1]);const h=O(r,e.width);if(h.length>1)for(const e of h){if(2>e.length)continue;const t={type:"line",path:e,style:Object.assign(Object.assign({},l),{_edgeFade:!0}),datum:n};i.push(t)}else i.push({type:"line",path:2>r.length&&h[0]||r,style:l,datum:n})}const p=this.getPoints(),h=a.pointIdAccessor?"function"==typeof a.pointIdAccessor?a.pointIdAccessor:e=>e[a.pointIdAccessor]:null,f=s.clipAngle&&null!==(n=s.clipAngle())&&void 0!==n?n:0,y=f>0?f*Math.PI/180:null,g=s.rotate?s.rotate():[0,0,0],m="function"==typeof s.center?s.center():[0,0],b=[(null!==(o=m[0])&&void 0!==o?o:0)-g[0],(null!==(r=m[1])&&void 0!==r?r:0)-g[1]];for(let e=0;p.length>e;e++){const n=p[e],o=c(n),r=u(n);if(null!=y&&t.geoDistance([o,r],b)>y)continue;const l=s([o,r]);if(!l)continue;const d=a.pointStyle?a.pointStyle(n):Object.assign({},A),f={type:"point",x:l[0],y:l[1],r:d.r||4,style:d,datum:n,pointId:h?h(n)+"":void 0};i.push(f)}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),f=Math.max(...h,1),y=Math.min(t.width,t.height)/2,g=n.scaleLinear().domain([0,f]).range([0,y]);this.cartogramLayout={cx:d,cy:p,maxCost:f,availableRadius:y},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of 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)?g(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:f,availableRadius:y};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(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const r=m(e,o,t);n[o]._decayOpacity=r,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:r})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),a=this.timestampBuffer.toArray();for(let e=0;i.length>e&&a.length>e;e++){const s=r-a[e];o>s&&(i[e]._pulseIntensity=1-s/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of i)if(e.pointId){const t=r.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(a=!0))}a&&(this.activeTransition={startTime:performance.now(),duration:o})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=g(e.x,e._targetX,n),e.y=g(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 R(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function z(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function P(e,t){const n=z(e);if(!n)return!1;const o=z(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function $(e,t,n,o,r,i,a=0){if(i){const e=function(e,t,n,o,r){const i=Math.max(o,r+5,12),a=t-i,s=t+i,l=n-i,c=n+i;let u=null,d=1/0;return e.visit((e,r,i,p,h)=>{if(r>s||a>p||i>c||l>h)return!0;if(!e.length){let r=e;do{const e=r.data,i=e.x-t,a=e.y-n,s=Math.sqrt(i*i+a*a);R(e.r,o)>=s&&d>s&&(u=e,d=s),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,a);if(e)return e}else{let r=null,i=o;for(const a of e){if("point"!==a.type)continue;const e=a.x-t,s=a.y-n,l=Math.sqrt(e*e+s*s);R(a.r,o)>=l&&i>l&&(r=a,i=l)}if(r)return{node:r,distance:i}}for(let o=e.length-1;o>=0;o--){const i=e[o];if("geoarea"!==i.type)continue;const a=i;if(!1===a.interactive)continue;const[[s,l],[c,u]]=a.bounds;if(!(s>t||t>c||l>n||n>u)&&(a._cachedPath2D||(a._cachedPath2D=new Path2D(a.pathData)),r.isPointInPath(a._cachedPath2D,t,n)))return{node:a,distance:0}}let s=null,l=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:r}=e,i=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;r.length-1>o;o++){const[a,c]=r[o],[u,d]=r[o+1],p=L(t,n,a,c,u,d);i>=p&&l>p&&(s=e,l=p)}}return s?{node:s,distance:l}:null}function L(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}function B(t){const n=e.createContext(null),o=I(t);return[function({children:o}){const r=e.useMemo(()=>I(t),[]);return h.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 I(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function D(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:N})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}C.QUADTREE_THRESHOLD=500;const N=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],T={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},W={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},_={mode:"light",colors:{primary:"#0000cc",categorical:N,sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[F,q]=B(e=>({theme:T,setTheme(t){e(e=>{if("light"===t)return{theme:T};if("dark"===t)return{theme:W};if("high-contrast"===t)return{theme:_};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?W:T;return{theme:D(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:D(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const H=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,G=new WeakMap;let V=0,U=!1,Z=null,Y=null,X=null;function Q(e,t){var n,o;if(!t)return t;const r=H.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(U)return;if("undefined"==typeof window||"undefined"==typeof document)return;U=!0;const e=()=>{V++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Z=new MutationObserver(e),Z.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Y=window.matchMedia("(prefers-color-scheme: dark)"),X=e,"function"==typeof Y.addEventListener?Y.addEventListener("change",X):"function"==typeof Y.addListener&&Y.addListener(X)}catch(e){}}();let a=G.get(i);a&&a.version===V||(a={version:V,map:new Map},G.set(i,a));const s=a.map.get(t);if(void 0!==s)return s;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return a.map.set(t,l),l}function K(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function J(t){const n=function(){const[t,n]=e.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return e.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),t}(),o=e.useRef(n);o.current=n;const[r,i]=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]]]}(t.sizeProp,t.responsiveWidth,t.responsiveHeight),a=e.useMemo(()=>Object.assign(Object.assign({},t.marginDefault),t.userMargin),[t.marginDefault,t.userMargin]),s=i[0]-a.left-a.right,l=i[1]-a.top-a.bottom,c=K(t.foregroundGraphics,i,a),u=K(t.backgroundGraphics,i,a),d=q(e=>e.theme),{transition:p,introEnabled:f}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(r||!e||!0!==e&&!1===e.intro)}}(t.animate,t.transitionProp),y="semiotic-table-"+h.useId(),g=e.useRef(0),m=e.useRef(()=>{}),b=e.useCallback(()=>{g.current||(g.current=requestAnimationFrame(()=>m.current()))},[]);e.useEffect(()=>()=>{g.current&&(cancelAnimationFrame(g.current),g.current=0)},[]);const v=e.useRef(()=>{}),x=e.useRef(()=>{}),k=e.useRef(null),w=e.useRef(0),A=e.useCallback(()=>{w.current=0;const e=k.current;k.current=null,e&&v.current(e)},[]),j=e.useCallback(e=>{k.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(A))},[A]),O=e.useCallback(()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);e.useEffect(()=>()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const E=t.themeDirtyRef;return e.useEffect(()=>{E&&(V++,E.current=!0,b())},[d,b,E]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:r,size:i,margin:a,adjustedWidth:s,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:p,introEnabled:f,tableId:y,rafRef:g,renderFnRef:m,scheduleRender:b,hoverHandlerRef:v,hoverLeaveRef:x,onPointerMove:j,onPointerLeave:O}}const ee={fill:e=>h.createElement("rect",{style:e,width:16,height:16}),line:e=>h.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function te(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,ee[n])(o(e,t)),r}function ne(){return h.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function oe(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function re({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-"+h.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(h.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return h.createElement("g",{"aria-label":i||"Gradient legend"},h.createElement("defs",null,h.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},c)),i&&h.createElement("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),h.createElement("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),h.createElement("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])),h.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(h.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return h.createElement("g",{"aria-label":i||"Gradient legend"},i&&h.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),h.createElement("defs",null,h.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},c)),h.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),h.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])),h.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])))}function ie(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,p]=h.useState(0),[f,y]=h.useState(0),g=h.useCallback((e,t)=>{p(e),y(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,p)=>{u+=5,d.push(h.createElement("line",{key:"legend-top-line legend-symbol-"+p,stroke:"gray",x1:0,y1:u,x2:t,y2:u})),u+=8,e.label&&(u+=16,d.push(h.createElement("text",{key:"legend-text-"+p,y:u,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},e.label)),u+=8),d.push(h.createElement("g",{key:"legend-group-"+p,className:"legend-item",transform:`translate(0,${u})`},((e,t,n,o,r,i,a,s,l,c)=>{const{type:u="fill",styleFn:d,items:p}=e,f=[];let y=0;const g=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return p.forEach((e,c)=>{const b=te(e,c,u,d),v=oe(e,o,r),x=r&&r.size>0&&r.has(e.label);f.push(h.createElement("g",{key:"legend-item-"+c,transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:g?s===i&&c===a?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&m?x||!1:void 0,"aria-current":g&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:g?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)+p.length)%p.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:g?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:g?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},g&&h.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&&h.createElement(ne,null),h.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},e.label))),y+=22}),f})(e,n,o,r,i,a,s,p,l,c))),u+=22*e.items.length+8}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:f,onFocusedIndexChange:g,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 p=[];e.forEach((e,t)=>{let f=0;e.label&&(f+=16);const y=((e,t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:p,items:f}=e,y=[];let g=0,m=0;const b=!(!t&&!n),v="isolate"===c||void 0===c&&null!=r;f.forEach((e,c)=>{const x=te(e,c,d,p),k=oe(e,o,r),w=r&&r.size>0&&r.has(e.label),A=26+7*e.label.length;u&&u>0&&g>0&&g+A>u&&(m++,g=0),y.push(h.createElement("g",{key:"legend-item-"+c,transform:`translate(${g},${22*m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:b?s===i&&c===a?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&v?w||!1:void 0,"aria-current":b&&!v&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:b?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)+f.length)%f.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:b?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},b&&h.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"}),x,w&&h.createElement(ne,null),h.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},e.label))),g+=A});let x=0,k=0;for(const e of f){const t=26+7*e.label.length;u&&u>0&&k>0&&k+t>u?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:y,offset:x,totalRows:w,totalHeight:22*w}})(e,o,r,i,a,s,l,t,c,u,n);f+=y.offset+5,p.push(Object.assign(Object.assign({label:e.label},y),{offset:f,totalRows:y.totalRows,totalHeight:y.totalHeight})),d+=f+12});let f=d>n?0:Math.max(0,(n-d)/2);const y=[];return p.forEach((n,o)=>{const r=e[o];r.label&&(y.push(h.createElement("text",{key:"legend-text-"+o,transform:`translate(${f},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},r.label)),f+=16),y.push(h.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${f},0)`},n.items)),f+=n.offset+5,e[o+1]&&y.push(h.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:f,y1:-8,x2:f,y2:(n.totalHeight||t)+0+8})),f+=12}),h.createElement("g",null,y)})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:f,onFocusedIndexChange:g,legendInteraction:a}),b=!(!n&&!o);return h.createElement("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==s&&""!==s&&"vertical"===u&&h.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},s),m)}function ae(e){return"string"==typeof e?{type:e}:e}function se({orient:t,config:n,values:o,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===o.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)}}(o);if(!e)return null;const{q1:r,median:a,q3:s,whiskerLow:u,whiskerHigh:d}=e,p=Math.min(.5*n,20),f=(n-p)/2+4;if(c){const e=i(r),n=i(s),o=i(a),c=i(u),y=i(d),g="top"===t?-1:1,m=0;return h.createElement("g",{"data-testid":"marginal-boxplot-"+t},h.createElement("line",{x1:c,y1:m+g*(f+p/2),x2:y,y2:m+g*(f+p/2),stroke:l.fill,strokeWidth:l.strokeWidth}),h.createElement("line",{x1:c,y1:m+g*f,x2:c,y2:m+g*(f+p),stroke:l.fill,strokeWidth:l.strokeWidth}),h.createElement("line",{x1:y,y1:m+g*f,x2:y,y2:m+g*(f+p),stroke:l.fill,strokeWidth:l.strokeWidth}),h.createElement("rect",{x:Math.min(e,n),y:"top"===t?m-f-p:m+f,width:Math.abs(n-e),height:p,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),h.createElement("line",{x1:o,y1:"top"===t?m-f-p:m+f,x2:o,y2:"top"===t?m-f:m+f+p,stroke:l.fill,strokeWidth:2}))}{const e=i(r),n=i(s),o=i(a),c=i(u),y=i(d),g="left"===t?-1:1,m=0;return h.createElement("g",{"data-testid":"marginal-boxplot-"+t},h.createElement("line",{x1:m+g*(f+p/2),y1:c,x2:m+g*(f+p/2),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),h.createElement("line",{x1:m+g*f,y1:c,x2:m+g*(f+p),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),h.createElement("line",{x1:m+g*f,y1:y,x2:m+g*(f+p),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),h.createElement("rect",{x:"left"===t?m-f-p:m+f,y:Math.min(e,n),width:p,height:Math.abs(n-e),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),h.createElement("line",{x1:"left"===t?m-f-p:m+f,y1:o,x2:"left"===t?m-f:m+f+p,y2:o,stroke:l.fill,strokeWidth:2}))}}const u=r.bin().domain(e).thresholds(l.bins)(o);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 h.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 h.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 h.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 h.createElement("g",{"data-testid":"marginal-violin-"+t},h.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 h.createElement("g",{"data-testid":"marginal-ridgeline-"+t},h.createElement("path",{d:e.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[o,i,l,a,s,t,c,4]);return u?h.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function le(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let 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 ce(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 ue(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:p,disable:f,events:y={},"data-testid":g}=e,m=new Set(Array.isArray(f)?f:[]);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 h.createElement("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${t},${n})`,"data-testid":g},y),!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(h.createElement("line",{key:"connector-line",x1:s,y1:l,x2:e,y2:t,stroke:o||"var(--semiotic-text-secondary, 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(h.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||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return h.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(h.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, 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(h.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, 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(h.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;a.push(h.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?a.push(h.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||a.push(h.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"var(--semiotic-text-secondary, 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(h.createElement("path",{key:"bracket-path",d:ce((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||"var(--semiotic-text-secondary, currentColor)"}));break}}return h.createElement("g",{className:"annotation-subject"},a)}(x,c,d,t,n),!m.has("note")&&function(e,t,n,o){if(!e)return h.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return h.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 p="start";"topBottom"===u?"right"===d?p="end":"middle"===d&&(p="middle"):p=0>t?"end":"start";const f=16,y=i?c?[i]:le(i,l):[],g=r?c?[r]:le(r,l):[],m="leftRight"===u?"end"===p?-4:4:0;let b=0;const v=[],x=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(v.push(h.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:p,fontWeight:"bold"},y.map((e,t)=>h.createElement("tspan",{key:t,x:m,dy:0===t?0:f},e)))),b=y.length*f),g.length>0&&v.push(h.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:p,y:b},g.map((e,t)=>h.createElement("tspan",{key:t,x:m,dy:0===t?0:f},e))));let k=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===p?(t=-e,n=0):"middle"===p&&(t=-e/2,n=e/2),k=h.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+g.length)*f+(g.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),k=h.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,y.length+g.length-1)*f;let A=0;return"topBottom"===u?A=0>n?-(w+2):18:"leftRight"===u&&(A="middle"===d?-(w+f+(g.length>0&&y.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),h.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},h.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},v),k)}(s,b,v,d))}function de(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 h.createElement(ue,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return h.createElement("g",null,s)}const s=o.note||{title:"none",label:o.label};return h.createElement(ue,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${o.i}`,events:a},o,{type:i}))}function pe(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 he(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function fe(e,t,n){var o,r,i,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=pe(e,n),c=he(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 ye(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const ge={linear:a.curveLinear,monotoneX:a.curveMonotoneX,monotoneY:a.curveMonotoneY,step:a.curveStep,stepAfter:a.curveStepAfter,stepBefore:a.curveStepBefore,basis:a.curveBasis,cardinal:a.curveCardinal,catmullRom:a.curveCatmullRom};let me={positions:new Map};const be=new Set;function ve(){for(const e of be)e()}function xe(e,t){const n=me.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(me.positions);o.delete(e),me={positions:o},ve()}function ke(e,t){const n=me.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(me.positions);o.delete(e),me={positions:o},ve()}function we(){return me}function Ae(e){return be.add(e),()=>be.delete(e)}const je={positions:new Map};function Oe(){return()=>{}}function Ee(){return je}function Se(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Me(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 Ce(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Re(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function ze(t){var n,o;const{width:r,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:p,axes:y,xLabel:g,yLabel:m,yLabelRight:b,xFormat:v,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:j,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:C,marginalGraphics:R,xValues:z,yValues:$,annotations:L,svgAnnotationRules:B,xAccessor:I,yAccessor:D,annotationData:N,pointNodes:T,curve:W,underlayRendered:_,linkedCrosshairName:F,linkedCrosshairSourceId:q,children:H}=t,G=e.useMemo(()=>{var e;if(!p||!d)return[];const t=null==y?void 0:y.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||v||Ce,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=d.x.ticks(Math.min(o,Math.max(2,Math.floor(r/70)))),a=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:d.x(e),label:n(e,t,a)})),l=s.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(l+8,55)):Math.max(55,l+8);let u=Re(s,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=d.x.domain()[1],t=d.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,a);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[p,d,y,v,r]),V=e.useMemo(()=>{var e;if(!p||!d)return[];const t=null==y?void 0:y.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||Ce,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=Re(d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=d.y.domain()[1],t=d.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[p,d,y,x,s]),U=e.useMemo(()=>{var e;if(!p||!d)return[];const t=null==y?void 0:y.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||Ce,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Re(d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22)},[p,d,y,x,s]),Z=e.useRef(new Map),Y=e.useRef(null!==(n=null==L?void 0:L.length)&&void 0!==n?n:0),X=null!==(o=null==L?void 0:L.length)&&void 0!==o?o:0;Y.current!==X&&(Y.current=X,Z.current=new Map);const Q=e.useMemo(()=>{if(!L||0===L.length)return null;const e=function(e,t,n){var o,r,s,l,c,u,d,p,y,g,m,b,v,x,k,w,A,j,O,E,S,M,C,R,z,P,$,L,B,I,D,N,T,W,_,F,q,H,G,V,U,Z,Y,X,Q,K,J,ee;switch(e.type){case"label":{const o=fe(e,t,n);if(!o)return null;const{x:r,y:i}=o;return ye(r,i,n)?h.createElement(de,{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=fe(e,t,n);if(!o)return null;const{x:r,y:i}=o;return ye(r,i,n)?h.createElement(de,{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=pe(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let a;return a="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12,h.createElement("g",{key:"ann-"+t},h.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&&h.createElement("text",{x:o+4,y:a,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=he(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,s;return"left"===i?(a=4,s="start"):"center"===i?(a=(n.width||0)/2,s="middle"):(a=(n.width||0)-4,s="end"),h.createElement("g",{key:"ann-"+t},h.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&&h.createElement("text",{x:a,y:o-4,textAnchor:s,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:pe(Object.assign(Object.assign({},e),{type:"point"}),n),y:he(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 r=i.packEnclose(o),a=e.padding||10;return h.createElement("g",{key:"ann-"+t},h.createElement("circle",{cx:r.x,cy:r.y,r:r.r+a,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&h.createElement("text",{x:r.x,y:r.y-r.r-a-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:pe(Object.assign(Object.assign({},e),{type:"point"}),n),y:he(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 h.createElement("g",{key:"ann-"+t},h.createElement("rect",{x:s,y:c,width:l-s,height:u-c,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&h.createElement("text",{x:(s+l)/2,y:c-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #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={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return h.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=pe(t,n),a=he(t,n);if(null==r||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return h.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:a,r:s},l))}))}case"bracket":{const o=pe(e,n),r=he(e,n);return h.createElement(de,{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 i=n.data||[];if(2>i.length)return null;const a=n.xAccessor||"x",p=n.yAccessor||"y",y=i.map(e=>[e[a],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const g=null!==(r=null===(o=n.scales)||void 0===o?void 0:o.x)&&void 0!==r?r: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(!g||!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,f=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],f+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const y=u*h-d*d;if(1e-12>Math.abs(y))s.push([t,p/u]);else{const e=(u*f-d*p)/y;s.push([t,(p-e*d)/u+e*t])}}return s}(y,null!==(d=e.bandwidth)&&void 0!==d?d:.3):("polynomial"===b?f.default.polynomial(y,{order:e.order||2}):f.default.linear(y)).points;const x=v.map(([e,t])=>`${g(e)},${m(t)}`).join(" "),k=e.color||"#6366f1";return h.createElement("g",{key:"ann-"+t},h.createElement("polyline",{points:x,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&h.createElement("text",{x:g(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!==(y=null===(p=n.scales)||void 0===p?void 0:p.y)&&void 0!==y?y:null===(g=n.scales)||void 0===g?void 0:g.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 h.createElement("g",{key:"ann-"+t},h.createElement("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&h.createElement("text",{x:(n.width||0)-4,y:Math.min(r,i)-4,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",i=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(!i||!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 p=ge[n.curve||"linear"]||a.curveLinear,f=a.area().x(e=>i(e[r])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(p)(d);if(!f)return null;const y=e.fill||"#6366f1";return h.createElement("g",{key:"ann-"+t},h.createElement("path",{d:f,fill:y,fillOpacity:null!==(O=e.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),e.label&&d.length>0&&h.createElement("text",{x:i(d[d.length-1][r])+4,y:s(d[d.length-1][l])-4,fill:y,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===(E=n.scales)||void 0===E?void 0:E.x)&&void 0!==S?S:null===(M=n.scales)||void 0===M?void 0:M.time,a=null!==(R=null===(C=n.scales)||void 0===C?void 0:C.y)&&void 0!==R?R:null===(z=n.scales)||void 0===z?void 0:z.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!==(P=e.threshold)&&void 0!==P?P:2,p=l-d*u,f=!1!==e.showBand,y=e.fill||"#6366f1",g=null!==($=e.fillOpacity)&&void 0!==$?$:.1,m=e.anomalyColor||"#ef4444",b=null!==(L=e.anomalyRadius)&&void 0!==L?L:6,v=a(l+d*u),x=a(p),k=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return h.createElement("g",{key:"ann-"+t},f&&h.createElement("rect",{x:0,y:Math.min(v,x),width:n.width||0,height:Math.abs(x-v),fill:y,fillOpacity:g}),k.map((e,t)=>{const o=pe(e,n),r=he(e,n);return null==o||null==r?null:h.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),e.label&&h.createElement("text",{x:(n.width||0)-4,y:Math.min(v,x)-4,textAnchor:"end",fill:y,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===(B=n.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(D=n.scales)||void 0===D?void 0:D.time,s=null!==(T=null===(N=n.scales)||void 0===N?void 0:N.y)&&void 0!==T?T:null===(W=n.scales)||void 0===W?void 0:W.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=f.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),p=Math.sqrt(d/Math.max(u-2,1)),y=l.reduce((e,t)=>e+t[0],0)/u,g=l.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),m=null!==(_=e.confidence)&&void 0!==_?_:.95,b=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,v=null!==(F=e.steps)&&void 0!==F?F: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=p*Math.sqrt(1+1/u+(g>0?Math.pow(e-y,2)/g: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`,O=A.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),E=`${a(x)},${s(c(x))}`,S=e.strokeColor||"#6366f1";return h.createElement("g",{key:"ann-"+t},h.createElement("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:null!==(q=e.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),h.createElement("polyline",{points:`${E} ${O}`,fill:"none",stroke:S,strokeWidth:null!==(H=e.strokeWidth)&&void 0!==H?H:2,strokeDasharray:null!==(G=e.strokeDasharray)&&void 0!==G?G:"6,3"}),e.label&&A.length>0&&h.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=fe(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!ye(o,r,n))return null;const i=null!==(V=e.dx)&&void 0!==V?V:0,a=null!==(U=e.dy)&&void 0!==U?U:0,s=null!==(Z=e.width)&&void 0!==Z?Z:32,l=null!==(Y=e.height)&&void 0!==Y?Y:32,c=null!==(X=e.content)&&void 0!==X?X:h.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return h.createElement("foreignObject",{key:"ann-"+t,x:o+i-s/2,y:r+a-l/2,width:s,height:l,style:{overflow:"visible",pointerEvents:"auto"}},h.createElement("div",{style:{width:s,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},c))}case"text":{const o=fe(e,t,n);if(!o)return null;const{x:r,y:i}=o;return h.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)}case"category-highlight":{const o=e.category;if(null==o)return null;const r=null===(Q=n.scales)||void 0===Q?void 0:Q.o,i=null===(K=n.scales)||void 0===K?void 0:K.x,a=null===(J=n.scales)||void 0===J?void 0:J.y,s=(null==r?void 0:r.bandwidth)?r:(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:null;if(!s)return null;const l=s(o);if(null==l)return null;const c=s.bandwidth(),u=e.color||"var(--semiotic-primary, #4589ff)",d=null!==(ee=e.opacity)&&void 0!==ee?ee:.15,p=e.label;return(n.projection?"vertical"===n.projection:s===i)?h.createElement("g",{key:"ann-"+t},h.createElement("rect",{x:l,y:0,width:c,height:n.height||0,fill:u,fillOpacity:d}),p&&h.createElement("text",{x:l+c/2,y:12,textAnchor:"middle",fill:u,fontSize:12,fontWeight:"bold"},p)):h.createElement("g",{key:"ann-"+t},h.createElement("rect",{x:0,y:l,width:n.width||0,height:c,fill:u,fillOpacity:d}),p&&h.createElement("text",{x:12,y:l+c/2,dominantBaseline:"middle",fill:u,fontSize:12,fontWeight:"bold"},p))}default:return null}},t={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:I,yAccessor:D,width:r,height:s,data:N,frameType:"xy",pointNodes:T,curve:W,stickyPositionCache:Z.current};return L.map((n,o)=>{if(B){const r=B(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[L,B,r,s,I,D,N,d,T,W]),K=function(t){var n;const o=e.useSyncExternalStore(t?Ae:Oe,t?we:Ee,t?we:Ee);return t&&null!==(n=o.positions.get(t))&&void 0!==n?n:null}(F);return e.useEffect(()=>{if(!(null==K?void 0:K.locked)||!F)return;const e=e=>{"Escape"===e.key&&ke(F)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==K?void 0:K.locked,F]),p||w||A||C||R||Q&&Q.length>0||k||H||K?h.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},h.createElement("title",null,"string"==typeof w?w:"XY Chart"),h.createElement("desc",null,"string"==typeof w?w+" — XY data visualization":"XY data visualization"),h.createElement("g",{transform:`translate(${u.left},${u.top})`},k&&d&&!_&&(()=>{var e,t;const n=Se(null===(e=null==y?void 0:y.find(e=>"bottom"===e.orient))||void 0===e?void 0:e.gridStyle),o=Se(null===(t=null==y?void 0:y.find(e=>"left"===e.orient))||void 0===t?void 0:t.gridStyle);return h.createElement("g",{className:"stream-grid"},G.map((e,t)=>h.createElement("line",{key:"xgrid-"+t,x1:e.pixel,y1:0,x2:e.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n})),V.map((e,t)=>h.createElement("line",{key:"ygrid-"+t,x1:0,y1:e.pixel,x2:r,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o})))})(),p&&d&&(()=>{const e=null==y?void 0:y.find(e=>"left"===e.orient),t=null==y?void 0:y.find(e=>"bottom"===e.orient),n=!e||!1!==e.baseline,o=!t||!1!==t.baseline,i=(null==e?void 0:e.jaggedBase)||!1,a=(null==t?void 0:t.jaggedBase)||!1,l=null==t?void 0:t.landmarkTicks,c=null==e?void 0:e.landmarkTicks,d="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",f="var(--semiotic-text, #333)",v=!!(null==t?void 0:t.autoRotate)&&G.length>1&&(()=>{const e=r/Math.max(G.length-1,1);return G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return h.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!_&&o&&!a&&h.createElement("line",{x1:0,y1:s,x2:r,y2:s,stroke:d,strokeWidth:1}),!_&&a&&h.createElement("path",{d:Me("bottom",r,s),fill:"none",stroke:d,strokeWidth:1}),G.map((e,t)=>{const n=!!l&&("function"==typeof l?l(e.value,t):P(e.value,t>0?G[t-1].value:void 0));return h.createElement("g",{key:"xtick-"+t,transform:`translate(${e.pixel},${s})`},h.createElement("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?h.createElement("text",{y:v?10:18,textAnchor:v?"end":"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:p,style:{userSelect:"none"},transform:v?"rotate(-45)":void 0},e.label):h.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},h.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},e.label)))}),g&&h.createElement("text",{x:r/2,y:s+40,textAnchor:"middle",fontSize:12,fill:f,style:{userSelect:"none"}},g),!_&&n&&!i&&h.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:d,strokeWidth:1}),!_&&i&&h.createElement("path",{d:Me("left",r,s),fill:"none",stroke:d,strokeWidth:1}),V.map((e,t)=>{const n=!!c&&("function"==typeof c?c(e.value,t):P(e.value,t>0?V[t-1].value:void 0));return h.createElement("g",{key:"ytick-"+t,transform:`translate(0,${e.pixel})`},h.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?h.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:p,style:{userSelect:"none"}},e.label):h.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},h.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},e.label)))}),(()=>{const t=(null==e?void 0:e.label)||m;return t?h.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},t):null})(),(()=>{const e=null==y?void 0:y.find(e=>"right"===e.orient);if(!e||0===U.length)return null;const t=e.landmarkTicks,n=e.label||b;return h.createElement(h.Fragment,null,!1!==e.baseline&&h.createElement("line",{x1:r,y1:0,x2:r,y2:s,stroke:d,strokeWidth:1}),U.map((e,n)=>{const o=!!t&&("function"==typeof t?t(e.value,n):P(e.value,n>0?U[n-1].value:void 0));return h.createElement("g",{key:"ytick-r-"+n,transform:`translate(${r},${e.pixel})`},h.createElement("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?h.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:p,style:{userSelect:"none"}},e.label):h.createElement("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"}},h.createElement("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"}},e.label)))}),n&&h.createElement("text",{x:r+u.right-15,y:s/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(90, ${r+u.right-15}, ${s/2})`,style:{userSelect:"none"}},n))})())})(),Q,R&&d&&z&&$&&h.createElement(h.Fragment,null,R.top&&h.createElement("g",{transform:"translate(0, 0)"},h.createElement(se,{orient:"top",config:ae(R.top),values:z,scale:d.x,size:u.top,length:r})),R.bottom&&h.createElement("g",{transform:`translate(0, ${s})`},h.createElement(se,{orient:"bottom",config:ae(R.bottom),values:z,scale:d.x,size:u.bottom,length:r})),R.left&&h.createElement("g",{transform:"translate(0, 0)"},h.createElement(se,{orient:"left",config:ae(R.left),values:$,scale:d.y,size:u.left,length:s})),R.right&&h.createElement("g",{transform:`translate(${r}, 0)`},h.createElement(se,{orient:"right",config:ae(R.right),values:$,scale:d.y,size:u.right,length:s}))),C,K&&K.sourceId!==q&&(null==d?void 0:d.x)&&(()=>{const e=d.x(K.xValue);if(null==e||0>e||e>r)return null;const t=K.locked;return h.createElement("line",{x1:e,y1:0,x2:e,y2:s,stroke:t?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:t?1.5:1,strokeDasharray:t?"6,3":"4,4",pointerEvents:"none"})})(),H),w&&h.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w: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 p="top"===i||"bottom"===i;let f,y;return"left"===i?(f=4,y=r.top):"top"===i?(f=0,y=a?32:8):"bottom"===i?(f=0,y=o-r.bottom+50):(f=n-r.right+10,y=r.top),h.createElement("g",{transform:`translate(${f}, ${y})`},"object"==typeof(g=t)&&null!==g&&"gradient"in g?h.createElement(re,{config:t.gradient,orientation:p?"horizontal":"vertical",width:p?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?h.createElement(ie,{legendGroups:t.legendGroups,title:"",width:p?n:100,orientation:p?"horizontal":"vertical",customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t);var g}({legend:A,totalWidth:l,totalHeight:c,margin:u,legendPosition:M,title:w,legendHoverBehavior:j,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:S})):null}function Pe(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const $e="undefined"==typeof window||"undefined"==typeof document,Le=h.createContext(null),Be={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ie(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const De=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Ne={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Te={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},We={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},_e={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Fe={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},qe={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},He={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Ge({scene:e,chartType:t,tableId:n,chartTitle:o}){var r;const[i,a]=h.useState(!1),s=h.useContext(Le),l=null!==(r=null==s?void 0:s.visible)&&void 0!==r&&r,c=i||l,u=h.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t,p=h.useCallback(()=>{i||l||a(!0)},[i,l]),f=h.useCallback(e=>{var t;l||(null===(t=u.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[l]);if(!e||0===e.length)return n?h.createElement("span",{id:n,tabIndex:-1,style:Be}):null;if(!c)return h.createElement("div",{id:n,tabIndex:-1,onFocus:p,style:Be,role:"region","aria-label":d},h.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",e.length," elements)"));const y=function(e){var t,n,o,r,i,a,s,l,c,u,d,p,h,f,y,g,m,b,v,x,k,w,A,j,O;const E=[];if(!Array.isArray(e))return E;for(const S of e)if(S&&"object"==typeof S)try{switch(S.type){case"point":E.push({label:"Point",values:{x:S.x,y:S.y}});break;case"line":{const e=S.path,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=S.topPath,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=S.datum&&"object"==typeof S.datum?S.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:S.group)&&void 0!==n?n:"",a=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;E.push({label:"Bar",values:{category:i,value:null!=a?a:""}});break}case"heatcell":E.push({label:"Cell",values:{x:S.x,y:S.y,value:S.value}});break;case"wedge":E.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(i=S.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:null===(s=S.datum)||void 0===s?void 0:s.label)&&void 0!==l?l:"",value:null!==(u=null===(c=S.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":E.push({label:"Node",values:{id:null!==(p=null===(d=S.datum)||void 0===d?void 0:d.id)&&void 0!==p?p:"",x:null!==(h=S.cx)&&void 0!==h?h:S.x,y:null!==(f=S.cy)&&void 0!==f?f:S.y}});break;case"arc":E.push({label:"Arc",values:{id:null!==(g=null===(y=S.datum)||void 0===y?void 0:y.id)&&void 0!==g?g:"",x:null!==(m=S.cx)&&void 0!==m?m:S.x,y:null!==(b=S.cy)&&void 0!==b?b:S.y}});break;case"candlestick":E.push({label:"Candlestick",values:{x:S.x,open:S.open,high:S.high,low:S.low,close:S.close}});break;case"geoarea":E.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(v=S.datum)||void 0===v?void 0:v.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=S.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(O=null===(j=S.datum)||void 0===j?void 0:j.value)&&void 0!==O?O:""}})}}catch(e){}return E}(e),g=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${De(e.min)} to ${De(e.max)}, mean ${De(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,g),b=y.slice(0,5),v=new Set;for(const e of b)for(const t of Object.keys(e.values))v.add(t);const x=Array.from(v);return h.createElement("div",{ref:u,id:n,tabIndex:-1,onBlur:f,style:Ne,role:"region","aria-label":d},h.createElement("button",{type:"button",onClick:()=>{l&&s&&s.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:We},"×"),h.createElement("div",{role:"note",style:Te},m),h.createElement("table",{role:"table","aria-label":"Sample data for "+t,style:_e},h.createElement("caption",{style:He},"First ",b.length," of ",y.length," data points"),h.createElement("thead",null,h.createElement("tr",null,h.createElement("th",{style:Fe},"type"),x.map(e=>h.createElement("th",{key:e,style:Fe},e)))),h.createElement("tbody",null,b.map((e,t)=>h.createElement("tr",{key:t},h.createElement("td",{style:qe},e.label),x.map(t=>{return h.createElement("td",{key:t,style:qe},null==(n=e.values[t])||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":De(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"");var n}))))))}function Ve({summary:e}){return e?h.createElement("div",{role:"note",style:Be},e):null}function Ue({tableId:e}){return h.createElement("a",{href:"#"+e,style:Be,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Be)}},"Skip to data table")}function Ze({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 h.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:Be},t)}const Ye="var(--semiotic-focus, #005fcc)";function Xe({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:a}){if(!e||!t)return null;const s=t.x+n.left,l=t.y+n.top;let c;if("rect"===r&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);c=h.createElement("rect",{x:s-e/2-3,y:l-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ye,strokeWidth:2,strokeDasharray:"4,2"})}else c=h.createElement("circle","wedge"===r?{cx:s,cy:l,r:12,fill:"none",stroke:Ye,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:l,r:8,fill:"none",stroke:Ye,strokeWidth:2,strokeDasharray:"4,2"});return h.createElement("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},c)}function Qe({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=h.useRef(null),[c,u]=h.useState(null);h.useLayoutEffect(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect();u(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,a,n,o]);let d;return d=c?`translate(${c.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${c.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`,h.createElement("div",{ref:l,className:a,style:{position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:s,width:"max-content"}},i)}function Ke(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Je(e,t,n=.6){var o,r,i,a,s;if(!Ke(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 et(e,t,n,o=.35){Ke(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function tt(e){switch(e){case"monotoneX":return a.curveMonotoneX;case"monotoneY":return a.curveMonotoneY;case"cardinal":return a.curveCardinal;case"catmullRom":return a.curveCatmullRom;case"step":return a.curveStep;case"stepBefore":return a.curveStepBefore;case"stepAfter":return a.curveStepAfter;case"basis":return a.curveBasis;case"natural":return a.curveNatural;default:return null}}function nt(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 ot(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 rt(e){return e.k}function it(e){return[e.x,e.y]}function at(e){return function(){return e}}function st([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function lt(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 ct(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function ut(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 dt{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 pt{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=ht(a),l=ft(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 ht(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 ft(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],a=Math.sqrt(r*r+i*i);if(n+a>=t||o===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[o-1][0]+r*s,y:e[o-1][1]+i*s,nx:-i/l,ny:r/l}}n+=a}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const yt={top:10,right:10,bottom:10,left:10},gt={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"},mt={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 bt({data:e}){if(!e)return null;if(e.properties)return h.createElement("div",{className:"semiotic-tooltip",style:gt},h.createElement("div",{style:{fontWeight:600}},e.properties.name||e.properties.NAME||e.properties.id||"Feature"));const t=Object.entries(e).slice(0,3);return h.createElement("div",{className:"semiotic-tooltip",style:gt},t.map(([e,t])=>h.createElement("div",{key:e},h.createElement("span",{style:{opacity:.7}},e,": "),h.createElement("span",{style:{fontWeight:600}},t+""))))}const vt=e.forwardRef(function(t,n){var o,r,i,s,u,d,p,f,y,g;const{projection:m,projectionExtent:b,fitPadding:v,projectionTransform:x,areas:k,points:w,lines:A,xAccessor:j,yAccessor:O,lineDataAccessor:E,pointIdAccessor:S,lineType:M="geo",flowStyle:R="basic",graticule:z,zoomable:P,zoomExtent:L,onZoom:B,dragRotate:I,showParticles:D,particleStyle:N,tileURL:T,tileAttribution:W,tileCacheSize:_,size:F,width:q,height:H,responsiveWidth:G,responsiveHeight:V,margin:U,className:Z,background:Y,areaStyle:X,pointStyle:K,lineStyle:ee,colorScheme:te,enableHover:ne=!0,hoverAnnotation:oe,tooltipContent:re,customClickBehavior:ie,customHoverBehavior:ae,annotations:se,decay:le,pulse:ce,transition:ue,animate:de,staleness:pe,backgroundGraphics:he,foregroundGraphics:fe,title:ye,legend:ge,legendPosition:me,legendHoverBehavior:be,legendClickBehavior:ve,legendHighlightedCategory:xe,legendIsolatedCategories:ke,showAxes:we,accessibleTable:Ae=!0,description:je,summary:Oe}=t,Ee=F||[q||600,H||400],Se=e.useRef(!0),Me=J({sizeProp:Ee,responsiveWidth:G,responsiveHeight:V,userMargin:U,marginDefault:yt,foregroundGraphics:fe,backgroundGraphics:he,animate:de,transitionProp:ue,themeDirtyRef:Se}),{reducedMotionRef:Ce,responsiveRef:Re,size:Le,margin:Be,adjustedWidth:De,adjustedHeight:Ne,resolvedForeground:Te,resolvedBackground:We,transition:_e,introEnabled:Fe,tableId:qe,rafRef:He,renderFnRef:Ye,scheduleRender:Ke}=Me,ht=e.useMemo(()=>null!=I?I:"orthographic"===("string"==typeof m?m:"object"==typeof m&&"type"in m?m.type:null),[I,m]),ft=e.useMemo(()=>({projection:m,projectionExtent:b,fitPadding:v,xAccessor:j,yAccessor:O,lineDataAccessor:E,lineType:M,flowStyle:R,areaStyle:X,pointStyle:K,lineStyle:ee,colorScheme:te,graticule:z,projectionTransform:x,decay:le,pulse:ce,transition:_e,introAnimation:Fe,annotations:se,pointIdAccessor:S}),[m,b,v,j,O,E,M,R,X,K,ee,te,z,x,le,ce,null==_e?void 0:_e.duration,null==_e?void 0:_e.easing,Fe,se,S]),gt=e.useRef(null);gt.current||(gt.current=new C(ft));const vt=e.useRef(null),xt=e.useRef(null),kt=e.useRef(null),wt=e.useRef(null),At=e.useRef(null);T&&!At.current&&(At.current=new dt(_||256));const jt=e.useRef(se),Ot=e.useRef(null),Et=e.useRef(l.zoomIdentity),St=e.useRef(!1),Mt=e.useRef(null),Ct=e.useRef(null),Rt=e.useRef(null),zt=e.useRef(null),Pt=e.useRef(0);if(D&&!zt.current){const e=null!==(o=null==N?void 0:N.maxPerLine)&&void 0!==o?o:30;zt.current=new pt(50*e)}const $t=e.useRef(null),Lt=e.useRef(null),[Bt,It]=e.useState(null),[Dt,Nt]=e.useState(0),[Tt,Wt]=e.useState(!1);e.useEffect(()=>{var e;null===(e=gt.current)||void 0===e||e.updateConfig(ft),Se.current=!0,Ke()},[ft,Ke]),e.useEffect(()=>{const e=gt.current;e&&(k&&e.setAreas(k),w&&e.setPoints(w),A&&e.setLines(A),Se.current=!0,Ke())},[k,w,A,Ke]);const _t=e.useCallback(e=>{var t;null===(t=gt.current)||void 0===t||t.pushPoint(e),Se.current=!0,Ke()},[Ke]),Ft=e.useCallback(e=>{var t;null===(t=gt.current)||void 0===t||t.pushMany(e),Se.current=!0,Ke()},[Ke]),qt=e.useCallback(()=>{var e;null===(e=gt.current)||void 0===e||e.clear(),Se.current=!0,Ke()},[Ke]);e.useImperativeHandle(n,()=>({push:_t,pushMany:Ft,removePoint:e=>{var t,n;const o=null!==(n=null===(t=gt.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Se.current=!0,Ke()),o},clear:qt,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=gt.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=gt.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=gt.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>Et.current.k,resetZoom:()=>{const e=Mt.current;e&&Ot.current&&c.select(e).call(Ot.current.transform,l.zoomIdentity)},getData:()=>{var e,t;return null!==(t=null===(e=gt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[_t,Ft,qt,Ke]);const{hoverHandlerRef:Ht,onPointerMove:Gt,onPointerLeave:Vt}=Me;e.useEffect(()=>{Ht.current=e=>{if(!ne)return;const t=gt.current;if(!t||!t.scene.length)return;const n=xt.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Be.left,i=e.clientY-o.top-Be.top;if(0>r||r>De||0>i||i>Ne)return $t.current=null,Lt.current=null,It(null),null==ae||ae(null),void Ke();wt.current||(wt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const a=wt.current.getContext("2d");if(!a)return;const s=$(t.scene,r,i,30,a,t.quadtree,t.maxPointRadius);if(s){const e=s.node,t=e.datum,n=(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,a;"point"===e.type?(o=e.x,a=e.y):"geoarea"===e.type?(o=e.centroid[0],a=e.centroid[1]):(o=r,a=i);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,x:o,y:a,time:o,value:a});$t.current=l,Lt.current=e,It(l),null==ae||ae(l),Ke()}else $t.current&&($t.current=null,Lt.current=null,It(null),null==ae||ae(null),Ke())}},[ne,De,Ne,Be,ae,Ke]),Me.hoverLeaveRef.current=()=>{$t.current=null,Lt.current=null,It(null),null==ae||ae(null),Ke()};const Ut=e.useCallback(e=>{if(!ie)return;const t=gt.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Be.left,r=e.clientY-n.top-Be.top;wt.current||(wt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=wt.current.getContext("2d");if(!i)return;const a=$(t.scene,o,r,30,i,t.quadtree,t.maxPointRadius);if(a){const e=a.node.datum,t=(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;ie(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,x:o,y:r,time:o,value:r}))}},[ie,Be]),Zt=e.useRef(-1),Yt=e.useRef(null),Xt=e.useCallback(e=>{const t=gt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)"point"===n.type&&null!=n.x?t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"}):"geoarea"===n.type&&n.centroid&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"circle"});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=Zt.current,r=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return Zt.current=-1,Yt.current=null,$t.current=null,Lt.current=null,It(null),null==ae||ae(null),void Ke();const i=0>o?0:r;Zt.current=i;const a=n[i];Yt.current={shape:a.shape,w:a.w,h:a.h};const s=a.datum;let l=s;s&&"object"==typeof s&&"geometry"in s&&s.properties&&"object"==typeof s.properties&&(l=Object.assign(Object.assign({},s),s.properties));const c=Object.assign(Object.assign({},l),{data:s,properties:null==s?void 0:s.properties,x:a.x,y:a.y,time:a.x,value:a.y});$t.current=c,It(c),null==ae||ae(c),Ke()},[ae,Ke]),Qt=e.useCallback(e=>{Zt.current=-1,Yt.current=null,Gt(e)},[Gt]);Ye.current=()=>{var e,t,n,o,r,i,s;He.current=0;const l=xt.current,c=gt.current;if(!l||!c)return;const u=performance.now();let d=!1;const p=Rt.current;p&&(Rt.current=null,c.applyRotation(p,{width:De,height:Ne}));const h=c.advanceTransition(Ce.current?u+1e6:u),f=!Ce.current&&h;if(Se.current&&!h){const e={width:De,height:Ne},t=ht?c.getRotation():null;c.computeScene(e);const n=Et.current,o=1!==n.k||0!==n.x||0!==n.y;ht&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),Se.current=!1,l.setAttribute("aria-label",Ie(c.scene,"Geographic chart"))}const y=ct();if(T&&At.current){const t=vt.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=lt(t,Le,Be,y);if(e){e.clearRect(-Be.left,-Be.top,Le[0],Le[1]),e.save(),e.beginPath(),e.rect(0,0,De,Ne),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=rt,l=it,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)),f=Math.pow(2,p-h)*a,y=+d[0]-u/2,g=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-y)/f)),b=Math.min(r?1<<h:1/0,Math.ceil((n-y)/f)),v=Math.max(i?0:-1/0,Math.floor((t-g)/f)),x=Math.min(i?1<<h:1/0,Math.ceil((o-g)/f)),k=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)k.push([t,e,h]);return k.translate=[y/f,g/f],k.scale=f,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:at(+e),u):s},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:at([+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=ct();let h=!0;for(const t of d){const[o,r,i]=st(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=ut(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:T,projection:c.scales.projection,width:De,height:Ne,tileCache:At.current,onTileLoad:()=>Ke()});e.restore(),t||(d=!0)}}}const g=lt(l,Le,Be,y);if(!g)return;g.clearRect(-Be.left,-Be.top,Le[0],Le[1]),Y&&!T&&(g.fillStyle=Y,g.fillRect(0,0,De,Ne)),g.save(),g.beginPath(),g.rect(0,0,De,Ne),g.clip();const m=c.scene,b={width:De,height:Ne};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=Q(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(r=t._decayOpacity)&&void 0!==r?r:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(i)}et(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(g,m),((e,t,n,o)=>{var r,i;const s=t.filter(e=>"line"===e.type);for(const l of s){if(2>l.path.length)continue;const c=l._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=l.style.stroke||"#007bff",d=l.style.strokeWidth||2,p=l.colorThresholds,h=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=d,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const m=null!==(r=l.style.opacity)&&void 0!==r?r:1;ot(e,l.path,u,d,m,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=tt(l.curve),y=p&&p.length>0&&h&&h.length===l.path.length,g=l._decayOpacities;if(g&&g.length===l.path.length&&!y){e.strokeStyle=u;const b=null!==(i=l.style.opacity)&&void 0!==i?i:1;for(let v=0;l.path.length-1>v;v++)e.globalAlpha=.5*(g[v]+g[v+1])*b,e.beginPath(),e.moveTo(l.path[v][0],l.path[v][1]),e.lineTo(l.path[v+1][0],l.path[v+1][1]),e.stroke()}else if(y){let x=null,k=null,w=null,A=null,j=!1;function O(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),j=!0}function E(){j&&(e.stroke(),j=!1)}for(let S=0;l.path.length>S;S++){const[M,C]=l.path[S],R=h[S],z=nt(R,p,u);if(null!==x&&null!==A&&null!==w){if(z===A)e.lineTo(M,C);else{const P=[];for(const $ of p){const L=$.value;(w>L||L>R)&&(L>w||R>L)||w===L||R===L||P.push({t:(L-w)/(R-w)})}P.sort((e,t)=>e.t-t.t);for(const B of P){const I=x+(M-x)*B.t,D=k+(C-k)*B.t,N=nt(w+(R-w)*Math.min(B.t+1e-4,1),p,u);e.lineTo(I,D),E(),O(N,I,D)}e.lineTo(M,C)}x=M,k=C,w=R,A=z}else O(z,M,C),x=M,k=C,w=R,A=z}E()}else{if(e.beginPath(),!l.strokeGradient||2>l.strokeGradient.colorStops.length||2>l.path.length)e.strokeStyle=u;else{const T=e.createLinearGradient(l.path[0][0],0,l.path[l.path.length-1][0],0);for(const W of l.strokeGradient.colorStops)T.addColorStop(Math.max(0,Math.min(1,W.offset)),W.color);e.strokeStyle=T}if(f)a.line().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(l.path);else{const[_,F]=l.path[0];e.moveTo(_,F);for(let q=1;l.path.length>q;q++)e.lineTo(l.path[q][0],l.path[q][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=("string"==typeof l.style.fill?Q(e,l.style.fill):l.style.fill)||l.style.fill,f&&!y)a.line().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(l.path);else{const[G,V]=l.path[0];e.moveTo(G,V);for(let U=1;l.path.length>U;U++)e.lineTo(l.path[U][0],l.path[U][1])}const H=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(H,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(g,m,0,b),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=("string"==typeof t.style.fill?Q(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?Q(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Je(e,t),e.globalAlpha=1}}finally{e.restore()}}})(g,m),D&&zt.current){const e=zt.current,a=m.filter(e=>"line"===e.type);if(a.length>0){const s=N||{},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,f=null!==(i=s.opacity)&&void 0!==i?i:.7,y=u/1e3,m=Pt.current>0?Math.min(y-Pt.current,.1):.016;Pt.current=y;const b=a.map(e=>e.path),v=a.map(e=>e.style.strokeWidth||2);for(let t=0;a.length>t;t++)Math.random()<p&&e.countForLine(t)<c&&e.spawn(t);e.step(m,l,b,v),g.globalAlpha=f;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=a[n.lineIndex],r="function"==typeof s.color?s.color(null==o?void 0:o.datum):"source"!==s.color&&s.color?s.color:(null==o?void 0:o.style.stroke)||"#fff";g.beginPath(),g.arc(n.x,n.y,h,0,2*Math.PI),g.fillStyle=r,g.fill()}g.globalAlpha=1,d=!0}}g.restore();const v=kt.current;if(v){const e=lt(v,Le,Be,y);if(e){e.clearRect(-Be.left,-Be.top,Le[0],Le[1]);const t=Lt.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof oe?oe:void 0,r=(null==o?void 0:o.pointColor)||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(pe){const e=performance.now()-c.lastIngestTime>(null!==(s=pe.threshold)&&void 0!==s?s:5e3);e!==Tt&&Wt(e)}const x=se!==jt.current;x&&(jt.current=se),(Se.current||x)&&Nt(e=>e+1),(f||null!=c.activeTransition||c.hasActivePulses||d)&&(He.current=requestAnimationFrame(()=>Ye.current()))},e.useEffect(()=>(Ke(),()=>{var e;null===(e=At.current)||void 0===e||e.clear()}),[Ke]),e.useEffect(()=>{Se.current=!0,Ke()},[De,Ne,Y,Ke]),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])}(pe,gt,Se,Ke,Tt,Wt),e.useEffect(()=>{if("production"!==process.env.NODE_ENV&&T){const e="string"==typeof m?m:"object"==typeof m&&"type"in m?m.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.`)}},[T,m]),e.useEffect(()=>{const e=Mt.current;if(!P||!e)return Ot.current&&e&&(c.select(e).on(".zoom",null),Ot.current=null),void(e&&c.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=L||[1,8],o={width:De,height:Ne};if(ht){let r=Et.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),Et.current=l.zoomIdentity.scale(r);const a=gt.current;a&&(a.applyZoomScale(r,o),Se.current=!1,Ke(),null==B||B({projection:null===(i=a.scales)||void 0===i?void 0:i.projection,zoom:a.currentZoom}))};Ot.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const a=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",s);const 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=gt.current;if(!o)return;const r=o.getRotation();Ct.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=Ct.current;t&&(Rt.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]],Ke())},p=t=>{var n;if(!Ct.current)return;Ct.current=null,e.releasePointerCapture(t.pointerId);const r=Rt.current;if(r){Rt.current=null;const e=gt.current;e&&(e.applyRotation(r,o),Ke())}const i=gt.current;i&&(null==B||B({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",s),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",p),e.removeEventListener("pointercancel",p),Ot.current=null}}const r=l.zoom().scaleExtent([t,n]).extent([[0,0],[Le[0],Le[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;Et.current=t,St.current=!0;const n=gt.current;n&&(n.applyZoomTransform(t,o),Se.current=!1,Ke())}).on("end",e=>{var t;Et.current=e.transform,St.current=!1;const n=gt.current;n&&(null==B||B({projection:null===(t=n.scales)||void 0===t?void 0:t.projection,zoom:n.currentZoom}))});return Ot.current=r,c.select(e).call(r),()=>{c.select(e).on(".zoom",null)}},[P,L,ht,Le,De,Ne,Be,B,Ke]);const Kt=ne&&!1!==oe,Jt=Kt&&Bt?re?re(Bt):h.createElement(bt,{data:Bt}):null,en=Jt?h.createElement(Qe,{x:Bt.x,y:Bt.y,containerWidth:De,containerHeight:Ne,margin:Be,className:"stream-frame-tooltip",zIndex:10},Jt):null;if($e){const e=gt.current;e&&(k||w||A)&&(k&&e.setAreas(k),w&&e.setPoints(w),A&&e.setLines(A),e.computeScene({width:De,height:Ne}));const t=null!==(r=null==e?void 0:e.scene)&&void 0!==r?r:[];return h.createElement("div",{className:"stream-geo-frame"+(Z?" "+Z:""),role:"img","aria-label":je||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:Le[0],height:Le[1]}},h.createElement(Ve,{summary:Oe}),h.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Le[0],height:Le[1],style:{position:"absolute",left:0,top:0}},h.createElement("g",{transform:`translate(${Be.left},${Be.top})`},We),h.createElement("g",{transform:`translate(${Be.left},${Be.top})`},Y&&h.createElement("rect",{x:0,y:0,width:De,height:Ne,fill:Y}),t.map((e,t)=>function(e,t){var n,o,r,i,a,s;switch(e.type){case"geoarea":{const r=e;return r.pathData?h.createElement("path",{key:"geoarea-"+t,d:r.pathData,fill:Pe(r.style.fill,"#e0e0e0"),fillOpacity:null!==(n=r.style.fillOpacity)&&void 0!==n?n:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(o=r._decayOpacity)&&void 0!==o?o:1}):null}case"point":{const n=e;return h.createElement("circle",{key:"point-"+t,cx:n.x,cy:n.y,r:n.r,fill:Pe(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:null!==(i=n._decayOpacity)&&void 0!==i?i:null!==(a=n.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 h.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)))),h.createElement(ze,{width:De,height:Ne,totalWidth:Le[0],totalHeight:Le[1],margin:Be,scales:null,showAxes:!1,title:ye,legend:ge,legendPosition:me,legendHoverBehavior:be,legendClickBehavior:ve,legendHighlightedCategory:xe,legendIsolatedCategories:ke,foregroundGraphics:Te,annotations:se,annotationFrame:0,xValues:[],yValues:[],pointNodes:t.filter(e=>"point"===e.type)}))}const tn=e.useCallback(e=>{Mt.current=e,Re&&"object"==typeof Re&&(Re.current=e)},[Re]);return h.createElement("div",{ref:tn,className:"stream-geo-frame"+(Z?" "+Z:""),role:"group","aria-label":je||("string"==typeof ye?ye:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:G?"100%":Le[0],height:V?"100%":Le[1],overflow:"hidden"},P?{touchAction:"none"}:{}),onKeyDown:Xt},Ae&&h.createElement(Ue,{tableId:qe}),Ae&&h.createElement(Ge,{scene:null!==(s=null===(i=gt.current)||void 0===i?void 0:i.scene)&&void 0!==s?s:[],chartType:"Geographic chart",tableId:qe,chartTitle:"string"==typeof ye?ye:void 0}),h.createElement(Ve,{summary:Oe}),h.createElement("div",{role:"img","aria-label":je||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Kt?Qt:void 0,onMouseLeave:Kt?Vt:void 0,onClick:ie?Ut:void 0},We&&h.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Le[0],height:Le[1],pointerEvents:"none"}},h.createElement("g",{transform:`translate(${Be.left},${Be.top})`},We)),T&&h.createElement("canvas",{ref:vt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),h.createElement("canvas",{ref:xt,"aria-label":Ie(null!==(d=null===(u=gt.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),h.createElement("canvas",{ref:kt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),h.createElement(Ze,{hoverPoint:Bt}),h.createElement(ze,{width:De,height:Ne,totalWidth:Le[0],totalHeight:Le[1],margin:Be,scales:null,showAxes:null!=we&&we,title:ye,legend:ge,legendPosition:me,legendHoverBehavior:be,legendClickBehavior:ve,legendHighlightedCategory:xe,legendIsolatedCategories:ke,foregroundGraphics:Te,annotations:se,annotationFrame:Dt,xValues:[],yValues:[],pointNodes:null===(p=gt.current)||void 0===p?void 0:p.scene.filter(e=>"point"===e.type)}),(null==pe?void 0:pe.showBadge)&&h.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===pe.badgePosition?{top:4,left:4}:"bottom-left"===pe.badgePosition?{bottom:4,left:4}:"bottom-right"===pe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Tt?"#dc3545":"#28a745",color:"white"})},Tt?"STALE":"LIVE"),P&&h.createElement("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Be.bottom+8,left:Be.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2}},h.createElement("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Mt.current,n=Ot.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(c.select(t),1.5)},style:mt},"+"),h.createElement("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Mt.current,n=Ot.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(c.select(t),1/1.5)},style:mt},"−")),W&&h.createElement("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Be.bottom+2,right:Be.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}},W),h.createElement(Xe,{active:Zt.current>=0,hoverPoint:Bt,margin:Be,size:Le,shape:null===(f=Yt.current)||void 0===f?void 0:f.shape,width:null===(y=Yt.current)||void 0===y?void 0:y.w,height:null===(g=Yt.current)||void 0===g?void 0:g.h}),en))});vt.displayName="StreamGeoFrame";const xt={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function kt(e,t){return"function"==typeof t?t(e):e[t]}function wt(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function At(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=kt(e,n);a=wt(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=kt(e,r);s.push({label:n,value:wt(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=wt(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=wt(e[t[0]],o))}}const l=Object.assign(Object.assign({},xt),r);return h.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},a&&h.createElement("div",{style:{fontWeight:s.length>0?"bold":"normal"}},a),s.map((e,t)=>h.createElement("div",{key:t,style:{marginTop:0===t&&a?"4px":0}},e.label&&h.createElement("span",null,e.label,": "),e.value)))}}function jt(e){if(!0===e)return At();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:h.createElement("div",{className:"semiotic-tooltip",style:xt},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?At(e):At())}const Ot={category10:u.schemeCategory10,tableau10:u.schemeTableau10,set3:u.schemeSet3,blues:u.interpolateBlues,reds:u.interpolateReds,greens:u.interpolateGreens,oranges:u.interpolateOranges,purples:u.interpolatePurples,viridis:u.interpolateViridis,plasma:u.interpolatePlasma},Et=u.schemeCategory10,St=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Mt=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 Ct(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")||Mt.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):Et[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+""))%Et.length]}function Rt(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=Ot[o]||Ot.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:Et;return n.scaleOrdinal().domain(r).range(e).unknown("#999")}}function zt(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}const Pt=e.createContext(null);function $t(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 Lt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Bt,It]=B(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Lt(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=Lt(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}})}})),[Dt,Nt]=B(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 Tt(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=It(e=>e.selections.get(r)),a=It(e=>e.setClause),s=It(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($t(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 Wt(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:a,clear:s}=Tt({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 _t=e.createContext(!1);function Ft(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}function qt(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}h.createContext(void 0);const Ht="#007bff";function Gt(t,n,o){const r=e.useContext(Pt),i=function(){var e;const t=q(e=>e.theme),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}();return e.useMemo(()=>{var e;if(!n)return;const a=null!==(e=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==e?e:"category10";if(0!==t.length){if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const t=Rt(e.map(e=>({_cat:e})),"_cat",a);return e=>r[e]||t(e)}return Rt(e.map(e=>({_cat:e})),"_cat",a)}if(r&&Object.keys(r).length>0){const e=Rt(t,n,a);return t=>r[t]||e(t)}return Rt(t,n,a)}if(r&&Object.keys(r).length>0){const e=Rt([{_:"a"}],"_",a);return t=>r[t]||e(t)}},[t,n,o,r,i])}function Vt({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:a,chartId:s,onClick:l,hoverHighlight:c,colorByField:u}){const d=e.useId(),p=Ft(n,o),h=Tt({name:(null==t?void 0:t.name)||"__unused__"}),f=Wt({name:(null==p?void 0:p.name)||"hover",fields:(null==p?void 0:p.fields)||o||[]}),y=Nt(e=>e.pushObservation),g=t?{isActive:h.isActive,predicate:h.predicate}:null,[m,b]=e.useState(null),v=u||o[0],x=e.useMemo(()=>{if(!c||null==m||!v)return null;const e=m,t=v;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,v]),k=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==p?void 0:p.mode)&&p.xField){const e=null==t?void 0:t[p.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=me.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(me={positions:new Map(me.positions).set(e,{xValue:t,sourceId:n})},ve())}(p.name||"hover",Number(e),d)}"x-position"!==(null==p?void 0:p.mode)&&f.onHover(t)}else"x-position"===(null==p?void 0:p.mode)&&xe(p.name||"hover",d),"x-position"!==(null==p?void 0:p.mode)&&f.onHover(null);if(c&&v)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[v];b(null!=n?n+"":null)}else b(null);if(i||y){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),y&&y(a)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),y&&y(e)}}},[n,f,p,d,i,a,s,y,c,v]),w=e.useCallback(e=>{var t,n,o,r;if("x-position"===(null==p?void 0:p.mode)&&p.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[p.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=me.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(me.positions);return t.delete(e),me={positions:t},ve(),!1}me={positions:new Map(me.positions).set(e,{xValue:t,sourceId:n,locked:!0})},ve()}(p.name||"hover",Number(n),d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||y){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const a=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(a),y&&y(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),y&&y(e)}}},[l,i,y,a,s,p,d]);return e.useEffect(()=>{if("x-position"!==(null==p?void 0:p.mode))return;const e=p.name||"hover";return()=>{ke(e,d),xe(e,d)}},[null==p?void 0:p.mode,null==p?void 0:p.name,d]),{activeSelectionHook:g,hoverSelectionHook:x,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:d}}function Ut({data:t,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:s={top:50,bottom:60,left:70,right:40},categories:l}){const c=e.useContext(_t),u=void 0!==r?r:!c&&!!n,d=e.useMemo(()=>{if(u&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):St[i%St.length];return{label:r+"",color:s}}),label:""}]}}({data:t,colorBy:n,colorScale:o,getColor:Ct,categories:l})},[u,n,t,o,l]),p=e.useMemo(()=>{const e=Object.assign(Object.assign({},s),a);return d&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[s,a,d,i]);return{legend:d,margin:p,legendPosition:i}}const Zt={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 Yt(e,t,n){var o,r,i,a,s,l,c;const u=Zt[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(r=t.height)&&void 0!==r?r:u.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Xt(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function Xt(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Qt({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return h.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"}},h.createElement("div",{style:{textAlign:"center",maxWidth:400}},h.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),h.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&h.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 Kt extends h.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:h.createElement(Qt,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Jt(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 en(e,t,n=3){let o,r=n+1;for(const n of t){const t=Jt(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function tn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function nn(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=en(e,t,3))&&void 0!==n?n:null)}const on={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},rn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},an={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},sn=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],ln=["vertical","horizontal"],cn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},on),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:sn},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({},on),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:sn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},on),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:sn},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({},on),rn),{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({},on),rn),{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({},on),rn),{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({},on),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},on),rn),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},on),rn),{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({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ln},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ln},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:ln},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ln},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ln},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ln},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ln},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:ln},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},on),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},on),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},on),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},on),an),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},on),{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({},on),{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:ln},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({},on),{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({},on),{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({},on),{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({},on),{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({},on),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},on),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},on),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},on),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},on),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},on),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},on),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function un(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const dn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),pn=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),hn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),fn=new Set(["LineChart","AreaChart","StackedAreaChart"]),yn=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function gn(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function mn(e,t){const n=gn(e),o=gn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const bn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function vn(e,t){const n=[],o=function(e,t){const n=[],o=cn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(cn).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(!un(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=en(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=tn(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=nn(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=tn(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=nn(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 cn[e]?(function(e,t,n){const o=cn[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=cn[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){dn.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){pn.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=cn[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(!hn.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(!fn.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=cn[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(!yn.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=mn(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=mn(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of bn)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var xn;const kn="undefined"!=typeof process&&"production"!==(null===(xn=process.env)||void 0===xn?void 0:xn.NODE_ENV);function wn({componentName:e,width:t,height:n,chartProps:o,children:r}){return h.createElement(Kt,{fallback:r=>{let i="";if(kn&&o)try{const t=vn(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return h.createElement(Qt,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const An={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"},jn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function On(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?h.createElement("div",{style:Object.assign(Object.assign({},An),{width:t,height:n})},o||"No data available"):null}function En(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 h.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)=>h.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},jn),{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 Sn(e,t,n,o){if(!kn)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 Mn(t){const n=q(e=>e.theme.colors.selectionOpacity);return e.useMemo(()=>{var e,o;if(void 0!==t||void 0!==n)return Object.assign(Object.assign({name:null!==(e=null==t?void 0:t.name)&&void 0!==e?e:""},t),{unselectedOpacity:null!==(o=null==t?void 0:t.unselectedOpacity)&&void 0!==o?o:n})},[t,n])}function Cn(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 Rn(e){return e}function zn(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 Rn;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 Pn=new Map;function $n(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function Ln(e){return Cn(this,void 0,void 0,function*(){const t=Pn.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return Cn(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:$n(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:$n(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:$n(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:$n(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 zn(e,t)})}:zn(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return Pn.set(e,i),i})}function Bn(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),Ln(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 In={blues:u.interpolateBlues,reds:u.interpolateReds,greens:u.interpolateGreens,viridis:u.interpolateViridis};function Dn(t){const o=Yt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{areas:i,valueAccessor:a,colorScheme:s="blues",projection:l="equalEarth",graticule:c,fitPadding:d,zoomable:p,zoomExtent:f,onZoom:y,dragRotate:g,tileURL:m,tileAttribution:b,tileCacheSize:v,tooltip:x,areaOpacity:k=1,annotations:w,margin:A,className:j,selection:O,linkedHover:E,onObservation:S,onClick:M,chartId:C,loading:R,emptyContent:z,frameProps:P={}}=t,$=null!=p?p:!!m,L=Bn(i),B=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]),I=e.useMemo(()=>{if(!L)return n.scaleSequential(u.interpolateBlues).domain([0,1]);const e=L.map(e=>B(e)).filter(e=>null!=e&&isFinite(e)),[t,o]=r.extent(e);return n.scaleSequential(In[s]||u.interpolateBlues).domain([null!=t?t:0,null!=o?o:1])},[L,B,s]),{activeSelectionHook:D,customHoverBehavior:N,customClickBehavior:T}=Vt({selection:O,linkedHover:E,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:C}),W=Mn(O),_=e.useMemo(()=>{const e=e=>{const t=B(e);return{fill:null!=t&&isFinite(t)?I(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}};return D?qt(e,D,W):e},[B,I,D,W,k]),F=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=B(e);return h.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},h.createElement("div",{style:{fontWeight:600}},o),null!=r&&h.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},[B]),q=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},A),[A]),H=En(R,o.width,o.height)||(L?null:En(!0,o.width,o.height)),G=H?null:On(L,o.width,o.height,z);if(Array.isArray(L)&&L.length>0){const e=L[0];if(!e||"object"!=typeof e||!e.geometry)return h.createElement(Qt,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:o.width,height:o.height})}const V=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:_,size:[o.width,o.height],margin:q,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?F:jt(x)||F},null!=c&&{graticule:c}),null!=d&&{fitPadding:d}),$&&{zoomable:!0}),f&&{zoomExtent:f}),y&&{onZoom:y}),null!=g&&{dragRotate:g}),m&&{tileURL:m}),b&&{tileAttribution:b}),v&&{tileCacheSize:v}),(E||S||M)&&{customHoverBehavior:N}),(S||M)&&{customClickBehavior:T}),w&&w.length>0&&{annotations:w}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),j&&{className:j}),null!=t.animate&&{animate:t.animate}),P);return H||G||h.createElement(wn,{componentName:"ChoroplethMap",width:o.width,height:o.height},h.createElement(vt,Object.assign({},V)))}Dn.displayName="ChoroplethMap";const Nn=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)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,r,i;const a=null!==(r=null===(n=o.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==r?r:[];for(const e of a)null===(i=o.current)||void 0===i||i.push(t(e));return a},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=Yt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{points:i,xAccessor:a="lon",yAccessor:s="lat",sizeBy:l,sizeRange:c=[3,30],colorBy:u,colorScheme:d,projection:p="equalEarth",graticule:f,fitPadding:y,zoomable:g,zoomExtent:m,onZoom:b,dragRotate:v,tileURL:x,tileAttribution:k,tileCacheSize:w,areas:A,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:O,annotations:E,margin:S,className:M,selection:C,linkedHover:R,onObservation:z,onClick:P,chartId:$,loading:L,emptyContent:B,legendInteraction:I,legendPosition:D,frameProps:N={}}=t,T=null!=g?g:!!x,W=Bn(A),_=i||[],{activeSelectionHook:F,customHoverBehavior:q,customClickBehavior:H}=Vt({selection:C,linkedHover:R,fallbackFields:u?["string"==typeof u?u:""]:[],onObservation:z,onClick:P,chartType:"ProportionalSymbolMap",chartId:$}),G=Mn(C),V=Gt(_,u,d),U=e.useMemo(()=>{if(!l)return;const e="function"==typeof l?l:e=>null==e?void 0:e[l],t=_.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[_,l]),Z=e.useMemo(()=>{const e=e=>({fill:u?Ct(e,u,V):Ht,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:l?zt(e,l,c,U):6});return F?qt(e,F,G):e},[u,V,l,c,U,F,G]),Y=e.useMemo(()=>{if(!u)return[];const e="function"==typeof u?u:e=>null==e?void 0:e[u],t=new Set;for(const n of _){if(!n)continue;const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[_,u]),X=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}}(I,u,Y),{legend:Q,margin:K,legendPosition:J}=Ut({data:_,colorBy:u,colorScale:V,showLegend:r.showLegend,legendPosition:D,userMargin:S,defaults:{top:10,bottom:10,left:10,right:10}}),ee=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 h.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},t&&h.createElement("div",{style:{fontWeight:600,marginBottom:2}},t),n&&null!=o&&h.createElement("div",null,h.createElement("span",{style:{opacity:.7}},n,": "),r(o)),i&&null!=a&&h.createElement("div",null,h.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])=>h.createElement("div",{key:e},h.createElement("span",{style:{opacity:.7}},e,": "),r(t))))},[l,u]),te=En(L,r.width,r.height),ne=te?null:On(i,r.width,r.height,B);Sn("ProportionalSymbolMap",_,"xAccessor",a),Sn("ProportionalSymbolMap",_,"yAccessor",s);const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:p},null!=i&&{points:_}),{xAccessor:a,yAccessor:s,pointStyle:Z}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),W&&{areas:W,areaStyle:j}),null!=f&&{graticule:f}),null!=y&&{fitPadding:y}),T&&{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:K,enableHover:!0,tooltipContent:!1===O?()=>null:jt(O)||ee}),Q&&{legend:Q,legendPosition:J}),I&&"none"!==I&&{legendHoverBehavior:X.onLegendHover,legendClickBehavior:X.onLegendClick,legendHighlightedCategory:X.highlightedCategory,legendIsolatedCategories:X.isolatedCategories}),(R||z||P)&&{customHoverBehavior:q}),(z||P)&&{customClickBehavior:H}),E&&E.length>0&&{annotations:E}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),M&&{className:M}),null!=t.animate&&{animate:t.animate}),N);return te||ne||h.createElement(wn,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height},h.createElement(vt,Object.assign({ref:o},oe)))});function Tn(t){const o=Yt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{flows:r,nodes:i,nodeIdAccessor:a="id",xAccessor:s="lon",yAccessor:l="lat",valueAccessor:c="value",projection:u="equalEarth",graticule:d,fitPadding:p,zoomable:f,zoomExtent:y,onZoom:g,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:O,edgeOpacity:E=.6,edgeWidthRange:S=[1,8],edgeLinecap:M="round",colorScheme:C,showParticles:R,particleStyle:z,tooltip:P,annotations:$,margin:L,className:B,selection:I,linkedHover:D,onObservation:N,onClick:T,chartId:W,loading:_,emptyContent:F,frameProps:q={}}=t,H=null!=f?f:!!b,G=Bn(A),V=Ft(D),U=Tt({name:(null==I?void 0:I.name)||"__unused__"}),Z=Wt({name:(null==V?void 0:V.name)||"hover",fields:(null==V?void 0:V.fields)||[]}),Y=Nt(e=>e.pushObservation),X=I?{isActive:U.isActive,predicate:U.predicate}:null,Q=r||[],K=i||[],J=Gt(Q,O,C),ee=e.useMemo(()=>{const e=new Map;for(const t of K)e.set(t[a]+"",t);return e},[K,a]),te=e.useMemo(()=>{const e=new Map;for(const t of Q)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},[Q]),ne=e.useCallback(e=>{var t,n;if(D)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=te.get(t[a]+"");e&&Z.onHover(e)}else Z.onHover(t)}else Z.onHover(null);if(N||Y){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),Y&&Y(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});N&&N(e),Y&&Y(e)}}},[D,Z,a,te,N,W,Y]),oe=e.useCallback(e=>{var t,n,o,r;if(e&&T){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),T(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(e&&(N||Y)){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n={timestamp:Date.now(),chartType:"FlowMap",chartId:W,type:"click",datum:t||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0};N&&N(n),Y&&Y(n)}},[T,N,Y,W]),re=e.useMemo(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof l?l:e=>e[l];return Q.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ee.get(n.source+""),r=ee.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)},[Q,ee,s,l]),ie=e.useMemo(()=>{const e=Q.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)},[Q,c,S]),ae=e.useMemo(()=>e=>{var t;return{stroke:O?Ct(e,O,J):Ht,strokeWidth:ie(null!==(t=e[c])&&void 0!==t?t:0),strokeLinecap:M,opacity:E}},[O,J,ie,c,E,M]),se=Mn(I),le=e.useMemo(()=>{if(!X)return ae;const e=Object.assign(Object.assign({},(null==se?void 0:se.unselectedStyle)||{}),{fillOpacity:0});return qt(ae,X,Object.assign(Object.assign({},se||{}),{unselectedStyle:e}))},[ae,X,se]),ce=e.useMemo(()=>()=>({fill:"#333",r:5,fillOpacity:.8}),[]),ue=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 h.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},h.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 h.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},h.createElement("div",{style:{fontWeight:600}},e.source," → ",e.target),null!=t&&h.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?h.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},h.createElement("div",{style:{fontWeight:600}},u)):null},[c,a]),de=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},L),[L]),pe=En(_,o.width,o.height),he=pe?null:On(r,o.width,o.height,F),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:u,lines:re,points:K,xAccessor:s,yAccessor:l,lineDataAccessor:"coordinates",lineType:k,flowStyle:w,lineStyle:le,pointStyle:ce},G&&{areas:G,areaStyle:j}),null!=d&&{graticule:d}),null!=p&&{fitPadding:p}),H&&{zoomable:!0}),y&&{zoomExtent:y}),g&&{onZoom:g}),null!=m&&{dragRotate:m}),R&&{showParticles:R}),z&&{particleStyle:z}),b&&{tileURL:b}),v&&{tileAttribution:v}),x&&{tileCacheSize:x}),{size:[o.width,o.height],margin:de,enableHover:!0,tooltipContent:!1===P?()=>null:jt(P)||ue}),(D||N||T)&&{customHoverBehavior:ne}),(N||T)&&{customClickBehavior:oe}),$&&$.length>0&&{annotations:$}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),B&&{className:B}),null!=t.animate&&{animate:t.animate}),q);return pe||he||h.createElement(wn,{componentName:"FlowMap",width:o.width,height:o.height},h.createElement(vt,Object.assign({},fe)))}Nn.displayName="ProportionalSymbolMap",Tn.displayName="FlowMap";const Wn=e.forwardRef(function(t,n){const o=Yt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{points:r,lines:i,xAccessor:a="lon",yAccessor:s="lat",nodeIdAccessor:l="id",center:c,costAccessor:u,strength:d=1,lineMode:p="straight",projection:f="mercator",graticule:y,fitPadding:g,zoomable:m,zoomExtent:b,onZoom:v,dragRotate:x,tileURL:k,tileAttribution:w,tileCacheSize:A,transition:j,colorBy:O,colorScheme:E,pointRadius:S=5,tooltip:M,showRings:C=!0,ringStyle:R,showNorth:z=!0,costLabel:P,annotations:$,margin:L,className:B,selection:I,linkedHover:D,onObservation:N,onClick:T,chartId:W,loading:_,emptyContent:F,legendPosition:q,frameProps:H={}}=t,G=null!=m?m:!!k,V=r||[],{activeSelectionHook:U,customHoverBehavior:Z,customClickBehavior:Y}=Vt({selection:I,linkedHover:D,fallbackFields:O?["string"==typeof O?O:""]:[],onObservation:N,onClick:T,chartType:"DistanceCartogram",chartId:W}),X=Mn(I),Q=Gt(V,O,E),K=e.useMemo(()=>{const e=e=>({fill:O?Ct(e,O,Q):Ht,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:S});return U?qt(e,U,X):e},[O,Q,S,U,X]),{legend:J,margin:ee,legendPosition:te}=Ut({data:V,colorBy:O,colorScale:Q,showLegend:o.showLegend,legendPosition:q,userMargin:L,defaults:{top:10,bottom:10,left:10,right:10}}),ne=e.useMemo(()=>({center:c,centerAccessor:l,costAccessor:u,strength:d,lineMode:p}),[c,l,u,d,p]),oe=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 V)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,V,a,s,l]),re=e.useMemo(()=>e=>{const t=("function"==typeof u?u:e=>e[u])(e);return h.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},h.createElement("div",{style:{fontWeight:600}},e[l]||e.name||e.id||"Point"),null!=t&&h.createElement("div",{style:{opacity:.7}},"Cost: ","number"==typeof t?t.toFixed(1):t))},[u,l]),ie=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=ie.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ie.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ie.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,r;const i=null!==(o=null===(n=ie.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of i)null===(r=ie.current)||void 0===r||r.push(t(e));return i},clear:()=>{var e;return null===(e=ie.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ie.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[ae,se]=e.useState(null),le=e.useCallback(()=>{var e,t;const n=null===(t=null===(e=ie.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&se(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(le);return()=>cancelAnimationFrame(e)},[le,d,c,o.width,o.height,V]);const ce=e.useMemo(()=>{if(!C||!ae)return[];const{maxCost:e}=ae;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,ae]),ue=e.useMemo(()=>{var e,t;if(!ae)return H.foregroundGraphics||null;const{cx:n,cy:o,maxCost:r,availableRadius:i}=ae,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},R),s=null!==(e=ee.left)&&void 0!==e?e:10,l=null!==(t=ee.top)&&void 0!==t?t:10;return h.createElement("g",null,ce.map(e=>{const t=e/r*i;return h.createElement("g",{key:e},h.createElement("circle",{cx:n+s,cy:o+l,r:t,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),h.createElement("text",{x:n+s+t+3,y:o+l-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif"},e,P?" "+P:""))}),z&&h.createElement("g",{transform:`translate(${s+24}, ${l+24})`},h.createElement("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),h.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"}),h.createElement("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif"},"N"),h.createElement("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),h.createElement("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),h.createElement("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})),H.foregroundGraphics)},[ae,ce,z,P,R,ee,H.foregroundGraphics]),de=En(_,o.width,o.height),pe=de?null:On(r,o.width,o.height,F);Sn("DistanceCartogram",V,"xAccessor",a),Sn("DistanceCartogram",V,"yAccessor",s);const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:f},null!=r&&{points:V}),oe&&{lines:oe,lineDataAccessor:"coordinates"}),{xAccessor:a,yAccessor:s,pointIdAccessor:l,pointStyle:K,projectionTransform:ne}),j&&{transition:{duration:j}}),null!=y&&{graticule:y}),null!=g&&{fitPadding:g}),G&&{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:ee,enableHover:!0,tooltipContent:!1===M?()=>null:jt(M)||re}),J&&{legend:J,legendPosition:te}),(D||N||T)&&{customHoverBehavior:Z}),(N||T)&&{customClickBehavior:Y}),$&&$.length>0&&{annotations:$}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),B&&{className:B}),null!=t.animate&&{animate:t.animate}),H),ue&&{foregroundGraphics:ue});return de||pe||h.createElement(wn,{componentName:"DistanceCartogram",width:o.width,height:o.height},h.createElement(vt,Object.assign({ref:ie},he)))});Wn.displayName="DistanceCartogram",exports.ChoroplethMap=Dn,exports.DistanceCartogram=Wn,exports.FlowMap=Tn,exports.ProportionalSymbolMap=Nn,exports.StreamGeoFrame=vt,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=Ln;
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-geo"),o=require("d3-scale"),r=require("d3-quadtree"),i=require("d3-array"),s=require("d3-hierarchy"),a=require("d3-shape"),l=require("regression"),c=require("d3-zoom"),u=require("d3-selection"),d=require("d3-scale-chromatic");function h(e){return e&&e.__esModule?e:{default:e}}function p(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 f=p(t),g=h(l);class y{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function m(e,t,n){return e+(t-e)*n}function b(e,t,n){var o,r,i;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>a?1:s;default:return 1}}const v={mercator:n.geoMercator,equalEarth:n.geoEqualEarth,albersUsa:n.geoAlbersUsa,orthographic:n.geoOrthographic,naturalEarth:n.geoNaturalEarth1,equirectangular:n.geoEquirectangular};function x(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function j(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function k(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function w(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 A(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const s=-r/i,a=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+s*l,u=(e[1]+t[1])/2+a*l,d=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;d.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return d}function O(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,s;0===t?(i=e[1][0]-r[0],s=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],s=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const a=Math.sqrt(i*i+s*s)||1;o.push([r[0]+s/a*n,r[1]+-i/a*n])}return o}function S(e,t,n,o,r){const i=t[0]-e[0],s=t[1]-e[1],a=Math.sqrt(i*i+s*s);if(0===a)return[e,t];const l=s/a,c=-i/a,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}class M{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e}initStreaming(e=500){this.pointBuffer=new y(e),this.timestampBuffer=new y(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return n.geoEqualEarth();if("string"==typeof e){const t=v[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),n.geoEqualEarth())}if("object"==typeof e&&"type"in e){const t=v[e.type],o=t?t():n.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(t.projection),this.geoPath=n.geoPath(this.projection),this.fitProjection(e),this.geoPath=n.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;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&r.length>0&&this.startTransition(r),this.version++}fitProjection(e){var t,n,o,r,i;const s=this.projection,a=this.config,l=[...this.areas],c=x(a.xAccessor,"lon"),u=x(a.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=j(a.lineDataAccessor);for(const e of this.lineData){const t=h(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==l.length){if(a.projectionExtent){const[[t,n],[o,r]]=a.projectionExtent;s.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,r],[t,r],[t,n]]]}})}else if(s.clipAngle&&(null!==(t=s.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=a.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);s.scale(o/2-o*t),s.translate([e.width/2,e.height/2])}else{const t=null!==(o=a.fitPadding)&&void 0!==o?o:0,n=e.width*t,r=e.height*t;s.fitExtent([[n,r],[e.width-n,e.height-r]],{type:"FeatureCollection",features:l})}this.baseScale=s.scale(),this.baseTranslate=s.translate(),this.baseRotation=null!==(i=null===(r=s.rotate)||void 0===r?void 0:r.call(s))&&void 0!==i?i:[0,0,0]}}applyZoomTransform(e,t){const 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=n.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(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=n.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(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=n.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(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,M.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._quadtree=r.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,o,r;const i=[],{config:s}=this,a=this.projection,l=this.geoPath,c=x(s.xAccessor,"lon"),u=x(s.yAccessor,"lat"),d=function(e){var t,n;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.surface)||"#e0e0e0",stroke:(null===(n=e.themeSemantic)||void 0===n?void 0:n.border)||"#999",strokeWidth:.5,fillOpacity:1}}(s),h=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(s),p=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(s);if(s.graticule){const t=!0===s.graticule?{}:s.graticule,o=n.geoGraticule();t.step&&o.step(t.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:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.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),a=k(s.areaStyle,e,d);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:r,style:a,datum:e,interactive:!0})}const f=j(s.lineDataAccessor);for(const t of this.lineData){const o=f(t);if(!o||2>o.length)continue;let r=[];if("geo"===s.lineType){const e=Array(o.length);for(let t=0;o.length>t;t++)e[t]=[c(o[t]),u(o[t])];for(let t=0;e.length-1>t;t++){const o=e[t],i=e[t+1],s=n.geoDistance(o,i)||0,l=Math.max(2,Math.ceil(s/(Math.PI/180))),c=n.geoInterpolate(o,i);for(let e=0;l>=e;e++){if(t>0&&0===e)continue;const n=a(c(e/l));null!=n&&r.push(n)}}}else for(let e=0;o.length>e;e++){const t=o[e],n=a([c(t),u(t)]);null!=n&&r.push(n)}if(2>r.length)continue;const l=k(s.lineStyle,t,h),d="number"==typeof l.strokeWidth?l.strokeWidth:1;2!==o.length||2>r.length||"arc"!==s.flowStyle?2!==o.length||2>r.length||"offset"!==s.flowStyle||(r="geo"===s.lineType?O(r,d):S(r[0],r[r.length-1],0,0,d)):r=A(r[0],r[r.length-1]);const p=w(r,e.width);if(p.length>1)for(const e of p){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},l),{_edgeFade:!0}),datum:t};i.push(n)}else i.push({type:"line",path:2>r.length&&p[0]||r,style:l,datum:t})}const g=this.getPoints(),y=s.pointIdAccessor?"function"==typeof s.pointIdAccessor?s.pointIdAccessor:e=>e[s.pointIdAccessor]:null,m=a.clipAngle&&null!==(t=a.clipAngle())&&void 0!==t?t:0,b=m>0?m*Math.PI/180:null,v=a.rotate?a.rotate():[0,0,0],M="function"==typeof a.center?a.center():[0,0],C=[(null!==(o=M[0])&&void 0!==o?o:0)-v[0],(null!==(r=M[1])&&void 0!==r?r:0)-v[1]];for(let e=0;g.length>e;e++){const t=g[e],o=c(t),r=u(t);if(null!=b&&n.geoDistance([o,r],C)>b)continue;const l=a([o,r]);if(!l)continue;const d=s.pointStyle?s.pointStyle(t):Object.assign({},p),h={type:"point",x:l[0],y:l[1],r:d.r||4,style:d,datum:t,pointId:y?y(t)+"":void 0};i.push(h)}return i}applyCartogramTransform(e,t){var n,r,i;const s=this.scene.filter(e=>"point"===e.type);if(2>s.length)return;const a=null!==(n=e.strength)&&void 0!==n?n:1;if(0===a)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=s.find(t=>t.datum&&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,h=u.y,p=s.map(e=>e.datum?c(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),f=Math.max(...p,1),g=Math.min(t.width,t.height)/2,y=o.scaleLinear().domain([0,f]).range([0,g]);this.cartogramLayout={cx:d,cy:h,maxCost:f,availableRadius:g},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 s){if(e===u)continue;if(!e.datum)continue;const t=Math.atan2(e.y-h,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-h,2)),o=c(e.datum),r=n+((isFinite(o)?y(o):n)-n)*a;e.x=d+Math.cos(t)*r,e.y=h+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 s)e.x+=v,e.y+=x;this.cartogramLayout={cx:m,cy:b,maxCost:f,availableRadius:g};const j=this.scene.filter(e=>"line"===e.type);if(j.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of s)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of j){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(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const r=b(e,o,t);n[o]._decayOpacity=r,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:r})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),s=this.timestampBuffer.toArray();for(let e=0;i.length>e&&s.length>e;e++){const a=r-s[e];o>a&&(i[e]._pulseIntensity=1-a/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let s=!1;for(const e of i)if(e.pointId){const t=r.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(s=!0))}s&&(this.activeTransition={startTime:performance.now(),duration:o})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=m(e.x,e._targetX,n),e.y=m(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 C(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function R(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function P(e,t){const n=R(e);if(!n)return!1;const o=R(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function z(e,t,n,o,r,i,s=0){if(i){const e=function(e,t,n,o,r){const i=Math.max(o,r+5,12),s=t-i,a=t+i,l=n-i,c=n+i;let u=null,d=1/0;return e.visit((e,r,i,h,p)=>{if(r>a||s>h||i>c||l>p)return!0;if(!e.length){let r=e;do{const e=r.data,i=e.x-t,s=e.y-n,a=Math.sqrt(i*i+s*s);C(e.r,o)>=a&&d>a&&(u=e,d=a),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,s);if(e)return e}else{let r=null,i=o;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,a=s.y-n,l=Math.sqrt(e*e+a*a);C(s.r,o)>=l&&i>l&&(r=s,i=l)}if(r)return{node:r,distance:i}}for(let o=e.length-1;o>=0;o--){const i=e[o];if("geoarea"!==i.type)continue;const s=i;if(!1===s.interactive)continue;const[[a,l],[c,u]]=s.bounds;if(!(a>t||t>c||l>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),r.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let a=null,l=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:r}=e,i=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;r.length-1>o;o++){const[s,c]=r[o],[u,d]=r[o+1],h=$(t,n,s,c,u,d);i>=h&&l>h&&(a=e,l=h)}}return a?{node:a,distance:l}:null}function $(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function L(n){const o=t.createContext(null),r=E(n);return[function({children:r}){const i=t.useMemo(()=>E(n),[]);return e.jsx(o.Provider,{value:i,children:r})},e=>{var n;const i=null!==(n=t.useContext(o))&&void 0!==n?n:r,s=t.useRef(e);s.current=e;const a=t.useCallback(()=>s.current(i.getState()),[i]),l=t.useCallback(()=>s.current(i.getState()),[i]);return t.useSyncExternalStore(i.subscribe,a,l)}]}function E(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function B(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function I(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:D})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}M.QUADTREE_THRESHOLD=500;const D=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],N={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},T={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},W={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:D,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[_,F]=L(e=>({theme:N,setTheme(t){e(e=>{if("light"===t)return{theme:N};if("dark"===t)return{theme:T};if("high-contrast"===t)return{theme:W};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?T:N;return{theme:I(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:I(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const q=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,H=new WeakMap;let G=0,V=!1,U=null,Z=null,Y=null;function X(e,t){var n,o;if(!t)return t;const r=q.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(V)return;if("undefined"==typeof window||"undefined"==typeof document)return;V=!0;const e=()=>{G++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(U=new MutationObserver(e),U.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Z=window.matchMedia("(prefers-color-scheme: dark)"),Y=e,"function"==typeof Z.addEventListener?Z.addEventListener("change",Y):"function"==typeof Z.addListener&&Z.addListener(Y)}catch(e){}}();let s=H.get(i);s&&s.version===G||(s={version:G,map:new Map},H.set(i,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function Q(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function K(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[r,i]=function(e,n,o){const r=t.useRef(null),[i,s]=t.useState(null);return t.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;s(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:e[0],o&&i?i.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=i[0]-s.left-s.right,l=i[1]-s.top-s.bottom,c=Q(e.foregroundGraphics,i,s),u=Q(e.backgroundGraphics,i,s),d=F(e=>e.theme),{transition:h,introEnabled:p}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(r||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+f.useId(),y=t.useRef(0),m=t.useRef(()=>{}),b=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const v=t.useRef(()=>{}),x=t.useRef(()=>{}),j=t.useRef(null),k=t.useRef(0),w=t.useCallback(()=>{k.current=0;const e=j.current;j.current=null,e&&v.current(e)},[]),A=t.useCallback(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(w))},[w]),O=t.useCallback(()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=e.themeDirtyRef;return t.useEffect(()=>{S&&(G++,S.current=!0,b())},[d,b,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:r,size:i,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:g,rafRef:y,renderFnRef:m,scheduleRender:b,hoverHandlerRef:v,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}const J={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function ee(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,J[n])(o(e,t)),r}function te(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ne(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const oe=(t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:p}=t,f=[];let g=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return p.forEach((t,u)=>{const b=ee(t,u,d,h),v=ne(t,r,i),x=i&&i.size>0&&i.has(t.label);f.push(e.jsxs("g",{transform:`translate(0,${g})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===s&&u===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(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"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&e.jsx(te,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),g+=22}),f};function re({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+f.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(i[0])}),e.jsx("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(i[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(i[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(i[0])})]})}function ie(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,p]=f.useState(0),[g,y]=f.useState(0),m=f.useCallback((e,t)=>{p(e),y(t)},[]),b="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,p)=>{d+=5,h.push(e.jsx("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+p)),d+=8,t.label&&(d+=16,h.push(e.jsx("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+p)),d+=8),h.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${d})`,children:oe(t,o,r,i,s,a,l,p,c,u)},"legend-group-"+p)),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:g,onFocusedIndexChange:m,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const p=[];t.forEach((t,n)=>{let f=0;t.label&&(f+=16);const g=((t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:p,items:f}=t,g=[];let y=0,m=0;const b=!(!n&&!o),v="isolate"===u||void 0===u&&null!=i;f.forEach((t,u)=>{const x=ee(t,u,h,p),j=ne(t,r,i),k=i&&i.size>0&&i.has(t.label),w=26+7*t.label.length;d&&d>0&&y>0&&y+w>d&&(m++,y=0),g.push(e.jsxs("g",{transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:b?l===s&&u===a?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&v?k||!1:void 0,"aria-current":b&&!v&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:b?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+f.length)%f.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:b?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:j,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,k&&e.jsx(te,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=w});let x=0,j=0;for(const e of f){const t=26+7*e.label.length;d&&d>0&&j>0&&j+t>d?(x=Math.max(x,j),j=t):j+=t}x=Math.max(x,j);const k=m+1;return{items:g,offset:x,totalRows:k,totalHeight:22*k}})(t,r,i,s,a,l,c,n,u,d,o);f+=g.offset+5,p.push(Object.assign(Object.assign({label:t.label},g),{offset:f,totalRows:g.totalRows,totalHeight:g.totalHeight})),h+=f+12});let f=h>o?0:Math.max(0,(o-h)/2);const g=[];return p.forEach((o,r)=>{const i=t[r];i.label&&(g.push(e.jsx("text",{transform:`translate(${f},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:i.label},"legend-text-"+r)),f+=16),g.push(e.jsx("g",{className:"legend-item",transform:`translate(${f},0)`,children:o.items},"legend-group-"+r)),f+=o.offset+5,t[r+1]&&g.push(e.jsx("line",{stroke:"gray",x1:f,y1:-8,x2:f,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+r)),f+=12}),e.jsx("g",{children:g})})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:g,onFocusedIndexChange:m,legendInteraction:a}),v=!(!o&&!r);return e.jsxs("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),b]})}function se(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ae(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const p="top"===s||"bottom"===s;let f,g;return"left"===s?(f=4,g=i.top):"top"===s?(f=0,g=a?32:8):"bottom"===s?(f=0,g=r-i.bottom+50):(f=o-i.right+10,g=i.top),e.jsx("g",{transform:`translate(${f}, ${g})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e.jsx(re,{config:n.gradient,orientation:p?"horizontal":"vertical",width:p?o:100}):se(n)?e.jsx(ie,{legendGroups:n.legendGroups,title:"",width:p?o:100,orientation:p?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function le(e){return"string"==typeof e?{type:e}:e}function ce({orient:n,config:o,values:r,scale:s,size:a,length:l}){const c=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),u="top"===n||"bottom"===n,d=t.useMemo(()=>{if(0===r.length)return null;const t=s.domain(),o=a-8;if("boxplot"===c.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(r);if(!t)return null;const{q1:i,median:a,q3:l,whiskerLow:d,whiskerHigh:h}=t,p=Math.min(.5*o,20),f=(o-p)/2+4;if(u){const t=s(i),o=s(l),r=s(a),u=s(d),g=s(h),y="top"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:m+y*(f+p/2),x2:g,y2:m+y*(f+p/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*f,x2:u,y2:m+y*(f+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:g,y1:m+y*f,x2:g,y2:m+y*(f+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?m-f-p:m+f,width:Math.abs(o-t),height:p,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:r,y1:"top"===n?m-f-p:m+f,x2:r,y2:"top"===n?m-f:m+f+p,stroke:c.fill,strokeWidth:2})]})}{const t=s(i),o=s(l),r=s(a),u=s(d),g=s(h),y="left"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:m+y*(f+p/2),y1:u,x2:m+y*(f+p/2),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*f,y1:u,x2:m+y*(f+p),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*f,y1:g,x2:m+y*(f+p),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?m-f-p:m+f,y:Math.min(t,o),width:p,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?m-f-p:m+f,y1:r,x2:"left"===n?m-f:m+f+p,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=i.bin().domain(t).thresholds(c.bins)(r);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,r)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*o;if(u){const o=s(t.x0),a=s(t.x1)-s(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-i:4,width:Math.max(a,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},r)}{const o=s(t.x0),a=s(t.x1)-s(t.x0);return e.jsx("rect",{x:"left"===n?-4-i:4,y:Math.min(o,o+a),width:i,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},r)}})});if("violin"===c.type){const t=o/2+4,r=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(o/2),a=s((e.x0+e.x1)/2);r.push(u?`${a},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${a}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const a=i.length/h*(o/2),l=s((i.x0+i.x1)/2);r.push(u?`${l},${"top"===n?-(t+a):t+a}`:`${"left"===n?-(t+a):t+a},${l}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:r.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,r=null!=d[0].x0?s(d[0].x0):0;t.push(`M${r},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*o,i=s((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-r-4:r+4}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,r=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${r}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*o,i=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-r-4:r+4},${i}`)}const i=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${e},${i}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[r,s,c,a,l,n,u,4]);return d?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function ue(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function de(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 he(t,n,o,r){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:i,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!s)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let p="start";"topBottom"===d?"right"===h?p="end":"middle"===h&&(p="middle"):p=0>n?"end":"start";const f=16,g=s?u?[s]:ue(s,c):[],y=i?u?[i]:ue(i,c):[],m="leftRight"===d?"end"===p?-4:4:0;let b=0;const v=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";g.length>0&&(v.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:p,fontWeight:"bold",children:g.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:f,children:t},n))},"annotation-note-title")),b=g.length*f),y.length>0&&v.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:p,y:b,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:f,children:t},n))},"annotation-note-label"));let j=null;if((s||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(g.length+y.length)*f+(y.length>0?f:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,g.length+y.length-1)*f;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===h?-(k+f+(y.length>0&&g.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:v}),j]})}function pe(t,n,o,r,i){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.jsx("rect",{width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.jsx("line",{x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.jsx("path",{d:de((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function fe(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+s*h,c=i+a*h}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.jsx("line",{x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.jsx("path",{d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:a})}function ge(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:p,disable:f,events:g={},"data-testid":y}=t,m=new Set(Array.isArray(f)?f:[]);let b=r||0,v=i||0;null!=s&&(b=s-n),null!=a&&(v=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===b&&0===v)if(void 0!==u.width){b=u.width/2;const e=u.depth||30;v=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;b=e+(0>e?-5:5),v=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},g,{children:[!m.has("connector")&&fe(b,v,c,h,x,u),!m.has("subject")&&pe(x,u,h,n,o),!m.has("note")&&he(l,b,v,h)]}))}function ye(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,s="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.jsx(ge,Object.assign({"data-testid":"semiotic-annotation"},i,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:l})}const l=r.note||{title:"none",label:r.label},c=`${l.label}-${l.title}-${r.i}`;return e.jsx(ge,Object.assign({"data-testid":"semiotic-annotation",events:a},r,{type:s}),c)}function me(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 be(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function ve(e,t,n){var o,r,i,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=me(e,n),c=be(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function xe(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const je={linear:a.curveLinear,monotoneX:a.curveMonotoneX,monotoneY:a.curveMonotoneY,step:a.curveStep,stepAfter:a.curveStepAfter,stepBefore:a.curveStepBefore,basis:a.curveBasis,cardinal:a.curveCardinal,catmullRom:a.curveCatmullRom};let ke={positions:new Map};const we=new Set;function Ae(){for(const e of we)e()}function Oe(e,t){const n=ke.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(ke.positions);o.delete(e),ke={positions:o},Ae()}function Se(e,t){const n=ke.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(ke.positions);o.delete(e),ke={positions:o},Ae()}function Me(){return ke}function Ce(e){return we.add(e),()=>we.delete(e)}const Re={positions:new Map};function Pe(){return()=>{}}function ze(){return Re}function $e(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Le(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function Ee(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Be(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function Ie(n){var o,r;const{width:i,height:l,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:p,axes:f,xLabel:y,yLabel:m,yLabelRight:b,xFormat:v,yFormat:x,showGrid:j,title:k,legend:w,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:S,legendIsolatedCategories:M,legendPosition:C="right",foregroundGraphics:R,marginalGraphics:z,xValues:$,yValues:L,annotations:E,svgAnnotationRules:B,xAccessor:I,yAccessor:D,annotationData:N,pointNodes:T,curve:W,underlayRendered:_,linkedCrosshairName:F,linkedCrosshairSourceId:q,children:H}=n,G=t.useMemo(()=>{var e;if(!p||!h)return[];const t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||v||Ee,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=h.x.ticks(Math.min(o,Math.max(2,Math.floor(i/70)))),s=r.map(e=>e.valueOf()),a=r.map((e,t)=>({value:e,pixel:h.x(e),label:n(e,t,s)})),l=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(l+8,55)):Math.max(55,l+8);let u=Be(a,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=h.x.domain()[1],t=h.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,s);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[p,h,f,v,i]),V=t.useMemo(()=>{var e;if(!p||!h)return[];const t=null==f?void 0:f.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||Ee,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=Be(h.y.ticks(Math.min(o,Math.max(2,Math.floor(l/30)))).map(e=>({value:e,pixel:h.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=h.y.domain()[1],t=h.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[p,h,f,x,l]),U=t.useMemo(()=>{var e;if(!p||!h)return[];const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||Ee,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Be(h.y.ticks(Math.min(o,Math.max(2,Math.floor(l/30)))).map(e=>({value:e,pixel:h.y(e),label:n(e)})),22)},[p,h,f,x,l]),Z=t.useRef(new Map),Y=t.useRef(null!==(o=null==E?void 0:E.length)&&void 0!==o?o:0),X=null!==(r=null==E?void 0:E.length)&&void 0!==r?r:0;Y.current!==X&&(Y.current=X,Z.current=new Map);const Q=t.useMemo(()=>{if(!E||0===E.length)return null;const t=function(t,n,o){var r,i,l,c,u,d,h,p,f,y,m,b,v,x,j,k,w,A,O,S,M,C,R,P,z,$,L,E,B,I,D,N,T,W,_,F,q,H,G,V,U,Z,Y,X,Q,K,J,ee;switch(t.type){case"label":{const r=ve(t,n,o);if(!r)return null;const{x:i,y:s}=r;return xe(i,s,o)?e.jsx(ye,{noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"callout":{const r=ve(t,n,o);if(!r)return null;const{x:i,y:s}=r;return xe(i,s,o)?e.jsx(ye,{noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"x-threshold":{const r=me(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:r+4,y:a,fill:i,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const r=be(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:me(Object.assign(Object.assign({},e),{type:"point"}),o),y:be(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=s.packEnclose(r),a=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:me(Object.assign(Object.assign({},e),{type:"point"}),o),y:be(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...s)-i,c=Math.max(...s)+i,u=Math.min(...a)-i,d=Math.max(...a)+i;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:i.map((n,r)=>{const i=me(n,o),a=be(n,o);if(null==i||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:i,cy:a,r:l},c),"hl-"+r)})},"ann-"+n)}case"bracket":{const r=me(t,o),i=be(t,o);return e.jsx(ye,{noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const s=o.data||[];if(2>s.length)return null;const a=o.xAccessor||"x",p=o.yAccessor||"y",f=s.map(e=>[e[a],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(l=o.scales)||void 0===l?void 0:l.time,m=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.value;if(!y||!m)return null;const b=t.method||"linear";let v;v="loess"===b?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,p=0,f=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],p+=t*r[e]*r[e],f+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const g=u*p-d*d;if(1e-12>Math.abs(g))a.push([t,h/u]);else{const e=(u*f-d*h)/g;a.push([t,(h-e*d)/u+e*t])}}return a}(f,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===b?g.default.polynomial(f,{order:t.order||2}):g.default.linear(f)).points;const x=v.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),j=t.color||"#6366f1";return e.jsxs("g",{children:[e.jsx("polyline",{points:x,fill:"none",stroke:j,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:y(v[v.length-1][0])+4,y:m(v[v.length-1][1])-4,fill:j,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const r=null!==(f=null===(p=o.scales)||void 0===p?void 0:p.y)&&void 0!==f?f:null===(y=o.scales)||void 0===y?void 0:y.value,i=null!==(m=null==r?void 0:r(t.y0))&&void 0!==m?m:0,s=null!==(b=null==r?void 0:r(t.y1))&&void 0!==b?b:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(i,s),width:o.width||0,height:Math.abs(s-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(i,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",s=null!==(x=null===(v=o.scales)||void 0===v?void 0:v.x)&&void 0!==x?x:null===(j=o.scales)||void 0===j?void 0:j.time,l=null!==(w=null===(k=o.scales)||void 0===k?void 0:k.y)&&void 0!==w?w:null===(A=o.scales)||void 0===A?void 0:A.value;if(!s||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[i]-t[i]);if(2>h.length)return null;const p=je[o.curve||"linear"]||a.curveLinear,f=a.area().x(e=>s(e[i])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(p)(h);if(!f)return null;const g=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:f,fill:g,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:s(h[h.length-1][i])+4,y:l(h[h.length-1][c])-4,fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",s=null!==(M=null===(S=o.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(C=o.scales)||void 0===C?void 0:C.time,a=null!==(P=null===(R=o.scales)||void 0===R?void 0:R.y)&&void 0!==P?P:null===(z=o.scales)||void 0===z?void 0:z.value;if(!s||!a)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==($=t.threshold)&&void 0!==$?$:2,p=c-h*d,f=!1!==t.showBand,g=t.fill||"#6366f1",y=null!==(L=t.fillOpacity)&&void 0!==L?L:.1,m=t.anomalyColor||"#ef4444",b=null!==(E=t.anomalyRadius)&&void 0!==E?E:6,v=a(c+h*d),x=a(p),j=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[f&&e.jsx("rect",{x:0,y:Math.min(v,x),width:o.width||0,height:Math.abs(x-v),fill:g,fillOpacity:y}),j.map((t,n)=>{const r=me(t,o),i=be(t,o);return null==r||null==i?null:e.jsx("circle",{cx:r,cy:i,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(v,x)-4,textAnchor:"end",fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(I=null===(B=o.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(D=o.scales)||void 0===D?void 0:D.time,l=null!==(T=null===(N=o.scales)||void 0===N?void 0:N.y)&&void 0!==T?T:null===(W=o.scales)||void 0===W?void 0:W.value;if(!a||!l)return null;const c=r.map(e=>[e[i],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=g.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(h/Math.max(d-2,1)),f=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(_=t.confidence)&&void 0!==_?_:.95,b=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,v=null!==(F=t.steps)&&void 0!==F?F:5,x=c[d-1][0],j=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;v>=e;e++)k.push(x+e*j);const w=[];for(const e of k){const t=u(e),n=p*Math.sqrt(1+1/d+(y>0?Math.pow(e-f,2)/y:0))*b;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=w.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(q=t.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:M,strokeWidth:null!==(H=t.strokeWidth)&&void 0!==H?H:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&w.length>0&&e.jsx("text",{x:a(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=ve(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!xe(r,i,o))return null;const s=null!==(V=t.dx)&&void 0!==V?V:0,a=null!==(U=t.dy)&&void 0!==U?U:0,l=null!==(Z=t.width)&&void 0!==Z?Z:32,c=null!==(Y=t.height)&&void 0!==Y?Y:32,u=null!==(X=t.content)&&void 0!==X?X:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const r=ve(t,n,o);if(!r)return null;const{x:i,y:s}=r;return e.jsx("text",{x:i+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+n)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(Q=o.scales)||void 0===Q?void 0:Q.o,s=null===(K=o.scales)||void 0===K?void 0:K.x,a=null===(J=o.scales)||void 0===J?void 0:J.y,l=(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,p=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:l===s)?{children:[e.jsx("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),p&&e.jsx("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e.jsx("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),p&&e.jsx("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+n)}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:I,yAccessor:D,width:i,height:l,data:N,frameType:"xy",pointNodes:T,curve:W,stickyPositionCache:Z.current};return E.map((e,o)=>{if(B){const r=B(e,o,n);return null!=r?r:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[E,B,i,l,I,D,N,h,T,W]),K=function(e){var n;const o=t.useSyncExternalStore(e?Ce:Pe,e?Me:ze,e?Me:ze);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}(F);return t.useEffect(()=>{if(!(null==K?void 0:K.locked)||!F)return;const e=e=>{"Escape"===e.key&&Se(F)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==K?void 0:K.locked,F]),p||k||w||R||z||Q&&Q.length>0||j||H||K?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof k?k:"XY Chart"}),e.jsx("desc",{children:"string"==typeof k?k+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[j&&h&&!_&&(()=>{var t,n;const o=$e(null===(t=null==f?void 0:f.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=$e(null===(n=null==f?void 0:f.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[G.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:l,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),V.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:i,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),p&&h&&(()=>{const t=null==f?void 0:f.find(e=>"left"===e.orient),n=null==f?void 0:f.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=!n||!1!==n.baseline,s=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,h="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",v=!!(null==n?void 0:n.autoRotate)&&G.length>1&&(()=>{const e=i/Math.max(G.length-1,1);return G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[!_&&r&&!a&&e.jsx("line",{x1:0,y1:l,x2:i,y2:l,stroke:h,strokeWidth:1}),!_&&a&&e.jsx("path",{d:Le("bottom",i,l),fill:"none",stroke:h,strokeWidth:1}),G.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):P(t.value,n>0?G[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:v?10:18,textAnchor:v?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:p,style:{userSelect:"none"},transform:v?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:t.label})})]},"xtick-"+n)}),y&&e.jsx("text",{x:i/2,y:l+40,textAnchor:"middle",fontSize:12,fill:g,style:{userSelect:"none"},children:y}),!_&&o&&!s&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:h,strokeWidth:1}),!_&&s&&e.jsx("path",{d:Le("left",i,l),fill:"none",stroke:h,strokeWidth:1}),V.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):P(t.value,n>0?V[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:p,style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:g,transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:n}):null})(),(()=>{const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t||0===U.length)return null;const n=t.landmarkTicks,o=t.label||b;return e.jsxs(e.Fragment,{children:[!1!==t.baseline&&e.jsx("line",{x1:i,y1:0,x2:i,y2:l,stroke:h,strokeWidth:1}),U.map((t,o)=>{const r=!!n&&("function"==typeof n?n(t.value,o):P(t.value,o>0?U[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${i},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:p,style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:t.label})})]},"ytick-r-"+o)}),o&&e.jsx("text",{x:i+d.right-15,y:l/2,textAnchor:"middle",fontSize:12,fill:g,transform:`rotate(90, ${i+d.right-15}, ${l/2})`,style:{userSelect:"none"},children:o})]})})()]})})(),Q,z&&h&&$&&L&&e.jsxs(e.Fragment,{children:[z.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ce,{orient:"top",config:le(z.top),values:$,scale:h.x,size:d.top,length:i})}),z.bottom&&e.jsx("g",{transform:`translate(0, ${l})`,children:e.jsx(ce,{orient:"bottom",config:le(z.bottom),values:$,scale:h.x,size:d.bottom,length:i})}),z.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ce,{orient:"left",config:le(z.left),values:L,scale:h.y,size:d.left,length:l})}),z.right&&e.jsx("g",{transform:`translate(${i}, 0)`,children:e.jsx(ce,{orient:"right",config:le(z.right),values:L,scale:h.y,size:d.right,length:l})})]}),R,K&&K.sourceId!==q&&(null==h?void 0:h.x)&&(()=>{const t=h.x(K.xValue);if(null==t||0>t||t>i)return null;const n=K.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:l,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),H]}),k&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof k?k:null}),ae({legend:w,totalWidth:c,totalHeight:u,margin:d,legendPosition:C,title:k,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:S,legendIsolatedCategories:M})]}):null}function De(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Ne="undefined"==typeof window||"undefined"==typeof document,Te=f.createContext(null),We={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function _e(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const Fe=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},qe={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},He={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Ge={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Ve={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ue={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},Ze={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Ye={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Xe({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[s,a]=f.useState(!1),l=f.useContext(Te),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=s||c,d=f.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,p=f.useCallback(()=>{s||c||a(!0)},[s,c]),g=f.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:We}):null;if(!u)return e.jsx("div",{id:o,tabIndex:-1,onFocus:p,style:We,role:"region","aria-label":h,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,p,f,g,y,m,b,v,x,j,k,w,A,O;const S=[];if(!Array.isArray(e))return S;for(const M of e)if(M&&"object"==typeof M)try{switch(M.type){case"point":S.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=M.topPath,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=M.datum&&"object"==typeof M.datum?M.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=M.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=M.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=M.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=M.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(p=M.cx)&&void 0!==p?p:M.x,y:null!==(f=M.cy)&&void 0!==f?f:M.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(y=null===(g=M.datum)||void 0===g?void 0:g.id)&&void 0!==y?y:"",x:null!==(m=M.cx)&&void 0!==m?m:M.x,y:null!==(b=M.cy)&&void 0!==b?b:M.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(w=null!==(j=null===(x=null===(v=M.datum)||void 0===v?void 0:v.properties)||void 0===x?void 0:x.name)&&void 0!==j?j:null===(k=M.datum)||void 0===k?void 0:k.name)&&void 0!==w?w:"",value:null!==(O=null===(A=M.datum)||void 0===A?void 0:A.value)&&void 0!==O?O:""}})}}catch(e){}return S}(t),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Fe(e.min)} to ${Fe(e.max)}, mean ${Fe(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,m),v=y.slice(0,5),x=new Set;for(const e of v)for(const t of Object.keys(e.values))x.add(t);const j=Array.from(x);return e.jsxs("div",{ref:d,id:o,tabIndex:-1,onBlur:g,style:qe,role:"region","aria-label":h,children:[e.jsx("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Ge,children:"×"}),e.jsx("div",{role:"note",style:He,children:b}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+n,style:Ve,children:[e.jsxs("caption",{style:Ye,children:["First ",v.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:Ue,children:"type"}),j.map(t=>e.jsx("th",{style:Ue,children:t},t))]})}),e.jsx("tbody",{children:v.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:Ze,children:t.label}),j.map(n=>{return e.jsx("td",{style:Ze,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Fe(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function Qe({summary:t}){return t?e.jsx("div",{role:"note",style:We,children:t}):null}function Ke({tableId:t}){return e.jsx("a",{href:"#"+t,style:We,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,We)},children:"Skip to data table"})}function Je({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:We,children:n})}const et="var(--semiotic-focus, #005fcc)";function tt({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:et,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:et,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:et,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function nt({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=f.useRef(null),[u,d]=f.useState(null);f.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.jsx("div",{ref:c,className:a,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"},children:s})}function ot(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function rt(e,t,n=.6){var o,r,i,s,a;if(!ot(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function it(e,t,n,o=.35){ot(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function st(e){switch(e){case"monotoneX":return a.curveMonotoneX;case"monotoneY":return a.curveMonotoneY;case"cardinal":return a.curveCardinal;case"catmullRom":return a.curveCatmullRom;case"step":return a.curveStep;case"stepBefore":return a.curveStepBefore;case"stepAfter":return a.curveStepAfter;case"basis":return a.curveBasis;case"natural":return a.curveNatural;default:return null}}function at(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function lt(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function ct(e){return e.k}function ut(e){return[e.x,e.y]}function dt(e){return function(){return e}}function ht([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function pt(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function ft(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function gt(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 yt{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 mt{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const s=n[i.lineIndex];if(!s||2>s.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const a=bt(s),l=vt(s,i.t*a),c=(o[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function bt(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 vt(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],s=Math.sqrt(r*r+i*i);if(n+s>=t||o===e.length-1){const a=s>0?(t-n)/s:0,l=s>.001?s:1;return{x:e[o-1][0]+r*a,y:e[o-1][1]+i*a,nx:-i/l,ny:r/l}}n+=s}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const xt={top:10,right:10,bottom:10,left:10},jt={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"},kt={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 wt(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function At(e){return e?e.getContext("2d"):null}function Ot({data:t}){if(!t)return null;if(t.properties)return e.jsx("div",{className:"semiotic-tooltip",style:jt,children:e.jsx("div",{style:{fontWeight:600},children:t.properties.name||t.properties.NAME||t.properties.id||"Feature"})});const n=Object.entries(t).slice(0,3);return e.jsx("div",{className:"semiotic-tooltip",style:jt,children:n.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),e.jsx("span",{style:{fontWeight:600},children:n+""})]},t))})}const St=t.forwardRef(function(n,o){var r,i,s,l,d,h,p,f,g,y;const{projection:m,projectionExtent:b,fitPadding:v,projectionTransform:x,areas:j,points:k,lines:w,xAccessor:A,yAccessor:O,lineDataAccessor:S,pointIdAccessor:C,lineType:R="geo",flowStyle:P="basic",graticule:$,zoomable:L,zoomExtent:E,onZoom:I,dragRotate:D,showParticles:N,particleStyle:T,tileURL:W,tileAttribution:_,tileCacheSize:F,size:q,width:H,height:G,responsiveWidth:V,responsiveHeight:U,margin:Z,className:Y,background:Q,areaStyle:J,pointStyle:ee,lineStyle:te,colorScheme:ne,enableHover:oe=!0,hoverAnnotation:re,tooltipContent:ie,customClickBehavior:se,customHoverBehavior:ae,annotations:le,decay:ce,pulse:ue,transition:de,animate:he,staleness:pe,backgroundGraphics:fe,foregroundGraphics:ge,title:ye,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:xe,legendHighlightedCategory:je,legendIsolatedCategories:ke,showAxes:we,accessibleTable:Ae=!0,description:Oe,summary:Se}=n,Me=q||[H||600,G||400],Ce=t.useRef(!0),Re=K({sizeProp:Me,responsiveWidth:V,responsiveHeight:U,userMargin:Z,marginDefault:xt,foregroundGraphics:ge,backgroundGraphics:fe,animate:he,transitionProp:de,themeDirtyRef:Ce}),{reducedMotionRef:Pe,responsiveRef:ze,size:$e,margin:Le,adjustedWidth:Ee,adjustedHeight:Be,resolvedForeground:Te,resolvedBackground:We,transition:Fe,introEnabled:qe,tableId:He,rafRef:Ge,renderFnRef:Ve,scheduleRender:Ue,currentTheme:Ze}=Re,Ye=t.useMemo(()=>null!=D?D:"orthographic"===wt(m),[D,m]),et=t.useMemo(()=>{var e,t;return{projection:m,projectionExtent:b,fitPadding:v,xAccessor:A,yAccessor:O,lineDataAccessor:S,lineType:R,flowStyle:P,areaStyle:J,pointStyle:ee,lineStyle:te,colorScheme:ne,themeSemantic:B(Ze),themeSequential:null===(e=null==Ze?void 0:Ze.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==Ze?void 0:Ze.colors)||void 0===t?void 0:t.diverging,graticule:$,projectionTransform:x,decay:ce,pulse:ue,transition:Fe,introAnimation:qe,annotations:le,pointIdAccessor:C}},[m,b,v,A,O,S,R,P,J,ee,te,ne,$,x,ce,ue,null==Fe?void 0:Fe.duration,null==Fe?void 0:Fe.easing,qe,le,C,Ze]),ot=t.useRef(null);ot.current||(ot.current=new M(et));const bt=t.useRef(null),vt=t.useRef(null),jt=t.useRef(null),St=t.useRef(null),Mt=t.useRef(null);W&&!Mt.current&&(Mt.current=new yt(F||256));const Ct=t.useRef(le),Rt=t.useRef(null),Pt=t.useRef(c.zoomIdentity),zt=t.useRef(!1),$t=t.useRef(null),Lt=t.useRef(null),Et=t.useRef(null),Bt=t.useRef(null),It=t.useRef(0);if(N&&!Bt.current){const e=null!==(r=null==T?void 0:T.maxPerLine)&&void 0!==r?r:30;Bt.current=new mt(50*e)}const Dt=t.useRef(null),Nt=t.useRef(null),[Tt,Wt]=t.useState(null),[_t,Ft]=t.useState(0),[qt,Ht]=t.useState(!1);t.useEffect(()=>{var e;null===(e=ot.current)||void 0===e||e.updateConfig(et),Ce.current=!0,Ue()},[et,Ue]),t.useEffect(()=>{const e=ot.current;e&&(j&&e.setAreas(j),k&&e.setPoints(k),w&&e.setLines(w),Ce.current=!0,Ue())},[j,k,w,Ue]);const Gt=t.useCallback(e=>{var t;null===(t=ot.current)||void 0===t||t.pushPoint(e),Ce.current=!0,Ue()},[Ue]),Vt=t.useCallback(e=>{var t;null===(t=ot.current)||void 0===t||t.pushMany(e),Ce.current=!0,Ue()},[Ue]),Ut=t.useCallback(()=>{var e;null===(e=ot.current)||void 0===e||e.clear(),Ce.current=!0,Ue()},[Ue]);t.useImperativeHandle(o,()=>({push:Gt,pushMany:Vt,removePoint:e=>{var t,n;const o=null!==(n=null===(t=ot.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Ce.current=!0,Ue()),o},clear:Ut,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=ot.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=ot.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=ot.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>Pt.current.k,resetZoom:()=>{const e=$t.current;e&&Rt.current&&u.select(e).call(Rt.current.transform,c.zoomIdentity)},getData:()=>{var e,t;return null!==(t=null===(e=ot.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[Gt,Vt,Ut,Ue]);const{hoverHandlerRef:Zt,onPointerMove:Yt,onPointerLeave:Xt}=Re;t.useEffect(()=>{Zt.current=e=>{if(!oe)return;const t=ot.current;if(!t||!t.scene.length)return;const n=vt.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Le.left,i=e.clientY-o.top-Le.top;if(0>r||r>Ee||0>i||i>Be)return Dt.current=null,Nt.current=null,Wt(null),null==ae||ae(null),void Ue();St.current||(St.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=At(St.current);if(!s)return;const a=z(t.scene,r,i,30,s,t.quadtree,t.maxPointRadius);if(a){const e=a.node,t=e.datum,n=Array.isArray(t)?null:(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,s;"point"===e.type?(o=e.x,s=e.y):"geoarea"===e.type?(o=e.centroid[0],s=e.centroid[1]):(o=r,s=i);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,x:o,y:s,time:o,value:s});Dt.current=l,Nt.current=e,Wt(l),null==ae||ae(l),Ue()}else Dt.current&&(Dt.current=null,Nt.current=null,Wt(null),null==ae||ae(null),Ue())}},[oe,Ee,Be,Le,ae,Ue]),Re.hoverLeaveRef.current=()=>{Dt.current=null,Nt.current=null,Wt(null),null==ae||ae(null),Ue()};const Qt=t.useCallback(e=>{if(!se)return;const t=ot.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Le.left,r=e.clientY-n.top-Le.top;St.current||(St.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=At(St.current);if(!i)return;const s=z(t.scene,o,r,30,i,t.quadtree,t.maxPointRadius);if(s){const e=s.node.datum,t=Array.isArray(e)?null:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;se(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,x:o,y:r,time:o,value:r}))}},[se,Le]),Kt=t.useRef(-1),Jt=t.useRef(null),en=t.useCallback(e=>{const t=ot.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)"point"===n.type&&null!=n.x?t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"}):"geoarea"===n.type&&n.centroid&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"circle"});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=Kt.current,r=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return Kt.current=-1,Jt.current=null,Dt.current=null,Nt.current=null,Wt(null),null==ae||ae(null),void Ue();const i=0>o?0:r;Kt.current=i;const s=n[i];Jt.current={shape:s.shape,w:s.w,h:s.h};const a=s.datum,l=(c=a)?c.properties&&"object"==typeof c.properties?Object.assign(Object.assign({},c),c.properties):c:null;var c;const u=Object.assign(Object.assign({},l),{data:a,properties:null==a?void 0:a.properties,x:s.x,y:s.y,time:s.x,value:s.y});Dt.current=u,Wt(u),null==ae||ae(u),Ue()},[ae,Ue]),tn=t.useCallback(e=>{Kt.current=-1,Jt.current=null,Yt(e)},[Yt]);Ve.current=()=>{var e,t,n,o,r,i,s,l;Ge.current=0;const c=vt.current,u=ot.current;if(!c||!u)return;const d=performance.now();let h=!1;const p=Et.current;p&&(Et.current=null,u.applyRotation(p,{width:Ee,height:Be}));const f=u.advanceTransition(Pe.current?d+1e6:d),g=!Pe.current&&f;if(Ce.current&&!f){const e={width:Ee,height:Be},t=Ye?u.getRotation():null;u.computeScene(e);const n=Pt.current,o=1!==n.k||0!==n.x||0!==n.y;Ye&&t?o?(u.setRotation(t),u.applyZoomScale(n.k,e)):u.applyRotation(t,e):o&&u.applyZoomTransform(n,e),Ce.current=!1,c.setAttribute("aria-label",_e(u.scene,"Geographic chart"))}const y=ft();if(W&&Mt.current){const t=bt.current;if(t&&(null===(e=u.scales)||void 0===e?void 0:e.projection)){const e=pt(t,$e,Le,y);if(e){e.clearRect(-Le.left,-Le.top,$e[0],$e[1]),e.save(),e.beginPath(),e.rect(0,0,Ee,Be),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:s,onTileLoad:a}=t,l=o.scale(),c=o.translate(),u=2*l*Math.PI,d=function(){let e=0,t=0,n=960,o=500,r=!0,i=!0,s=256,a=ct,l=ut,c=0;function u(){const u=+a.apply(this,arguments),d=l.apply(this,arguments),h=Math.log2(u/s),p=Math.round(Math.max(h+c,0)),f=Math.pow(2,h-p)*s,g=+d[0]-u/2,y=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-g)/f)),b=Math.min(r?1<<p:1/0,Math.ceil((n-g)/f)),v=Math.max(i?0:-1/0,Math.floor((t-y)/f)),x=Math.min(i?1<<p:1/0,Math.ceil((o-y)/f)),j=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)j.push([t,e,p]);return j.translate=[g/f,y/f],j.scale=f,j}return u.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],u):[n-e,o-t]},u.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],u):[[e,t],[n,o]]},u.scale=function(e){return arguments.length?(a="function"==typeof e?e:dt(+e),u):a},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:dt([+e[0],+e[1]]),u):l},u.zoomDelta=function(e){return arguments.length?(c=+e,u):c},u.tileSize=function(e){return arguments.length?(s=+e,u):s},u.clamp=function(e){return arguments.length?(r=i=!!e,u):r&&i},u.clampX=function(e){return arguments.length?(r=!!e,u):r},u.clampY=function(e){return arguments.length?(i=!!e,u):i},u}().size([r,i]).scale(u).translate(c).clamp(!0)(),h=ft();let p=!0;for(const t of d){const[o,r,i]=ht(t),l=`${i}/${o}/${r}`;let c=s.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};s.set(l,t),e.onload=()=>{t.loaded=!0,null==a||a()},e.onerror=()=>{t.loaded=!0},e.src=gt(n,i,o,r,h),c=t}if(!c.loaded){p=!1;continue}const u=d.scale;e.drawImage(c.img,(t[0]+d.translate[0])*u-.5,(t[1]+d.translate[1])*u-.5,u+1,u+1)}return p}(e,{tileURL:W,projection:u.scales.projection,width:Ee,height:Be,tileCache:Mt.current,onTileLoad:()=>Ue()});e.restore(),t||(h=!0)}}}const m=pt(c,$e,Le,y);if(!m)return;m.clearRect(-Le.left,-Le.top,$e[0],$e[1]),Q&&!W&&(m.fillStyle=Q,m.fillRect(0,0,Ee,Be)),m.save(),m.beginPath(),m.rect(0,0,Ee,Be),m.clip();const b=u.scene,v={width:Ee,height:Be};if(function(e,t){var n,o,r;const i=t.filter(e=>"geoarea"===e.type);for(const t of i){if(!t.pathData)continue;const i=new Path2D(t.pathData),s=t.style.fill||"#e0e0e0";if("none"!==s&&(e.fillStyle=s,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(i)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=X(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(r=t._decayOpacity)&&void 0!==r?r:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(i)}it(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(m,b),((e,t,n,o)=>{var r,i;const s=t.filter(e=>"line"===e.type);for(const l of s){if(2>l.path.length)continue;const c=l._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=l.style.stroke||"#007bff",d=X(e,u)||u,h=l.style.strokeWidth||2,p=l.colorThresholds,f=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=h,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const b=null!==(r=l.style.opacity)&&void 0!==r?r:1;lt(e,l.path,d,h,b,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=st(l.curve),y=p&&p.length>0&&f&&f.length===l.path.length,m=l._decayOpacities;if(m&&m.length===l.path.length&&!y){e.strokeStyle=d;const v=null!==(i=l.style.opacity)&&void 0!==i?i:1;for(let x=0;l.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*v,e.beginPath(),e.moveTo(l.path[x][0],l.path[x][1]),e.lineTo(l.path[x+1][0],l.path[x+1][1]),e.stroke()}else if(y){let j=null,k=null,w=null,A=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function M(){O&&(e.stroke(),O=!1)}for(let C=0;l.path.length>C;C++){const[R,P]=l.path[C],z=f[C],$=at(z,p,d);if(null!==j&&null!==A&&null!==w){if($===A)e.lineTo(R,P);else{const L=[];for(const E of p){const B=E.value;(w>B||B>z)&&(B>w||z>B)||w===B||z===B||L.push({t:(B-w)/(z-w)})}L.sort((e,t)=>e.t-t.t);for(const I of L){const D=j+(R-j)*I.t,N=k+(P-k)*I.t,T=at(w+(z-w)*Math.min(I.t+1e-4,1),p,d);e.lineTo(D,N),M(),S(T,D,N)}e.lineTo(R,P)}j=R,k=P,w=z,A=$}else S($,R,P),j=R,k=P,w=z,A=$}M()}else{if(e.beginPath(),!l.strokeGradient||2>l.strokeGradient.colorStops.length||2>l.path.length)e.strokeStyle=d;else{const W=e.createLinearGradient(l.path[0][0],0,l.path[l.path.length-1][0],0);for(const _ of l.strokeGradient.colorStops)W.addColorStop(Math.max(0,Math.min(1,_.offset)),_.color);e.strokeStyle=W}if(g)a.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(l.path);else{const[F,q]=l.path[0];e.moveTo(F,q);for(let H=1;l.path.length>H;H++)e.lineTo(l.path[H][0],l.path[H][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=("string"==typeof l.style.fill?X(e,l.style.fill):l.style.fill)||l.style.fill,g&&!y)a.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(l.path);else{const[V,U]=l.path[0];e.moveTo(V,U);for(let Z=1;l.path.length>Z;Z++)e.lineTo(l.path[Z][0],l.path[Z][1])}const G=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(G,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(m,b,0,v),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=("string"==typeof t.style.fill?X(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?X(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),rt(e,t),e.globalAlpha=1}}finally{e.restore()}}})(m,b),N&&Bt.current){const e=Bt.current,a=b.filter(e=>"line"===e.type);if(a.length>0){const l=T||{},c=.3*(null!==(t=l.speedMultiplier)&&void 0!==t?t:1),u=null!==(n=l.maxPerLine)&&void 0!==n?n:30,p=null!==(o=l.spawnRate)&&void 0!==o?o:.15,f=null!==(r=l.radius)&&void 0!==r?r:2,g=null!==(i=l.opacity)&&void 0!==i?i:.7,y=d/1e3,b=It.current>0?Math.min(y-It.current,.1):.016;It.current=y;const v=a.map(e=>e.path),x=a.map(e=>e.style.strokeWidth||2);for(let t=0;a.length>t;t++)Math.random()<p&&e.countForLine(t)<u&&e.spawn(t);e.step(b,c,v,x),m.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=a[n.lineIndex],r="function"==typeof l.color?l.color(null!==(s=null==o?void 0:o.datum)&&void 0!==s?s:{}):"source"!==l.color&&l.color?l.color:(null==o?void 0:o.style.stroke)||"#fff";m.beginPath(),m.arc(n.x,n.y,f,0,2*Math.PI),m.fillStyle=r,m.fill()}m.globalAlpha=1,h=!0}}m.restore();const x=jt.current;if(x){const e=pt(x,$e,Le,y);if(e){e.clearRect(-Le.left,-Le.top,$e[0],$e[1]);const t=Nt.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof re?re:void 0,r=(null==o?void 0:o.pointColor)||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(pe){const e=performance.now()-u.lastIngestTime>(null!==(l=pe.threshold)&&void 0!==l?l:5e3);e!==qt&&Ht(e)}const j=le!==Ct.current;j&&(Ct.current=le),(Ce.current||j)&&Ft(e=>e+1),(g||null!=u.activeTransition||u.hasActivePulses||h)&&(Ge.current=requestAnimationFrame(()=>Ve.current()))},t.useEffect(()=>(Ue(),()=>{var e;null===(e=Mt.current)||void 0===e||e.clear()}),[Ue]),t.useEffect(()=>{Ce.current=!0,Ue()},[Ee,Be,Q,Ue]),function(e,n,o,r,i,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),o.current=!0,r())},1e3);return()=>clearInterval(t)},[e,i,r])}(pe,ot,Ce,Ue,qt,Ht),t.useEffect(()=>{if("production"!==process.env.NODE_ENV&&W){const e=wt(m);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[W,m]),t.useEffect(()=>{const e=$t.current;if(!L||!e)return Rt.current&&e&&(u.select(e).on(".zoom",null),Rt.current=null),void(e&&u.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=E||[1,8],o={width:Ee,height:Be};if(Ye){let r=Pt.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),Pt.current=c.zoomIdentity.scale(r);const s=ot.current;s&&(s.applyZoomScale(r,o),Ce.current=!1,Ue(),(null===(i=s.scales)||void 0===i?void 0:i.projection)&&(null==I||I({projection:s.scales.projection,zoom:s.currentZoom})))};Rt.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const s=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},a=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",a);const l=.4,u=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=ot.current;if(!o)return;const r=o.getRotation();Lt.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=Lt.current;t&&(Et.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],Ue())},h=t=>{var n;if(!Lt.current)return;Lt.current=null,e.releasePointerCapture(t.pointerId);const r=Et.current;if(r){Et.current=null;const e=ot.current;e&&(e.applyRotation(r,o),Ue())}const i=ot.current;(null===(n=null==i?void 0:i.scales)||void 0===n?void 0:n.projection)&&(null==I||I({projection:i.scales.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",a),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),Rt.current=null}}const r=c.zoom().scaleExtent([t,n]).extent([[0,0],[$e[0],$e[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;Pt.current=t,zt.current=!0;const n=ot.current;n&&(n.applyZoomTransform(t,o),Ce.current=!1,Ue())}).on("end",e=>{var t;Pt.current=e.transform,zt.current=!1;const n=ot.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==I||I({projection:n.scales.projection,zoom:n.currentZoom}))});return Rt.current=r,u.select(e).call(r),()=>{u.select(e).on(".zoom",null)}},[L,E,Ye,$e,Ee,Be,Le,I,Ue]);const nn=oe&&!1!==re,on=nn&&Tt?ie?ie(Tt):e.jsx(Ot,{data:Tt}):null,rn=on?e.jsx(nt,{x:Tt.x,y:Tt.y,containerWidth:Ee,containerHeight:Be,margin:Le,className:"stream-frame-tooltip",zIndex:10,children:on}):null;if(Ne){const t=ot.current;t&&(j||k||w)&&(j&&t.setAreas(j),k&&t.setPoints(k),w&&t.setLines(w),t.computeScene({width:Ee,height:Be}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[];return e.jsxs("div",{className:"stream-geo-frame"+(Y?" "+Y:""),role:"img","aria-label":Oe||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:$e[0],height:$e[1]},children:[e.jsx(Qe,{summary:Se}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:$e[0],height:$e[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${Le.left},${Le.top})`,children:We}),e.jsxs("g",{transform:`translate(${Le.left},${Le.top})`,children:[Q&&e.jsx("rect",{x:0,y:0,width:Ee,height:Be,fill:Q}),n.map((t,n)=>function(t,n){var o,r,i,s,a,l;switch(t.type){case"geoarea":{const i=t;return i.pathData?e.jsx("path",{d:i.pathData,fill:De(i.style.fill,"#e0e0e0"),fillOpacity:null!==(o=i.style.fillOpacity)&&void 0!==o?o:1,stroke:i.style.stroke||"none",strokeWidth:i.style.strokeWidth||.5,strokeDasharray:i.style.strokeDasharray,opacity:null!==(r=i._decayOpacity)&&void 0!==r?r:1},"geoarea-"+n):null}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:De(o.style.fill),fillOpacity:null!==(i=o.style.fillOpacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(s=o._decayOpacity)&&void 0!==s?s:null!==(a=o.style.opacity)&&void 0!==a?a:1},"point-"+n)}case"line":{const o=t;if(2>o.path.length)return null;const r="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e.jsx("path",{d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(l=o.style.opacity)&&void 0!==l?l:1},"line-"+n)}default:return null}}(t,n))]})]}),e.jsx(Ie,{width:Ee,height:Be,totalWidth:$e[0],totalHeight:$e[1],margin:Le,scales:null,showAxes:!1,title:ye,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:xe,legendHighlightedCategory:je,legendIsolatedCategories:ke,foregroundGraphics:Te,annotations:le,annotationFrame:0,xValues:[],yValues:[],pointNodes:n.filter(e=>"point"===e.type)})]})}const sn=t.useCallback(e=>{$t.current=e,ze&&"object"==typeof ze&&(ze.current=e)},[ze]);return e.jsxs("div",{ref:sn,className:"stream-geo-frame"+(Y?" "+Y:""),role:"group","aria-label":Oe||("string"==typeof ye?ye:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:V?"100%":$e[0],height:U?"100%":$e[1],overflow:"hidden"},L?{touchAction:"none"}:{}),onKeyDown:en,children:[Ae&&e.jsx(Ke,{tableId:He}),Ae&&e.jsx(Xe,{scene:null!==(l=null===(s=ot.current)||void 0===s?void 0:s.scene)&&void 0!==l?l:[],chartType:"Geographic chart",tableId:He,chartTitle:"string"==typeof ye?ye:void 0}),e.jsx(Qe,{summary:Se}),e.jsxs("div",{role:"img","aria-label":Oe||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:nn?tn:void 0,onMouseLeave:nn?Xt:void 0,onClick:se?Qt:void 0,children:[We&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:$e[0],height:$e[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Le.left},${Le.top})`,children:We})}),W&&e.jsx("canvas",{ref:bt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx("canvas",{ref:vt,"aria-label":_e(null!==(h=null===(d=ot.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:jt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(Je,{hoverPoint:Tt}),e.jsx(Ie,{width:Ee,height:Be,totalWidth:$e[0],totalHeight:$e[1],margin:Le,scales:null,showAxes:null!=we&&we,title:ye,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:xe,legendHighlightedCategory:je,legendIsolatedCategories:ke,foregroundGraphics:Te,annotations:le,annotationFrame:_t,xValues:[],yValues:[],pointNodes:null===(p=ot.current)||void 0===p?void 0:p.scene.filter(e=>"point"===e.type)}),(null==pe?void 0:pe.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===pe.badgePosition?{top:4,left:4}:"bottom-left"===pe.badgePosition?{bottom:4,left:4}:"bottom-right"===pe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:qt?"#dc3545":"#28a745",color:"white"}),children:qt?"STALE":"LIVE"}),L&&e.jsxs("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Le.bottom+8,left:Le.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e.jsx("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=$t.current,n=Rt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1.5)},style:kt,children:"+"}),e.jsx("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=$t.current,n=Rt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1/1.5)},style:kt,children:"−"})]}),_&&e.jsx("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Le.bottom+2,right:Le.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:_}),e.jsx(tt,{active:Kt.current>=0,hoverPoint:Tt,margin:Le,size:$e,shape:null===(f=Jt.current)||void 0===f?void 0:f.shape,width:null===(g=Jt.current)||void 0===g?void 0:g.w,height:null===(y=Jt.current)||void 0===y?void 0:y.h}),rn]})]})});St.displayName="StreamGeoFrame";const Mt={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Ct(e,t){return"function"==typeof t?t(e):e[t]}function Rt(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Pt(t={}){const{fields:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=Ct(t,o);a=Rt(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=Ct(t,o);l.push({label:n,value:Rt(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=Rt(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=Rt(t[e[0]],r))}}const c=Object.assign(Object.assign({},Mt),i);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function zt(t){if(!0===t)return Pt();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.jsx("div",{className:"semiotic-tooltip",style:Mt,children:o})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Pt(t):Pt())}const $t={category10:d.schemeCategory10,tableau10:d.schemeTableau10,set3:d.schemeSet3,blues:d.interpolateBlues,reds:d.interpolateReds,greens:d.interpolateGreens,oranges:d.interpolateOranges,purples:d.interpolatePurples,viridis:d.interpolateViridis,plasma:d.interpolatePlasma},Lt=d.schemeCategory10,Et=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Bt=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 It(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")||Bt.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):Lt[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+""))%Lt.length]}function Dt(e,t,n="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(n))return o.scaleOrdinal().domain(r).range(n).unknown("#999");const s=$t[n]||$t.category10;if(i&&"function"==typeof s){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:Lt;return o.scaleOrdinal().domain(r).range(e).unknown("#999")}}function Nt(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[i,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}const Tt=t.createContext(null);function Wt(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 _t(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Ft,qt]=L(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=_t(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=_t(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}})}})),[Ht,Gt]=L(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 Vt(e){const n=t.useId(),o=e.clientId||n,{name:r}=e,i=qt(e=>e.selections.get(r)),s=qt(e=>e.setClause),a=qt(e=>e.clearClause),l=t.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:t.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(Wt(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:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(r,{clientId:o,type:"point",fields:t})},[o,r,s]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(r,{clientId:o,type:"interval",fields:t})},[o,r,s]),clear:t.useCallback(()=>{a(r,o)},[a,r,o]),clientId:o}}function Ut(e){const n=e.name||"hover",{fields:o}=e,{predicate:r,isActive:i,selectPoints:s,clear:a}=Vt({name:n});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,a,n]),predicate:r,isActive:i}}const Zt=t.createContext(!1);function Yt(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}function Xt(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}function Qt(){return F(e=>e.theme)}f.createContext(void 0);const Kt="#007bff";function Jt(e,n,o){const r=t.useContext(Tt),i=function(){var e;const t=Qt(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}();return t.useMemo(()=>{var t;if(!n)return;const s=null!==(t=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const e=Dt(t.map(e=>({_cat:e})),"_cat",s);return t=>r[t]||e(t)}return Dt(t.map(e=>({_cat:e})),"_cat",s)}if(r&&Object.keys(r).length>0){const t=Dt(e,n,s);return e=>r[e]||t(e)}return Dt(e,n,s)}if(r&&Object.keys(r).length>0){const e=Dt([{_:"a"}],"_",s);return t=>r[t]||e(t)}},[e,n,o,r,i])}function en({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=Yt(n,o),p=Vt({name:(null==e?void 0:e.name)||"__unused__"}),f=Ut({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),g=Gt(e=>e.pushObservation),y=e?{isActive:p.isActive,predicate:p.predicate}:null,[m,b]=t.useState(null),v=u||o[0],x=t.useMemo(()=>{if(!c||null==m||!v)return null;const e=m,t=v;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,v]),j=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const e=null==t?void 0:t[h.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=ke.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(ke={positions:new Map(ke.positions).set(e,{xValue:t,sourceId:n})},Ae())}(h.name||"hover",Number(e),d)}"x-position"!==(null==h?void 0:h.mode)&&f.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Oe(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&f.onHover(null);if(c&&v)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[v];b(null!=n?n+"":null)}else b(null);if(i||g){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const s=Object.assign(Object.assign({},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(s),g&&g(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),g&&g(e)}}},[n,f,h,d,i,s,a,g,c,v]),k=t.useCallback(e=>{var t,n,o,r;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[h.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=ke.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(ke.positions);return t.delete(e),ke={positions:t},Ae(),!1}ke={positions:new Map(ke.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Ae()}(h.name||"hover",Number(n),d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||g){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),g&&g(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),g&&g(e)}}},[l,i,g,s,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{Se(e,d),Oe(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:j,customClickBehavior:k,crosshairSourceId:d}}function tn({data:e,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(Zt),u=void 0!==r?r:!c&&!!n,d=t.useMemo(()=>{if(!u||!n)return;const t=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):Et[i%Et.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:It,categories:l});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[u,n,e,o,l]),h=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return d&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,d,i]);return{legend:d,margin:h,legendPosition:i}}const nn={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 on(e,t,n){var o,r,i,s,a,l,c;const u=nn[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(r=t.height)&&void 0!==r?r:u.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:rn(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function rn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function sn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function an({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.jsx("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}class ln extends f.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.jsx(an,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function cn(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function un(e,t,n=3){let o,r=n+1;for(const n of t){const t=cn(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function dn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function hn(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=un(e,t,3))&&void 0!==n?n:null)}const pn={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},fn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},gn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},yn=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],mn=["vertical","horizontal"],bn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:yn},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({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:yn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:yn},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({},pn),fn),{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({},pn),fn),{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({},pn),fn),{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({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),fn),{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({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:mn},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:mn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},pn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},pn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},pn),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},pn),gn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},pn),{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({},pn),{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:mn},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({},pn),{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({},pn),{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({},pn),{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({},pn),{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({},pn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},pn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},pn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},pn),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},pn),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},pn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},pn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function vn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const xn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),jn=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),kn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),wn=new Set(["LineChart","AreaChart","StackedAreaChart"]),An=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function On(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function Sn(e,t){const n=On(e),o=On(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Mn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Cn(e,t){const n=[],o=function(e,t){const n=[],o=bn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(bn).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(!vn(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=un(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const s=function({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=dn(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=hn(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=dn(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=hn(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return bn[e]?(function(e,t,n){const o=bn[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=bn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){xn.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){jn.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=bn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=t.xAccessor;"string"==typeof s&&i[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!kn.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(!wn.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(r=t.height)&&void 0!==r?r:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=bn[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(i.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!An.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Sn(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=Sn(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of Mn)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var Rn;const Pn="undefined"!=typeof process&&"production"!==(null===(Rn=process.env)||void 0===Rn?void 0:Rn.NODE_ENV);function zn({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.jsx(ln,{fallback:i=>{let s="";if(Pn&&r)try{const e=Cn(t,r);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.jsx(an,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})},children:i})}const $n={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"},Ln={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function En(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},$n),{width:n,height:o}),children:r||"No data available"}):null}function Bn(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Ln),{position:"absolute",top:a+o*(i+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})},o))})}function In(e,t,n,o){if(!Pn)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 Dn(e){const n=F(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function Nn(e,t,n,o){return new(n||(n=Promise))(function(r,i){function s(e){try{l(o.next(e))}catch(e){i(e)}}function a(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((o=o.apply(e,t||[])).next())})}function Tn(e){return e}function Wn(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 Tn;var t,n,o=e.scale[0],r=e.scale[1],i=e.translate[0],s=e.translate[1];return function(e,a){a||(t=n=0);var l=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+i,u[1]=(n+=e[1])*r+s;c>l;)u[l]=e[l],++l;return u}}(e.transform),o=e.arcs;function r(e,t){t.length&&t.pop();for(var r=o[0>e?~e:e],i=0,s=r.length;s>i;++i)t.push(n(r[i],i));0>e&&function(e,t){for(var n,o=e.length,r=o-t;r<--o;)n=e[r],e[r++]=e[o],e[o]=n}(t,s)}function i(e){return n(e)}function s(e){for(var t=[],n=0,o=e.length;o>n;++n)r(e[n],t);return 2>t.length&&t.push(t[0]),t}function a(e){for(var t=s(e);4>t.length;)t.push(t[0]);return t}function l(e){return e.map(a)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=i(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(i);break;case"LineString":n=s(t.arcs);break;case"MultiLineString":n=t.arcs.map(s);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:r,geometry:i}:null==o?{type:"Feature",id:n,properties:r,geometry:i}:{type:"Feature",id:n,bbox:o,properties:r,geometry:i}}"function"==typeof SuppressedError&&SuppressedError;const _n=new Map;function Fn(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function qn(e){return Nn(this,void 0,void 0,function*(){const t=_n.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return Nn(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:Fn(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Fn(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Fn(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Fn(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 Wn(e,t)})}:Wn(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return _n.set(e,i),i})}function Hn(e){const n=t.useMemo(()=>Array.isArray(e)?e:void 0,[e]),[o,r]=t.useState(null);return t.useEffect(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return r(null),qn(e).then(e=>{t||r(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),r(null)}else r(null)},[e]),void 0!==n?n:o}const Gn={blues:d.interpolateBlues,reds:d.interpolateReds,greens:d.interpolateGreens,viridis:d.interpolateViridis,oranges:d.interpolateOranges,purples:d.interpolatePurples,greys:d.interpolateGreys,plasma:d.interpolatePlasma,inferno:d.interpolateInferno,magma:d.interpolateMagma,cividis:d.interpolateCividis,turbo:d.interpolateTurbo};function Vn(n){var r;const s=on(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),a=function(){var e;const t=Qt();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:l,valueAccessor:c,colorScheme:u,projection:h="equalEarth",graticule:p,fitPadding:f,zoomable:g,zoomExtent:y,onZoom:m,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:j,tooltip:k,areaOpacity:w=1,annotations:A,margin:O,className:S,selection:M,linkedHover:C,onObservation:R,onClick:P,chartId:z,loading:$,emptyContent:L,frameProps:E={},stroke:B,strokeWidth:I,opacity:D}=n,N=null!=g?g:!!v,T=Hn(l),W=t.useMemo(()=>"function"==typeof c?c:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[c])&&void 0!==n?n:null==e?void 0:e[c]},[c]),_=null!==(r=null!=u?u:a)&&void 0!==r?r:"blues",F=t.useMemo(()=>{if(!T)return o.scaleSequential(d.interpolateBlues).domain([0,1]);const e=T.map(e=>W(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=i.extent(e);return o.scaleSequential(Gn[_]||d.interpolateBlues).domain([null!=t?t:0,null!=n?n:1])},[T,W,_]),{activeSelectionHook:q,customHoverBehavior:H,customClickBehavior:G}=en({selection:M,linkedHover:C,onObservation:R,onClick:P,chartType:"ChoroplethMap",chartId:z}),V=Dn(M),U=t.useMemo(()=>{const e=sn(e=>{const t=W(e);return{fill:null!=t&&isFinite(t)?F(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:w}},{stroke:B,strokeWidth:I,opacity:D});return q?Xt(e,q,V):e},[W,F,q,V,w,B,I,D]),Z=t.useMemo(()=>t=>{var n,o;const r=(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.name)||(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||"Feature",i=W(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:r}),null!=i&&e.jsx("div",{style:{opacity:.7},children:(s=i,"number"==typeof s&&isFinite(s)?Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=s?s:"")+"")})]});var s},[W]),Y=t.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof O?{top:O,bottom:O,left:O,right:O}:O),[O]),X=Bn($,s.width,s.height)||(T?null:Bn(!0,s.width,s.height)),Q=X?null:En(T,s.width,s.height,L);if(Array.isArray(T)&&T.length>0){const t=T[0];if(!t||"object"!=typeof t||!t.geometry)return e.jsx(an,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:s.width,height:s.height})}const K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h,areas:T,areaStyle:U,size:[s.width,s.height],margin:Y,enableHover:!0,tooltipContent:!1===k?()=>null:!0===k?Z:zt(k)||Z},null!=p&&{graticule:p}),null!=f&&{fitPadding:f}),N&&{zoomable:!0}),y&&{zoomExtent:y}),m&&{onZoom:m}),null!=b&&{dragRotate:b}),v&&{tileURL:v}),x&&{tileAttribution:x}),j&&{tileCacheSize:j}),(C||R||P)&&{customHoverBehavior:H}),(R||P)&&{customClickBehavior:G}),A&&A.length>0&&{annotations:A}),s.title&&{title:s.title}),s.description&&{description:s.description}),s.summary&&{summary:s.summary}),void 0!==s.accessibleTable&&{accessibleTable:s.accessibleTable}),S&&{className:S}),null!=n.animate&&{animate:n.animate}),E);return X||Q||e.jsx(zn,{componentName:"ChoroplethMap",width:s.width,height:s.height,children:e.jsx(St,Object.assign({},K))})}Vn.displayName="ChoroplethMap";const Un=t.forwardRef(function(n,o){const r=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,i;const s=null!==(o=null===(n=r.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of s)null===(i=r.current)||void 0===i||i.push(t(e));return s},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const i=on(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:s,xAccessor:a="lon",yAccessor:l="lat",sizeBy:c,sizeRange:u=[3,30],colorBy:d,colorScheme:h,projection:p="equalEarth",graticule:f,fitPadding:g,zoomable:y,zoomExtent:m,onZoom:b,dragRotate:v,tileURL:x,tileAttribution:j,tileCacheSize:k,areas:w,areaStyle:A={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:O,annotations:S,margin:M,className:C,selection:R,linkedHover:P,onObservation:z,onClick:$,chartId:L,loading:E,emptyContent:B,legendInteraction:I,legendPosition:D,frameProps:N={},stroke:T,strokeWidth:W,opacity:_}=n,F=null!=y?y:!!x,q=Hn(w),H=s||[],{activeSelectionHook:G,customHoverBehavior:V,customClickBehavior:U}=en({selection:R,linkedHover:P,fallbackFields:d?["string"==typeof d?d:""]:[],onObservation:z,onClick:$,chartType:"ProportionalSymbolMap",chartId:L}),Z=Dn(R),Y=Jt(H,d,h),X=t.useMemo(()=>{if(!c)return;const e="function"==typeof c?c:e=>null==e?void 0:e[c],t=H.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[H,c]),Q=t.useMemo(()=>{const e=sn(e=>({fill:d?It(e,d,Y):Kt,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:c?Nt(e,c,u,X):6}),{stroke:T,strokeWidth:W,opacity:_});return G?Xt(e,G,Z):e},[d,Y,c,u,X,G,Z,T,W,_]),K=t.useMemo(()=>{if(!d)return[];const e="function"==typeof d?d:e=>null==e?void 0:e[d],t=new Set;for(const n of H){if(!n)continue;const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[H,d]),J=function(e,n,o){const[r,i]=t.useState(null),[s,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&i(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===r}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,r,s]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(I,d,K),{legend:ee,margin:te,legendPosition:ne}=tn({data:H,colorBy:d,colorScale:Y,showLegend:i.showLegend,legendPosition:D,userMargin:M,defaults:{top:10,bottom:10,left:10,right:10}}),oe=t.useMemo(()=>t=>{const n=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t.NAME)||(null==t?void 0:t.id),o="string"==typeof c?c:null,r=("function"==typeof c?c:e=>e[c])(t),i=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",s="string"==typeof d?d:null,a=s?null==t?void 0:t[s]:null;return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[n&&e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:n}),o&&null!=r&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[o,": "]}),i(r)]}),s&&null!=a&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[s,": "]}),a+""]}),!n&&!o&&Object.entries(t).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),i(n)]},t))]})},[c,d]),re=Bn(E,i.width,i.height),ie=re?null:En(s,i.width,i.height,B);In("ProportionalSymbolMap",H,"xAccessor",a),In("ProportionalSymbolMap",H,"yAccessor",l);const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:p},null!=s&&{points:H}),{xAccessor:a,yAccessor:l,pointStyle:Q}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),q&&{areas:q,areaStyle:A}),null!=f&&{graticule:f}),null!=g&&{fitPadding:g}),F&&{zoomable:!0}),m&&{zoomExtent:m}),b&&{onZoom:b}),null!=v&&{dragRotate:v}),x&&{tileURL:x}),j&&{tileAttribution:j}),k&&{tileCacheSize:k}),{size:[i.width,i.height],margin:te,enableHover:!0,tooltipContent:!1===O?()=>null:zt(O)||oe}),ee&&{legend:ee,legendPosition:ne}),I&&"none"!==I&&{legendHoverBehavior:J.onLegendHover,legendClickBehavior:J.onLegendClick,legendHighlightedCategory:J.highlightedCategory,legendIsolatedCategories:J.isolatedCategories}),(P||z||$)&&{customHoverBehavior:V}),(z||$)&&{customClickBehavior:U}),S&&S.length>0&&{annotations:S}),i.title&&{title:i.title}),i.description&&{description:i.description}),i.summary&&{summary:i.summary}),void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable}),C&&{className:C}),null!=n.animate&&{animate:n.animate}),N);return re||ie||e.jsx(zn,{componentName:"ProportionalSymbolMap",width:i.width,height:i.height,children:e.jsx(St,Object.assign({ref:r},se))})});function Zn(n){const r=on(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:i,nodes:s,nodeIdAccessor:a="id",xAccessor:l="lon",yAccessor:c="lat",valueAccessor:u="value",projection:d="equalEarth",graticule:h,fitPadding:p,zoomable:f,zoomExtent:g,onZoom:y,dragRotate:m,tileURL:b,tileAttribution:v,tileCacheSize:x,lineType:j="geo",flowStyle:k="basic",areas:w,areaStyle:A={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:O,edgeOpacity:S=.6,edgeWidthRange:M=[1,8],edgeLinecap:C="round",colorScheme:R,showParticles:P,particleStyle:z,tooltip:$,annotations:L,margin:E,className:B,selection:I,linkedHover:D,onObservation:N,onClick:T,chartId:W,loading:_,emptyContent:F,frameProps:q={},stroke:H,strokeWidth:G,opacity:V}=n,U=null!=f?f:!!b,Z=Hn(w),Y=Yt(D),X=Vt({name:(null==I?void 0:I.name)||"__unused__"}),Q=Ut({name:(null==Y?void 0:Y.name)||"hover",fields:(null==Y?void 0:Y.fields)||[]}),K=Gt(e=>e.pushObservation),J=I?{isActive:X.isActive,predicate:X.predicate}:null,ee=i||[],te=s||[],ne=Jt(ee,O,R),oe=t.useMemo(()=>{const e=new Map;for(const t of te)e.set(t[a]+"",t);return e},[te,a]),re=t.useMemo(()=>{const e=new Map;for(const t of ee)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},[ee]),ie=t.useCallback(e=>{var t,n;if(D)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=re.get(t[a]+"");e&&Q.onHover(e)}else Q.onHover(t)}else Q.onHover(null);if(N||K){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),K&&K(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});N&&N(e),K&&K(e)}}},[D,Q,a,re,N,W,K]),se=t.useCallback(e=>{var t,n,o,r;if(e&&T){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),T(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(e&&(N||K)){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n={timestamp:Date.now(),chartType:"FlowMap",chartId:W,type:"click",datum:t||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0};N&&N(n),K&&K(n)}},[T,N,K,W]),ae=t.useMemo(()=>{const e="function"==typeof l?l:e=>e[l],t="function"==typeof c?c:e=>e[c];return ee.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=oe.get(n.source+""),r=oe.get(n.target+"");return o&&r?Object.assign(Object.assign({},n),{coordinates:[{[l]:e(o),[c]:t(o)},{[l]:e(r),[c]:t(r)}]}):null}).filter(Boolean)},[ee,oe,l,c]),le=t.useMemo(()=>{const e=ee.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[u])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>M[0]:o.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(M)},[ee,u,M]),ce=t.useMemo(()=>e=>{var t;return{stroke:O?It(e,O,ne):Kt,strokeWidth:le(null!==(t=e[u])&&void 0!==t?t:0),strokeLinecap:C,opacity:S}},[O,ne,le,u,S,C]),ue=Dn(I),de=t.useMemo(()=>{const e=sn(ce,{stroke:H,strokeWidth:G,opacity:V});if(!J)return e;const t=Object.assign(Object.assign({},(null==ue?void 0:ue.unselectedStyle)||{}),{fillOpacity:0});return Xt(e,J,Object.assign(Object.assign({},ue||{}),{unselectedStyle:t}))},[ce,J,ue,H,G,V]),he=t.useMemo(()=>sn(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:H,strokeWidth:G,opacity:V}),[H,G,V]),pe=t.useMemo(()=>t=>{var n,o,r,i,s,l,c;if((null==t?void 0:t.geometry)||(null==t?void 0:t.properties)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.geometry)){const n=(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.name)||(null===(r=null==t?void 0:t.properties)||void 0===r?void 0:r.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||(null===(s=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.properties)||void 0===s?void 0:s.name)||(null===(c=null===(l=null==t?void 0:t.data)||void 0===l?void 0:l.properties)||void 0===c?void 0:c.NAME);if(n)return e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:n})})}if(null!=(null==t?void 0:t.source)&&null!=(null==t?void 0:t.target)){const n=t[u];return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsxs("div",{style:{fontWeight:600},children:[t.source," → ",t.target]}),null!=n&&e.jsx("div",{style:{opacity:.7},children:"number"==typeof n?n.toLocaleString():n})]})}const d=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t[a]);return null!=d?e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:d})}):null},[u,a]),fe=t.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof E?{top:E,bottom:E,left:E,right:E}:E),[E]),ge=Bn(_,r.width,r.height),ye=ge?null:En(i,r.width,r.height,F),me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:d,lines:ae,points:te,xAccessor:l,yAccessor:c,lineDataAccessor:"coordinates",lineType:j,flowStyle:k,lineStyle:de,pointStyle:he},Z&&{areas:Z,areaStyle:A}),null!=h&&{graticule:h}),null!=p&&{fitPadding:p}),U&&{zoomable:!0}),g&&{zoomExtent:g}),y&&{onZoom:y}),null!=m&&{dragRotate:m}),P&&{showParticles:P}),z&&{particleStyle:z}),b&&{tileURL:b}),v&&{tileAttribution:v}),x&&{tileCacheSize:x}),{size:[r.width,r.height],margin:fe,enableHover:!0,tooltipContent:!1===$?()=>null:zt($)||pe}),(D||N||T)&&{customHoverBehavior:ie}),(N||T)&&{customClickBehavior:se}),L&&L.length>0&&{annotations:L}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),B&&{className:B}),null!=n.animate&&{animate:n.animate}),q);return ge||ye||e.jsx(zn,{componentName:"FlowMap",width:r.width,height:r.height,children:e.jsx(St,Object.assign({},me))})}Un.displayName="ProportionalSymbolMap",Zn.displayName="FlowMap";const Yn=t.forwardRef(function(n,o){const r=on(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:i,lines:s,xAccessor:a="lon",yAccessor:l="lat",nodeIdAccessor:c="id",center:u,costAccessor:d,strength:h=1,lineMode:p="straight",projection:f="mercator",graticule:g,fitPadding:y,zoomable:m,zoomExtent:b,onZoom:v,dragRotate:x,tileURL:j,tileAttribution:k,tileCacheSize:w,transition:A,colorBy:O,colorScheme:S,pointRadius:M=5,tooltip:C,showRings:R=!0,ringStyle:P,showNorth:z=!0,costLabel:$,annotations:L,margin:E,className:B,selection:I,linkedHover:D,onObservation:N,onClick:T,chartId:W,loading:_,emptyContent:F,legendPosition:q,frameProps:H={},stroke:G,strokeWidth:V,opacity:U}=n,Z=null!=m?m:!!j,Y=i||[],{activeSelectionHook:X,customHoverBehavior:Q,customClickBehavior:K}=en({selection:I,linkedHover:D,fallbackFields:O?["string"==typeof O?O:""]:[],onObservation:N,onClick:T,chartType:"DistanceCartogram",chartId:W}),J=Dn(I),ee=Jt(Y,O,S),te=t.useMemo(()=>{const e=sn(e=>({fill:O?It(e,O,ee):Kt,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:M}),{stroke:G,strokeWidth:V,opacity:U});return X?Xt(e,X,J):e},[O,ee,M,X,J,G,V,U]),{legend:ne,margin:oe,legendPosition:re}=tn({data:Y,colorBy:O,colorScale:ee,showLegend:r.showLegend,legendPosition:q,userMargin:E,defaults:{top:10,bottom:10,left:10,right:10}}),ie=t.useMemo(()=>({center:u,centerAccessor:c,costAccessor:d,strength:h,lineMode:p}),[u,c,d,h,p]),se=t.useMemo(()=>{if(!s)return;const e="function"==typeof a?a:e=>e[a],t="function"==typeof l?l:e=>e[l],n=new Map;for(const e of Y)n.set(e[c]+"",e);return s.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),[l]:t(r)},{[a]:e(i),[l]:t(i)}]}):null}).filter(Boolean)},[s,Y,a,l,c]),ae=t.useMemo(()=>t=>{const n=("function"==typeof d?d:e=>e[d])(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:t[c]||t.name||t.id||"Point"}),null!=n&&e.jsxs("div",{style:{opacity:.7},children:["Cost: ","number"==typeof n?n.toFixed(1):n]})]})},[d,c]),le=t.useRef(null);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=le.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=le.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=le.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,r;const i=null!==(o=null===(n=le.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of i)null===(r=le.current)||void 0===r||r.push(t(e));return i},clear:()=>{var e;return null===(e=le.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=le.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[ce,ue]=t.useState(null),de=t.useCallback(()=>{var e,t;const n=null===(t=null===(e=le.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ue(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);t.useEffect(()=>{const e=requestAnimationFrame(de);return()=>cancelAnimationFrame(e)},[de,h,u,r.width,r.height,Y]);const he=t.useMemo(()=>{if(!R||!ce)return[];const{maxCost:e}=ce;if(0>=e)return[];if(Array.isArray(R))return R.filter(t=>t>0&&e>=t);const t="number"==typeof R?R:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[R,ce]),pe=t.useMemo(()=>{var t,n;if(!ce)return H.foregroundGraphics||null;const{cx:o,cy:r,maxCost:i,availableRadius:s}=ce,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},P),l=null!==(t=oe.left)&&void 0!==t?t:10,c=null!==(n=oe.top)&&void 0!==n?n:10;return e.jsxs("g",{children:[he.map(t=>{const n=t/i*s;return e.jsxs("g",{children:[e.jsx("circle",{cx:o+l,cy:r+c,r:n,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),e.jsxs("text",{x:o+l+n+3,y:r+c-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif",children:[t,$?" "+$:""]})]},t)}),z&&e.jsxs("g",{transform:`translate(${l+24}, ${c+24})`,children:[e.jsx("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e.jsx("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e.jsx("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e.jsx("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),H.foregroundGraphics]})},[ce,he,z,$,P,oe,H.foregroundGraphics]),fe=Bn(_,r.width,r.height),ge=fe?null:En(i,r.width,r.height,F);In("DistanceCartogram",Y,"xAccessor",a),In("DistanceCartogram",Y,"yAccessor",l);const ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:f},null!=i&&{points:Y}),se&&{lines:se,lineDataAccessor:"coordinates"}),{xAccessor:a,yAccessor:l,pointIdAccessor:c,pointStyle:te,projectionTransform:ie}),A&&{transition:{duration:A}}),null!=g&&{graticule:g}),null!=y&&{fitPadding:y}),Z&&{zoomable:!0}),b&&{zoomExtent:b}),v&&{onZoom:v}),null!=x&&{dragRotate:x}),j&&{tileURL:j}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[r.width,r.height],margin:oe,enableHover:!0,tooltipContent:!1===C?()=>null:zt(C)||ae}),ne&&{legend:ne,legendPosition:re}),(D||N||T)&&{customHoverBehavior:Q}),(N||T)&&{customClickBehavior:K}),L&&L.length>0&&{annotations:L}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),B&&{className:B}),null!=n.animate&&{animate:n.animate}),H),pe&&{foregroundGraphics:pe});return fe||ge||e.jsx(zn,{componentName:"DistanceCartogram",width:r.width,height:r.height,children:e.jsx(St,Object.assign({ref:le},ye))})});Yn.displayName="DistanceCartogram",exports.ChoroplethMap=Vn,exports.DistanceCartogram=Yn,exports.FlowMap=Zn,exports.ProportionalSymbolMap=Un,exports.StreamGeoFrame=St,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=qn;
|