semiotic 3.4.2 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +114 -9
- package/README.md +45 -4
- package/ai/behaviorContracts.cjs +311 -0
- package/ai/chartSuggestions.cjs +291 -0
- package/ai/cli.js +255 -30
- package/ai/componentMetadata.cjs +107 -0
- package/ai/dist/mcp-server.js +907 -227
- package/ai/schema.json +3954 -2537
- package/ai/system-prompt.md +23 -4
- package/dist/components/LinkedCharts.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +64 -0
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +71 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +59 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +93 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +51 -4
- package/dist/components/charts/geo/FlowMap.d.ts +55 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +53 -0
- package/dist/components/charts/index.d.ts +6 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +34 -2
- package/dist/components/charts/network/CirclePack.d.ts +36 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +130 -2
- package/dist/components/charts/network/OrbitDiagram.d.ts +37 -0
- package/dist/components/charts/network/SankeyDiagram.d.ts +51 -2
- package/dist/components/charts/network/TreeDiagram.d.ts +37 -2
- package/dist/components/charts/network/Treemap.d.ts +36 -2
- package/dist/components/charts/ordinal/BarChart.d.ts +113 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +33 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +36 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +33 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +40 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +45 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +40 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +97 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +44 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +90 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +29 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +40 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +38 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +62 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +34 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +22 -4
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -2
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +24 -3
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +12 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +14 -0
- package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +67 -0
- package/dist/components/charts/realtime/resolveWindowSize.d.ts +26 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +91 -0
- package/dist/components/charts/shared/colorPalettes.d.ts +62 -0
- package/dist/components/charts/shared/colorUtils.d.ts +9 -10
- package/dist/components/charts/shared/numberFormat.d.ts +58 -0
- package/dist/components/charts/shared/sparseArray.d.ts +27 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +113 -0
- package/dist/components/charts/shared/timeFormat.d.ts +60 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +84 -0
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +28 -0
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +6 -19
- package/dist/components/charts/shared/useStreamingLegend.d.ts +27 -11
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/validationMap.d.ts +2 -1
- package/dist/components/charts/shared/withChartWrapper.d.ts +13 -4
- package/dist/components/charts/xy/AreaChart.d.ts +44 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +4 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +37 -6
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +28 -0
- package/dist/components/charts/xy/Heatmap.d.ts +4 -0
- package/dist/components/charts/xy/LineChart.d.ts +12 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +58 -0
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +27 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +21 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +38 -2
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +16 -0
- package/dist/components/charts/xy/StackedAreaChart.d.ts +61 -1
- package/dist/components/realtime/types.d.ts +2 -4
- package/dist/components/recipes/bullet.d.ts +86 -0
- package/dist/components/recipes/calendar.d.ts +43 -0
- package/dist/components/recipes/dagre.d.ts +56 -0
- package/dist/components/recipes/flextree.d.ts +55 -0
- package/dist/components/recipes/marimekko.d.ts +55 -0
- package/dist/components/recipes/parallelCoordinates.d.ts +97 -0
- package/dist/components/recipes/recipeUtils.d.ts +27 -0
- package/dist/components/recipes/waffle.d.ts +46 -0
- package/dist/components/semiotic-ai.d.ts +4 -0
- package/dist/components/semiotic-network.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +3 -0
- package/dist/components/semiotic-recipes.d.ts +24 -0
- package/dist/components/semiotic-xy.d.ts +3 -0
- package/dist/components/semiotic.d.ts +2 -2
- package/dist/components/server/renderToStaticSVG.d.ts +8 -2
- package/dist/components/server/serverChartConfigs.d.ts +47 -1
- package/dist/components/server/staticAnnotations.d.ts +6 -0
- package/dist/components/store/ObservationStore.d.ts +1 -3
- package/dist/components/store/SelectionStore.d.ts +1 -3
- package/dist/components/store/ThemeStore.d.ts +4 -4
- package/dist/components/store/TooltipStore.d.ts +1 -3
- package/dist/components/store/createStore.d.ts +4 -2
- package/dist/components/stream/CanvasHitTester.d.ts +10 -8
- package/dist/components/stream/DataSourceAdapter.d.ts +9 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +9 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +14 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +25 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +12 -0
- package/dist/components/stream/PipelineStore.d.ts +51 -0
- package/dist/components/stream/SVGOverlay.d.ts +12 -0
- package/dist/components/stream/SceneGraph.d.ts +15 -1
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/categoryDomain.d.ts +4 -0
- package/dist/components/stream/composeOverlays.d.ts +15 -0
- package/dist/components/stream/customLayout.d.ts +76 -0
- package/dist/components/stream/customLayoutPalette.d.ts +29 -0
- package/dist/components/stream/geoTypes.d.ts +13 -0
- package/dist/components/stream/hoverUtils.d.ts +4 -10
- package/dist/components/stream/networkCustomLayout.d.ts +67 -0
- package/dist/components/stream/networkTypes.d.ts +45 -0
- package/dist/components/stream/ordinalCustomLayout.d.ts +84 -0
- package/dist/components/stream/ordinalTypes.d.ts +35 -1
- package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +9 -1
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +92 -0
- package/dist/components/stream/sampleCurvePath.d.ts +9 -0
- package/dist/components/stream/types.d.ts +44 -1
- package/dist/components/stream/useHydration.d.ts +89 -0
- package/dist/components/stream/useStableShallow.d.ts +1 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +4 -0
- package/dist/geo.min.js +2 -1
- package/dist/geo.module.min.js +2 -1
- package/dist/network.min.js +2 -1
- package/dist/network.module.min.js +2 -1
- package/dist/ordinal.min.js +2 -1
- package/dist/ordinal.module.min.js +2 -1
- package/dist/realtime.min.js +2 -1
- package/dist/realtime.module.min.js +2 -1
- package/dist/semiotic-ai.d.ts +69 -65
- package/dist/semiotic-ai.min.js +2 -1
- package/dist/semiotic-ai.module.min.js +2 -1
- package/dist/semiotic-data.d.ts +4 -4
- package/dist/semiotic-geo.d.ts +15 -15
- package/dist/semiotic-network.d.ts +19 -16
- package/dist/semiotic-ordinal.d.ts +31 -28
- package/dist/semiotic-realtime.d.ts +17 -17
- package/dist/semiotic-recipes.d.ts +24 -0
- package/dist/semiotic-recipes.min.js +1 -0
- package/dist/semiotic-recipes.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +6 -6
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +1 -0
- package/dist/semiotic-themes.d.ts +3 -3
- package/dist/semiotic-themes.min.js +2 -1
- package/dist/semiotic-themes.module.min.js +2 -1
- package/dist/semiotic-utils.d.ts +23 -23
- package/dist/semiotic-utils.min.js +2 -1
- package/dist/semiotic-utils.module.min.js +2 -1
- package/dist/semiotic-xy.d.ts +27 -24
- package/dist/semiotic.d.ts +63 -63
- package/dist/semiotic.min.js +2 -1
- package/dist/semiotic.module.min.js +2 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/canvasMock.d.ts +34 -5
- package/dist/xy.min.js +2 -1
- package/dist/xy.module.min.js +2 -1
- package/package.json +38 -17
- package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +0 -1
package/dist/geo.module.min.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{createContext as r,useMemo as i,useContext as s,useRef as a,useCallback as l,useSyncExternalStore as c,useState as u,useEffect as d,forwardRef as h,useImperativeHandle as p,useId as f}from"react";import{geoPath as g,geoGraticule as y,geoDistance as m,geoInterpolate as b,geoEqualEarth as v,geoEquirectangular as x,geoNaturalEarth1 as A,geoOrthographic as w,geoAlbersUsa as k,geoMercator as j}from"d3-geo";import{scaleLinear as O,scaleOrdinal as S,scaleSequential as M}from"d3-scale";import{quadtree as C}from"d3-quadtree";import{bin as $,extent as z}from"d3-array";import{packEnclose as P}from"d3-hierarchy";import{area as L,curveCatmullRom as B,curveCardinal as I,curveBasis as R,curveStepBefore as D,curveStepAfter as N,curveStep as E,curveMonotoneY as T,curveMonotoneX as W,curveLinear as _,line as F,curveNatural as H}from"d3-shape";import q from"regression";import{zoomIdentity as G,zoom as V}from"d3-zoom";import{select as U}from"d3-selection";import{schemeCategory10 as Z,interpolatePlasma as Y,interpolateViridis as X,interpolatePurples as Q,interpolateOranges as K,interpolateGreens as J,interpolateReds as ee,interpolateBlues as te,schemeSet3 as ne,schemeTableau10 as oe,interpolateTurbo as re,interpolateCividis as ie,interpolateMagma as se,interpolateInferno as ae,interpolateGreys as le}from"d3-scale-chromatic";class ce{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function ue(e,t,n){return e+(t-e)*n}function de(e,t,n){var o,r,i;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>a?1:s;default:return 1}}const he={mercator:j,equalEarth:v,albersUsa:k,orthographic:w,naturalEarth:A,equirectangular:x};function pe(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function fe(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function ge(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function ye(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let r=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>r.length||o.push(r),r=[i]):r.push(i)}return 2>r.length||o.push(r),o}function me(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const s=-r/i,a=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+s*l,u=(e[1]+t[1])/2+a*l,d=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;d.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return d}function be(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,s;0===t?(i=e[1][0]-r[0],s=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],s=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const a=Math.sqrt(i*i+s*s)||1;o.push([r[0]+s/a*n,r[1]+-i/a*n])}return o}function ve(e,t,n,o,r){const i=t[0]-e[0],s=t[1]-e[1],a=Math.sqrt(i*i+s*s);if(0===a)return[e,t];const l=s/a,c=-i/a,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}class xe{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e}initStreaming(e=500){this.pointBuffer=new ce(e),this.timestampBuffer=new ce(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return v();if("string"==typeof e){const t=he[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),v())}if("object"==typeof e&&"type"in e){const t=he[e.type],n=t?t():v();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=g(this.projection),this.fitProjection(e),this.geoPath=g(this.projection);const n=this.projection;this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null};const o=this.scene;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&o.length>0&&this.startTransition(o),this.version++}fitProjection(e){var t,n,o,r,i;const s=this.projection,a=this.config,l=[...this.areas],c=pe(a.xAccessor,"lon"),u=pe(a.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=fe(a.lineDataAccessor);for(const e of this.lineData){const t=h(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==l.length){if(a.projectionExtent){const[[t,n],[o,r]]=a.projectionExtent;s.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,r],[t,r],[t,n]]]}})}else if(s.clipAngle&&(null!==(t=s.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=a.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);s.scale(o/2-o*t),s.translate([e.width/2,e.height/2])}else{const t=null!==(o=a.fitPadding)&&void 0!==o?o:0,n=e.width*t,r=e.height*t;s.fitExtent([[n,r],[e.width-n,e.height-r]],{type:"FeatureCollection",features:l})}this.baseScale=s.scale(),this.baseTranslate=s.translate(),this.baseRotation=null!==(i=null===(r=s.rotate)||void 0===r?void 0:r.call(s))&&void 0!==i?i:[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=g(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=g(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;n&&n.rotate&&(n.rotate(e),this.geoPath=g(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,xe.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._quadtree=C().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,n,o;const r=[],{config:i}=this,s=this.projection,a=this.geoPath,l=pe(i.xAccessor,"lon"),c=pe(i.yAccessor,"lat"),u=function(e){var t,n;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.surface)||"#e0e0e0",stroke:(null===(n=e.themeSemantic)||void 0===n?void 0:n.border)||"#999",strokeWidth:.5,fillOpacity:1}}(i),d=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(i),h=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(i);if(i.graticule){const t=!0===i.graticule?{}:i.graticule,n=y();t.step&&n.step(t.step);const o=a(n())||"";o&&r.push({type:"geoarea",pathData:o,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=a(e);if(!t)continue;const n=a.centroid(e),o=a.bounds(e),s=a.area(e),l=ge(i.areaStyle,e,u);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:s,style:l,datum:e,interactive:!0})}const p=fe(i.lineDataAccessor);for(const t of this.lineData){const n=p(t);if(!n||2>n.length)continue;let o=[];if("geo"===i.lineType){const e=Array(n.length);for(let t=0;n.length>t;t++)e[t]=[l(n[t]),c(n[t])];for(let t=0;e.length-1>t;t++){const n=e[t],r=e[t+1],i=m(n,r)||0,a=Math.max(2,Math.ceil(i/(Math.PI/180))),l=b(n,r);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const n=s(l(e/a));null!=n&&o.push(n)}}}else for(let e=0;n.length>e;e++){const t=n[e],r=s([l(t),c(t)]);null!=r&&o.push(r)}if(2>o.length)continue;const a=ge(i.lineStyle,t,d),u="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==n.length||2>o.length||"arc"!==i.flowStyle?2!==n.length||2>o.length||"offset"!==i.flowStyle||(o="geo"===i.lineType?be(o,u):ve(o[0],o[o.length-1],0,0,u)):o=me(o[0],o[o.length-1]);const h=ye(o,e.width);if(h.length>1)for(const e of h){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},a),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>o.length&&h[0]||o,style:a,datum:t})}const f=this.getPoints(),g=i.pointIdAccessor?"function"==typeof i.pointIdAccessor?i.pointIdAccessor:e=>e[i.pointIdAccessor]:null,v=s.clipAngle&&null!==(t=s.clipAngle())&&void 0!==t?t:0,x=v>0?v*Math.PI/180:null,A=s.rotate?s.rotate():[0,0,0],w="function"==typeof s.center?s.center():[0,0],k=[(null!==(n=w[0])&&void 0!==n?n:0)-A[0],(null!==(o=w[1])&&void 0!==o?o:0)-A[1]];for(let e=0;f.length>e;e++){const t=f[e],n=l(t),o=c(t);if(null!=x&&m([n,o],k)>x)continue;const a=s([n,o]);if(!a)continue;const u=i.pointStyle?i.pointStyle(t):Object.assign({},h),d={type:"point",x:a[0],y:a[1],r:u.r||4,style:u,datum:t,pointId:g?g(t)+"":void 0};r.push(d)}return r}applyCartogramTransform(e,t){var n,o,r;const i=this.scene.filter(e=>"point"===e.type);if(2>i.length)return;const s=null!==(n=e.strength)&&void 0!==n?n:1;if(0===s)return;const a=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,l="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=i.find(t=>t.datum&&a(t.datum)+""==e.center+"");if(!c)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const u=c.x,d=c.y,h=i.map(e=>e.datum?l(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),p=Math.max(...h,1),f=Math.min(t.width,t.height)/2,g=O().domain([0,p]).range([0,f]);this.cartogramLayout={cx:u,cy:d,maxCost:p,availableRadius:f},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of i){if(e===c)continue;if(!e.datum)continue;const t=Math.atan2(e.y-d,e.x-u),n=Math.sqrt(Math.pow(e.x-u,2)+Math.pow(e.y-d,2)),o=l(e.datum),r=n+((isFinite(o)?g(o):n)-n)*s;e.x=u+Math.cos(t)*r,e.y=d+Math.sin(t)*r}const y=t.width/2,m=t.height/2,b=y-c.x,v=m-c.y;if(Math.abs(b)>.5||Math.abs(v)>.5)for(const e of i)e.x+=b,e.y+=v;this.cartogramLayout={cx:y,cy:m,maxCost:p,availableRadius:f};const x=this.scene.filter(e=>"line"===e.type);if(x.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of i)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of x){const n=null===(o=t.datum)||void 0===o?void 0:o.source,i=null===(r=t.datum)||void 0===r?void 0:r.target;if(n&&i){const o=e.get(n+""),r=e.get(i+"");o&&r&&(t.path=[o,r])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const r=de(e,o,t);n[o]._decayOpacity=r,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:r})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),s=this.timestampBuffer.toArray();for(let e=0;i.length>e&&s.length>e;e++){const a=r-s[e];o>a&&(i[e]._pulseIntensity=1-a/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let s=!1;for(const e of i)if(e.pointId){const t=r.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(s=!0))}s&&(this.activeTransition={startTime:performance.now(),duration:o})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=ue(e.x,e._targetX,n),e.y=ue(t,e._targetY,n)}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0);return this.activeTransition=null,!1}return!0}}function Ae(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function we(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function ke(e,t){const n=we(e);if(!n)return!1;const o=we(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function je(e,t,n,o,r,i,s=0){if(i){const e=function(e,t,n,o,r){const i=Math.max(o,r+5,12),s=t-i,a=t+i,l=n-i,c=n+i;let u=null,d=1/0;return e.visit((e,r,i,h,p)=>{if(r>a||s>h||i>c||l>p)return!0;if(!e.length){let r=e;do{const e=r.data,i=e.x-t,s=e.y-n,a=Math.sqrt(i*i+s*s);Ae(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);Ae(s.r,o)>=l&&i>l&&(r=s,i=l)}if(r)return{node:r,distance:i}}for(let o=e.length-1;o>=0;o--){const i=e[o];if("geoarea"!==i.type)continue;const s=i;if(!1===s.interactive)continue;const[[a,l],[c,u]]=s.bounds;if(!(a>t||t>c||l>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),r.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let a=null,l=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:r}=e,i=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;r.length-1>o;o++){const[s,c]=r[o],[u,d]=r[o+1],h=Oe(t,n,s,c,u,d);i>=h&&l>h&&(a=e,l=h)}}return a?{node:a,distance:l}:null}function Oe(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function Se(t){const n=r(null),o=Me(t);return[function({children:o}){const r=i(()=>Me(t),[]);return e(n.Provider,{value:r,children:o})},e=>{var t;const r=null!==(t=s(n))&&void 0!==t?t:o,i=a(e);i.current=e;const u=l(()=>i.current(r.getState()),[r]),d=l(()=>i.current(r.getState()),[r]);return c(r.subscribe,u,d)}]}function Me(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function Ce(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function $e(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:ze})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}xe.QUADTREE_THRESHOLD=500;const ze=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Pe={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Le={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Be={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ze,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[Ie,Re]=Se(e=>({theme:Pe,setTheme(t){e(e=>{if("light"===t)return{theme:Pe};if("dark"===t)return{theme:Le};if("high-contrast"===t)return{theme:Be};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Le:Pe;return{theme:$e(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:$e(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const De=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ne=new WeakMap;let Ee=0,Te=!1,We=null,_e=null,Fe=null;function He(e,t){var n,o;if(!t)return t;const r=De.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(Te)return;if("undefined"==typeof window||"undefined"==typeof document)return;Te=!0;const e=()=>{Ee++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(We=new MutationObserver(e),We.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{_e=window.matchMedia("(prefers-color-scheme: dark)"),Fe=e,"function"==typeof _e.addEventListener?_e.addEventListener("change",Fe):"function"==typeof _e.addListener&&_e.addListener(Fe)}catch(e){}}();let s=Ne.get(i);s&&s.version===Ee||(s={version:Ee,map:new Map},Ne.set(i,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function qe(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ge(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return d(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=a(t);n.current=t;const[r,s]=function(e,t,n){const o=a(null),[r,i]=u(null);return d(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),c=i(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=s[0]-c.left-c.right,p=s[1]-c.top-c.bottom,f=qe(e.foregroundGraphics,s,c),g=qe(e.backgroundGraphics,s,c),y=Re(e=>e.theme),{transition:m,introEnabled:b}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(r||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),v="semiotic-table-"+o.useId(),x=a(0),A=a(()=>{}),w=l(()=>{x.current||(x.current=requestAnimationFrame(()=>A.current()))},[]);d(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const k=a(()=>{}),j=a(()=>{}),O=a(null),S=a(0),M=l(()=>{S.current=0;const e=O.current;O.current=null,e&&k.current(e)},[]),C=l(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===S.current&&(S.current=requestAnimationFrame(M))},[M]),$=l(()=>{O.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0),j.current()},[]);d(()=>()=>{O.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0)},[]);const z=e.themeDirtyRef;return d(()=>{z&&(Ee++,z.current=!0,w())},[y,w,z]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:s,margin:c,adjustedWidth:h,adjustedHeight:p,resolvedForeground:f,resolvedBackground:g,currentTheme:y,transition:m,introEnabled:b,tableId:v,rafRef:x,renderFnRef:A,scheduleRender:w,hoverHandlerRef:k,hoverLeaveRef:j,onPointerMove:C,onPointerLeave:$}}const Ve={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function Ue(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,Ve[n])(o(e,t)),r}function Ze(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ye(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Xe=(n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:p,items:f}=n,g=[];let y=0;const m=!(!o&&!r),b="isolate"===d||void 0===d&&null!=s;return f.forEach((n,d)=>{const v=Ue(n,d,h,p),x=Ye(n,i,s),A=s&&s.size>0&&s.has(n.label);g.push(t("g",{transform:`translate(0,${y})`,onClick:o?()=>o(n):void 0,onMouseEnter:r?()=>r(n):void 0,onMouseLeave:r?()=>r(null):void 0,tabIndex:m?c===a&&d===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&b?A||!1:void 0,"aria-current":m&&!b&&null!=i&&n.label===i||void 0,"aria-label":n.label,onKeyDown:m?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+f.length)%f.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{u(c,d),r&&r(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{r&&r(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,A&&e(Ze,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),y+=22}),g};function Qe({config:n,orientation:r="vertical",width:i=100}){const{colorFn:s,domain:a,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===r){const n=12,o=Math.min(i,200),r=Math.max(0,(i-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:r+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:r,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:r,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),e("text",{x:r+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(a[1]-a[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])})]})}function Ke(n){const{legendGroups:r,customClickBehavior:i,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:p="vertical"}=n,[f,g]=o.useState(0),[y,m]=o.useState(0),b=o.useCallback((e,t)=>{g(e),m(t)},[]),v="vertical"===p?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,p)=>{d+=5,h.push(e("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+p)),d+=8,t.label&&(d+=16,h.push(e("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+p)),d+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${d})`,children:Xe(t,o,r,i,s,a,l,p,c,u)},"legend-group-"+p)),d+=22*t.items.length+8}),h})({legendGroups:r||[],width:d,customClickBehavior:i,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:c}):(({legendGroups:n,height:o,width:r,customClickBehavior:i,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let p=0;const f=[];n.forEach((n,o)=>{let g=0;n.label&&(g+=16);const y=((n,o,r,i,s,a,l,c,u,d,h)=>{const{type:p="fill",styleFn:f,items:g}=n,y=[];let m=0,b=0;const v=!(!o&&!r),x="isolate"===d||void 0===d&&null!=s;g.forEach((n,d)=>{const A=Ue(n,d,p,f),w=Ye(n,i,s),k=s&&s.size>0&&s.has(n.label),j=26+7*n.label.length;h&&h>0&&m>0&&m+j>h&&(b++,m=0),y.push(t("g",{transform:`translate(${m},${22*b})`,onClick:o?()=>o(n):void 0,onMouseEnter:r?()=>r(n):void 0,onMouseLeave:r?()=>r(null):void 0,tabIndex:v?c===a&&d===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&x?k||!1:void 0,"aria-current":v&&!x&&null!=i&&n.label===i||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+g.length)%g.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),r&&r(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{r&&r(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),A,k&&e(Ze,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=j});let A=0,w=0;for(const e of g){const t=26+7*e.label.length;h&&h>0&&w>0&&w+t>h?(A=Math.max(A,w),w=t):w+=t}A=Math.max(A,w);const k=b+1;return{items:y,offset:A,totalRows:k,totalHeight:22*k}})(n,i,s,a,l,c,u,o,d,h,r);g+=y.offset+5,f.push(Object.assign(Object.assign({label:n.label},y),{offset:g,totalRows:y.totalRows,totalHeight:y.totalHeight})),p+=g+12});let g=p>r?0:Math.max(0,(r-p)/2);const y=[];return f.forEach((t,r)=>{const i=n[r];i.label&&(y.push(e("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:i.label},"legend-text-"+r)),g+=16),y.push(e("g",{className:"legend-item",transform:`translate(${g},0)`,children:t.items},"legend-group-"+r)),g+=t.offset+5,n[r+1]&&y.push(e("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+r)),g+=12}),e("g",{children:y})})({legendGroups:r||[],title:u,height:h,width:d,customClickBehavior:i,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:c}),x=!(!i&&!s);return t("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===p&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),v]})}function Je(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function et(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const p="top"===s||"bottom"===s;let f,g;return"left"===s?(f=4,g=i.top):"top"===s?(f=0,g=a?32:8):"bottom"===s?(f=0,g=r-i.bottom+50):(f=o-i.right+10,g=i.top),e("g",{transform:`translate(${f}, ${g})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e(Qe,{config:n.gradient,orientation:p?"horizontal":"vertical",width:p?o:100}):Je(n)?e(Ke,{legendGroups:n.legendGroups,title:"",width:p?o:100,orientation:p?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function tt(e){return"string"==typeof e?{type:e}:e}function nt({orient:n,config:o,values:r,scale:s,size:a,length:l}){const c=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),u="top"===n||"bottom"===n,d=i(()=>{if(0===r.length)return null;const o=s.domain(),i=a-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(r);if(!o)return null;const{q1:a,median:l,q3:d,whiskerLow:h,whiskerHigh:p}=o,f=Math.min(.5*i,20),g=(i-f)/2+4;if(u){const o=s(a),r=s(d),i=s(l),u=s(h),y=s(p),m="top"===n?-1:1,b=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:b+m*(g+f/2),x2:y,y2:b+m*(g+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:b+m*g,x2:u,y2:b+m*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:b+m*g,x2:y,y2:b+m*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,r),y:"top"===n?b-g-f:b+g,width:Math.abs(r-o),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:i,y1:"top"===n?b-g-f:b+g,x2:i,y2:"top"===n?b-g:b+g+f,stroke:c.fill,strokeWidth:2})]})}{const o=s(a),r=s(d),i=s(l),u=s(h),y=s(p),m="left"===n?-1:1,b=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:b+m*(g+f/2),y1:u,x2:b+m*(g+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:b+m*g,y1:u,x2:b+m*(g+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:b+m*g,y1:y,x2:b+m*(g+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?b-g-f:b+g,y:Math.min(o,r),width:f,height:Math.abs(r-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?b-g-f:b+g,y1:i,x2:"left"===n?b-g:b+g+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=$().domain(o).thresholds(c.bins)(r);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/h*i;if(u){const i=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:i,y:"top"===n?-4-r:4,width:Math.max(a,.5),height:r,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const i=s(t.x0),a=s(t.x1)-s(t.x0);return e("rect",{x:"left"===n?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=i/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*(i/2),a=s((e.x0+e.x1)/2);o.push(u?`${a},${"top"===n?-(t-r):t-r}`:`${"left"===n?-(t-r):t-r},${a}`)}for(let e=d.length-1;e>=0;e--){const r=d[e];if(null==r.x0||null==r.x1)continue;const a=r.length/h*(i/2),l=s((r.x0+r.x1)/2);o.push(u?`${l},${"top"===n?-(t+a):t+a}`:`${"left"===n?-(t+a):t+a},${l}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*i,r=s((e.x0+e.x1)/2);t.push(`L${r},${"top"===n?-o-4:o+4}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${r},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*i,r=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${r}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):l;t.push(`L${e},${r}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[r,s,c,a,l,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function ot(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function rt(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function it(n,o,r,i){if(!n)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!a)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(r)?"leftRight":"topBottom");let p=c;p&&"dynamic"!==p||(p="topBottom"===h?0>o?"right":"left":0>r?"bottom":"top");let f="start";"topBottom"===h?"right"===p?f="end":"middle"===p&&(f="middle"):f=0>o?"end":"start";const g=16,y=a?d?[a]:ot(a,u):[],m=s?d?[s]:ot(s,u):[],b="leftRight"===h?"end"===f?-4:4:0;let v=0;const x=[],A=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:A,textAnchor:f,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:b,dy:0===n?0:g,children:t},n))},"annotation-note-title")),v=y.length*g),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:A,textAnchor:f,y:v,children:m.map((t,n)=>e("tspan",{x:b,dy:0===n?0:g,children:t},n))},"annotation-note-label"));let w=null;if((a||s)&&(0!==o||0!==r))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*g+(m.length>0?g:0);let n=0,o=t;"bottom"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+m.length-1)*g;let j=0;return"topBottom"===h?j=0>r?-(k+2):18:"leftRight"===h&&(j="middle"===p?-(k+g+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===p||0>r?-(k+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${r})`,children:[e("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:x}),w]})}function st(t,n,o,r,i){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e("rect",{width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e("line",{x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e("line",{x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e("path",{d:rt((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:a})}function at(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+s*h,c=i+a*h}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e("line",{x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e("path",{d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e("g",{className:"annotation-connector",children:a})}function lt(e){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:p,disable:f,events:g={},"data-testid":y}=e,m=new Set(Array.isArray(f)?f:[]);let b=r||0,v=i||0;null!=s&&(b=s-n),null!=a&&(v=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===b&&0===v)if(void 0!==u.width){b=u.width/2;const e=u.depth||30;v=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;b=e+(0>e?-5:5),v=u.height/2}return t("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},g,{children:[!m.has("connector")&&at(b,v,c,h,x,u),!m.has("subject")&&st(x,u,h,n,o),!m.has("note")&&it(l,b,v,h)]}))}function ct(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,s="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e(lt,Object.assign({"data-testid":"semiotic-annotation"},i,{type:s}),"multi-annotation-"+o)});return e("g",{children:l})}const l=r.note||{title:"none",label:r.label},c=`${l.label}-${l.title}-${r.i}`;return e(lt,Object.assign({"data-testid":"semiotic-annotation",events:a},r,{type:s}),c)}function ut(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function dt(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function ht(e,t,n){var o,r,i,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=ut(e,n),c=dt(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function pt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const ft={linear:_,monotoneX:W,monotoneY:T,step:E,stepAfter:N,stepBefore:D,basis:R,cardinal:I,catmullRom:B};let gt={positions:new Map};const yt=new Set;function mt(){for(const e of yt)e()}function bt(e,t){const n=gt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(gt.positions);o.delete(e),gt={positions:o},mt()}function vt(e,t){const n=gt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(gt.positions);o.delete(e),gt={positions:o},mt()}function xt(){return gt}function At(e){return yt.add(e),()=>yt.delete(e)}const wt={positions:new Map};function kt(){return()=>{}}function jt(){return wt}function Ot(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function St(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function Mt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Ct(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function $t(o){var r,s;const{width:l,height:u,totalWidth:h,totalHeight:p,margin:f,scales:g,showAxes:y,axes:m,xLabel:b,yLabel:v,yLabelRight:x,xFormat:A,yFormat:w,showGrid:k,title:j,legend:O,legendHoverBehavior:S,legendClickBehavior:M,legendHighlightedCategory:C,legendIsolatedCategories:$,legendPosition:z="right",foregroundGraphics:B,marginalGraphics:I,xValues:R,yValues:D,annotations:N,svgAnnotationRules:E,xAccessor:T,yAccessor:W,annotationData:F,pointNodes:H,curve:G,underlayRendered:V,linkedCrosshairName:U,linkedCrosshairSourceId:Z,children:Y}=o,X=i(()=>{var e;if(!y||!g)return[];const t=null==m?void 0:m.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||A||Mt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=g.x.ticks(Math.min(o,Math.max(2,Math.floor(l/70)))),i=r.map(e=>e.valueOf()),s=r.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,i)})),a=s.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(a+8,55)):Math.max(55,a+8);let u=Ct(s,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=g.x.domain()[1],t=g.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,i);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[y,g,m,A,l]),Q=i(()=>{var e;if(!y||!g)return[];const t=null==m?void 0:m.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||w||Mt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=Ct(g.y.ticks(Math.min(o,Math.max(2,Math.floor(u/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=g.y.domain()[1],t=g.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[y,g,m,w,u]),K=i(()=>{var e;if(!y||!g)return[];const t=null==m?void 0:m.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||w||Mt,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Ct(g.y.ticks(Math.min(o,Math.max(2,Math.floor(u/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22)},[y,g,m,w,u]),J=a(new Map),ee=a(null!==(r=null==N?void 0:N.length)&&void 0!==r?r:0),te=null!==(s=null==N?void 0:N.length)&&void 0!==s?s:0;ee.current!==te&&(ee.current=te,J.current=new Map);const ne=i(()=>{if(!N||0===N.length)return null;const n=function(n,o,r){var i,s,a,l,c,u,d,h,p,f,g,y,m,b,v,x,A,w,k,j,O,S,M,C,$,z,B,I,R,D,N,E,T,W,F,H,G,V,U,Z,Y,X,Q,K,J,ee,te,ne;switch(n.type){case"label":{const t=ht(n,o,r);if(!t)return null;const{x:i,y:s}=t;return pt(i,s,r)?e(ct,{noteData:{x:i,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const t=ht(n,o,r);if(!t)return null;const{x:i,y:s}=t;return pt(i,s,r)?e(ct,{noteData:{x:i,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const i=ut(n,r);if(null==i)return null;const s=n.color||"#f97316",a=n.labelPosition||"top";let l;return l="bottom"===a?(r.height||0)-4:"center"===a?(r.height||0)/2:12,t("g",{children:[e("line",{x1:i,y1:0,x2:i,y2:r.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:i+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const i=dt(n,r);if(null==i)return null;const s=n.color||"#f97316",a=n.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(r.width||0)/2,c="middle"):(l=(r.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:i,x2:r.width||0,y2:i,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:l,y:i-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const i=(n.coordinates||[]).map(e=>({x:ut(Object.assign(Object.assign({},e),{type:"point"}),r),y:dt(Object.assign(Object.assign({},e),{type:"point"}),r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const s=P(i),a=n.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const i=(n.coordinates||[]).map(e=>({x:ut(Object.assign(Object.assign({},e),{type:"point"}),r),y:dt(Object.assign(Object.assign({},e),{type:"point"}),r)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const s=n.padding||10,a=i.map(e=>e.x),l=i.map(e=>e.y),c=Math.min(...a)-s,u=Math.max(...a)+s,d=Math.min(...l)-s,h=Math.max(...l)+s;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const t=r.data||[],i="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:i.map((t,o)=>{const i=ut(t,r),a=dt(t,r);if(null==i||null==a)return null;const l="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||s;return e("circle",Object.assign({cx:i,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const t=ut(n,r),i=dt(n,r);return e(ct,{noteData:{x:null!=t?t:0,y:null!=i?i:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=r.data||[];if(2>h.length)return null;const p=r.xAccessor||"x",f=r.yAccessor||"y",g=h.map(e=>[e[p],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>g.length)return null;const y=null!==(s=null===(i=r.scales)||void 0===i?void 0:i.x)&&void 0!==s?s:null===(a=r.scales)||void 0===a?void 0:a.time,m=null!==(c=null===(l=r.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=r.scales)||void 0===u?void 0:u.value;if(!y||!m)return null;const b=n.method||"linear";let v;v="loess"===b?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,p=0,f=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],p+=t*r[e]*r[e],f+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const g=u*p-d*d;if(1e-12>Math.abs(g))a.push([t,h/u]);else{const e=(u*f-d*h)/g;a.push([t,(h-e*d)/u+e*t])}}return a}(g,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===b?q.polynomial(g,{order:n.order||2}):q.linear(g)).points;const x=v.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),A=n.color||"#6366f1";return t("g",{children:[e("polyline",{points:x,fill:"none",stroke:A,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:y(v[v.length-1][0])+4,y:m(v[v.length-1][1])-4,fill:A,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const i=null!==(p=null===(h=r.scales)||void 0===h?void 0:h.y)&&void 0!==p?p:null===(f=r.scales)||void 0===f?void 0:f.value,s=null!==(g=null==i?void 0:i(n.y0))&&void 0!==g?g:0,a=null!==(y=null==i?void 0:i(n.y1))&&void 0!==y?y:r.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(s,a),width:r.width||0,height:Math.abs(a-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const i=r.data||[];if(2>i.length)return null;const s=r.xAccessor||"x",a=null!==(b=null===(m=r.scales)||void 0===m?void 0:m.x)&&void 0!==b?b:null===(v=r.scales)||void 0===v?void 0:v.time,l=null!==(A=null===(x=r.scales)||void 0===x?void 0:x.y)&&void 0!==A?A:null===(w=r.scales)||void 0===w?void 0:w.value;if(!a||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const p=ft[r.curve||"linear"]||_,f=L().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(p)(h);if(!f)return null;const g=n.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:g,fillOpacity:null!==(k=n.fillOpacity)&&void 0!==k?k:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:g,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const i=r.data||[];if(2>i.length)return null;const s=r.yAccessor||"y",a=null!==(O=null===(j=r.scales)||void 0===j?void 0:j.x)&&void 0!==O?O:null===(S=r.scales)||void 0===S?void 0:S.time,l=null!==(C=null===(M=r.scales)||void 0===M?void 0:M.y)&&void 0!==C?C:null===($=r.scales)||void 0===$?void 0:$.value;if(!a||!l)return null;const c=i.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),p=null!==(z=n.threshold)&&void 0!==z?z:2,f=u-p*h,g=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(B=n.fillOpacity)&&void 0!==B?B:.1,b=n.anomalyColor||"#ef4444",v=null!==(I=n.anomalyRadius)&&void 0!==I?I:6,x=l(u+p*h),A=l(f),w=i.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>p*h});return t("g",{children:[g&&e("rect",{x:0,y:Math.min(x,A),width:r.width||0,height:Math.abs(A-x),fill:y,fillOpacity:m}),w.map((t,n)=>{const o=ut(t,r),i=dt(t,r);return null==o||null==i?null:e("circle",{cx:o,cy:i,r:v,fill:b,fillOpacity:.7,stroke:b,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(x,A)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const i=r.data||[];if(3>i.length)return null;const s=r.xAccessor||"x",a=r.yAccessor||"y",l=null!==(D=null===(R=r.scales)||void 0===R?void 0:R.x)&&void 0!==D?D:null===(N=r.scales)||void 0===N?void 0:N.time,c=null!==(T=null===(E=r.scales)||void 0===E?void 0:E.y)&&void 0!==T?T:null===(W=r.scales)||void 0===W?void 0:W.value;if(!l||!c)return null;const u=i.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=q.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,r=0;for(const[e,i]of u)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;d=e=>a+s*e}const h=u.length,p=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(p/Math.max(h-2,1)),g=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),m=null!==(F=n.confidence)&&void 0!==F?F:.95,b=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,v=null!==(H=n.steps)&&void 0!==H?H:5,x=u[h-1][0],A=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;v>=e;e++)w.push(x+e*A);const k=[];for(const e of w){const t=d(e),n=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-g,2)/y:0))*b;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${k.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,O=k.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),S=`${l(x)},${c(d(x))}`,M=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:j,fill:n.fill||"#6366f1",fillOpacity:null!==(G=n.fillOpacity)&&void 0!==G?G:.15,stroke:"none"}),e("polyline",{points:`${S} ${O}`,fill:"none",stroke:M,strokeWidth:null!==(V=n.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(U=n.strokeDasharray)&&void 0!==U?U:"6,3"}),n.label&&k.length>0&&e("text",{x:l(k[k.length-1].x)+4,y:c(k[k.length-1].yCenter)-4,fill:M,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let t=null,i=null;if(null!=n.px&&null!=n.py)t=n.px,i=n.py;else{const e=ht(n,o,r);if(!e)return null;t=e.x,i=e.y}if(null==t||null==i)return null;if(!pt(t,i,r))return null;const s=null!==(Z=n.dx)&&void 0!==Z?Z:0,a=null!==(Y=n.dy)&&void 0!==Y?Y:0,l=null!==(X=n.width)&&void 0!==X?X:32,c=null!==(Q=n.height)&&void 0!==Q?Q:32,u=null!==(K=n.content)&&void 0!==K?K:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=ht(n,o,r);if(!t)return null;const{x:i,y:s}=t;return e("text",{x:i+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const i=n.category;if(null==i)return null;const s=null===(J=r.scales)||void 0===J?void 0:J.o,a=null===(ee=r.scales)||void 0===ee?void 0:ee.x,l=null===(te=r.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const u=c(i);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",p=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,f=n.label;return t("g",(r.projection?"vertical"===r.projection:c===a)?{children:[e("rect",{x:u,y:0,width:d,height:r.height||0,fill:h,fillOpacity:p}),f&&e("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e("rect",{x:0,y:u,width:r.width||0,height:d,fill:h,fillOpacity:p}),f&&e("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+o)}default:return null}},o={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:T,yAccessor:W,width:l,height:u,data:F,frameType:"xy",pointNodes:H,curve:G,stickyPositionCache:J.current};return N.map((e,t)=>{if(E){const r=E(e,t,o);return null!=r?r:n(e,t,o)}return n(e,t,o)}).filter(Boolean)},[N,E,l,u,T,W,F,g,H,G]),oe=function(e){var t;const n=c(e?At:kt,e?xt:jt,e?xt:jt);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(U);return d(()=>{if(!(null==oe?void 0:oe.locked)||!U)return;const e=e=>{"Escape"===e.key&&vt(U)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,U]),y||j||O||B||I||ne&&ne.length>0||k||Y||oe?t("svg",{role:"img",width:h,height:p,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof j?j:"XY Chart"}),e("desc",{children:"string"==typeof j?j+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[k&&g&&!V&&(()=>{var n,o;const r=Ot(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),i=Ot(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[X.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:u,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"xgrid-"+n)),Q.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:l,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),y&&g&&(()=>{const o=null==m?void 0:m.find(e=>"left"===e.orient),r=null==m?void 0:m.find(e=>"bottom"===e.orient),i=!o||!1!==o.baseline,s=!r||!1!==r.baseline,a=(null==o?void 0:o.jaggedBase)||!1,c=(null==r?void 0:r.jaggedBase)||!1,d=null==r?void 0:r.landmarkTicks,h=null==o?void 0:o.landmarkTicks,p="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",A=!!(null==r?void 0:r.autoRotate)&&X.length>1&&(()=>{const e=l/Math.max(X.length-1,1);return X.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[!V&&s&&!c&&e("line",{x1:0,y1:u,x2:l,y2:u,stroke:p,strokeWidth:1}),!V&&c&&e("path",{d:St("bottom",l,u),fill:"none",stroke:p,strokeWidth:1}),X.map((n,o)=>{const r=!!d&&("function"==typeof d?d(n.value,o):ke(n.value,o>0?X[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${u})`,children:[e("line",{y2:5,stroke:p,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:A?10:18,textAnchor:A?"end":"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"},transform:A?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"xtick-"+o)}),b&&e("text",{x:l/2,y:u+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:b}),!V&&i&&!a&&e("line",{x1:0,y1:0,x2:0,y2:u,stroke:p,strokeWidth:1}),!V&&a&&e("path",{d:St("left",l,u),fill:"none",stroke:p,strokeWidth:1}),Q.map((n,o)=>{const r=!!h&&("function"==typeof h?h(n.value,o):ke(n.value,o>0?Q[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:p,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==o?void 0:o.label)||v;return t?e("text",{x:15-f.left,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-f.left}, ${u/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const o=null==m?void 0:m.find(e=>"right"===e.orient);if(!o||0===K.length)return null;const r=o.landmarkTicks,i=o.label||x;return t(n,{children:[!1!==o.baseline&&e("line",{x1:l,y1:0,x2:l,y2:u,stroke:p,strokeWidth:1}),K.map((n,o)=>{const i=!!r&&("function"==typeof r?r(n.value,o):ke(n.value,o>0?K[o-1].value:void 0));return t("g",{transform:`translate(${l},${n.pixel})`,children:[e("line",{x2:5,stroke:p,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:g,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-r-"+o)}),i&&e("text",{x:l+f.right-15,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${l+f.right-15}, ${u/2})`,style:{userSelect:"none"},children:i})]})})()]})})(),ne,I&&g&&R&&D&&t(n,{children:[I.top&&e("g",{transform:"translate(0, 0)",children:e(nt,{orient:"top",config:tt(I.top),values:R,scale:g.x,size:f.top,length:l})}),I.bottom&&e("g",{transform:`translate(0, ${u})`,children:e(nt,{orient:"bottom",config:tt(I.bottom),values:R,scale:g.x,size:f.bottom,length:l})}),I.left&&e("g",{transform:"translate(0, 0)",children:e(nt,{orient:"left",config:tt(I.left),values:D,scale:g.y,size:f.left,length:u})}),I.right&&e("g",{transform:`translate(${l}, 0)`,children:e(nt,{orient:"right",config:tt(I.right),values:D,scale:g.y,size:f.right,length:u})})]}),B,oe&&oe.sourceId!==Z&&(null==g?void 0:g.x)&&(()=>{const t=g.x(oe.xValue);if(null==t||0>t||t>l)return null;const n=oe.locked;return e("line",{x1:t,y1:0,x2:t,y2:u,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Y]}),j&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof j?j:null}),et({legend:O,totalWidth:h,totalHeight:p,margin:f,legendPosition:z,title:j,legendHoverBehavior:S,legendClickBehavior:M,legendHighlightedCategory:C,legendIsolatedCategories:$})]}):null}function zt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Pt="undefined"==typeof window||"undefined"==typeof document,Lt=o.createContext(null),Bt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function It(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const Rt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Dt={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Nt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Et={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Tt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Wt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},_t={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Ft={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Ht({scene:n,chartType:r,tableId:i,chartTitle:s}){var a;const[l,c]=o.useState(!1),u=o.useContext(Lt),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,p=o.useRef(null),f=s?"Data summary for "+s:i?`Data summary for ${r} ${i}`:"Data summary for "+r,g=o.useCallback(()=>{l||d||c(!0)},[l,d]),y=o.useCallback(e=>{var t;d||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return i?e("span",{id:i,tabIndex:-1,style:Bt}):null;if(!h)return e("div",{id:i,tabIndex:-1,onFocus:g,style:Bt,role:"region","aria-label":f,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,p,f,g,y,m,b,v,x,A,w,k,j,O;const S=[];if(!Array.isArray(e))return S;for(const M of e)if(M&&"object"==typeof M)try{switch(M.type){case"point":S.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=M.topPath,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=M.datum&&"object"==typeof M.datum?M.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=M.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=M.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=M.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=M.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(p=M.cx)&&void 0!==p?p:M.x,y:null!==(f=M.cy)&&void 0!==f?f:M.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(y=null===(g=M.datum)||void 0===g?void 0:g.id)&&void 0!==y?y:"",x:null!==(m=M.cx)&&void 0!==m?m:M.x,y:null!==(b=M.cy)&&void 0!==b?b:M.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(A=null===(x=null===(v=M.datum)||void 0===v?void 0:v.properties)||void 0===x?void 0:x.name)&&void 0!==A?A:null===(w=M.datum)||void 0===w?void 0:w.name)&&void 0!==k?k:"",value:null!==(O=null===(j=M.datum)||void 0===j?void 0:j.value)&&void 0!==O?O:""}})}}catch(e){}return S}(n),b=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Rt(e.min)} to ${Rt(e.max)}, mean ${Rt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,b),x=m.slice(0,5),A=new Set;for(const e of x)for(const t of Object.keys(e.values))A.add(t);const w=Array.from(A);return t("div",{ref:p,id:i,tabIndex:-1,onBlur:y,style:Dt,role:"region","aria-label":f,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Et,children:"×"}),e("div",{role:"note",style:Nt,children:v}),t("table",{role:"table","aria-label":"Sample data for "+r,style:Tt,children:[t("caption",{style:Ft,children:["First ",x.length," of ",m.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Wt,children:"type"}),w.map(t=>e("th",{style:Wt,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:_t,children:n.label}),w.map(t=>{return e("td",{style:_t,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Rt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function qt({summary:t}){return t?e("div",{role:"note",style:Bt,children:t}):null}function Gt({tableId:t}){return e("a",{href:"#"+t,style:Bt,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Bt)},children:"Skip to data table"})}function Vt({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Bt,children:n})}const Ut="var(--semiotic-focus, #005fcc)";function Zt({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Ut,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Ut,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ut,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Yt({x:t,y:n,containerWidth:r,containerHeight:i,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=o.useRef(null),[d,h]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,r,i]);let p;return p=d?`translate(${d.width+12>r-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*r?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:l,style:{position:"absolute",left:s.left+t,top:s.top+n,transform:p,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function Xt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Qt(e,t,n=.6){var o,r,i,s,a;if(!Xt(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Kt(e,t,n,o=.35){Xt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Jt(e){switch(e){case"monotoneX":return W;case"monotoneY":return T;case"cardinal":return I;case"catmullRom":return B;case"step":return E;case"stepBefore":return D;case"stepAfter":return N;case"basis":return R;case"natural":return H;default:return null}}function en(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function tn(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function nn(e){return e.k}function on(e){return[e.x,e.y]}function rn(e){return function(){return e}}function sn([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function an(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function ln(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function cn(e,t,n,o,r){return"function"==typeof e?e(t,n,o,r):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",r>1?"@2x":"")}class un{constructor(e=256){this.cache=new Map,this.limit=e}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,o]of this.cache)t>o.lastUsed&&(t=o.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}}class dn{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const s=n[i.lineIndex];if(!s||2>s.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const a=hn(s),l=pn(s,i.t*a),c=(o[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function hn(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],r=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+r*r)}return t}function pn(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],s=Math.sqrt(r*r+i*i);if(n+s>=t||o===e.length-1){const a=s>0?(t-n)/s:0,l=s>.001?s:1;return{x:e[o-1][0]+r*a,y:e[o-1][1]+i*a,nx:-i/l,ny:r/l}}n+=s}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const fn={top:10,right:10,bottom:10,left:10},gn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"},yn={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function mn(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function bn(e){return e?e.getContext("2d"):null}function vn({data:n}){if(!n)return null;if(n.properties)return e("div",{className:"semiotic-tooltip",style:gn,children:e("div",{style:{fontWeight:600},children:n.properties.name||n.properties.NAME||n.properties.id||"Feature"})});const o=Object.entries(n).slice(0,3);return e("div",{className:"semiotic-tooltip",style:gn,children:o.map(([n,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[n,": "]}),e("span",{style:{fontWeight:600},children:o+""})]},n))})}const xn=h(function(n,o){var r,s,c,h,f,g,y,m,b,v;const{projection:x,projectionExtent:A,fitPadding:w,projectionTransform:k,areas:j,points:O,lines:S,xAccessor:M,yAccessor:C,lineDataAccessor:$,pointIdAccessor:z,lineType:P="geo",flowStyle:L="basic",graticule:B,zoomable:I,zoomExtent:R,onZoom:D,dragRotate:N,showParticles:E,particleStyle:T,tileURL:W,tileAttribution:_,tileCacheSize:H,size:q,width:Z,height:Y,responsiveWidth:X,responsiveHeight:Q,margin:K,className:J,background:ee,areaStyle:te,pointStyle:ne,lineStyle:oe,colorScheme:re,enableHover:ie=!0,hoverAnnotation:se,tooltipContent:ae,customClickBehavior:le,customHoverBehavior:ce,annotations:ue,decay:de,pulse:he,transition:pe,animate:fe,staleness:ge,backgroundGraphics:ye,foregroundGraphics:me,title:be,legend:ve,legendPosition:Ae,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,showAxes:Me,accessibleTable:$e=!0,description:ze,summary:Pe}=n,Le=q||[Z||600,Y||400],Be=a(!0),Ie=Ge({sizeProp:Le,responsiveWidth:X,responsiveHeight:Q,userMargin:K,marginDefault:fn,foregroundGraphics:me,backgroundGraphics:ye,animate:fe,transitionProp:pe,themeDirtyRef:Be}),{reducedMotionRef:Re,responsiveRef:De,size:Ne,margin:Ee,adjustedWidth:Te,adjustedHeight:We,resolvedForeground:_e,resolvedBackground:Fe,transition:qe,introEnabled:Ve,tableId:Ue,rafRef:Ze,renderFnRef:Ye,scheduleRender:Xe,currentTheme:Qe}=Ie,Ke=i(()=>null!=N?N:"orthographic"===mn(x),[N,x]),Je=i(()=>{var e,t;return{projection:x,projectionExtent:A,fitPadding:w,xAccessor:M,yAccessor:C,lineDataAccessor:$,lineType:P,flowStyle:L,areaStyle:te,pointStyle:ne,lineStyle:oe,colorScheme:re,themeSemantic:Ce(Qe),themeSequential:null===(e=null==Qe?void 0:Qe.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==Qe?void 0:Qe.colors)||void 0===t?void 0:t.diverging,graticule:B,projectionTransform:k,decay:de,pulse:he,transition:qe,introAnimation:Ve,annotations:ue,pointIdAccessor:z}},[x,A,w,M,C,$,P,L,te,ne,oe,re,B,k,de,he,null==qe?void 0:qe.duration,null==qe?void 0:qe.easing,Ve,ue,z,Qe]),et=a(null);et.current||(et.current=new xe(Je));const tt=a(null),nt=a(null),ot=a(null),rt=a(null),it=a(null);W&&!it.current&&(it.current=new un(H||256));const st=a(ue),at=a(null),lt=a(G),ct=a(!1),ut=a(null),dt=a(null),ht=a(null),pt=a(null),ft=a(0);if(E&&!pt.current){const e=null!==(r=null==T?void 0:T.maxPerLine)&&void 0!==r?r:30;pt.current=new dn(50*e)}const gt=a(null),yt=a(null),[mt,bt]=u(null),[vt,xt]=u(0),[At,wt]=u(!1);d(()=>{var e;null===(e=et.current)||void 0===e||e.updateConfig(Je),Be.current=!0,Xe()},[Je,Xe]),d(()=>{const e=et.current;e&&(j&&e.setAreas(j),O&&e.setPoints(O),S&&e.setLines(S),Be.current=!0,Xe())},[j,O,S,Xe]);const kt=l(e=>{var t;null===(t=et.current)||void 0===t||t.pushPoint(e),Be.current=!0,Xe()},[Xe]),jt=l(e=>{var t;null===(t=et.current)||void 0===t||t.pushMany(e),Be.current=!0,Xe()},[Xe]),Ot=l(()=>{var e;null===(e=et.current)||void 0===e||e.clear(),Be.current=!0,Xe()},[Xe]);p(o,()=>({push:kt,pushMany:jt,removePoint:e=>{var t,n;const o=null!==(n=null===(t=et.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Be.current=!0,Xe()),o},clear:Ot,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=et.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.projection)&&void 0!==n?n:null},getGeoPath:()=>{var e,t,n;return null!==(n=null===(t=null===(e=et.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.geoPath)&&void 0!==n?n:null},getCartogramLayout:()=>{var e,t;return null!==(t=null===(e=et.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>lt.current.k,resetZoom:()=>{const e=ut.current;e&&at.current&&U(e).call(at.current.transform,G)},getData:()=>{var e,t;return null!==(t=null===(e=et.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[kt,jt,Ot,Xe]);const{hoverHandlerRef:St,onPointerMove:Mt,onPointerLeave:Ct}=Ie;d(()=>{St.current=e=>{if(!ie)return;const t=et.current;if(!t||!t.scene.length)return;const n=nt.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Ee.left,i=e.clientY-o.top-Ee.top;if(0>r||r>Te||0>i||i>We)return gt.current=null,yt.current=null,bt(null),null==ce||ce(null),void Xe();rt.current||(rt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=bn(rt.current);if(!s)return;const a=je(t.scene,r,i,30,s,t.quadtree,t.maxPointRadius);if(a){const e=a.node,t=e.datum,n=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});gt.current=l,yt.current=e,bt(l),null==ce||ce(l),Xe()}else gt.current&&(gt.current=null,yt.current=null,bt(null),null==ce||ce(null),Xe())}},[ie,Te,We,Ee,ce,Xe]),Ie.hoverLeaveRef.current=()=>{gt.current=null,yt.current=null,bt(null),null==ce||ce(null),Xe()};const Lt=l(e=>{if(!le)return;const t=et.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Ee.left,r=e.clientY-n.top-Ee.top;rt.current||(rt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=bn(rt.current);if(!i)return;const s=je(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;le(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,x:o,y:r,time:o,value:r}))}},[le,Ee]),Bt=a(-1),Rt=a(null),Dt=l(e=>{const t=et.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)"point"===n.type&&null!=n.x?t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"}):"geoarea"===n.type&&n.centroid&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"circle"});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=Bt.current,r=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return Bt.current=-1,Rt.current=null,gt.current=null,yt.current=null,bt(null),null==ce||ce(null),void Xe();const i=0>o?0:r;Bt.current=i;const s=n[i];Rt.current={shape:s.shape,w:s.w,h:s.h};const a=s.datum,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});gt.current=u,bt(u),null==ce||ce(u),Xe()},[ce,Xe]),Nt=l(e=>{Bt.current=-1,Rt.current=null,Mt(e)},[Mt]);Ye.current=()=>{var e,t,n,o,r,i,s,a;Ze.current=0;const l=nt.current,c=et.current;if(!l||!c)return;const u=performance.now();let d=!1;const h=ht.current;h&&(ht.current=null,c.applyRotation(h,{width:Te,height:We}));const p=c.advanceTransition(Re.current?u+1e6:u),f=!Re.current&&p;if(Be.current&&!p){const e={width:Te,height:We},t=Ke?c.getRotation():null;c.computeScene(e);const n=lt.current,o=1!==n.k||0!==n.x||0!==n.y;Ke&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),Be.current=!1,l.setAttribute("aria-label",It(c.scene,"Geographic chart"))}const g=ln();if(W&&it.current){const t=tt.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=an(t,Ne,Ee,g);if(e){e.clearRect(-Ee.left,-Ee.top,Ne[0],Ne[1]),e.save(),e.beginPath(),e.rect(0,0,Te,We),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:s,onTileLoad:a}=t,l=o.scale(),c=o.translate(),u=2*l*Math.PI,d=function(){let e=0,t=0,n=960,o=500,r=!0,i=!0,s=256,a=nn,l=on,c=0;function u(){const u=+a.apply(this,arguments),d=l.apply(this,arguments),h=Math.log2(u/s),p=Math.round(Math.max(h+c,0)),f=Math.pow(2,h-p)*s,g=+d[0]-u/2,y=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-g)/f)),b=Math.min(r?1<<p:1/0,Math.ceil((n-g)/f)),v=Math.max(i?0:-1/0,Math.floor((t-y)/f)),x=Math.min(i?1<<p:1/0,Math.ceil((o-y)/f)),A=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)A.push([t,e,p]);return A.translate=[g/f,y/f],A.scale=f,A}return u.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],u):[n-e,o-t]},u.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],u):[[e,t],[n,o]]},u.scale=function(e){return arguments.length?(a="function"==typeof e?e:rn(+e),u):a},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:rn([+e[0],+e[1]]),u):l},u.zoomDelta=function(e){return arguments.length?(c=+e,u):c},u.tileSize=function(e){return arguments.length?(s=+e,u):s},u.clamp=function(e){return arguments.length?(r=i=!!e,u):r&&i},u.clampX=function(e){return arguments.length?(r=!!e,u):r},u.clampY=function(e){return arguments.length?(i=!!e,u):i},u}().size([r,i]).scale(u).translate(c).clamp(!0)(),h=ln();let p=!0;for(const t of d){const[o,r,i]=sn(t),l=`${i}/${o}/${r}`;let c=s.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};s.set(l,t),e.onload=()=>{t.loaded=!0,null==a||a()},e.onerror=()=>{t.loaded=!0},e.src=cn(n,i,o,r,h),c=t}if(!c.loaded){p=!1;continue}const u=d.scale;e.drawImage(c.img,(t[0]+d.translate[0])*u-.5,(t[1]+d.translate[1])*u-.5,u+1,u+1)}return p}(e,{tileURL:W,projection:c.scales.projection,width:Te,height:We,tileCache:it.current,onTileLoad:()=>Xe()});e.restore(),t||(d=!0)}}}const y=an(l,Ne,Ee,g);if(!y)return;y.clearRect(-Ee.left,-Ee.top,Ne[0],Ne[1]),ee&&!W&&(y.fillStyle=ee,y.fillRect(0,0,Te,We)),y.save(),y.beginPath(),y.rect(0,0,Te,We),y.clip();const m=c.scene,b={width:Te,height:We};if(function(e,t){var n,o,r;const i=t.filter(e=>"geoarea"===e.type);for(const t of i){if(!t.pathData)continue;const i=new Path2D(t.pathData),s=t.style.fill||"#e0e0e0";if("none"!==s&&(e.fillStyle=s,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(i)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=He(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(r=t._decayOpacity)&&void 0!==r?r:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(i)}Kt(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(y,m),((e,t,n,o)=>{var r,i;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=a.style.stroke||"#007bff",u=He(e,c)||c,d=a.style.strokeWidth||2,h=a.colorThresholds,p=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=d,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const m=null!==(r=a.style.opacity)&&void 0!==r?r:1;tn(e,a.path,u,d,m,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=Jt(a.curve),g=h&&h.length>0&&p&&p.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!g){e.strokeStyle=u;const b=null!==(i=a.style.opacity)&&void 0!==i?i:1;for(let v=0;a.path.length-1>v;v++)e.globalAlpha=.5*(y[v]+y[v+1])*b,e.beginPath(),e.moveTo(a.path[v][0],a.path[v][1]),e.lineTo(a.path[v+1][0],a.path[v+1][1]),e.stroke()}else if(g){let x=null,A=null,w=null,k=null,j=!1;function O(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),j=!0}function S(){j&&(e.stroke(),j=!1)}for(let M=0;a.path.length>M;M++){const[C,$]=a.path[M],z=p[M],P=en(z,h,u);if(null!==x&&null!==k&&null!==w){if(P===k)e.lineTo(C,$);else{const L=[];for(const B of h){const I=B.value;(w>I||I>z)&&(I>w||z>I)||w===I||z===I||L.push({t:(I-w)/(z-w)})}L.sort((e,t)=>e.t-t.t);for(const R of L){const D=x+(C-x)*R.t,N=A+($-A)*R.t,E=en(w+(z-w)*Math.min(R.t+1e-4,1),h,u);e.lineTo(D,N),S(),O(E,D,N)}e.lineTo(C,$)}x=C,A=$,w=z,k=P}else O(P,C,$),x=C,A=$,w=z,k=P}S()}else{if(e.beginPath(),!a.strokeGradient||2>a.strokeGradient.colorStops.length||2>a.path.length)e.strokeStyle=u;else{const T=e.createLinearGradient(a.path[0][0],0,a.path[a.path.length-1][0],0);for(const W of a.strokeGradient.colorStops)T.addColorStop(Math.max(0,Math.min(1,W.offset)),W.color);e.strokeStyle=T}if(f)F().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[_,H]=a.path[0];e.moveTo(_,H);for(let q=1;a.path.length>q;q++)e.lineTo(a.path[q][0],a.path[q][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=("string"==typeof a.style.fill?He(e,a.style.fill):a.style.fill)||a.style.fill,f&&!g)F().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(a.path);else{const[V,U]=a.path[0];e.moveTo(V,U);for(let Z=1;a.path.length>Z;Z++)e.lineTo(a.path[Z][0],a.path[Z][1])}const G=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(G,o.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(y,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?He(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?He(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Qt(e,t),e.globalAlpha=1}}finally{e.restore()}}})(y,m),E&&pt.current){const e=pt.current,a=m.filter(e=>"line"===e.type);if(a.length>0){const l=T||{},c=.3*(null!==(t=l.speedMultiplier)&&void 0!==t?t:1),h=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,m=u/1e3,b=ft.current>0?Math.min(m-ft.current,.1):.016;ft.current=m;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)<h&&e.spawn(t);e.step(b,c,v,x),y.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";y.beginPath(),y.arc(n.x,n.y,f,0,2*Math.PI),y.fillStyle=r,y.fill()}y.globalAlpha=1,d=!0}}y.restore();const v=ot.current;if(v){const e=an(v,Ne,Ee,g);if(e){e.clearRect(-Ee.left,-Ee.top,Ne[0],Ne[1]);const t=yt.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof se?se:void 0,r=(null==o?void 0:o.pointColor)||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(ge){const e=performance.now()-c.lastIngestTime>(null!==(a=ge.threshold)&&void 0!==a?a:5e3);e!==At&&wt(e)}const x=ue!==st.current;x&&(st.current=ue),(Be.current||x)&&xt(e=>e+1),(f||null!=c.activeTransition||c.hasActivePulses||d)&&(Ze.current=requestAnimationFrame(()=>Ye.current()))},d(()=>(Xe(),()=>{var e;null===(e=it.current)||void 0===e||e.clear()}),[Xe]),d(()=>{Be.current=!0,Xe()},[Te,We,ee,Xe]),function(e,t,n,o,r,i){d(()=>{if(!e)return;const s=setInterval(()=>{var s;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(s=e.threshold)&&void 0!==s?s:5e3,u=l-a.lastIngestTime>c;u!==r&&(i(u),n.current=!0,o())},1e3);return()=>clearInterval(s)},[e,r,o])}(ge,et,Be,Xe,At,wt),d(()=>{if("production"!==process.env.NODE_ENV&&W){const e=mn(x);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[W,x]),d(()=>{const e=ut.current;if(!I||!e)return at.current&&e&&(U(e).on(".zoom",null),at.current=null),void(e&&U(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=R||[1,8],o={width:Te,height:We};if(Ke){let r=lt.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),lt.current=G.scale(r);const s=et.current;s&&(s.applyZoomScale(r,o),Be.current=!1,Xe(),(null===(i=s.scales)||void 0===i?void 0:i.projection)&&(null==D||D({projection:s.scales.projection,zoom:s.currentZoom})))};at.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const s=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},a=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",a);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=et.current;if(!o)return;const r=o.getRotation();dt.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=dt.current;t&&(ht.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],Xe())},d=t=>{var n;if(!dt.current)return;dt.current=null,e.releasePointerCapture(t.pointerId);const r=ht.current;if(r){ht.current=null;const e=et.current;e&&(e.applyRotation(r,o),Xe())}const i=et.current;(null===(n=null==i?void 0:i.scales)||void 0===n?void 0:n.projection)&&(null==D||D({projection:i.scales.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",a),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),at.current=null}}const r=V().scaleExtent([t,n]).extent([[0,0],[Ne[0],Ne[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;lt.current=t,ct.current=!0;const n=et.current;n&&(n.applyZoomTransform(t,o),Be.current=!1,Xe())}).on("end",e=>{var t;lt.current=e.transform,ct.current=!1;const n=et.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==D||D({projection:n.scales.projection,zoom:n.currentZoom}))});return at.current=r,U(e).call(r),()=>{U(e).on(".zoom",null)}},[I,R,Ke,Ne,Te,We,Ee,D,Xe]);const Et=ie&&!1!==se,Tt=Et&&mt?ae?ae(mt):e(vn,{data:mt}):null,Wt=Tt?e(Yt,{x:mt.x,y:mt.y,containerWidth:Te,containerHeight:We,margin:Ee,className:"stream-frame-tooltip",zIndex:10,children:Tt}):null;if(Pt){const n=et.current;n&&(j||O||S)&&(j&&n.setAreas(j),O&&n.setPoints(O),S&&n.setLines(S),n.computeScene({width:Te,height:We}));const o=null!==(s=null==n?void 0:n.scene)&&void 0!==s?s:[];return t("div",{className:"stream-geo-frame"+(J?" "+J:""),role:"img","aria-label":ze||("string"==typeof be?be:"Geographic chart"),style:{position:"relative",width:Ne[0],height:Ne[1]},children:[e(qt,{summary:Pe}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ne[0],height:Ne[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Ee.left},${Ee.top})`,children:Fe}),t("g",{transform:`translate(${Ee.left},${Ee.top})`,children:[ee&&e("rect",{x:0,y:0,width:Te,height:We,fill:ee}),o.map((t,n)=>function(t,n){var o,r,i,s,a,l;switch(t.type){case"geoarea":{const i=t;return i.pathData?e("path",{d:i.pathData,fill:zt(i.style.fill,"#e0e0e0"),fillOpacity:null!==(o=i.style.fillOpacity)&&void 0!==o?o:1,stroke:i.style.stroke||"none",strokeWidth:i.style.strokeWidth||.5,strokeDasharray:i.style.strokeDasharray,opacity:null!==(r=i._decayOpacity)&&void 0!==r?r:1},"geoarea-"+n):null}case"point":{const o=t;return e("circle",{cx:o.x,cy:o.y,r:o.r,fill:zt(o.style.fill),fillOpacity:null!==(i=o.style.fillOpacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(s=o._decayOpacity)&&void 0!==s?s:null!==(a=o.style.opacity)&&void 0!==a?a:1},"point-"+n)}case"line":{const o=t;if(2>o.path.length)return null;const r="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e("path",{d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(l=o.style.opacity)&&void 0!==l?l:1},"line-"+n)}default:return null}}(t,n))]})]}),e($t,{width:Te,height:We,totalWidth:Ne[0],totalHeight:Ne[1],margin:Ee,scales:null,showAxes:!1,title:be,legend:ve,legendPosition:Ae,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,foregroundGraphics:_e,annotations:ue,annotationFrame:0,xValues:[],yValues:[],pointNodes:o.filter(e=>"point"===e.type)})]})}const _t=l(e=>{ut.current=e,De&&"object"==typeof De&&(De.current=e)},[De]);return t("div",{ref:_t,className:"stream-geo-frame"+(J?" "+J:""),role:"group","aria-label":ze||("string"==typeof be?be:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:X?"100%":Ne[0],height:Q?"100%":Ne[1],overflow:"hidden"},I?{touchAction:"none"}:{}),onKeyDown:Dt,children:[$e&&e(Gt,{tableId:Ue}),$e&&e(Ht,{scene:null!==(h=null===(c=et.current)||void 0===c?void 0:c.scene)&&void 0!==h?h:[],chartType:"Geographic chart",tableId:Ue,chartTitle:"string"==typeof be?be:void 0}),e(qt,{summary:Pe}),t("div",{role:"img","aria-label":ze||("string"==typeof be?be:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Et?Nt:void 0,onMouseLeave:Et?Ct:void 0,onClick:le?Lt:void 0,children:[Fe&&e("svg",{style:{position:"absolute",left:0,top:0,width:Ne[0],height:Ne[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Ee.left},${Ee.top})`,children:Fe})}),W&&e("canvas",{ref:tt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e("canvas",{ref:nt,"aria-label":It(null!==(g=null===(f=et.current)||void 0===f?void 0:f.scene)&&void 0!==g?g:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:ot,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Vt,{hoverPoint:mt}),e($t,{width:Te,height:We,totalWidth:Ne[0],totalHeight:Ne[1],margin:Ee,scales:null,showAxes:null!=Me&&Me,title:be,legend:ve,legendPosition:Ae,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,foregroundGraphics:_e,annotations:ue,annotationFrame:vt,xValues:[],yValues:[],pointNodes:null===(y=et.current)||void 0===y?void 0:y.scene.filter(e=>"point"===e.type)}),(null==ge?void 0:ge.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ge.badgePosition?{top:4,left:4}:"bottom-left"===ge.badgePosition?{bottom:4,left:4}:"bottom-right"===ge.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:At?"#dc3545":"#28a745",color:"white"}),children:At?"STALE":"LIVE"}),I&&t("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Ee.bottom+8,left:Ee.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=ut.current,n=at.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(U(t),1.5)},style:yn,children:"+"}),e("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=ut.current,n=at.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(U(t),1/1.5)},style:yn,children:"−"})]}),_&&e("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Ee.bottom+2,right:Ee.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:_}),e(Zt,{active:Bt.current>=0,hoverPoint:mt,margin:Ee,size:Ne,shape:null===(m=Rt.current)||void 0===m?void 0:m.shape,width:null===(b=Rt.current)||void 0===b?void 0:b.w,height:null===(v=Rt.current)||void 0===v?void 0:v.h}),Wt]})]})});xn.displayName="StreamGeoFrame";const An={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function wn(e,t){return"function"==typeof t?t(e):e[t]}function kn(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 jn(n={}){const{fields:o,title:r,format:i,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(r){const e=wn(n,r);l=kn(e,i)}if(o&&o.length>0)o.forEach(e=>{let t,o,r;"string"==typeof e?(t=e,o=e,r=i):(t=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=wn(n,o);c.push({label:t,value:kn(s,r)})});else if(!r){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=kn(n[t],i);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=kn(n[e[0]],i))}}const u=Object.assign(Object.assign({},An),s);return t("div",{className:("semiotic-tooltip "+a).trim(),style:u,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function On(t){if(!0===t)return jn();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e("div",{className:"semiotic-tooltip",style:An,children:o})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?jn(t):jn())}const Sn={category10:Z,tableau10:oe,set3:ne,blues:te,reds:ee,greens:J,oranges:K,purples:Q,viridis:X,plasma:Y},Mn=Z,Cn=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],$n=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 zn(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")||$n.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):Mn[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+""))%Mn.length]}function Pn(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return S().domain(o).range(n).unknown("#999");const i=Sn[n]||Sn.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Mn;return S().domain(o).range(e).unknown("#999")}}function Ln(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 Bn=r(null);function In(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 Rn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Dn,Nn]=Se(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Rn(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=Rn(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}})}})),[En,Tn]=Se(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Wn(e){const t=f(),n=e.clientId||t,{name:o}=e,r=Nn(e=>e.selections.get(o)),s=Nn(e=>e.setClause),a=Nn(e=>e.clearClause),c=i(()=>!!r&&r.clauses.size>0,[r]);return{predicate:i(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(In(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:c,selectPoints:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:l(()=>{a(o,n)},[a,o,n]),clientId:n}}function _n(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Wn({name:t});return{onHover:l(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,s,t]),predicate:o,isActive:r}}const Fn=r(!1);function Hn(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 qn(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 Gn(){return Re(e=>e.theme)}o.createContext(void 0);const Vn="#007bff";function Un(e,t,n){const o=s(Bn),r=function(){var e;const t=Gn(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}();return i(()=>{var i;if(!t)return;const s=null!==(i=null!=n?n:r&&r.length>0?r:void 0)&&void 0!==i?i:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=Pn(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return Pn(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=Pn(e,t,s);return e=>o[e]||n(e)}return Pn(e,t,s)}if(o&&Object.keys(o).length>0){const e=Pn([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,r])}function Zn({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:s,chartId:a,onClick:c,hoverHighlight:h,colorByField:p}){const g=f(),y=Hn(t,n),m=Wn({name:(null==e?void 0:e.name)||"__unused__"}),b=_n({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),v=Tn(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[A,w]=u(null),k=p||n[0],j=i(()=>{if(!h||null==A||!k)return null;const e=A,t=k;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,A,k]),O=l(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const e=null==t?void 0:t[y.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=gt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(gt={positions:new Map(gt.positions).set(e,{xValue:t,sourceId:n})},mt())}(y.name||"hover",Number(e),g)}"x-position"!==(null==y?void 0:y.mode)&&b.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&bt(y.name||"hover",g),"x-position"!==(null==y?void 0:y.mode)&&b.onHover(null);if(h&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[k];w(null!=n?n+"":null)}else w(null);if(r||v){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const s=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),v&&v(s)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),v&&v(e)}}},[t,b,y,g,r,s,a,v,h,k]),S=l(e=>{var t,n,o,i;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[y.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=gt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(gt.positions);return t.delete(e),gt={positions:t},mt(),!1}gt={positions:new Map(gt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},mt()}(y.name||"hover",Number(n),g)}if(e&&c){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),c(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||v){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),v&&v(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),v&&v(e)}}},[c,r,v,s,a,y,g]);return d(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{vt(e,g),bt(e,g)}},[null==y?void 0:y.mode,null==y?void 0:y.name,g]),{activeSelectionHook:x,hoverSelectionHook:j,customHoverBehavior:O,customClickBehavior:S,crosshairSourceId:g}}function Yn({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(Fn),d=void 0!==o?o:!u&&!!t,h=i(()=>{if(!d||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):Cn[i%Cn.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:zn,categories:c});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[d,t,e,n,c]),p=i(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=Object.assign(Object.assign({},l),e);return h&&("right"===r&&110>t.right?t.right=110:"left"===r&&110>t.left?t.left=110:"top"===r&&50>t.top?t.top=50:"bottom"===r&&80>t.bottom&&(t.bottom=80)),t},[l,a,h,r]);return{legend:h,margin:p,legendPosition:r}}const Xn={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 Qn(e,t,n){var o,r,i,s,a,l,c;const u=Xn[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:Kn(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Kn(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 Jn(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 eo({componentName:n,message:o,diagnosticHint:r,width:i,height:s}){return e("div",{role:"alert",style:{width:i,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),r&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:r})]})})}class to extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(eo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function no(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 oo(e,t,n=3){let o,r=n+1;for(const n of t){const t=no(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function ro(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function io(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=oo(e,t,3))&&void 0!==n?n:null)}const so={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"}},ao={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},lo={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},co=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],uo=["vertical","horizontal"],ho={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},so),ao),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:co},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({},so),ao),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:co},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},so),ao),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:co},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({},so),ao),{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({},so),ao),{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({},so),ao),{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({},so),ao),{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({},so),ao),{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({},so),ao),{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({},so),ao),{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({},so),lo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:uo},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({},so),lo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:uo},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({},so),lo),{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:uo},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},so),lo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:uo},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({},so),lo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:uo},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({},so),lo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:uo},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},so),lo),{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({},so),lo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:uo},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({},so),lo),{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({},so),lo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:uo},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},so),{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({},so),{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({},so),{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({},so),lo),{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({},so),lo),{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({},so),{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({},so),{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:uo},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({},so),{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({},so),{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({},so),{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({},so),{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({},so),{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({},so),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},so),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},so),{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({},so),{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({},so),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},so),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function po(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const fo=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),go=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),yo=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),mo=new Set(["LineChart","AreaChart","StackedAreaChart"]),bo=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function vo(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 xo(e,t){const n=vo(e),o=vo(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Ao=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function wo(e,t){const n=[],o=function(e,t){const n=[],o=ho[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(ho).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(!po(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=oo(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=ro(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=io(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=ro(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=io(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 ho[e]?(function(e,t,n){const o=ho[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=ho[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){fo.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){go.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=ho[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(!yo.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(!mo.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=ho[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(!bo.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=xo(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=xo(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 Ao)"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 ko;const jo="undefined"!=typeof process&&"production"!==(null===(ko=process.env)||void 0===ko?void 0:ko.NODE_ENV);function Oo({componentName:t,width:n,height:o,chartProps:r,children:i}){return e(to,{fallback:i=>{let s="";if(jo&&r)try{const e=wo(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(eo,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})},children:i})}const So={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"},Mo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Co(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},So),{width:n,height:o}),children:r||"No data available"}):null}function $o(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Mo),{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 zo(e,t,n,o){if(!jo)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 Po(e){const t=Re(e=>e.theme.colors.selectionOpacity);return i(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function Lo(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 Bo(e){return e}function Io(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 Bo;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 Ro=new Map;function Do(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function No(e){return Lo(this,void 0,void 0,function*(){const t=Ro.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return Lo(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:Do(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Do(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Do(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Do(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 Io(e,t)})}:Io(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return Ro.set(e,i),i})}function Eo(e){const t=i(()=>Array.isArray(e)?e:void 0,[e]),[n,o]=u(null);return d(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return o(null),No(e).then(e=>{t||o(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),o(null)}else o(null)},[e]),void 0!==t?t:n}const To={blues:te,reds:ee,greens:J,viridis:X,oranges:K,purples:Q,greys:le,plasma:Y,inferno:ae,magma:se,cividis:ie,turbo:re};function Wo(n){var o;const r=Qn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),s=function(){var e;const t=Gn();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:a,valueAccessor:l,colorScheme:c,projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:p,zoomExtent:f,onZoom:g,dragRotate:y,tileURL:m,tileAttribution:b,tileCacheSize:v,tooltip:x,areaOpacity:A=1,annotations:w,margin:k,className:j,selection:O,linkedHover:S,onObservation:C,onClick:$,chartId:P,loading:L,emptyContent:B,frameProps:I={},stroke:R,strokeWidth:D,opacity:N}=n,E=null!=p?p:!!m,T=Eo(a),W=i(()=>"function"==typeof l?l:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[l])&&void 0!==n?n:null==e?void 0:e[l]},[l]),_=null!==(o=null!=c?c:s)&&void 0!==o?o:"blues",F=i(()=>{if(!T)return M(te).domain([0,1]);const e=T.map(e=>W(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=z(e);return M(To[_]||te).domain([null!=t?t:0,null!=n?n:1])},[T,W,_]),{activeSelectionHook:H,customHoverBehavior:q,customClickBehavior:G}=Zn({selection:O,linkedHover:S,onObservation:C,onClick:$,chartType:"ChoroplethMap",chartId:P}),V=Po(O),U=i(()=>{const e=Jn(e=>{const t=W(e);return{fill:null!=t&&isFinite(t)?F(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:A}},{stroke:R,strokeWidth:D,opacity:N});return H?qn(e,H,V):e},[W,F,H,V,A,R,D,N]),Z=i(()=>n=>{var o,r;const i=(null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.name)||(null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||"Feature",s=W(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:i}),null!=s&&e("div",{style:{opacity:.7},children:(a=s,"number"==typeof a&&isFinite(a)?Number.isInteger(a)?a.toLocaleString():a.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=a?a:"")+"")})]});var a},[W]),Y=i(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof k?{top:k,bottom:k,left:k,right:k}:k),[k]),X=$o(L,r.width,r.height)||(T?null:$o(!0,r.width,r.height)),Q=X?null:Co(T,r.width,r.height,B);if(Array.isArray(T)&&T.length>0){const t=T[0];if(!t||"object"!=typeof t||!t.geometry)return e(eo,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:r.width,height:r.height})}const K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:u,areas:T,areaStyle:U,size:[r.width,r.height],margin:Y,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?Z:On(x)||Z},null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),E&&{zoomable:!0}),f&&{zoomExtent:f}),g&&{onZoom:g}),null!=y&&{dragRotate:y}),m&&{tileURL:m}),b&&{tileAttribution:b}),v&&{tileCacheSize:v}),(S||C||$)&&{customHoverBehavior:q}),(C||$)&&{customClickBehavior:G}),w&&w.length>0&&{annotations:w}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),j&&{className:j}),null!=n.animate&&{animate:n.animate}),I);return X||Q||e(Oo,{componentName:"ChoroplethMap",width:r.width,height:r.height,children:e(xn,Object.assign({},K))})}Wo.displayName="ChoroplethMap";const _o=h(function(n,o){const r=a(null);p(o,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,i;const s=null!==(o=null===(n=r.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of s)null===(i=r.current)||void 0===i||i.push(t(e));return s},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Qn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:c,xAccessor:d="lon",yAccessor:h="lat",sizeBy:f,sizeRange:g=[3,30],colorBy:y,colorScheme:m,projection:b="equalEarth",graticule:v,fitPadding:x,zoomable:A,zoomExtent:w,onZoom:k,dragRotate:j,tileURL:O,tileAttribution:S,tileCacheSize:M,areas:C,areaStyle:$={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:z,annotations:P,margin:L,className:B,selection:I,linkedHover:R,onObservation:D,onClick:N,chartId:E,loading:T,emptyContent:W,legendInteraction:_,legendPosition:F,frameProps:H={},stroke:q,strokeWidth:G,opacity:V}=n,U=null!=A?A:!!O,Z=Eo(C),Y=c||[],{activeSelectionHook:X,customHoverBehavior:Q,customClickBehavior:K}=Zn({selection:I,linkedHover:R,fallbackFields:y?["string"==typeof y?y:""]:[],onObservation:D,onClick:N,chartType:"ProportionalSymbolMap",chartId:E}),J=Po(I),ee=Un(Y,y,m),te=i(()=>{if(!f)return;const e="function"==typeof f?f:e=>null==e?void 0:e[f],t=Y.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[Y,f]),ne=i(()=>{const e=Jn(e=>({fill:y?zn(e,y,ee):Vn,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:f?Ln(e,f,g,te):6}),{stroke:q,strokeWidth:G,opacity:V});return X?qn(e,X,J):e},[y,ee,f,g,te,X,J,q,G,V]),oe=i(()=>{if(!y)return[];const e="function"==typeof y?y:e=>null==e?void 0:e[y],t=new Set;for(const n of Y){if(!n)continue;const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[Y,y]),re=function(e,t,n){const[o,r]=u(null),[s,a]=u(new Set),c=l(t=>{"highlight"===e&&r(t?t.label:null)},[e]),d=l(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=i(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(_,y,oe),{legend:ie,margin:se,legendPosition:ae}=Yn({data:Y,colorBy:y,colorScale:ee,showLegend:s.showLegend,legendPosition:F,userMargin:L,defaults:{top:10,bottom:10,left:10,right:10}}),le=i(()=>n=>{const o=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n.NAME)||(null==n?void 0:n.id),r="string"==typeof f?f:null,i=("function"==typeof f?f:e=>e[f])(n),s=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",a="string"==typeof y?y:null,l=a?null==n?void 0:n[a]:null;return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[o&&e("div",{style:{fontWeight:600,marginBottom:2},children:o}),r&&null!=i&&t("div",{children:[t("span",{style:{opacity:.7},children:[r,": "]}),s(i)]}),a&&null!=l&&t("div",{children:[t("span",{style:{opacity:.7},children:[a,": "]}),l+""]}),!o&&!r&&Object.entries(n).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,": "]}),s(n)]},e))]})},[f,y]),ce=$o(T,s.width,s.height),ue=ce?null:Co(c,s.width,s.height,W);zo("ProportionalSymbolMap",Y,"xAccessor",d),zo("ProportionalSymbolMap",Y,"yAccessor",h);const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:b},null!=c&&{points:Y}),{xAccessor:d,yAccessor:h,pointStyle:ne}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),Z&&{areas:Z,areaStyle:$}),null!=v&&{graticule:v}),null!=x&&{fitPadding:x}),U&&{zoomable:!0}),w&&{zoomExtent:w}),k&&{onZoom:k}),null!=j&&{dragRotate:j}),O&&{tileURL:O}),S&&{tileAttribution:S}),M&&{tileCacheSize:M}),{size:[s.width,s.height],margin:se,enableHover:!0,tooltipContent:!1===z?()=>null:On(z)||le}),ie&&{legend:ie,legendPosition:ae}),_&&"none"!==_&&{legendHoverBehavior:re.onLegendHover,legendClickBehavior:re.onLegendClick,legendHighlightedCategory:re.highlightedCategory,legendIsolatedCategories:re.isolatedCategories}),(R||D||N)&&{customHoverBehavior:Q}),(D||N)&&{customClickBehavior:K}),P&&P.length>0&&{annotations:P}),s.title&&{title:s.title}),s.description&&{description:s.description}),s.summary&&{summary:s.summary}),void 0!==s.accessibleTable&&{accessibleTable:s.accessibleTable}),B&&{className:B}),null!=n.animate&&{animate:n.animate}),H);return ce||ue||e(Oo,{componentName:"ProportionalSymbolMap",width:s.width,height:s.height,children:e(xn,Object.assign({ref:r},de))})});function Fo(n){const o=Qn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:r,nodes:s,nodeIdAccessor:a="id",xAccessor:c="lon",yAccessor:u="lat",valueAccessor:d="value",projection:h="equalEarth",graticule:p,fitPadding:f,zoomable:g,zoomExtent:y,onZoom:m,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:A,lineType:w="geo",flowStyle:k="basic",areas:j,areaStyle:S={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:M,edgeOpacity:C=.6,edgeWidthRange:$=[1,8],edgeLinecap:z="round",colorScheme:P,showParticles:L,particleStyle:B,tooltip:I,annotations:R,margin:D,className:N,selection:E,linkedHover:T,onObservation:W,onClick:_,chartId:F,loading:H,emptyContent:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=n,Y=null!=g?g:!!v,X=Eo(j),Q=Hn(T),K=Wn({name:(null==E?void 0:E.name)||"__unused__"}),J=_n({name:(null==Q?void 0:Q.name)||"hover",fields:(null==Q?void 0:Q.fields)||[]}),ee=Tn(e=>e.pushObservation),te=E?{isActive:K.isActive,predicate:K.predicate}:null,ne=r||[],oe=s||[],re=Un(ne,M,P),ie=i(()=>{const e=new Map;for(const t of oe)e.set(t[a]+"",t);return e},[oe,a]),se=i(()=>{const e=new Map;for(const t of ne)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[ne]),ae=l(e=>{var t,n;if(T)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=se.get(t[a]+"");e&&J.onHover(e)}else J.onHover(t)}else J.onHover(null);if(W||ee){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:F};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},o),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});W&&W(i),ee&&ee(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});W&&W(e),ee&&ee(e)}}},[T,J,a,se,W,F,ee]),le=l(e=>{var t,n,o,r;if(e&&_){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),_(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(e&&(W||ee)){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n={timestamp:Date.now(),chartType:"FlowMap",chartId:F,type:"click",datum:t||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0};W&&W(n),ee&&ee(n)}},[_,W,ee,F]),ce=i(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];return ne.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ie.get(n.source+""),r=ie.get(n.target+"");return o&&r?Object.assign(Object.assign({},n),{coordinates:[{[c]:e(o),[u]:t(o)},{[c]:e(r),[u]:t(r)}]}):null}).filter(Boolean)},[ne,ie,c,u]),ue=i(()=>{const e=ne.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[d])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>$[0]:O().domain([Math.min(...e),Math.max(...e)]).range($)},[ne,d,$]),de=i(()=>e=>{var t;return{stroke:M?zn(e,M,re):Vn,strokeWidth:ue(null!==(t=e[d])&&void 0!==t?t:0),strokeLinecap:z,opacity:C}},[M,re,ue,d,C,z]),he=Po(E),pe=i(()=>{const e=Jn(de,{stroke:V,strokeWidth:U,opacity:Z});if(!te)return e;const t=Object.assign(Object.assign({},(null==he?void 0:he.unselectedStyle)||{}),{fillOpacity:0});return qn(e,te,Object.assign(Object.assign({},he||{}),{unselectedStyle:t}))},[de,te,he,V,U,Z]),fe=i(()=>Jn(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:V,strokeWidth:U,opacity:Z}),[V,U,Z]),ge=i(()=>n=>{var o,r,i,s,l,c,u;if((null==n?void 0:n.geometry)||(null==n?void 0:n.properties)||(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.geometry)){const t=(null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r.name)||(null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||(null===(l=null===(s=null==n?void 0:n.data)||void 0===s?void 0:s.properties)||void 0===l?void 0:l.name)||(null===(u=null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.properties)||void 0===u?void 0:u.NAME);if(t)return e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:t})})}if(null!=(null==n?void 0:n.source)&&null!=(null==n?void 0:n.target)){const o=n[d];return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t("div",{style:{fontWeight:600},children:[n.source," → ",n.target]}),null!=o&&e("div",{style:{opacity:.7},children:"number"==typeof o?o.toLocaleString():o})]})}const h=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n[a]);return null!=h?e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:h})}):null},[d,a]),ye=i(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof D?{top:D,bottom:D,left:D,right:D}:D),[D]),me=$o(H,o.width,o.height),be=me?null:Co(r,o.width,o.height,q),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h,lines:ce,points:oe,xAccessor:c,yAccessor:u,lineDataAccessor:"coordinates",lineType:w,flowStyle:k,lineStyle:pe,pointStyle:fe},X&&{areas:X,areaStyle:S}),null!=p&&{graticule:p}),null!=f&&{fitPadding:f}),Y&&{zoomable:!0}),y&&{zoomExtent:y}),m&&{onZoom:m}),null!=b&&{dragRotate:b}),L&&{showParticles:L}),B&&{particleStyle:B}),v&&{tileURL:v}),x&&{tileAttribution:x}),A&&{tileCacheSize:A}),{size:[o.width,o.height],margin:ye,enableHover:!0,tooltipContent:!1===I?()=>null:On(I)||ge}),(T||W||_)&&{customHoverBehavior:ae}),(W||_)&&{customClickBehavior:le}),R&&R.length>0&&{annotations:R}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),N&&{className:N}),null!=n.animate&&{animate:n.animate}),G);return me||be||e(Oo,{componentName:"FlowMap",width:o.width,height:o.height,children:e(xn,Object.assign({},ve))})}_o.displayName="ProportionalSymbolMap",Fo.displayName="FlowMap";const Ho=h(function(n,o){const r=Qn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:s,lines:c,xAccessor:h="lon",yAccessor:f="lat",nodeIdAccessor:g="id",center:y,costAccessor:m,strength:b=1,lineMode:v="straight",projection:x="mercator",graticule:A,fitPadding:w,zoomable:k,zoomExtent:j,onZoom:O,dragRotate:S,tileURL:M,tileAttribution:C,tileCacheSize:$,transition:z,colorBy:P,colorScheme:L,pointRadius:B=5,tooltip:I,showRings:R=!0,ringStyle:D,showNorth:N=!0,costLabel:E,annotations:T,margin:W,className:_,selection:F,linkedHover:H,onObservation:q,onClick:G,chartId:V,loading:U,emptyContent:Z,legendPosition:Y,frameProps:X={},stroke:Q,strokeWidth:K,opacity:J}=n,ee=null!=k?k:!!M,te=s||[],{activeSelectionHook:ne,customHoverBehavior:oe,customClickBehavior:re}=Zn({selection:F,linkedHover:H,fallbackFields:P?["string"==typeof P?P:""]:[],onObservation:q,onClick:G,chartType:"DistanceCartogram",chartId:V}),ie=Po(F),se=Un(te,P,L),ae=i(()=>{const e=Jn(e=>({fill:P?zn(e,P,se):Vn,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:B}),{stroke:Q,strokeWidth:K,opacity:J});return ne?qn(e,ne,ie):e},[P,se,B,ne,ie,Q,K,J]),{legend:le,margin:ce,legendPosition:ue}=Yn({data:te,colorBy:P,colorScale:se,showLegend:r.showLegend,legendPosition:Y,userMargin:W,defaults:{top:10,bottom:10,left:10,right:10}}),de=i(()=>({center:y,centerAccessor:g,costAccessor:m,strength:b,lineMode:v}),[y,g,m,b,v]),he=i(()=>{if(!c)return;const e="function"==typeof h?h:e=>e[h],t="function"==typeof f?f:e=>e[f],n=new Map;for(const e of te)n.set(e[g]+"",e);return c.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),i=n.get(o.target+"");return r&&i?Object.assign(Object.assign({},o),{coordinates:[{[h]:e(r),[f]:t(r)},{[h]:e(i),[f]:t(i)}]}):null}).filter(Boolean)},[c,te,h,f,g]),pe=i(()=>n=>{const o=("function"==typeof m?m:e=>e[m])(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:n[g]||n.name||n.id||"Point"}),null!=o&&t("div",{style:{opacity:.7},children:["Cost: ","number"==typeof o?o.toFixed(1):o]})]})},[m,g]),fe=a(null);p(o,()=>({push:e=>{var t;return null===(t=fe.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=fe.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=fe.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,r;const i=null!==(o=null===(n=fe.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of i)null===(r=fe.current)||void 0===r||r.push(t(e));return i},clear:()=>{var e;return null===(e=fe.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=fe.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[ge,ye]=u(null),me=l(()=>{var e,t;const n=null===(t=null===(e=fe.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ye(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);d(()=>{const e=requestAnimationFrame(me);return()=>cancelAnimationFrame(e)},[me,b,y,r.width,r.height,te]);const be=i(()=>{if(!R||!ge)return[];const{maxCost:e}=ge;if(0>=e)return[];if(Array.isArray(R))return R.filter(t=>t>0&&e>=t);const t="number"==typeof R?R:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[R,ge]),ve=i(()=>{var n,o;if(!ge)return X.foregroundGraphics||null;const{cx:r,cy:i,maxCost:s,availableRadius:a}=ge,l=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},D),c=null!==(n=ce.left)&&void 0!==n?n:10,u=null!==(o=ce.top)&&void 0!==o?o:10;return t("g",{children:[be.map(n=>{const o=n/s*a;return t("g",{children:[e("circle",{cx:r+c,cy:i+u,r:o,fill:"none",stroke:l.stroke,strokeWidth:l.strokeWidth,strokeDasharray:l.strokeDasharray,opacity:.5}),t("text",{x:r+c+o+3,y:i+u-2,fontSize:l.labelSize,fill:l.labelColor,fontFamily:"system-ui, sans-serif",children:[n,E?" "+E:""]})]},n)}),N&&t("g",{transform:`translate(${c+24}, ${u+24})`,children:[e("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),X.foregroundGraphics]})},[ge,be,N,E,D,ce,X.foregroundGraphics]),xe=$o(U,r.width,r.height),Ae=xe?null:Co(s,r.width,r.height,Z);zo("DistanceCartogram",te,"xAccessor",h),zo("DistanceCartogram",te,"yAccessor",f);const we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:x},null!=s&&{points:te}),he&&{lines:he,lineDataAccessor:"coordinates"}),{xAccessor:h,yAccessor:f,pointIdAccessor:g,pointStyle:ae,projectionTransform:de}),z&&{transition:{duration:z}}),null!=A&&{graticule:A}),null!=w&&{fitPadding:w}),ee&&{zoomable:!0}),j&&{zoomExtent:j}),O&&{onZoom:O}),null!=S&&{dragRotate:S}),M&&{tileURL:M}),C&&{tileAttribution:C}),$&&{tileCacheSize:$}),{size:[r.width,r.height],margin:ce,enableHover:!0,tooltipContent:!1===I?()=>null:On(I)||pe}),le&&{legend:le,legendPosition:ue}),(H||q||G)&&{customHoverBehavior:oe}),(q||G)&&{customClickBehavior:re}),T&&T.length>0&&{annotations:T}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),_&&{className:_}),null!=n.animate&&{animate:n.animate}),X),ve&&{foregroundGraphics:ve});return xe||Ae||e(Oo,{componentName:"DistanceCartogram",width:r.width,height:r.height,children:e(xn,Object.assign({ref:fe},we))})});function qo(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})}Ho.displayName="DistanceCartogram";export{Wo as ChoroplethMap,Ho as DistanceCartogram,Fo as FlowMap,_o as ProportionalSymbolMap,xn as StreamGeoFrame,qo as mergeData,No as resolveReferenceGeography};
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useContext as l,useCallback as s,useSyncExternalStore as a,createContext as c,useState as u,useEffect as d,useLayoutEffect as h,forwardRef as f,useImperativeHandle as p,useId as g}from"react";import{geoPath as y,geoGraticule as v,geoDistance as m,geoInterpolate as b,geoEqualEarth as x,geoEquirectangular as k,geoNaturalEarth1 as w,geoOrthographic as j,geoAlbersUsa as O,geoMercator as S}from"d3-geo";import{scaleLinear as M,scaleOrdinal as A,scaleSequential as C}from"d3-scale";import{quadtree as z}from"d3-quadtree";import{bin as P,extent as L}from"d3-array";import{packEnclose as I}from"d3-hierarchy";import{area as D,curveCatmullRom as $,curveCardinal as R,curveBasis as W,curveStepBefore as B,curveStepAfter as T,curveStep as N,curveMonotoneY as E,curveMonotoneX as _,curveLinear as H,curveNatural as F,line as q}from"d3-shape";import G from"regression";import{zoomIdentity as V,zoom as U}from"d3-zoom";import{select as Z}from"d3-selection";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 i=0;this._size>i;i++){const r=(o+i)%this._capacity,l=this.buffer[r];if(e(l)){let e;e="object"!=typeof l||null===l?l:Array.isArray(l)?[...l]:Object.assign({},l),n.push(e),this.buffer[r]=t(l)}}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 X(e,t,n){return e+(t-e)*n}function Q(e,t,n){var o,i,r;if(1>=n)return 1;const l=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return l+(1-s/(n-1))*(1-l);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return l+Math.pow(.5,s/t)*(1-l)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>s?1:l;default:return 1}}const K={mercator:S,equalEarth:x,albersUsa:O,orthographic:j,naturalEarth:w,equirectangular:k};function J(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function ee(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function te(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function ne(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let i=[e[0]];for(let t=1;e.length>t;t++){const r=e[t];Math.abs(r[0]-e[t-1][0])>n?(2>i.length||o.push(i),i=[r]):i.push(r)}return 2>i.length||o.push(i),o}function oe(e,t,n=24){const o=t[0]-e[0],i=t[1]-e[1],r=Math.sqrt(o*o+i*i);if(0===r)return[e,t];const l=-i/r,s=o/r,a=Math.min(.3*r,80),c=(e[0]+t[0])/2+l*a,u=(e[1]+t[1])/2+s*a,d=[];for(let o=0;n>=o;o++){const i=o/n,r=1-i;d.push([r*r*e[0]+2*r*i*c+i*i*t[0],r*r*e[1]+2*r*i*u+i*i*t[1]])}return d}function ie(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const i=e[t];let r,l;0===t?(r=e[1][0]-i[0],l=e[1][1]-i[1]):t===e.length-1?(r=i[0]-e[t-1][0],l=i[1]-e[t-1][1]):(r=e[t+1][0]-e[t-1][0],l=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(r*r+l*l)||1;o.push([i[0]+l/s*n,i[1]+-r/s*n])}return o}function re(e,t,n,o,i){const r=t[0]-e[0],l=t[1]-e[1],s=Math.sqrt(r*r+l*l);if(0===s)return[e,t];const a=l/s,c=-r/s,u=i/2+1;return[[e[0]+a*u,e[1]+c*u],[t[0]+a*u,t[1]+c*u]]}class le{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 x();if("string"==typeof e){const t=K[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),x())}if("object"==typeof e&&"type"in e){const t=K[e.type],n=t?t():x();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=y(this.projection),this.fitProjection(e),this.geoPath=y(this.projection);const n=this.projection;this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null};const o=this.scene;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&o.length>0&&this.startTransition(o),this.version++}fitProjection(e){var t,n,o,i,r;const l=this.projection,s=this.config,a=[...this.areas],c=J(s.xAccessor,"lon"),u=J(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=ee(s.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)]);a.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==a.length){if(s.projectionExtent){const[[t,n],[o,i]]=s.projectionExtent;l.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,i],[t,i],[t,n]]]}})}else if(l.clipAngle&&(null!==(t=l.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);l.scale(o/2-o*t),l.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,i=e.height*t;l.fitExtent([[n,i],[e.width-n,e.height-i]],{type:"FeatureCollection",features:a})}this.baseScale=l.scale(),this.baseTranslate=l.translate(),this.baseRotation=null!==(r=null===(i=l.rotate)||void 0===i?void 0:i.call(l))&&void 0!==r?r:[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=y(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=y(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;n&&n.rotate&&(n.rotate(e),this.geoPath=y(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,le.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=z().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,n,o;const i=[],{config:r}=this,l=this.projection,s=this.geoPath,a=J(r.xAccessor,"lon"),c=J(r.yAccessor,"lat"),u=function(e){var t,n;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.surface)||"#e0e0e0",stroke:(null===(n=e.themeSemantic)||void 0===n?void 0:n.border)||"#999",strokeWidth:.5,fillOpacity:1}}(r),d=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(r),h=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(r);if(r.graticule){const t=!0===r.graticule?{}:r.graticule,n=v();t.step&&n.step(t.step);const o=s(n())||"";o&&i.push({type:"geoarea",pathData:o,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=s(e);if(!t)continue;const n=s.centroid(e),o=s.bounds(e),l=s.area(e),a=te(r.areaStyle,e,u);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:l,style:a,datum:e,interactive:!0})}const f=ee(r.lineDataAccessor);for(const t of this.lineData){const n=f(t);if(!n||2>n.length)continue;let o=[];if("geo"===r.lineType){const e=Array(n.length);for(let t=0;n.length>t;t++)e[t]=[a(n[t]),c(n[t])];for(let t=0;e.length-1>t;t++){const n=e[t],i=e[t+1],r=m(n,i)||0,s=Math.max(2,Math.ceil(r/(Math.PI/180))),a=b(n,i);for(let e=0;s>=e;e++){if(t>0&&0===e)continue;const n=l(a(e/s));null!=n&&o.push(n)}}}else for(let e=0;n.length>e;e++){const t=n[e],i=l([a(t),c(t)]);null!=i&&o.push(i)}if(2>o.length)continue;const s=te(r.lineStyle,t,d),u="number"==typeof s.strokeWidth?s.strokeWidth:1;2!==n.length||2>o.length||"arc"!==r.flowStyle?2!==n.length||2>o.length||"offset"!==r.flowStyle||(o="geo"===r.lineType?ie(o,u):re(o[0],o[o.length-1],0,0,u)):o=oe(o[0],o[o.length-1]);const h=ne(o,e.width);if(h.length>1)for(const e of h){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},s),{_edgeFade:!0}),datum:t};i.push(n)}else i.push({type:"line",path:2>o.length&&h[0]||o,style:s,datum:t})}const p=this.getPoints(),g=r.pointIdAccessor?"function"==typeof r.pointIdAccessor?r.pointIdAccessor:e=>e[r.pointIdAccessor]:null,y=l.clipAngle&&null!==(t=l.clipAngle())&&void 0!==t?t:0,x=y>0?y*Math.PI/180:null,k=l.rotate?l.rotate():[0,0,0],w="function"==typeof l.center?l.center():[0,0],j=[(null!==(n=w[0])&&void 0!==n?n:0)-k[0],(null!==(o=w[1])&&void 0!==o?o:0)-k[1]];for(let e=0;p.length>e;e++){const t=p[e],n=a(t),o=c(t);if(null!=x&&m([n,o],j)>x)continue;const s=l([n,o]);if(!s)continue;const u=r.pointStyle?r.pointStyle(t):Object.assign({},h),d={type:"point",x:s[0],y:s[1],r:u.r||4,style:u,datum:t,pointId:g?g(t)+"":void 0};i.push(d)}return i}applyCartogramTransform(e,t){var n,o,i;const r=this.scene.filter(e=>"point"===e.type);if(2>r.length)return;const l=null!==(n=e.strength)&&void 0!==n?n:1;if(0===l)return;const s=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,a="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=r.find(t=>t.datum&&s(t.datum)+""==e.center+"");if(!c)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const u=c.x,d=c.y,h=r.map(e=>e.datum?a(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),f=Math.max(...h,1),p=Math.min(t.width,t.height)/2,g=M().domain([0,f]).range([0,p]);this.cartogramLayout={cx:u,cy:d,maxCost:f,availableRadius:p},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 r){if(e===c)continue;if(!e.datum)continue;const t=Math.atan2(e.y-d,e.x-u),n=Math.sqrt(Math.pow(e.x-u,2)+Math.pow(e.y-d,2)),o=a(e.datum),i=n+((isFinite(o)?g(o):n)-n)*l;e.x=u+Math.cos(t)*i,e.y=d+Math.sin(t)*i}const y=t.width/2,v=t.height/2,m=y-c.x,b=v-c.y;if(Math.abs(m)>.5||Math.abs(b)>.5)for(const e of r)e.x+=m,e.y+=b;this.cartogramLayout={cx:y,cy:v,maxCost:f,availableRadius:p};const x=this.scene.filter(e=>"line"===e.type);if(x.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of r)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of x){const n=null===(o=t.datum)||void 0===o?void 0:o.source,r=null===(i=t.datum)||void 0===i?void 0:i.target;if(n&&r){const o=e.get(n+""),i=e.get(r+"");o&&i&&(t.path=[o,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 i=Q(e,o,t);n[o]._decayOpacity=i,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:i})}}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,i=performance.now(),r=this.scene.filter(e=>"point"===e.type),l=this.timestampBuffer.toArray();for(let e=0;r.length>e&&l.length>e;e++){const s=i-l[e];o>s&&(r[e]._pulseIntensity=1-s/o,r[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",r[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 i=new Map;for(const t of e)"point"===t.type&&t.pointId&&i.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let l=!1;for(const e of r)if(e.pointId){const t=i.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)&&(l=!0))}l&&(this.activeTransition={startTime:performance.now(),duration:o})}cancelIntroAnimation(){this.activeTransition=null}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=X(e.x,e._targetX,n),e.y=X(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 se(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ae(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function ce(e,t){const n=ae(e);if(!n)return!1;const o=ae(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function ue(e,t,n,o,i,r,l=0){if(r){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),l=t-r,s=t+r,a=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,f)=>{if(i>s||l>h||r>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,l=e.y-n,s=Math.sqrt(r*r+l*l);se(e.r,o)>=s&&d>s&&(u=e,d=s),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,l);if(e)return e}else{let i=null,r=o;for(const l of e){if("point"!==l.type)continue;const e=l.x-t,s=l.y-n,a=Math.sqrt(e*e+s*s);se(l.r,o)>=a&&r>a&&(i=l,r=a)}if(i)return{node:i,distance:r}}for(let o=e.length-1;o>=0;o--){const r=e[o];if("geoarea"!==r.type)continue;const l=r;if(!1===l.interactive)continue;const[[s,a],[c,u]]=l.bounds;if(!(s>t||t>c||a>n||n>u)&&(l._cachedPath2D||(l._cachedPath2D=new Path2D(l.pathData)),i.isPointInPath(l._cachedPath2D,t,n)))return{node:l,distance:0}}let s=null,a=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:i}=e,r=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;i.length-1>o;o++){const[l,c]=i[o],[u,d]=i[o+1],h=de(t,n,l,c,u,d);r>=h&&a>h&&(s=e,a=h)}}return s?{node:s,distance:a}:null}function de(e,t,n,o,i,r){const l=i-n,s=r-o,a=l*l+s*s;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*l+(t-o)*s)/a;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*l),2)+Math.pow(t-u,2))}function he(t){let n=null;const o=()=>(n||(n=c(null)),n),u=fe(t);return[function({children:n,initialState:l}){const s=i(l),a=r(()=>fe(t,s.current),[]),c=o();return e(c.Provider,{value:a,children:n})},e=>{var t;const n=o(),r=null!==(t=l(n))&&void 0!==t?t:u,c=i(e);c.current=e;const d=s(()=>c.current(r.getState()),[r]),h=s(()=>c.current(r.getState()),[r]);return a(r.subscribe,d,h)}]}function fe(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function pe(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 ge(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:ye})})),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}le.QUADTREE_THRESHOLD=500;const ye=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],ve={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}},me={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},be={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ye,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function xe(e,t){if("light"===t)return ve;if("dark"===t)return me;if("high-contrast"===t)return be;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?me:ve;return ge(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 ge(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[ke,we]=he(e=>({theme:ve,setTheme(t){e(e=>({theme:xe(e.theme,t)}))}}));const je=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Oe=new WeakMap;let Se=0,Me=!1,Ae=null,Ce=null,ze=null;function Pe(e,t){var n,o;if(!t)return t;const i=je.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Me)return;if("undefined"==typeof window||"undefined"==typeof document)return;Me=!0;const e=()=>{Se++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ae=new MutationObserver(e),Ae.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Ce=window.matchMedia("(prefers-color-scheme: dark)"),ze=e,"function"==typeof Ce.addEventListener?Ce.addEventListener("change",ze):"function"==typeof Ce.addListener&&Ce.addListener(ze)}catch(e){}}();let l=Oe.get(r);l&&l.version===Se||(l={version:Se,map:new Map},Oe.set(r,l));const s=l.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return l.map.set(t,a),a}const Le="undefined"==typeof window?d:h;function Ie(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function De(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return d(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[l,a]=function(e,t,n){const o=i(null),[r,l]=u(null);return d(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),c=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=a[0]-c.left-c.right,f=a[1]-c.top-c.bottom,p=Ie(e.foregroundGraphics,a,c),g=Ie(e.backgroundGraphics,a,c),y=we(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="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:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=i(0),k=i(()=>{}),w=s(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);d(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const j=i(()=>{}),O=i(()=>{}),S=i(null),M=i(0),A=s(()=>{M.current=0;const e=S.current;S.current=null,e&&j.current(e)},[]),C=s(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===M.current&&(M.current=requestAnimationFrame(A))},[A]),z=s(()=>{S.current=null,0!==M.current&&(cancelAnimationFrame(M.current),M.current=0),O.current()},[]);d(()=>()=>{S.current=null,0!==M.current&&(cancelAnimationFrame(M.current),M.current=0)},[]);const P=e.themeDirtyRef;return Le(()=>{P&&(Se++,P.current=!0,w())},[y,w,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:l,size:a,margin:c,adjustedWidth:h,adjustedHeight:f,resolvedForeground:p,resolvedBackground:g,currentTheme:y,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:j,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:z}}const $e={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function Re(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,$e[n])(o(e,t)),i}function We(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Be(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Te=(n,o,i,r,l,s,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=n,g=[];let y=0;const v=!(!o&&!i),m="isolate"===d||void 0===d&&null!=l;return p.forEach((n,d)=>{const b=Re(n,d,h,f),x=Be(n,r,l),k=l&&l.size>0&&l.has(n.label);g.push(t("g",{transform:`translate(0,${y})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===s&&d===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?k||!1:void 0,"aria-current":v&&!m&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,k&&e(We,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),y+=22}),g};function Ne({config:n,orientation:i="vertical",width:r=100}){const{colorFn:l,domain:s,label:a,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:l(s[0]+n*(s[1]-s[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),a&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:l(s[1]-n*(s[1]-s[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[a&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])})]})}function Ee(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:f="vertical"}=n,[p,g]=o.useState(0),[y,v]=o.useState(0),m=o.useCallback((e,t)=>{g(e),v(t)},[]),b="vertical"===f?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,f)=>{d+=5,h.push(e("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,t.label&&(d+=16,h.push(e("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),d+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${d})`,children:Te(t,o,i,r,l,s,a,f,c,u)},"legend-group-"+f)),d+=22*t.items.length+8}),h})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let f=0;const p=[];n.forEach((n,o)=>{let g=0;n.label&&(g+=16);const y=((n,o,i,r,l,s,a,c,u,d,h)=>{const{type:f="fill",styleFn:p,items:g}=n,y=[];let v=0,m=0;const b=!(!o&&!i),x="isolate"===d||void 0===d&&null!=l;g.forEach((n,d)=>{const k=Re(n,d,f,p),w=Be(n,r,l),j=l&&l.size>0&&l.has(n.label),O=26+7*n.label.length;h&&h>0&&v>0&&v+O>h&&(m++,v=0),y.push(t("g",{transform:`translate(${v},${22*m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===s&&d===a?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?j||!1:void 0,"aria-current":b&&!x&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+g.length)%g.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,j&&e(We,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),v+=O});let k=0,w=0;for(const e of g){const t=26+7*e.label.length;h&&h>0&&w>0&&w+t>h?(k=Math.max(k,w),w=t):w+=t}k=Math.max(k,w);const j=m+1;return{items:y,offset:k,totalRows:j,totalHeight:22*j}})(n,r,l,s,a,c,u,o,d,h,i);g+=y.offset+5,p.push(Object.assign(Object.assign({label:n.label},y),{offset:g,totalRows:y.totalRows,totalHeight:y.totalHeight})),f+=g+12});let g=f>i?0:Math.max(0,(i-f)/2);const y=[];return p.forEach((t,i)=>{const r=n[i];r.label&&(y.push(e("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),g+=16),y.push(e("g",{className:"legend-item",transform:`translate(${g},0)`,children:t.items},"legend-group-"+i)),g+=t.offset+5,n[i+1]&&y.push(e("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),g+=12}),e("g",{children:y})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}),x=!(!r&&!l);return t("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===f&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function _e(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function He(t){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:l="right",title:s,legendHoverBehavior:a,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const f="top"===l||"bottom"===l;let p,g;return"left"===l?(p=4,g=r.top):"top"===l?(p=0,g=s?32:8):"bottom"===l?(p=0,g=i-r.bottom+50):(p=o-r.right+10,g=r.top),e("g",{transform:`translate(${p}, ${g})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e(Ne,{config:n.gradient,orientation:f?"horizontal":"vertical",width:f?o:100}):_e(n)?e(Ee,{legendGroups:n.legendGroups,title:"",width:f?o:100,orientation:f?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function Fe(e){return"string"==typeof e?{type:e}:e}function qe({orient:n,config:o,values:i,scale:l,size:s,length:a}){const c=function(e){var t,n,o,i,r;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!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=r(()=>{if(0===i.length)return null;const o=l.domain(),r=s-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],l=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*l),whiskerHigh:Math.min(t[n-1],r+1.5*l)}}(i);if(!o)return null;const{q1:s,median:a,q3:d,whiskerLow:h,whiskerHigh:f}=o,p=Math.min(.5*r,20),g=(r-p)/2+4;if(u){const o=l(s),i=l(d),r=l(a),u=l(h),y=l(f),v="top"===n?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:m+v*(g+p/2),x2:y,y2:m+v*(g+p/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:m+v*g,x2:u,y2:m+v*(g+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:m+v*g,x2:y,y2:m+v*(g+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?m-g-p:m+g,width:Math.abs(i-o),height:p,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?m-g-p:m+g,x2:r,y2:"top"===n?m-g:m+g+p,stroke:c.fill,strokeWidth:2})]})}{const o=l(s),i=l(d),r=l(a),u=l(h),y=l(f),v="left"===n?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:m+v*(g+p/2),y1:u,x2:m+v*(g+p/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*g,y1:u,x2:m+v*(g+p),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*g,y1:y,x2:m+v*(g+p),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?m-g-p:m+g,y:Math.min(o,i),width:p,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?m-g-p:m+g,y1:r,x2:"left"===n?m-g:m+g+p,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=P().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=l(t.x0),s=l(t.x1)-l(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(s,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=l(t.x0),s=l(t.x1)-l(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+s),width:i,height:Math.abs(s),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),s=l((e.x0+e.x1)/2);o.push(u?`${s},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${s}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const s=i.length/h*(r/2),a=l((i.x0+i.x1)/2);o.push(u?`${a},${"top"===n?-(t+s):t+s}`:`${"left"===n?-(t+s):t+s},${a}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?l(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=l((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?l(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=l((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,l,c,s,a,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function Ge(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let l="";for(const e of i)l&&l.length+1+e.length>o?(r.push(l),l=e):l=l?`${l} ${e}`:e;return l&&r.push(l),r}function Ve(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(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:l,title:s,orientation:a,align:c,wrap:u=120,noWrap:d}=n;if(!l&&!s)return e("g",{className:"annotation-note"});let h=a;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let f=c;f&&"dynamic"!==f||(f="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let p="start";"topBottom"===h?"right"===f?p="end":"middle"===f&&(p="middle"):p=0>o?"end":"start";const g=16,y=s?d?[s]:Ge(s,u):[],v=l?d?[l]:Ge(l,u):[],m="leftRight"===h?"end"===p?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:p,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-title")),b=y.length*g),v.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:p,y:b,children:v.map((t,n)=>e("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-label"));let w=null;if((s||l)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+v.length)*g+(v.length>0?g:0);let n=0,o=t;"bottom"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const j=Math.max(0,y.length+v.length-1)*g;let O=0;return"topBottom"===h?O=0>i?-(j+2):18:"leftRight"===h&&(O="middle"===f?-(j+g+(v.length>0&&y.length>0?2:0))/2+8:"bottom"===f||0>i?-(j+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),w]})}function Ze(t,n,o,i,r){var l;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e("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,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&s.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,l=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;s.push(e("line",{x1:i,y1:(n.y1||0)-l,x2:i,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-l;s.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,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)?s.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e("line",{x1:0,y1:(n.y1||0)-l,x2:0,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(l=null==n?void 0:n.width)&&void 0!==l?l:null==n?void 0:n.height;void 0!==t&&s.push(e("path",{d:Ve((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:s})}function Ye(t,n,o,i,r,l){const s=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==l?void 0:l.radius)){if("callout-rect"===r&&l){const e=l.width||0,o=l.height||0;if(e>0||o>0){const i=e/2,r=o/2,l=t-i,s=n-r;if(0!==l||0!==s){const t=Math.abs(l),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;a=i+l*h,c=r+s*h}}}else if("bracket"===r&&l){const e=l.width,t=l.height,n=l.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=n,c=t/2)}}else{const e=(l.radius||0)+(l.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(s.push(e("line",{x1:a,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,l=Math.atan2(n-c,t-a);s.push(e("path",{d:`M${a},${c}L${a+o*Math.cos(l+r)},${c+o*Math.sin(l+r)}L${a+o*Math.cos(l-r)},${c+o*Math.sin(l-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e("g",{className:"annotation-connector",children:s})}function Xe(e){const{x:n=0,y:o=0,dx:i,dy:r,nx:l,ny:s,note:a,connector:c,subject:u,type:d,color:h,className:f,disable:p,events:g={},"data-testid":y}=e,v=new Set(Array.isArray(p)?p:[]);let m=i||0,b=r||0;null!=l&&(m=l-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===m&&0===b)if(void 0!==u.width){m=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;m=e+(0>e?-5:5),b=u.height/2}return t("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},g,{children:[!v.has("connector")&&Ye(m,b,c,h,x,u),!v.has("subject")&&Ze(x,u,h,n,o),!v.has("note")&&Ue(a,m,b,h)]}))}function Qe(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,l="string"==typeof i.type?i.type:"label",s=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),s=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e(Xe,Object.assign({"data-testid":"semiotic-annotation"},r,{type:l}),"multi-annotation-"+o)});return e("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e(Xe,Object.assign({"data-testid":"semiotic-annotation",events:s},i,{type:l}),c)}function Ke(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Je(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function et(e,t,n){var o,i,r,l;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,l;const s=e.data;if(!s||0===s.length)return null;const a=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!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let a=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,c=t.y)}if(null!=a&&null!=c||(a=Ke(e,n),c=Je(e,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:a,y:c}),{x:a,y:c};if("sticky"===s){const e=null===(l=n.stickyPositionCache)||void 0===l?void 0:l.get(t);if(e)return e}return null}function tt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const nt={linear:H,monotoneX:_,monotoneY:E,step:N,stepAfter:T,stepBefore:B,basis:W,cardinal:R,catmullRom:$};let ot={positions:new Map};const it=new Set;function rt(){for(const e of it)e()}function lt(e,t){const n=ot.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(ot.positions);o.delete(e),ot={positions:o},rt()}function st(e,t){const n=ot.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(ot.positions);o.delete(e),ot={positions:o},rt()}function at(){return ot}function ct(e){return it.add(e),()=>it.delete(e)}const ut={positions:new Map};function dt(){return()=>{}}function ht(){return ut}function ft(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function pt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let l="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);l+=`L${Math.min(8*e+4,t)},${o+4*i}`,l+=`L${Math.min(n,t)},${o}`}return l}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let l=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);l+=`L${o+4*i},${Math.min(8*e+4,n)}`,l+=`L${o},${Math.min(t,n)}`}return l}}function gt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function yt(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 vt(o){var l,s;const{width:c,height:u,totalWidth:h,totalHeight:f,margin:p,scales:g,showAxes:y,axes:v,xLabel:m,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,showGrid:j,title:O,legend:S,legendHoverBehavior:M,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:z,legendPosition:P="right",foregroundGraphics:L,marginalGraphics:$,xValues:R,yValues:W,annotations:B,svgAnnotationRules:T,xAccessor:N,yAccessor:E,annotationData:_,pointNodes:F,curve:q,underlayRendered:V,canvasObscuresUnderlay:U=!0,linkedCrosshairName:Z,linkedCrosshairSourceId:Y,children:X}=o,Q=r(()=>{var e;if(!y||!g)return[];const t=null==v?void 0:v.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||k||gt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=g.x.ticks(Math.min(o,Math.max(2,Math.floor(c/70)))),r=i.map(e=>e.valueOf()),l=i.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,r)})),s=l.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),a=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(s+8,55)):Math.max(55,s+8);let u=yt(l,a);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=g.x.domain()[1],t=g.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,u.length,r);a>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:i})}}return u},[y,g,v,k,c]),K=r(()=>{var e;if(!y||!g)return[];const t=null==v?void 0:v.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||w||gt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=yt(g.y.ticks(Math.min(o,Math.max(2,Math.floor(u/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22);if(i.length>1&&(i=i.filter((e,t)=>0===t||e.label+""!=i[t-1].label+"")),(null==t?void 0:t.includeMax)&&i.length>0){const e=g.y.domain()[1],t=g.y(e),o=i[i.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e);22>Math.abs(t-o)&&i.length>1&&(i=i.slice(0,-1)),i.push({value:e,pixel:t,label:r})}}return i},[y,g,v,w,u]),J=r(()=>{var e;if(!y||!g)return[];const t=null==v?void 0:v.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||w||gt,o=null!==(e=t.ticks)&&void 0!==e?e:5;return yt(g.y.ticks(Math.min(o,Math.max(2,Math.floor(u/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22)},[y,g,v,w,u]),ee=i(new Map),te=i(null!==(l=null==B?void 0:B.length)&&void 0!==l?l:0),ne=null!==(s=null==B?void 0:B.length)&&void 0!==s?s:0;te.current!==ne&&(te.current=ne,ee.current=new Map);const oe=r(()=>{if(!B||0===B.length)return null;const n=function(n,o,i){var r,l,s,a,c,u,d,h,f,p,g,y,v,m,b,x,k,w,j,O,S,M,A,C,z,P,L,$,R,W,B,T,N,E,_,F,q,V,U,Z,Y,X,Q,K,J,ee,te,ne;switch(n.type){case"label":{const t=et(n,o,i);if(!t)return null;const{x:r,y:l}=t;return tt(r,l,i)?e(Qe,{noteData:{x:r,y:l,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const t=et(n,o,i);if(!t)return null;const{x:r,y:l}=t;return tt(r,l,i)?e(Qe,{noteData:{x:r,y:l,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=Ke(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,i);if(null==r)return null;const l=n.color||"#f97316",s=n.labelPosition||"top";let a;return a="bottom"===s?(i.height||0)-4:"center"===s?(i.height||0)/2:12,t("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:r+4,y:a,fill:l,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Je(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,i);if(null==r)return null;const l=n.color||"#f97316",s=n.labelPosition||"right";let a,c;return"left"===s?(a=4,c="start"):"center"===s?(a=(i.width||0)/2,c="middle"):(a=(i.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:a,y:r-4,textAnchor:c,fill:l,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:Ke(Object.assign(Object.assign({},e),{type:"point"}),i),y:Je(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const l=I(r),s=n.padding||10;return t("g",{children:[e("circle",{cx:l.x,cy:l.y,r:l.r+s,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:l.x,y:l.y-l.r-s-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:Ke(Object.assign(Object.assign({},e),{type:"point"}),i),y:Je(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const l=n.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),c=Math.min(...s)-l,u=Math.max(...s)+l,d=Math.min(...a)-l,h=Math.max(...a)+l;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const t=i.data||[],r="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],l={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,o)=>{const r=Ke(t,i),s=Je(t,i);if(null==r||null==s)return null;const a="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||l;return e("circle",Object.assign({cx:r,cy:s,r:a},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const t=Ke(n,i),r=Je(n,i);return e(Qe,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const f=i.xAccessor||"x",p=i.yAccessor||"y",g=h.map(e=>[e[f],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>g.length)return null;const y=null!==(l=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==l?l:null===(s=i.scales)||void 0===s?void 0:s.time,v=null!==(c=null===(a=i.scales)||void 0===a?void 0:a.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!y||!v)return null;const m=n.method||"linear";let b;b="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),l=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(l-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],f+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){s.push([t,r[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))s.push([t,h/u]);else{const e=(u*p-d*h)/g;s.push([t,(h-e*d)/u+e*t])}}return s}(g,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===m?G.polynomial(g,{order:n.order||2}):G.linear(g)).points;const x=b.map(([e,t])=>`${y(e)},${v(t)}`).join(" "),k=n.color||"#6366f1";return t("g",{children:[e("polyline",{points:x,fill:"none",stroke:k,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:y(b[b.length-1][0])+4,y:v(b[b.length-1][1])-4,fill:k,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(f=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==f?f:null===(p=i.scales)||void 0===p?void 0:p.value,l=null!==(g=null==r?void 0:r(n.y0))&&void 0!==g?g:0,s=null!==(y=null==r?void 0:r(n.y1))&&void 0!==y?y:i.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(l,s),width:i.width||0,height:Math.abs(s-l),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(l,s)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const l=i.xAccessor||"x",s=null!==(m=null===(v=i.scales)||void 0===v?void 0:v.x)&&void 0!==m?m:null===(b=i.scales)||void 0===b?void 0:b.time,a=null!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.value;if(!s||!a)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[l]-t[l]);if(2>h.length)return null;const f=nt[i.curve||"linear"]||H,p=D().x(e=>s(e[l])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!p)return null;const g=n.fill||"#6366f1";return t("g",{children:[e("path",{d:p,fill:g,fillOpacity:null!==(j=n.fillOpacity)&&void 0!==j?j:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:s(h[h.length-1][l])+4,y:a(h[h.length-1][c])-4,fill:g,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const l=i.yAccessor||"y",s=null!==(S=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(M=i.scales)||void 0===M?void 0:M.time,a=null!==(C=null===(A=i.scales)||void 0===A?void 0:A.y)&&void 0!==C?C:null===(z=i.scales)||void 0===z?void 0:z.value;if(!s||!a)return null;const c=r.map(e=>e[l]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),f=null!==(P=n.threshold)&&void 0!==P?P:2,p=u-f*h,g=!1!==n.showBand,y=n.fill||"#6366f1",v=null!==(L=n.fillOpacity)&&void 0!==L?L:.1,m=n.anomalyColor||"#ef4444",b=null!==($=n.anomalyRadius)&&void 0!==$?$:6,x=a(u+f*h),k=a(p),w=r.filter(e=>{const t=e[l];return null!=t&&Math.abs(t-u)>f*h});return t("g",{children:[g&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:v}),w.map((t,n)=>{const o=Ke(t,i),r=Je(t,i);return null==o||null==r?null:e("circle",{cx:o,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const l=i.xAccessor||"x",s=i.yAccessor||"y",a=null!==(W=null===(R=i.scales)||void 0===R?void 0:R.x)&&void 0!==W?W:null===(B=i.scales)||void 0===B?void 0:B.time,c=null!==(N=null===(T=i.scales)||void 0===T?void 0:T.y)&&void 0!==N?N:null===(E=i.scales)||void 0===E?void 0:E.value;if(!a||!c)return null;const u=r.map(e=>[e[l],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>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=G.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const l=(e*i-t*n)/r,s=(n-l*t)/e;d=e=>s+l*e}const h=u.length,f=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(f/Math.max(h-2,1)),g=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),v=null!==(_=n.confidence)&&void 0!==_?_:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,b=null!==(F=n.steps)&&void 0!==F?F:5,x=u[h-1][0],k=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const j=[];for(const e of w){const t=d(e),n=p*Math.sqrt(1+1/h+(y>0?Math.pow(e-g,2)/y:0))*m;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${j.map(e=>`${a(e.x)},${c(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${a(e.x)},${c(e.yLower)}`).join(" L")} Z`,S=j.map(e=>`${a(e.x)},${c(e.yCenter)}`).join(" "),M=`${a(x)},${c(d(x))}`,A=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(q=n.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e("polyline",{points:`${M} ${S}`,fill:"none",stroke:A,strokeWidth:null!==(V=n.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(U=n.strokeDasharray)&&void 0!==U?U:"6,3"}),n.label&&j.length>0&&e("text",{x:a(j[j.length-1].x)+4,y:c(j[j.length-1].yCenter)-4,fill:A,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let t=null,r=null;if(null!=n.px&&null!=n.py)t=n.px,r=n.py;else{const e=et(n,o,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!tt(t,r,i))return null;const l=null!==(Z=n.dx)&&void 0!==Z?Z:0,s=null!==(Y=n.dy)&&void 0!==Y?Y:0,a=null!==(X=n.width)&&void 0!==X?X:32,c=null!==(Q=n.height)&&void 0!==Q?Q:32,u=null!==(K=n.content)&&void 0!==K?K:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+l-a/2,y:r+s-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=et(n,o,i);if(!t)return null;const{x:r,y:l}=t;return e("text",{x:r+(n.dx||0),y:l+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const l=null===(J=i.scales)||void 0===J?void 0:J.o,s=null===(ee=i.scales)||void 0===ee?void 0:ee.x,a=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==l?void 0:l.bandwidth)?l:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!c)return null;const u=c(r);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",f=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return t("g",(i.projection?"vertical"===i.projection:c===s)?{children:[e("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:f}),p&&e("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:f}),p&&e("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:N,yAccessor:E,width:c,height:u,data:_,frameType:"xy",pointNodes:F,curve:q,stickyPositionCache:ee.current};return B.map((e,t)=>{if(T){const i=T(e,t,o);return null!=i?i:n(e,t,o)}return n(e,t,o)}).filter(Boolean)},[B,T,c,u,N,E,_,g,F,q]),ie=function(e){var t;const n=a(e?ct:dt,e?at:ht,e?at:ht);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(Z);return d(()=>{if(!(null==ie?void 0:ie.locked)||!Z)return;const e=e=>{"Escape"===e.key&&st(Z)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==ie?void 0:ie.locked,Z]),y||O||S||L||$||oe&&oe.length>0||j||X||ie?t("svg",{role:"img",width:h,height:f,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof O?O:"XY Chart"}),e("desc",{children:"string"==typeof O?O+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${p.left},${p.top})`,children:[j&&g&&(!V||U)&&(()=>{var n,o;const i=ft(null===(n=null==v?void 0:v.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=ft(null===(o=null==v?void 0:v.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[Q.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:u,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),K.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:c,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&g&&(()=>{const o=null==v?void 0:v.find(e=>"left"===e.orient),i=null==v?void 0:v.find(e=>"bottom"===e.orient),r=!o||!1!==o.baseline,l=!i||!1!==i.baseline,s=(null==o?void 0:o.jaggedBase)||!1,a=(null==i?void 0:i.jaggedBase)||!1,d=null==i?void 0:i.landmarkTicks,h=null==o?void 0:o.landmarkTicks,f="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",k=!!(null==i?void 0:i.autoRotate)&&Q.length>1&&(()=>{const e=c/Math.max(Q.length-1,1);return Q.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(!V||U)&&l&&!a&&e("line",{x1:0,y1:u,x2:c,y2:u,stroke:f,strokeWidth:1}),(!V||U)&&a&&e("path",{d:pt("bottom",c,u),fill:"none",stroke:f,strokeWidth:1}),Q.map((n,o)=>{const i=!!d&&("function"==typeof d?d(n.value,o):ce(n.value,o>0?Q[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${u})`,children:[e("line",{y2:5,stroke:f,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:k?10:18,textAnchor:k?"end":"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:g,style:{userSelect:"none"},transform:k?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"xtick-"+o)}),m&&e("text",{x:c/2,y:u+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:m}),(!V||U)&&r&&!s&&e("line",{x1:0,y1:0,x2:0,y2:u,stroke:f,strokeWidth:1}),(!V||U)&&s&&e("path",{d:pt("left",c,u),fill:"none",stroke:f,strokeWidth:1}),K.map((n,o)=>{const i=!!h&&("function"==typeof h?h(n.value,o):ce(n.value,o>0?K[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:f,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:g,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==o?void 0:o.label)||b;return t?e("text",{x:15-p.left,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-p.left}, ${u/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const o=null==v?void 0:v.find(e=>"right"===e.orient);if(!o||0===J.length)return null;const i=o.landmarkTicks,r=o.label||x;return t(n,{children:[!1!==o.baseline&&e("line",{x1:c,y1:0,x2:c,y2:u,stroke:f,strokeWidth:1}),J.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):ce(n.value,o>0?J[o-1].value:void 0));return t("g",{transform:`translate(${c},${n.pixel})`,children:[e("line",{x2:5,stroke:f,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:c+p.right-15,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${c+p.right-15}, ${u/2})`,style:{userSelect:"none"},children:r})]})})()]})})(),oe,$&&g&&R&&W&&t(n,{children:[$.top&&e("g",{transform:"translate(0, 0)",children:e(qe,{orient:"top",config:Fe($.top),values:R,scale:g.x,size:p.top,length:c})}),$.bottom&&e("g",{transform:`translate(0, ${u})`,children:e(qe,{orient:"bottom",config:Fe($.bottom),values:R,scale:g.x,size:p.bottom,length:c})}),$.left&&e("g",{transform:"translate(0, 0)",children:e(qe,{orient:"left",config:Fe($.left),values:W,scale:g.y,size:p.left,length:u})}),$.right&&e("g",{transform:`translate(${c}, 0)`,children:e(qe,{orient:"right",config:Fe($.right),values:W,scale:g.y,size:p.right,length:u})})]}),L,ie&&ie.sourceId!==Y&&(null==g?void 0:g.x)&&(()=>{const t=g.x(ie.xValue);if(null==t||0>t||t>c)return null;const n=ie.locked;return e("line",{x1:t,y1:0,x2:t,y2:u,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),X]}),O&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof O?O:null}),He({legend:S,totalWidth:h,totalHeight:f,margin:p,legendPosition:P,title:O,legendHoverBehavior:M,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:z})]}):null}function mt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const bt="undefined"==typeof window||"undefined"==typeof document,xt="undefined"!=typeof window?h:d,kt=()=>()=>{},wt=()=>!1,jt=()=>!0;function Ot(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function St(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Mt(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const At=o.createContext(null),Ct={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function zt(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=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],l=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of l)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const Pt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Lt={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"},It={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Dt={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)"},$t={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Rt={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)"},Wt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Bt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Tt({scene:n,chartType:i,tableId:r,chartTitle:l}){var s;const[a,c]=o.useState(!1),u=o.useContext(At),d=null!==(s=null==u?void 0:u.visible)&&void 0!==s&&s,h=a||d,f=o.useRef(null),p=l?"Data summary for "+l:r?`Data summary for ${i} ${r}`:"Data summary for "+i,g=o.useCallback(()=>{a||d||c(!0)},[a,d]),y=o.useCallback(e=>{var t;d||(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:Ct}):null;if(!h)return e("div",{id:r,tabIndex:-1,onFocus:g,style:Ct,role:"region","aria-label":p,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const v=function(e){var t,n,o,i,r,l,s,a,c,u,d,h,f,p,g,y,v,m,b,x,k,w,j,O,S;const M=[];if(!Array.isArray(e))return M;for(const A of e)if(A&&"object"==typeof A)try{switch(A.type){case"point":M.push({label:"Point",values:{x:A.x,y:A.y}});break;case"line":{const e=A.path,t=Array.isArray(A.datum)?A.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&M.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=A.topPath,t=Array.isArray(A.datum)?A.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&M.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=A.datum&&"object"==typeof A.datum?A.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:A.group)&&void 0!==n?n:"",l=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;M.push({label:"Bar",values:{category:r,value:null!=l?l:""}});break}case"heatcell":M.push({label:"Cell",values:{x:A.x,y:A.y,value:A.value}});break;case"wedge":M.push({label:"Wedge",values:{category:null!==(a=null!==(l=null===(r=A.datum)||void 0===r?void 0:r.category)&&void 0!==l?l:null===(s=A.datum)||void 0===s?void 0:s.label)&&void 0!==a?a:"",value:null!==(u=null===(c=A.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":M.push({label:"Node",values:{id:null!==(h=null===(d=A.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(f=A.cx)&&void 0!==f?f:A.x,y:null!==(p=A.cy)&&void 0!==p?p:A.y}});break;case"arc":M.push({label:"Arc",values:{id:null!==(y=null===(g=A.datum)||void 0===g?void 0:g.id)&&void 0!==y?y:"",x:null!==(v=A.cx)&&void 0!==v?v:A.x,y:null!==(m=A.cy)&&void 0!==m?m:A.y}});break;case"candlestick":M.push({label:"Candlestick",values:{x:A.x,open:A.open,high:A.high,low:A.low,close:A.close}});break;case"geoarea":M.push({label:"Region",values:{name:null!==(j=null!==(k=null===(x=null===(b=A.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=A.datum)||void 0===w?void 0:w.name)&&void 0!==j?j:"",value:null!==(S=null===(O=A.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return M}(n),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=[],i=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&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(v),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Pt(e.min)} to ${Pt(e.max)}, mean ${Pt(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(" ")}(v.length,m),x=v.slice(0,5),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:f,id:r,tabIndex:-1,onBlur:y,style:Lt,role:"region","aria-label":p,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Dt,children:"×"}),e("div",{role:"note",style:It,children:b}),t("table",{role:"table","aria-label":"Sample data for "+i,style:$t,children:[t("caption",{style:Bt,children:["First ",x.length," of ",v.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Rt,children:"type"}),w.map(t=>e("th",{style:Rt,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:Wt,children:n.label}),w.map(t=>{return e("td",{style:Wt,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Pt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function Nt({summary:t}){return t?e("div",{role:"note",style:Ct,children:t}):null}function Et({tableId:t}){return e("a",{href:"#"+t,style:Ct,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,Ct)},children:"Skip to data table"})}function _t({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Ct,children:n})}const Ht=Object.freeze([]);function Ft(e){if(!e)return Ht;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}const qt="var(--semiotic-focus, #005fcc)";function Gt({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:l,height:s}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=l&&null!=s){const t=Math.max(l,4),n=Math.max(s,4);u=e("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:qt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:qt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:qt,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Vt({x:t,y:n,containerWidth:i,containerHeight:r,margin:l,children:s,className:a="stream-frame-tooltip",zIndex:c=1}){const u=o.useRef(null),[d,h]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,i,r]);let f;return f=d?`translate(${d.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:a,style:{position:"absolute",left:l.left+t,top:l.top+n,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"},children:s})}function Ut(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Zt(e,t,n=.6){var o,i,r,l,s;if(!Ut(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(s=null!==(l=t.cy)&&void 0!==l?l: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 Yt(e,t,n,o=.35){Ut(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Xt(e){switch(e){case"monotoneX":return _;case"monotoneY":return E;case"cardinal":return R;case"catmullRom":return $;case"step":return N;case"stepBefore":return B;case"stepAfter":return T;case"basis":return W;case"natural":return F;default:return null}}function Qt(e,t,n){return null==t?n:"string"!=typeof t?t:Pe(e,t)||n}function Kt(e,t,n,o,i,r){const l=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>l.length)return null;const s=e.createLinearGradient(n,o,i,r);for(const e of l)s.addColorStop(e.offset,e.color);return s}function Jt(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 en(e,t,n,o,i,r){if(2>t.length)return;const l=[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];l.push(l[e-1]+Math.sqrt(n*n+o*o))}const s=l[l.length-1];if(0===s)return;const a=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(l[n]+l[n+1])/2;let r=i;a>o&&(r*=o/a),a>s-o&&(r*=(s-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function tn(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,l=t[1]*o,s=t[0]+"px",a=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===l||(e.width=r,e.height=l),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function nn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function on([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function rn(e,t,n,o,i){return"function"==typeof e?e(t,n,o,i):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",i>1?"@2x":"")}class ln{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 sn{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 i=0;this.capacity>i;i++){const r=this.particles[i];if(!r.active)continue;const l=n[r.lineIndex];if(!l||2>l.length){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const s=an(l),a=cn(l,r.t*s),c=(o[r.lineIndex]||2)/2;r.x=a.x+a.nx*r.offset*c*2,r.y=a.y+a.ny*r.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 an(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],i=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+i*i)}return t}function cn(e,t){let n=0;for(let o=1;e.length>o;o++){const i=e[o][0]-e[o-1][0],r=e[o][1]-e[o-1][1],l=Math.sqrt(i*i+r*r);if(n+l>=t||o===e.length-1){const s=l>0?(t-n)/l:0,a=l>.001?l:1;return{x:e[o-1][0]+i*s,y:e[o-1][1]+r*s,nx:-r/a,ny:i/a}}n+=l}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const un={top:10,right:10,bottom:10,left:10},dn={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"},hn={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 fn(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function pn(e){return e?e.getContext("2d"):null}function gn({data:n}){var o;if(!n)return null;if(n.properties)return e("div",{className:"semiotic-tooltip",style:dn,children:e("div",{style:{fontWeight:600},children:n.properties.name||n.properties.NAME||n.properties.id||"Feature"})});const i=null!==(o=n.data)&&void 0!==o?o:n,r=Object.entries(i).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return e("div",{className:"semiotic-tooltip",style:dn,children:r.map(([n,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[n,": "]}),e("span",{style:{fontWeight:600},children:o+""})]},n))})}const yn=f(function(n,o){var l,c,h,f,g,y,v,m,b,x;const{projection:k,projectionExtent:w,fitPadding:j,projectionTransform:O,areas:S,points:M,lines:A,xAccessor:C,yAccessor:z,lineDataAccessor:P,pointIdAccessor:L,lineType:I="geo",flowStyle:D="basic",graticule:$,zoomable:R,zoomExtent:W,onZoom:B,dragRotate:T,showParticles:N,particleStyle:E,tileURL:_,tileAttribution:H,tileCacheSize:F,size:G,width:Y,height:X,responsiveWidth:Q,responsiveHeight:K,margin:J,className:ee,background:te,areaStyle:ne,pointStyle:oe,lineStyle:ie,colorScheme:re,enableHover:se=!0,hoverAnnotation:ae,tooltipContent:ce,customClickBehavior:de,customHoverBehavior:he,annotations:fe,decay:ge,pulse:ye,transition:ve,animate:me,staleness:be,backgroundGraphics:xe,foregroundGraphics:ke,title:we,legend:je,legendPosition:Oe,legendHoverBehavior:Se,legendClickBehavior:Me,legendHighlightedCategory:Ae,legendIsolatedCategories:Ce,legendCategoryAccessor:ze,onCategoriesChange:Le,showAxes:Ie,accessibleTable:$e=!0,description:Re,summary:We}=n,Be=G||[Y||600,X||400],Te=i(!0),Ne=De({sizeProp:Be,responsiveWidth:Q,responsiveHeight:K,userMargin:J,marginDefault:un,foregroundGraphics:ke,backgroundGraphics:xe,animate:me,transitionProp:ve,themeDirtyRef:Te}),{reducedMotionRef:Ee,responsiveRef:_e,size:He,margin:Fe,adjustedWidth:qe,adjustedHeight:Ge,resolvedForeground:Ve,resolvedBackground:Ue,transition:Ze,introEnabled:Ye,tableId:Xe,rafRef:Qe,renderFnRef:Ke,scheduleRender:Je,currentTheme:et}=Ne,tt=function(){const[e,t]=u(!1);return xt(()=>{t(!0)},[]),e}(),nt=function(){const e=a(kt,wt,jt);return i(e).current}(),ot=r(()=>Array.isArray(S)?Ft(S):S,[S]),it=r(()=>Ft(M),[M]),rt=r(()=>Ft(A),[A]),lt=r(()=>null!=T?T:"orthographic"===fn(k),[T,k]),st=r(()=>{var e,t;return{projection:k,projectionExtent:w,fitPadding:j,xAccessor:C,yAccessor:z,lineDataAccessor:P,lineType:I,flowStyle:D,areaStyle:ne,pointStyle:oe,lineStyle:ie,colorScheme:re,themeSemantic:pe(et),themeSequential:null===(e=null==et?void 0:et.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==et?void 0:et.colors)||void 0===t?void 0:t.diverging,graticule:$,projectionTransform:O,decay:ge,pulse:ye,transition:Ze,introAnimation:Ye,annotations:fe,pointIdAccessor:L}},[k,w,j,C,z,P,I,D,ne,oe,ie,re,$,O,ge,ye,null==Ze?void 0:Ze.duration,null==Ze?void 0:Ze.easing,Ye,fe,L,et]),at=function(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return St(e,t);if(!Mt(e)||!Mt(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!St(n,i))return!1}else{if(!Mt(n)||!Mt(i))return!1;if(!Ot(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(st),ct=i(null);ct.current||(ct.current=new le(at));const ut=i(null),dt=i(null),ht=i(null),ft=i(null),pt=i(null);_&&!pt.current&&(pt.current=new ln(F||256));const gt=i(fe),yt=i(null),At=i(V),Ct=i(!1),Pt=i(null),Lt=s(e=>{Pt.current=e,_e&&"object"==typeof _e&&(_e.current=e)},[_e]),It=i(null),Dt=i(null),$t=i(null),Rt=i(0);if(N&&!$t.current){const e=null!==(l=null==E?void 0:E.maxPerLine)&&void 0!==l?l:30;$t.current=new sn(50*e)}const Wt=i(null),Bt=i(null),[Ht,qt]=u(null),[Ut,an]=u(0),[cn,dn]=u(!1),yn=i([]),vn=i(ze),mn=i(Le);vn.current=ze,mn.current=Le;const bn=s(()=>{var e,t;const n=vn.current,o=mn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=ct.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,yn.current)||(yn.current=i,o(i))},[]);d(()=>{var e;null===(e=ct.current)||void 0===e||e.updateConfig(at),Te.current=!0,Je()},[at,Je]),d(()=>{const e=ct.current;e&&(ot&&e.setAreas(ot),M&&e.setPoints(it),A&&e.setLines(rt),Te.current=!0,Je())},[ot,M,it,A,rt,Je]);const xn=s(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=ct.current)||void 0===t||t.pushPoint(e),Te.current=!0,Je())},[Je]),kn=s(e=>{var t;const n=Ft(e);0!==n.length&&(null===(t=ct.current)||void 0===t||t.pushMany(n),Te.current=!0,Je())},[Je]),wn=s(()=>{var e;null===(e=ct.current)||void 0===e||e.clear(),Te.current=!0,Je()},[Je]);p(o,()=>({push:xn,pushMany:kn,removePoint:e=>{var t,n;const o=null!==(n=null===(t=ct.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Te.current=!0,Je()),o},clear:wn,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=ct.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=ct.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=ct.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>At.current.k,resetZoom:()=>{const e=Pt.current;e&&yt.current&&Z(e).call(yt.current.transform,V)},getData:()=>{var e,t;return null!==(t=null===(e=ct.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[xn,kn,wn,Je]);const{hoverHandlerRef:jn,onPointerMove:On,onPointerLeave:Sn}=Ne;d(()=>{jn.current=e=>{if(!se)return;const t=ct.current;if(!t||!t.scene.length)return;const n=dt.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-Fe.left,r=e.clientY-o.top-Fe.top;if(0>i||i>qe||0>r||r>Ge)return Wt.current=null,Bt.current=null,qt(null),null==he||he(null),void Je();ft.current||(ft.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const l=pn(ft.current);if(!l)return;const s=ue(t.scene,i,r,30,l,t.quadtree,t.maxPointRadius);if(s){const e=s.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,l;"point"===e.type?(o=e.x,l=e.y):"geoarea"===e.type?(o=e.centroid[0],l=e.centroid[1]):(o=i,l=r);const a=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,__semioticHoverData:!0,x:o,y:l});Wt.current=a,Bt.current=e,qt(a),null==he||he(a),Je()}else Wt.current&&(Wt.current=null,Bt.current=null,qt(null),null==he||he(null),Je())}},[se,qe,Ge,Fe,he,Je]),Ne.hoverLeaveRef.current=()=>{Wt.current=null,Bt.current=null,qt(null),null==he||he(null),Je()};const Mn=s(e=>{if(!de)return;const t=ct.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Fe.left,i=e.clientY-n.top-Fe.top;ft.current||(ft.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=pn(ft.current);if(!r)return;const l=ue(t.scene,o,i,30,r,t.quadtree,t.maxPointRadius);if(l){const e=l.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;de(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i}))}},[de,Fe]),An=i(-1),Cn=i(null),zn=s(e=>{const t=ct.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=An.current,i=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===i)return;if(e.preventDefault(),0>i)return An.current=-1,Cn.current=null,Wt.current=null,Bt.current=null,qt(null),null==he||he(null),void Je();const r=0>o?0:i;An.current=r;const l=n[r];Cn.current={shape:l.shape,w:l.w,h:l.h};const s=l.datum,a=Object.assign(Object.assign(Object.assign({},s||{}),(null==s?void 0:s.properties)||{}),{data:s,properties:null==s?void 0:s.properties,x:l.x,y:l.y,__semioticHoverData:!0});Wt.current=a,qt(a),null==he||he(a),Je()},[he,Je]),Pn=s(e=>{An.current=-1,Cn.current=null,On(e)},[On]);Ke.current=()=>{var e,t,n,o,i,r,l,s;Qe.current=0;const a=dt.current,c=ct.current;if(!a||!c)return;const u=performance.now();let d=!1;const h=Dt.current;h&&(Dt.current=null,c.applyRotation(h,{width:qe,height:Ge}));const f=c.advanceTransition(Ee.current?u+1e6:u),p=!Ee.current&&f;if(Te.current&&!f){const e={width:qe,height:Ge},t=lt?c.getRotation():null;c.computeScene(e);const n=At.current,o=1!==n.k||0!==n.x||0!==n.y;lt&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),Te.current=!1,a.setAttribute("aria-label",zt(c.scene,"Geographic chart")),bn()}const g=nn();if(_&&pt.current){const t=ut.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=tn(t,He,Fe,g);if(e){e.clearRect(-Fe.left,-Fe.top,He[0],He[1]),e.save(),e.beginPath(),e.rect(0,0,qe,Ge),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:i,height:r,tileCache:l,onTileLoad:s}=t,a=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:i=!0,clampY:r=!0}=e,l=Math.max(Math.log(n)/Math.LN2-8,0),s=Math.round(l),a=1<<s,c=Math.pow(2,l-s+8),u=o[0]-n/2,d=o[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?a:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(r?0:-1/0,Math.floor((0-d)/c)),g=Math.min(r?a:1/0,Math.ceil((t[1]-d)/c)),y=[];for(let e=p;g>e;++e)for(let t=h;f>t;++t)y.push([t,e,s]);return{tiles:y,translate:[u/c,d/c],scale:c}}({size:[i,r],scale:2*a*Math.PI,translate:c}),d=nn();let h=!0;for(const t of u.tiles){const[o,i,r]=on(t),a=`${r}/${o}/${i}`;let c=l.get(a);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:a,lastUsed:performance.now()};l.set(a,t),e.onload=()=>{t.loaded=!0,null==s||s()},e.onerror=()=>{t.loaded=!0},e.src=rn(n,r,o,i,d),c=t}if(!c.loaded){h=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return h}(e,{tileURL:_,projection:c.scales.projection,width:qe,height:Ge,tileCache:pt.current,onTileLoad:()=>Je()});e.restore(),t||(d=!0)}}}const y=tn(a,He,Fe,g);if(!y)return;if(y.clearRect(-Fe.left,-Fe.top,He[0],He[1]),te&&!_){const e=Pe(y,te);e&&(y.fillStyle=e,y.fillRect(0,0,qe,Ge))}y.save(),y.beginPath(),y.rect(0,0,qe,Ge),y.clip();const v=c.scene,m={width:qe,height:Ge};if(function(e,t){var n,o,i;const r=t.filter(e=>"geoarea"===e.type);for(const t of r){if(!t.pathData)continue;const r=new Path2D(t.pathData),l=t.style.fill||"#e0e0e0";if("none"!==l&&(e.fillStyle=l,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=Pe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(i=t._decayOpacity)&&void 0!==i?i:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(r)}Yt(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(y,v),((e,t,n,o)=>{var i,r;const l=t.filter(e=>"line"===e.type);for(const s of l){if(2>s.path.length)continue;const a=s._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const c=s.style.stroke||"#007bff",u=Pe(e,c)||c,d=s.style.strokeWidth||2,h=s.colorThresholds,f=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=d,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const v=null!==(i=s.style.opacity)&&void 0!==i?i:1;en(e,s.path,u,d,v,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=Xt(s.curve),g=h&&h.length>0&&f&&f.length===s.path.length,y=s._decayOpacities;if(y&&y.length===s.path.length&&!g){e.strokeStyle=u;const m=null!==(r=s.style.opacity)&&void 0!==r?r:1;for(let b=0;s.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*m,e.beginPath(),e.moveTo(s.path[b][0],s.path[b][1]),e.lineTo(s.path[b+1][0],s.path[b+1][1]),e.stroke()}else if(g){let x=null,k=null,w=null,j=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 A=0;s.path.length>A;A++){const[C,z]=s.path[A],P=f[A],L=Jt(P,h,u);if(null!==x&&null!==j&&null!==w){if(L===j)e.lineTo(C,z);else{const I=[];for(const D of h){const $=D.value;(w>$||$>P)&&($>w||P>$)||w===$||P===$||I.push({t:($-w)/(P-w)})}I.sort((e,t)=>e.t-t.t);for(const R of I){const W=x+(C-x)*R.t,B=k+(z-k)*R.t,T=Jt(w+(P-w)*Math.min(R.t+1e-4,1),h,u);e.lineTo(W,B),M(),S(T,W,B)}e.lineTo(C,z)}x=C,k=z,w=P,j=L}else S(L,C,z),x=C,k=z,w=P,j=L}M()}else{e.beginPath();const N=s.strokeGradient&&s.path.length>=2?Kt(e,s.strokeGradient,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(e.strokeStyle=N||u,p)q().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[E,_]=s.path[0];e.moveTo(E,_);for(let H=1;s.path.length>H;H++)e.lineTo(s.path[H][0],s.path[H][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=Qt(e,s.style.fill,s.style.fill),p&&!g)q().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[G,V]=s.path[0];e.moveTo(G,V);for(let U=1;s.path.length>U;U++)e.lineTo(s.path[U][0],s.path[U][1])}const F=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(F,o.height),e.closePath(),e.fill()}void 0!==a&&1>a&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(y,v,0,m),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=Qt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Qt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),Zt(e,t),e.globalAlpha=1}}finally{e.restore()}}})(y,v),N&&$t.current){const e=$t.current,s=v.filter(e=>"line"===e.type);if(s.length>0){const a=E||{},c=.3*(null!==(t=a.speedMultiplier)&&void 0!==t?t:1),h=null!==(n=a.maxPerLine)&&void 0!==n?n:30,f=null!==(o=a.spawnRate)&&void 0!==o?o:.15,p=null!==(i=a.radius)&&void 0!==i?i:2,g=null!==(r=a.opacity)&&void 0!==r?r:.7,v=u/1e3,m=Rt.current>0?Math.min(v-Rt.current,.1):.016;Rt.current=v;const b=s.map(e=>e.path),x=s.map(e=>e.style.strokeWidth||2);for(let t=0;s.length>t;t++)Math.random()<f&&e.countForLine(t)<h&&e.spawn(t);e.step(m,c,b,x),y.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=s[n.lineIndex],i="function"==typeof a.color?a.color(null!==(l=null==o?void 0:o.datum)&&void 0!==l?l:{}):"source"!==a.color&&a.color?a.color:(null==o?void 0:o.style.stroke)||"#fff";y.beginPath(),y.arc(n.x,n.y,p,0,2*Math.PI),y.fillStyle=i,y.fill()}y.globalAlpha=1,d=!0}}y.restore();const b=ht.current;if(b){const e=tn(b,He,Fe,g);if(e){e.clearRect(-Fe.left,-Fe.top,He[0],He[1]);const t=Bt.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 ae?ae:void 0,i=(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),i?(e.save(),e.globalAlpha=.4,e.fillStyle=i,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=i||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(be){const e=performance.now()-c.lastIngestTime>(null!==(s=be.threshold)&&void 0!==s?s:5e3);e!==cn&&dn(e)}const x=fe!==gt.current;x&&(gt.current=fe),(Te.current||x)&&an(e=>e+1),(p||null!=c.activeTransition||c.hasActivePulses||d)&&(Qe.current=requestAnimationFrame(()=>Ke.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:l,cleanup:s}=e;xt(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,l.current()},[t,n]);const a=i(s);a.current=s,d(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:tt,wasHydratingFromSSR:nt,storeRef:ct,dirtyRef:Te,renderFnRef:Ke,cleanup:()=>{var e;return null===(e=pt.current)||void 0===e?void 0:e.clear()}}),d(()=>{Te.current=!0,Je()},[qe,Ge,te,Je]),function(e,t,n,o,i,r){d(()=>{if(!e)return;const l=setInterval(()=>{var l;const s=t.current;if(!s||0===s.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(l=e.threshold)&&void 0!==l?l:5e3,u=a-s.lastIngestTime>c;u!==i&&(r(u),n.current=!0,o())},1e3);return()=>clearInterval(l)},[e,i,o])}(be,ct,Te,Je,cn,dn),d(()=>{if("production"!==process.env.NODE_ENV&&_){const e=fn(k);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.`)}},[_,k]),d(()=>{const e=Pt.current;if(!R||!e)return yt.current&&e&&(Z(e).on(".zoom",null),yt.current=null),void(e&&Z(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=W||[1,8],o={width:qe,height:Ge};if(lt){let i=At.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),At.current=V.scale(i);const l=ct.current;l&&(l.applyZoomScale(i,o),Te.current=!1,Je(),(null===(r=l.scales)||void 0===r?void 0:r.projection)&&(null==B||B({projection:l.scales.projection,zoom:l.currentZoom})))};yt.current={scaleBy:(e,t)=>r(i*t),transform:(e,t)=>{var n;return r(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const l=e=>{e.preventDefault(),r(i*(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(),r(1.5*i))};e.addEventListener("wheel",l,{passive:!1}),e.addEventListener("dblclick",s);const a=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=ct.current;if(!o)return;const i=o.getRotation();It.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=It.current;t&&(Dt.current=[t.rotation[0]+(e.clientX-t.x)*a,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*a)),t.rotation[2]],Je())},d=t=>{var n;if(!It.current)return;It.current=null,e.releasePointerCapture(t.pointerId);const i=Dt.current;if(i){Dt.current=null;const e=ct.current;e&&(e.applyRotation(i,o),Je())}const r=ct.current;(null===(n=null==r?void 0:r.scales)||void 0===n?void 0:n.projection)&&(null==B||B({projection:r.scales.projection,zoom:r.currentZoom}))};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",l),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),yt.current=null}}const i=U().scaleExtent([t,n]).extent([[0,0],[He[0],He[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;At.current=t,Ct.current=!0;const n=ct.current;n&&(n.applyZoomTransform(t,o),Te.current=!1,Je())}).on("end",e=>{var t;At.current=e.transform,Ct.current=!1;const n=ct.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==B||B({projection:n.scales.projection,zoom:n.currentZoom}))});return yt.current=i,Z(e).call(i),()=>{Z(e).on(".zoom",null)}},[R,W,lt,He,qe,Ge,Fe,B,Je]);const Ln=se&&!1!==ae,In=Ln&&Ht?ce?ce(Ht):e(gn,{data:Ht}):null,Dn=In?e(Vt,{x:Ht.x,y:Ht.y,containerWidth:qe,containerHeight:Ge,margin:Fe,className:"stream-frame-tooltip",zIndex:10,children:In}):null;if(bt||!tt&&nt){const n=ct.current;n&&(ot||M||A)&&(ot&&n.setAreas(ot),M&&n.setPoints(it),A&&n.setLines(rt),n.computeScene({width:qe,height:Ge}));const o=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[];return t("div",{ref:Lt,className:"stream-geo-frame"+(ee?" "+ee:""),role:"img","aria-label":Re||("string"==typeof we?we:"Geographic chart"),style:{position:"relative",width:Q?"100%":He[0],height:K?"100%":He[1]},children:[e(Nt,{summary:We}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:He[0],height:He[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Fe.left},${Fe.top})`,children:Ue}),t("g",{transform:`translate(${Fe.left},${Fe.top})`,children:[te&&e("rect",{x:0,y:0,width:qe,height:Ge,fill:te}),o.map((t,n)=>function(t,n){var o,i,r,l,s,a;switch(t.type){case"geoarea":{const r=t;return r.pathData?e("path",{d:r.pathData,fill:mt(r.style.fill,"#e0e0e0"),fillOpacity:null!==(o=r.style.fillOpacity)&&void 0!==o?o:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(i=r._decayOpacity)&&void 0!==i?i:1},"geoarea-"+n):null}case"point":{const o=t;return e("circle",{cx:o.x,cy:o.y,r:o.r,fill:mt(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(l=o._decayOpacity)&&void 0!==l?l:null!==(s=o.style.opacity)&&void 0!==s?s:1},"point-"+n)}case"line":{const o=t;if(2>o.path.length)return null;const i="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(a=o.style.opacity)&&void 0!==a?a:1},"line-"+n)}default:return null}}(t,n))]})]}),e(vt,{width:qe,height:Ge,totalWidth:He[0],totalHeight:He[1],margin:Fe,scales:null,showAxes:!1,title:we,legend:je,legendPosition:Oe,legendHoverBehavior:Se,legendClickBehavior:Me,legendHighlightedCategory:Ae,legendIsolatedCategories:Ce,foregroundGraphics:Ve,annotations:fe,annotationFrame:0,xValues:[],yValues:[],pointNodes:o.filter(e=>"point"===e.type)})]})}return t("div",{ref:Lt,className:"stream-geo-frame"+(ee?" "+ee:""),role:"group","aria-label":Re||("string"==typeof we?we:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:Q?"100%":He[0],height:K?"100%":He[1],overflow:"hidden"},R?{touchAction:"none"}:{}),onKeyDown:zn,children:[$e&&e(Et,{tableId:Xe}),$e&&e(Tt,{scene:null!==(f=null===(h=ct.current)||void 0===h?void 0:h.scene)&&void 0!==f?f:[],chartType:"Geographic chart",tableId:Xe,chartTitle:"string"==typeof we?we:void 0}),e(Nt,{summary:We}),t("div",{role:"img","aria-label":Re||("string"==typeof we?we:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Ln?Pn:void 0,onMouseLeave:Ln?Sn:void 0,onClick:de?Mn:void 0,children:[Ue&&e("svg",{style:{position:"absolute",left:0,top:0,width:He[0],height:He[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Fe.left},${Fe.top})`,children:Ue})}),_&&e("canvas",{ref:ut,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e("canvas",{ref:dt,"aria-label":zt(null!==(y=null===(g=ct.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:ht,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(_t,{hoverPoint:Ht}),e(vt,{width:qe,height:Ge,totalWidth:He[0],totalHeight:He[1],margin:Fe,scales:null,showAxes:null!=Ie&&Ie,title:we,legend:je,legendPosition:Oe,legendHoverBehavior:Se,legendClickBehavior:Me,legendHighlightedCategory:Ae,legendIsolatedCategories:Ce,foregroundGraphics:Ve,annotations:fe,annotationFrame:Ut,xValues:[],yValues:[],pointNodes:null===(v=ct.current)||void 0===v?void 0:v.scene.filter(e=>"point"===e.type)}),(null==be?void 0:be.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===be.badgePosition?{top:4,left:4}:"bottom-left"===be.badgePosition?{bottom:4,left:4}:"bottom-right"===be.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:cn?"#dc3545":"#28a745",color:"white"}),children:cn?"STALE":"LIVE"}),R&&t("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Fe.bottom+8,left:Fe.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Pt.current,n=yt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(Z(t),1.5)},style:hn,children:"+"}),e("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Pt.current,n=yt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(Z(t),1/1.5)},style:hn,children:"−"})]}),H&&e("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Fe.bottom+2,right:Fe.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:H}),e(Gt,{active:An.current>=0,hoverPoint:Ht,margin:Fe,size:He,shape:null===(m=Cn.current)||void 0===m?void 0:m.shape,width:null===(b=Cn.current)||void 0===b?void 0:b.w,height:null===(x=Cn.current)||void 0===x?void 0:x.h}),Dn]})]})});yn.displayName="StreamGeoFrame";const vn={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function mn(e,t){return"function"==typeof t?t(e):e[t]}function bn(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 xn(n={}){const{fields:o,title:i,format:r,style:l={},className:s=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let a;const c=[];if(i){const e=mn(n,i);a=bn(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const l=mn(n,o);c.push({label:t,value:bn(l,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){a=bn(n[t],r);break}if(!a){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(a=bn(n[e[0]],r))}}const u=Object.assign(Object.assign({},vn),l);return t("div",{className:("semiotic-tooltip "+s).trim(),style:u,children:[a&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:a}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&a?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function kn(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t,r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:vn,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?xn(t):xn())}}function wn(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function jn(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function On(e){const t=e.map(wn),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return jn(e,n,o)}if(e>=1){const[e,o,i]=t[n];return jn(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[l,s,a]=t[i],[c,u,d]=t[i+1];return jn(Math.round(l+(c-l)*r),Math.round(s+(u-s)*r),Math.round(a+(d-a)*r))}}const Sn=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Mn=On(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),An=On(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Cn=On(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),zn=On(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Pn=On(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ln=On(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),In=On(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Dn=On(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),$n=On(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Rn=On(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Wn=On(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Bn=On(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);On(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),On(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),On(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),On(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),On(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),On(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),On(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const Tn={category10:Sn,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Mn,reds:An,greens:Cn,oranges:zn,purples:Pn,viridis:In,plasma:Dn},Nn=Sn,En=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],_n=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 Hn(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")||_n.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Nn[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))%Nn.length]}function Fn(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return A().domain(o).range(n).unknown("#999");const r=Tn[n]||Tn.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:Nn;return A().domain(o).range(e).unknown("#999")}}function qn(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,l]=o,[s,a]=n;return l===r?(s+a)/2:s+(i-r)/(l-r)*(a-s)}const Gn=c(null);function Vn(){return l(Gn)}function Un(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,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Zn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Yn,Xn]=he(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Zn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Zn(o,t);return o.set(t,Object.assign(Object.assign({},i),{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}})}})),[Qn,Kn]=he(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 Jn(e){const t=g(),n=e.clientId||t,{name:o}=e,i=Xn(e=>e.selections.get(o)),l=Xn(e=>e.setClause),a=Xn(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Un(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};l(o,{clientId:n,type:"point",fields:t})},[n,o,l]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};l(o,{clientId:n,type:"interval",fields:t})},[n,o,l]),clear:s(()=>{a(o,n)},[a,o,n]),clientId:n}}function eo(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:l}=Jn({name:t});return{onHover:s(e=>{if(!e)return void l();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,l,t]),predicate:o,isActive:i}}const to=c(!1),no=c(null),oo="undefined"==typeof window?d:h;function io(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 ro(e,t,n){return t?o=>{var i;const r=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(r,n.selectedStyle);else{const e=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}function lo(){return we(e=>e.theme)}o.createContext(void 0);const so="#007bff";function ao(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function co(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function uo(){var e;const t=lo(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function ho({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:l,chartId:a,onClick:c,hoverHighlight:h,colorByField:f}){const p=g(),y=io(t,n),v=Jn({name:(null==e?void 0:e.name)||"__unused__"}),m=eo({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=Kn(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,w]=u(null),j=f||n[0],O=r(()=>{if(!h||null==k||!j)return null;const e=k,t=j;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,j]),S=s(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=ao(e,t,y.xField);null!=n&&function(e,t,n){const o=ot.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n})},rt())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&m.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&<(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&m.onHover(null);if(h&&j)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[j];w(null!=n?n+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:a};if(e){const r=co(e),l=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(l),b&&b(l)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,m,y,p,i,l,a,b,h,j]),M=s(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=ao(e,t,y.xField);null!=n&&function(e,t,n){const o=ot.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(ot.positions);return t.delete(e),ot={positions:t},rt(),!1}ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n,locked:!0})},rt()}(y.name||"hover",n,p)}if(e&&c){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),c(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:a};if(e){const n=co(e),l=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(l),b&&b(l)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[c,i,b,l,a,y,p]);return d(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{st(e,p),lt(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:M,crosshairSourceId:p}}function fo({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:s="right",userMargin:a,defaults:c={top:50,bottom:60,left:70,right:40},categories:u}){const d=l(to),h=null!==l(no),f=void 0!==o?o:!d&&!!t,p=!!t&&(f||h),y=r(()=>{if(!p)return[];if(void 0!==u)return u;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[u,t,e,p]);!function(e){const t=l(no),n=g(),o=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=i([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(r.current,o)||(r.current=o);const s=r.current;oo(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),oo(()=>{t&&t.registerCategories(n,s)},[t,n,s])}(h&&t?y:[]);const v=r(()=>{if(!f||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:l}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(l&&l.length>0?l:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const l=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=l?o(l,t,n):n?n(i):En[r%En.length];return{label:i+"",color:s}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Hn,categories:y});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[f,t,e,n,y]),m=r(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=Object.assign(Object.assign({},c),e);return v&&("right"===s&&110>t.right?t.right=110:"left"===s&&110>t.left?t.left=110:"top"===s&&50>t.top?t.top=50:"bottom"===s&&80>t.bottom&&(t.bottom=80)),t},[c,a,v,s]);return{legend:v,margin:m,legendPosition:s}}const po={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 go(e,t,n){var o,i,r,l,s,a,c;const u=po[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(i=t.height)&&void 0!==i?i:u.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(l=t.showGrid)&&void 0!==l?l:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a: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:yo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function yo(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 vo(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 mo({componentName:n,message:o,diagnosticHint:i,width:r,height:l}){return e("div",{role:"alert",style:{width:r,height:Math.max(l,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class bo extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(mo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var xo;const ko="undefined"!=typeof process&&"production"!==(null===(xo=process.env)||void 0===xo?void 0:xo.NODE_ENV);function wo({componentName:t,width:n,height:o,children:i}){return e(bo,{fallback:i=>e(mo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const jo={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Oo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function So(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},jo),{width:n,height:o}),children:i||"No data available"}):null}function Mo(t,n,o){if(!t)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),l=Math.max(6,Math.floor(o/(2.5*i))),s=Math.floor((o-(i*(r+l)-l))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Oo),{position:"absolute",top:s+o*(r+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}function Ao(e,t,n,o){if(!ko)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Co(e){const t=we(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function zo(e,t,n,o){return new(n||(n=Promise))(function(i,r){function l(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,s)}a((o=o.apply(e,t||[])).next())})}function Po(e){return e}function Lo(e,t){var n=t.id,o=t.bbox,i=null==t.properties?{}:t.properties,r=function(e,t){var n=function(e){if(null==e)return Po;var t,n,o=e.scale[0],i=e.scale[1],r=e.translate[0],l=e.translate[1];return function(e,s){s||(t=n=0);var a=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+r,u[1]=(n+=e[1])*i+l;c>a;)u[a]=e[a],++a;return u}}(e.transform),o=e.arcs;function i(e,t){t.length&&t.pop();for(var i=o[0>e?~e:e],r=0,l=i.length;l>r;++r)t.push(n(i[r],r));0>e&&function(e,t){for(var n,o=e.length,i=o-t;i<--o;)n=e[i],e[i++]=e[o],e[o]=n}(t,l)}function r(e){return n(e)}function l(e){for(var t=[],n=0,o=e.length;o>n;++n)i(e[n],t);return 2>t.length&&t.push(t[0]),t}function s(e){for(var t=l(e);4>t.length;)t.push(t[0]);return t}function a(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=r(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(r);break;case"LineString":n=l(t.arcs);break;case"MultiLineString":n=t.arcs.map(l);break;case"Polygon":n=a(t.arcs);break;case"MultiPolygon":n=t.arcs.map(a);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:i,geometry:r}:null==o?{type:"Feature",id:n,properties:i,geometry:r}:{type:"Feature",id:n,bbox:o,properties:i,geometry:r}}"function"==typeof SuppressedError&&SuppressedError;const Io=new Map;function Do(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function $o(e){return zo(this,void 0,void 0,function*(){const t=Io.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return zo(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:Do(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Do(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Do(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Do(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 i=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return Lo(e,t)})}:Lo(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return Io.set(e,r),r})}function Ro(e){const t=r(()=>Array.isArray(e)?e:void 0,[e]),[n,o]=u(null);return d(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return o(null),$o(e).then(e=>{t||o(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),o(null)}else o(null)},[e]),void 0!==t?t:n}const Wo={blues:Mn,reds:An,greens:Cn,viridis:In,oranges:zn,purples:Pn,greys:Ln,plasma:Dn,inferno:$n,magma:Rn,cividis:Wn,turbo:Bn};function Bo(n){var o;const i=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),l=function(){var e;const t=lo();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:s,valueAccessor:a,colorScheme:c,projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:f,zoomExtent:p,onZoom:g,dragRotate:y,tileURL:v,tileAttribution:m,tileCacheSize:b,tooltip:x,areaOpacity:k=1,annotations:w,margin:j,className:O,selection:S,linkedHover:M,onObservation:A,onClick:z,chartId:P,loading:I,emptyContent:D,frameProps:$={},stroke:R,strokeWidth:W,opacity:B}=n,T=null!=f?f:!!v,N=Ro(s),E=r(()=>N?Ft(N):N,[N]),_=r(()=>"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]),H=null!==(o=null!=c?c:l)&&void 0!==o?o:"blues",F=r(()=>{if(!E)return C(Mn).domain([0,1]);const e=E.map(e=>_(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=L(e);return C(Wo[H]||Mn).domain([null!=t?t:0,null!=n?n:1])},[E,_,H]),{activeSelectionHook:q,customHoverBehavior:G,customClickBehavior:V}=ho({selection:S,linkedHover:M,onObservation:A,onClick:z,chartType:"ChoroplethMap",chartId:P}),U=Co(S),Z=r(()=>{const e=vo(e=>{const t=_(e);return{fill:null!=t&&isFinite(t)?F(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}},{stroke:R,strokeWidth:W,opacity:B});return q?ro(e,q,U):e},[_,F,q,U,k,R,W,B]),Y=r(()=>n=>{var o,i;const r=(null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.name)||(null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||"Feature",l=_(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:r}),null!=l&&e("div",{style:{opacity:.7},children:(s=l,"number"==typeof s&&isFinite(s)?Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=s?s:"")+"")})]});var s},[_]),X=r(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof j?{top:j,bottom:j,left:j,right:j}:j),[j]),Q=Mo(I,i.width,i.height)||(E?null:Mo(!0,i.width,i.height)),K=Q?null:So(E,i.width,i.height,D);if(Array.isArray(E)&&E.length>0){const t=E[0];if(!t||"object"!=typeof t||!t.geometry)return e(mo,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:i.width,height:i.height})}const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:u,areas:E,areaStyle:Z,size:[i.width,i.height],margin:X,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?Y:kn(x)||Y},null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),T&&{zoomable:!0}),p&&{zoomExtent:p}),g&&{onZoom:g}),null!=y&&{dragRotate:y}),v&&{tileURL:v}),m&&{tileAttribution:m}),b&&{tileCacheSize:b}),(M||A||z)&&{customHoverBehavior:G}),(A||z)&&{customClickBehavior:V}),w&&w.length>0&&{annotations:w}),i.title&&{title:i.title}),i.description&&{description:i.description}),i.summary&&{summary:i.summary}),void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),$);return Q||K||e(wo,{componentName:"ChoroplethMap",width:i.width,height:i.height,children:e(yn,Object.assign({},J))})}function To(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:l,legendPosition:a,selection:c,linkedHover:d,fallbackFields:h,unwrapData:f=!1,onObservation:p,chartType:g,chartId:y,showLegend:v,userMargin:m,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,emptyContent:j,width:O,height:S}=e,M=void 0===n,A=r(()=>Ft(t),[t]),[C,z]=u([]),P=s(e=>{z(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:I,hoverSelectionHook:D,customHoverBehavior:$,customClickBehavior:R,crosshairSourceId:W}=ho({selection:c,linkedHover:d,fallbackFields:h,unwrapData:f,onObservation:p,chartType:g,chartId:y,onClick:x,hoverHighlight:k,colorByField:L}),B=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(d,W),T=function(e,t,n){const o=Vn(),i=uo();return r(()=>{var r;if(!t)return;const l=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=Fn(n.map(e=>({_cat:e})),"_cat",l);return t=>o[t]||e(t)}return Fn(n.map(e=>({_cat:e})),"_cat",l)}if(o&&Object.keys(o).length>0){const n=Fn(e,t,l);return e=>o[e]||n(e)}return Fn(e,t,l)}if(o&&Object.keys(o).length>0){const e=Fn([{_:"a"}],"_",l);return t=>o[t]||e(t)}},[e,t,n,o,i])}(A,o,i),N=r(()=>{if(!o)return[];const e=new Set;for(const t of A){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[A,o]),E=r(()=>M&&C.length>0?C:N,[M,C,N]),_=function(e,t,n){const[o,i]=u(null),[l,a]=u(new Set),c=s(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,o,l]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(l,o,E),H=r(()=>D||(_.legendSelectionHook?_.legendSelectionHook:I),[D,_.legendSelectionHook,I]),F=Co(c),q=uo(),G=Vn(),V=r(()=>{if(T)return T;if(!o||0===E.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:q&&q.length>0?q:En,t="__streamCat",n=Fn(E.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||n(e)||"#999"},[T,o,E,i,q,G]),{legend:U,margin:Z,legendPosition:Y}=fo({data:A,colorBy:o,colorScale:V,showLegend:v,legendPosition:a,userMargin:m,defaults:b,categories:E}),X=r(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Y),l&&"none"!==l&&(e.legendHoverBehavior=_.onLegendHover,e.legendClickBehavior=_.onLegendClick,e.legendHighlightedCategory=_.highlightedCategory,e.legendIsolatedCategories=_.isolatedCategories),M&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=P),e},[U,Y,l,_.onLegendHover,_.onLegendClick,_.highlightedCategory,_.isolatedCategories,M,o,P]),Q=Array.isArray(n)?Ft(n):n,K=Mo(w,O,S),J=K?null:So(Q,O,S,j);return{data:A,colorScale:T,allCategories:E,legendState:_,effectiveSelectionHook:H,activeSelectionHook:I,customHoverBehavior:$,customClickBehavior:R,legend:U,margin:Z,legendPosition:Y,earlyReturn:K||J||null,legendBehaviorProps:X,crosshairProps:B,resolvedSelection:F}}function No(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,l;const s=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of s){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(l=e.current)||void 0===l||l.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const l=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removePoint(e))&&void 0!==i?i:[];for(const e of l)null===(r=n.current)||void 0===r||r.push(t(e));return l},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}Bo.displayName="ChoroplethMap";const Eo=f(function(n,o){const l=i(null);No(o,{variant:"geo-points",frameRef:l});const s=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:a,xAccessor:c="lon",yAccessor:u="lat",sizeBy:d,sizeRange:h=[3,30],colorBy:f,colorScheme:p,projection:g="equalEarth",graticule:y,fitPadding:v,zoomable:m,zoomExtent:b,onZoom:x,dragRotate:k,tileURL:w,tileAttribution:j,tileCacheSize:O,areas:S,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:A,annotations:C,margin:z,className:P,selection:L,linkedHover:I,onObservation:D,onClick:$,chartId:R,loading:W,emptyContent:B,legendInteraction:T,legendPosition:N,frameProps:E={},stroke:_,strokeWidth:H,opacity:F}=n,q=null!=m?m:!!w,G=Ro(S),V=To({data:null!=a?a:Ht,rawData:a,colorBy:f,colorScheme:p,legendInteraction:T,legendPosition:N,selection:L,linkedHover:I,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:D,onClick:$,chartType:"ProportionalSymbolMap",chartId:R,showLegend:s.showLegend,userMargin:z,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:W,emptyContent:B,width:s.width,height:s.height}),U=V.data,Z=r(()=>{if(!d)return;const e="function"==typeof d?d:e=>null==e?void 0:e[d],t=U.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[U,d]),Y=r(()=>{const e=vo(e=>({fill:f?Hn(e,f,V.colorScale):so,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:d?qn(e,d,h,Z):6}),{stroke:_,strokeWidth:H,opacity:F});return V.effectiveSelectionHook?ro(e,V.effectiveSelectionHook,V.resolvedSelection):e},[f,V.colorScale,V.effectiveSelectionHook,V.resolvedSelection,d,h,Z,_,H,F]),X=r(()=>n=>{const o=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n.NAME)||(null==n?void 0:n.id),i="string"==typeof d?d:null,r=("function"==typeof d?d:e=>e[d])(n),l=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",s="string"==typeof f?f:null,a=s?null==n?void 0:n[s]:null;return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[o&&e("div",{style:{fontWeight:600,marginBottom:2},children:o}),i&&null!=r&&t("div",{children:[t("span",{style:{opacity:.7},children:[i,": "]}),l(r)]}),s&&null!=a&&t("div",{children:[t("span",{style:{opacity:.7},children:[s,": "]}),a+""]}),!o&&!i&&Object.entries(n).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,": "]}),l(n)]},e))]})},[d,f]);Ao("ProportionalSymbolMap",U,"xAccessor",c),Ao("ProportionalSymbolMap",U,"yAccessor",u);const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:g},null!=a&&{points:U}),{xAccessor:c,yAccessor:u,pointStyle:Y}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),G&&{areas:G,areaStyle:M}),null!=y&&{graticule:y}),null!=v&&{fitPadding:v}),q&&{zoomable:!0}),b&&{zoomExtent:b}),x&&{onZoom:x}),null!=k&&{dragRotate:k}),w&&{tileURL:w}),j&&{tileAttribution:j}),O&&{tileCacheSize:O}),{size:[s.width,s.height],margin:V.margin,enableHover:!0,tooltipContent:!1===A?()=>null:kn(A)||X}),V.legendBehaviorProps),(I||D||$)&&{customHoverBehavior:V.customHoverBehavior}),(D||$)&&{customClickBehavior:V.customClickBehavior}),C&&C.length>0&&{annotations:C}),s.title&&{title:s.title}),s.description&&{description:s.description}),s.summary&&{summary:s.summary}),void 0!==s.accessibleTable&&{accessibleTable:s.accessibleTable}),P&&{className:P}),null!=n.animate&&{animate:n.animate}),E);return V.earlyReturn?V.earlyReturn:e(wo,{componentName:"ProportionalSymbolMap",width:s.width,height:s.height,children:e(yn,Object.assign({ref:l},Q))})});function _o(n){const o=go(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:l,nodeIdAccessor:a="id",xAccessor:c="lon",yAccessor:u="lat",valueAccessor:d="value",projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:g,zoomExtent:y,onZoom:v,dragRotate:m,tileURL:b,tileAttribution:x,tileCacheSize:k,lineType:w="geo",flowStyle:j="basic",areas:O,areaStyle:S={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:A,edgeOpacity:C=.6,edgeWidthRange:z=[1,8],edgeLinecap:P="round",colorScheme:L,showParticles:I,particleStyle:D,tooltip:$,annotations:R,margin:W,className:B,selection:T,linkedHover:N,onObservation:E,onClick:_,chartId:H,loading:F,emptyContent:q,frameProps:G={},legendInteraction:V,legendPosition:U,stroke:Z,strokeWidth:Y,opacity:X}=n,Q=null!=g?g:!!b,K=Ro(O),J=r(()=>Ft(l),[l]),ee=To({data:null!=i?i:Ht,rawData:i,colorBy:A,colorScheme:L,legendInteraction:V,legendPosition:U,selection:T,linkedHover:N,fallbackFields:A?["string"==typeof A?A:""]:[],unwrapData:!1,onObservation:E,onClick:_,chartType:"FlowMap",chartId:H,showLegend:o.showLegend,userMargin:W,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:F,emptyContent:q,width:o.width,height:o.height}),te=ee.data,ne=io(N),oe=eo({name:(null==ne?void 0:ne.name)||"hover",fields:(null==ne?void 0:ne.fields)||[]}),ie=Kn(e=>e.pushObservation),re=r(()=>{const e=new Map;for(const t of J)e.set(t[a]+"",t);return e},[J,a]),le=r(()=>{const e=new Map;for(const t of te)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},[te]),se=s(e=>{var t,n;if(N)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=le.get(t[a]+"");e&&oe.onHover(e)}else oe.onHover(t)}else oe.onHover(null);if(E||ie){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:H};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const r=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});E&&E(r),ie&&ie(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});E&&E(e),ie&&ie(e)}}},[N,oe,a,le,E,H,ie]),ae=ee.customClickBehavior,ce=r(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];return te.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=re.get(n.source+""),i=re.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[c]:e(o),[u]:t(o)},{[c]:e(i),[u]:t(i)}]}):null}).filter(Boolean)},[te,re,c,u]),ue=r(()=>{const e=te.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[d])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>z[0]:M().domain([Math.min(...e),Math.max(...e)]).range(z)},[te,d,z]),de=r(()=>e=>{var t;return{stroke:A?Hn(e,A,ee.colorScale):so,strokeWidth:ue(null!==(t=e[d])&&void 0!==t?t:0),strokeLinecap:P,opacity:C}},[A,ee.colorScale,ue,d,C,P]),he=r(()=>{var e;const t=vo(de,{stroke:Z,strokeWidth:Y,opacity:X});if(!ee.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=ee.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return ro(t,ee.effectiveSelectionHook,Object.assign(Object.assign({},ee.resolvedSelection||{}),{unselectedStyle:n}))},[de,ee.effectiveSelectionHook,ee.resolvedSelection,Z,Y,X]),fe=r(()=>vo(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:Z,strokeWidth:Y,opacity:X}),[Z,Y,X]),pe=r(()=>n=>{var o,i,r,l,s,c,u;if((null==n?void 0:n.geometry)||(null==n?void 0:n.properties)||(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.geometry)){const t=(null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i.name)||(null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||(null===(s=null===(l=null==n?void 0:n.data)||void 0===l?void 0:l.properties)||void 0===s?void 0:s.name)||(null===(u=null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.properties)||void 0===u?void 0:u.NAME);if(t)return e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:t})})}if(null!=(null==n?void 0:n.source)&&null!=(null==n?void 0:n.target)){const o=n[d];return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t("div",{style:{fontWeight:600},children:[n.source," → ",n.target]}),null!=o&&e("div",{style:{opacity:.7},children:"number"==typeof o?o.toLocaleString():o})]})}const h=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n[a]);return null!=h?e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:h})}):null},[d,a]),ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h,lines:ce,points:J,xAccessor:c,yAccessor:u,lineDataAccessor:"coordinates",lineType:w,flowStyle:j,lineStyle:he,pointStyle:fe},K&&{areas:K,areaStyle:S}),null!=f&&{graticule:f}),null!=p&&{fitPadding:p}),Q&&{zoomable:!0}),y&&{zoomExtent:y}),v&&{onZoom:v}),null!=m&&{dragRotate:m}),I&&{showParticles:I}),D&&{particleStyle:D}),b&&{tileURL:b}),x&&{tileAttribution:x}),k&&{tileCacheSize:k}),{size:[o.width,o.height],margin:ee.margin,enableHover:!0,tooltipContent:!1===$?()=>null:kn($)||pe}),ee.legendBehaviorProps),(N||E||_)&&{customHoverBehavior:se}),(E||_)&&{customClickBehavior:ae}),R&&R.length>0&&{annotations:R}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),B&&{className:B}),null!=n.animate&&{animate:n.animate}),G);return ee.earlyReturn?ee.earlyReturn:e(wo,{componentName:"FlowMap",width:o.width,height:o.height,children:e(yn,Object.assign({},ge))})}Eo.displayName="ProportionalSymbolMap",_o.displayName="FlowMap";const Ho=f(function(n,o){const l=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:a,lines:c,xAccessor:h="lon",yAccessor:f="lat",nodeIdAccessor:p="id",center:g,costAccessor:y,strength:v=1,lineMode:m="straight",projection:b="mercator",graticule:x,fitPadding:k,zoomable:w,zoomExtent:j,onZoom:O,dragRotate:S,tileURL:M,tileAttribution:A,tileCacheSize:C,transition:z,colorBy:P,colorScheme:L,pointRadius:I=5,tooltip:D,showRings:$=!0,ringStyle:R,showNorth:W=!0,costLabel:B,annotations:T,margin:N,className:E,selection:_,linkedHover:H,onObservation:F,onClick:q,chartId:G,loading:V,emptyContent:U,legendPosition:Z,frameProps:Y={},stroke:X,strokeWidth:Q,opacity:K}=n,J=null!=w?w:!!M,ee=r(()=>Ft(a),[a]),te=To({data:ee,rawData:a,colorBy:P,colorScheme:L,legendInteraction:void 0,legendPosition:Z,selection:_,linkedHover:H,fallbackFields:P?["string"==typeof P?P:""]:[],unwrapData:!1,onObservation:F,onClick:q,chartType:"DistanceCartogram",chartId:G,showLegend:l.showLegend,userMargin:N,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:V,emptyContent:U,width:l.width,height:l.height}),ne=r(()=>{const e=vo(e=>({fill:P?Hn(e,P,te.colorScale):so,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:I}),{stroke:X,strokeWidth:Q,opacity:K});return te.effectiveSelectionHook?ro(e,te.effectiveSelectionHook,te.resolvedSelection):e},[P,te.colorScale,te.effectiveSelectionHook,te.resolvedSelection,I,X,Q,K]),oe=r(()=>({center:g,centerAccessor:p,costAccessor:y,strength:v,lineMode:m}),[g,p,y,v,m]),ie=r(()=>{if(!c)return;const e="function"==typeof h?h:e=>e[h],t="function"==typeof f?f:e=>e[f],n=new Map;for(const e of ee)n.set(e[p]+"",e);return c.map(o=>{if(o.coordinates)return o;const i=n.get(o.source+""),r=n.get(o.target+"");return i&&r?Object.assign(Object.assign({},o),{coordinates:[{[h]:e(i),[f]:t(i)},{[h]:e(r),[f]:t(r)}]}):null}).filter(Boolean)},[c,ee,h,f,p]),re=r(()=>n=>{const o=("function"==typeof y?y:e=>e[y])(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:n[p]||n.name||n.id||"Point"}),null!=o&&t("div",{style:{opacity:.7},children:["Cost: ","number"==typeof o?o.toFixed(1):o]})]})},[y,p]),le=i(null);No(o,{variant:"geo-points",frameRef:le});const[se,ae]=u(null),ce=s(()=>{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&&ae(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);d(()=>{const e=requestAnimationFrame(ce);return()=>cancelAnimationFrame(e)},[ce,v,g,l.width,l.height,ee]);const ue=r(()=>{if(!$||!se)return[];const{maxCost:e}=se;if(0>=e)return[];if(Array.isArray($))return $.filter(t=>t>0&&e>=t);const t="number"==typeof $?$: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},[$,se]),de=r(()=>{var n,o;if(!se)return Y.foregroundGraphics||null;const{cx:i,cy:r,maxCost:l,availableRadius:s}=se,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},R),c=null!==(n=te.margin.left)&&void 0!==n?n:10,u=null!==(o=te.margin.top)&&void 0!==o?o:10;return t("g",{children:[ue.map(n=>{const o=n/l*s;return t("g",{children:[e("circle",{cx:i+c,cy:r+u,r:o,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),t("text",{x:i+c+o+3,y:r+u-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif",children:[n,B?" "+B:""]})]},n)}),W&&t("g",{transform:`translate(${c+24}, ${u+24})`,children:[e("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),Y.foregroundGraphics]})},[se,ue,W,B,R,te.margin,Y.foregroundGraphics]);Ao("DistanceCartogram",ee,"xAccessor",h),Ao("DistanceCartogram",ee,"yAccessor",f);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:b},null!=a&&{points:ee}),ie&&{lines:ie,lineDataAccessor:"coordinates"}),{xAccessor:h,yAccessor:f,pointIdAccessor:p,pointStyle:ne,projectionTransform:oe}),z&&{transition:{duration:z}}),null!=x&&{graticule:x}),null!=k&&{fitPadding:k}),J&&{zoomable:!0}),j&&{zoomExtent:j}),O&&{onZoom:O}),null!=S&&{dragRotate:S}),M&&{tileURL:M}),A&&{tileAttribution:A}),C&&{tileCacheSize:C}),{size:[l.width,l.height],margin:te.margin,enableHover:!0,tooltipContent:!1===D?()=>null:kn(D)||re}),te.legendBehaviorProps),(H||F||q)&&{customHoverBehavior:te.customHoverBehavior}),(F||q)&&{customClickBehavior:te.customClickBehavior}),T&&T.length>0&&{annotations:T}),l.title&&{title:l.title}),l.description&&{description:l.description}),l.summary&&{summary:l.summary}),void 0!==l.accessibleTable&&{accessibleTable:l.accessibleTable}),E&&{className:E}),null!=n.animate&&{animate:n.animate}),Y),de&&{foregroundGraphics:de});return te.earlyReturn?te.earlyReturn:e(wo,{componentName:"DistanceCartogram",width:l.width,height:l.height,children:e(yn,Object.assign({ref:le},he))})});function Fo(e,t,n){const{featureKey:o,dataKey:i}=n,r=new Map;for(const e of t)r.set(e[i]+"",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=r.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})}Ho.displayName="DistanceCartogram";export{Bo as ChoroplethMap,Ho as DistanceCartogram,_o as FlowMap,Eo as ProportionalSymbolMap,yn as StreamGeoFrame,Fo as mergeData,$o as resolveReferenceGeography};
|