semiotic 3.1.2 → 3.2.0
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 +134 -216
- package/LICENSE +197 -10
- package/README.md +1 -0
- package/ai/dist/componentRegistry.js +6 -0
- package/ai/dist/mcp-server.js +115 -5
- package/ai/examples.md +93 -0
- package/ai/schema.json +3916 -878
- package/ai/system-prompt.md +27 -0
- package/dist/components/ThemeProvider.d.ts +5 -3
- package/dist/components/charts/geo/ChoroplethMap.d.ts +1 -1
- package/dist/components/charts/index.d.ts +8 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +1 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +1 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +55 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +1 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +1 -0
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -0
- package/dist/components/charts/shared/colorManipulation.d.ts +15 -0
- package/dist/components/charts/shared/formatUtils.d.ts +28 -0
- package/dist/components/charts/shared/hatchPattern.d.ts +35 -0
- package/dist/components/charts/shared/hooks.d.ts +16 -1
- package/dist/components/charts/shared/legendUtils.d.ts +2 -1
- package/dist/components/charts/shared/selectionUtils.d.ts +11 -0
- package/dist/components/charts/shared/statisticalOverlays.d.ts +49 -5
- package/dist/components/charts/shared/types.d.ts +4 -1
- package/dist/components/charts/xy/Heatmap.d.ts +1 -1
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +71 -0
- package/dist/components/realtime/types.d.ts +2 -0
- package/dist/components/semiotic-ai.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +3 -0
- package/dist/components/semiotic-themes.d.ts +64 -0
- package/dist/components/semiotic-xy.d.ts +1 -0
- package/dist/components/semiotic.d.ts +11 -5
- package/dist/components/store/ThemeStore.d.ts +22 -2
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +1 -0
- package/dist/components/stream/PipelineStore.d.ts +2 -0
- package/dist/components/stream/SVGOverlay.d.ts +5 -3
- package/dist/components/stream/accessorUtils.d.ts +14 -0
- package/dist/components/stream/networkTypes.d.ts +2 -0
- package/dist/components/stream/ordinalSceneBuilders/barFunnelScene.d.ts +27 -0
- package/dist/components/stream/ordinalSceneBuilders/funnelScene.d.ts +26 -0
- package/dist/components/stream/ordinalTypes.d.ts +16 -2
- package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +12 -0
- package/dist/components/stream/renderers/trapezoidCanvasRenderer.d.ts +15 -0
- package/dist/components/stream/sceneUtils.d.ts +10 -0
- package/dist/components/stream/types.d.ts +10 -3
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +1 -0
- package/dist/semiotic-ai.d.ts +3 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-ordinal.d.ts +3 -0
- package/dist/semiotic-statisticalOverlays-D8LhSbQt.js +1 -0
- package/dist/semiotic-themes.d.ts +64 -0
- package/dist/semiotic-themes.min.js +1 -0
- package/dist/semiotic-themes.module.min.js +1 -0
- package/dist/semiotic-xy.d.ts +1 -0
- package/dist/semiotic.d.ts +11 -5
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy-statisticalOverlays-C2PPlmXv.js +1 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +24 -5
- package/dist/semiotic-ai-statisticalOverlays-C1f7TYyD.js +0 -1
- package/dist/semiotic-statisticalOverlays-C1f7TYyD.js +0 -1
- package/dist/xy-statisticalOverlays-C1f7TYyD.js +0 -1
package/dist/geo.module.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useRef as t,useState as n,useEffect as o,useMemo as r,createContext as i,useContext as a,useCallback as s,useSyncExternalStore as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{geoPath as p,geoGraticule as h,geoDistance as g,geoInterpolate as y,geoEqualEarth as f,geoEquirectangular as m,geoNaturalEarth1 as b,geoOrthographic as v,geoAlbersUsa as x,geoMercator as k}from"d3-geo";import{scaleLinear as w,scaleOrdinal as A,scaleSequential as j}from"d3-scale";import{bin as E,extent as O}from"d3-array";import{packEnclose as S}from"d3-hierarchy";import{area as M,curveCatmullRom as C,curveCardinal as $,curveBasis as L,curveStepBefore as z,curveStepAfter as P,curveStep as D,curveMonotoneY as N,curveMonotoneX as I,curveLinear as B,line as W,curveNatural as R}from"d3-shape";import T from"regression";import{zoomIdentity as _,zoom as H}from"d3-zoom";import{select as F}from"d3-selection";import{schemeCategory10 as q,interpolatePlasma as G,interpolateViridis as V,interpolatePurples as Z,interpolateOranges as U,interpolateGreens as Y,interpolateReds as X,interpolateBlues as K,schemeSet3 as J,schemeTableau10 as Q}from"d3-scale-chromatic";class ee{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function te(e,t,n){return e+(t-e)*n}const ne={mercator:k,equalEarth:f,albersUsa:x,orthographic:v,naturalEarth:b,equirectangular:m};function oe(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function re(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function ie(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):n}const ae={fill:"#e0e0e0",stroke:"#999",strokeWidth:.5,fillOpacity:1},se={fill:"#4e79a7",r:4,fillOpacity:.8},le={stroke:"#4e79a7",strokeWidth:1.5,fill:"none"};function ce(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 ue(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const a=-r/i,s=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;d.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return d}function de(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,a;0===t?(i=e[1][0]-r[0],a=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],a=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(i*i+a*a)||1;o.push([r[0]+a/s*n,r[1]+-i/s*n])}return o}function pe(e,t,n,o,r){const i=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(i*i+a*a);if(0===s)return[e,t];const l=a/s,c=-i/s,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}class he{constructor(e){this.scene=[],this.scales=null,this.version=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e}initStreaming(e=500){this.pointBuffer=new ee(e),this.timestampBuffer=new ee(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return f();if("string"==typeof e){const t=ne[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),f())}if("object"==typeof e&&"type"in e){const t=ne[e.type],n=t?t():f();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=p(this.projection),this.fitProjection(e),this.geoPath=p(this.projection);const n=this.projection;this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null};const o=this.scene;this.scene=this.buildSceneNodes(e),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&o.length>0&&this.startTransition(o),this.version++}fitProjection(e){var t,n,o,r,i;const a=this.projection,s=this.config,l=[...this.areas],c=oe(s.xAccessor,"lon"),u=oe(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const p=re(s.lineDataAccessor);for(const e of this.lineData){const t=p(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==l.length){if(s.projectionExtent){const[[t,n],[o,r]]=s.projectionExtent;a.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,r],[t,r],[t,n]]]}})}else if(a.clipAngle&&(null!==(t=a.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=s.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);a.scale(o/2-o*t),a.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,r=e.height*t;a.fitExtent([[n,r],[e.width-n,e.height-r]],{type:"FeatureCollection",features:l})}this.baseScale=a.scale(),this.baseTranslate=a.translate(),this.baseRotation=null!==(i=null===(r=a.rotate)||void 0===r?void 0:r.call(a))&&void 0!==i?i:[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=p(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=p(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;n&&n.rotate&&(n.rotate(e),this.geoPath=p(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.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}buildSceneNodes(e){var t,n,o;const r=[],{config:i}=this,a=this.projection,s=this.geoPath,l=oe(i.xAccessor,"lon"),c=oe(i.yAccessor,"lat");if(i.graticule){const t=!0===i.graticule?{}:i.graticule,n=h();t.step&&n.step(t.step);const o=s(n())||"";o&&r.push({type:"geoarea",pathData:o,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=s(e);if(!t)continue;const n=s.centroid(e),o=s.bounds(e),a=s.area(e),l=ie(i.areaStyle,e,ae);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:a,style:l,datum:e,interactive:!0})}const u=re(i.lineDataAccessor);for(const t of this.lineData){const n=u(t);if(!n||2>n.length)continue;const o=n.map(e=>[l(e),c(e)]);let s;if("geo"===i.lineType){const e=[];for(let t=0;o.length-1>t;t++){const n=o[t],r=o[t+1],i=g(n,r)||0,a=Math.max(2,Math.ceil(i/(Math.PI/180))),s=y(n,r);for(let n=0;a>=n;n++)t>0&&0===n||e.push(s(n/a))}s=e.map(([e,t])=>a([e,t])).filter(e=>null!=e)}else s=o.map(([e,t])=>a([e,t])).filter(e=>null!=e);if(2>s.length)continue;const d=ie(i.lineStyle,t,le),p="number"==typeof d.strokeWidth?d.strokeWidth:1;2!==o.length||2>s.length||"arc"!==i.flowStyle?2!==o.length||2>s.length||"offset"!==i.flowStyle||(s="geo"===i.lineType?de(s,p):pe(s[0],s[s.length-1],0,0,p)):s=ue(s[0],s[s.length-1]);const h=ce(s,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({},d),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>s.length&&h[0]||s,style:d,datum:t})}const d=this.getPoints(),p=i.pointIdAccessor?"function"==typeof i.pointIdAccessor?i.pointIdAccessor:e=>e[i.pointIdAccessor]:null,f=a.clipAngle&&null!==(t=a.clipAngle())&&void 0!==t?t:0,m=f>0?f*Math.PI/180:null,b=a.rotate?a.rotate():[0,0,0],v="function"==typeof a.center?a.center():[0,0],x=[(null!==(n=v[0])&&void 0!==n?n:0)-b[0],(null!==(o=v[1])&&void 0!==o?o:0)-b[1]];for(let e=0;d.length>e;e++){const t=d[e],n=l(t),o=c(t);if(null!=m&&g([n,o],x)>m)continue;const s=a([n,o]);if(!s)continue;const u=i.pointStyle?i.pointStyle(t):Object.assign({},se),h={type:"point",x:s[0],y:s[1],r:u.r||4,style:u,datum:t,pointId:p?p(t)+"":void 0};r.push(h)}return r}applyCartogramTransform(e,t){var n,o,r;const i=this.scene.filter(e=>"point"===e.type);if(2>i.length)return;const a=null!==(n=e.strength)&&void 0!==n?n:1;if(0===a)return;const s=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,l="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=i.find(t=>s(t.datum)+""==e.center+"");if(!c)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const u=c.x,d=c.y,p=i.map(e=>l(e.datum)).filter(e=>isFinite(e)&&e>=0),h=Math.max(...p,1),g=Math.min(t.width,t.height)/2,y=w().domain([0,h]).range([0,g]);this.cartogramLayout={cx:u,cy:d,maxCost:h,availableRadius:g},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of i){if(e===c)continue;const t=Math.atan2(e.y-d,e.x-u),n=Math.sqrt(Math.pow(e.x-u,2)+Math.pow(e.y-d,2)),o=l(e.datum),r=n+((isFinite(o)?y(o):n)-n)*a;e.x=u+Math.cos(t)*r,e.y=d+Math.sin(t)*r}const f=t.width/2,m=t.height/2,b=f-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:f,cy:m,maxCost:h,availableRadius:g};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(){var e,t,n;const o=this.config.decay;if(!o||!this.pointBuffer)return;const r=this.pointBuffer.size;if(0===r)return;const i=null!==(e=o.minOpacity)&&void 0!==e?e:.1,a=null!==(t=o.halfLife)&&void 0!==t?t:r/2,s=null!==(n=o.stepThreshold)&&void 0!==n?n:.5*r,l=this.scene.filter(e=>"point"===e.type);for(let e=0;l.length>e;e++){const t=r-1-e;let n;switch(o.type){case"exponential":n=i+Math.pow(.5,t/a)*(1-i);break;case"step":n=s>t?1:i;break;default:n=i+(r>1?1-t/(r-1):1)*(1-i)}l[e]._decayOpacity=n,l[e].style=Object.assign(Object.assign({},l[e].style),{opacity:n})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),a=this.timestampBuffer.toArray();for(let e=0;i.length>e&&a.length>e;e++){const s=r-a[e];o>s&&(i[e]._pulseIntensity=1-s/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of i)if(e.pointId){const t=r.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(a=!0))}a&&(this.activeTransition={startTime:performance.now(),duration:o})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=te(e.x,e._targetX,n),e.y=te(t,e._targetY,n)}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0);return this.activeTransition=null,!1}return!0}}function ge(e,t,n,o,r,i){const a=e.filter(e=>"point"===e.type);let s=null,l=o;for(const e of a){const o=e.x-t,r=e.y-n,i=Math.sqrt(o*o+r*r);(e.r||4)+4>=i&&l>i&&(s=e,l=i)}if(s)return{node:s,distance:l};const c=e.filter(e=>"geoarea"===e.type&&!1!==e.interactive);for(let e=c.length-1;e>=0;e--){const o=c[e],[[i,a],[s,l]]=o.bounds;if(!(i>t||t>s||a>n||n>l)&&(o._cachedPath2D||(o._cachedPath2D=new Path2D(o.pathData)),r.isPointInPath(o._cachedPath2D,t,n)))return{node:o,distance:0}}const u=e.filter(e=>"line"===e.type);let d=null,p=o;for(const e of u){const{path:o}=e;for(let r=0;o.length-1>r;r++){const[i,a]=o[r],[s,l]=o[r+1],c=ye(t,n,i,a,s,l);Math.max((e.style.strokeWidth||2)+4,5)>=c&&p>c&&(d=e,p=c)}}return d?{node:d,distance:p}:null}function ye(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}const fe={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function me(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,fe[n])(o(e,t)),r}function be(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ve(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function xe({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:a,format:s}=t,l=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:s+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function ke(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[p,h]=e.useState(0),[g,y]=e.useState(0),f=e.useCallback((e,t)=>{h(e),y(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const p=[];return t.forEach((t,h)=>{d+=5,p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+h,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,p.push(e.createElement("text",{key:"legend-text-"+h,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),p.push(e.createElement("g",{key:"legend-group-"+h,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:p,items:h}=t,g=[];let y=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return h.forEach((t,u)=>{const b=me(t,u,d,p),v=ve(t,r,i),x=i&&i.size>0&&i.has(t.label);g.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${y})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===a&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+h.length)%h.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&e.createElement(be,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),y+=22}),g})(t,o,r,i,a,s,l,h,c,u))),d+=22*t.items.length+8}),p})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:g,onFocusedIndexChange:f,legendInteraction:s}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let p=0;const h=[];t.forEach((t,n)=>{let o=0;t.label&&(o+=16);const g=((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:p,items:h}=t,g=[];let y=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return h.forEach((t,u)=>{const b=me(t,u,d,p),v=ve(t,r,i),x=i&&i.size>0&&i.has(t.label);g.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${y},0)`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===a&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+h.length)%h.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&e.createElement(be,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),y+=26+7*t.label.length}),{items:g,offset:y}})(t,r,i,a,s,l,c,n,u,d);o+=g.offset+5,h.push(Object.assign(Object.assign({label:t.label},g),{offset:o})),p+=o+12});let g=Math.max(0,(o-p)/2);const y=[];return h.forEach((o,r)=>{const i=t[r];i.label&&(y.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),g+=16),y.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${g},0)`},o.items)),g+=o.offset+5,t[r+1]&&y.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:g,y1:-8,x2:g,y2:n+0+8})),g+=12}),e.createElement("g",null,y)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:g,onFocusedIndexChange:f,legendInteraction:s}),b=!(!o&&!r);return e.createElement("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==s&&(void 0!==s||null==a))||void 0,"aria-label":"Chart legend"},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},l),m)}function we(e){return"string"==typeof e?{type:e}:e}function Ae({orient:t,config:n,values:o,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(n),c="top"===t||"bottom"===t,u=r(()=>{if(0===o.length)return null;const n=i.domain(),r=a-8;if("boxplot"===l.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(o);if(!n)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:p}=n,h=Math.min(.5*r,20),g=(r-h)/2+4;if(c){const n=i(a),o=i(u),r=i(s),c=i(d),y=i(p),f="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+f*(g+h/2),x2:y,y2:m+f*(g+h/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+f*g,x2:c,y2:m+f*(g+h),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:y,y1:m+f*g,x2:y,y2:m+f*(g+h),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-g-h:m+g,width:Math.abs(o-n),height:h,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===t?m-g-h:m+g,x2:r,y2:"top"===t?m-g:m+g+h,stroke:l.fill,strokeWidth:2}))}{const n=i(a),o=i(u),r=i(s),c=i(d),y=i(p),f="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+f*(g+h/2),y1:c,x2:m+f*(g+h/2),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*g,y1:c,x2:m+f*(g+h),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*g,y1:y,x2:m+f*(g+h),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-g-h:m+g,y:Math.min(n,o),width:h,height:Math.abs(o-n),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===t?m-g-h:m+g,y1:r,x2:"left"===t?m-g:m+g+h,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=E().domain(n).thresholds(l.bins)(o);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((n,o)=>{if(null==n.x0||null==n.x1)return null;const a=n.length/d*r;if(c){const r=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:o,x:r,y:"top"===t?-4-a:4,width:Math.max(s,.5),height:a,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const r=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:o,x:"left"===t?-4-a:4,y:Math.min(r,r+s),width:a,height:Math.abs(s),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const n=r/2+4,o=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const a=e.length/d*(r/2),s=i((e.x0+e.x1)/2);o.push(c?`${s},${"top"===t?-(n-a):n-a}`:`${"left"===t?-(n-a):n-a},${s}`)}for(let e=u.length-1;e>=0;e--){const a=u[e];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(r/2),l=i((a.x0+a.x1)/2);o.push(c?`${l},${"top"===t?-(n+s):n+s}`:`${"left"===t?-(n+s):n+s},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+t},e.createElement("polygon",{points:o.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const n=[];if(c){const e=0,o=null!=u[0].x0?i(u[0].x0):0;n.push(`M${o},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/d*r,a=i((e.x0+e.x1)/2);n.push(`L${a},${"top"===t?-o-4:o+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${a},${e}`),n.push("Z")}else{const e=0,o=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${o}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/d*r,a=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-o-4:o+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${e},${a}`),n.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+t},e.createElement("path",{d:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[o,i,l,a,s,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function je(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Ee(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 Oe(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:p,className:h,disable:g,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(g)?g:[]);let b=r||0,v=i||0;null!=a&&(b=a-n),null!=s&&(v=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===b&&0===v)if(void 0!==u.width){b=u.width/2;const e=u.depth||30;v=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;b=e+(0>e?-5:5),v=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(h||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y),!m.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,p=t*d>n*u?u/t:d/n;l=r+a*p,c=i+s*p}}}else if("bracket"===i&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(s.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(b,v,c,p,x,u),!m.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&s.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-a;s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:Ee((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"currentColor"}));break}}return e.createElement("g",{className:"annotation-subject"},s)}(x,u,p,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let p=l;p&&"dynamic"!==p||(p="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===d?"right"===p?h="end":"middle"===p&&(h="middle"):h=0>n?"end":"start";const g=16,y=a?u?[a]:je(a,c):[],f=i?u?[i]:je(i,c):[],m="leftRight"===d?"end"===h?-4:4:0;let b=0;const v=[];y.length>0&&(v.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:h,fontWeight:"bold"},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:g},t)))),b=y.length*g),f.length>0&&v.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:h,y:b},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:g},t))));let x=null;if((a||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(y.length+f.length)*g+(f.length>0?g:0);let n=0,o=t;"bottom"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const k=Math.max(0,y.length+f.length-1)*g;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===p?-(k+g+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===p||0>o?-(k+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0},v),x)}(l,b,v,p))}function Se(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e.createElement(Oe,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Oe,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}const Me={linear:B,monotoneX:I,monotoneY:N,step:D,stepAfter:P,stepBefore:z,basis:L,cardinal:$,catmullRom:C};function Ce(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function $e(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function Le(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],p=l[e.yAccessor||"y"];return null==d||null==p?null:{x:c(d),y:u(p)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Ce(e,n),c=$e(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function ze(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Pe(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function De(e){return Math.round(100*e)/100+""}function Ne(e,t){return e instanceof Date&&(!(t&&t instanceof Date)||e.getFullYear()!==t.getFullYear()||e.getMonth()!==t.getMonth()||e.getDate()!==t.getDate())}function Ie(n){var o,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:p,axes:h,xLabel:g,yLabel:y,xFormat:f,yFormat:m,showGrid:b,title:v,legend:x,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:j,legendPosition:E="right",foregroundGraphics:O,marginalGraphics:C,xValues:$,yValues:L,annotations:z,svgAnnotationRules:P,xAccessor:D,yAccessor:N,annotationData:I,pointNodes:W,curve:R,underlayRendered:_,children:H}=n,F=r(()=>{var e;if(!p||!d)return[];const t=null==h?void 0:h.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||f||De,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return d.x.ticks(Math.min(o,Math.max(2,Math.floor(a/70)))).map(e=>({value:e,pixel:d.x(e),label:n(e)}))},[p,d,h,f,a]),q=r(()=>{var e;if(!p||!d)return[];const t=null==h?void 0:h.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||m||De,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)}))},[p,d,h,m,s]),G=t(new Map),V=t(null!==(o=null==z?void 0:z.length)&&void 0!==o?o:0),Z=null!==(i=null==z?void 0:z.length)&&void 0!==i?i:0;V.current!==Z&&(V.current=Z,G.current=new Map);const U=r(()=>{if(!z||0===z.length)return null;const t=function(t,n,o){var r,i,a,s,l,c,u,d,p,h,g,y,f,m,b,v,x,k,w,A,j,E,O,C,$,L,z,P,D,N,I,W,R,_,H,F,q,G,V,Z,U,Y,X,K;switch(t.type){case"label":{const r=Le(t,n,o);if(!r)return null;const{x:i,y:a}=r;return ze(i,a,o)?e.createElement(Se,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=Le(t,n,o);if(!r)return null;const{x:i,y:a}=r;return ze(i,a,o)?e.createElement(Se,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Ce(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:12,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=$e(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:r-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Ce(Object.assign(Object.assign({},e),{type:"point"}),o),y:$e(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=S(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Ce(Object.assign(Object.assign({},e),{type:"point"}),o),y:$e(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],a=t.style||{stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Ce(n,o),s=$e(n,o);return null==i||null==s?null:e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:t.r||6},a))}))}case"bracket":{const r=Ce(t,o),i=$e(t,o);return e.createElement(Se,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const p=o.xAccessor||"x",h=o.yAccessor||"y",g=d.map(e=>[e[p],e[h]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>g.length)return null;const y=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,f=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!y||!f)return null;const m=t.method||"linear";let b;b="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,p=0,h=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],p+=t*i[e],h+=t*r[e]*r[e],g+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const y=u*h-d*d;if(1e-12>Math.abs(y))s.push([t,p/u]);else{const e=(u*g-d*p)/y;s.push([t,(p-e*d)/u+e*t])}}return s}(g,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?T.polynomial(g,{order:t.order||2}):T.linear(g)).points;const v=b.map(([e,t])=>`${y(e)},${f(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:v,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:y(b[b.length-1][0])+4,y:f(b[b.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(p=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==p?p:null===(h=o.scales)||void 0===h?void 0:h.value,i=null!==(g=null==r?void 0:r(t.y0))&&void 0!==g?g:0,a=null!==(y=null==r?void 0:r(t.y1))&&void 0!==y?y:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-i),fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,a)-4,textAnchor:"end",fill:t.color||"#6366f1",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",a=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.x)&&void 0!==m?m:null===(b=o.scales)||void 0===b?void 0:b.time,s=null!==(x=null===(v=o.scales)||void 0===v?void 0:v.y)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.value;if(!a||!s)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const p=Me[o.curve||"linear"]||B,h=M().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(p)(d);if(!h)return null;const g=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:h,fill:g,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:a(d[d.length-1][i])+4,y:s(d[d.length-1][l])-4,fill:g,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(j=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==j?j:null===(E=o.scales)||void 0===E?void 0:E.time,s=null!==(C=null===(O=o.scales)||void 0===O?void 0:O.y)&&void 0!==C?C:null===($=o.scales)||void 0===$?void 0:$.value;if(!a||!s)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),p=null!==(L=t.threshold)&&void 0!==L?L:2,h=c-p*d,g=!1!==t.showBand,y=t.fill||"#6366f1",f=null!==(z=t.fillOpacity)&&void 0!==z?z:.1,m=t.anomalyColor||"#ef4444",b=null!==(P=t.anomalyRadius)&&void 0!==P?P:6,v=s(c+p*d),x=s(h),k=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>p*d});return e.createElement("g",{key:"ann-"+n},g&&e.createElement("rect",{x:0,y:Math.min(v,x),width:o.width||0,height:Math.abs(x-v),fill:y,fillOpacity:f}),k.map((t,n)=>{const r=Ce(t,o),i=$e(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(v,x)-4,textAnchor:"end",fill:y,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(N=null===(D=o.scales)||void 0===D?void 0:D.x)&&void 0!==N?N:null===(I=o.scales)||void 0===I?void 0:I.time,l=null!==(R=null===(W=o.scales)||void 0===W?void 0:W.y)&&void 0!==R?R:null===(_=o.scales)||void 0===_?void 0:_.value;if(!s||!l)return null;const c=r.map(e=>[e[i],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=T.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*e}const d=c.length,p=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),h=Math.sqrt(p/Math.max(d-2,1)),g=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),f=null!==(H=t.confidence)&&void 0!==H?H:.95,m=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,b=null!==(F=t.steps)&&void 0!==F?F:5,v=c[d-1][0],x=(v-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(v+e*x);const w=[];for(const e of k){const t=u(e),n=h*Math.sqrt(1+1/d+(y>0?Math.pow(e-g,2)/y:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,j=w.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),E=`${s(v)},${l(u(v))}`,O=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(q=t.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e.createElement("polyline",{points:`${E} ${j}`,fill:"none",stroke:O,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(V=t.strokeDasharray)&&void 0!==V?V:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:s(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:O,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=Le(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!ze(r,i,o))return null;const a=null!==(Z=t.dx)&&void 0!==Z?Z:0,s=null!==(U=t.dy)&&void 0!==U?U:0,l=null!==(Y=t.width)&&void 0!==Y?Y:32,c=null!==(X=t.height)&&void 0!==X?X:32,u=null!==(K=t.content)&&void 0!==K?K:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+a-l/2,y:i+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=Le(t,n,o);if(!r)return null;const{x:i,y:a}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:a+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}default:return null}},n={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:D,yAccessor:N,width:a,height:s,data:I,frameType:"xy",pointNodes:W,curve:R,stickyPositionCache:G.current};return z.map((e,o)=>{if(P){const r=P(e,o,n);return null!=r?r:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[z,P,a,s,D,N,I,d,W,R]);return p||v||x||O||C||U&&U.length>0||b||H?e.createElement("svg",{role:"img",width:l,height:c,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof v?v:"XY Chart"),e.createElement("desc",null,"string"==typeof v?v+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},b&&d&&!_&&e.createElement("g",{className:"stream-grid"},F.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),q.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:a,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),p&&d&&(()=>{const t=null==h?void 0:h.find(e=>"left"===e.orient),n=null==h?void 0:h.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=(null==t?void 0:t.jaggedBase)||!1,i=(null==n?void 0:n.jaggedBase)||!1,l=null==n?void 0:n.landmarkTicks,c=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, #666)",f="var(--semiotic-text, #333)";return e.createElement("g",{className:"stream-axes"},!_&&(!n||!1!==n.baseline)&&!i&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:d,strokeWidth:1}),!_&&i&&e.createElement("path",{d:Pe("bottom",a,s),fill:"none",stroke:d,strokeWidth:1}),F.map((t,n)=>{const o=!!l&&("function"==typeof l?l(t.value,n):Ne(t.value,n>0?F[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:d,strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:p,style:{userSelect:"none"}},t.label))}),g&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:f,style:{userSelect:"none"}},g),!_&&o&&!r&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:d,strokeWidth:1}),!_&&r&&e.createElement("path",{d:Pe("left",a,s),fill:"none",stroke:d,strokeWidth:1}),q.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):Ne(t.value,n>0?q[n-1].value:void 0));return e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:p,style:{userSelect:"none"}},t.label))}),y&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},y))})(),U,C&&d&&$&&L&&e.createElement(e.Fragment,null,C.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ae,{orient:"top",config:we(C.top),values:$,scale:d.x,size:u.top,length:a})),C.bottom&&e.createElement("g",{transform:`translate(0, ${s})`},e.createElement(Ae,{orient:"bottom",config:we(C.bottom),values:$,scale:d.x,size:u.bottom,length:a})),C.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ae,{orient:"left",config:we(C.left),values:L,scale:d.y,size:u.left,length:s})),C.right&&e.createElement("g",{transform:`translate(${a}, 0)`},e.createElement(Ae,{orient:"right",config:we(C.right),values:L,scale:d.y,size:u.right,length:s}))),O,H),v&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof v?v:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:p}=t;if(!n)return null;const h="top"===a||"bottom"===a;let g,y;return"left"===a?(g=4,y=i.top):"top"===a?(g=0,y=s?32:8):"bottom"===a?(g=0,y=r-i.bottom+50):(g=o-i.right+10,y=i.top),e.createElement("g",{transform:`translate(${g}, ${y})`},"object"==typeof(f=n)&&null!==f&&"gradient"in f?e.createElement(xe,{config:n.gradient,orientation:h?"horizontal":"vertical",width:h?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(ke,{legendGroups:n.legendGroups,title:"",width:h?o:100,orientation:h?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:p}):n);var f}({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:E,title:v,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:j})):null}const Be="undefined"==typeof window||"undefined"==typeof document,We={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Re(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks"},i=["point","line","area","rect","heatcell","circle","candlestick"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function Te({scene:t,chartType:n}){var o,r,i,a;const s=[];for(const e of t){if(s.length>=50)break;"point"===e.type?s.push({label:"Point",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+""}}):"rect"===e.type?s.push({label:"Bar",values:{category:(null===(o=e.datum)||void 0===o?void 0:o.category)||"",value:Math.round(100*(null!==(i=null===(r=e.datum)||void 0===r?void 0:r.value)&&void 0!==i?i:0))/100+""}}):"heatcell"===e.type&&s.push({label:"Cell",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+"",value:Math.round(100*(null!==(a=e.value)&&void 0!==a?a:0))/100+""}})}if(0===s.length)return null;const l=new Set;for(const e of s)for(const t of Object.keys(e.values))l.add(t);const c=Array.from(l);return e.createElement("table",{style:We,role:"table","aria-label":"Data table for "+n},e.createElement("thead",null,e.createElement("tr",null,c.map(t=>e.createElement("th",{key:t},t)))),e.createElement("tbody",null,s.map((t,n)=>e.createElement("tr",{key:n},c.map(n=>{var o;return e.createElement("td",{key:n},null!==(o=t.values[n])&&void 0!==o?o:"")}))),t.length>50&&e.createElement("tr",null,e.createElement("td",{colSpan:c.length},"...and ",t.length-50," more items"))))}function _e({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:We},n)}function He(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Fe(e,t,n=.6){var o,r,i,a,s;if(!He(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function qe(e,t,n,o=.35){He(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Ge(e){switch(e){case"monotoneX":return I;case"monotoneY":return N;case"cardinal":return $;case"catmullRom":return C;case"step":return D;case"stepBefore":return z;case"stepAfter":return P;case"basis":return L;case"natural":return R;default:return null}}function Ve(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 Ze(e,t,n,o,r,i){if(2>t.length)return;const a=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function Ue(e){return e.k}function Ye(e){return[e.x,e.y]}function Xe(e){return function(){return e}}function Ke([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function Je(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function Qe(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function et(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 tt{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 nt{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const a=n[i.lineIndex];if(!a||2>a.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const s=ot(a),l=rt(a,i.t*s),c=(o[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function ot(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 rt(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],a=Math.sqrt(r*r+i*i);if(n+a>=t||o===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[o-1][0]+r*s,y:e[o-1][1]+i*s,nx:-i/l,ny:r/l}}n+=a}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}function it(n){const o=i(null),c=at(n);return[function({children:t}){const i=r(()=>at(n),[]);return e.createElement(o.Provider,{value:i,children:t})},e=>{var n;const r=null!==(n=a(o))&&void 0!==n?n:c,i=t(e);i.current=e;const u=s(()=>i.current(r.getState()),[r]),d=s(()=>i.current(r.getState()),[r]);return l(r.subscribe,u,d)}]}function at(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const st={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},lt={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},[ct,ut]=it(e=>({theme:st,setTheme(t){e(e=>"light"===t?{theme:st}:"dark"===t?{theme:lt}:{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})})}})),dt={top:10,right:10,bottom:10,left:10},pt={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"},ht={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 gt({data:t}){if(!t)return null;if(t.properties)return e.createElement("div",{className:"semiotic-tooltip",style:pt},e.createElement("div",{style:{fontWeight:600}},t.properties.name||t.properties.NAME||t.properties.id||"Feature"));const n=Object.entries(t).slice(0,3);return e.createElement("div",{className:"semiotic-tooltip",style:pt},n.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,": "),e.createElement("span",{style:{fontWeight:600}},n+""))))}const yt=c(function(i,a){var l,c,d,p,h,g,y;const{projection:f,projectionExtent:m,fitPadding:b,projectionTransform:v,areas:x,points:k,lines:w,xAccessor:A,yAccessor:j,lineDataAccessor:E,pointIdAccessor:O,lineType:S="geo",flowStyle:M="basic",graticule:C,zoomable:$,zoomExtent:L,onZoom:z,dragRotate:P,showParticles:D,particleStyle:N,tileURL:I,tileAttribution:B,tileCacheSize:R,size:T,width:q,height:G,responsiveWidth:V,responsiveHeight:Z,margin:U,className:Y,background:X,areaStyle:K,pointStyle:J,lineStyle:Q,colorScheme:ee,enableHover:te=!0,hoverAnnotation:ne,tooltipContent:oe,customClickBehavior:re,customHoverBehavior:ie,annotations:ae,decay:se,pulse:le,transition:ce,staleness:ue,backgroundGraphics:de,foregroundGraphics:pe,title:ye,legend:fe,legendPosition:me,legendHoverBehavior:be,legendClickBehavior:ve,legendHighlightedCategory:xe,legendIsolatedCategories:ke,showAxes:we,accessibleTable:Ae}=i,je=T||[q||600,G||400],[Ee,Oe]=function(e,r,i){const a=t(null),[s,l]=n(null);return o(()=>{if(!r&&!i)return;const e=a.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[r,i]),[a,[r&&s?s.w:e[0],i&&s?s.h:e[1]]]}(je,V,Z),Se=r(()=>Object.assign(Object.assign({},dt),U),[U]),Me=Oe[0]-Se.left-Se.right,Ce=Oe[1]-Se.top-Se.bottom,$e="function"==typeof pe?pe({size:Oe,margin:Se}):pe,Le="function"==typeof de?de({size:Oe,margin:Se}):de,ze=r(()=>null!=P?P:"orthographic"===("string"==typeof f?f:"object"==typeof f&&"type"in f?f.type:null),[P,f]),Pe=r(()=>({projection:f,projectionExtent:m,fitPadding:b,xAccessor:A,yAccessor:j,lineDataAccessor:E,lineType:S,flowStyle:M,areaStyle:K,pointStyle:J,lineStyle:Q,colorScheme:ee,graticule:C,projectionTransform:v,decay:se,pulse:le,transition:ce,annotations:ae,pointIdAccessor:O}),[f,m,b,A,j,E,S,M,K,J,Q,ee,C,v,se,le,ce,ae,O]),De=t(null);De.current||(De.current=new he(Pe));const Ne=t(null),We=t(null),He=t(null),ot=t(null),rt=t(null);I&&!rt.current&&(rt.current=new tt(R||256));const it=t(0),at=t(!0),st=ut(e=>e.theme),lt=t(ae),ct=t(()=>{}),pt=t(null),yt=t(_),ft=t(!1),mt=t(null),bt=t(null),vt=t(null),xt=t(null),kt=t(0);if(D&&!xt.current){const e=null!==(l=null==N?void 0:N.maxPerLine)&&void 0!==l?l:30;xt.current=new nt(50*e)}const wt=t(null),At=t(null),[jt,Et]=n(null),[Ot,St]=n(0),[Mt,Ct]=n(!1),$t=s(()=>{it.current||(it.current=requestAnimationFrame(()=>ct.current()))},[]);o(()=>{at.current=!0,$t()},[st,$t]),o(()=>{var e;null===(e=De.current)||void 0===e||e.updateConfig(Pe),at.current=!0,$t()},[Pe,$t]),o(()=>{const e=De.current;e&&(x&&e.setAreas(x),k&&e.setPoints(k),w&&e.setLines(w),at.current=!0,$t())},[x,k,w,$t]);const Lt=s(e=>{var t;null===(t=De.current)||void 0===t||t.pushPoint(e),at.current=!0,$t()},[$t]),zt=s(e=>{var t;null===(t=De.current)||void 0===t||t.pushMany(e),at.current=!0,$t()},[$t]),Pt=s(()=>{var e;null===(e=De.current)||void 0===e||e.clear(),at.current=!0,$t()},[$t]);u(a,()=>({push:Lt,pushMany:zt,clear:Pt,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=De.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=De.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=De.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>yt.current.k,resetZoom:()=>{const e=mt.current;e&&pt.current&&F(e).call(pt.current.transform,_)},getData:()=>{const e=De.current;return e?e.scene.filter(e=>"point"===e.type).map(e=>e.datum).filter(Boolean):[]}}),[Lt,zt,Pt]);const Dt=t(()=>{});o(()=>{Dt.current=e=>{if(!te)return;const t=De.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Se.left,r=e.clientY-n.top-Se.top;if(0>o||o>Me||0>r||r>Ce)return wt.current=null,At.current=null,Et(null),null==ie||ie(null),void $t();ot.current||(ot.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=ot.current.getContext("2d");if(!i)return;const a=ge(t.scene,o,r,30,i);if(a){const e=a.node,t=e.datum,n=(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let i,s;"point"===e.type?(i=e.x,s=e.y):"geoarea"===e.type?(i=e.centroid[0],s=e.centroid[1]):(i=o,s=r);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,x:i,y:s,time:0});wt.current=l,At.current=e,Et(l),null==ie||ie({type:e.type,data:n,x:i,y:s}),$t()}else wt.current&&(wt.current=null,At.current=null,Et(null),null==ie||ie(null),$t())}},[te,Me,Ce,Se,ie,$t]);const Nt=s(e=>Dt.current(e),[]),It=s(()=>{wt.current=null,At.current=null,Et(null),null==ie||ie(null),$t()},[ie,$t]),Bt=s(e=>{if(!re)return;const t=De.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Se.left,r=e.clientY-n.top-Se.top;ot.current||(ot.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=ot.current.getContext("2d");if(!i)return;const a=ge(t.scene,o,r,30,i);if(a){const e=a.node.datum;re({type:a.node.type,data:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,x:o,y:r})}},[re,Se]);ct.current=()=>{var e,t,n,o,r,i,a;it.current=0;const s=We.current,l=De.current;if(!s||!l)return;const c=performance.now();let u=!1;const d=vt.current;d&&(vt.current=null,l.applyRotation(d,{width:Me,height:Ce}));const p=l.advanceTransition(c);if(at.current&&!p){const e={width:Me,height:Ce},t=ze?l.getRotation():null;l.computeScene(e);const n=yt.current,o=1!==n.k||0!==n.x||0!==n.y;ze&&t?o?(l.setRotation(t),l.applyZoomScale(n.k,e)):l.applyRotation(t,e):o&&l.applyZoomTransform(n,e),at.current=!1,s.setAttribute("aria-label",Re(l.scene,"Geographic chart"))}const h=Qe();if(I&&rt.current){const t=Ne.current;if(t&&(null===(e=l.scales)||void 0===e?void 0:e.projection)){const e=Je(t,Oe,Se,h);if(e){e.clearRect(-Se.left,-Se.top,Oe[0],Oe[1]),e.save(),e.beginPath(),e.rect(0,0,Me,Ce),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:a,onTileLoad:s}=t,l=o.scale(),c=o.translate(),u=2*l*Math.PI,d=function(){let e=0,t=0,n=960,o=500,r=!0,i=!0,a=256,s=Ue,l=Ye,c=0;function u(){const u=+s.apply(this,arguments),d=l.apply(this,arguments),p=Math.log2(u/a),h=Math.round(Math.max(p+c,0)),g=Math.pow(2,p-h)*a,y=+d[0]-u/2,f=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-y)/g)),b=Math.min(r?1<<h:1/0,Math.ceil((n-y)/g)),v=Math.max(i?0:-1/0,Math.floor((t-f)/g)),x=Math.min(i?1<<h:1/0,Math.ceil((o-f)/g)),k=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)k.push([t,e,h]);return k.translate=[y/g,f/g],k.scale=g,k}return u.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],u):[n-e,o-t]},u.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],u):[[e,t],[n,o]]},u.scale=function(e){return arguments.length?(s="function"==typeof e?e:Xe(+e),u):s},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:Xe([+e[0],+e[1]]),u):l},u.zoomDelta=function(e){return arguments.length?(c=+e,u):c},u.tileSize=function(e){return arguments.length?(a=+e,u):a},u.clamp=function(e){return arguments.length?(r=i=!!e,u):r&&i},u.clampX=function(e){return arguments.length?(r=!!e,u):r},u.clampY=function(e){return arguments.length?(i=!!e,u):i},u}().size([r,i]).scale(u).translate(c).clamp(!0)(),p=Qe();let h=!0;for(const t of d){const[o,r,i]=Ke(t),l=`${i}/${o}/${r}`;let c=a.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};a.set(l,t),e.onload=()=>{t.loaded=!0,null==s||s()},e.onerror=()=>{t.loaded=!0},e.src=et(n,i,o,r,p),c=t}if(!c.loaded){h=!1;continue}const u=d.scale;e.drawImage(c.img,(t[0]+d.translate[0])*u-.5,(t[1]+d.translate[1])*u-.5,u+1,u+1)}return h}(e,{tileURL:I,projection:l.scales.projection,width:Me,height:Ce,tileCache:rt.current,onTileLoad:()=>$t()});e.restore(),t||(u=!0)}}}const g=Je(s,Oe,Se,h);if(!g)return;g.clearRect(-Se.left,-Se.top,Oe[0],Oe[1]),X&&!I&&(g.fillStyle=X,g.fillRect(0,0,Me,Ce)),g.save(),g.beginPath(),g.rect(0,0,Me,Ce),g.clip();const y=l.scene,f={height:Ce};if(function(e,t){var n,o,r;const i=t.filter(e=>"geoarea"===e.type);for(const t of i){if(!t.pathData)continue;const i=new Path2D(t.pathData),a=t.style.fill||"#e0e0e0";if("none"!==a&&(e.fillStyle=a,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(i)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(r=t._decayOpacity)&&void 0!==r?r:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(i)}qe(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(g,y),((e,t,n,o)=>{var r,i;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s.style.stroke||"#007bff",c=s.style.strokeWidth||2,u=s.colorThresholds,d=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=c,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const y=null!==(r=s.style.opacity)&&void 0!==r?r:1;Ze(e,s.path,l,c,y,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=Ge(s.curve),h=u&&u.length>0&&d&&d.length===s.path.length,g=s._decayOpacities;if(g&&g.length===s.path.length&&!h){e.strokeStyle=l;const f=null!==(i=s.style.opacity)&&void 0!==i?i:1;for(let m=0;s.path.length-1>m;m++)e.globalAlpha=.5*(g[m]+g[m+1])*f,e.beginPath(),e.moveTo(s.path[m][0],s.path[m][1]),e.lineTo(s.path[m+1][0],s.path[m+1][1]),e.stroke()}else if(h){let b=null,v=null,x=null,k=null,w=!1;function A(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),w=!0}function j(){w&&(e.stroke(),w=!1)}for(let E=0;s.path.length>E;E++){const[O,S]=s.path[E],M=d[E],C=Ve(M,u,l);if(null!==b&&null!==k&&null!==x){if(C===k)e.lineTo(O,S);else{const $=[];for(const L of u){const z=L.value;(x>z||z>M)&&(z>x||M>z)||x===z||M===z||$.push({t:(z-x)/(M-x)})}$.sort((e,t)=>e.t-t.t);for(const P of $){const D=b+(O-b)*P.t,N=v+(S-v)*P.t,I=Ve(x+(M-x)*Math.min(P.t+1e-4,1),u,l);e.lineTo(D,N),j(),A(I,D,N)}e.lineTo(O,S)}b=O,v=S,x=M,k=C}else A(C,O,S),b=O,v=S,x=M,k=C}j()}else{if(e.beginPath(),e.strokeStyle=l,p)W().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[B,R]=s.path[0];e.moveTo(B,R);for(let T=1;s.path.length>T;T++)e.lineTo(s.path[T][0],s.path[T][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=s.style.fill,p&&!h)W().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[H,F]=s.path[0];e.moveTo(H,F);for(let q=1;s.path.length>q;q++)e.lineTo(s.path[q][0],s.path[q][1])}const _=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(_,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(g,y,0,f),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Fe(e,t),e.globalAlpha=1}}finally{e.restore()}})(g,y),D&&xt.current){const e=xt.current,a=y.filter(e=>"line"===e.type);if(a.length>0){const s=N||{},l=.3*(null!==(t=s.speedMultiplier)&&void 0!==t?t:1),d=null!==(n=s.maxPerLine)&&void 0!==n?n:30,p=null!==(o=s.spawnRate)&&void 0!==o?o:.15,h=null!==(r=s.radius)&&void 0!==r?r:2,y=null!==(i=s.opacity)&&void 0!==i?i:.7,f=c/1e3,m=kt.current>0?Math.min(f-kt.current,.1):.016;kt.current=f;const b=a.map(e=>e.path),v=a.map(e=>e.style.strokeWidth||2);for(let t=0;a.length>t;t++)Math.random()<p&&e.countForLine(t)<d&&e.spawn(t);e.step(m,l,b,v),g.globalAlpha=y;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=a[n.lineIndex],r="function"==typeof s.color?s.color(null==o?void 0:o.datum):"source"!==s.color&&s.color?s.color:(null==o?void 0:o.style.stroke)||"#fff";g.beginPath(),g.arc(n.x,n.y,h,0,2*Math.PI),g.fillStyle=r,g.fill()}g.globalAlpha=1,u=!0}}g.restore();const m=He.current;if(m){const e=Je(m,Oe,Se,h);if(e){e.clearRect(-Se.left,-Se.top,Oe[0],Oe[1]);const t=At.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t;e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill(),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(ue){const e=performance.now()-l.lastIngestTime>(null!==(a=ue.threshold)&&void 0!==a?a:5e3);e!==Mt&&Ct(e)}const b=ae!==lt.current;b&&(lt.current=ae),(at.current||b)&&St(e=>e+1),(p||l.hasActivePulses||u)&&(it.current=requestAnimationFrame(()=>ct.current()))},o(()=>($t(),()=>{var e;it.current&&(cancelAnimationFrame(it.current),it.current=0),null===(e=rt.current)||void 0===e||e.clear()}),[$t]),o(()=>{at.current=!0,$t()},[Me,Ce,X,$t]),function(e,t,n,r,i,a){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}(ue,De,at,$t,Mt,Ct),o(()=>{if("production"!==process.env.NODE_ENV&&I){const e="string"==typeof f?f:"object"==typeof f&&"type"in f?f.type:null;e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[I,f]),o(()=>{const e=mt.current;if(!$||!e)return pt.current&&e&&(F(e).on(".zoom",null),pt.current=null),void(e&&F(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=L||[1,8],o={width:Me,height:Ce};if(ze){let r=yt.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),yt.current=_.scale(r);const a=De.current;a&&(a.applyZoomScale(r,o),at.current=!1,$t(),null==z||z({projection:null===(i=a.scales)||void 0===i?void 0:i.projection,zoom:a.currentZoom}))};pt.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const a=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",s);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=De.current;if(!o)return;const r=o.getRotation();bt.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=bt.current;t&&(vt.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]],$t())},d=t=>{var n;if(!bt.current)return;bt.current=null,e.releasePointerCapture(t.pointerId);const r=vt.current;if(r){vt.current=null;const e=De.current;e&&(e.applyRotation(r,o),$t())}const i=De.current;i&&(null==z||z({projection:null===(n=i.scales)||void 0===n?void 0:n.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),pt.current=null}}const r=H().scaleExtent([t,n]).extent([[0,0],[Oe[0],Oe[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;yt.current=t,ft.current=!0;const n=De.current;n&&(n.applyZoomTransform(t,o),at.current=!1,$t())}).on("end",e=>{var t;yt.current=e.transform,ft.current=!1;const n=De.current;n&&(null==z||z({projection:null===(t=n.scales)||void 0===t?void 0:t.projection,zoom:n.currentZoom}))});return pt.current=r,F(e).call(r),()=>{F(e).on(".zoom",null)}},[$,L,ze,Oe,Me,Ce,Se,z,$t]);const Wt=te&&!1!==ne,Rt=Wt&&jt?oe?oe(jt):e.createElement(gt,{data:jt}):null,Tt=Rt?e.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:Se.left+jt.x,top:Se.top+jt.y,transform:`translate(${jt.x>.7*Me?"calc(-100% - 12px)":"12px"}, ${.3*Ce>jt.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:10,width:"max-content"}},Rt):null;if(Be){const t=De.current;t&&(x||k||w)&&(x&&t.setAreas(x),k&&t.setPoints(k),w&&t.setLines(w),t.computeScene({width:Me,height:Ce}));const n=null!==(c=null==t?void 0:t.scene)&&void 0!==c?c:[];return e.createElement("div",{className:"stream-geo-frame"+(Y?" "+Y:""),role:"img","aria-label":"string"==typeof ye?ye:"Geographic chart",style:{position:"relative",width:Oe[0],height:Oe[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Oe[0],height:Oe[1],style:{position:"absolute",left:0,top:0}},Le,e.createElement("g",{transform:`translate(${Se.left},${Se.top})`},X&&e.createElement("rect",{x:0,y:0,width:Me,height:Ce,fill:X}),n.map((t,n)=>function(t,n){var o,r,i,a,s,l;switch(t.type){case"geoarea":return t.pathData?e.createElement("path",{key:"geoarea-"+n,d:t.pathData,fill:t.style.fill||"#e0e0e0",fillOpacity:null!==(o=t.style.fillOpacity)&&void 0!==o?o:1,stroke:t.style.stroke||"none",strokeWidth:t.style.strokeWidth||.5,strokeDasharray:t.style.strokeDasharray,opacity:null!==(r=t._decayOpacity)&&void 0!==r?r:1}):null;case"point":return e.createElement("circle",{key:"point-"+n,cx:t.x,cy:t.y,r:t.r,fill:t.style.fill||"#4e79a7",fillOpacity:null!==(i=t.style.fillOpacity)&&void 0!==i?i:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:null!==(a=t._decayOpacity)&&void 0!==a?a:null!==(s=t.style.opacity)&&void 0!==s?s:1});case"line":{const o=t;if(2>o.path.length)return null;const r="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e.createElement("path",{key:"line-"+n,d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(l=o.style.opacity)&&void 0!==l?l:1})}default:return null}}(t,n)))),e.createElement(Ie,{width:Me,height:Ce,totalWidth:Oe[0],totalHeight:Oe[1],margin:Se,scales:null,showAxes:!1,title:ye,legend:fe,legendPosition:me,legendHoverBehavior:be,legendClickBehavior:ve,legendHighlightedCategory:xe,legendIsolatedCategories:ke,foregroundGraphics:$e,annotations:ae,annotationFrame:0,xValues:[],yValues:[],pointNodes:n.filter(e=>"point"===e.type)}))}const _t=s(e=>{mt.current=e,Ee&&"object"==typeof Ee&&(Ee.current=e)},[Ee]);return e.createElement("div",{ref:_t,className:"stream-geo-frame"+(Y?" "+Y:""),role:"img","aria-label":"string"==typeof ye?ye:"Geographic chart",tabIndex:0,style:Object.assign({position:"relative",width:V?"100%":Oe[0],height:Z?"100%":Oe[1],overflow:"hidden"},$?{touchAction:"none"}:{}),onMouseMove:Wt?Nt:void 0,onMouseLeave:Wt?It:void 0,onClick:re?Bt:void 0},Le&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Oe[0],height:Oe[1],pointerEvents:"none"}},Le),I&&e.createElement("canvas",{ref:Ne,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement("canvas",{ref:We,"aria-label":Re(null!==(p=null===(d=De.current)||void 0===d?void 0:d.scene)&&void 0!==p?p:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:He,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(_e,{hoverPoint:jt}),Ae&&e.createElement(Te,{scene:null!==(g=null===(h=De.current)||void 0===h?void 0:h.scene)&&void 0!==g?g:[],chartType:"Geographic chart"}),e.createElement(Ie,{width:Me,height:Ce,totalWidth:Oe[0],totalHeight:Oe[1],margin:Se,scales:null,showAxes:null!=we&&we,title:ye,legend:fe,legendPosition:me,legendHoverBehavior:be,legendClickBehavior:ve,legendHighlightedCategory:xe,legendIsolatedCategories:ke,foregroundGraphics:$e,annotations:ae,annotationFrame:Ot,xValues:[],yValues:[],pointNodes:null===(y=De.current)||void 0===y?void 0:y.scene.filter(e=>"point"===e.type)}),(null==ue?void 0:ue.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ue.badgePosition?{top:4,left:4}:"bottom-left"===ue.badgePosition?{bottom:4,left:4}:"bottom-right"===ue.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Mt?"#dc3545":"#28a745",color:"white"})},Mt?"STALE":"LIVE"),$&&e.createElement("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Se.bottom+8,left:Se.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2}},e.createElement("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=mt.current,n=pt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(F(t),1.5)},style:ht},"+"),e.createElement("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=mt.current,n=pt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(F(t),1/1.5)},style:ht},"−")),B&&e.createElement("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Se.bottom+2,right:Se.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2}},B),Tt)});yt.displayName="StreamGeoFrame";const ft={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function mt(e,t){return"function"==typeof t?t(e):e[t]}function bt(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function vt(t={}){const{fields:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=mt(t,o);s=bt(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=mt(t,o);l.push({label:n,value:bt(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=bt(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=bt(t[e[0]],r))}}const c=Object.assign(Object.assign({},ft),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function xt(t){if(!0===t)return vt();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:ft},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?vt(t):vt())}const kt={category10:q,tableau10:Q,set3:J,blues:K,reds:X,greens:Y,oranges:U,purples:Z,viridis:V,plasma:G},wt=q,At=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 jt(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")||At.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):wt[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+""))%wt.length]}function Et(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return A().domain(o).range(n).unknown("#999");const i=kt[n]||kt.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:wt;return A().domain(o).range(e).unknown("#999")}}function Ot(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}const St=i(null);function Mt(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 Ct(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[$t,Lt]=it(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Ct(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=Ct(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}})}})),[zt,Pt]=it(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 Dt(e){const t=d(),n=e.clientId||t,{name:o}=e,i=Lt(e=>e.selections.get(o)),a=Lt(e=>e.setClause),l=Lt(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Mt(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(o,{clientId:n,type:"point",fields:t})},[n,o,a]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(o,{clientId:n,type:"interval",fields:t})},[n,o,a]),clear:s(()=>{l(o,n)},[l,o,n]),clientId:n}}function Nt(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=Dt({name:t});return{onHover:s(e=>{if(!e)return void a();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,a,t]),predicate:o,isActive:r}}const It=i(!1);function Bt(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields}:null}function Wt(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}const Rt="#007bff";function Tt(e,t,n="category10"){const o=a(St);return r(()=>{if(t){if(0===e.length)return o&&Object.keys(o).length>0?e=>o[e]||"#999":void 0;if("function"==typeof t){const r=Array.from(new Set(e.map(e=>t(e)+"")));return o&&Object.keys(o).length>0?e=>o[e]||"#999":Et(r.map(e=>({_cat:e})),"_cat",n)}if(o&&Object.keys(o).length>0){const r=Et(e,t,n);return e=>o[e]||r(e)}return Et(e,t,n)}},[e,t,n,o])}function _t({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:i,chartId:a}){const l=Bt(t,n),c=Dt({name:(null==e?void 0:e.name)||"__unused__"}),u=Nt({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||n||[]}),d=Pt(e=>e.pushObservation),p=e?{isActive:c.isActive,predicate:c.predicate}:null,h=s(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(r||d){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=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(a),d&&d(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),d&&d(e)}}},[t,u,r,i,a,d]),g=s(e=>{var t,n;if(r||d){const o={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),d&&d(e)}}},[r,d,i,a]);return{activeSelectionHook:p,customHoverBehavior:h,customClickBehavior:g}}function Ht({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40}}){const c=a(It),u=void 0!==o?o:!c&&!!t,d=r(()=>{if(u&&t)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:jt})},[u,t,e,n]),p=r(()=>{const e=Object.assign(Object.assign({},l),s);return d&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[l,s,d,i]);return{legend:d,margin:p,legendPosition:i}}const Ft={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 qt(e,t,n){var o,r,i,a,s,l;const c=Ft[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(r=t.height)&&void 0!==r?r:c.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}function Gt({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},o)))}class Vt extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(Gt,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Zt(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Ut(e,t,n=3){let o,r=n+1;for(const n of t){const t=Zt(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Yt(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Xt(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=Ut(e,t,3))&&void 0!==n?n:null)}const Kt={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},frameProps:{type:"object"}},Jt={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Qt={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},en=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],tn=["vertical","horizontal"],nn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kt),Jt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:en},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({},Kt),Jt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:en},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kt),Jt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:en},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({},Kt),Jt),{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({},Kt),Jt),{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({},Kt),Jt),{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({},Kt),Jt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kt),Jt),{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({},Kt),Qt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:tn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kt),Qt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:tn},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kt),Qt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:tn},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kt),Qt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:tn},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kt),Qt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:tn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kt),Qt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kt),Qt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:tn},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kt),Qt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:tn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Kt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Kt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Kt),{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({},Kt),{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:tn},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({},Kt),{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({},Kt),{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({},Kt),{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({},Kt),{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({},Kt),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function on(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const rn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),an=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),sn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),ln=new Set(["LineChart","AreaChart","StackedAreaChart"]),cn=new Set(["BarChart","StackedBarChart","GroupedBarChart"]);function un(e,t){const n=[],o=function(e,t){const n=[],o=nn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(nn).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(!on(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=Ut(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=function({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=Yt(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=Xt(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=Yt(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=Xt(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 nn[e]?(function(e,t,n){const o=nn[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=nn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){rn.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){an.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=nn[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!sn.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!ln.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=nn[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!cn.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var dn;const pn="undefined"!=typeof process&&"production"!==(null===(dn=process.env)||void 0===dn?void 0:dn.NODE_ENV);function hn({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(Vt,{fallback:i=>{let a="";if(pn&&r)try{const e=un(t,r);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(Gt,{componentName:t,message:i.message,diagnosticHint:a,width:n,height:o})}},i)}const gn={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"},yn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function fn(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},gn),{width:n,height:o})},r||"No data available"):null}function mn(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},yn),{position:"absolute",top:s+o*(i+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function bn(e,t,n,o){if(!pn)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function vn(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((o=o.apply(e,t||[])).next())})}function xn(e){return e}function kn(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 xn;var t,n,o=e.scale[0],r=e.scale[1],i=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var l=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+i,u[1]=(n+=e[1])*r+a;c>l;)u[l]=e[l],++l;return u}}(e.transform),o=e.arcs;function r(e,t){t.length&&t.pop();for(var r=o[0>e?~e:e],i=0,a=r.length;a>i;++i)t.push(n(r[i],i));0>e&&function(e,t){for(var n,o=e.length,r=o-t;r<--o;)n=e[r],e[r++]=e[o],e[o]=n}(t,a)}function i(e){return n(e)}function a(e){for(var t=[],n=0,o=e.length;o>n;++n)r(e[n],t);return 2>t.length&&t.push(t[0]),t}function s(e){for(var t=a(e);4>t.length;)t.push(t[0]);return t}function l(e){return e.map(s)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=i(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(i);break;case"LineString":n=a(t.arcs);break;case"MultiLineString":n=t.arcs.map(a);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:r,geometry:i}:null==o?{type:"Feature",id:n,properties:r,geometry:i}:{type:"Feature",id:n,bbox:o,properties:r,geometry:i}}"function"==typeof SuppressedError&&SuppressedError;const wn=new Map;function An(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function jn(e){return vn(this,void 0,void 0,function*(){const t=wn.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return vn(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:An(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:An(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:An(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:An(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 kn(e,t)})}:kn(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return wn.set(e,i),i})}function En(e){const t=r(()=>Array.isArray(e)?e:void 0,[e]),[i,a]=n(null);return o(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return a(null),jn(e).then(e=>{t||a(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".`),a(null)}else a(null)},[e]),void 0!==t?t:i}const On={blues:K,reds:X,greens:Y,viridis:V};function Sn(t){const n=qt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{areas:o,valueAccessor:i,colorScheme:a="blues",projection:s="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:p,dragRotate:h,tileURL:g,tileAttribution:y,tileCacheSize:f,tooltip:m,areaOpacity:b=1,annotations:v,margin:x,className:k,selection:w,linkedHover:A,onObservation:E,chartId:S,loading:M,emptyContent:C,frameProps:$={}}=t,L=null!=u?u:!!g,z=En(o),P=r(()=>"function"==typeof i?i:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[i])&&void 0!==n?n:null==e?void 0:e[i]},[i]),D=r(()=>{if(!z)return j(K).domain([0,1]);const e=z.map(e=>P(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=O(e);return j(On[a]||K).domain([null!=t?t:0,null!=n?n:1])},[z,P,a]),{activeSelectionHook:N,customHoverBehavior:I}=_t({selection:w,linkedHover:A,onObservation:E,chartType:"ChoroplethMap",chartId:S}),B=r(()=>{const e=e=>{const t=P(e);return{fill:null!=t&&isFinite(t)?D(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:b}};return N?Wt(e,N,w):e},[P,D,N,w,b]),W=r(()=>t=>{var n,o;const r=(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.name)||(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||"Feature",i=P(t);return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},r),null!=i&&e.createElement("div",{style:{opacity:.7}},"number"==typeof(a=i)&&isFinite(a)?Number.isInteger(a)?a.toLocaleString():a.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=a?a:"")+""));var a},[P]),R=r(()=>Object.assign({top:10,right:10,bottom:10,left:10},x),[x]),T=mn(M,n.width,n.height);if(T)return T;if(!z)return mn(!0,n.width,n.height)||null;const _=fn(z,n.width,n.height,C);if(_)return _;if(Array.isArray(z)&&z.length>0){const t=z[0];if(!t||"object"!=typeof t||!t.geometry)return e.createElement(Gt,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:n.width,height:n.height})}const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:s,areas:z,areaStyle:B,size:[n.width,n.height],margin:R,enableHover:!0,tooltipContent:!1===m?()=>null:!0===m?W:xt(m)||W},null!=l&&{graticule:l}),null!=c&&{fitPadding:c}),L&&{zoomable:!0}),d&&{zoomExtent:d}),p&&{onZoom:p}),null!=h&&{dragRotate:h}),g&&{tileURL:g}),y&&{tileAttribution:y}),f&&{tileCacheSize:f}),(A||E)&&{customHoverBehavior:I}),v&&v.length>0&&{annotations:v}),n.title&&{title:n.title}),k&&{className:k}),$);return e.createElement(hn,{componentName:"ChoroplethMap",width:n.width,height:n.height},e.createElement(yt,Object.assign({},H)))}Sn.displayName="ChoroplethMap";const Mn=c(function(o,i){const a=t(null);u(i,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const l=qt(o.mode,{width:o.width,height:o.height,showLegend:o.showLegend,title:o.title}),{points:c,xAccessor:d="lon",yAccessor:p="lat",sizeBy:h,sizeRange:g=[3,30],colorBy:y,colorScheme:f="category10",projection:m="equalEarth",graticule:b,fitPadding:v,zoomable:x,zoomExtent:k,onZoom:w,dragRotate:A,tileURL:j,tileAttribution:E,tileCacheSize:O,areas:S,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:C,annotations:$,margin:L,className:z,selection:P,linkedHover:D,onObservation:N,chartId:I,loading:B,emptyContent:W,legendInteraction:R,legendPosition:T,frameProps:_={}}=o,H=null!=x?x:!!j,F=En(S),q=c||[],{activeSelectionHook:G,customHoverBehavior:V}=_t({selection:P,linkedHover:D,fallbackFields:y?["string"==typeof y?y:""]:[],onObservation:N,chartType:"ProportionalSymbolMap",chartId:I}),Z=Tt(q,y,f),U=r(()=>{if(!h)return;const e="function"==typeof h?h:e=>e[h],t=q.map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[q,h]),Y=r(()=>{const e=e=>({fill:y?jt(e,y,Z):Rt,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:h?Ot(e,h,g,U):6});return G?Wt(e,G,P):e},[y,Z,h,g,U,G,P]),X=r(()=>{if(!y)return[];const e="function"==typeof y?y:e=>e[y],t=new Set;for(const n of q){const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[q,y]),K=function(e,t,o){const[i,a]=n(null),[l,c]=n(new Set),u=s(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),p=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===i}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,i,l]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:p}}(R,y,X),{legend:J,margin:Q,legendPosition:ee}=Ht({data:q,colorBy:y,colorScale:Z,showLegend:l.showLegend,legendPosition:T,userMargin:L,defaults:{top:10,bottom:10,left:10,right:10}}),te=r(()=>t=>{const n=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t.NAME)||(null==t?void 0:t.id),o="string"==typeof h?h:null,r=("function"==typeof h?h:e=>e[h])(t),i=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",a="string"==typeof y?y:null,s=a?null==t?void 0:t[a]:null;return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},n&&e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n),o&&null!=r&&e.createElement("div",null,e.createElement("span",{style:{opacity:.7}},o,": "),i(r)),a&&null!=s&&e.createElement("div",null,e.createElement("span",{style:{opacity:.7}},a,": "),s+""),!n&&!o&&Object.entries(t).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,": "),i(n))))},[h,y]),ne=mn(B,l.width,l.height);if(ne)return ne;const oe=fn(c,l.width,l.height,W);if(oe)return oe;bn("ProportionalSymbolMap",q,"xAccessor",d),bn("ProportionalSymbolMap",q,"yAccessor",p);const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:m},null!=c&&{points:q}),{xAccessor:d,yAccessor:p,pointStyle:Y}),F&&{areas:F,areaStyle:M}),null!=b&&{graticule:b}),null!=v&&{fitPadding:v}),H&&{zoomable:!0}),k&&{zoomExtent:k}),w&&{onZoom:w}),null!=A&&{dragRotate:A}),j&&{tileURL:j}),E&&{tileAttribution:E}),O&&{tileCacheSize:O}),{size:[l.width,l.height],margin:Q,enableHover:!0,tooltipContent:!1===C?()=>null:xt(C)||te}),J&&{legend:J,legendPosition:ee}),R&&"none"!==R&&{legendHoverBehavior:K.onLegendHover,legendClickBehavior:K.onLegendClick,legendHighlightedCategory:K.highlightedCategory,legendIsolatedCategories:K.isolatedCategories}),(D||N)&&{customHoverBehavior:V}),$&&$.length>0&&{annotations:$}),l.title&&{title:l.title}),z&&{className:z}),_);return e.createElement(hn,{componentName:"ProportionalSymbolMap",width:l.width,height:l.height},e.createElement(yt,Object.assign({ref:a},re)))});function Cn(t){const n=qt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{flows:o,nodes:i,nodeIdAccessor:a="id",xAccessor:l="lon",yAccessor:c="lat",valueAccessor:u="value",projection:d="equalEarth",graticule:p,fitPadding:h,zoomable:g,zoomExtent:y,onZoom:f,dragRotate:m,tileURL:b,tileAttribution:v,tileCacheSize:x,lineType:k="geo",flowStyle:A="basic",areas:j,areaStyle:E={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:O,edgeOpacity:S=.6,edgeWidthRange:M=[1,8],edgeLinecap:C="round",colorScheme:$="category10",showParticles:L,particleStyle:z,tooltip:P,annotations:D,margin:N,className:I,selection:B,linkedHover:W,onObservation:R,chartId:T,loading:_,emptyContent:H,frameProps:F={}}=t,q=null!=g?g:!!b,G=En(j),V=Bt(W),Z=Dt({name:(null==B?void 0:B.name)||"__unused__"}),U=Nt({name:(null==V?void 0:V.name)||"hover",fields:(null==V?void 0:V.fields)||[]}),Y=Pt(e=>e.pushObservation),X=B?{isActive:Z.isActive,predicate:Z.predicate}:null,K=o||[],J=i||[],Q=Tt(K,O,$),ee=r(()=>{const e=new Map;for(const t of J)e.set(t[a]+"",t);return e},[J,a]),te=r(()=>{const e=new Map;for(const t of K)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[K]),ne=s(e=>{var t,n;if(W)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=te.get(t[a]+"");e&&U.onHover(e)}else U.onHover(t)}else U.onHover(null);if(R||Y){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:T};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});R&&R(i),Y&&Y(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});R&&R(e),Y&&Y(e)}}},[W,U,a,te,R,T,Y]),oe=r(()=>{const e="function"==typeof l?l:e=>e[l],t="function"==typeof c?c:e=>e[c];return K.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ee.get(n.source+""),r=ee.get(n.target+"");return o&&r?Object.assign(Object.assign({},n),{coordinates:[{[l]:e(o),[c]:t(o)},{[l]:e(r),[c]:t(r)}]}):null}).filter(Boolean)},[K,ee,l,c]),re=r(()=>{const e=K.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[u])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>M[0]:w().domain([Math.min(...e),Math.max(...e)]).range(M)},[K,u,M]),ie=r(()=>e=>{var t;return{stroke:O?jt(e,O,Q):Rt,strokeWidth:re(null!==(t=e[u])&&void 0!==t?t:0),strokeLinecap:C,opacity:S}},[O,Q,re,u,S,C]),ae=r(()=>X?Wt(ie,X,Object.assign(Object.assign({},B||{}),{unselectedStyle:{opacity:.15,strokeOpacity:.15,fillOpacity:0}})):ie,[ie,X,B]),se=r(()=>()=>({fill:"#333",r:5,fillOpacity:.8}),[]),le=r(()=>t=>{var n,o,r,i,s,l,c;if((null==t?void 0:t.geometry)||(null==t?void 0:t.properties)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.geometry)){const n=(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.name)||(null===(r=null==t?void 0:t.properties)||void 0===r?void 0:r.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||(null===(s=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.properties)||void 0===s?void 0:s.name)||(null===(c=null===(l=null==t?void 0:t.data)||void 0===l?void 0:l.properties)||void 0===c?void 0:c.NAME);if(n)return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},n))}if(null!=(null==t?void 0:t.source)&&null!=(null==t?void 0:t.target)){const n=t[u];return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},t.source," → ",t.target),null!=n&&e.createElement("div",{style:{opacity:.7}},"number"==typeof n?n.toLocaleString():n))}const d=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t[a]);return null!=d?e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},d)):null},[u,a]),ce=r(()=>Object.assign({top:10,right:10,bottom:10,left:10},N),[N]),ue=mn(_,n.width,n.height);if(ue)return ue;const de=fn(o,n.width,n.height,H);if(de)return de;const pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:d,lines:oe,points:J,xAccessor:l,yAccessor:c,lineDataAccessor:"coordinates",lineType:k,flowStyle:A,lineStyle:ae,pointStyle:se},G&&{areas:G,areaStyle:E}),null!=p&&{graticule:p}),null!=h&&{fitPadding:h}),q&&{zoomable:!0}),y&&{zoomExtent:y}),f&&{onZoom:f}),null!=m&&{dragRotate:m}),L&&{showParticles:L}),z&&{particleStyle:z}),b&&{tileURL:b}),v&&{tileAttribution:v}),x&&{tileCacheSize:x}),{size:[n.width,n.height],margin:ce,enableHover:!0,tooltipContent:!1===P?()=>null:xt(P)||le}),(W||R)&&{customHoverBehavior:ne}),D&&D.length>0&&{annotations:D}),n.title&&{title:n.title}),I&&{className:I}),F);return e.createElement(hn,{componentName:"FlowMap",width:n.width,height:n.height},e.createElement(yt,Object.assign({},pe)))}Mn.displayName="ProportionalSymbolMap",Cn.displayName="FlowMap";const $n=c(function(i,a){const l=qt(i.mode,{width:i.width,height:i.height,showLegend:i.showLegend,title:i.title}),{points:c,lines:d,xAccessor:p="lon",yAccessor:h="lat",nodeIdAccessor:g="id",center:y,costAccessor:f,strength:m=1,lineMode:b="straight",projection:v="mercator",graticule:x,fitPadding:k,zoomable:w,zoomExtent:A,onZoom:j,dragRotate:E,tileURL:O,tileAttribution:S,tileCacheSize:M,transition:C,colorBy:$,colorScheme:L="category10",pointRadius:z=5,tooltip:P,showRings:D=!0,ringStyle:N,showNorth:I=!0,costLabel:B,annotations:W,margin:R,className:T,selection:_,linkedHover:H,onObservation:F,chartId:q,loading:G,emptyContent:V,legendPosition:Z,frameProps:U={}}=i,Y=null!=w?w:!!O,X=c||[],{activeSelectionHook:K,customHoverBehavior:J}=_t({selection:_,linkedHover:H,fallbackFields:$?["string"==typeof $?$:""]:[],onObservation:F,chartType:"DistanceCartogram",chartId:q}),Q=Tt(X,$,L),ee=r(()=>{const e=e=>({fill:$?jt(e,$,Q):Rt,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:z});return K?Wt(e,K,_):e},[$,Q,z,K,_]),{legend:te,margin:ne,legendPosition:oe}=Ht({data:X,colorBy:$,colorScale:Q,showLegend:l.showLegend,legendPosition:Z,userMargin:R,defaults:{top:10,bottom:10,left:10,right:10}}),re=r(()=>({center:y,centerAccessor:g,costAccessor:f,strength:m,lineMode:b}),[y,g,f,m,b]),ie=r(()=>{if(!d)return;const e="function"==typeof p?p:e=>e[p],t="function"==typeof h?h:e=>e[h],n=new Map;for(const e of X)n.set(e[g]+"",e);return d.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),i=n.get(o.target+"");return r&&i?Object.assign(Object.assign({},o),{coordinates:[{[p]:e(r),[h]:t(r)},{[p]:e(i),[h]:t(i)}]}):null}).filter(Boolean)},[d,X,p,h,g]),ae=r(()=>t=>{const n=("function"==typeof f?f:e=>e[f])(t);return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},t[g]||t.name||t.id||"Point"),null!=n&&e.createElement("div",{style:{opacity:.7}},"Cost: ","number"==typeof n?n.toFixed(1):n))},[f,g]),se=t(null);u(a,()=>({push:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=se.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=se.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[le,ce]=n(null),ue=s(()=>{var e,t;const n=null===(t=null===(e=se.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ce(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);o(()=>{const e=requestAnimationFrame(ue);return()=>cancelAnimationFrame(e)},[ue,m,y,l.width,l.height,X]);const de=r(()=>{if(!D||!le)return[];const{maxCost:e}=le;if(0>=e)return[];if(Array.isArray(D))return D.filter(t=>t>0&&e>=t);const t="number"==typeof D?D: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},[D,le]),pe=r(()=>{var t,n;if(!le)return U.foregroundGraphics||null;const{cx:o,cy:r,maxCost:i,availableRadius:a}=le,s=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},N),l=null!==(t=ne.left)&&void 0!==t?t:10,c=null!==(n=ne.top)&&void 0!==n?n:10;return e.createElement("g",null,de.map(t=>{const n=t/i*a;return e.createElement("g",{key:t},e.createElement("circle",{cx:o+l,cy:r+c,r:n,fill:"none",stroke:s.stroke,strokeWidth:s.strokeWidth,strokeDasharray:s.strokeDasharray,opacity:.5}),e.createElement("text",{x:o+l+n+3,y:r+c-2,fontSize:s.labelSize,fill:s.labelColor,fontFamily:"system-ui, sans-serif"},t,B?" "+B:""))}),I&&e.createElement("g",{transform:`translate(${l+24}, ${c+24})`},e.createElement("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e.createElement("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e.createElement("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif"},"N"),e.createElement("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.createElement("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.createElement("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})),U.foregroundGraphics)},[le,de,I,B,N,ne,U.foregroundGraphics]),he=mn(G,l.width,l.height);if(he)return he;const ge=fn(c,l.width,l.height,V);if(ge)return ge;bn("DistanceCartogram",X,"xAccessor",p),bn("DistanceCartogram",X,"yAccessor",h);const ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:v},null!=c&&{points:X}),ie&&{lines:ie,lineDataAccessor:"coordinates"}),{xAccessor:p,yAccessor:h,pointIdAccessor:g,pointStyle:ee,projectionTransform:re}),C&&{transition:{duration:C}}),null!=x&&{graticule:x}),null!=k&&{fitPadding:k}),Y&&{zoomable:!0}),A&&{zoomExtent:A}),j&&{onZoom:j}),null!=E&&{dragRotate:E}),O&&{tileURL:O}),S&&{tileAttribution:S}),M&&{tileCacheSize:M}),{size:[l.width,l.height],margin:ne,enableHover:!0,tooltipContent:!1===P?()=>null:xt(P)||ae}),te&&{legend:te,legendPosition:oe}),(H||F)&&{customHoverBehavior:J}),W&&W.length>0&&{annotations:W}),l.title&&{title:l.title}),T&&{className:T}),U),pe&&{foregroundGraphics:pe});return e.createElement(hn,{componentName:"DistanceCartogram",width:l.width,height:l.height},e.createElement(yt,Object.assign({ref:se},ye)))});function Ln(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})}$n.displayName="DistanceCartogram";export{Sn as ChoroplethMap,$n as DistanceCartogram,Cn as FlowMap,Mn as ProportionalSymbolMap,yt as StreamGeoFrame,Ln as mergeData,jn as resolveReferenceGeography};
|
|
1
|
+
import*as e from"react";import{useRef as t,useState as n,useEffect as o,useMemo as r,createContext as i,useContext as a,useCallback as s,useSyncExternalStore as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{geoPath as p,geoGraticule as h,geoDistance as y,geoInterpolate as g,geoEqualEarth as f,geoEquirectangular as m,geoNaturalEarth1 as b,geoOrthographic as v,geoAlbersUsa as x,geoMercator as k}from"d3-geo";import{scaleLinear as A,scaleOrdinal as w,scaleSequential as j}from"d3-scale";import{bin as O,extent as E}from"d3-array";import{packEnclose as S}from"d3-hierarchy";import{area as M,curveCatmullRom as C,curveCardinal as $,curveBasis as z,curveStepBefore as L,curveStepAfter as P,curveStep as D,curveMonotoneY as I,curveMonotoneX as B,curveLinear as N,line as W,curveNatural as R}from"d3-shape";import T from"regression";import{zoomIdentity as _,zoom as F}from"d3-zoom";import{select as H}from"d3-selection";import{schemeCategory10 as q,interpolatePlasma as G,interpolateViridis as V,interpolatePurples as Z,interpolateOranges as U,interpolateGreens as Y,interpolateReds as X,interpolateBlues as K,schemeSet3 as J,schemeTableau10 as Q}from"d3-scale-chromatic";class ee{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function te(e,t,n){return e+(t-e)*n}const ne={mercator:k,equalEarth:f,albersUsa:x,orthographic:v,naturalEarth:b,equirectangular:m};function oe(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function re(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function ie(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):n}const ae={fill:"#e0e0e0",stroke:"#999",strokeWidth:.5,fillOpacity:1},se={fill:"#4e79a7",r:4,fillOpacity:.8},le={stroke:"#4e79a7",strokeWidth:1.5,fill:"none"};function ce(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 ue(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const a=-r/i,s=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;d.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return d}function de(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,a;0===t?(i=e[1][0]-r[0],a=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],a=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(i*i+a*a)||1;o.push([r[0]+a/s*n,r[1]+-i/s*n])}return o}function pe(e,t,n,o,r){const i=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(i*i+a*a);if(0===s)return[e,t];const l=a/s,c=-i/s,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}class he{constructor(e){this.scene=[],this.scales=null,this.version=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e}initStreaming(e=500){this.pointBuffer=new ee(e),this.timestampBuffer=new ee(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return f();if("string"==typeof e){const t=ne[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),f())}if("object"==typeof e&&"type"in e){const t=ne[e.type],n=t?t():f();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=p(this.projection),this.fitProjection(e),this.geoPath=p(this.projection);const n=this.projection;this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null};const o=this.scene;this.scene=this.buildSceneNodes(e),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&o.length>0&&this.startTransition(o),this.version++}fitProjection(e){var t,n,o,r,i;const a=this.projection,s=this.config,l=[...this.areas],c=oe(s.xAccessor,"lon"),u=oe(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const p=re(s.lineDataAccessor);for(const e of this.lineData){const t=p(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==l.length){if(s.projectionExtent){const[[t,n],[o,r]]=s.projectionExtent;a.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,r],[t,r],[t,n]]]}})}else if(a.clipAngle&&(null!==(t=a.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=s.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);a.scale(o/2-o*t),a.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,r=e.height*t;a.fitExtent([[n,r],[e.width-n,e.height-r]],{type:"FeatureCollection",features:l})}this.baseScale=a.scale(),this.baseTranslate=a.translate(),this.baseRotation=null!==(i=null===(r=a.rotate)||void 0===r?void 0:r.call(a))&&void 0!==i?i:[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=p(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=p(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;n&&n.rotate&&(n.rotate(e),this.geoPath=p(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.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}buildSceneNodes(e){var t,n,o;const r=[],{config:i}=this,a=this.projection,s=this.geoPath,l=oe(i.xAccessor,"lon"),c=oe(i.yAccessor,"lat");if(i.graticule){const t=!0===i.graticule?{}:i.graticule,n=h();t.step&&n.step(t.step);const o=s(n())||"";o&&r.push({type:"geoarea",pathData:o,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=s(e);if(!t)continue;const n=s.centroid(e),o=s.bounds(e),a=s.area(e),l=ie(i.areaStyle,e,ae);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:a,style:l,datum:e,interactive:!0})}const u=re(i.lineDataAccessor);for(const t of this.lineData){const n=u(t);if(!n||2>n.length)continue;const o=n.map(e=>[l(e),c(e)]);let s;if("geo"===i.lineType){const e=[];for(let t=0;o.length-1>t;t++){const n=o[t],r=o[t+1],i=y(n,r)||0,a=Math.max(2,Math.ceil(i/(Math.PI/180))),s=g(n,r);for(let n=0;a>=n;n++)t>0&&0===n||e.push(s(n/a))}s=e.map(([e,t])=>a([e,t])).filter(e=>null!=e)}else s=o.map(([e,t])=>a([e,t])).filter(e=>null!=e);if(2>s.length)continue;const d=ie(i.lineStyle,t,le),p="number"==typeof d.strokeWidth?d.strokeWidth:1;2!==o.length||2>s.length||"arc"!==i.flowStyle?2!==o.length||2>s.length||"offset"!==i.flowStyle||(s="geo"===i.lineType?de(s,p):pe(s[0],s[s.length-1],0,0,p)):s=ue(s[0],s[s.length-1]);const h=ce(s,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({},d),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>s.length&&h[0]||s,style:d,datum:t})}const d=this.getPoints(),p=i.pointIdAccessor?"function"==typeof i.pointIdAccessor?i.pointIdAccessor:e=>e[i.pointIdAccessor]:null,f=a.clipAngle&&null!==(t=a.clipAngle())&&void 0!==t?t:0,m=f>0?f*Math.PI/180:null,b=a.rotate?a.rotate():[0,0,0],v="function"==typeof a.center?a.center():[0,0],x=[(null!==(n=v[0])&&void 0!==n?n:0)-b[0],(null!==(o=v[1])&&void 0!==o?o:0)-b[1]];for(let e=0;d.length>e;e++){const t=d[e],n=l(t),o=c(t);if(null!=m&&y([n,o],x)>m)continue;const s=a([n,o]);if(!s)continue;const u=i.pointStyle?i.pointStyle(t):Object.assign({},se),h={type:"point",x:s[0],y:s[1],r:u.r||4,style:u,datum:t,pointId:p?p(t)+"":void 0};r.push(h)}return r}applyCartogramTransform(e,t){var n,o,r;const i=this.scene.filter(e=>"point"===e.type);if(2>i.length)return;const a=null!==(n=e.strength)&&void 0!==n?n:1;if(0===a)return;const s=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,l="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=i.find(t=>s(t.datum)+""==e.center+"");if(!c)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const u=c.x,d=c.y,p=i.map(e=>l(e.datum)).filter(e=>isFinite(e)&&e>=0),h=Math.max(...p,1),y=Math.min(t.width,t.height)/2,g=A().domain([0,h]).range([0,y]);this.cartogramLayout={cx:u,cy:d,maxCost:h,availableRadius:y},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of i){if(e===c)continue;const t=Math.atan2(e.y-d,e.x-u),n=Math.sqrt(Math.pow(e.x-u,2)+Math.pow(e.y-d,2)),o=l(e.datum),r=n+((isFinite(o)?g(o):n)-n)*a;e.x=u+Math.cos(t)*r,e.y=d+Math.sin(t)*r}const f=t.width/2,m=t.height/2,b=f-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:f,cy:m,maxCost:h,availableRadius:y};const x=this.scene.filter(e=>"line"===e.type);if(x.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of i)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of x){const n=null===(o=t.datum)||void 0===o?void 0:o.source,i=null===(r=t.datum)||void 0===r?void 0:r.target;if(n&&i){const o=e.get(n+""),r=e.get(i+"");o&&r&&(t.path=[o,r])}}}}applyDecay(){var e,t,n;const o=this.config.decay;if(!o||!this.pointBuffer)return;const r=this.pointBuffer.size;if(0===r)return;const i=null!==(e=o.minOpacity)&&void 0!==e?e:.1,a=null!==(t=o.halfLife)&&void 0!==t?t:r/2,s=null!==(n=o.stepThreshold)&&void 0!==n?n:.5*r,l=this.scene.filter(e=>"point"===e.type);for(let e=0;l.length>e;e++){const t=r-1-e;let n;switch(o.type){case"exponential":n=i+Math.pow(.5,t/a)*(1-i);break;case"step":n=s>t?1:i;break;default:n=i+(r>1?1-t/(r-1):1)*(1-i)}l[e]._decayOpacity=n,l[e].style=Object.assign(Object.assign({},l[e].style),{opacity:n})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),a=this.timestampBuffer.toArray();for(let e=0;i.length>e&&a.length>e;e++){const s=r-a[e];o>s&&(i[e]._pulseIntensity=1-s/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of i)if(e.pointId){const t=r.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(a=!0))}a&&(this.activeTransition={startTime:performance.now(),duration:o})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=te(e.x,e._targetX,n),e.y=te(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 ye(e,t,n,o,r,i){const a=e.filter(e=>"point"===e.type);let s=null,l=o;for(const e of a){const o=e.x-t,r=e.y-n,i=Math.sqrt(o*o+r*r);(e.r||4)+4>=i&&l>i&&(s=e,l=i)}if(s)return{node:s,distance:l};const c=e.filter(e=>"geoarea"===e.type&&!1!==e.interactive);for(let e=c.length-1;e>=0;e--){const o=c[e],[[i,a],[s,l]]=o.bounds;if(!(i>t||t>s||a>n||n>l)&&(o._cachedPath2D||(o._cachedPath2D=new Path2D(o.pathData)),r.isPointInPath(o._cachedPath2D,t,n)))return{node:o,distance:0}}const u=e.filter(e=>"line"===e.type);let d=null,p=o;for(const e of u){const{path:o}=e;for(let r=0;o.length-1>r;r++){const[i,a]=o[r],[s,l]=o[r+1],c=ge(t,n,i,a,s,l);Math.max((e.style.strokeWidth||2)+4,5)>=c&&p>c&&(d=e,p=c)}}return d?{node:d,distance:p}:null}function ge(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}const fe={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function me(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,fe[n])(o(e,t)),r}function be(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ve(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function xe({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:a,format:s}=t,l=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:s+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function ke(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[p,h]=e.useState(0),[y,g]=e.useState(0),f=e.useCallback((e,t)=>{h(e),g(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const p=[];return t.forEach((t,h)=>{d+=5,p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+h,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,p.push(e.createElement("text",{key:"legend-text-"+h,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),p.push(e.createElement("g",{key:"legend-group-"+h,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:p,items:h}=t,y=[];let g=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return h.forEach((t,u)=>{const b=me(t,u,d,p),v=ve(t,r,i),x=i&&i.size>0&&i.has(t.label);y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${g})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===a&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+h.length)%h.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&e.createElement(be,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),g+=22}),y})(t,o,r,i,a,s,l,h,c,u))),d+=22*t.items.length+8}),p})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:f,legendInteraction:s}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let p=0;const h=[];t.forEach((t,n)=>{let o=0;t.label&&(o+=16);const y=((t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:p,items:h}=t,y=[];let g=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return h.forEach((t,u)=>{const b=me(t,u,d,p),v=ve(t,r,i),x=i&&i.size>0&&i.has(t.label);y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${g},0)`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===a&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+h.length)%h.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&e.createElement(be,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),g+=26+7*t.label.length}),{items:y,offset:g}})(t,r,i,a,s,l,c,n,u,d);o+=y.offset+5,h.push(Object.assign(Object.assign({label:t.label},y),{offset:o})),p+=o+12});let y=Math.max(0,(o-p)/2);const g=[];return h.forEach((o,r)=>{const i=t[r];i.label&&(g.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),y+=16),g.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${y},0)`},o.items)),y+=o.offset+5,t[r+1]&&g.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:y,y1:-8,x2:y,y2:n+0+8})),y+=12}),e.createElement("g",null,g)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:f,legendInteraction:s}),b=!(!o&&!r);return e.createElement("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==s&&(void 0!==s||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},l),m)}function Ae(e){return"string"==typeof e?{type:e}:e}function we({orient:t,config:n,values:o,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(n),c="top"===t||"bottom"===t,u=r(()=>{if(0===o.length)return null;const n=i.domain(),r=a-8;if("boxplot"===l.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(o);if(!n)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:p}=n,h=Math.min(.5*r,20),y=(r-h)/2+4;if(c){const n=i(a),o=i(u),r=i(s),c=i(d),g=i(p),f="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+f*(y+h/2),x2:g,y2:m+f*(y+h/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+f*y,x2:c,y2:m+f*(y+h),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:g,y1:m+f*y,x2:g,y2:m+f*(y+h),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-y-h:m+y,width:Math.abs(o-n),height:h,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===t?m-y-h:m+y,x2:r,y2:"top"===t?m-y:m+y+h,stroke:l.fill,strokeWidth:2}))}{const n=i(a),o=i(u),r=i(s),c=i(d),g=i(p),f="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+f*(y+h/2),y1:c,x2:m+f*(y+h/2),y2:g,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*y,y1:c,x2:m+f*(y+h),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*y,y1:g,x2:m+f*(y+h),y2:g,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-y-h:m+y,y:Math.min(n,o),width:h,height:Math.abs(o-n),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===t?m-y-h:m+y,y1:r,x2:"left"===t?m-y:m+y+h,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=O().domain(n).thresholds(l.bins)(o);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((n,o)=>{if(null==n.x0||null==n.x1)return null;const a=n.length/d*r;if(c){const r=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:o,x:r,y:"top"===t?-4-a:4,width:Math.max(s,.5),height:a,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const r=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:o,x:"left"===t?-4-a:4,y:Math.min(r,r+s),width:a,height:Math.abs(s),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const n=r/2+4,o=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const a=e.length/d*(r/2),s=i((e.x0+e.x1)/2);o.push(c?`${s},${"top"===t?-(n-a):n-a}`:`${"left"===t?-(n-a):n-a},${s}`)}for(let e=u.length-1;e>=0;e--){const a=u[e];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(r/2),l=i((a.x0+a.x1)/2);o.push(c?`${l},${"top"===t?-(n+s):n+s}`:`${"left"===t?-(n+s):n+s},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+t},e.createElement("polygon",{points:o.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const n=[];if(c){const e=0,o=null!=u[0].x0?i(u[0].x0):0;n.push(`M${o},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/d*r,a=i((e.x0+e.x1)/2);n.push(`L${a},${"top"===t?-o-4:o+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${a},${e}`),n.push("Z")}else{const e=0,o=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${o}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const o=e.length/d*r,a=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-o-4:o+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${e},${a}`),n.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+t},e.createElement("path",{d:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[o,i,l,a,s,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function je(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Oe(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 Ee(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:p,className:h,disable:y,events:g={},"data-testid":f}=t,m=new Set(Array.isArray(y)?y:[]);let b=r||0,v=i||0;null!=a&&(b=a-n),null!=s&&(v=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===b&&0===v)if(void 0!==u.width){b=u.width/2;const e=u.depth||30;v=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;b=e+(0>e?-5:5),v=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(h||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},g),!m.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,p=t*d>n*u?u/t:d/n;l=r+a*p,c=i+s*p}}}else if("bracket"===i&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(s.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(b,v,c,p,x,u),!m.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&s.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-a;s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:Oe((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"currentColor"}));break}}return e.createElement("g",{className:"annotation-subject"},s)}(x,u,p,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let p=l;p&&"dynamic"!==p||(p="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===d?"right"===p?h="end":"middle"===p&&(h="middle"):h=0>n?"end":"start";const y=16,g=a?u?[a]:je(a,c):[],f=i?u?[i]:je(i,c):[],m="leftRight"===d?"end"===h?-4:4:0;let b=0;const v=[];g.length>0&&(v.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:h,fontWeight:"bold"},g.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t)))),b=g.length*y),f.length>0&&v.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:h,y:b},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t))));let x=null;if((a||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(g.length+f.length)*y+(f.length>0?y:0);let n=0,o=t;"bottom"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const k=Math.max(0,g.length+f.length-1)*y;let A=0;return"topBottom"===d?A=0>o?-(k+2):18:"leftRight"===d&&(A="middle"===p?-(k+y+(f.length>0&&g.length>0?2:0))/2+8:"bottom"===p||0>o?-(k+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},v),x)}(l,b,v,p))}function Se(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e.createElement(Ee,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Ee,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}const Me={linear:N,monotoneX:B,monotoneY:I,step:D,stepAfter:P,stepBefore:L,basis:z,cardinal:$,catmullRom:C};function Ce(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function $e(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function ze(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],p=l[e.yAccessor||"y"];return null==d||null==p?null:{x:c(d),y:u(p)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Ce(e,n),c=$e(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function Le(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Pe(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function De(e,t,n){return Math.round(100*e)/100+""}function Ie(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 Be(e,t){return e instanceof Date&&(!(t&&t instanceof Date)||e.getFullYear()!==t.getFullYear()||e.getMonth()!==t.getMonth()||e.getDate()!==t.getDate())}function Ne(n){var o,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:p,axes:h,xLabel:y,yLabel:g,yLabelRight:f,xFormat:m,yFormat:b,showGrid:v,title:x,legend:k,legendHoverBehavior:A,legendClickBehavior:w,legendHighlightedCategory:j,legendIsolatedCategories:O,legendPosition:E="right",foregroundGraphics:C,marginalGraphics:$,xValues:z,yValues:L,annotations:P,svgAnnotationRules:D,xAccessor:I,yAccessor:B,annotationData:W,pointNodes:R,curve:_,underlayRendered:F,children:H}=n,q=r(()=>{var e;if(!p||!d)return[];const t=null==h?void 0:h.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||m||De,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=d.x.ticks(Math.min(o,Math.max(2,Math.floor(a/70)))),i=r.map(e=>e.valueOf()),s=r.map((e,t)=>({value:e,pixel:d.x(e),label:n(e,t,i)})),l=s.reduce((e,t)=>Math.max(e,6.5*t.label.length),0);return Ie(s,Math.max(55,l+8))},[p,d,h,m,a]),G=r(()=>{var e;if(!p||!d)return[];const t=null==h?void 0:h.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||b||De,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return Ie(d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22)},[p,d,h,b,s]),V=r(()=>{var e;if(!p||!d)return[];const t=null==h?void 0:h.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||b||De,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Ie(d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22)},[p,d,h,b,s]),Z=t(new Map),U=t(null!==(o=null==P?void 0:P.length)&&void 0!==o?o:0),Y=null!==(i=null==P?void 0:P.length)&&void 0!==i?i:0;U.current!==Y&&(U.current=Y,Z.current=new Map);const X=r(()=>{if(!P||0===P.length)return null;const t=function(t,n,o){var r,i,a,s,l,c,u,d,p,h,y,g,f,m,b,v,x,k,A,w,j,O,E,C,$,z,L,P,D,I,B,W,R,_,F,H,q,G,V,Z,U,Y,X,K;switch(t.type){case"label":{const r=ze(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Le(i,a,o)?e.createElement(Se,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=ze(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Le(i,a,o)?e.createElement(Se,{key:"ann-"+n,noteData:{x:i,y:a,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Ce(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:12,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=$e(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:r-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Ce(Object.assign(Object.assign({},e),{type:"point"}),o),y:$e(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=S(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Ce(Object.assign(Object.assign({},e),{type:"point"}),o),y:$e(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],a={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Ce(n,o),s=$e(n,o);if(null==i||null==s)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||a;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:l},c))}))}case"bracket":{const r=Ce(t,o),i=$e(t,o);return e.createElement(Se,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const p=o.xAccessor||"x",h=o.yAccessor||"y",y=d.map(e=>[e[p],e[h]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const g=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,f=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!g||!f)return null;const m=t.method||"linear";let b;b="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,p=0,h=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],p+=t*i[e],h+=t*r[e]*r[e],y+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const g=u*h-d*d;if(1e-12>Math.abs(g))s.push([t,p/u]);else{const e=(u*y-d*p)/g;s.push([t,(p-e*d)/u+e*t])}}return s}(y,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?T.polynomial(y,{order:t.order||2}):T.linear(y)).points;const v=b.map(([e,t])=>`${g(e)},${f(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:v,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:g(b[b.length-1][0])+4,y:f(b[b.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(p=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==p?p:null===(h=o.scales)||void 0===h?void 0:h.value,i=null!==(y=null==r?void 0:r(t.y0))&&void 0!==y?y:0,a=null!==(g=null==r?void 0:r(t.y1))&&void 0!==g?g:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,a)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",a=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.x)&&void 0!==m?m:null===(b=o.scales)||void 0===b?void 0:b.time,s=null!==(x=null===(v=o.scales)||void 0===v?void 0:v.y)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.value;if(!a||!s)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const p=Me[o.curve||"linear"]||N,h=M().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(p)(d);if(!h)return null;const y=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:h,fill:y,fillOpacity:null!==(A=t.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:a(d[d.length-1][i])+4,y:s(d[d.length-1][l])-4,fill:y,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(j=null===(w=o.scales)||void 0===w?void 0:w.x)&&void 0!==j?j:null===(O=o.scales)||void 0===O?void 0:O.time,s=null!==(C=null===(E=o.scales)||void 0===E?void 0:E.y)&&void 0!==C?C:null===($=o.scales)||void 0===$?void 0:$.value;if(!a||!s)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),p=null!==(z=t.threshold)&&void 0!==z?z:2,h=c-p*d,y=!1!==t.showBand,g=t.fill||"#6366f1",f=null!==(L=t.fillOpacity)&&void 0!==L?L:.1,m=t.anomalyColor||"#ef4444",b=null!==(P=t.anomalyRadius)&&void 0!==P?P:6,v=s(c+p*d),x=s(h),k=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>p*d});return e.createElement("g",{key:"ann-"+n},y&&e.createElement("rect",{x:0,y:Math.min(v,x),width:o.width||0,height:Math.abs(x-v),fill:g,fillOpacity:f}),k.map((t,n)=>{const r=Ce(t,o),i=$e(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(v,x)-4,textAnchor:"end",fill:g,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(I=null===(D=o.scales)||void 0===D?void 0:D.x)&&void 0!==I?I:null===(B=o.scales)||void 0===B?void 0:B.time,l=null!==(R=null===(W=o.scales)||void 0===W?void 0:W.y)&&void 0!==R?R:null===(_=o.scales)||void 0===_?void 0:_.value;if(!s||!l)return null;const c=r.map(e=>[e[i],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=T.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*e}const d=c.length,p=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),h=Math.sqrt(p/Math.max(d-2,1)),y=c.reduce((e,t)=>e+t[0],0)/d,g=c.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),f=null!==(F=t.confidence)&&void 0!==F?F:.95,m=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,b=null!==(H=t.steps)&&void 0!==H?H:5,v=c[d-1][0],x=(v-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(v+e*x);const A=[];for(const e of k){const t=u(e),n=h*Math.sqrt(1+1/d+(g>0?Math.pow(e-y,2)/g:0))*m;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const w=`M${A.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,j=A.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),O=`${s(v)},${l(u(v))}`,E=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:w,fill:t.fill||"#6366f1",fillOpacity:null!==(q=t.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e.createElement("polyline",{points:`${O} ${j}`,fill:"none",stroke:E,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(V=t.strokeDasharray)&&void 0!==V?V:"6,3"}),t.label&&A.length>0&&e.createElement("text",{x:s(A[A.length-1].x)+4,y:l(A[A.length-1].yCenter)-4,fill:E,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=ze(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Le(r,i,o))return null;const a=null!==(Z=t.dx)&&void 0!==Z?Z:0,s=null!==(U=t.dy)&&void 0!==U?U:0,l=null!==(Y=t.width)&&void 0!==Y?Y:32,c=null!==(X=t.height)&&void 0!==X?X:32,u=null!==(K=t.content)&&void 0!==K?K:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+a-l/2,y:i+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=ze(t,n,o);if(!r)return null;const{x:i,y:a}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:a+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}default:return null}},n={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:I,yAccessor:B,width:a,height:s,data:W,frameType:"xy",pointNodes:R,curve:_,stickyPositionCache:Z.current};return P.map((e,o)=>{if(D){const r=D(e,o,n);return null!=r?r:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[P,D,a,s,I,B,W,d,R,_]);return p||x||k||C||$||X&&X.length>0||v||H?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof x?x:"XY Chart"),e.createElement("desc",null,"string"==typeof x?x+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!F&&e.createElement("g",{className:"stream-grid"},q.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),G.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:a,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),p&&d&&(()=>{const t=null==h?void 0:h.find(e=>"left"===e.orient),n=null==h?void 0:h.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=(null==t?void 0:t.jaggedBase)||!1,i=(null==n?void 0:n.jaggedBase)||!1,l=null==n?void 0:n.landmarkTicks,c=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",m="var(--semiotic-text, #333)";return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!F&&(!n||!1!==n.baseline)&&!i&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:d,strokeWidth:1}),!F&&i&&e.createElement("path",{d:Pe("bottom",a,s),fill:"none",stroke:d,strokeWidth:1}),q.map((t,n)=>{const o=!!l&&("function"==typeof l?l(t.value,n):Be(t.value,n>0?q[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:d,strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:p,style:{userSelect:"none"}},t.label))}),y&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:m,style:{userSelect:"none"}},y),!F&&o&&!r&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:d,strokeWidth:1}),!F&&r&&e.createElement("path",{d:Pe("left",a,s),fill:"none",stroke:d,strokeWidth:1}),G.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):Be(t.value,n>0?G[n-1].value:void 0));return e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:p,style:{userSelect:"none"}},t.label))}),(()=>{const n=(null==t?void 0:t.label)||g;return n?e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:m,transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==h?void 0:h.find(e=>"right"===e.orient);if(!t||0===V.length)return null;const n=t.landmarkTicks,o=t.label||f;return e.createElement(e.Fragment,null,!1!==t.baseline&&e.createElement("line",{x1:a,y1:0,x2:a,y2:s,stroke:d,strokeWidth:1}),V.map((t,o)=>{const r=!!n&&("function"==typeof n?n(t.value,o):Be(t.value,o>0?V[o-1].value:void 0));return e.createElement("g",{key:"ytick-r-"+o,transform:`translate(${a},${t.pixel})`},e.createElement("line",{x2:5,stroke:d,strokeWidth:1}),e.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:p,style:{userSelect:"none"}},t.label))}),o&&e.createElement("text",{x:a+u.right-15,y:s/2,textAnchor:"middle",fontSize:12,fill:m,transform:`rotate(90, ${a+u.right-15}, ${s/2})`,style:{userSelect:"none"}},o))})())})(),X,$&&d&&z&&L&&e.createElement(e.Fragment,null,$.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(we,{orient:"top",config:Ae($.top),values:z,scale:d.x,size:u.top,length:a})),$.bottom&&e.createElement("g",{transform:`translate(0, ${s})`},e.createElement(we,{orient:"bottom",config:Ae($.bottom),values:z,scale:d.x,size:u.bottom,length:a})),$.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(we,{orient:"left",config:Ae($.left),values:L,scale:d.y,size:u.left,length:s})),$.right&&e.createElement("g",{transform:`translate(${a}, 0)`},e.createElement(we,{orient:"right",config:Ae($.right),values:L,scale:d.y,size:u.right,length:s}))),C,H),x&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof x?x:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:p}=t;if(!n)return null;const h="top"===a||"bottom"===a;let y,g;return"left"===a?(y=4,g=i.top):"top"===a?(y=0,g=s?32:8):"bottom"===a?(y=0,g=r-i.bottom+50):(y=o-i.right+10,g=i.top),e.createElement("g",{transform:`translate(${y}, ${g})`},"object"==typeof(f=n)&&null!==f&&"gradient"in f?e.createElement(xe,{config:n.gradient,orientation:h?"horizontal":"vertical",width:h?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(ke,{legendGroups:n.legendGroups,title:"",width:h?o:100,orientation:h?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:p}):n);var f}({legend:k,totalWidth:l,totalHeight:c,margin:u,legendPosition:E,title:x,legendHoverBehavior:A,legendClickBehavior:w,legendHighlightedCategory:j,legendIsolatedCategories:O})):null}function We(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Re="undefined"==typeof window||"undefined"==typeof document,Te={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function _e(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks"},i=["point","line","area","rect","heatcell","circle","candlestick"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function Fe({scene:t,chartType:n}){var o,r,i,a;const s=[];for(const e of t){if(s.length>=50)break;"point"===e.type?s.push({label:"Point",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+""}}):"rect"===e.type?s.push({label:"Bar",values:{category:(null===(o=e.datum)||void 0===o?void 0:o.category)||"",value:Math.round(100*(null!==(i=null===(r=e.datum)||void 0===r?void 0:r.value)&&void 0!==i?i:0))/100+""}}):"heatcell"===e.type&&s.push({label:"Cell",values:{x:Math.round(100*e.x)/100+"",y:Math.round(100*e.y)/100+"",value:Math.round(100*(null!==(a=e.value)&&void 0!==a?a:0))/100+""}})}if(0===s.length)return null;const l=new Set;for(const e of s)for(const t of Object.keys(e.values))l.add(t);const c=Array.from(l);return e.createElement("table",{style:Te,role:"table","aria-label":"Data table for "+n},e.createElement("thead",null,e.createElement("tr",null,c.map(t=>e.createElement("th",{key:t},t)))),e.createElement("tbody",null,s.map((t,n)=>e.createElement("tr",{key:n},c.map(n=>{var o;return e.createElement("td",{key:n},null!==(o=t.values[n])&&void 0!==o?o:"")}))),t.length>50&&e.createElement("tr",null,e.createElement("td",{colSpan:c.length},"...and ",t.length-50," more items"))))}function He({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:Te},n)}function qe(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Ge(e,t,n=.6){var o,r,i,a,s;if(!qe(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Ve(e,t,n,o=.35){qe(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Ze(e){switch(e){case"monotoneX":return B;case"monotoneY":return I;case"cardinal":return $;case"catmullRom":return C;case"step":return D;case"stepBefore":return L;case"stepAfter":return P;case"basis":return z;case"natural":return R;default:return null}}function Ue(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 Ye(e,t,n,o,r,i){if(2>t.length)return;const a=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function Xe(e){return e.k}function Ke(e){return[e.x,e.y]}function Je(e){return function(){return e}}function Qe([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function et(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function tt(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function nt(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 ot{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 rt{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const a=n[i.lineIndex];if(!a||2>a.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const s=it(a),l=at(a,i.t*s),c=(o[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function it(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 at(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],a=Math.sqrt(r*r+i*i);if(n+a>=t||o===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[o-1][0]+r*s,y:e[o-1][1]+i*s,nx:-i/l,ny:r/l}}n+=a}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}function st(n){const o=i(null),c=lt(n);return[function({children:t}){const i=r(()=>lt(n),[]);return e.createElement(o.Provider,{value:i,children:t})},e=>{var n;const r=null!==(n=a(o))&&void 0!==n?n:c,i=t(e);i.current=e;const u=s(()=>i.current(r.getState()),[r]),d=s(()=>i.current(r.getState()),[r]);return l(r.subscribe,u,d)}]}function lt(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const ct={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},ut={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},dt={mode:"light",colors:{primary:"#0000cc",categorical:["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[pt,ht]=st(e=>({theme:ct,setTheme(t){e(e=>{if("light"===t)return{theme:ct};if("dark"===t)return{theme:ut};if("high-contrast"===t)return{theme:dt};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?ut:ct;return{theme:Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})})}}return{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}})),yt={top:10,right:10,bottom:10,left:10},gt={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"},ft={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 mt({data:t}){if(!t)return null;if(t.properties)return e.createElement("div",{className:"semiotic-tooltip",style:gt},e.createElement("div",{style:{fontWeight:600}},t.properties.name||t.properties.NAME||t.properties.id||"Feature"));const n=Object.entries(t).slice(0,3);return e.createElement("div",{className:"semiotic-tooltip",style:gt},n.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,": "),e.createElement("span",{style:{fontWeight:600}},n+""))))}const bt=c(function(i,a){var l,c,d,p,h,y,g;const{projection:f,projectionExtent:m,fitPadding:b,projectionTransform:v,areas:x,points:k,lines:A,xAccessor:w,yAccessor:j,lineDataAccessor:O,pointIdAccessor:E,lineType:S="geo",flowStyle:M="basic",graticule:C,zoomable:$,zoomExtent:z,onZoom:L,dragRotate:P,showParticles:D,particleStyle:I,tileURL:B,tileAttribution:N,tileCacheSize:R,size:T,width:q,height:G,responsiveWidth:V,responsiveHeight:Z,margin:U,className:Y,background:X,areaStyle:K,pointStyle:J,lineStyle:Q,colorScheme:ee,enableHover:te=!0,hoverAnnotation:ne,tooltipContent:oe,customClickBehavior:re,customHoverBehavior:ie,annotations:ae,decay:se,pulse:le,transition:ce,staleness:ue,backgroundGraphics:de,foregroundGraphics:pe,title:ge,legend:fe,legendPosition:me,legendHoverBehavior:be,legendClickBehavior:ve,legendHighlightedCategory:xe,legendIsolatedCategories:ke,showAxes:Ae,accessibleTable:we}=i,je=T||[q||600,G||400],[Oe,Ee]=function(e,r,i){const a=t(null),[s,l]=n(null);return o(()=>{if(!r&&!i)return;const e=a.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[r,i]),[a,[r&&s?s.w:e[0],i&&s?s.h:e[1]]]}(je,V,Z),Se=r(()=>Object.assign(Object.assign({},yt),U),[U]),Me=Ee[0]-Se.left-Se.right,Ce=Ee[1]-Se.top-Se.bottom,$e="function"==typeof pe?pe({size:Ee,margin:Se}):pe,ze="function"==typeof de?de({size:Ee,margin:Se}):de,Le=r(()=>null!=P?P:"orthographic"===("string"==typeof f?f:"object"==typeof f&&"type"in f?f.type:null),[P,f]),Pe=r(()=>({projection:f,projectionExtent:m,fitPadding:b,xAccessor:w,yAccessor:j,lineDataAccessor:O,lineType:S,flowStyle:M,areaStyle:K,pointStyle:J,lineStyle:Q,colorScheme:ee,graticule:C,projectionTransform:v,decay:se,pulse:le,transition:ce,annotations:ae,pointIdAccessor:E}),[f,m,b,w,j,O,S,M,K,J,Q,ee,C,v,se,le,ce,ae,E]),De=t(null);De.current||(De.current=new he(Pe));const Ie=t(null),Be=t(null),Te=t(null),qe=t(null),it=t(null);B&&!it.current&&(it.current=new ot(R||256));const at=t(0),st=t(!0),lt=ht(e=>e.theme),ct=t(ae),ut=t(()=>{}),dt=t(null),pt=t(_),gt=t(!1),bt=t(null),vt=t(null),xt=t(null),kt=t(null),At=t(0);if(D&&!kt.current){const e=null!==(l=null==I?void 0:I.maxPerLine)&&void 0!==l?l:30;kt.current=new rt(50*e)}const wt=t(null),jt=t(null),[Ot,Et]=n(null),[St,Mt]=n(0),[Ct,$t]=n(!1),zt=s(()=>{at.current||(at.current=requestAnimationFrame(()=>ut.current()))},[]);o(()=>{st.current=!0,zt()},[lt,zt]),o(()=>{var e;null===(e=De.current)||void 0===e||e.updateConfig(Pe),st.current=!0,zt()},[Pe,zt]),o(()=>{const e=De.current;e&&(x&&e.setAreas(x),k&&e.setPoints(k),A&&e.setLines(A),st.current=!0,zt())},[x,k,A,zt]);const Lt=s(e=>{var t;null===(t=De.current)||void 0===t||t.pushPoint(e),st.current=!0,zt()},[zt]),Pt=s(e=>{var t;null===(t=De.current)||void 0===t||t.pushMany(e),st.current=!0,zt()},[zt]),Dt=s(()=>{var e;null===(e=De.current)||void 0===e||e.clear(),st.current=!0,zt()},[zt]);u(a,()=>({push:Lt,pushMany:Pt,clear:Dt,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=De.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=De.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=De.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>pt.current.k,resetZoom:()=>{const e=bt.current;e&&dt.current&&H(e).call(dt.current.transform,_)},getData:()=>{const e=De.current;return e?e.scene.filter(e=>"point"===e.type).map(e=>e.datum).filter(Boolean):[]}}),[Lt,Pt,Dt]);const It=t(()=>{});o(()=>{It.current=e=>{if(!te)return;const t=De.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Se.left,r=e.clientY-n.top-Se.top;if(0>o||o>Me||0>r||r>Ce)return wt.current=null,jt.current=null,Et(null),null==ie||ie(null),void zt();qe.current||(qe.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=qe.current.getContext("2d");if(!i)return;const a=ye(t.scene,o,r,30,i);if(a){const e=a.node,t=e.datum,n=(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let i,s;"point"===e.type?(i=e.x,s=e.y):"geoarea"===e.type?(i=e.centroid[0],s=e.centroid[1]):(i=o,s=r);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,x:i,y:s,time:0});wt.current=l,jt.current=e,Et(l),null==ie||ie({type:e.type,data:n,x:i,y:s}),zt()}else wt.current&&(wt.current=null,jt.current=null,Et(null),null==ie||ie(null),zt())}},[te,Me,Ce,Se,ie,zt]);const Bt=s(e=>It.current(e),[]),Nt=s(()=>{wt.current=null,jt.current=null,Et(null),null==ie||ie(null),zt()},[ie,zt]),Wt=s(e=>{if(!re)return;const t=De.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Se.left,r=e.clientY-n.top-Se.top;qe.current||(qe.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=qe.current.getContext("2d");if(!i)return;const a=ye(t.scene,o,r,30,i);if(a){const e=a.node.datum;re({type:a.node.type,data:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,x:o,y:r})}},[re,Se]);ut.current=()=>{var e,t,n,o,r,i,a;at.current=0;const s=Be.current,l=De.current;if(!s||!l)return;const c=performance.now();let u=!1;const d=xt.current;d&&(xt.current=null,l.applyRotation(d,{width:Me,height:Ce}));const p=l.advanceTransition(c);if(st.current&&!p){const e={width:Me,height:Ce},t=Le?l.getRotation():null;l.computeScene(e);const n=pt.current,o=1!==n.k||0!==n.x||0!==n.y;Le&&t?o?(l.setRotation(t),l.applyZoomScale(n.k,e)):l.applyRotation(t,e):o&&l.applyZoomTransform(n,e),st.current=!1,s.setAttribute("aria-label",_e(l.scene,"Geographic chart"))}const h=tt();if(B&&it.current){const t=Ie.current;if(t&&(null===(e=l.scales)||void 0===e?void 0:e.projection)){const e=et(t,Ee,Se,h);if(e){e.clearRect(-Se.left,-Se.top,Ee[0],Ee[1]),e.save(),e.beginPath(),e.rect(0,0,Me,Ce),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:a,onTileLoad:s}=t,l=o.scale(),c=o.translate(),u=2*l*Math.PI,d=function(){let e=0,t=0,n=960,o=500,r=!0,i=!0,a=256,s=Xe,l=Ke,c=0;function u(){const u=+s.apply(this,arguments),d=l.apply(this,arguments),p=Math.log2(u/a),h=Math.round(Math.max(p+c,0)),y=Math.pow(2,p-h)*a,g=+d[0]-u/2,f=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-g)/y)),b=Math.min(r?1<<h:1/0,Math.ceil((n-g)/y)),v=Math.max(i?0:-1/0,Math.floor((t-f)/y)),x=Math.min(i?1<<h:1/0,Math.ceil((o-f)/y)),k=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)k.push([t,e,h]);return k.translate=[g/y,f/y],k.scale=y,k}return u.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],u):[n-e,o-t]},u.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],u):[[e,t],[n,o]]},u.scale=function(e){return arguments.length?(s="function"==typeof e?e:Je(+e),u):s},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:Je([+e[0],+e[1]]),u):l},u.zoomDelta=function(e){return arguments.length?(c=+e,u):c},u.tileSize=function(e){return arguments.length?(a=+e,u):a},u.clamp=function(e){return arguments.length?(r=i=!!e,u):r&&i},u.clampX=function(e){return arguments.length?(r=!!e,u):r},u.clampY=function(e){return arguments.length?(i=!!e,u):i},u}().size([r,i]).scale(u).translate(c).clamp(!0)(),p=tt();let h=!0;for(const t of d){const[o,r,i]=Qe(t),l=`${i}/${o}/${r}`;let c=a.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};a.set(l,t),e.onload=()=>{t.loaded=!0,null==s||s()},e.onerror=()=>{t.loaded=!0},e.src=nt(n,i,o,r,p),c=t}if(!c.loaded){h=!1;continue}const u=d.scale;e.drawImage(c.img,(t[0]+d.translate[0])*u-.5,(t[1]+d.translate[1])*u-.5,u+1,u+1)}return h}(e,{tileURL:B,projection:l.scales.projection,width:Me,height:Ce,tileCache:it.current,onTileLoad:()=>zt()});e.restore(),t||(u=!0)}}}const y=et(s,Ee,Se,h);if(!y)return;y.clearRect(-Se.left,-Se.top,Ee[0],Ee[1]),X&&!B&&(y.fillStyle=X,y.fillRect(0,0,Me,Ce)),y.save(),y.beginPath(),y.rect(0,0,Me,Ce),y.clip();const g=l.scene,f={height:Ce};if(function(e,t){var n,o,r;const i=t.filter(e=>"geoarea"===e.type);for(const t of i){if(!t.pathData)continue;const i=new Path2D(t.pathData),a=t.style.fill||"#e0e0e0";if("none"!==a&&(e.fillStyle=a,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(i)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(r=t._decayOpacity)&&void 0!==r?r:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(i)}Ve(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(y,g),((e,t,n,o)=>{var r,i;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s.style.stroke||"#007bff",c=s.style.strokeWidth||2,u=s.colorThresholds,d=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=c,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const g=null!==(r=s.style.opacity)&&void 0!==r?r:1;Ye(e,s.path,l,c,g,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=Ze(s.curve),h=u&&u.length>0&&d&&d.length===s.path.length,y=s._decayOpacities;if(y&&y.length===s.path.length&&!h){e.strokeStyle=l;const f=null!==(i=s.style.opacity)&&void 0!==i?i:1;for(let m=0;s.path.length-1>m;m++)e.globalAlpha=.5*(y[m]+y[m+1])*f,e.beginPath(),e.moveTo(s.path[m][0],s.path[m][1]),e.lineTo(s.path[m+1][0],s.path[m+1][1]),e.stroke()}else if(h){let b=null,v=null,x=null,k=null,A=!1;function w(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),A=!0}function j(){A&&(e.stroke(),A=!1)}for(let O=0;s.path.length>O;O++){const[E,S]=s.path[O],M=d[O],C=Ue(M,u,l);if(null!==b&&null!==k&&null!==x){if(C===k)e.lineTo(E,S);else{const $=[];for(const z of u){const L=z.value;(x>L||L>M)&&(L>x||M>L)||x===L||M===L||$.push({t:(L-x)/(M-x)})}$.sort((e,t)=>e.t-t.t);for(const P of $){const D=b+(E-b)*P.t,I=v+(S-v)*P.t,B=Ue(x+(M-x)*Math.min(P.t+1e-4,1),u,l);e.lineTo(D,I),j(),w(B,D,I)}e.lineTo(E,S)}b=E,v=S,x=M,k=C}else w(C,E,S),b=E,v=S,x=M,k=C}j()}else{if(e.beginPath(),e.strokeStyle=l,p)W().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[N,R]=s.path[0];e.moveTo(N,R);for(let T=1;s.path.length>T;T++)e.lineTo(s.path[T][0],s.path[T][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=s.style.fill,p&&!h)W().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[F,H]=s.path[0];e.moveTo(F,H);for(let q=1;s.path.length>q;q++)e.lineTo(s.path[q][0],s.path[q][1])}const _=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(_,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(y,g,0,f),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Ge(e,t),e.globalAlpha=1}}finally{e.restore()}})(y,g),D&&kt.current){const e=kt.current,a=g.filter(e=>"line"===e.type);if(a.length>0){const s=I||{},l=.3*(null!==(t=s.speedMultiplier)&&void 0!==t?t:1),d=null!==(n=s.maxPerLine)&&void 0!==n?n:30,p=null!==(o=s.spawnRate)&&void 0!==o?o:.15,h=null!==(r=s.radius)&&void 0!==r?r:2,g=null!==(i=s.opacity)&&void 0!==i?i:.7,f=c/1e3,m=At.current>0?Math.min(f-At.current,.1):.016;At.current=f;const b=a.map(e=>e.path),v=a.map(e=>e.style.strokeWidth||2);for(let t=0;a.length>t;t++)Math.random()<p&&e.countForLine(t)<d&&e.spawn(t);e.step(m,l,b,v),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 s.color?s.color(null==o?void 0:o.datum):"source"!==s.color&&s.color?s.color:(null==o?void 0:o.style.stroke)||"#fff";y.beginPath(),y.arc(n.x,n.y,h,0,2*Math.PI),y.fillStyle=r,y.fill()}y.globalAlpha=1,u=!0}}y.restore();const m=Te.current;if(m){const e=et(m,Ee,Se,h);if(e){e.clearRect(-Se.left,-Se.top,Ee[0],Ee[1]);const t=jt.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 ne?ne: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(ue){const e=performance.now()-l.lastIngestTime>(null!==(a=ue.threshold)&&void 0!==a?a:5e3);e!==Ct&&$t(e)}const b=ae!==ct.current;b&&(ct.current=ae),(st.current||b)&&Mt(e=>e+1),(p||l.hasActivePulses||u)&&(at.current=requestAnimationFrame(()=>ut.current()))},o(()=>(zt(),()=>{var e;at.current&&(cancelAnimationFrame(at.current),at.current=0),null===(e=it.current)||void 0===e||e.clear()}),[zt]),o(()=>{st.current=!0,zt()},[Me,Ce,X,zt]),function(e,t,n,r,i,a){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}(ue,De,st,zt,Ct,$t),o(()=>{if("production"!==process.env.NODE_ENV&&B){const e="string"==typeof f?f:"object"==typeof f&&"type"in f?f.type:null;e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[B,f]),o(()=>{const e=bt.current;if(!$||!e)return dt.current&&e&&(H(e).on(".zoom",null),dt.current=null),void(e&&H(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=z||[1,8],o={width:Me,height:Ce};if(Le){let r=pt.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),pt.current=_.scale(r);const a=De.current;a&&(a.applyZoomScale(r,o),st.current=!1,zt(),null==L||L({projection:null===(i=a.scales)||void 0===i?void 0:i.projection,zoom:a.currentZoom}))};dt.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const a=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",s);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=De.current;if(!o)return;const r=o.getRotation();vt.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=vt.current;t&&(xt.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]],zt())},d=t=>{var n;if(!vt.current)return;vt.current=null,e.releasePointerCapture(t.pointerId);const r=xt.current;if(r){xt.current=null;const e=De.current;e&&(e.applyRotation(r,o),zt())}const i=De.current;i&&(null==L||L({projection:null===(n=i.scales)||void 0===n?void 0:n.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),dt.current=null}}const r=F().scaleExtent([t,n]).extent([[0,0],[Ee[0],Ee[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;pt.current=t,gt.current=!0;const n=De.current;n&&(n.applyZoomTransform(t,o),st.current=!1,zt())}).on("end",e=>{var t;pt.current=e.transform,gt.current=!1;const n=De.current;n&&(null==L||L({projection:null===(t=n.scales)||void 0===t?void 0:t.projection,zoom:n.currentZoom}))});return dt.current=r,H(e).call(r),()=>{H(e).on(".zoom",null)}},[$,z,Le,Ee,Me,Ce,Se,L,zt]);const Rt=te&&!1!==ne,Tt=Rt&&Ot?oe?oe(Ot):e.createElement(mt,{data:Ot}):null,_t=Tt?e.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:Se.left+Ot.x,top:Se.top+Ot.y,transform:`translate(${Ot.x>.7*Me?"calc(-100% - 12px)":"12px"}, ${.3*Ce>Ot.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:10,width:"max-content"}},Tt):null;if(Re){const t=De.current;t&&(x||k||A)&&(x&&t.setAreas(x),k&&t.setPoints(k),A&&t.setLines(A),t.computeScene({width:Me,height:Ce}));const n=null!==(c=null==t?void 0:t.scene)&&void 0!==c?c:[];return e.createElement("div",{className:"stream-geo-frame"+(Y?" "+Y:""),role:"img","aria-label":"string"==typeof ge?ge:"Geographic chart",style:{position:"relative",width:Ee[0],height:Ee[1]}},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ee[0],height:Ee[1],style:{position:"absolute",left:0,top:0}},ze,e.createElement("g",{transform:`translate(${Se.left},${Se.top})`},X&&e.createElement("rect",{x:0,y:0,width:Me,height:Ce,fill:X}),n.map((t,n)=>function(t,n){var o,r,i,a,s,l;switch(t.type){case"geoarea":{const i=t;return i.pathData?e.createElement("path",{key:"geoarea-"+n,d:i.pathData,fill:We(i.style.fill,"#e0e0e0"),fillOpacity:null!==(o=i.style.fillOpacity)&&void 0!==o?o:1,stroke:i.style.stroke||"none",strokeWidth:i.style.strokeWidth||.5,strokeDasharray:i.style.strokeDasharray,opacity:null!==(r=i._decayOpacity)&&void 0!==r?r:1}):null}case"point":{const o=t;return e.createElement("circle",{key:"point-"+n,cx:o.x,cy:o.y,r:o.r,fill:We(o.style.fill),fillOpacity:null!==(i=o.style.fillOpacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(a=o._decayOpacity)&&void 0!==a?a:null!==(s=o.style.opacity)&&void 0!==s?s:1})}case"line":{const o=t;if(2>o.path.length)return null;const r="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e.createElement("path",{key:"line-"+n,d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(l=o.style.opacity)&&void 0!==l?l:1})}default:return null}}(t,n)))),e.createElement(Ne,{width:Me,height:Ce,totalWidth:Ee[0],totalHeight:Ee[1],margin:Se,scales:null,showAxes:!1,title:ge,legend:fe,legendPosition:me,legendHoverBehavior:be,legendClickBehavior:ve,legendHighlightedCategory:xe,legendIsolatedCategories:ke,foregroundGraphics:$e,annotations:ae,annotationFrame:0,xValues:[],yValues:[],pointNodes:n.filter(e=>"point"===e.type)}))}const Ft=s(e=>{bt.current=e,Oe&&"object"==typeof Oe&&(Oe.current=e)},[Oe]);return e.createElement("div",{ref:Ft,className:"stream-geo-frame"+(Y?" "+Y:""),role:"img","aria-label":"string"==typeof ge?ge:"Geographic chart",tabIndex:0,style:Object.assign({position:"relative",width:V?"100%":Ee[0],height:Z?"100%":Ee[1],overflow:"hidden"},$?{touchAction:"none"}:{}),onMouseMove:Rt?Bt:void 0,onMouseLeave:Rt?Nt:void 0,onClick:re?Wt:void 0},ze&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Ee[0],height:Ee[1],pointerEvents:"none"}},ze),B&&e.createElement("canvas",{ref:Ie,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement("canvas",{ref:Be,"aria-label":_e(null!==(p=null===(d=De.current)||void 0===d?void 0:d.scene)&&void 0!==p?p:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:Te,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(He,{hoverPoint:Ot}),we&&e.createElement(Fe,{scene:null!==(y=null===(h=De.current)||void 0===h?void 0:h.scene)&&void 0!==y?y:[],chartType:"Geographic chart"}),e.createElement(Ne,{width:Me,height:Ce,totalWidth:Ee[0],totalHeight:Ee[1],margin:Se,scales:null,showAxes:null!=Ae&&Ae,title:ge,legend:fe,legendPosition:me,legendHoverBehavior:be,legendClickBehavior:ve,legendHighlightedCategory:xe,legendIsolatedCategories:ke,foregroundGraphics:$e,annotations:ae,annotationFrame:St,xValues:[],yValues:[],pointNodes:null===(g=De.current)||void 0===g?void 0:g.scene.filter(e=>"point"===e.type)}),(null==ue?void 0:ue.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ue.badgePosition?{top:4,left:4}:"bottom-left"===ue.badgePosition?{bottom:4,left:4}:"bottom-right"===ue.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Ct?"#dc3545":"#28a745",color:"white"})},Ct?"STALE":"LIVE"),$&&e.createElement("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Se.bottom+8,left:Se.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2}},e.createElement("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=bt.current,n=dt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(H(t),1.5)},style:ft},"+"),e.createElement("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=bt.current,n=dt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(H(t),1/1.5)},style:ft},"−")),N&&e.createElement("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Se.bottom+2,right:Se.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}},N),_t)});bt.displayName="StreamGeoFrame";const vt={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 xt(e,t){return"function"==typeof t?t(e):e[t]}function kt(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function At(t={}){const{fields:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=xt(t,o);s=kt(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=xt(t,o);l.push({label:n,value:kt(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=kt(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=kt(t[e[0]],r))}}const c=Object.assign(Object.assign({},vt),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function wt(t){if(!0===t)return At();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:vt},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?At(t):At())}const jt={category10:q,tableau10:Q,set3:J,blues:K,reds:X,greens:Y,oranges:U,purples:Z,viridis:V,plasma:G},Ot=q,Et=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],St=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 Mt(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")||St.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):Ot[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+""))%Ot.length]}function Ct(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 w().domain(o).range(n).unknown("#999");const i=jt[n]||jt.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:Ot;return w().domain(o).range(e).unknown("#999")}}function $t(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}const zt=i(null);function Lt(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 Pt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Dt,It]=st(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Pt(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=Pt(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}})}})),[Bt,Nt]=st(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Wt(e){const t=d(),n=e.clientId||t,{name:o}=e,i=It(e=>e.selections.get(o)),a=It(e=>e.setClause),l=It(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Lt(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(o,{clientId:n,type:"point",fields:t})},[n,o,a]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(o,{clientId:n,type:"interval",fields:t})},[n,o,a]),clear:s(()=>{l(o,n)},[l,o,n]),clientId:n}}function Rt(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=Wt({name:t});return{onHover:s(e=>{if(!e)return void a();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,a,t]),predicate:o,isActive:r}}const Tt=i(!1);function _t(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields}:null}function Ft(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}const Ht="#007bff";function qt(e,t,n="category10"){const o=a(zt);return r(()=>{if(t){if(0===e.length)return o&&Object.keys(o).length>0?e=>o[e]||"#999":void 0;if("function"==typeof t){const r=Array.from(new Set(e.map(e=>t(e)+"")));return o&&Object.keys(o).length>0?e=>o[e]||"#999":Ct(r.map(e=>({_cat:e})),"_cat",n)}if(o&&Object.keys(o).length>0){const r=Ct(e,t,n);return e=>o[e]||r(e)}return Ct(e,t,n)}},[e,t,n,o])}function Gt({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:i,chartId:a}){const l=_t(t,n),c=Wt({name:(null==e?void 0:e.name)||"__unused__"}),u=Rt({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||n||[]}),d=Nt(e=>e.pushObservation),p=e?{isActive:c.isActive,predicate:c.predicate}:null,h=s(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(r||d){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=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(a),d&&d(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),d&&d(e)}}},[t,u,r,i,a,d]),y=s(e=>{var t,n;if(r||d){const o={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),d&&d(e)}}},[r,d,i,a]);return{activeSelectionHook:p,customHoverBehavior:h,customClickBehavior:y}}function Vt({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=a(Tt),d=void 0!==o?o:!u&&!!t,p=r(()=>{if(d&&t)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):Et[i%Et.length];return{label:r+"",color:s}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Mt,categories:c})},[d,t,e,n,c]),h=r(()=>{const e=Object.assign(Object.assign({},l),s);return p&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[l,s,p,i]);return{legend:p,margin:h,legendPosition:i}}const Zt={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Ut(e,t,n){var o,r,i,a,s,l;const c=Zt[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(r=t.height)&&void 0!==r?r:c.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:Yt(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function Yt(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 Xt({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},o)))}class Kt extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(Xt,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Jt(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Qt(e,t,n=3){let o,r=n+1;for(const n of t){const t=Jt(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function en(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function tn(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=Qt(e,t,3))&&void 0!==n?n:null)}const nn={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"}},on={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},rn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},an=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],sn=["vertical","horizontal"],ln={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),on),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:an},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({},nn),on),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:an},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),on),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:an},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({},nn),on),{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({},nn),on),{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({},nn),on),{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({},nn),on),{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({},nn),on),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),on),{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({},nn),rn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:sn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),rn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:sn},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),rn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:sn},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),rn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:sn},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),rn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:sn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),rn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),rn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:sn},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),rn),{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({},nn),rn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:sn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},nn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nn),rn),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},nn),{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({},nn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:sn},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},nn),{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({},nn),{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({},nn),{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({},nn),{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({},nn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function cn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const un=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),dn=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),pn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),hn=new Set(["LineChart","AreaChart","StackedAreaChart"]),yn=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function gn(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function fn(e,t){const n=gn(e),o=gn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const mn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function bn(e,t){const n=[],o=function(e,t){const n=[],o=ln[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(ln).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(!cn(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=Qt(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=function({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=en(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=tn(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=en(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=tn(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 ln[e]?(function(e,t,n){const o=ln[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=ln[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){un.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){dn.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=ln[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!pn.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!hn.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=ln[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!yn.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=fn(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=[];for(const e of mn)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var vn;const xn="undefined"!=typeof process&&"production"!==(null===(vn=process.env)||void 0===vn?void 0:vn.NODE_ENV);function kn({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(Kt,{fallback:i=>{let a="";if(xn&&r)try{const e=bn(t,r);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(Xt,{componentName:t,message:i.message,diagnosticHint:a,width:n,height:o})}},i)}const An={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},wn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function jn(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},An),{width:n,height:o})},r||"No data available"):null}function On(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},wn),{position:"absolute",top:s+o*(i+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function En(e,t,n,o){if(!xn)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 Sn(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((o=o.apply(e,t||[])).next())})}function Mn(e){return e}function Cn(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 Mn;var t,n,o=e.scale[0],r=e.scale[1],i=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var l=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+i,u[1]=(n+=e[1])*r+a;c>l;)u[l]=e[l],++l;return u}}(e.transform),o=e.arcs;function r(e,t){t.length&&t.pop();for(var r=o[0>e?~e:e],i=0,a=r.length;a>i;++i)t.push(n(r[i],i));0>e&&function(e,t){for(var n,o=e.length,r=o-t;r<--o;)n=e[r],e[r++]=e[o],e[o]=n}(t,a)}function i(e){return n(e)}function a(e){for(var t=[],n=0,o=e.length;o>n;++n)r(e[n],t);return 2>t.length&&t.push(t[0]),t}function s(e){for(var t=a(e);4>t.length;)t.push(t[0]);return t}function l(e){return e.map(s)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=i(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(i);break;case"LineString":n=a(t.arcs);break;case"MultiLineString":n=t.arcs.map(a);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:r,geometry:i}:null==o?{type:"Feature",id:n,properties:r,geometry:i}:{type:"Feature",id:n,bbox:o,properties:r,geometry:i}}"function"==typeof SuppressedError&&SuppressedError;const $n=new Map;function zn(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function Ln(e){return Sn(this,void 0,void 0,function*(){const t=$n.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return Sn(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:zn(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:zn(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:zn(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:zn(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 Cn(e,t)})}:Cn(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return $n.set(e,i),i})}function Pn(e){const t=r(()=>Array.isArray(e)?e:void 0,[e]),[i,a]=n(null);return o(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return a(null),Ln(e).then(e=>{t||a(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".`),a(null)}else a(null)},[e]),void 0!==t?t:i}const Dn={blues:K,reds:X,greens:Y,viridis:V};function In(t){const n=Ut(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{areas:o,valueAccessor:i,colorScheme:a="blues",projection:s="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:p,dragRotate:h,tileURL:y,tileAttribution:g,tileCacheSize:f,tooltip:m,areaOpacity:b=1,annotations:v,margin:x,className:k,selection:A,linkedHover:w,onObservation:O,chartId:S,loading:M,emptyContent:C,frameProps:$={}}=t,z=null!=u?u:!!y,L=Pn(o),P=r(()=>"function"==typeof i?i:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[i])&&void 0!==n?n:null==e?void 0:e[i]},[i]),D=r(()=>{if(!L)return j(K).domain([0,1]);const e=L.map(e=>P(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=E(e);return j(Dn[a]||K).domain([null!=t?t:0,null!=n?n:1])},[L,P,a]),{activeSelectionHook:I,customHoverBehavior:B}=Gt({selection:A,linkedHover:w,onObservation:O,chartType:"ChoroplethMap",chartId:S}),N=r(()=>{const e=e=>{const t=P(e);return{fill:null!=t&&isFinite(t)?D(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:b}};return I?Ft(e,I,A):e},[P,D,I,A,b]),W=r(()=>t=>{var n,o;const r=(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.name)||(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||"Feature",i=P(t);return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},r),null!=i&&e.createElement("div",{style:{opacity:.7}},"number"==typeof(a=i)&&isFinite(a)?Number.isInteger(a)?a.toLocaleString():a.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=a?a:"")+""));var a},[P]),R=r(()=>Object.assign({top:10,right:10,bottom:10,left:10},x),[x]),T=On(M,n.width,n.height)||(L?null:On(!0,n.width,n.height)),_=T?null:jn(L,n.width,n.height,C);if(Array.isArray(L)&&L.length>0){const t=L[0];if(!t||"object"!=typeof t||!t.geometry)return e.createElement(Xt,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:n.width,height:n.height})}const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:s,areas:L,areaStyle:N,size:[n.width,n.height],margin:R,enableHover:!0,tooltipContent:!1===m?()=>null:!0===m?W:wt(m)||W},null!=l&&{graticule:l}),null!=c&&{fitPadding:c}),z&&{zoomable:!0}),d&&{zoomExtent:d}),p&&{onZoom:p}),null!=h&&{dragRotate:h}),y&&{tileURL:y}),g&&{tileAttribution:g}),f&&{tileCacheSize:f}),(w||O)&&{customHoverBehavior:B}),v&&v.length>0&&{annotations:v}),n.title&&{title:n.title}),k&&{className:k}),$);return T||_||e.createElement(kn,{componentName:"ChoroplethMap",width:n.width,height:n.height},e.createElement(bt,Object.assign({},F)))}In.displayName="ChoroplethMap";const Bn=c(function(o,i){const a=t(null);u(i,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const l=Ut(o.mode,{width:o.width,height:o.height,showLegend:o.showLegend,title:o.title}),{points:c,xAccessor:d="lon",yAccessor:p="lat",sizeBy:h,sizeRange:y=[3,30],colorBy:g,colorScheme:f="category10",projection:m="equalEarth",graticule:b,fitPadding:v,zoomable:x,zoomExtent:k,onZoom:A,dragRotate:w,tileURL:j,tileAttribution:O,tileCacheSize:E,areas:S,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:C,annotations:$,margin:z,className:L,selection:P,linkedHover:D,onObservation:I,chartId:B,loading:N,emptyContent:W,legendInteraction:R,legendPosition:T,frameProps:_={}}=o,F=null!=x?x:!!j,H=Pn(S),q=c||[],{activeSelectionHook:G,customHoverBehavior:V}=Gt({selection:P,linkedHover:D,fallbackFields:g?["string"==typeof g?g:""]:[],onObservation:I,chartType:"ProportionalSymbolMap",chartId:B}),Z=qt(q,g,f),U=r(()=>{if(!h)return;const e="function"==typeof h?h:e=>e[h],t=q.map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[q,h]),Y=r(()=>{const e=e=>({fill:g?Mt(e,g,Z):Ht,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:h?$t(e,h,y,U):6});return G?Ft(e,G,P):e},[g,Z,h,y,U,G,P]),X=r(()=>{if(!g)return[];const e="function"==typeof g?g:e=>e[g],t=new Set;for(const n of q){const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[q,g]),K=function(e,t,o){const[i,a]=n(null),[l,c]=n(new Set),u=s(t=>{"highlight"===e&&a(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),p=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===i}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,i,l]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:p}}(R,g,X),{legend:J,margin:Q,legendPosition:ee}=Vt({data:q,colorBy:g,colorScale:Z,showLegend:l.showLegend,legendPosition:T,userMargin:z,defaults:{top:10,bottom:10,left:10,right:10}}),te=r(()=>t=>{const n=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t.NAME)||(null==t?void 0:t.id),o="string"==typeof h?h:null,r=("function"==typeof h?h:e=>e[h])(t),i=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",a="string"==typeof g?g:null,s=a?null==t?void 0:t[a]:null;return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},n&&e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n),o&&null!=r&&e.createElement("div",null,e.createElement("span",{style:{opacity:.7}},o,": "),i(r)),a&&null!=s&&e.createElement("div",null,e.createElement("span",{style:{opacity:.7}},a,": "),s+""),!n&&!o&&Object.entries(t).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,": "),i(n))))},[h,g]),ne=On(N,l.width,l.height),oe=ne?null:jn(c,l.width,l.height,W);En("ProportionalSymbolMap",q,"xAccessor",d),En("ProportionalSymbolMap",q,"yAccessor",p);const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:m},null!=c&&{points:q}),{xAccessor:d,yAccessor:p,pointStyle:Y}),H&&{areas:H,areaStyle:M}),null!=b&&{graticule:b}),null!=v&&{fitPadding:v}),F&&{zoomable:!0}),k&&{zoomExtent:k}),A&&{onZoom:A}),null!=w&&{dragRotate:w}),j&&{tileURL:j}),O&&{tileAttribution:O}),E&&{tileCacheSize:E}),{size:[l.width,l.height],margin:Q,enableHover:!0,tooltipContent:!1===C?()=>null:wt(C)||te}),J&&{legend:J,legendPosition:ee}),R&&"none"!==R&&{legendHoverBehavior:K.onLegendHover,legendClickBehavior:K.onLegendClick,legendHighlightedCategory:K.highlightedCategory,legendIsolatedCategories:K.isolatedCategories}),(D||I)&&{customHoverBehavior:V}),$&&$.length>0&&{annotations:$}),l.title&&{title:l.title}),L&&{className:L}),_);return ne||oe||e.createElement(kn,{componentName:"ProportionalSymbolMap",width:l.width,height:l.height},e.createElement(bt,Object.assign({ref:a},re)))});function Nn(t){const n=Ut(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{flows:o,nodes:i,nodeIdAccessor:a="id",xAccessor:l="lon",yAccessor:c="lat",valueAccessor:u="value",projection:d="equalEarth",graticule:p,fitPadding:h,zoomable:y,zoomExtent:g,onZoom:f,dragRotate:m,tileURL:b,tileAttribution:v,tileCacheSize:x,lineType:k="geo",flowStyle:w="basic",areas:j,areaStyle:O={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:E,edgeOpacity:S=.6,edgeWidthRange:M=[1,8],edgeLinecap:C="round",colorScheme:$="category10",showParticles:z,particleStyle:L,tooltip:P,annotations:D,margin:I,className:B,selection:N,linkedHover:W,onObservation:R,chartId:T,loading:_,emptyContent:F,frameProps:H={}}=t,q=null!=y?y:!!b,G=Pn(j),V=_t(W),Z=Wt({name:(null==N?void 0:N.name)||"__unused__"}),U=Rt({name:(null==V?void 0:V.name)||"hover",fields:(null==V?void 0:V.fields)||[]}),Y=Nt(e=>e.pushObservation),X=N?{isActive:Z.isActive,predicate:Z.predicate}:null,K=o||[],J=i||[],Q=qt(K,E,$),ee=r(()=>{const e=new Map;for(const t of J)e.set(t[a]+"",t);return e},[J,a]),te=r(()=>{const e=new Map;for(const t of K)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[K]),ne=s(e=>{var t,n;if(W)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=te.get(t[a]+"");e&&U.onHover(e)}else U.onHover(t)}else U.onHover(null);if(R||Y){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:T};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});R&&R(i),Y&&Y(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});R&&R(e),Y&&Y(e)}}},[W,U,a,te,R,T,Y]),oe=r(()=>{const e="function"==typeof l?l:e=>e[l],t="function"==typeof c?c:e=>e[c];return K.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ee.get(n.source+""),r=ee.get(n.target+"");return o&&r?Object.assign(Object.assign({},n),{coordinates:[{[l]:e(o),[c]:t(o)},{[l]:e(r),[c]:t(r)}]}):null}).filter(Boolean)},[K,ee,l,c]),re=r(()=>{const e=K.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[u])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>M[0]:A().domain([Math.min(...e),Math.max(...e)]).range(M)},[K,u,M]),ie=r(()=>e=>{var t;return{stroke:E?Mt(e,E,Q):Ht,strokeWidth:re(null!==(t=e[u])&&void 0!==t?t:0),strokeLinecap:C,opacity:S}},[E,Q,re,u,S,C]),ae=r(()=>X?Ft(ie,X,Object.assign(Object.assign({},N||{}),{unselectedStyle:{opacity:.15,strokeOpacity:.15,fillOpacity:0}})):ie,[ie,X,N]),se=r(()=>()=>({fill:"#333",r:5,fillOpacity:.8}),[]),le=r(()=>t=>{var n,o,r,i,s,l,c;if((null==t?void 0:t.geometry)||(null==t?void 0:t.properties)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.geometry)){const n=(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.name)||(null===(r=null==t?void 0:t.properties)||void 0===r?void 0:r.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||(null===(s=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.properties)||void 0===s?void 0:s.name)||(null===(c=null===(l=null==t?void 0:t.data)||void 0===l?void 0:l.properties)||void 0===c?void 0:c.NAME);if(n)return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},n))}if(null!=(null==t?void 0:t.source)&&null!=(null==t?void 0:t.target)){const n=t[u];return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},t.source," → ",t.target),null!=n&&e.createElement("div",{style:{opacity:.7}},"number"==typeof n?n.toLocaleString():n))}const d=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t[a]);return null!=d?e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},d)):null},[u,a]),ce=r(()=>Object.assign({top:10,right:10,bottom:10,left:10},I),[I]),ue=On(_,n.width,n.height),de=ue?null:jn(o,n.width,n.height,F),pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:d,lines:oe,points:J,xAccessor:l,yAccessor:c,lineDataAccessor:"coordinates",lineType:k,flowStyle:w,lineStyle:ae,pointStyle:se},G&&{areas:G,areaStyle:O}),null!=p&&{graticule:p}),null!=h&&{fitPadding:h}),q&&{zoomable:!0}),g&&{zoomExtent:g}),f&&{onZoom:f}),null!=m&&{dragRotate:m}),z&&{showParticles:z}),L&&{particleStyle:L}),b&&{tileURL:b}),v&&{tileAttribution:v}),x&&{tileCacheSize:x}),{size:[n.width,n.height],margin:ce,enableHover:!0,tooltipContent:!1===P?()=>null:wt(P)||le}),(W||R)&&{customHoverBehavior:ne}),D&&D.length>0&&{annotations:D}),n.title&&{title:n.title}),B&&{className:B}),H);return ue||de||e.createElement(kn,{componentName:"FlowMap",width:n.width,height:n.height},e.createElement(bt,Object.assign({},pe)))}Bn.displayName="ProportionalSymbolMap",Nn.displayName="FlowMap";const Wn=c(function(i,a){const l=Ut(i.mode,{width:i.width,height:i.height,showLegend:i.showLegend,title:i.title}),{points:c,lines:d,xAccessor:p="lon",yAccessor:h="lat",nodeIdAccessor:y="id",center:g,costAccessor:f,strength:m=1,lineMode:b="straight",projection:v="mercator",graticule:x,fitPadding:k,zoomable:A,zoomExtent:w,onZoom:j,dragRotate:O,tileURL:E,tileAttribution:S,tileCacheSize:M,transition:C,colorBy:$,colorScheme:z="category10",pointRadius:L=5,tooltip:P,showRings:D=!0,ringStyle:I,showNorth:B=!0,costLabel:N,annotations:W,margin:R,className:T,selection:_,linkedHover:F,onObservation:H,chartId:q,loading:G,emptyContent:V,legendPosition:Z,frameProps:U={}}=i,Y=null!=A?A:!!E,X=c||[],{activeSelectionHook:K,customHoverBehavior:J}=Gt({selection:_,linkedHover:F,fallbackFields:$?["string"==typeof $?$:""]:[],onObservation:H,chartType:"DistanceCartogram",chartId:q}),Q=qt(X,$,z),ee=r(()=>{const e=e=>({fill:$?Mt(e,$,Q):Ht,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:L});return K?Ft(e,K,_):e},[$,Q,L,K,_]),{legend:te,margin:ne,legendPosition:oe}=Vt({data:X,colorBy:$,colorScale:Q,showLegend:l.showLegend,legendPosition:Z,userMargin:R,defaults:{top:10,bottom:10,left:10,right:10}}),re=r(()=>({center:g,centerAccessor:y,costAccessor:f,strength:m,lineMode:b}),[g,y,f,m,b]),ie=r(()=>{if(!d)return;const e="function"==typeof p?p:e=>e[p],t="function"==typeof h?h:e=>e[h],n=new Map;for(const e of X)n.set(e[y]+"",e);return d.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),i=n.get(o.target+"");return r&&i?Object.assign(Object.assign({},o),{coordinates:[{[p]:e(r),[h]:t(r)},{[p]:e(i),[h]:t(i)}]}):null}).filter(Boolean)},[d,X,p,h,y]),ae=r(()=>t=>{const n=("function"==typeof f?f:e=>e[f])(t);return e.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},e.createElement("div",{style:{fontWeight:600}},t[y]||t.name||t.id||"Point"),null!=n&&e.createElement("div",{style:{opacity:.7}},"Cost: ","number"==typeof n?n.toFixed(1):n))},[f,y]),se=t(null);u(a,()=>({push:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=se.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=se.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=se.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[le,ce]=n(null),ue=s(()=>{var e,t;const n=null===(t=null===(e=se.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ce(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);o(()=>{const e=requestAnimationFrame(ue);return()=>cancelAnimationFrame(e)},[ue,m,g,l.width,l.height,X]);const de=r(()=>{if(!D||!le)return[];const{maxCost:e}=le;if(0>=e)return[];if(Array.isArray(D))return D.filter(t=>t>0&&e>=t);const t="number"==typeof D?D: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},[D,le]),pe=r(()=>{var t,n;if(!le)return U.foregroundGraphics||null;const{cx:o,cy:r,maxCost:i,availableRadius:a}=le,s=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},I),l=null!==(t=ne.left)&&void 0!==t?t:10,c=null!==(n=ne.top)&&void 0!==n?n:10;return e.createElement("g",null,de.map(t=>{const n=t/i*a;return e.createElement("g",{key:t},e.createElement("circle",{cx:o+l,cy:r+c,r:n,fill:"none",stroke:s.stroke,strokeWidth:s.strokeWidth,strokeDasharray:s.strokeDasharray,opacity:.5}),e.createElement("text",{x:o+l+n+3,y:r+c-2,fontSize:s.labelSize,fill:s.labelColor,fontFamily:"system-ui, sans-serif"},t,N?" "+N:""))}),B&&e.createElement("g",{transform:`translate(${l+24}, ${c+24})`},e.createElement("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e.createElement("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e.createElement("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif"},"N"),e.createElement("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.createElement("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.createElement("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})),U.foregroundGraphics)},[le,de,B,N,I,ne,U.foregroundGraphics]),he=On(G,l.width,l.height),ye=he?null:jn(c,l.width,l.height,V);En("DistanceCartogram",X,"xAccessor",p),En("DistanceCartogram",X,"yAccessor",h);const 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({projection:v},null!=c&&{points:X}),ie&&{lines:ie,lineDataAccessor:"coordinates"}),{xAccessor:p,yAccessor:h,pointIdAccessor:y,pointStyle:ee,projectionTransform:re}),C&&{transition:{duration:C}}),null!=x&&{graticule:x}),null!=k&&{fitPadding:k}),Y&&{zoomable:!0}),w&&{zoomExtent:w}),j&&{onZoom:j}),null!=O&&{dragRotate:O}),E&&{tileURL:E}),S&&{tileAttribution:S}),M&&{tileCacheSize:M}),{size:[l.width,l.height],margin:ne,enableHover:!0,tooltipContent:!1===P?()=>null:wt(P)||ae}),te&&{legend:te,legendPosition:oe}),(F||H)&&{customHoverBehavior:J}),W&&W.length>0&&{annotations:W}),l.title&&{title:l.title}),T&&{className:T}),U),pe&&{foregroundGraphics:pe});return he||ye||e.createElement(kn,{componentName:"DistanceCartogram",width:l.width,height:l.height},e.createElement(bt,Object.assign({ref:se},ge)))});function Rn(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})}Wn.displayName="DistanceCartogram";export{In as ChoroplethMap,Wn as DistanceCartogram,Nn as FlowMap,Bn as ProportionalSymbolMap,bt as StreamGeoFrame,Rn as mergeData,Ln as resolveReferenceGeography};
|