semiotic 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +50 -8
- package/README.md +11 -11
- package/ai/dist/mcp-server.js +31925 -528
- package/ai/examples.md +91 -0
- package/ai/schema.json +235 -9
- package/ai/system-prompt.md +12 -4
- package/dist/components/ChartContainer.d.ts +2 -0
- package/dist/components/DataSummaryContext.d.ts +12 -0
- package/dist/components/Tooltip/FlippingTooltip.d.ts +34 -0
- package/dist/components/charts/index.d.ts +4 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +3 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +3 -1
- package/dist/components/charts/ordinal/DonutChart.d.ts +0 -1
- package/dist/components/charts/ordinal/DotPlot.d.ts +3 -1
- package/dist/components/charts/ordinal/FunnelChart.d.ts +3 -1
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -1
- package/dist/components/charts/ordinal/Histogram.d.ts +16 -2
- package/dist/components/charts/ordinal/LikertChart.d.ts +94 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +0 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +11 -7
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +14 -1
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +65 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +16 -2
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +20 -0
- package/dist/components/charts/shared/annotationResolvers.d.ts +28 -0
- package/dist/components/charts/shared/hooks.d.ts +23 -2
- package/dist/components/charts/shared/selectionUtils.d.ts +5 -1
- package/dist/components/charts/shared/statsTooltip.d.ts +11 -0
- package/dist/components/charts/shared/types.d.ts +22 -1
- package/dist/components/charts/shared/useChartSetup.d.ts +12 -2
- package/dist/components/charts/shared/useLikertAggregation.d.ts +51 -0
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +28 -0
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +54 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/validationMap.d.ts +12 -0
- package/dist/components/charts/xy/AreaChart.d.ts +11 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
- package/dist/components/charts/xy/StackedAreaChart.d.ts +11 -0
- package/dist/components/realtime/types.d.ts +4 -0
- package/dist/components/semiotic-ai.d.ts +1 -0
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-themes.d.ts +16 -0
- package/dist/components/semiotic-utils.d.ts +30 -0
- package/dist/components/semiotic.d.ts +4 -4
- package/dist/components/store/LinkedCrosshairStore.d.ts +11 -0
- package/dist/components/store/useSelection.d.ts +1 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +28 -6
- package/dist/components/stream/FocusRing.d.ts +33 -0
- package/dist/components/stream/OrdinalBrushOverlay.d.ts +43 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +16 -0
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +1 -1
- package/dist/components/stream/PipelineStore.d.ts +5 -47
- package/dist/components/stream/SVGOverlay.d.ts +4 -0
- package/dist/components/stream/SceneGraph.d.ts +6 -1
- package/dist/components/stream/XYBrushOverlay.d.ts +47 -0
- package/dist/components/stream/devDataAccessWarning.d.ts +13 -0
- package/dist/components/stream/geoTypes.d.ts +5 -1
- package/dist/components/stream/keyboardNav.d.ts +85 -9
- package/dist/components/stream/layouts/hierarchySceneBuilders.d.ts +35 -0
- package/dist/components/stream/layouts/hierarchyUtils.d.ts +25 -0
- package/dist/components/stream/networkTypes.d.ts +5 -1
- package/dist/components/stream/ordinalSceneBuilders/swimlaneScene.d.ts +12 -0
- package/dist/components/stream/ordinalTypes.d.ts +15 -3
- package/dist/components/stream/pipelineDecay.d.ts +20 -0
- package/dist/components/stream/pipelinePulse.d.ts +24 -0
- package/dist/components/stream/pipelineTransitions.d.ts +59 -0
- package/dist/components/stream/renderers/pointCanvasRenderer.d.ts +2 -1
- package/dist/components/stream/types.d.ts +19 -1
- package/dist/components/stream/useMediaPreferences.d.ts +11 -0
- package/dist/components/stream/xySceneBuilders/areaScene.d.ts +13 -0
- package/dist/components/stream/xySceneBuilders/barScene.d.ts +18 -0
- package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +8 -0
- package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +10 -0
- package/dist/components/stream/xySceneBuilders/emitPointNodes.d.ts +13 -0
- package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +3 -0
- package/dist/components/stream/xySceneBuilders/lineScene.d.ts +12 -0
- package/dist/components/stream/xySceneBuilders/pointScene.d.ts +12 -0
- package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +10 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +93 -0
- package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +12 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +1 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/{semiotic-statisticalOverlays-D8LhSbQt.js → semiotic-statisticalOverlays-DGX_WWc5.js} +1 -1
- package/dist/semiotic-themes.d.ts +16 -0
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils.d.ts +30 -0
- package/dist/semiotic-utils.min.js +1 -0
- package/dist/semiotic-utils.module.min.js +1 -0
- package/dist/semiotic.d.ts +4 -4
- 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.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +19 -11
package/dist/geo.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react"),t=require("d3-geo"),n=require("d3-scale"),o=require("d3-array"),r=require("d3-hierarchy"),i=require("d3-shape"),a=require("regression"),s=require("d3-zoom"),l=require("d3-selection"),c=require("d3-scale-chromatic");function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const p=d(e),h=u(a);class g{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function f(e,t,n){return e+(t-e)*n}const y={mercator:t.geoMercator,equalEarth:t.geoEqualEarth,albersUsa:t.geoAlbersUsa,orthographic:t.geoOrthographic,naturalEarth:t.geoNaturalEarth1,equirectangular:t.geoEquirectangular};function m(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function b(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function v(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):n}const x={fill:"#e0e0e0",stroke:"#999",strokeWidth:.5,fillOpacity:1},k={fill:"#4e79a7",r:4,fillOpacity:.8},A={stroke:"#4e79a7",strokeWidth:1.5,fill:"none"};function w(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let r=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>r.length||o.push(r),r=[i]):r.push(i)}return 2>r.length||o.push(r),o}function j(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const a=-r/i,s=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;d.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return d}function E(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,a;0===t?(i=e[1][0]-r[0],a=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],a=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(i*i+a*a)||1;o.push([r[0]+a/s*n,r[1]+-i/s*n])}return o}function O(e,t,n,o,r){const i=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(i*i+a*a);if(0===s)return[e,t];const l=a/s,c=-i/s,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}class S{constructor(e){this.scene=[],this.scales=null,this.version=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e}initStreaming(e=500){this.pointBuffer=new g(e),this.timestampBuffer=new g(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this.version++}computeScene(e){const{config:n}=this;this.projection=function(e){if(!e)return t.geoEqualEarth();if("string"==typeof e){const n=y[e];return n?n():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),t.geoEqualEarth())}if("object"==typeof e&&"type"in e){const n=y[e.type],o=n?n():t.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(n.projection),this.geoPath=t.geoPath(this.projection),this.fitProjection(e),this.geoPath=t.geoPath(this.projection);const o=this.projection;this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null};const r=this.scene;this.scene=this.buildSceneNodes(e),n.projectionTransform&&this.applyCartogramTransform(n.projectionTransform,e),n.decay&&this.streaming&&this.applyDecay(),n.pulse&&this.streaming&&this.applyPulse(),n.transition&&r.length>0&&this.startTransition(r),this.version++}fitProjection(e){var t,n,o,r,i;const a=this.projection,s=this.config,l=[...this.areas],c=m(s.xAccessor,"lon"),u=m(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const p=b(s.lineDataAccessor);for(const e of this.lineData){const t=p(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==l.length){if(s.projectionExtent){const[[t,n],[o,r]]=s.projectionExtent;a.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,r],[t,r],[t,n]]]}})}else if(a.clipAngle&&(null!==(t=a.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=s.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);a.scale(o/2-o*t),a.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,r=e.height*t;a.fitExtent([[n,r],[e.width-n,e.height-r]],{type:"FeatureCollection",features:l})}this.baseScale=a.scale(),this.baseTranslate=a.translate(),this.baseRotation=null!==(i=null===(r=a.rotate)||void 0===r?void 0:r.call(a))&&void 0!==i?i:[0,0,0]}}applyZoomTransform(e,n){const o=this.projection;o&&(o.scale(this.baseScale*e.k),o.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=t.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}applyZoomScale(e,n){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=t.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}applyRotation(e,n){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=t.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}buildSceneNodes(e){var n,o,r;const i=[],{config:a}=this,s=this.projection,l=this.geoPath,c=m(a.xAccessor,"lon"),u=m(a.yAccessor,"lat");if(a.graticule){const n=!0===a.graticule?{}:a.graticule,o=t.geoGraticule();n.step&&o.step(n.step);const r=l(o())||"";r&&i.push({type:"geoarea",pathData:r,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:n.stroke||"#e0e0e0",strokeWidth:n.strokeWidth||.5,strokeDasharray:n.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=l(e);if(!t)continue;const n=l.centroid(e),o=l.bounds(e),r=l.area(e),s=v(a.areaStyle,e,x);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:r,style:s,datum:e,interactive:!0})}const d=b(a.lineDataAccessor);for(const n of this.lineData){const o=d(n);if(!o||2>o.length)continue;const r=o.map(e=>[c(e),u(e)]);let l;if("geo"===a.lineType){const e=[];for(let n=0;r.length-1>n;n++){const o=r[n],i=r[n+1],a=t.geoDistance(o,i)||0,s=Math.max(2,Math.ceil(a/(Math.PI/180))),l=t.geoInterpolate(o,i);for(let t=0;s>=t;t++)n>0&&0===t||e.push(l(t/s))}l=e.map(([e,t])=>s([e,t])).filter(e=>null!=e)}else l=r.map(([e,t])=>s([e,t])).filter(e=>null!=e);if(2>l.length)continue;const p=v(a.lineStyle,n,A),h="number"==typeof p.strokeWidth?p.strokeWidth:1;2!==r.length||2>l.length||"arc"!==a.flowStyle?2!==r.length||2>l.length||"offset"!==a.flowStyle||(l="geo"===a.lineType?E(l,h):O(l[0],l[l.length-1],0,0,h)):l=j(l[0],l[l.length-1]);const g=w(l,e.width);if(g.length>1)for(const e of g){if(2>e.length)continue;const t={type:"line",path:e,style:Object.assign(Object.assign({},p),{_edgeFade:!0}),datum:n};i.push(t)}else i.push({type:"line",path:2>l.length&&g[0]||l,style:p,datum:n})}const p=this.getPoints(),h=a.pointIdAccessor?"function"==typeof a.pointIdAccessor?a.pointIdAccessor:e=>e[a.pointIdAccessor]:null,g=s.clipAngle&&null!==(n=s.clipAngle())&&void 0!==n?n:0,f=g>0?g*Math.PI/180:null,y=s.rotate?s.rotate():[0,0,0],S="function"==typeof s.center?s.center():[0,0],M=[(null!==(o=S[0])&&void 0!==o?o:0)-y[0],(null!==(r=S[1])&&void 0!==r?r:0)-y[1]];for(let e=0;p.length>e;e++){const n=p[e],o=c(n),r=u(n);if(null!=f&&t.geoDistance([o,r],M)>f)continue;const l=s([o,r]);if(!l)continue;const d=a.pointStyle?a.pointStyle(n):Object.assign({},k),g={type:"point",x:l[0],y:l[1],r:d.r||4,style:d,datum:n,pointId:h?h(n)+"":void 0};i.push(g)}return i}applyCartogramTransform(e,t){var o,r,i;const a=this.scene.filter(e=>"point"===e.type);if(2>a.length)return;const s=null!==(o=e.strength)&&void 0!==o?o:1;if(0===s)return;const l=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,c="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],u=a.find(t=>l(t.datum)+""==e.center+"");if(!u)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const d=u.x,p=u.y,h=a.map(e=>c(e.datum)).filter(e=>isFinite(e)&&e>=0),g=Math.max(...h,1),f=Math.min(t.width,t.height)/2,y=n.scaleLinear().domain([0,g]).range([0,f]);this.cartogramLayout={cx:d,cy:p,maxCost:g,availableRadius:f},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of a){if(e===u)continue;const t=Math.atan2(e.y-p,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-p,2)),o=c(e.datum),r=n+((isFinite(o)?y(o):n)-n)*s;e.x=d+Math.cos(t)*r,e.y=p+Math.sin(t)*r}const m=t.width/2,b=t.height/2,v=m-u.x,x=b-u.y;if(Math.abs(v)>.5||Math.abs(x)>.5)for(const e of a)e.x+=v,e.y+=x;this.cartogramLayout={cx:m,cy:b,maxCost:g,availableRadius:f};const k=this.scene.filter(e=>"line"===e.type);if(k.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of a)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of k){const n=null===(r=t.datum)||void 0===r?void 0:r.source,o=null===(i=t.datum)||void 0===i?void 0:i.target;if(n&&o){const r=e.get(n+""),i=e.get(o+"");r&&i&&(t.path=[r,i])}}}}applyDecay(){var e,t,n;const o=this.config.decay;if(!o||!this.pointBuffer)return;const r=this.pointBuffer.size;if(0===r)return;const i=null!==(e=o.minOpacity)&&void 0!==e?e:.1,a=null!==(t=o.halfLife)&&void 0!==t?t:r/2,s=null!==(n=o.stepThreshold)&&void 0!==n?n:.5*r,l=this.scene.filter(e=>"point"===e.type);for(let e=0;l.length>e;e++){const t=r-1-e;let n;switch(o.type){case"exponential":n=i+Math.pow(.5,t/a)*(1-i);break;case"step":n=s>t?1:i;break;default:n=i+(r>1?1-t/(r-1):1)*(1-i)}l[e]._decayOpacity=n,l[e].style=Object.assign(Object.assign({},l[e].style),{opacity:n})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),a=this.timestampBuffer.toArray();for(let e=0;i.length>e&&a.length>e;e++){const s=r-a[e];o>s&&(i[e]._pulseIntensity=1-s/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of i)if(e.pointId){const t=r.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(a=!0))}a&&(this.activeTransition={startTime:performance.now(),duration:o})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=f(e.x,e._targetX,n),e.y=f(t,e._targetY,n)}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0);return this.activeTransition=null,!1}return!0}}function M(e,t,n,o,r,i){const a=e.filter(e=>"point"===e.type);let s=null,l=o;for(const e of a){const o=e.x-t,r=e.y-n,i=Math.sqrt(o*o+r*r);(e.r||4)+4>=i&&l>i&&(s=e,l=i)}if(s)return{node:s,distance:l};const c=e.filter(e=>"geoarea"===e.type&&!1!==e.interactive);for(let e=c.length-1;e>=0;e--){const o=c[e],[[i,a],[s,l]]=o.bounds;if(!(i>t||t>s||a>n||n>l)&&(o._cachedPath2D||(o._cachedPath2D=new Path2D(o.pathData)),r.isPointInPath(o._cachedPath2D,t,n)))return{node:o,distance:0}}const u=e.filter(e=>"line"===e.type);let d=null,p=o;for(const e of u){const{path:o}=e;for(let r=0;o.length-1>r;r++){const[i,a]=o[r],[s,l]=o[r+1],c=C(t,n,i,a,s,l);Math.max((e.style.strokeWidth||2)+4,5)>=c&&p>c&&(d=e,p=c)}}return d?{node:d,distance:p}:null}function C(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}const $={fill:e=>p.createElement("rect",{style:e,width:16,height:16}),line:e=>p.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function z(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,$[n])(o(e,t)),r}function L(){return p.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function P(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function R({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+p.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(p.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return p.createElement("g",{"aria-label":i||"Gradient legend"},p.createElement("defs",null,p.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},c)),i&&p.createElement("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),p.createElement("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),p.createElement("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])),p.createElement("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])))}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(p.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return p.createElement("g",{"aria-label":i||"Gradient legend"},i&&p.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),p.createElement("defs",null,p.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},c)),p.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),p.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])),p.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])))}function D(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical"}=e,[d,h]=p.useState(0),[g,f]=p.useState(0),y=p.useCallback((e,t)=>{h(e),f(t)},[]),m="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c})=>{let u=24;const d=[];return e.forEach((e,h)=>{u+=5,d.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+h,stroke:"gray",x1:0,y1:u,x2:t,y2:u})),u+=8,e.label&&(u+=16,d.push(p.createElement("text",{key:"legend-text-"+h,y:u,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label)),u+=8),d.push(p.createElement("g",{key:"legend-group-"+h,className:"legend-item",transform:`translate(0,${u})`},((e,t,n,o,r,i,a,s,l,c)=>{const{type:u="fill",styleFn:d,items:h}=e,g=[];let f=0;const y=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return h.forEach((e,c)=>{const b=z(e,c,u,d),v=P(e,o,r),x=r&&r.size>0&&r.has(e.label);g.push(p.createElement("g",{key:"legend-item-"+c,transform:`translate(0,${f})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?s===i&&c===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+h.length)%h.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},y&&p.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&p.createElement(L,null),p.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),f+=22}),g})(e,n,o,r,i,a,s,h,l,c))),u+=22*e.items.length+8}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:a}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=0;const h=[];e.forEach((e,t)=>{let n=0;e.label&&(n+=16);const g=((e,t,n,o,r,i,a,s,l,c)=>{const{type:u="fill",styleFn:d,items:h}=e,g=[];let f=0;const y=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return h.forEach((e,c)=>{const b=z(e,c,u,d),v=P(e,o,r),x=r&&r.size>0&&r.has(e.label);g.push(p.createElement("g",{key:"legend-item-"+c,transform:`translate(${f},0)`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?s===i&&c===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(c+("ArrowRight"===n.key?1:-1)+h.length)%h.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},y&&p.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&p.createElement(L,null),p.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),f+=26+7*e.label.length}),{items:g,offset:f}})(e,o,r,i,a,s,l,t,c,u);n+=g.offset+5,h.push(Object.assign(Object.assign({label:e.label},g),{offset:n})),d+=n+12});let g=Math.max(0,(n-d)/2);const f=[];return h.forEach((n,o)=>{const r=e[o];r.label&&(f.push(p.createElement("text",{key:"legend-text-"+o,transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),g+=16),f.push(p.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${g},0)`},n.items)),g+=n.offset+5,e[o+1]&&f.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:g,y1:-8,x2:g,y2:t+0+8})),g+=12}),p.createElement("g",null,f)})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:a}),b=!(!n&&!o);return p.createElement("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==s&&""!==s&&"vertical"===u&&p.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},s),m)}function I(e){return"string"==typeof e?{type:e}:e}function B({orient:t,config:n,values:r,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(n),c="top"===t||"bottom"===t,u=e.useMemo(()=>{if(0===r.length)return null;const e=i.domain(),n=a-8;if("boxplot"===l.type){const e=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!e)return null;const{q1:o,median:a,q3:s,whiskerLow:u,whiskerHigh:d}=e,h=Math.min(.5*n,20),g=(n-h)/2+4;if(c){const e=i(o),n=i(s),r=i(a),c=i(u),f=i(d),y="top"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:c,y1:m+y*(g+h/2),x2:f,y2:m+y*(g+h/2),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:c,y1:m+y*g,x2:c,y2:m+y*(g+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:f,y1:m+y*g,x2:f,y2:m+y*(g+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:Math.min(e,n),y:"top"===t?m-g-h:m+g,width:Math.abs(n-e),height:h,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:r,y1:"top"===t?m-g-h:m+g,x2:r,y2:"top"===t?m-g:m+g+h,stroke:l.fill,strokeWidth:2}))}{const e=i(o),n=i(s),r=i(a),c=i(u),f=i(d),y="left"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:m+y*(g+h/2),y1:c,x2:m+y*(g+h/2),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+y*g,y1:c,x2:m+y*(g+h),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+y*g,y1:f,x2:m+y*(g+h),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:"left"===t?m-g-h:m+g,y:Math.min(e,n),width:h,height:Math.abs(n-e),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:"left"===t?m-g-h:m+g,y1:r,x2:"left"===t?m-g:m+g+h,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=o.bin().domain(e).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return p.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((e,o)=>{if(null==e.x0||null==e.x1)return null;const r=e.length/d*n;if(c){const n=i(e.x0),a=i(e.x1)-i(e.x0);return p.createElement("rect",{key:o,x:n,y:"top"===t?-4-r:4,width:Math.max(a,.5),height:r,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const n=i(e.x0),a=i(e.x1)-i(e.x0);return p.createElement("rect",{key:o,x:"left"===t?-4-r:4,y:Math.min(n,n+a),width:r,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const e=n/2+4,o=[];for(const r of u){if(null==r.x0||null==r.x1)continue;const a=r.length/d*(n/2),s=i((r.x0+r.x1)/2);o.push(c?`${s},${"top"===t?-(e-a):e-a}`:`${"left"===t?-(e-a):e-a},${s}`)}for(let r=u.length-1;r>=0;r--){const a=u[r];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(n/2),l=i((a.x0+a.x1)/2);o.push(c?`${l},${"top"===t?-(e+s):e+s}`:`${"left"===t?-(e+s):e+s},${l}`)}return p.createElement("g",{"data-testid":"marginal-violin-"+t},p.createElement("polygon",{points:o.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const e=[];if(c){const o=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${r},${o}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,a=i((o.x0+o.x1)/2);e.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;e.push(`L${a},${o}`),e.push("Z")}else{const o=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${o},${r}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,a=i((o.x0+o.x1)/2);e.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;e.push(`L${o},${a}`),e.push("Z")}return p.createElement("g",{"data-testid":"marginal-ridgeline-"+t},p.createElement("path",{d:e.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,a,s,t,c,4]);return u?p.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function N(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function W(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function T(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:g,events:f={},"data-testid":y}=e,m=new Set(Array.isArray(g)?g:[]);let b=o||0,v=r||0;null!=i&&(b=i-t),null!=a&&(v=a-n);const x="string"==typeof u?u:"label";if("bracket"===x&&c&&0===b&&0===v)if(void 0!==c.width){b=c.width/2;const e=c.depth||30;v=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;b=e+(0>e?-5:5),v=c.height/2}return p.createElement("g",Object.assign({className:("annotation "+(h||"")).trim(),transform:`translate(${t},${n})`,"data-testid":y},f),!m.has("connector")&&function(e,t,n,o,r,i){const a=[];let s=0,l=0;if("callout-circle"!==r&&"label"!==r||!(null==i?void 0:i.radius)){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=o/2,p=e*d>t*u?u/e:d/t;s=r+a*p,l=i+c*p}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);s=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-s,2)+Math.pow(t-l,2))>.5&&(a.push(p.createElement("line",{key:"connector-line",x1:s,y1:l,x2:e,y2:t,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,i=Math.atan2(t-l,e-s);a.push(p.createElement("path",{key:"connector-arrow",d:`M${s},${l}L${s+n*Math.cos(i+r)},${l+n*Math.sin(i+r)}L${s+n*Math.cos(i-r)},${l+n*Math.sin(i-r)}Z`,fill:o||"currentColor",stroke:"none"}))}return p.createElement("g",{className:"annotation-connector"},a)}(b,v,l,d,x,c),!m.has("subject")&&function(e,t,n,o,r){var i;const a=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&a.push(p.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&a.push(p.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&a.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,i=r||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;a.push(p.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;a.push(p.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?a.push(p.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||a.push(p.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&a.push(p.createElement("path",{key:"bracket-path",d:W((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"currentColor"}));break}}return p.createElement("g",{className:"annotation-subject"},a)}(x,c,d,t,n),!m.has("note")&&function(e,t,n,o){if(!e)return p.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return p.createElement("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const g=16,f=i?c?[i]:N(i,l):[],y=r?c?[r]:N(r,l):[],m="leftRight"===u?"end"===h?-4:4:0;let b=0;const v=[];f.length>0&&(v.push(p.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:h,fontWeight:"bold"},f.map((e,t)=>p.createElement("tspan",{key:t,x:m,dy:0===t?0:g},e)))),b=f.length*g),y.length>0&&v.push(p.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:h,y:b},y.map((e,t)=>p.createElement("tspan",{key:t,x:m,dy:0===t?0:g},e))));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=p.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(f.length+y.length)*g+(y.length>0?g:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=p.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const k=Math.max(0,f.length+y.length-1)*g;let A=0;return"topBottom"===u?A=0>n?-(k+2):18:"leftRight"===u&&(A="middle"===d?-(k+g+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===d||0>n?-(k+2):18),p.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},p.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},v),x)}(s,b,v,d))}function _(e){var t,n;const{noteData:o}=e,{screenCoordinates:r}=o,i="string"==typeof o.type?o.type:"label",a=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),a=o.ny||r[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),s=r.map((t,n)=>{const r=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:a});return p.createElement(T,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return p.createElement("g",null,s)}const s=o.note||{title:"none",label:o.label};return p.createElement(T,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${o.i}`,events:a},o,{type:i}))}const F={linear:i.curveLinear,monotoneX:i.curveMonotoneX,monotoneY:i.curveMonotoneY,step:i.curveStep,stepAfter:i.curveStepAfter,stepBefore:i.curveStepBefore,basis:i.curveBasis,cardinal:i.curveCardinal,catmullRom:i.curveCatmullRom};function H(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function q(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function G(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],p=l[e.yAccessor||"y"];return null==d||null==p?null:{x:c(d),y:u(p)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=H(e,n),c=q(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function V(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Z(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function U(e,t,n){return Math.round(100*e)/100+""}function Y(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 X(e,t){return e instanceof Date&&(!(t&&t instanceof Date)||e.getFullYear()!==t.getFullYear()||e.getMonth()!==t.getMonth()||e.getDate()!==t.getDate())}function K(t){var n,o;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:g,axes:f,xLabel:y,yLabel:m,yLabelRight:b,xFormat:v,yFormat:x,showGrid:k,title:A,legend:w,legendHoverBehavior:j,legendClickBehavior:E,legendHighlightedCategory:O,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:C,marginalGraphics:$,xValues:z,yValues:L,annotations:P,svgAnnotationRules:N,xAccessor:W,yAccessor:T,annotationData:K,pointNodes:J,curve:Q,underlayRendered:ee,children:te}=t,ne=e.useMemo(()=>{var e;if(!g||!d)return[];const t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||v||U,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 Y(s,Math.max(55,l+8))},[g,d,f,v,a]),oe=e.useMemo(()=>{var e;if(!g||!d)return[];const t=null==f?void 0:f.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||U,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return Y(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)},[g,d,f,x,s]),re=e.useMemo(()=>{var e;if(!g||!d)return[];const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||U,o=null!==(e=t.ticks)&&void 0!==e?e:5;return Y(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)},[g,d,f,x,s]),ie=e.useRef(new Map),ae=e.useRef(null!==(n=null==P?void 0:P.length)&&void 0!==n?n:0),se=null!==(o=null==P?void 0:P.length)&&void 0!==o?o:0;ae.current!==se&&(ae.current=se,ie.current=new Map);const le=e.useMemo(()=>{if(!P||0===P.length)return null;const e=function(e,t,n){var o,a,s,l,c,u,d,g,f,y,m,b,v,x,k,A,w,j,E,O,S,M,C,$,z,L,P,R,D,I,B,N,W,T,Z,U,Y,X,K,J,Q,ee,te,ne;switch(e.type){case"label":{const o=G(e,t,n);if(!o)return null;const{x:r,y:i}=o;return V(r,i,n)?p.createElement(_,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{const o=G(e,t,n);if(!o)return null;const{x:r,y:i}=o;return V(r,i,n)?p.createElement(_,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=H(e,n);if(null==o)return null;const r=e.color||"#f97316";return p.createElement("g",{key:"ann-"+t},p.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:o+4,y:12,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=q(e,n);if(null==o)return null;const r=e.color||"#f97316";return p.createElement("g",{key:"ann-"+t},p.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:o-4,textAnchor:"end",fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:H(Object.assign(Object.assign({},e),{type:"point"}),n),y:q(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const i=r.packEnclose(o),a=e.padding||10;return p.createElement("g",{key:"ann-"+t},p.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&p.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:H(Object.assign(Object.assign({},e),{type:"point"}),n),y:q(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=e.padding||10,i=o.map(e=>e.x),a=o.map(e=>e.y),s=Math.min(...i)-r,l=Math.max(...i)+r,c=Math.min(...a)-r,u=Math.max(...a)+r;return p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:s,y:c,width:l-s,height:u-c,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&p.createElement("text",{x:(s+l)/2,y:c-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return p.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=H(t,n),a=q(t,n);if(null==r||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return p.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:a,r:s},l))}))}case"bracket":{const o=H(e,n),r=q(e,n);return p.createElement(_,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=r?r:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const r=n.data||[];if(2>r.length)return null;const i=n.xAccessor||"x",g=n.yAccessor||"y",f=r.map(e=>[e[i],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(a=null===(o=n.scales)||void 0===o?void 0:o.x)&&void 0!==a?a:null===(s=n.scales)||void 0===s?void 0:s.time,m=null!==(c=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=n.scales)||void 0===u?void 0:u.value;if(!y||!m)return null;const b=e.method||"linear";let v;v="loess"===b?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,p=0,h=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],p+=t*i[e],h+=t*r[e]*r[e],g+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const f=u*h-d*d;if(1e-12>Math.abs(f))s.push([t,p/u]);else{const e=(u*g-d*p)/f;s.push([t,(p-e*d)/u+e*t])}}return s}(f,null!==(d=e.bandwidth)&&void 0!==d?d:.3):("polynomial"===b?h.default.polynomial(f,{order:e.order||2}):h.default.linear(f)).points;const x=v.map(([e,t])=>`${y(e)},${m(t)}`).join(" "),k=e.color||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("polyline",{points:x,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:y(v[v.length-1][0])+4,y:m(v[v.length-1][1])-4,fill:k,fontSize:11},e.label))}case"band":{const o=null!==(f=null===(g=n.scales)||void 0===g?void 0:g.y)&&void 0!==f?f:null===(y=n.scales)||void 0===y?void 0:y.value,r=null!==(m=null==o?void 0:o(e.y0))&&void 0!==m?m:0,i=null!==(b=null==o?void 0:o(e.y1))&&void 0!==b?b:n.height||0;return p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:Math.min(r,i)-4,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",a=null!==(x=null===(v=n.scales)||void 0===v?void 0:v.x)&&void 0!==x?x:null===(k=n.scales)||void 0===k?void 0:k.time,s=null!==(w=null===(A=n.scales)||void 0===A?void 0:A.y)&&void 0!==w?w:null===(j=n.scales)||void 0===j?void 0:j.value;if(!a||!s)return null;const l=e.upperAccessor||"upperBounds",c=e.lowerAccessor||"lowerBounds",u=e.filter,d=o.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[r]-t[r]);if(2>d.length)return null;const h=F[n.curve||"linear"]||i.curveLinear,g=i.area().x(e=>a(e[r])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!g)return null;const f=e.fill||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("path",{d:g,fill:f,fillOpacity:null!==(E=e.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.label&&d.length>0&&p.createElement("text",{x:a(d[d.length-1][r])+4,y:s(d[d.length-1][l])-4,fill:f,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(S=null===(O=n.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(M=n.scales)||void 0===M?void 0:M.time,a=null!==($=null===(C=n.scales)||void 0===C?void 0:C.y)&&void 0!==$?$:null===(z=n.scales)||void 0===z?void 0:z.value;if(!i||!a)return null;const s=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+Math.pow(t-l,2),0)/s.length,u=Math.sqrt(c),d=null!==(L=e.threshold)&&void 0!==L?L:2,h=l-d*u,g=!1!==e.showBand,f=e.fill||"#6366f1",y=null!==(P=e.fillOpacity)&&void 0!==P?P:.1,m=e.anomalyColor||"#ef4444",b=null!==(R=e.anomalyRadius)&&void 0!==R?R:6,v=a(l+d*u),x=a(h),k=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return p.createElement("g",{key:"ann-"+t},g&&p.createElement("rect",{x:0,y:Math.min(v,x),width:n.width||0,height:Math.abs(x-v),fill:f,fillOpacity:y}),k.map((e,t)=>{const o=H(e,n),r=q(e,n);return null==o||null==r?null:p.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:Math.min(v,x)-4,textAnchor:"end",fill:f,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",a=null!==(I=null===(D=n.scales)||void 0===D?void 0:D.x)&&void 0!==I?I:null===(B=n.scales)||void 0===B?void 0:B.time,s=null!==(W=null===(N=n.scales)||void 0===N?void 0:N.y)&&void 0!==W?W:null===(T=n.scales)||void 0===T?void 0:T.value;if(!a||!s)return null;const l=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=h.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;c=e=>s+a*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(d/Math.max(u-2,1)),f=l.reduce((e,t)=>e+t[0],0)/u,y=l.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(Z=e.confidence)&&void 0!==Z?Z:.95,b=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,v=null!==(U=e.steps)&&void 0!==U?U:5,x=l[u-1][0],k=(x-l[0][0])/Math.max(u-1,1),A=[];for(let e=1;v>=e;e++)A.push(x+e*k);const w=[];for(const e of A){const t=c(e),n=g*Math.sqrt(1+1/u+(y>0?Math.pow(e-f,2)/y:0))*b;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${w.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,E=w.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),O=`${a(x)},${s(c(x))}`,S=e.strokeColor||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:null!==(Y=e.fillOpacity)&&void 0!==Y?Y:.15,stroke:"none"}),p.createElement("polyline",{points:`${O} ${E}`,fill:"none",stroke:S,strokeWidth:null!==(X=e.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(K=e.strokeDasharray)&&void 0!==K?K:"6,3"}),e.label&&w.length>0&&p.createElement("text",{x:a(w[w.length-1].x)+4,y:s(w[w.length-1].yCenter)-4,fill:S,fontSize:11},e.label))}case"widget":{let o=null,r=null;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=G(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!V(o,r,n))return null;const i=null!==(J=e.dx)&&void 0!==J?J:0,a=null!==(Q=e.dy)&&void 0!==Q?Q:0,s=null!==(ee=e.width)&&void 0!==ee?ee:32,l=null!==(te=e.height)&&void 0!==te?te:32,c=null!==(ne=e.content)&&void 0!==ne?ne:p.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return p.createElement("foreignObject",{key:"ann-"+t,x:o+i-s/2,y:r+a-l/2,width:s,height:l,style:{overflow:"visible",pointerEvents:"auto"}},p.createElement("div",{style:{width:s,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},c))}case"text":{const o=G(e,t,n);if(!o)return null;const{x:r,y:i}=o;return p.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}default:return null}},t={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:W,yAccessor:T,width:a,height:s,data:K,frameType:"xy",pointNodes:J,curve:Q,stickyPositionCache:ie.current};return P.map((n,o)=>{if(N){const r=N(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[P,N,a,s,W,T,K,d,J,Q]);return g||A||w||C||$||le&&le.length>0||k||te?p.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},p.createElement("title",null,"string"==typeof A?A:"XY Chart"),p.createElement("desc",null,"string"==typeof A?A+" — XY data visualization":"XY data visualization"),p.createElement("g",{transform:`translate(${u.left},${u.top})`},k&&d&&!ee&&p.createElement("g",{className:"stream-grid"},ne.map((e,t)=>p.createElement("line",{key:"xgrid-"+t,x1:e.pixel,y1:0,x2:e.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),oe.map((e,t)=>p.createElement("line",{key:"ygrid-"+t,x1:0,y1:e.pixel,x2:a,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),g&&d&&(()=>{const e=null==f?void 0:f.find(e=>"left"===e.orient),t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=!e||!1!==e.baseline,o=(null==e?void 0:e.jaggedBase)||!1,r=(null==t?void 0:t.jaggedBase)||!1,i=null==t?void 0:t.landmarkTicks,l=null==e?void 0:e.landmarkTicks,c="var(--semiotic-border, #ccc)",d="var(--semiotic-text-secondary, var(--semiotic-text, #666))",h="var(--semiotic-text, #333)";return p.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!ee&&(!t||!1!==t.baseline)&&!r&&p.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:c,strokeWidth:1}),!ee&&r&&p.createElement("path",{d:Z("bottom",a,s),fill:"none",stroke:c,strokeWidth:1}),ne.map((e,t)=>{const n=!!i&&("function"==typeof i?i(e.value,t):X(e.value,t>0?ne[t-1].value:void 0));return p.createElement("g",{key:"xtick-"+t,transform:`translate(${e.pixel},${s})`},p.createElement("line",{y2:5,stroke:c,strokeWidth:1}),p.createElement("text",{y:18,textAnchor:"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:d,style:{userSelect:"none"}},e.label))}),y&&p.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:h,style:{userSelect:"none"}},y),!ee&&n&&!o&&p.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:c,strokeWidth:1}),!ee&&o&&p.createElement("path",{d:Z("left",a,s),fill:"none",stroke:c,strokeWidth:1}),oe.map((e,t)=>{const n=!!l&&("function"==typeof l?l(e.value,t):X(e.value,t>0?oe[t-1].value:void 0));return p.createElement("g",{key:"ytick-"+t,transform:`translate(0,${e.pixel})`},p.createElement("line",{x2:-5,stroke:c,strokeWidth:1}),p.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:d,style:{userSelect:"none"}},e.label))}),(()=>{const t=(null==e?void 0:e.label)||m;return t?p.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:h,transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},t):null})(),(()=>{const e=null==f?void 0:f.find(e=>"right"===e.orient);if(!e||0===re.length)return null;const t=e.landmarkTicks,n=e.label||b;return p.createElement(p.Fragment,null,!1!==e.baseline&&p.createElement("line",{x1:a,y1:0,x2:a,y2:s,stroke:c,strokeWidth:1}),re.map((e,n)=>{const o=!!t&&("function"==typeof t?t(e.value,n):X(e.value,n>0?re[n-1].value:void 0));return p.createElement("g",{key:"ytick-r-"+n,transform:`translate(${a},${e.pixel})`},p.createElement("line",{x2:5,stroke:c,strokeWidth:1}),p.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:d,style:{userSelect:"none"}},e.label))}),n&&p.createElement("text",{x:a+u.right-15,y:s/2,textAnchor:"middle",fontSize:12,fill:h,transform:`rotate(90, ${a+u.right-15}, ${s/2})`,style:{userSelect:"none"}},n))})())})(),le,$&&d&&z&&L&&p.createElement(p.Fragment,null,$.top&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(B,{orient:"top",config:I($.top),values:z,scale:d.x,size:u.top,length:a})),$.bottom&&p.createElement("g",{transform:`translate(0, ${s})`},p.createElement(B,{orient:"bottom",config:I($.bottom),values:z,scale:d.x,size:u.bottom,length:a})),$.left&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(B,{orient:"left",config:I($.left),values:L,scale:d.y,size:u.left,length:s})),$.right&&p.createElement("g",{transform:`translate(${a}, 0)`},p.createElement(B,{orient:"right",config:I($.right),values:L,scale:d.y,size:u.right,length:s}))),C,te),A&&p.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof A?A:null),function(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",title:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const h="top"===i||"bottom"===i;let g,f;return"left"===i?(g=4,f=r.top):"top"===i?(g=0,f=a?32:8):"bottom"===i?(g=0,f=o-r.bottom+50):(g=n-r.right+10,f=r.top),p.createElement("g",{transform:`translate(${g}, ${f})`},"object"==typeof(y=t)&&null!==y&&"gradient"in y?p.createElement(R,{config:t.gradient,orientation:h?"horizontal":"vertical",width:h?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?p.createElement(D,{legendGroups:t.legendGroups,title:"",width:h?n:100,orientation:h?"horizontal":"vertical",customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t);var y}({legend:w,totalWidth:l,totalHeight:c,margin:u,legendPosition:M,title:A,legendHoverBehavior:j,legendClickBehavior:E,legendHighlightedCategory:O,legendIsolatedCategories:S})):null}function J(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Q="undefined"==typeof window||"undefined"==typeof document,ee={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function te(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 ne({scene:e,chartType:t}){var n,o,r,i;const a=[];for(const t of e){if(a.length>=50)break;"point"===t.type?a.push({label:"Point",values:{x:Math.round(100*t.x)/100+"",y:Math.round(100*t.y)/100+""}}):"rect"===t.type?a.push({label:"Bar",values:{category:(null===(n=t.datum)||void 0===n?void 0:n.category)||"",value:Math.round(100*(null!==(r=null===(o=t.datum)||void 0===o?void 0:o.value)&&void 0!==r?r:0))/100+""}}):"heatcell"===t.type&&a.push({label:"Cell",values:{x:Math.round(100*t.x)/100+"",y:Math.round(100*t.y)/100+"",value:Math.round(100*(null!==(i=t.value)&&void 0!==i?i:0))/100+""}})}if(0===a.length)return null;const s=new Set;for(const e of a)for(const t of Object.keys(e.values))s.add(t);const l=Array.from(s);return p.createElement("table",{style:ee,role:"table","aria-label":"Data table for "+t},p.createElement("thead",null,p.createElement("tr",null,l.map(e=>p.createElement("th",{key:e},e)))),p.createElement("tbody",null,a.map((e,t)=>p.createElement("tr",{key:t},l.map(t=>{var n;return p.createElement("td",{key:t},null!==(n=e.values[t])&&void 0!==n?n:"")}))),e.length>50&&p.createElement("tr",null,p.createElement("td",{colSpan:l.length},"...and ",e.length-50," more items"))))}function oe({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Focused on data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+n}return p.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:ee},t)}function re(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function ie(e,t,n=.6){var o,r,i,a,s;if(!re(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 ae(e,t,n,o=.35){re(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function se(e){switch(e){case"monotoneX":return i.curveMonotoneX;case"monotoneY":return i.curveMonotoneY;case"cardinal":return i.curveCardinal;case"catmullRom":return i.curveCatmullRom;case"step":return i.curveStep;case"stepBefore":return i.curveStepBefore;case"stepAfter":return i.curveStepAfter;case"basis":return i.curveBasis;case"natural":return i.curveNatural;default:return null}}function le(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 ce(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 de(e){return[e.x,e.y]}function pe(e){return function(){return e}}function he([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function ge(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 fe(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function ye(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 me{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 be{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=ve(a),l=xe(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 ve(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 xe(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 ke(t){const n=e.createContext(null),o=Ae(t);return[function({children:o}){const r=e.useMemo(()=>Ae(t),[]);return p.createElement(n.Provider,{value:r,children:o})},t=>{var r;const i=null!==(r=e.useContext(n))&&void 0!==r?r:o,a=e.useRef(t);a.current=t;const s=e.useCallback(()=>a.current(i.getState()),[i]),l=e.useCallback(()=>a.current(i.getState()),[i]);return e.useSyncExternalStore(i.subscribe,s,l)}]}function Ae(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 we={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}},je={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}},Ee={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"},[Oe,Se]=ke(e=>({theme:we,setTheme(t){e(e=>{if("light"===t)return{theme:we};if("dark"===t)return{theme:je};if("high-contrast"===t)return{theme:Ee};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?je:we;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||{})})}})}})),Me={top:10,right:10,bottom:10,left:10},Ce={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"},$e={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 ze({data:e}){if(!e)return null;if(e.properties)return p.createElement("div",{className:"semiotic-tooltip",style:Ce},p.createElement("div",{style:{fontWeight:600}},e.properties.name||e.properties.NAME||e.properties.id||"Feature"));const t=Object.entries(e).slice(0,3);return p.createElement("div",{className:"semiotic-tooltip",style:Ce},t.map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,": "),p.createElement("span",{style:{fontWeight:600}},t+""))))}const Le=e.forwardRef(function(t,n){var o,r,a,c,u,d,h;const{projection:g,projectionExtent:f,fitPadding:y,projectionTransform:m,areas:b,points:v,lines:x,xAccessor:k,yAccessor:A,lineDataAccessor:w,pointIdAccessor:j,lineType:E="geo",flowStyle:O="basic",graticule:C,zoomable:$,zoomExtent:z,onZoom:L,dragRotate:P,showParticles:R,particleStyle:D,tileURL:I,tileAttribution:B,tileCacheSize:N,size:W,width:T,height:_,responsiveWidth:F,responsiveHeight:H,margin:q,className:G,background:V,areaStyle:Z,pointStyle:U,lineStyle:Y,colorScheme:X,enableHover:ee=!0,hoverAnnotation:re,tooltipContent:ve,customClickBehavior:xe,customHoverBehavior:ke,annotations:Ae,decay:we,pulse:je,transition:Ee,staleness:Oe,backgroundGraphics:Ce,foregroundGraphics:Le,title:Pe,legend:Re,legendPosition:De,legendHoverBehavior:Ie,legendClickBehavior:Be,legendHighlightedCategory:Ne,legendIsolatedCategories:We,showAxes:Te,accessibleTable:_e}=t,Fe=W||[T||600,_||400],[He,qe]=function(t,n,o){const r=e.useRef(null),[i,a]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&i?i.w:t[0],o&&i?i.h:t[1]]]}(Fe,F,H),Ge=e.useMemo(()=>Object.assign(Object.assign({},Me),q),[q]),Ve=qe[0]-Ge.left-Ge.right,Ze=qe[1]-Ge.top-Ge.bottom,Ue="function"==typeof Le?Le({size:qe,margin:Ge}):Le,Ye="function"==typeof Ce?Ce({size:qe,margin:Ge}):Ce,Xe=e.useMemo(()=>null!=P?P:"orthographic"===("string"==typeof g?g:"object"==typeof g&&"type"in g?g.type:null),[P,g]),Ke=e.useMemo(()=>({projection:g,projectionExtent:f,fitPadding:y,xAccessor:k,yAccessor:A,lineDataAccessor:w,lineType:E,flowStyle:O,areaStyle:Z,pointStyle:U,lineStyle:Y,colorScheme:X,graticule:C,projectionTransform:m,decay:we,pulse:je,transition:Ee,annotations:Ae,pointIdAccessor:j}),[g,f,y,k,A,w,E,O,Z,U,Y,X,C,m,we,je,Ee,Ae,j]),Je=e.useRef(null);Je.current||(Je.current=new S(Ke));const Qe=e.useRef(null),et=e.useRef(null),tt=e.useRef(null),nt=e.useRef(null),ot=e.useRef(null);I&&!ot.current&&(ot.current=new me(N||256));const rt=e.useRef(0),it=e.useRef(!0),at=Se(e=>e.theme),st=e.useRef(Ae),lt=e.useRef(()=>{}),ct=e.useRef(null),ut=e.useRef(s.zoomIdentity),dt=e.useRef(!1),pt=e.useRef(null),ht=e.useRef(null),gt=e.useRef(null),ft=e.useRef(null),yt=e.useRef(0);if(R&&!ft.current){const e=null!==(o=null==D?void 0:D.maxPerLine)&&void 0!==o?o:30;ft.current=new be(50*e)}const mt=e.useRef(null),bt=e.useRef(null),[vt,xt]=e.useState(null),[kt,At]=e.useState(0),[wt,jt]=e.useState(!1),Et=e.useCallback(()=>{rt.current||(rt.current=requestAnimationFrame(()=>lt.current()))},[]);e.useEffect(()=>{it.current=!0,Et()},[at,Et]),e.useEffect(()=>{var e;null===(e=Je.current)||void 0===e||e.updateConfig(Ke),it.current=!0,Et()},[Ke,Et]),e.useEffect(()=>{const e=Je.current;e&&(b&&e.setAreas(b),v&&e.setPoints(v),x&&e.setLines(x),it.current=!0,Et())},[b,v,x,Et]);const Ot=e.useCallback(e=>{var t;null===(t=Je.current)||void 0===t||t.pushPoint(e),it.current=!0,Et()},[Et]),St=e.useCallback(e=>{var t;null===(t=Je.current)||void 0===t||t.pushMany(e),it.current=!0,Et()},[Et]),Mt=e.useCallback(()=>{var e;null===(e=Je.current)||void 0===e||e.clear(),it.current=!0,Et()},[Et]);e.useImperativeHandle(n,()=>({push:Ot,pushMany:St,clear:Mt,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=Je.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=Je.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=Je.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>ut.current.k,resetZoom:()=>{const e=pt.current;e&&ct.current&&l.select(e).call(ct.current.transform,s.zoomIdentity)},getData:()=>{const e=Je.current;return e?e.scene.filter(e=>"point"===e.type).map(e=>e.datum).filter(Boolean):[]}}),[Ot,St,Mt]);const Ct=e.useRef(()=>{});e.useEffect(()=>{Ct.current=e=>{if(!ee)return;const t=Je.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Ge.left,r=e.clientY-n.top-Ge.top;if(0>o||o>Ve||0>r||r>Ze)return mt.current=null,bt.current=null,xt(null),null==ke||ke(null),void Et();nt.current||(nt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=nt.current.getContext("2d");if(!i)return;const a=M(t.scene,o,r,30,i);if(a){const e=a.node,t=e.datum,n=(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let i,s;"point"===e.type?(i=e.x,s=e.y):"geoarea"===e.type?(i=e.centroid[0],s=e.centroid[1]):(i=o,s=r);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,x:i,y:s,time:0});mt.current=l,bt.current=e,xt(l),null==ke||ke({type:e.type,data:n,x:i,y:s}),Et()}else mt.current&&(mt.current=null,bt.current=null,xt(null),null==ke||ke(null),Et())}},[ee,Ve,Ze,Ge,ke,Et]);const $t=e.useCallback(e=>Ct.current(e),[]),zt=e.useCallback(()=>{mt.current=null,bt.current=null,xt(null),null==ke||ke(null),Et()},[ke,Et]),Lt=e.useCallback(e=>{if(!xe)return;const t=Je.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Ge.left,r=e.clientY-n.top-Ge.top;nt.current||(nt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=nt.current.getContext("2d");if(!i)return;const a=M(t.scene,o,r,30,i);if(a){const e=a.node.datum;xe({type:a.node.type,data:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,x:o,y:r})}},[xe,Ge]);lt.current=()=>{var e,t,n,o,r,a,s;rt.current=0;const l=et.current,c=Je.current;if(!l||!c)return;const u=performance.now();let d=!1;const p=gt.current;p&&(gt.current=null,c.applyRotation(p,{width:Ve,height:Ze}));const h=c.advanceTransition(u);if(it.current&&!h){const e={width:Ve,height:Ze},t=Xe?c.getRotation():null;c.computeScene(e);const n=ut.current,o=1!==n.k||0!==n.x||0!==n.y;Xe&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),it.current=!1,l.setAttribute("aria-label",te(c.scene,"Geographic chart"))}const g=fe();if(I&&ot.current){const t=Qe.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=ge(t,qe,Ge,g);if(e){e.clearRect(-Ge.left,-Ge.top,qe[0],qe[1]),e.save(),e.beginPath(),e.rect(0,0,Ve,Ze),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=de,c=0;function u(){const u=+s.apply(this,arguments),d=l.apply(this,arguments),p=Math.log2(u/a),h=Math.round(Math.max(p+c,0)),g=Math.pow(2,p-h)*a,f=+d[0]-u/2,y=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-f)/g)),b=Math.min(r?1<<h:1/0,Math.ceil((n-f)/g)),v=Math.max(i?0:-1/0,Math.floor((t-y)/g)),x=Math.min(i?1<<h:1/0,Math.ceil((o-y)/g)),k=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)k.push([t,e,h]);return k.translate=[f/g,y/g],k.scale=g,k}return u.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],u):[n-e,o-t]},u.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],u):[[e,t],[n,o]]},u.scale=function(e){return arguments.length?(s="function"==typeof e?e:pe(+e),u):s},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:pe([+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=fe();let h=!0;for(const t of d){const[o,r,i]=he(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=ye(n,i,o,r,p),c=t}if(!c.loaded){h=!1;continue}const u=d.scale;e.drawImage(c.img,(t[0]+d.translate[0])*u-.5,(t[1]+d.translate[1])*u-.5,u+1,u+1)}return h}(e,{tileURL:I,projection:c.scales.projection,width:Ve,height:Ze,tileCache:ot.current,onTileLoad:()=>Et()});e.restore(),t||(d=!0)}}}const f=ge(l,qe,Ge,g);if(!f)return;f.clearRect(-Ge.left,-Ge.top,qe[0],qe[1]),V&&!I&&(f.fillStyle=V,f.fillRect(0,0,Ve,Ze)),f.save(),f.beginPath(),f.rect(0,0,Ve,Ze),f.clip();const y=c.scene,m={height:Ze};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)}ae(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(f,y),((e,t,n,o)=>{var r,a;const s=t.filter(e=>"line"===e.type);for(const l of s){if(2>l.path.length)continue;const c=l.style.stroke||"#007bff",u=l.style.strokeWidth||2,d=l.colorThresholds,p=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=u,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const y=null!==(r=l.style.opacity)&&void 0!==r?r:1;ce(e,l.path,c,u,y,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=se(l.curve),g=d&&d.length>0&&p&&p.length===l.path.length,f=l._decayOpacities;if(f&&f.length===l.path.length&&!g){e.strokeStyle=c;const m=null!==(a=l.style.opacity)&&void 0!==a?a:1;for(let b=0;l.path.length-1>b;b++)e.globalAlpha=.5*(f[b]+f[b+1])*m,e.beginPath(),e.moveTo(l.path[b][0],l.path[b][1]),e.lineTo(l.path[b+1][0],l.path[b+1][1]),e.stroke()}else if(g){let v=null,x=null,k=null,A=null,w=!1;function j(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),w=!0}function E(){w&&(e.stroke(),w=!1)}for(let O=0;l.path.length>O;O++){const[S,M]=l.path[O],C=p[O],$=le(C,d,c);if(null!==v&&null!==A&&null!==k){if($===A)e.lineTo(S,M);else{const z=[];for(const L of d){const P=L.value;(k>P||P>C)&&(P>k||C>P)||k===P||C===P||z.push({t:(P-k)/(C-k)})}z.sort((e,t)=>e.t-t.t);for(const R of z){const D=v+(S-v)*R.t,I=x+(M-x)*R.t,B=le(k+(C-k)*Math.min(R.t+1e-4,1),d,c);e.lineTo(D,I),E(),j(B,D,I)}e.lineTo(S,M)}v=S,x=M,k=C,A=$}else j($,S,M),v=S,x=M,k=C,A=$}E()}else{if(e.beginPath(),e.strokeStyle=c,h)i.line().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(l.path);else{const[N,W]=l.path[0];e.moveTo(N,W);for(let T=1;l.path.length>T;T++)e.lineTo(l.path[T][0],l.path[T][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=l.style.fill,h&&!g)i.line().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(l.path);else{const[F,H]=l.path[0];e.moveTo(F,H);for(let q=1;l.path.length>q;q++)e.lineTo(l.path[q][0],l.path[q][1])}const _=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(_,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(f,y,0,m),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),ie(e,t),e.globalAlpha=1}}finally{e.restore()}})(f,y),R&&ft.current){const e=ft.current,i=y.filter(e=>"line"===e.type);if(i.length>0){const s=D||{},l=.3*(null!==(t=s.speedMultiplier)&&void 0!==t?t:1),c=null!==(n=s.maxPerLine)&&void 0!==n?n:30,p=null!==(o=s.spawnRate)&&void 0!==o?o:.15,h=null!==(r=s.radius)&&void 0!==r?r:2,g=null!==(a=s.opacity)&&void 0!==a?a:.7,y=u/1e3,m=yt.current>0?Math.min(y-yt.current,.1):.016;yt.current=y;const b=i.map(e=>e.path),v=i.map(e=>e.style.strokeWidth||2);for(let t=0;i.length>t;t++)Math.random()<p&&e.countForLine(t)<c&&e.spawn(t);e.step(m,l,b,v),f.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=i[n.lineIndex],r="function"==typeof s.color?s.color(null==o?void 0:o.datum):"source"!==s.color&&s.color?s.color:(null==o?void 0:o.style.stroke)||"#fff";f.beginPath(),f.arc(n.x,n.y,h,0,2*Math.PI),f.fillStyle=r,f.fill()}f.globalAlpha=1,d=!0}}f.restore();const b=tt.current;if(b){const e=ge(b,qe,Ge,g);if(e){e.clearRect(-Ge.left,-Ge.top,qe[0],qe[1]);const t=bt.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof re?re:void 0,r=(null==o?void 0:o.pointColor)||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(Oe){const e=performance.now()-c.lastIngestTime>(null!==(s=Oe.threshold)&&void 0!==s?s:5e3);e!==wt&&jt(e)}const v=Ae!==st.current;v&&(st.current=Ae),(it.current||v)&&At(e=>e+1),(h||c.hasActivePulses||d)&&(rt.current=requestAnimationFrame(()=>lt.current()))},e.useEffect(()=>(Et(),()=>{var e;rt.current&&(cancelAnimationFrame(rt.current),rt.current=0),null===(e=ot.current)||void 0===e||e.clear()}),[Et]),e.useEffect(()=>{it.current=!0,Et()},[Ve,Ze,V,Et]),function(t,n,o,r,i,a){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const s=n.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),o.current=!0,r())},1e3);return()=>clearInterval(e)},[t,i,r])}(Oe,Je,it,Et,wt,jt),e.useEffect(()=>{if("production"!==process.env.NODE_ENV&&I){const e="string"==typeof g?g:"object"==typeof g&&"type"in g?g.type:null;e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[I,g]),e.useEffect(()=>{const e=pt.current;if(!$||!e)return ct.current&&e&&(l.select(e).on(".zoom",null),ct.current=null),void(e&&l.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=z||[1,8],o={width:Ve,height:Ze};if(Xe){let r=ut.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),ut.current=s.zoomIdentity.scale(r);const a=Je.current;a&&(a.applyZoomScale(r,o),it.current=!1,Et(),null==L||L({projection:null===(i=a.scales)||void 0===i?void 0:i.projection,zoom:a.currentZoom}))};ct.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const a=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},l=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",l);const c=.4,u=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=Je.current;if(!o)return;const r=o.getRotation();ht.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=ht.current;t&&(gt.current=[t.rotation[0]+(e.clientX-t.x)*c,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*c)),t.rotation[2]],Et())},p=t=>{var n;if(!ht.current)return;ht.current=null,e.releasePointerCapture(t.pointerId);const r=gt.current;if(r){gt.current=null;const e=Je.current;e&&(e.applyRotation(r,o),Et())}const i=Je.current;i&&(null==L||L({projection:null===(n=i.scales)||void 0===n?void 0:n.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",p),e.addEventListener("pointercancel",p),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",l),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",p),e.removeEventListener("pointercancel",p),ct.current=null}}const r=s.zoom().scaleExtent([t,n]).extent([[0,0],[qe[0],qe[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;ut.current=t,dt.current=!0;const n=Je.current;n&&(n.applyZoomTransform(t,o),it.current=!1,Et())}).on("end",e=>{var t;ut.current=e.transform,dt.current=!1;const n=Je.current;n&&(null==L||L({projection:null===(t=n.scales)||void 0===t?void 0:t.projection,zoom:n.currentZoom}))});return ct.current=r,l.select(e).call(r),()=>{l.select(e).on(".zoom",null)}},[$,z,Xe,qe,Ve,Ze,Ge,L,Et]);const Pt=ee&&!1!==re,Rt=Pt&&vt?ve?ve(vt):p.createElement(ze,{data:vt}):null,Dt=Rt?p.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:Ge.left+vt.x,top:Ge.top+vt.y,transform:`translate(${vt.x>.7*Ve?"calc(-100% - 12px)":"12px"}, ${.3*Ze>vt.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:10,width:"max-content"}},Rt):null;if(Q){const e=Je.current;e&&(b||v||x)&&(b&&e.setAreas(b),v&&e.setPoints(v),x&&e.setLines(x),e.computeScene({width:Ve,height:Ze}));const t=null!==(r=null==e?void 0:e.scene)&&void 0!==r?r:[];return p.createElement("div",{className:"stream-geo-frame"+(G?" "+G:""),role:"img","aria-label":"string"==typeof Pe?Pe:"Geographic chart",style:{position:"relative",width:qe[0],height:qe[1]}},p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:qe[0],height:qe[1],style:{position:"absolute",left:0,top:0}},Ye,p.createElement("g",{transform:`translate(${Ge.left},${Ge.top})`},V&&p.createElement("rect",{x:0,y:0,width:Ve,height:Ze,fill:V}),t.map((e,t)=>function(e,t){var n,o,r,i,a,s;switch(e.type){case"geoarea":{const r=e;return r.pathData?p.createElement("path",{key:"geoarea-"+t,d:r.pathData,fill:J(r.style.fill,"#e0e0e0"),fillOpacity:null!==(n=r.style.fillOpacity)&&void 0!==n?n:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(o=r._decayOpacity)&&void 0!==o?o:1}):null}case"point":{const n=e;return p.createElement("circle",{key:"point-"+t,cx:n.x,cy:n.y,r:n.r,fill:J(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:null!==(i=n._decayOpacity)&&void 0!==i?i:null!==(a=n.style.opacity)&&void 0!==a?a:1})}case"line":{const n=e;if(2>n.path.length)return null;const o="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return p.createElement("path",{key:"line-"+t,d:o,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:null!==(s=n.style.opacity)&&void 0!==s?s:1})}default:return null}}(e,t)))),p.createElement(K,{width:Ve,height:Ze,totalWidth:qe[0],totalHeight:qe[1],margin:Ge,scales:null,showAxes:!1,title:Pe,legend:Re,legendPosition:De,legendHoverBehavior:Ie,legendClickBehavior:Be,legendHighlightedCategory:Ne,legendIsolatedCategories:We,foregroundGraphics:Ue,annotations:Ae,annotationFrame:0,xValues:[],yValues:[],pointNodes:t.filter(e=>"point"===e.type)}))}const It=e.useCallback(e=>{pt.current=e,He&&"object"==typeof He&&(He.current=e)},[He]);return p.createElement("div",{ref:It,className:"stream-geo-frame"+(G?" "+G:""),role:"img","aria-label":"string"==typeof Pe?Pe:"Geographic chart",tabIndex:0,style:Object.assign({position:"relative",width:F?"100%":qe[0],height:H?"100%":qe[1],overflow:"hidden"},$?{touchAction:"none"}:{}),onMouseMove:Pt?$t:void 0,onMouseLeave:Pt?zt:void 0,onClick:xe?Lt:void 0},Ye&&p.createElement("svg",{style:{position:"absolute",left:0,top:0,width:qe[0],height:qe[1],pointerEvents:"none"}},Ye),I&&p.createElement("canvas",{ref:Qe,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),p.createElement("canvas",{ref:et,"aria-label":te(null!==(c=null===(a=Je.current)||void 0===a?void 0:a.scene)&&void 0!==c?c:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),p.createElement("canvas",{ref:tt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),p.createElement(oe,{hoverPoint:vt}),_e&&p.createElement(ne,{scene:null!==(d=null===(u=Je.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],chartType:"Geographic chart"}),p.createElement(K,{width:Ve,height:Ze,totalWidth:qe[0],totalHeight:qe[1],margin:Ge,scales:null,showAxes:null!=Te&&Te,title:Pe,legend:Re,legendPosition:De,legendHoverBehavior:Ie,legendClickBehavior:Be,legendHighlightedCategory:Ne,legendIsolatedCategories:We,foregroundGraphics:Ue,annotations:Ae,annotationFrame:kt,xValues:[],yValues:[],pointNodes:null===(h=Je.current)||void 0===h?void 0:h.scene.filter(e=>"point"===e.type)}),(null==Oe?void 0:Oe.showBadge)&&p.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Oe.badgePosition?{top:4,left:4}:"bottom-left"===Oe.badgePosition?{bottom:4,left:4}:"bottom-right"===Oe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:wt?"#dc3545":"#28a745",color:"white"})},wt?"STALE":"LIVE"),$&&p.createElement("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Ge.bottom+8,left:Ge.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2}},p.createElement("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=pt.current,n=ct.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(l.select(t),1.5)},style:$e},"+"),p.createElement("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=pt.current,n=ct.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(l.select(t),1/1.5)},style:$e},"−")),B&&p.createElement("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Ge.bottom+2,right:Ge.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),Dt)});Le.displayName="StreamGeoFrame";const Pe={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 Re(e,t){return"function"==typeof t?t(e):e[t]}function De(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 Ie(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=Re(e,n);a=De(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=Re(e,r);s.push({label:n,value:De(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=De(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=De(e[t[0]],o))}}const l=Object.assign(Object.assign({},Pe),r);return p.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},a&&p.createElement("div",{style:{fontWeight:s.length>0?"bold":"normal"}},a),s.map((e,t)=>p.createElement("div",{key:t,style:{marginTop:0===t&&a?"4px":0}},e.label&&p.createElement("span",null,e.label,": "),e.value)))}}function Be(e){if(!0===e)return Ie();if("function"==typeof e){const t=e;return e=>{const n=t(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==n?null:p.createElement("div",{className:"semiotic-tooltip",style:Pe},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Ie(e):Ie())}const Ne={category10:c.schemeCategory10,tableau10:c.schemeTableau10,set3:c.schemeSet3,blues:c.interpolateBlues,reds:c.interpolateReds,greens:c.interpolateGreens,oranges:c.interpolateOranges,purples:c.interpolatePurples,viridis:c.interpolateViridis,plasma:c.interpolatePlasma},We=c.schemeCategory10,Te=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],_e=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 Fe(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")||_e.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):We[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+""))%We.length]}function He(e,t,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(r).range(o).unknown("#999");const a=Ne[o]||Ne.category10;if(i&&"function"==typeof a){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>a(Number(t)/e)}{const e=Array.isArray(a)?a:We;return n.scaleOrdinal().domain(r).range(e).unknown("#999")}}function qe(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 Ge=e.createContext(null);function Ve(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 Ze(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Ue,Ye]=ke(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Ze(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=Ze(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}})}})),[Xe,Ke]=ke(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Je(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=Ye(e=>e.selections.get(r)),a=Ye(e=>e.setClause),s=Ye(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Ve(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:e.useCallback(()=>{s(r,o)},[s,r,o]),clientId:o}}function Qe(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:a,clear:s}=Je({name:n});return{onHover:e.useCallback(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&a(t)},[o,a,s,n]),predicate:r,isActive:i}}const et=e.createContext(!1);function tt(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 nt(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 ot="#007bff";function rt(t,n,o="category10"){const r=e.useContext(Ge);return e.useMemo(()=>{if(n){if(0===t.length)return r&&Object.keys(r).length>0?e=>r[e]||"#999":void 0;if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));return r&&Object.keys(r).length>0?e=>r[e]||"#999":He(e.map(e=>({_cat:e})),"_cat",o)}if(r&&Object.keys(r).length>0){const e=He(t,n,o);return t=>r[t]||e(t)}return He(t,n,o)}},[t,n,o,r])}function it({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:a,chartId:s}){const l=tt(n,o),c=Je({name:(null==t?void 0:t.name)||"__unused__"}),u=Qe({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||o||[]}),d=Ke(e=>e.pushObservation),p=t?{isActive:c.isActive,predicate:c.predicate}:null,h=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(i||d){const n={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),d&&d(a)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),d&&d(e)}}},[n,u,i,a,s,d]),g=e.useCallback(e=>{var t,n;if(i||d){const o={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});i&&i(e),d&&d(e)}}},[i,d,a,s]);return{activeSelectionHook:p,customHoverBehavior:h,customClickBehavior:g}}function at({data:t,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:s={top:50,bottom:60,left:70,right:40},categories:l}){const c=e.useContext(et),u=void 0!==r?r:!c&&!!n,d=e.useMemo(()=>{if(u&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):Te[i%Te.length];return{label:r+"",color:s}}),label:""}]}}({data:t,colorBy:n,colorScale:o,getColor:Fe,categories:l})},[u,n,t,o,l]),p=e.useMemo(()=>{const e=Object.assign(Object.assign({},s),a);return d&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[s,a,d,i]);return{legend:d,margin:p,legendPosition:i}}const st={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 lt(e,t,n){var o,r,i,a,s,l;const c=st[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:ct(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function ct(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 ut({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return p.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},p.createElement("div",{style:{textAlign:"center",maxWidth:400}},p.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),p.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&p.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},n)))}class dt extends p.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:p.createElement(ut,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function pt(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 ht(e,t,n=3){let o,r=n+1;for(const n of t){const t=pt(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function gt(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function ft(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=ht(e,t,3))&&void 0!==n?n:null)}const yt={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"}},mt={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},bt={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},vt=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],xt=["vertical","horizontal"],kt={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yt),mt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:vt},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({},yt),mt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:vt},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yt),mt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:vt},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({},yt),mt),{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({},yt),mt),{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({},yt),mt),{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({},yt),mt),{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({},yt),mt),{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({},yt),mt),{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({},yt),bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yt),bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yt),bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yt),bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},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({},yt),bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yt),bt),{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({},yt),bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},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({},yt),bt),{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({},yt),bt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},yt),{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({},yt),{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({},yt),bt),{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({},yt),{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({},yt),{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:xt},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({},yt),{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({},yt),{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({},yt),{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({},yt),{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({},yt),{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 At(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const wt=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),jt=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Et=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Ot=new Set(["LineChart","AreaChart","StackedAreaChart"]),St=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Mt(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 Ct(e,t){const n=Mt(e),o=Mt(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const $t=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function zt(e,t){const n=[],o=function(e,t){const n=[],o=kt[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(kt).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(!At(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=ht(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=gt(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=ft(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=gt(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=ft(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 kt[e]?(function(e,t,n){const o=kt[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=kt[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){wt.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){jt.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=kt[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(!Et.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(!Ot.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=kt[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(!St.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=Ct(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 $t)"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 Lt;const Pt="undefined"!=typeof process&&"production"!==(null===(Lt=process.env)||void 0===Lt?void 0:Lt.NODE_ENV);function Rt({componentName:e,width:t,height:n,chartProps:o,children:r}){return p.createElement(dt,{fallback:r=>{let i="";if(Pt&&o)try{const t=zt(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return p.createElement(ut,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const Dt={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"},It={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Bt(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?p.createElement("div",{style:Object.assign(Object.assign({},Dt),{width:t,height:n})},o||"No data available"):null}function Nt(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*o))),i=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(r+i)-i))/2);return p.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>p.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},It),{position:"absolute",top:a+n*(r+i),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})})))}function Wt(e,t,n,o){if(!Pt)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 Tt(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 _t(e){return e}function Ft(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 _t;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 Ht=new Map;function qt(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function Gt(e){return Tt(this,void 0,void 0,function*(){const t=Ht.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return Tt(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:qt(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:qt(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:qt(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:qt(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 Ft(e,t)})}:Ft(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return Ht.set(e,i),i})}function Vt(t){const n=e.useMemo(()=>Array.isArray(t)?t:void 0,[t]),[o,r]=e.useState(null);return e.useEffect(()=>{if(t&&!Array.isArray(t)){if("string"==typeof(e=t)&&["world-110m","world-50m","land-110m","land-50m"].includes(e)){let e=!1;return r(null),Gt(t).then(t=>{e||r(t)}),()=>{e=!0}}var e;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${t}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),r(null)}else r(null)},[t]),void 0!==n?n:o}const Zt={blues:c.interpolateBlues,reds:c.interpolateReds,greens:c.interpolateGreens,viridis:c.interpolateViridis};function Ut(t){const r=lt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{areas:i,valueAccessor:a,colorScheme:s="blues",projection:l="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:g,onZoom:f,dragRotate:y,tileURL:m,tileAttribution:b,tileCacheSize:v,tooltip:x,areaOpacity:k=1,annotations:A,margin:w,className:j,selection:E,linkedHover:O,onObservation:S,chartId:M,loading:C,emptyContent:$,frameProps:z={}}=t,L=null!=h?h:!!m,P=Vt(i),R=e.useMemo(()=>"function"==typeof a?a:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[a])&&void 0!==n?n:null==e?void 0:e[a]},[a]),D=e.useMemo(()=>{if(!P)return n.scaleSequential(c.interpolateBlues).domain([0,1]);const e=P.map(e=>R(e)).filter(e=>null!=e&&isFinite(e)),[t,r]=o.extent(e);return n.scaleSequential(Zt[s]||c.interpolateBlues).domain([null!=t?t:0,null!=r?r:1])},[P,R,s]),{activeSelectionHook:I,customHoverBehavior:B}=it({selection:E,linkedHover:O,onObservation:S,chartType:"ChoroplethMap",chartId:M}),N=e.useMemo(()=>{const e=e=>{const t=R(e);return{fill:null!=t&&isFinite(t)?D(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}};return I?nt(e,I,E):e},[R,D,I,E,k]),W=e.useMemo(()=>e=>{var t,n;const o=(null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.name)||(null===(n=null==e?void 0:e.properties)||void 0===n?void 0:n.NAME)||(null==e?void 0:e.name)||(null==e?void 0:e.NAME)||"Feature",r=R(e);return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},o),null!=r&&p.createElement("div",{style:{opacity:.7}},"number"==typeof(i=r)&&isFinite(i)?Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=i?i:"")+""));var i},[R]),T=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},w),[w]),_=Nt(C,r.width,r.height)||(P?null:Nt(!0,r.width,r.height)),F=_?null:Bt(P,r.width,r.height,$);if(Array.isArray(P)&&P.length>0){const e=P[0];if(!e||"object"!=typeof e||!e.geometry)return p.createElement(ut,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:r.width,height:r.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:l,areas:P,areaStyle:N,size:[r.width,r.height],margin:T,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?W:Be(x)||W},null!=u&&{graticule:u}),null!=d&&{fitPadding:d}),L&&{zoomable:!0}),g&&{zoomExtent:g}),f&&{onZoom:f}),null!=y&&{dragRotate:y}),m&&{tileURL:m}),b&&{tileAttribution:b}),v&&{tileCacheSize:v}),(O||S)&&{customHoverBehavior:B}),A&&A.length>0&&{annotations:A}),r.title&&{title:r.title}),j&&{className:j}),z);return _||F||p.createElement(Rt,{componentName:"ChoroplethMap",width:r.width,height:r.height},p.createElement(Le,Object.assign({},H)))}Ut.displayName="ChoroplethMap";const Yt=e.forwardRef(function(t,n){const o=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const r=lt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{points:i,xAccessor:a="lon",yAccessor:s="lat",sizeBy:l,sizeRange:c=[3,30],colorBy:u,colorScheme:d="category10",projection:h="equalEarth",graticule:g,fitPadding:f,zoomable:y,zoomExtent:m,onZoom:b,dragRotate:v,tileURL:x,tileAttribution:k,tileCacheSize:A,areas:w,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:E,annotations:O,margin:S,className:M,selection:C,linkedHover:$,onObservation:z,chartId:L,loading:P,emptyContent:R,legendInteraction:D,legendPosition:I,frameProps:B={}}=t,N=null!=y?y:!!x,W=Vt(w),T=i||[],{activeSelectionHook:_,customHoverBehavior:F}=it({selection:C,linkedHover:$,fallbackFields:u?["string"==typeof u?u:""]:[],onObservation:z,chartType:"ProportionalSymbolMap",chartId:L}),H=rt(T,u,d),q=e.useMemo(()=>{if(!l)return;const e="function"==typeof l?l:e=>e[l],t=T.map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[T,l]),G=e.useMemo(()=>{const e=e=>({fill:u?Fe(e,u,H):ot,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:l?qe(e,l,c,q):6});return _?nt(e,_,C):e},[u,H,l,c,q,_,C]),V=e.useMemo(()=>{if(!u)return[];const e="function"==typeof u?u:e=>e[u],t=new Set;for(const n of T){const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[T,u]),Z=function(t,n,o){const[r,i]=e.useState(null),[a,s]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&i(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&s(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=r?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===r}:"isolate"===t&&a.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return a.has(o)}}:null},[t,n,r,a]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?a:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(D,u,V),{legend:U,margin:Y,legendPosition:X}=at({data:T,colorBy:u,colorScale:H,showLegend:r.showLegend,legendPosition:I,userMargin:S,defaults:{top:10,bottom:10,left:10,right:10}}),K=e.useMemo(()=>e=>{const t=(null==e?void 0:e.name)||(null==e?void 0:e.label)||(null==e?void 0:e.NAME)||(null==e?void 0:e.id),n="string"==typeof l?l:null,o=("function"==typeof l?l:e=>e[l])(e),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",i="string"==typeof u?u:null,a=i?null==e?void 0:e[i]:null;return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},t&&p.createElement("div",{style:{fontWeight:600,marginBottom:2}},t),n&&null!=o&&p.createElement("div",null,p.createElement("span",{style:{opacity:.7}},n,": "),r(o)),i&&null!=a&&p.createElement("div",null,p.createElement("span",{style:{opacity:.7}},i,": "),a+""),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,": "),r(t))))},[l,u]),J=Nt(P,r.width,r.height),Q=J?null:Bt(i,r.width,r.height,R);Wt("ProportionalSymbolMap",T,"xAccessor",a),Wt("ProportionalSymbolMap",T,"yAccessor",s);const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=i&&{points:T}),{xAccessor:a,yAccessor:s,pointStyle:G}),W&&{areas:W,areaStyle:j}),null!=g&&{graticule:g}),null!=f&&{fitPadding:f}),N&&{zoomable:!0}),m&&{zoomExtent:m}),b&&{onZoom:b}),null!=v&&{dragRotate:v}),x&&{tileURL:x}),k&&{tileAttribution:k}),A&&{tileCacheSize:A}),{size:[r.width,r.height],margin:Y,enableHover:!0,tooltipContent:!1===E?()=>null:Be(E)||K}),U&&{legend:U,legendPosition:X}),D&&"none"!==D&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories}),($||z)&&{customHoverBehavior:F}),O&&O.length>0&&{annotations:O}),r.title&&{title:r.title}),M&&{className:M}),B);return J||Q||p.createElement(Rt,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height},p.createElement(Le,Object.assign({ref:o},ee)))});function Xt(t){const o=lt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{flows:r,nodes:i,nodeIdAccessor:a="id",xAccessor:s="lon",yAccessor:l="lat",valueAccessor:c="value",projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:g,zoomExtent:f,onZoom:y,dragRotate:m,tileURL:b,tileAttribution:v,tileCacheSize:x,lineType:k="geo",flowStyle:A="basic",areas:w,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:E,edgeOpacity:O=.6,edgeWidthRange:S=[1,8],edgeLinecap:M="round",colorScheme:C="category10",showParticles:$,particleStyle:z,tooltip:L,annotations:P,margin:R,className:D,selection:I,linkedHover:B,onObservation:N,chartId:W,loading:T,emptyContent:_,frameProps:F={}}=t,H=null!=g?g:!!b,q=Vt(w),G=tt(B),V=Je({name:(null==I?void 0:I.name)||"__unused__"}),Z=Qe({name:(null==G?void 0:G.name)||"hover",fields:(null==G?void 0:G.fields)||[]}),U=Ke(e=>e.pushObservation),Y=I?{isActive:V.isActive,predicate:V.predicate}:null,X=r||[],K=i||[],J=rt(X,E,C),Q=e.useMemo(()=>{const e=new Map;for(const t of K)e.set(t[a]+"",t);return e},[K,a]),ee=e.useMemo(()=>{const e=new Map;for(const t of X)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[X]),te=e.useCallback(e=>{var t,n;if(B)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=ee.get(t[a]+"");e&&Z.onHover(e)}else Z.onHover(t)}else Z.onHover(null);if(N||U){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:W};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},o),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});N&&N(i),U&&U(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});N&&N(e),U&&U(e)}}},[B,Z,a,ee,N,W,U]),ne=e.useMemo(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof l?l:e=>e[l];return X.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=Q.get(n.source+""),r=Q.get(n.target+"");return o&&r?Object.assign(Object.assign({},n),{coordinates:[{[s]:e(o),[l]:t(o)},{[s]:e(r),[l]:t(r)}]}):null}).filter(Boolean)},[X,Q,s,l]),oe=e.useMemo(()=>{const e=X.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[c])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>S[0]:n.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(S)},[X,c,S]),re=e.useMemo(()=>e=>{var t;return{stroke:E?Fe(e,E,J):ot,strokeWidth:oe(null!==(t=e[c])&&void 0!==t?t:0),strokeLinecap:M,opacity:O}},[E,J,oe,c,O,M]),ie=e.useMemo(()=>Y?nt(re,Y,Object.assign(Object.assign({},I||{}),{unselectedStyle:{opacity:.15,strokeOpacity:.15,fillOpacity:0}})):re,[re,Y,I]),ae=e.useMemo(()=>()=>({fill:"#333",r:5,fillOpacity:.8}),[]),se=e.useMemo(()=>e=>{var t,n,o,r,i,s,l;if((null==e?void 0:e.geometry)||(null==e?void 0:e.properties)||(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.geometry)){const t=(null===(n=null==e?void 0:e.properties)||void 0===n?void 0:n.name)||(null===(o=null==e?void 0:e.properties)||void 0===o?void 0:o.NAME)||(null==e?void 0:e.name)||(null==e?void 0:e.NAME)||(null===(i=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.properties)||void 0===i?void 0:i.name)||(null===(l=null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.properties)||void 0===l?void 0:l.NAME);if(t)return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},t))}if(null!=(null==e?void 0:e.source)&&null!=(null==e?void 0:e.target)){const t=e[c];return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},e.source," → ",e.target),null!=t&&p.createElement("div",{style:{opacity:.7}},"number"==typeof t?t.toLocaleString():t))}const u=(null==e?void 0:e.name)||(null==e?void 0:e.label)||(null==e?void 0:e[a]);return null!=u?p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},u)):null},[c,a]),le=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},R),[R]),ce=Nt(T,o.width,o.height),ue=ce?null:Bt(r,o.width,o.height,_),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:u,lines:ne,points:K,xAccessor:s,yAccessor:l,lineDataAccessor:"coordinates",lineType:k,flowStyle:A,lineStyle:ie,pointStyle:ae},q&&{areas:q,areaStyle:j}),null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),H&&{zoomable:!0}),f&&{zoomExtent:f}),y&&{onZoom:y}),null!=m&&{dragRotate:m}),$&&{showParticles:$}),z&&{particleStyle:z}),b&&{tileURL:b}),v&&{tileAttribution:v}),x&&{tileCacheSize:x}),{size:[o.width,o.height],margin:le,enableHover:!0,tooltipContent:!1===L?()=>null:Be(L)||se}),(B||N)&&{customHoverBehavior:te}),P&&P.length>0&&{annotations:P}),o.title&&{title:o.title}),D&&{className:D}),F);return ce||ue||p.createElement(Rt,{componentName:"FlowMap",width:o.width,height:o.height},p.createElement(Le,Object.assign({},de)))}Yt.displayName="ProportionalSymbolMap",Xt.displayName="FlowMap";const Kt=e.forwardRef(function(t,n){const o=lt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title}),{points:r,lines:i,xAccessor:a="lon",yAccessor:s="lat",nodeIdAccessor:l="id",center:c,costAccessor:u,strength:d=1,lineMode:h="straight",projection:g="mercator",graticule:f,fitPadding:y,zoomable:m,zoomExtent:b,onZoom:v,dragRotate:x,tileURL:k,tileAttribution:A,tileCacheSize:w,transition:j,colorBy:E,colorScheme:O="category10",pointRadius:S=5,tooltip:M,showRings:C=!0,ringStyle:$,showNorth:z=!0,costLabel:L,annotations:P,margin:R,className:D,selection:I,linkedHover:B,onObservation:N,chartId:W,loading:T,emptyContent:_,legendPosition:F,frameProps:H={}}=t,q=null!=m?m:!!k,G=r||[],{activeSelectionHook:V,customHoverBehavior:Z}=it({selection:I,linkedHover:B,fallbackFields:E?["string"==typeof E?E:""]:[],onObservation:N,chartType:"DistanceCartogram",chartId:W}),U=rt(G,E,O),Y=e.useMemo(()=>{const e=e=>({fill:E?Fe(e,E,U):ot,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:S});return V?nt(e,V,I):e},[E,U,S,V,I]),{legend:X,margin:K,legendPosition:J}=at({data:G,colorBy:E,colorScale:U,showLegend:o.showLegend,legendPosition:F,userMargin:R,defaults:{top:10,bottom:10,left:10,right:10}}),Q=e.useMemo(()=>({center:c,centerAccessor:l,costAccessor:u,strength:d,lineMode:h}),[c,l,u,d,h]),ee=e.useMemo(()=>{if(!i)return;const e="function"==typeof a?a:e=>e[a],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of G)n.set(e[l]+"",e);return i.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),i=n.get(o.target+"");return r&&i?Object.assign(Object.assign({},o),{coordinates:[{[a]:e(r),[s]:t(r)},{[a]:e(i),[s]:t(i)}]}):null}).filter(Boolean)},[i,G,a,s,l]),te=e.useMemo(()=>e=>{const t=("function"==typeof u?u:e=>e[u])(e);return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},e[l]||e.name||e.id||"Point"),null!=t&&p.createElement("div",{style:{opacity:.7}},"Cost: ","number"==typeof t?t.toFixed(1):t))},[u,l]),ne=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=ne.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ne.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=ne.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ne.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[oe,re]=e.useState(null),ie=e.useCallback(()=>{var e,t;const n=null===(t=null===(e=ne.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&re(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);e.useEffect(()=>{const e=requestAnimationFrame(ie);return()=>cancelAnimationFrame(e)},[ie,d,c,o.width,o.height,G]);const ae=e.useMemo(()=>{if(!C||!oe)return[];const{maxCost:e}=oe;if(0>=e)return[];if(Array.isArray(C))return C.filter(t=>t>0&&e>=t);const t="number"==typeof C?C:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[C,oe]),se=e.useMemo(()=>{var e,t;if(!oe)return H.foregroundGraphics||null;const{cx:n,cy:o,maxCost:r,availableRadius:i}=oe,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},$),s=null!==(e=K.left)&&void 0!==e?e:10,l=null!==(t=K.top)&&void 0!==t?t:10;return p.createElement("g",null,ae.map(e=>{const t=e/r*i;return p.createElement("g",{key:e},p.createElement("circle",{cx:n+s,cy:o+l,r:t,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),p.createElement("text",{x:n+s+t+3,y:o+l-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif"},e,L?" "+L:""))}),z&&p.createElement("g",{transform:`translate(${s+24}, ${l+24})`},p.createElement("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),p.createElement("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),p.createElement("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif"},"N"),p.createElement("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),p.createElement("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),p.createElement("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})),H.foregroundGraphics)},[oe,ae,z,L,$,K,H.foregroundGraphics]),le=Nt(T,o.width,o.height),ce=le?null:Bt(r,o.width,o.height,_);Wt("DistanceCartogram",G,"xAccessor",a),Wt("DistanceCartogram",G,"yAccessor",s);const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:g},null!=r&&{points:G}),ee&&{lines:ee,lineDataAccessor:"coordinates"}),{xAccessor:a,yAccessor:s,pointIdAccessor:l,pointStyle:Y,projectionTransform:Q}),j&&{transition:{duration:j}}),null!=f&&{graticule:f}),null!=y&&{fitPadding:y}),q&&{zoomable:!0}),b&&{zoomExtent:b}),v&&{onZoom:v}),null!=x&&{dragRotate:x}),k&&{tileURL:k}),A&&{tileAttribution:A}),w&&{tileCacheSize:w}),{size:[o.width,o.height],margin:K,enableHover:!0,tooltipContent:!1===M?()=>null:Be(M)||te}),X&&{legend:X,legendPosition:J}),(B||N)&&{customHoverBehavior:Z}),P&&P.length>0&&{annotations:P}),o.title&&{title:o.title}),D&&{className:D}),H),se&&{foregroundGraphics:se});return le||ce||p.createElement(Rt,{componentName:"DistanceCartogram",width:o.width,height:o.height},p.createElement(Le,Object.assign({ref:ne},ue)))});Kt.displayName="DistanceCartogram",exports.ChoroplethMap=Ut,exports.DistanceCartogram=Kt,exports.FlowMap=Xt,exports.ProportionalSymbolMap=Yt,exports.StreamGeoFrame=Le,exports.mergeData=function(e,t,n){const{featureKey:o,dataKey:r}=n,i=new Map;for(const e of t)i.set(e[r]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=null==n?void 0:n[e];return(null!=n?n:"")+""})(e),n=i.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})},exports.resolveReferenceGeography=Gt;
|
|
1
|
+
"use strict";const e=require("react"),t=require("d3-geo"),n=require("d3-scale"),o=require("d3-array"),r=require("d3-hierarchy"),i=require("d3-shape"),a=require("regression"),s=require("d3-zoom"),l=require("d3-selection"),c=require("d3-scale-chromatic");function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const p=d(e),h=u(a);class y{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function f(e,t,n){return e+(t-e)*n}const g={mercator:t.geoMercator,equalEarth:t.geoEqualEarth,albersUsa:t.geoAlbersUsa,orthographic:t.geoOrthographic,naturalEarth:t.geoNaturalEarth1,equirectangular:t.geoEquirectangular};function m(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function b(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function v(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):n}const x={fill:"#e0e0e0",stroke:"#999",strokeWidth:.5,fillOpacity:1},k={fill:"#4e79a7",r:4,fillOpacity:.8},w={stroke:"#4e79a7",strokeWidth:1.5,fill:"none"};function A(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let r=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>r.length||o.push(r),r=[i]):r.push(i)}return 2>r.length||o.push(r),o}function j(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const a=-r/i,s=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;d.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return d}function E(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,a;0===t?(i=e[1][0]-r[0],a=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],a=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(i*i+a*a)||1;o.push([r[0]+a/s*n,r[1]+-i/s*n])}return o}function O(e,t,n,o,r){const i=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(i*i+a*a);if(0===s)return[e,t];const l=a/s,c=-i/s,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}class S{constructor(e){this.scene=[],this.scales=null,this.version=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e}initStreaming(e=500){this.pointBuffer=new y(e),this.timestampBuffer=new y(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this.version++}computeScene(e){const{config:n}=this;this.projection=function(e){if(!e)return t.geoEqualEarth();if("string"==typeof e){const n=g[e];return n?n():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),t.geoEqualEarth())}if("object"==typeof e&&"type"in e){const n=g[e.type],o=n?n():t.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(n.projection),this.geoPath=t.geoPath(this.projection),this.fitProjection(e),this.geoPath=t.geoPath(this.projection);const o=this.projection;this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null};const r=this.scene;this.scene=this.buildSceneNodes(e),n.projectionTransform&&this.applyCartogramTransform(n.projectionTransform,e),n.decay&&this.streaming&&this.applyDecay(),n.pulse&&this.streaming&&this.applyPulse(),n.transition&&r.length>0&&this.startTransition(r),this.version++}fitProjection(e){var t,n,o,r,i;const a=this.projection,s=this.config,l=[...this.areas],c=m(s.xAccessor,"lon"),u=m(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const p=b(s.lineDataAccessor);for(const e of this.lineData){const t=p(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==l.length){if(s.projectionExtent){const[[t,n],[o,r]]=s.projectionExtent;a.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,r],[t,r],[t,n]]]}})}else if(a.clipAngle&&(null!==(t=a.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=s.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);a.scale(o/2-o*t),a.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,r=e.height*t;a.fitExtent([[n,r],[e.width-n,e.height-r]],{type:"FeatureCollection",features:l})}this.baseScale=a.scale(),this.baseTranslate=a.translate(),this.baseRotation=null!==(i=null===(r=a.rotate)||void 0===r?void 0:r.call(a))&&void 0!==i?i:[0,0,0]}}applyZoomTransform(e,n){const o=this.projection;o&&(o.scale(this.baseScale*e.k),o.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=t.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}applyZoomScale(e,n){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=t.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}applyRotation(e,n){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=t.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}buildSceneNodes(e){var n,o,r;const i=[],{config:a}=this,s=this.projection,l=this.geoPath,c=m(a.xAccessor,"lon"),u=m(a.yAccessor,"lat");if(a.graticule){const n=!0===a.graticule?{}:a.graticule,o=t.geoGraticule();n.step&&o.step(n.step);const r=l(o())||"";r&&i.push({type:"geoarea",pathData:r,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:n.stroke||"#e0e0e0",strokeWidth:n.strokeWidth||.5,strokeDasharray:n.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=l(e);if(!t)continue;const n=l.centroid(e),o=l.bounds(e),r=l.area(e),s=v(a.areaStyle,e,x);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:r,style:s,datum:e,interactive:!0})}const d=b(a.lineDataAccessor);for(const n of this.lineData){const o=d(n);if(!o||2>o.length)continue;const r=o.map(e=>[c(e),u(e)]);let l;if("geo"===a.lineType){const e=[];for(let n=0;r.length-1>n;n++){const o=r[n],i=r[n+1],a=t.geoDistance(o,i)||0,s=Math.max(2,Math.ceil(a/(Math.PI/180))),l=t.geoInterpolate(o,i);for(let t=0;s>=t;t++)n>0&&0===t||e.push(l(t/s))}l=e.map(([e,t])=>s([e,t])).filter(e=>null!=e)}else l=r.map(([e,t])=>s([e,t])).filter(e=>null!=e);if(2>l.length)continue;const p=v(a.lineStyle,n,w),h="number"==typeof p.strokeWidth?p.strokeWidth:1;2!==r.length||2>l.length||"arc"!==a.flowStyle?2!==r.length||2>l.length||"offset"!==a.flowStyle||(l="geo"===a.lineType?E(l,h):O(l[0],l[l.length-1],0,0,h)):l=j(l[0],l[l.length-1]);const y=A(l,e.width);if(y.length>1)for(const e of y){if(2>e.length)continue;const t={type:"line",path:e,style:Object.assign(Object.assign({},p),{_edgeFade:!0}),datum:n};i.push(t)}else i.push({type:"line",path:2>l.length&&y[0]||l,style:p,datum:n})}const p=this.getPoints(),h=a.pointIdAccessor?"function"==typeof a.pointIdAccessor?a.pointIdAccessor:e=>e[a.pointIdAccessor]:null,y=s.clipAngle&&null!==(n=s.clipAngle())&&void 0!==n?n:0,f=y>0?y*Math.PI/180:null,g=s.rotate?s.rotate():[0,0,0],S="function"==typeof s.center?s.center():[0,0],M=[(null!==(o=S[0])&&void 0!==o?o:0)-g[0],(null!==(r=S[1])&&void 0!==r?r:0)-g[1]];for(let e=0;p.length>e;e++){const n=p[e],o=c(n),r=u(n);if(null!=f&&t.geoDistance([o,r],M)>f)continue;const l=s([o,r]);if(!l)continue;const d=a.pointStyle?a.pointStyle(n):Object.assign({},k),y={type:"point",x:l[0],y:l[1],r:d.r||4,style:d,datum:n,pointId:h?h(n)+"":void 0};i.push(y)}return i}applyCartogramTransform(e,t){var o,r,i;const a=this.scene.filter(e=>"point"===e.type);if(2>a.length)return;const s=null!==(o=e.strength)&&void 0!==o?o:1;if(0===s)return;const l=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,c="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],u=a.find(t=>l(t.datum)+""==e.center+"");if(!u)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const d=u.x,p=u.y,h=a.map(e=>c(e.datum)).filter(e=>isFinite(e)&&e>=0),y=Math.max(...h,1),f=Math.min(t.width,t.height)/2,g=n.scaleLinear().domain([0,y]).range([0,f]);this.cartogramLayout={cx:d,cy:p,maxCost:y,availableRadius:f},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of a){if(e===u)continue;const t=Math.atan2(e.y-p,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-p,2)),o=c(e.datum),r=n+((isFinite(o)?g(o):n)-n)*s;e.x=d+Math.cos(t)*r,e.y=p+Math.sin(t)*r}const m=t.width/2,b=t.height/2,v=m-u.x,x=b-u.y;if(Math.abs(v)>.5||Math.abs(x)>.5)for(const e of a)e.x+=v,e.y+=x;this.cartogramLayout={cx:m,cy:b,maxCost:y,availableRadius:f};const k=this.scene.filter(e=>"line"===e.type);if(k.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of a)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of k){const n=null===(r=t.datum)||void 0===r?void 0:r.source,o=null===(i=t.datum)||void 0===i?void 0:i.target;if(n&&o){const r=e.get(n+""),i=e.get(o+"");r&&i&&(t.path=[r,i])}}}}applyDecay(){var e,t,n;const o=this.config.decay;if(!o||!this.pointBuffer)return;const r=this.pointBuffer.size;if(0===r)return;const i=null!==(e=o.minOpacity)&&void 0!==e?e:.1,a=null!==(t=o.halfLife)&&void 0!==t?t:r/2,s=null!==(n=o.stepThreshold)&&void 0!==n?n:.5*r,l=this.scene.filter(e=>"point"===e.type);for(let e=0;l.length>e;e++){const t=r-1-e;let n;switch(o.type){case"exponential":n=i+Math.pow(.5,t/a)*(1-i);break;case"step":n=s>t?1:i;break;default:n=i+(r>1?1-t/(r-1):1)*(1-i)}l[e]._decayOpacity=n,l[e].style=Object.assign(Object.assign({},l[e].style),{opacity:n})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),a=this.timestampBuffer.toArray();for(let e=0;i.length>e&&a.length>e;e++){const s=r-a[e];o>s&&(i[e]._pulseIntensity=1-s/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of i)if(e.pointId){const t=r.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(a=!0))}a&&(this.activeTransition={startTime:performance.now(),duration:o})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=f(e.x,e._targetX,n),e.y=f(t,e._targetY,n)}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0);return this.activeTransition=null,!1}return!0}}function M(e,t,n,o,r,i){const a=e.filter(e=>"point"===e.type);let s=null,l=o;for(const e of a){const o=e.x-t,r=e.y-n,i=Math.sqrt(o*o+r*r);Math.max((e.r||4)+5,12)>=i&&l>i&&(s=e,l=i)}if(s)return{node:s,distance:l};const c=e.filter(e=>"geoarea"===e.type&&!1!==e.interactive);for(let e=c.length-1;e>=0;e--){const o=c[e],[[i,a],[s,l]]=o.bounds;if(!(i>t||t>s||a>n||n>l)&&(o._cachedPath2D||(o._cachedPath2D=new Path2D(o.pathData)),r.isPointInPath(o._cachedPath2D,t,n)))return{node:o,distance:0}}const u=e.filter(e=>"line"===e.type);let d=null,p=o;for(const e of u){const{path:o}=e;for(let r=0;o.length-1>r;r++){const[i,a]=o[r],[s,l]=o[r+1],c=C(t,n,i,a,s,l);Math.max((e.style.strokeWidth||2)+4,5)>=c&&p>c&&(d=e,p=c)}}return d?{node:d,distance:p}:null}function C(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}const $={fill:e=>p.createElement("rect",{style:e,width:16,height:16}),line:e=>p.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function z(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,$[n])(o(e,t)),r}function L(){return p.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function P(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function R({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+p.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(p.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return p.createElement("g",{"aria-label":i||"Gradient legend"},p.createElement("defs",null,p.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},c)),i&&p.createElement("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),p.createElement("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),p.createElement("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])),p.createElement("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])))}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(p.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return p.createElement("g",{"aria-label":i||"Gradient legend"},i&&p.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),p.createElement("defs",null,p.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},c)),p.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),p.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])),p.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])))}function I(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical"}=e,[d,h]=p.useState(0),[y,f]=p.useState(0),g=p.useCallback((e,t)=>{h(e),f(t)},[]),m="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c})=>{let u=24;const d=[];return e.forEach((e,h)=>{u+=5,d.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+h,stroke:"gray",x1:0,y1:u,x2:t,y2:u})),u+=8,e.label&&(u+=16,d.push(p.createElement("text",{key:"legend-text-"+h,y:u,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label)),u+=8),d.push(p.createElement("g",{key:"legend-group-"+h,className:"legend-item",transform:`translate(0,${u})`},((e,t,n,o,r,i,a,s,l,c)=>{const{type:u="fill",styleFn:d,items:h}=e,y=[];let f=0;const g=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return h.forEach((e,c)=>{const b=z(e,c,u,d),v=P(e,o,r),x=r&&r.size>0&&r.has(e.label);y.push(p.createElement("g",{key:"legend-item-"+c,transform:`translate(0,${f})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:g?s===i&&c===a?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&m?x||!1:void 0,"aria-current":g&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:g?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+h.length)%h.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:g?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:g?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},g&&p.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&p.createElement(L,null),p.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),f+=22}),y})(e,n,o,r,i,a,s,h,l,c))),u+=22*e.items.length+8}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:a}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=0;const h=[];e.forEach((e,t)=>{let y=0;e.label&&(y+=16);const f=((e,t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:y}=e,f=[];let g=0,m=0;const b=!(!t&&!n),v="isolate"===c||void 0===c&&null!=r;y.forEach((e,c)=>{const x=z(e,c,d,h),k=P(e,o,r),w=r&&r.size>0&&r.has(e.label),A=26+7*e.label.length;u&&u>0&&g>0&&g+A>u&&(m++,g=0),f.push(p.createElement("g",{key:"legend-item-"+c,transform:`translate(${g},${22*m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:b?s===i&&c===a?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&v?w||!1:void 0,"aria-current":b&&!v&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:b?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(c+("ArrowRight"===n.key?1:-1)+y.length)%y.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:b?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},b&&p.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&p.createElement(L,null),p.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),g+=A});let x=0,k=0;for(const e of y){const t=26+7*e.label.length;u&&u>0&&k>0&&k+t>u?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:f,offset:x,totalRows:w,totalHeight:22*w}})(e,o,r,i,a,s,l,t,c,u,n);y+=f.offset+5,h.push(Object.assign(Object.assign({label:e.label},f),{offset:y,totalRows:f.totalRows,totalHeight:f.totalHeight})),d+=y+12});let y=d>n?0:Math.max(0,(n-d)/2);const f=[];return h.forEach((n,o)=>{const r=e[o];r.label&&(f.push(p.createElement("text",{key:"legend-text-"+o,transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),y+=16),f.push(p.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${y},0)`},n.items)),y+=n.offset+5,e[o+1]&&f.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:y,y1:-8,x2:y,y2:(n.totalHeight||t)+0+8})),y+=12}),p.createElement("g",null,f)})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:a}),b=!(!n&&!o);return p.createElement("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==s&&""!==s&&"vertical"===u&&p.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},s),m)}function B(e){return"string"==typeof e?{type:e}:e}function D({orient:t,config:n,values:r,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(n),c="top"===t||"bottom"===t,u=e.useMemo(()=>{if(0===r.length)return null;const e=i.domain(),n=a-8;if("boxplot"===l.type){const e=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!e)return null;const{q1:o,median:a,q3:s,whiskerLow:u,whiskerHigh:d}=e,h=Math.min(.5*n,20),y=(n-h)/2+4;if(c){const e=i(o),n=i(s),r=i(a),c=i(u),f=i(d),g="top"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:c,y1:m+g*(y+h/2),x2:f,y2:m+g*(y+h/2),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:c,y1:m+g*y,x2:c,y2:m+g*(y+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:f,y1:m+g*y,x2:f,y2:m+g*(y+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:Math.min(e,n),y:"top"===t?m-y-h:m+y,width:Math.abs(n-e),height:h,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:r,y1:"top"===t?m-y-h:m+y,x2:r,y2:"top"===t?m-y:m+y+h,stroke:l.fill,strokeWidth:2}))}{const e=i(o),n=i(s),r=i(a),c=i(u),f=i(d),g="left"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:m+g*(y+h/2),y1:c,x2:m+g*(y+h/2),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+g*y,y1:c,x2:m+g*(y+h),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+g*y,y1:f,x2:m+g*(y+h),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:"left"===t?m-y-h:m+y,y:Math.min(e,n),width:h,height:Math.abs(n-e),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:"left"===t?m-y-h:m+y,y1:r,x2:"left"===t?m-y:m+y+h,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=o.bin().domain(e).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return p.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((e,o)=>{if(null==e.x0||null==e.x1)return null;const r=e.length/d*n;if(c){const n=i(e.x0),a=i(e.x1)-i(e.x0);return p.createElement("rect",{key:o,x:n,y:"top"===t?-4-r:4,width:Math.max(a,.5),height:r,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const n=i(e.x0),a=i(e.x1)-i(e.x0);return p.createElement("rect",{key:o,x:"left"===t?-4-r:4,y:Math.min(n,n+a),width:r,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const e=n/2+4,o=[];for(const r of u){if(null==r.x0||null==r.x1)continue;const a=r.length/d*(n/2),s=i((r.x0+r.x1)/2);o.push(c?`${s},${"top"===t?-(e-a):e-a}`:`${"left"===t?-(e-a):e-a},${s}`)}for(let r=u.length-1;r>=0;r--){const a=u[r];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(n/2),l=i((a.x0+a.x1)/2);o.push(c?`${l},${"top"===t?-(e+s):e+s}`:`${"left"===t?-(e+s):e+s},${l}`)}return p.createElement("g",{"data-testid":"marginal-violin-"+t},p.createElement("polygon",{points:o.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const e=[];if(c){const o=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${r},${o}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,a=i((o.x0+o.x1)/2);e.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;e.push(`L${a},${o}`),e.push("Z")}else{const o=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${o},${r}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,a=i((o.x0+o.x1)/2);e.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;e.push(`L${o},${a}`),e.push("Z")}return p.createElement("g",{"data-testid":"marginal-ridgeline-"+t},p.createElement("path",{d:e.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,a,s,t,c,4]);return u?p.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function N(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function T(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 W(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:y,events:f={},"data-testid":g}=e,m=new Set(Array.isArray(y)?y:[]);let b=o||0,v=r||0;null!=i&&(b=i-t),null!=a&&(v=a-n);const x="string"==typeof u?u:"label";if("bracket"===x&&c&&0===b&&0===v)if(void 0!==c.width){b=c.width/2;const e=c.depth||30;v=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;b=e+(0>e?-5:5),v=c.height/2}return p.createElement("g",Object.assign({className:("annotation "+(h||"")).trim(),transform:`translate(${t},${n})`,"data-testid":g},f),!m.has("connector")&&function(e,t,n,o,r,i){const a=[];let s=0,l=0;if("callout-circle"!==r&&"label"!==r||!(null==i?void 0:i.radius)){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=o/2,p=e*d>t*u?u/e:d/t;s=r+a*p,l=i+c*p}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);s=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-s,2)+Math.pow(t-l,2))>.5&&(a.push(p.createElement("line",{key:"connector-line",x1:s,y1:l,x2:e,y2:t,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,i=Math.atan2(t-l,e-s);a.push(p.createElement("path",{key:"connector-arrow",d:`M${s},${l}L${s+n*Math.cos(i+r)},${l+n*Math.sin(i+r)}L${s+n*Math.cos(i-r)},${l+n*Math.sin(i-r)}Z`,fill:o||"currentColor",stroke:"none"}))}return p.createElement("g",{className:"annotation-connector"},a)}(b,v,l,d,x,c),!m.has("subject")&&function(e,t,n,o,r){var i;const a=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&a.push(p.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&a.push(p.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&a.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,i=r||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;a.push(p.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;a.push(p.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?a.push(p.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||a.push(p.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&a.push(p.createElement("path",{key:"bracket-path",d:T((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"currentColor"}));break}}return p.createElement("g",{className:"annotation-subject"},a)}(x,c,d,t,n),!m.has("note")&&function(e,t,n,o){if(!e)return p.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return p.createElement("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const y=16,f=i?c?[i]:N(i,l):[],g=r?c?[r]:N(r,l):[],m="leftRight"===u?"end"===h?-4:4:0;let b=0;const v=[];f.length>0&&(v.push(p.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:h,fontWeight:"bold"},f.map((e,t)=>p.createElement("tspan",{key:t,x:m,dy:0===t?0:y},e)))),b=f.length*y),g.length>0&&v.push(p.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:h,y:b},g.map((e,t)=>p.createElement("tspan",{key:t,x:m,dy:0===t?0:y},e))));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=p.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(f.length+g.length)*y+(g.length>0?y:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=p.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const k=Math.max(0,f.length+g.length-1)*y;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===d?-(k+y+(g.length>0&&f.length>0?2:0))/2+8:"bottom"===d||0>n?-(k+2):18),p.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},p.createElement("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0},v),x)}(s,b,v,d))}function _(e){var t,n;const{noteData:o}=e,{screenCoordinates:r}=o,i="string"==typeof o.type?o.type:"label",a=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),a=o.ny||r[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),s=r.map((t,n)=>{const r=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:a});return p.createElement(W,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return p.createElement("g",null,s)}const s=o.note||{title:"none",label:o.label};return p.createElement(W,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${o.i}`,events:a},o,{type:i}))}function F(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function H(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 q(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],p=l[e.yAccessor||"y"];return null==d||null==p?null:{x:c(d),y:u(p)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=F(e,n),c=H(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 G(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const V={linear:i.curveLinear,monotoneX:i.curveMonotoneX,monotoneY:i.curveMonotoneY,step:i.curveStep,stepAfter:i.curveStepAfter,stepBefore:i.curveStepBefore,basis:i.curveBasis,cardinal:i.curveCardinal,catmullRom:i.curveCatmullRom};let U={positions:new Map};const Z=new Set;function Y(){for(const e of Z)e()}function X(e,t){const n=U.positions.get(e);if(!n||n.sourceId!==t)return;const o=new Map(U.positions);o.delete(e),U={positions:o},Y()}function K(){return U}function J(e){return Z.add(e),()=>Z.delete(e)}const Q={positions:new Map};function ee(){return()=>{}}function te(){return Q}function ne(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 oe(e,t,n){return Math.round(100*e)/100+""}function re(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function ie(e,t){return e instanceof Date&&(!(t&&t instanceof Date)||e.getFullYear()!==t.getFullYear()||e.getMonth()!==t.getMonth()||e.getDate()!==t.getDate())}function ae(t){var n,o;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:y,axes:f,xLabel:g,yLabel:m,yLabelRight:b,xFormat:v,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:j,legendClickBehavior:E,legendHighlightedCategory:O,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:C,marginalGraphics:$,xValues:z,yValues:L,annotations:P,svgAnnotationRules:N,xAccessor:T,yAccessor:W,annotationData:U,pointNodes:Z,curve:Y,underlayRendered:X,linkedCrosshairName:Q,linkedCrosshairSourceId:ae,children:se}=t,le=e.useMemo(()=>{var e;if(!y||!d)return[];const t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||v||oe,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 re(s,Math.max(55,l+8))},[y,d,f,v,a]),ce=e.useMemo(()=>{var e;if(!y||!d)return[];const t=null==f?void 0:f.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||oe,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return re(d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22)},[y,d,f,x,s]),ue=e.useMemo(()=>{var e;if(!y||!d)return[];const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||oe,o=null!==(e=t.ticks)&&void 0!==e?e:5;return re(d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22)},[y,d,f,x,s]),de=e.useRef(new Map),pe=e.useRef(null!==(n=null==P?void 0:P.length)&&void 0!==n?n:0),he=null!==(o=null==P?void 0:P.length)&&void 0!==o?o:0;pe.current!==he&&(pe.current=he,de.current=new Map);const ye=e.useMemo(()=>{if(!P||0===P.length)return null;const e=function(e,t,n){var o,a,s,l,c,u,d,y,f,g,m,b,v,x,k,w,A,j,E,O,S,M,C,$,z,L,P,R,I,B,D,N,T,W,U,Z,Y,X,K,J,Q,ee,te,ne,oe,re,ie,ae;switch(e.type){case"label":{const o=q(e,t,n);if(!o)return null;const{x:r,y:i}=o;return G(r,i,n)?p.createElement(_,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{const o=q(e,t,n);if(!o)return null;const{x:r,y:i}=o;return G(r,i,n)?p.createElement(_,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=F(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let a;return a="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12,p.createElement("g",{key:"ann-"+t},p.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:o+4,y:a,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=H(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,s;return"left"===i?(a=4,s="start"):"center"===i?(a=(n.width||0)/2,s="middle"):(a=(n.width||0)-4,s="end"),p.createElement("g",{key:"ann-"+t},p.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:a,y:o-4,textAnchor:s,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:F(Object.assign(Object.assign({},e),{type:"point"}),n),y:H(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const i=r.packEnclose(o),a=e.padding||10;return p.createElement("g",{key:"ann-"+t},p.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&p.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:F(Object.assign(Object.assign({},e),{type:"point"}),n),y:H(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=e.padding||10,i=o.map(e=>e.x),a=o.map(e=>e.y),s=Math.min(...i)-r,l=Math.max(...i)+r,c=Math.min(...a)-r,u=Math.max(...a)+r;return p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:s,y:c,width:l-s,height:u-c,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&p.createElement("text",{x:(s+l)/2,y:c-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return p.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=F(t,n),a=H(t,n);if(null==r||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return p.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:a,r:s},l))}))}case"bracket":{const o=F(e,n),r=H(e,n);return p.createElement(_,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=r?r:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const r=n.data||[];if(2>r.length)return null;const i=n.xAccessor||"x",y=n.yAccessor||"y",f=r.map(e=>[e[i],e[y]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const g=null!==(a=null===(o=n.scales)||void 0===o?void 0:o.x)&&void 0!==a?a:null===(s=n.scales)||void 0===s?void 0:s.time,m=null!==(c=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=n.scales)||void 0===u?void 0:u.value;if(!g||!m)return null;const b=e.method||"linear";let v;v="loess"===b?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,p=0,h=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],p+=t*i[e],h+=t*r[e]*r[e],y+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const f=u*h-d*d;if(1e-12>Math.abs(f))s.push([t,p/u]);else{const e=(u*y-d*p)/f;s.push([t,(p-e*d)/u+e*t])}}return s}(f,null!==(d=e.bandwidth)&&void 0!==d?d:.3):("polynomial"===b?h.default.polynomial(f,{order:e.order||2}):h.default.linear(f)).points;const x=v.map(([e,t])=>`${g(e)},${m(t)}`).join(" "),k=e.color||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("polyline",{points:x,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:g(v[v.length-1][0])+4,y:m(v[v.length-1][1])-4,fill:k,fontSize:11},e.label))}case"band":{const o=null!==(f=null===(y=n.scales)||void 0===y?void 0:y.y)&&void 0!==f?f:null===(g=n.scales)||void 0===g?void 0:g.value,r=null!==(m=null==o?void 0:o(e.y0))&&void 0!==m?m:0,i=null!==(b=null==o?void 0:o(e.y1))&&void 0!==b?b:n.height||0;return p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:Math.min(r,i)-4,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",a=null!==(x=null===(v=n.scales)||void 0===v?void 0:v.x)&&void 0!==x?x:null===(k=n.scales)||void 0===k?void 0:k.time,s=null!==(A=null===(w=n.scales)||void 0===w?void 0:w.y)&&void 0!==A?A:null===(j=n.scales)||void 0===j?void 0:j.value;if(!a||!s)return null;const l=e.upperAccessor||"upperBounds",c=e.lowerAccessor||"lowerBounds",u=e.filter,d=o.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[r]-t[r]);if(2>d.length)return null;const h=V[n.curve||"linear"]||i.curveLinear,y=i.area().x(e=>a(e[r])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!y)return null;const f=e.fill||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("path",{d:y,fill:f,fillOpacity:null!==(E=e.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.label&&d.length>0&&p.createElement("text",{x:a(d[d.length-1][r])+4,y:s(d[d.length-1][l])-4,fill:f,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(S=null===(O=n.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(M=n.scales)||void 0===M?void 0:M.time,a=null!==($=null===(C=n.scales)||void 0===C?void 0:C.y)&&void 0!==$?$:null===(z=n.scales)||void 0===z?void 0:z.value;if(!i||!a)return null;const s=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+Math.pow(t-l,2),0)/s.length,u=Math.sqrt(c),d=null!==(L=e.threshold)&&void 0!==L?L:2,h=l-d*u,y=!1!==e.showBand,f=e.fill||"#6366f1",g=null!==(P=e.fillOpacity)&&void 0!==P?P:.1,m=e.anomalyColor||"#ef4444",b=null!==(R=e.anomalyRadius)&&void 0!==R?R:6,v=a(l+d*u),x=a(h),k=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return p.createElement("g",{key:"ann-"+t},y&&p.createElement("rect",{x:0,y:Math.min(v,x),width:n.width||0,height:Math.abs(x-v),fill:f,fillOpacity:g}),k.map((e,t)=>{const o=F(e,n),r=H(e,n);return null==o||null==r?null:p.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:Math.min(v,x)-4,textAnchor:"end",fill:f,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",a=null!==(B=null===(I=n.scales)||void 0===I?void 0:I.x)&&void 0!==B?B:null===(D=n.scales)||void 0===D?void 0:D.time,s=null!==(T=null===(N=n.scales)||void 0===N?void 0:N.y)&&void 0!==T?T:null===(W=n.scales)||void 0===W?void 0:W.value;if(!a||!s)return null;const l=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=h.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;c=e=>s+a*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),y=Math.sqrt(d/Math.max(u-2,1)),f=l.reduce((e,t)=>e+t[0],0)/u,g=l.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(U=e.confidence)&&void 0!==U?U:.95,b=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,v=null!==(Z=e.steps)&&void 0!==Z?Z:5,x=l[u-1][0],k=(x-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;v>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=c(e),n=y*Math.sqrt(1+1/u+(g>0?Math.pow(e-f,2)/g:0))*b;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${A.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,E=A.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),O=`${a(x)},${s(c(x))}`,S=e.strokeColor||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:null!==(Y=e.fillOpacity)&&void 0!==Y?Y:.15,stroke:"none"}),p.createElement("polyline",{points:`${O} ${E}`,fill:"none",stroke:S,strokeWidth:null!==(X=e.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(K=e.strokeDasharray)&&void 0!==K?K:"6,3"}),e.label&&A.length>0&&p.createElement("text",{x:a(A[A.length-1].x)+4,y:s(A[A.length-1].yCenter)-4,fill:S,fontSize:11},e.label))}case"widget":{let o=null,r=null;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=q(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!G(o,r,n))return null;const i=null!==(J=e.dx)&&void 0!==J?J:0,a=null!==(Q=e.dy)&&void 0!==Q?Q:0,s=null!==(ee=e.width)&&void 0!==ee?ee:32,l=null!==(te=e.height)&&void 0!==te?te:32,c=null!==(ne=e.content)&&void 0!==ne?ne:p.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return p.createElement("foreignObject",{key:"ann-"+t,x:o+i-s/2,y:r+a-l/2,width:s,height:l,style:{overflow:"visible",pointerEvents:"auto"}},p.createElement("div",{style:{width:s,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},c))}case"text":{const o=q(e,t,n);if(!o)return null;const{x:r,y:i}=o;return p.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}case"category-highlight":{const o=e.category;if(null==o)return null;const r=null===(oe=n.scales)||void 0===oe?void 0:oe.o,i=null===(re=n.scales)||void 0===re?void 0:re.x,a=null===(ie=n.scales)||void 0===ie?void 0:ie.y,s=(null==r?void 0:r.bandwidth)?r:(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:null;if(!s)return null;const l=s(o);if(null==l)return null;const c=s.bandwidth(),u=e.color||"var(--semiotic-primary, #4589ff)",d=null!==(ae=e.opacity)&&void 0!==ae?ae:.15,h=e.label;return(n.projection?"vertical"===n.projection:s===i)?p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:l,y:0,width:c,height:n.height||0,fill:u,fillOpacity:d}),h&&p.createElement("text",{x:l+c/2,y:12,textAnchor:"middle",fill:u,fontSize:12,fontWeight:"bold"},h)):p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:0,y:l,width:n.width||0,height:c,fill:u,fillOpacity:d}),h&&p.createElement("text",{x:12,y:l+c/2,dominantBaseline:"middle",fill:u,fontSize:12,fontWeight:"bold"},h))}default:return null}},t={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:T,yAccessor:W,width:a,height:s,data:U,frameType:"xy",pointNodes:Z,curve:Y,stickyPositionCache:de.current};return P.map((n,o)=>{if(N){const r=N(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[P,N,a,s,T,W,U,d,Z,Y]),fe=function(t){var n;const o=e.useSyncExternalStore(t?J:ee,t?K:te,t?K:te);return t&&null!==(n=o.positions.get(t))&&void 0!==n?n:null}(Q);return y||w||A||C||$||ye&&ye.length>0||k||se||fe?p.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},p.createElement("title",null,"string"==typeof w?w:"XY Chart"),p.createElement("desc",null,"string"==typeof w?w+" — XY data visualization":"XY data visualization"),p.createElement("g",{transform:`translate(${u.left},${u.top})`},k&&d&&!X&&p.createElement("g",{className:"stream-grid"},le.map((e,t)=>p.createElement("line",{key:"xgrid-"+t,x1:e.pixel,y1:0,x2:e.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),ce.map((e,t)=>p.createElement("line",{key:"ygrid-"+t,x1:0,y1:e.pixel,x2:a,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),y&&d&&(()=>{const e=null==f?void 0:f.find(e=>"left"===e.orient),t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=!e||!1!==e.baseline,o=(null==e?void 0:e.jaggedBase)||!1,r=(null==t?void 0:t.jaggedBase)||!1,i=null==t?void 0:t.landmarkTicks,l=null==e?void 0:e.landmarkTicks,c="var(--semiotic-border, #ccc)",d="var(--semiotic-text-secondary, var(--semiotic-text, #666))",h="var(--semiotic-text, #333)";return p.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!X&&(!t||!1!==t.baseline)&&!r&&p.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:c,strokeWidth:1}),!X&&r&&p.createElement("path",{d:ne("bottom",a,s),fill:"none",stroke:c,strokeWidth:1}),le.map((e,t)=>{const n=!!i&&("function"==typeof i?i(e.value,t):ie(e.value,t>0?le[t-1].value:void 0));return p.createElement("g",{key:"xtick-"+t,transform:`translate(${e.pixel},${s})`},p.createElement("line",{y2:5,stroke:c,strokeWidth:1}),p.createElement("text",{y:18,textAnchor:"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:d,style:{userSelect:"none"}},e.label))}),g&&p.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:h,style:{userSelect:"none"}},g),!X&&n&&!o&&p.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:c,strokeWidth:1}),!X&&o&&p.createElement("path",{d:ne("left",a,s),fill:"none",stroke:c,strokeWidth:1}),ce.map((e,t)=>{const n=!!l&&("function"==typeof l?l(e.value,t):ie(e.value,t>0?ce[t-1].value:void 0));return p.createElement("g",{key:"ytick-"+t,transform:`translate(0,${e.pixel})`},p.createElement("line",{x2:-5,stroke:c,strokeWidth:1}),p.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:d,style:{userSelect:"none"}},e.label))}),(()=>{const t=(null==e?void 0:e.label)||m;return t?p.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:h,transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},t):null})(),(()=>{const e=null==f?void 0:f.find(e=>"right"===e.orient);if(!e||0===ue.length)return null;const t=e.landmarkTicks,n=e.label||b;return p.createElement(p.Fragment,null,!1!==e.baseline&&p.createElement("line",{x1:a,y1:0,x2:a,y2:s,stroke:c,strokeWidth:1}),ue.map((e,n)=>{const o=!!t&&("function"==typeof t?t(e.value,n):ie(e.value,n>0?ue[n-1].value:void 0));return p.createElement("g",{key:"ytick-r-"+n,transform:`translate(${a},${e.pixel})`},p.createElement("line",{x2:5,stroke:c,strokeWidth:1}),p.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:d,style:{userSelect:"none"}},e.label))}),n&&p.createElement("text",{x:a+u.right-15,y:s/2,textAnchor:"middle",fontSize:12,fill:h,transform:`rotate(90, ${a+u.right-15}, ${s/2})`,style:{userSelect:"none"}},n))})())})(),ye,$&&d&&z&&L&&p.createElement(p.Fragment,null,$.top&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(D,{orient:"top",config:B($.top),values:z,scale:d.x,size:u.top,length:a})),$.bottom&&p.createElement("g",{transform:`translate(0, ${s})`},p.createElement(D,{orient:"bottom",config:B($.bottom),values:z,scale:d.x,size:u.bottom,length:a})),$.left&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(D,{orient:"left",config:B($.left),values:L,scale:d.y,size:u.left,length:s})),$.right&&p.createElement("g",{transform:`translate(${a}, 0)`},p.createElement(D,{orient:"right",config:B($.right),values:L,scale:d.y,size:u.right,length:s}))),C,fe&&fe.sourceId!==ae&&(null==d?void 0:d.x)&&(()=>{const e=d.x(fe.xValue);return null==e||0>e||e>a?null:p.createElement("line",{x1:e,y1:0,x2:e,y2:s,stroke:"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:1,strokeDasharray:"4,4",pointerEvents:"none"})})(),se),w&&p.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),function(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",title:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const h="top"===i||"bottom"===i;let y,f;return"left"===i?(y=4,f=r.top):"top"===i?(y=0,f=a?32:8):"bottom"===i?(y=0,f=o-r.bottom+50):(y=n-r.right+10,f=r.top),p.createElement("g",{transform:`translate(${y}, ${f})`},"object"==typeof(g=t)&&null!==g&&"gradient"in g?p.createElement(R,{config:t.gradient,orientation:h?"horizontal":"vertical",width:h?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?p.createElement(I,{legendGroups:t.legendGroups,title:"",width:h?n:100,orientation:h?"horizontal":"vertical",customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t);var g}({legend:A,totalWidth:l,totalHeight:c,margin:u,legendPosition:M,title:w,legendHoverBehavior:j,legendClickBehavior:E,legendHighlightedCategory:O,legendIsolatedCategories:S})):null}function se(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const le="undefined"==typeof window||"undefined"==typeof document,ce=p.createContext(null),ue={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function de(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const pe=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},he={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},ye={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},fe={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},ge={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},me={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},be={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},ve={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function xe({scene:e,chartType:t,tableId:n,chartTitle:o}){var r;const[i,a]=p.useState(!1),s=p.useContext(ce),l=null!==(r=null==s?void 0:s.visible)&&void 0!==r&&r,c=i||l,u=p.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t,h=p.useCallback(()=>{i||l||a(!0)},[i,l]),y=p.useCallback(e=>{var t;l||(null===(t=u.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[l]);if(!e||0===e.length)return n?p.createElement("span",{id:n,tabIndex:-1,style:ue}):null;if(!c)return p.createElement("div",{id:n,tabIndex:-1,onFocus:h,style:ue,role:"region","aria-label":d},p.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",e.length," elements)"));const f=function(e){var t,n,o,r,i,a,s,l,c,u,d,p,h,y,f,g,m,b,v,x,k,w,A,j,E;const O=[];if(!Array.isArray(e))return O;for(const S of e)if(S&&"object"==typeof S)try{switch(S.type){case"point":O.push({label:"Point",values:{x:S.x,y:S.y}});break;case"line":{const e=S.path,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&O.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=S.topPath,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&O.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=S.datum&&"object"==typeof S.datum?S.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:S.group)&&void 0!==n?n:"",a=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;O.push({label:"Bar",values:{category:i,value:null!=a?a:""}});break}case"heatcell":O.push({label:"Cell",values:{x:S.x,y:S.y,value:S.value}});break;case"wedge":O.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(i=S.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:null===(s=S.datum)||void 0===s?void 0:s.label)&&void 0!==l?l:"",value:null!==(u=null===(c=S.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":O.push({label:"Node",values:{id:null!==(p=null===(d=S.datum)||void 0===d?void 0:d.id)&&void 0!==p?p:"",x:null!==(h=S.cx)&&void 0!==h?h:S.x,y:null!==(y=S.cy)&&void 0!==y?y:S.y}});break;case"arc":O.push({label:"Arc",values:{id:null!==(g=null===(f=S.datum)||void 0===f?void 0:f.id)&&void 0!==g?g:"",x:null!==(m=S.cx)&&void 0!==m?m:S.x,y:null!==(b=S.cy)&&void 0!==b?b:S.y}});break;case"candlestick":O.push({label:"Candlestick",values:{x:S.x,open:S.open,high:S.high,low:S.low,close:S.close}});break;case"geoarea":O.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(v=S.datum)||void 0===v?void 0:v.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=S.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(E=null===(j=S.datum)||void 0===j?void 0:j.value)&&void 0!==E?E:""}})}}catch(e){}return O}(e),g=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(f),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${pe(e.min)} to ${pe(e.max)}, mean ${pe(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(f.length,g),b=f.slice(0,5),v=new Set;for(const e of b)for(const t of Object.keys(e.values))v.add(t);const x=Array.from(v);return p.createElement("div",{ref:u,id:n,tabIndex:-1,onBlur:y,style:he,role:"region","aria-label":d},p.createElement("button",{type:"button",onClick:()=>{l&&s&&s.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:fe},"×"),p.createElement("div",{role:"note",style:ye},m),p.createElement("table",{role:"table","aria-label":"Sample data for "+t,style:ge},p.createElement("caption",{style:ve},"First ",b.length," of ",f.length," data points"),p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",{style:me},"type"),x.map(e=>p.createElement("th",{key:e,style:me},e)))),p.createElement("tbody",null,b.map((e,t)=>p.createElement("tr",{key:t},p.createElement("td",{style:be},e.label),x.map(t=>{return p.createElement("td",{key:t,style:be},null==(n=e.values[t])||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":pe(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"");var n}))))))}function ke({summary:e}){return e?p.createElement("div",{role:"note",style:ue},e):null}function we({tableId:e}){return p.createElement("a",{href:"#"+e,style:ue,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,ue)}},"Skip to data table")}function Ae({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Focused on data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+n}return p.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:ue},t)}const je="var(--semiotic-focus, #005fcc)";function Ee({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:a}){if(!e||!t)return null;const s=t.x+n.left,l=t.y+n.top;let c;if("rect"===r&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);c=p.createElement("rect",{x:s-e/2-3,y:l-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:je,strokeWidth:2,strokeDasharray:"4,2"})}else c=p.createElement("circle","wedge"===r?{cx:s,cy:l,r:12,fill:"none",stroke:je,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:l,r:8,fill:"none",stroke:je,strokeWidth:2,strokeDasharray:"4,2"});return p.createElement("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},c)}function Oe({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=p.useRef(null),[c,u]=p.useState(null);p.useLayoutEffect(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect();u(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,a,n,o]);let d;return d=c?`translate(${c.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${c.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`,p.createElement("div",{ref:l,className:a,style:{position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:s,width:"max-content"}},i)}function Se(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Me(e,t,n=.6){var o,r,i,a,s;if(!Se(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 Ce(e,t,n,o=.35){Se(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function $e(e){switch(e){case"monotoneX":return i.curveMonotoneX;case"monotoneY":return i.curveMonotoneY;case"cardinal":return i.curveCardinal;case"catmullRom":return i.curveCatmullRom;case"step":return i.curveStep;case"stepBefore":return i.curveStepBefore;case"stepAfter":return i.curveStepAfter;case"basis":return i.curveBasis;case"natural":return i.curveNatural;default:return null}}function ze(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 Le(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 Pe(e){return e.k}function Re(e){return[e.x,e.y]}function Ie(e){return function(){return e}}function Be([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function De(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 Ne(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Te(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 We{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 _e{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=Fe(a),l=He(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 Fe(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 He(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 qe(t){const n=e.createContext(null),o=Ge(t);return[function({children:o}){const r=e.useMemo(()=>Ge(t),[]);return p.createElement(n.Provider,{value:r,children:o})},t=>{var r;const i=null!==(r=e.useContext(n))&&void 0!==r?r:o,a=e.useRef(t);a.current=t;const s=e.useCallback(()=>a.current(i.getState()),[i]),l=e.useCallback(()=>a.current(i.getState()),[i]);return e.useSyncExternalStore(i.subscribe,s,l)}]}function Ge(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 Ve={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}},Ue={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}},Ze={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"},[Ye,Xe]=qe(e=>({theme:Ve,setTheme(t){e(e=>{if("light"===t)return{theme:Ve};if("dark"===t)return{theme:Ue};if("high-contrast"===t)return{theme:Ze};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Ue:Ve;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||{})})}})}})),Ke={top:10,right:10,bottom:10,left:10},Je={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"},Qe={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 et({data:e}){if(!e)return null;if(e.properties)return p.createElement("div",{className:"semiotic-tooltip",style:Je},p.createElement("div",{style:{fontWeight:600}},e.properties.name||e.properties.NAME||e.properties.id||"Feature"));const t=Object.entries(e).slice(0,3);return p.createElement("div",{className:"semiotic-tooltip",style:Je},t.map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,": "),p.createElement("span",{style:{fontWeight:600}},t+""))))}const tt=e.forwardRef(function(t,n){var o,r,a,c,u,d,h,y,f,g;const{projection:m,projectionExtent:b,fitPadding:v,projectionTransform:x,areas:k,points:w,lines:A,xAccessor:j,yAccessor:E,lineDataAccessor:O,pointIdAccessor:C,lineType:$="geo",flowStyle:z="basic",graticule:L,zoomable:P,zoomExtent:R,onZoom:I,dragRotate:B,showParticles:D,particleStyle:N,tileURL:T,tileAttribution:W,tileCacheSize:_,size:F,width:H,height:q,responsiveWidth:G,responsiveHeight:V,margin:U,className:Z,background:Y,areaStyle:X,pointStyle:K,lineStyle:J,colorScheme:Q,enableHover:ee=!0,hoverAnnotation:te,tooltipContent:ne,customClickBehavior:oe,customHoverBehavior:re,annotations:ie,decay:ce,pulse:ue,transition:pe,staleness:he,backgroundGraphics:ye,foregroundGraphics:fe,title:ge,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:je,legendHighlightedCategory:Se,legendIsolatedCategories:Fe,showAxes:He,accessibleTable:qe=!0,description:Ge,summary:Ve}=t,Ue=function(){const[t,n]=e.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return e.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),t}(),Ze=e.useRef(Ue);Ze.current=Ue;const Ye="semiotic-table-"+p.useId(),Je=F||[H||600,q||400],[tt,nt]=function(t,n,o){const r=e.useRef(null),[i,a]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&i?i.w:t[0],o&&i?i.h:t[1]]]}(Je,G,V),ot=e.useMemo(()=>Object.assign(Object.assign({},Ke),U),[U]),rt=nt[0]-ot.left-ot.right,it=nt[1]-ot.top-ot.bottom,at="function"==typeof fe?fe({size:nt,margin:ot}):fe,st="function"==typeof ye?ye({size:nt,margin:ot}):ye,lt=e.useMemo(()=>null!=B?B:"orthographic"===("string"==typeof m?m:"object"==typeof m&&"type"in m?m.type:null),[B,m]),ct=e.useMemo(()=>({projection:m,projectionExtent:b,fitPadding:v,xAccessor:j,yAccessor:E,lineDataAccessor:O,lineType:$,flowStyle:z,areaStyle:X,pointStyle:K,lineStyle:J,colorScheme:Q,graticule:L,projectionTransform:x,decay:ce,pulse:ue,transition:pe,annotations:ie,pointIdAccessor:C}),[m,b,v,j,E,O,$,z,X,K,J,Q,L,x,ce,ue,pe,ie,C]),ut=e.useRef(null);ut.current||(ut.current=new S(ct));const dt=e.useRef(null),pt=e.useRef(null),ht=e.useRef(null),yt=e.useRef(null),ft=e.useRef(null);T&&!ft.current&&(ft.current=new We(_||256));const gt=e.useRef(0),mt=e.useRef(!0),bt=Xe(e=>e.theme),vt=e.useRef(ie),xt=e.useRef(()=>{}),kt=e.useRef(null),wt=e.useRef(s.zoomIdentity),At=e.useRef(!1),jt=e.useRef(null),Et=e.useRef(null),Ot=e.useRef(null),St=e.useRef(null),Mt=e.useRef(0);if(D&&!St.current){const e=null!==(o=null==N?void 0:N.maxPerLine)&&void 0!==o?o:30;St.current=new _e(50*e)}const Ct=e.useRef(null),$t=e.useRef(null),[zt,Lt]=e.useState(null),[Pt,Rt]=e.useState(0),[It,Bt]=e.useState(!1),Dt=e.useCallback(()=>{gt.current||(gt.current=requestAnimationFrame(()=>xt.current()))},[]);e.useEffect(()=>{mt.current=!0,Dt()},[bt,Dt]),e.useEffect(()=>{var e;null===(e=ut.current)||void 0===e||e.updateConfig(ct),mt.current=!0,Dt()},[ct,Dt]),e.useEffect(()=>{const e=ut.current;e&&(k&&e.setAreas(k),w&&e.setPoints(w),A&&e.setLines(A),mt.current=!0,Dt())},[k,w,A,Dt]);const Nt=e.useCallback(e=>{var t;null===(t=ut.current)||void 0===t||t.pushPoint(e),mt.current=!0,Dt()},[Dt]),Tt=e.useCallback(e=>{var t;null===(t=ut.current)||void 0===t||t.pushMany(e),mt.current=!0,Dt()},[Dt]),Wt=e.useCallback(()=>{var e;null===(e=ut.current)||void 0===e||e.clear(),mt.current=!0,Dt()},[Dt]);e.useImperativeHandle(n,()=>({push:Nt,pushMany:Tt,clear:Wt,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=ut.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=ut.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=ut.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>wt.current.k,resetZoom:()=>{const e=jt.current;e&&kt.current&&l.select(e).call(kt.current.transform,s.zoomIdentity)},getData:()=>{const e=ut.current;return e?e.scene.filter(e=>"point"===e.type).map(e=>e.datum).filter(Boolean):[]}}),[Nt,Tt,Wt]);const _t=e.useRef(()=>{});e.useEffect(()=>{_t.current=e=>{if(!ee)return;const t=ut.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-ot.left,r=e.clientY-n.top-ot.top;if(0>o||o>rt||0>r||r>it)return Ct.current=null,$t.current=null,Lt(null),null==re||re(null),void Dt();yt.current||(yt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=yt.current.getContext("2d");if(!i)return;const a=M(t.scene,o,r,30,i);if(a){const e=a.node,t=e.datum,n=(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let i,s;"point"===e.type?(i=e.x,s=e.y):"geoarea"===e.type?(i=e.centroid[0],s=e.centroid[1]):(i=o,s=r);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,x:i,y:s,time:0});Ct.current=l,$t.current=e,Lt(l),null==re||re({type:e.type,data:n,x:i,y:s}),Dt()}else Ct.current&&(Ct.current=null,$t.current=null,Lt(null),null==re||re(null),Dt())}},[ee,rt,it,ot,re,Dt]);const Ft=e.useCallback(()=>{Ct.current=null,$t.current=null,Lt(null),null==re||re(null),Dt()},[re,Dt]),Ht=e.useCallback(e=>{if(!oe)return;const t=ut.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-ot.left,r=e.clientY-n.top-ot.top;yt.current||(yt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=yt.current.getContext("2d");if(!i)return;const a=M(t.scene,o,r,30,i);if(a){const e=a.node.datum;oe({type:a.node.type,data:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,x:o,y:r})}},[oe,ot]),qt=e.useRef(-1),Gt=e.useRef(null),Vt=e.useCallback(e=>{const t=ut.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)"point"===n.type&&null!=n.x?t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"}):"geoarea"===n.type&&n.centroid&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"circle"});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=qt.current,r=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return qt.current=-1,Gt.current=null,Ct.current=null,$t.current=null,Lt(null),null==re||re(null),void Dt();const i=0>o?0:r;qt.current=i;const a=n[i];Gt.current={shape:a.shape,w:a.w,h:a.h};const s=function(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}(a);Ct.current=s,Lt(s);const l=a.datum;let c="point",u=l;l&&"object"==typeof l&&"geometry"in l&&(c="geoarea",l.properties&&"object"==typeof l.properties&&(u=Object.assign(Object.assign({},l),l.properties))),null==re||re({type:c,data:u,x:a.x,y:a.y}),Dt()},[re,Dt]),Ut=e.useCallback(e=>{qt.current=-1,Gt.current=null,_t.current(e)},[]);xt.current=()=>{var e,t,n,o,r,a,s;gt.current=0;const l=pt.current,c=ut.current;if(!l||!c)return;const u=performance.now();let d=!1;const p=Ot.current;p&&(Ot.current=null,c.applyRotation(p,{width:rt,height:it}));const h=c.advanceTransition(Ze.current?u+1e6:u),y=!Ze.current&&h;if(mt.current&&!h){const e={width:rt,height:it},t=lt?c.getRotation():null;c.computeScene(e);const n=wt.current,o=1!==n.k||0!==n.x||0!==n.y;lt&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),mt.current=!1,l.setAttribute("aria-label",de(c.scene,"Geographic chart"))}const f=Ne();if(T&&ft.current){const t=dt.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=De(t,nt,ot,f);if(e){e.clearRect(-ot.left,-ot.top,nt[0],nt[1]),e.save(),e.beginPath(),e.rect(0,0,rt,it),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=Pe,l=Re,c=0;function u(){const u=+s.apply(this,arguments),d=l.apply(this,arguments),p=Math.log2(u/a),h=Math.round(Math.max(p+c,0)),y=Math.pow(2,p-h)*a,f=+d[0]-u/2,g=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-f)/y)),b=Math.min(r?1<<h:1/0,Math.ceil((n-f)/y)),v=Math.max(i?0:-1/0,Math.floor((t-g)/y)),x=Math.min(i?1<<h:1/0,Math.ceil((o-g)/y)),k=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)k.push([t,e,h]);return k.translate=[f/y,g/y],k.scale=y,k}return u.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],u):[n-e,o-t]},u.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],u):[[e,t],[n,o]]},u.scale=function(e){return arguments.length?(s="function"==typeof e?e:Ie(+e),u):s},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:Ie([+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=Ne();let h=!0;for(const t of d){const[o,r,i]=Be(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=Te(n,i,o,r,p),c=t}if(!c.loaded){h=!1;continue}const u=d.scale;e.drawImage(c.img,(t[0]+d.translate[0])*u-.5,(t[1]+d.translate[1])*u-.5,u+1,u+1)}return h}(e,{tileURL:T,projection:c.scales.projection,width:rt,height:it,tileCache:ft.current,onTileLoad:()=>Dt()});e.restore(),t||(d=!0)}}}const g=De(l,nt,ot,f);if(!g)return;g.clearRect(-ot.left,-ot.top,nt[0],nt[1]),Y&&!T&&(g.fillStyle=Y,g.fillRect(0,0,rt,it)),g.save(),g.beginPath(),g.rect(0,0,rt,it),g.clip();const m=c.scene,b={height:it};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)}Ce(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(g,m),((e,t,n,o)=>{var r,a;const s=t.filter(e=>"line"===e.type);for(const l of s){if(2>l.path.length)continue;const c=l.style.stroke||"#007bff",u=l.style.strokeWidth||2,d=l.colorThresholds,p=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=u,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const g=null!==(r=l.style.opacity)&&void 0!==r?r:1;Le(e,l.path,c,u,g,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=$e(l.curve),y=d&&d.length>0&&p&&p.length===l.path.length,f=l._decayOpacities;if(f&&f.length===l.path.length&&!y){e.strokeStyle=c;const m=null!==(a=l.style.opacity)&&void 0!==a?a:1;for(let b=0;l.path.length-1>b;b++)e.globalAlpha=.5*(f[b]+f[b+1])*m,e.beginPath(),e.moveTo(l.path[b][0],l.path[b][1]),e.lineTo(l.path[b+1][0],l.path[b+1][1]),e.stroke()}else if(y){let v=null,x=null,k=null,w=null,A=!1;function j(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),A=!0}function E(){A&&(e.stroke(),A=!1)}for(let O=0;l.path.length>O;O++){const[S,M]=l.path[O],C=p[O],$=ze(C,d,c);if(null!==v&&null!==w&&null!==k){if($===w)e.lineTo(S,M);else{const z=[];for(const L of d){const P=L.value;(k>P||P>C)&&(P>k||C>P)||k===P||C===P||z.push({t:(P-k)/(C-k)})}z.sort((e,t)=>e.t-t.t);for(const R of z){const I=v+(S-v)*R.t,B=x+(M-x)*R.t,D=ze(k+(C-k)*Math.min(R.t+1e-4,1),d,c);e.lineTo(I,B),E(),j(D,I,B)}e.lineTo(S,M)}v=S,x=M,k=C,w=$}else j($,S,M),v=S,x=M,k=C,w=$}E()}else{if(e.beginPath(),e.strokeStyle=c,h)i.line().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(l.path);else{const[N,T]=l.path[0];e.moveTo(N,T);for(let W=1;l.path.length>W;W++)e.lineTo(l.path[W][0],l.path[W][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=l.style.fill,h&&!y)i.line().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(l.path);else{const[F,H]=l.path[0];e.moveTo(F,H);for(let q=1;l.path.length>q;q++)e.lineTo(l.path[q][0],l.path[q][1])}const _=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(_,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(g,m,0,b),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Me(e,t),e.globalAlpha=1}}finally{e.restore()}}})(g,m),D&&St.current){const e=St.current,i=m.filter(e=>"line"===e.type);if(i.length>0){const s=N||{},l=.3*(null!==(t=s.speedMultiplier)&&void 0!==t?t:1),c=null!==(n=s.maxPerLine)&&void 0!==n?n:30,p=null!==(o=s.spawnRate)&&void 0!==o?o:.15,h=null!==(r=s.radius)&&void 0!==r?r:2,y=null!==(a=s.opacity)&&void 0!==a?a:.7,f=u/1e3,m=Mt.current>0?Math.min(f-Mt.current,.1):.016;Mt.current=f;const b=i.map(e=>e.path),v=i.map(e=>e.style.strokeWidth||2);for(let t=0;i.length>t;t++)Math.random()<p&&e.countForLine(t)<c&&e.spawn(t);e.step(m,l,b,v),g.globalAlpha=y;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=i[n.lineIndex],r="function"==typeof s.color?s.color(null==o?void 0:o.datum):"source"!==s.color&&s.color?s.color:(null==o?void 0:o.style.stroke)||"#fff";g.beginPath(),g.arc(n.x,n.y,h,0,2*Math.PI),g.fillStyle=r,g.fill()}g.globalAlpha=1,d=!0}}g.restore();const v=ht.current;if(v){const e=De(v,nt,ot,f);if(e){e.clearRect(-ot.left,-ot.top,nt[0],nt[1]);const t=$t.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 te?te: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(he){const e=performance.now()-c.lastIngestTime>(null!==(s=he.threshold)&&void 0!==s?s:5e3);e!==It&&Bt(e)}const x=ie!==vt.current;x&&(vt.current=ie),(mt.current||x)&&Rt(e=>e+1),(y||c.hasActivePulses||d)&&(gt.current=requestAnimationFrame(()=>xt.current()))},e.useEffect(()=>(Dt(),()=>{var e;gt.current&&(cancelAnimationFrame(gt.current),gt.current=0),null===(e=ft.current)||void 0===e||e.clear()}),[Dt]),e.useEffect(()=>{mt.current=!0,Dt()},[rt,it,Y,Dt]),function(t,n,o,r,i,a){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const s=n.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),o.current=!0,r())},1e3);return()=>clearInterval(e)},[t,i,r])}(he,ut,mt,Dt,It,Bt),e.useEffect(()=>{if("production"!==process.env.NODE_ENV&&T){const e="string"==typeof m?m:"object"==typeof m&&"type"in m?m.type:null;e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[T,m]),e.useEffect(()=>{const e=jt.current;if(!P||!e)return kt.current&&e&&(l.select(e).on(".zoom",null),kt.current=null),void(e&&l.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=R||[1,8],o={width:rt,height:it};if(lt){let r=wt.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),wt.current=s.zoomIdentity.scale(r);const a=ut.current;a&&(a.applyZoomScale(r,o),mt.current=!1,Dt(),null==I||I({projection:null===(i=a.scales)||void 0===i?void 0:i.projection,zoom:a.currentZoom}))};kt.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const a=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},l=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",l);const c=.4,u=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=ut.current;if(!o)return;const r=o.getRotation();Et.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=Et.current;t&&(Ot.current=[t.rotation[0]+(e.clientX-t.x)*c,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*c)),t.rotation[2]],Dt())},p=t=>{var n;if(!Et.current)return;Et.current=null,e.releasePointerCapture(t.pointerId);const r=Ot.current;if(r){Ot.current=null;const e=ut.current;e&&(e.applyRotation(r,o),Dt())}const i=ut.current;i&&(null==I||I({projection:null===(n=i.scales)||void 0===n?void 0:n.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",p),e.addEventListener("pointercancel",p),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",l),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",p),e.removeEventListener("pointercancel",p),kt.current=null}}const r=s.zoom().scaleExtent([t,n]).extent([[0,0],[nt[0],nt[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;wt.current=t,At.current=!0;const n=ut.current;n&&(n.applyZoomTransform(t,o),mt.current=!1,Dt())}).on("end",e=>{var t;wt.current=e.transform,At.current=!1;const n=ut.current;n&&(null==I||I({projection:null===(t=n.scales)||void 0===t?void 0:t.projection,zoom:n.currentZoom}))});return kt.current=r,l.select(e).call(r),()=>{l.select(e).on(".zoom",null)}},[P,R,lt,nt,rt,it,ot,I,Dt]);const Zt=ee&&!1!==te,Yt=Zt&&zt?ne?ne(zt):p.createElement(et,{data:zt}):null,Xt=Yt?p.createElement(Oe,{x:zt.x,y:zt.y,containerWidth:rt,containerHeight:it,margin:ot,className:"stream-frame-tooltip",zIndex:10},Yt):null;if(le){const e=ut.current;e&&(k||w||A)&&(k&&e.setAreas(k),w&&e.setPoints(w),A&&e.setLines(A),e.computeScene({width:rt,height:it}));const t=null!==(r=null==e?void 0:e.scene)&&void 0!==r?r:[];return p.createElement("div",{className:"stream-geo-frame"+(Z?" "+Z:""),role:"img","aria-label":Ge||("string"==typeof ge?ge:"Geographic chart"),style:{position:"relative",width:nt[0],height:nt[1]}},p.createElement(ke,{summary:Ve}),p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:nt[0],height:nt[1],style:{position:"absolute",left:0,top:0}},p.createElement("g",{transform:`translate(${ot.left},${ot.top})`},st),p.createElement("g",{transform:`translate(${ot.left},${ot.top})`},Y&&p.createElement("rect",{x:0,y:0,width:rt,height:it,fill:Y}),t.map((e,t)=>function(e,t){var n,o,r,i,a,s;switch(e.type){case"geoarea":{const r=e;return r.pathData?p.createElement("path",{key:"geoarea-"+t,d:r.pathData,fill:se(r.style.fill,"#e0e0e0"),fillOpacity:null!==(n=r.style.fillOpacity)&&void 0!==n?n:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(o=r._decayOpacity)&&void 0!==o?o:1}):null}case"point":{const n=e;return p.createElement("circle",{key:"point-"+t,cx:n.x,cy:n.y,r:n.r,fill:se(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:null!==(i=n._decayOpacity)&&void 0!==i?i:null!==(a=n.style.opacity)&&void 0!==a?a:1})}case"line":{const n=e;if(2>n.path.length)return null;const o="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return p.createElement("path",{key:"line-"+t,d:o,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:null!==(s=n.style.opacity)&&void 0!==s?s:1})}default:return null}}(e,t)))),p.createElement(ae,{width:rt,height:it,totalWidth:nt[0],totalHeight:nt[1],margin:ot,scales:null,showAxes:!1,title:ge,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:je,legendHighlightedCategory:Se,legendIsolatedCategories:Fe,foregroundGraphics:at,annotations:ie,annotationFrame:0,xValues:[],yValues:[],pointNodes:t.filter(e=>"point"===e.type)}))}const Kt=e.useCallback(e=>{jt.current=e,tt&&"object"==typeof tt&&(tt.current=e)},[tt]);return p.createElement("div",{ref:Kt,className:"stream-geo-frame"+(Z?" "+Z:""),role:"group","aria-label":Ge||("string"==typeof ge?ge:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:G?"100%":nt[0],height:V?"100%":nt[1],overflow:"hidden"},P?{touchAction:"none"}:{}),onKeyDown:Vt},qe&&p.createElement(we,{tableId:Ye}),qe&&p.createElement(xe,{scene:null!==(c=null===(a=ut.current)||void 0===a?void 0:a.scene)&&void 0!==c?c:[],chartType:"Geographic chart",tableId:Ye,chartTitle:"string"==typeof ge?ge:void 0}),p.createElement(ke,{summary:Ve}),p.createElement("div",{role:"img","aria-label":Ge||("string"==typeof ge?ge:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Zt?Ut:void 0,onMouseLeave:Zt?Ft:void 0,onClick:oe?Ht:void 0},st&&p.createElement("svg",{style:{position:"absolute",left:0,top:0,width:nt[0],height:nt[1],pointerEvents:"none"}},p.createElement("g",{transform:`translate(${ot.left},${ot.top})`},st)),T&&p.createElement("canvas",{ref:dt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),p.createElement("canvas",{ref:pt,"aria-label":de(null!==(d=null===(u=ut.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),p.createElement("canvas",{ref:ht,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),p.createElement(Ae,{hoverPoint:zt}),p.createElement(ae,{width:rt,height:it,totalWidth:nt[0],totalHeight:nt[1],margin:ot,scales:null,showAxes:null!=He&&He,title:ge,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:je,legendHighlightedCategory:Se,legendIsolatedCategories:Fe,foregroundGraphics:at,annotations:ie,annotationFrame:Pt,xValues:[],yValues:[],pointNodes:null===(h=ut.current)||void 0===h?void 0:h.scene.filter(e=>"point"===e.type)}),(null==he?void 0:he.showBadge)&&p.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===he.badgePosition?{top:4,left:4}:"bottom-left"===he.badgePosition?{bottom:4,left:4}:"bottom-right"===he.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:It?"#dc3545":"#28a745",color:"white"})},It?"STALE":"LIVE"),P&&p.createElement("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:ot.bottom+8,left:ot.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2}},p.createElement("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=jt.current,n=kt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(l.select(t),1.5)},style:Qe},"+"),p.createElement("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=jt.current,n=kt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(l.select(t),1/1.5)},style:Qe},"−")),W&&p.createElement("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:ot.bottom+2,right:ot.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2}},W),p.createElement(Ee,{active:qt.current>=0,hoverPoint:zt,margin:ot,size:nt,shape:null===(y=Gt.current)||void 0===y?void 0:y.shape,width:null===(f=Gt.current)||void 0===f?void 0:f.w,height:null===(g=Gt.current)||void 0===g?void 0:g.h}),Xt))});tt.displayName="StreamGeoFrame";const nt={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 ot(e,t){return"function"==typeof t?t(e):e[t]}function rt(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 it(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=ot(e,n);a=rt(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=ot(e,r);s.push({label:n,value:rt(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=rt(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=rt(e[t[0]],o))}}const l=Object.assign(Object.assign({},nt),r);return p.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},a&&p.createElement("div",{style:{fontWeight:s.length>0?"bold":"normal"}},a),s.map((e,t)=>p.createElement("div",{key:t,style:{marginTop:0===t&&a?"4px":0}},e.label&&p.createElement("span",null,e.label,": "),e.value)))}}function at(e){if(!0===e)return it();if("function"==typeof e){const t=e;return e=>{const n=t(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==n?null:p.createElement("div",{className:"semiotic-tooltip",style:nt},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?it(e):it())}const st={category10:c.schemeCategory10,tableau10:c.schemeTableau10,set3:c.schemeSet3,blues:c.interpolateBlues,reds:c.interpolateReds,greens:c.interpolateGreens,oranges:c.interpolateOranges,purples:c.interpolatePurples,viridis:c.interpolateViridis,plasma:c.interpolatePlasma},lt=c.schemeCategory10,ct=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ut=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 dt(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")||ut.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):lt[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o+""))%lt.length]}function pt(e,t,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(r).range(o).unknown("#999");const a=st[o]||st.category10;if(i&&"function"==typeof a){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>a(Number(t)/e)}{const e=Array.isArray(a)?a:lt;return n.scaleOrdinal().domain(r).range(e).unknown("#999")}}function ht(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 yt=e.createContext(null);function ft(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 gt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[mt,bt]=qe(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=gt(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=gt(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}})}})),[vt,xt]=qe(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 kt(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=bt(e=>e.selections.get(r)),a=bt(e=>e.setClause),s=bt(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(ft(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:e.useCallback(()=>{s(r,o)},[s,r,o]),clientId:o}}function wt(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:a,clear:s}=kt({name:n});return{onHover:e.useCallback(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&a(t)},[o,a,s,n]),predicate:r,isActive:i}}const At=e.createContext(!1);function jt(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}function Et(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}p.createContext(void 0);const Ot="#007bff";function St(t,n,o){const r=e.useContext(yt),i=function(){var e;const t=Xe(e=>e.theme),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}();return e.useMemo(()=>{var e;if(!n)return;const a=null!==(e=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==e?e:"category10";if(0!==t.length){if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const t=pt(e.map(e=>({_cat:e})),"_cat",a);return e=>r[e]||t(e)}return pt(e.map(e=>({_cat:e})),"_cat",a)}if(r&&Object.keys(r).length>0){const e=pt(t,n,a);return t=>r[t]||e(t)}return pt(t,n,a)}if(r&&Object.keys(r).length>0){const e=pt([{_:"a"}],"_",a);return t=>r[t]||e(t)}},[t,n,o,r,i])}function Mt({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:a,chartId:s,onClick:l}){const c=e.useId(),u=jt(n,o),d=kt({name:(null==t?void 0:t.name)||"__unused__"}),p=wt({name:(null==u?void 0:u.name)||"hover",fields:(null==u?void 0:u.fields)||o||[]}),h=xt(e=>e.pushObservation),y=t?{isActive:d.isActive,predicate:d.predicate}:null,f=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==u?void 0:u.mode)&&u.xField){const e=null==t?void 0:t[u.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=U.positions.get(e);o&&o.xValue===t&&o.sourceId===n||(U={positions:new Map(U.positions).set(e,{xValue:t,sourceId:n})},Y())}(u.name||"hover",Number(e),c)}"x-position"!==(null==u?void 0:u.mode)&&p.onHover(t)}else"x-position"===(null==u?void 0:u.mode)&&X(u.name||"hover",c),"x-position"!==(null==u?void 0:u.mode)&&p.onHover(null);if(i||h){const n={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),h&&h(a)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),h&&h(e)}}},[n,p,u,c,i,a,s,h]),g=e.useCallback(e=>{var t,n,o,r;if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||h){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const a=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(a),h&&h(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),h&&h(e)}}},[l,i,h,a,s]);return e.useEffect(()=>{if("x-position"!==(null==u?void 0:u.mode))return;const e=u.name||"hover";return()=>{X(e,c)}},[null==u?void 0:u.mode,null==u?void 0:u.name,c]),{activeSelectionHook:y,customHoverBehavior:f,customClickBehavior:g,crosshairSourceId:c}}function Ct({data:t,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:s={top:50,bottom:60,left:70,right:40},categories:l}){const c=e.useContext(At),u=void 0!==r?r:!c&&!!n,d=e.useMemo(()=>{if(u&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):ct[i%ct.length];return{label:r+"",color:s}}),label:""}]}}({data:t,colorBy:n,colorScale:o,getColor:dt,categories:l})},[u,n,t,o,l]),p=e.useMemo(()=>{const e=Object.assign(Object.assign({},s),a);return d&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[s,a,d,i]);return{legend:d,margin:p,legendPosition:i}}const $t={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 zt(e,t,n){var o,r,i,a,s,l;const c=$t[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,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,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:Lt(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function Lt(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 Pt({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return p.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},p.createElement("div",{style:{textAlign:"center",maxWidth:400}},p.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),p.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&p.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},n)))}class Rt extends p.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:p.createElement(Pt,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function It(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 Bt(e,t,n=3){let o,r=n+1;for(const n of t){const t=It(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Dt(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Nt(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=Bt(e,t,3))&&void 0!==n?n:null)}const Tt={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Wt={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},_t={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Ft=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Ht=["vertical","horizontal"],qt={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),Wt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ft},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({},Tt),Wt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ft},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),Wt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Ft},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({},Tt),Wt),{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({},Tt),Wt),{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({},Tt),Wt),{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({},Tt),Wt),{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({},Tt),Wt),{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({},Tt),Wt),{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({},Tt),_t),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ht},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),_t),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ht},normalize:{type:"boolean"},barPadding:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),_t),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:Ht},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),_t),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ht},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),_t),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ht},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),_t),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ht},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),_t),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),_t),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ht},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),_t),{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({},Tt),_t),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ht},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Tt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Tt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),_t),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Tt),_t),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Tt),{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({},Tt),{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:Ht},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({},Tt),{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({},Tt),{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({},Tt),{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({},Tt),{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({},Tt),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function Gt(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Vt=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Ut=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Zt=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Yt=new Set(["LineChart","AreaChart","StackedAreaChart"]),Xt=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Kt(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 Jt(e,t){const n=Kt(e),o=Kt(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Qt=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function en(e,t){const n=[],o=function(e,t){const n=[],o=qt[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(qt).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(!Gt(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=Bt(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=Dt(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=Nt(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=Dt(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=Nt(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 qt[e]?(function(e,t,n){const o=qt[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=qt[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){Vt.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){Ut.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=qt[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(!Zt.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(!Yt.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=qt[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(!Xt.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=Jt(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=Jt(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of Qt)"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 tn;const nn="undefined"!=typeof process&&"production"!==(null===(tn=process.env)||void 0===tn?void 0:tn.NODE_ENV);function on({componentName:e,width:t,height:n,chartProps:o,children:r}){return p.createElement(Rt,{fallback:r=>{let i="";if(nn&&o)try{const t=en(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return p.createElement(Pt,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const rn={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"},an={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function sn(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?p.createElement("div",{style:Object.assign(Object.assign({},rn),{width:t,height:n})},o||"No data available"):null}function ln(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*o))),i=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(r+i)-i))/2);return p.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>p.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},an),{position:"absolute",top:a+n*(r+i),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})})))}function cn(e,t,n,o){if(!nn)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 un(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 dn(e){return e}function pn(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 dn;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 hn=new Map;function yn(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function fn(e){return un(this,void 0,void 0,function*(){const t=hn.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return un(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:yn(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:yn(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:yn(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:yn(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 pn(e,t)})}:pn(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return hn.set(e,i),i})}function gn(t){const n=e.useMemo(()=>Array.isArray(t)?t:void 0,[t]),[o,r]=e.useState(null);return e.useEffect(()=>{if(t&&!Array.isArray(t)){if("string"==typeof(e=t)&&["world-110m","world-50m","land-110m","land-50m"].includes(e)){let e=!1;return r(null),fn(t).then(t=>{e||r(t)}),()=>{e=!0}}var e;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${t}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),r(null)}else r(null)},[t]),void 0!==n?n:o}const mn={blues:c.interpolateBlues,reds:c.interpolateReds,greens:c.interpolateGreens,viridis:c.interpolateViridis};function bn(t){const r=zt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{areas:i,valueAccessor:a,colorScheme:s="blues",projection:l="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:y,onZoom:f,dragRotate:g,tileURL:m,tileAttribution:b,tileCacheSize:v,tooltip:x,areaOpacity:k=1,annotations:w,margin:A,className:j,selection:E,linkedHover:O,onObservation:S,onClick:M,chartId:C,loading:$,emptyContent:z,frameProps:L={}}=t,P=null!=h?h:!!m,R=gn(i),I=e.useMemo(()=>"function"==typeof a?a:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[a])&&void 0!==n?n:null==e?void 0:e[a]},[a]),B=e.useMemo(()=>{if(!R)return n.scaleSequential(c.interpolateBlues).domain([0,1]);const e=R.map(e=>I(e)).filter(e=>null!=e&&isFinite(e)),[t,r]=o.extent(e);return n.scaleSequential(mn[s]||c.interpolateBlues).domain([null!=t?t:0,null!=r?r:1])},[R,I,s]),{activeSelectionHook:D,customHoverBehavior:N,customClickBehavior:T}=Mt({selection:E,linkedHover:O,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:C}),W=e.useMemo(()=>{const e=e=>{const t=I(e);return{fill:null!=t&&isFinite(t)?B(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}};return D?Et(e,D,E):e},[I,B,D,E,k]),_=e.useMemo(()=>e=>{var t,n;const o=(null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.name)||(null===(n=null==e?void 0:e.properties)||void 0===n?void 0:n.NAME)||(null==e?void 0:e.name)||(null==e?void 0:e.NAME)||"Feature",r=I(e);return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},o),null!=r&&p.createElement("div",{style:{opacity:.7}},"number"==typeof(i=r)&&isFinite(i)?Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=i?i:"")+""));var i},[I]),F=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},A),[A]),H=ln($,r.width,r.height)||(R?null:ln(!0,r.width,r.height)),q=H?null:sn(R,r.width,r.height,z);if(Array.isArray(R)&&R.length>0){const e=R[0];if(!e||"object"!=typeof e||!e.geometry)return p.createElement(Pt,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:r.width,height:r.height})}const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:l,areas:R,areaStyle:W,size:[r.width,r.height],margin:F,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?_:at(x)||_},null!=u&&{graticule:u}),null!=d&&{fitPadding:d}),P&&{zoomable:!0}),y&&{zoomExtent:y}),f&&{onZoom:f}),null!=g&&{dragRotate:g}),m&&{tileURL:m}),b&&{tileAttribution:b}),v&&{tileCacheSize:v}),(O||S||M)&&{customHoverBehavior:N}),(S||M)&&{customClickBehavior:T}),w&&w.length>0&&{annotations:w}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),j&&{className:j}),L);return H||q||p.createElement(on,{componentName:"ChoroplethMap",width:r.width,height:r.height},p.createElement(tt,Object.assign({},G)))}bn.displayName="ChoroplethMap";const vn=e.forwardRef(function(t,n){const o=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const r=zt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{points:i,xAccessor:a="lon",yAccessor:s="lat",sizeBy:l,sizeRange:c=[3,30],colorBy:u,colorScheme:d,projection:h="equalEarth",graticule:y,fitPadding:f,zoomable:g,zoomExtent:m,onZoom:b,dragRotate:v,tileURL:x,tileAttribution:k,tileCacheSize:w,areas:A,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:E,annotations:O,margin:S,className:M,selection:C,linkedHover:$,onObservation:z,onClick:L,chartId:P,loading:R,emptyContent:I,legendInteraction:B,legendPosition:D,frameProps:N={}}=t,T=null!=g?g:!!x,W=gn(A),_=i||[],{activeSelectionHook:F,customHoverBehavior:H,customClickBehavior:q}=Mt({selection:C,linkedHover:$,fallbackFields:u?["string"==typeof u?u:""]:[],onObservation:z,onClick:L,chartType:"ProportionalSymbolMap",chartId:P}),G=St(_,u,d),V=e.useMemo(()=>{if(!l)return;const e="function"==typeof l?l:e=>e[l],t=_.map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[_,l]),U=e.useMemo(()=>{const e=e=>({fill:u?dt(e,u,G):Ot,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:l?ht(e,l,c,V):6});return F?Et(e,F,C):e},[u,G,l,c,V,F,C]),Z=e.useMemo(()=>{if(!u)return[];const e="function"==typeof u?u:e=>e[u],t=new Set;for(const n of _){const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[_,u]),Y=function(t,n,o){const[r,i]=e.useState(null),[a,s]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&i(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&s(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=r?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===r}:"isolate"===t&&a.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return a.has(o)}}:null},[t,n,r,a]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?a:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(B,u,Z),{legend:X,margin:K,legendPosition:J}=Ct({data:_,colorBy:u,colorScale:G,showLegend:r.showLegend,legendPosition:D,userMargin:S,defaults:{top:10,bottom:10,left:10,right:10}}),Q=e.useMemo(()=>e=>{const t=(null==e?void 0:e.name)||(null==e?void 0:e.label)||(null==e?void 0:e.NAME)||(null==e?void 0:e.id),n="string"==typeof l?l:null,o=("function"==typeof l?l:e=>e[l])(e),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",i="string"==typeof u?u:null,a=i?null==e?void 0:e[i]:null;return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},t&&p.createElement("div",{style:{fontWeight:600,marginBottom:2}},t),n&&null!=o&&p.createElement("div",null,p.createElement("span",{style:{opacity:.7}},n,": "),r(o)),i&&null!=a&&p.createElement("div",null,p.createElement("span",{style:{opacity:.7}},i,": "),a+""),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,": "),r(t))))},[l,u]),ee=ln(R,r.width,r.height),te=ee?null:sn(i,r.width,r.height,I);cn("ProportionalSymbolMap",_,"xAccessor",a),cn("ProportionalSymbolMap",_,"yAccessor",s);const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=i&&{points:_}),{xAccessor:a,yAccessor:s,pointStyle:U}),W&&{areas:W,areaStyle:j}),null!=y&&{graticule:y}),null!=f&&{fitPadding:f}),T&&{zoomable:!0}),m&&{zoomExtent:m}),b&&{onZoom:b}),null!=v&&{dragRotate:v}),x&&{tileURL:x}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[r.width,r.height],margin:K,enableHover:!0,tooltipContent:!1===E?()=>null:at(E)||Q}),X&&{legend:X,legendPosition:J}),B&&"none"!==B&&{legendHoverBehavior:Y.onLegendHover,legendClickBehavior:Y.onLegendClick,legendHighlightedCategory:Y.highlightedCategory,legendIsolatedCategories:Y.isolatedCategories}),($||z||L)&&{customHoverBehavior:H}),(z||L)&&{customClickBehavior:q}),O&&O.length>0&&{annotations:O}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),M&&{className:M}),N);return ee||te||p.createElement(on,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height},p.createElement(tt,Object.assign({ref:o},ne)))});function xn(t){const o=zt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{flows:r,nodes:i,nodeIdAccessor:a="id",xAccessor:s="lon",yAccessor:l="lat",valueAccessor:c="value",projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:y,zoomExtent:f,onZoom:g,dragRotate:m,tileURL:b,tileAttribution:v,tileCacheSize:x,lineType:k="geo",flowStyle:w="basic",areas:A,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:E,edgeOpacity:O=.6,edgeWidthRange:S=[1,8],edgeLinecap:M="round",colorScheme:C,showParticles:$,particleStyle:z,tooltip:L,annotations:P,margin:R,className:I,selection:B,linkedHover:D,onObservation:N,onClick:T,chartId:W,loading:_,emptyContent:F,frameProps:H={}}=t,q=null!=y?y:!!b,G=gn(A),V=jt(D),U=kt({name:(null==B?void 0:B.name)||"__unused__"}),Z=wt({name:(null==V?void 0:V.name)||"hover",fields:(null==V?void 0:V.fields)||[]}),Y=xt(e=>e.pushObservation),X=B?{isActive:U.isActive,predicate:U.predicate}:null,K=r||[],J=i||[],Q=St(K,E,C),ee=e.useMemo(()=>{const e=new Map;for(const t of J)e.set(t[a]+"",t);return e},[J,a]),te=e.useMemo(()=>{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=e.useCallback(e=>{var t,n;if(D)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=te.get(t[a]+"");e&&Z.onHover(e)}else Z.onHover(t)}else Z.onHover(null);if(N||Y){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:W};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},o),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});N&&N(i),Y&&Y(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});N&&N(e),Y&&Y(e)}}},[D,Z,a,te,N,W,Y]),oe=e.useCallback(e=>{var t,n,o,r;if(e&&T){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),T(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(e&&(N||Y)){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n={timestamp:Date.now(),chartType:"FlowMap",chartId:W,type:"click",datum:t||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0};N&&N(n),Y&&Y(n)}},[T,N,Y,W]),re=e.useMemo(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof l?l:e=>e[l];return 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:[{[s]:e(o),[l]:t(o)},{[s]:e(r),[l]:t(r)}]}):null}).filter(Boolean)},[K,ee,s,l]),ie=e.useMemo(()=>{const e=K.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[c])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>S[0]:n.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(S)},[K,c,S]),ae=e.useMemo(()=>e=>{var t;return{stroke:E?dt(e,E,Q):Ot,strokeWidth:ie(null!==(t=e[c])&&void 0!==t?t:0),strokeLinecap:M,opacity:O}},[E,Q,ie,c,O,M]),se=e.useMemo(()=>X?Et(ae,X,Object.assign(Object.assign({},B||{}),{unselectedStyle:{opacity:.15,strokeOpacity:.15,fillOpacity:0}})):ae,[ae,X,B]),le=e.useMemo(()=>()=>({fill:"#333",r:5,fillOpacity:.8}),[]),ce=e.useMemo(()=>e=>{var t,n,o,r,i,s,l;if((null==e?void 0:e.geometry)||(null==e?void 0:e.properties)||(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.geometry)){const t=(null===(n=null==e?void 0:e.properties)||void 0===n?void 0:n.name)||(null===(o=null==e?void 0:e.properties)||void 0===o?void 0:o.NAME)||(null==e?void 0:e.name)||(null==e?void 0:e.NAME)||(null===(i=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.properties)||void 0===i?void 0:i.name)||(null===(l=null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.properties)||void 0===l?void 0:l.NAME);if(t)return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},t))}if(null!=(null==e?void 0:e.source)&&null!=(null==e?void 0:e.target)){const t=e[c];return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},e.source," → ",e.target),null!=t&&p.createElement("div",{style:{opacity:.7}},"number"==typeof t?t.toLocaleString():t))}const u=(null==e?void 0:e.name)||(null==e?void 0:e.label)||(null==e?void 0:e[a]);return null!=u?p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},u)):null},[c,a]),ue=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},R),[R]),de=ln(_,o.width,o.height),pe=de?null:sn(r,o.width,o.height,F),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:u,lines:re,points:J,xAccessor:s,yAccessor:l,lineDataAccessor:"coordinates",lineType:k,flowStyle:w,lineStyle:se,pointStyle:le},G&&{areas:G,areaStyle:j}),null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),q&&{zoomable:!0}),f&&{zoomExtent:f}),g&&{onZoom:g}),null!=m&&{dragRotate:m}),$&&{showParticles:$}),z&&{particleStyle:z}),b&&{tileURL:b}),v&&{tileAttribution:v}),x&&{tileCacheSize:x}),{size:[o.width,o.height],margin:ue,enableHover:!0,tooltipContent:!1===L?()=>null:at(L)||ce}),(D||N||T)&&{customHoverBehavior:ne}),(N||T)&&{customClickBehavior:oe}),P&&P.length>0&&{annotations:P}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),I&&{className:I}),H);return de||pe||p.createElement(on,{componentName:"FlowMap",width:o.width,height:o.height},p.createElement(tt,Object.assign({},he)))}vn.displayName="ProportionalSymbolMap",xn.displayName="FlowMap";const kn=e.forwardRef(function(t,n){const o=zt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{points:r,lines:i,xAccessor:a="lon",yAccessor:s="lat",nodeIdAccessor:l="id",center:c,costAccessor:u,strength:d=1,lineMode:h="straight",projection:y="mercator",graticule:f,fitPadding:g,zoomable:m,zoomExtent:b,onZoom:v,dragRotate:x,tileURL:k,tileAttribution:w,tileCacheSize:A,transition:j,colorBy:E,colorScheme:O,pointRadius:S=5,tooltip:M,showRings:C=!0,ringStyle:$,showNorth:z=!0,costLabel:L,annotations:P,margin:R,className:I,selection:B,linkedHover:D,onObservation:N,onClick:T,chartId:W,loading:_,emptyContent:F,legendPosition:H,frameProps:q={}}=t,G=null!=m?m:!!k,V=r||[],{activeSelectionHook:U,customHoverBehavior:Z,customClickBehavior:Y}=Mt({selection:B,linkedHover:D,fallbackFields:E?["string"==typeof E?E:""]:[],onObservation:N,onClick:T,chartType:"DistanceCartogram",chartId:W}),X=St(V,E,O),K=e.useMemo(()=>{const e=e=>({fill:E?dt(e,E,X):Ot,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:S});return U?Et(e,U,B):e},[E,X,S,U,B]),{legend:J,margin:Q,legendPosition:ee}=Ct({data:V,colorBy:E,colorScale:X,showLegend:o.showLegend,legendPosition:H,userMargin:R,defaults:{top:10,bottom:10,left:10,right:10}}),te=e.useMemo(()=>({center:c,centerAccessor:l,costAccessor:u,strength:d,lineMode:h}),[c,l,u,d,h]),ne=e.useMemo(()=>{if(!i)return;const e="function"==typeof a?a:e=>e[a],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of V)n.set(e[l]+"",e);return i.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),i=n.get(o.target+"");return r&&i?Object.assign(Object.assign({},o),{coordinates:[{[a]:e(r),[s]:t(r)},{[a]:e(i),[s]:t(i)}]}):null}).filter(Boolean)},[i,V,a,s,l]),oe=e.useMemo(()=>e=>{const t=("function"==typeof u?u:e=>e[u])(e);return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},e[l]||e.name||e.id||"Point"),null!=t&&p.createElement("div",{style:{opacity:.7}},"Cost: ","number"==typeof t?t.toFixed(1):t))},[u,l]),re=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=re.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[ie,ae]=e.useState(null),se=e.useCallback(()=>{var e,t;const n=null===(t=null===(e=re.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ae(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);e.useEffect(()=>{const e=requestAnimationFrame(se);return()=>cancelAnimationFrame(e)},[se,d,c,o.width,o.height,V]);const le=e.useMemo(()=>{if(!C||!ie)return[];const{maxCost:e}=ie;if(0>=e)return[];if(Array.isArray(C))return C.filter(t=>t>0&&e>=t);const t="number"==typeof C?C:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[C,ie]),ce=e.useMemo(()=>{var e,t;if(!ie)return q.foregroundGraphics||null;const{cx:n,cy:o,maxCost:r,availableRadius:i}=ie,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},$),s=null!==(e=Q.left)&&void 0!==e?e:10,l=null!==(t=Q.top)&&void 0!==t?t:10;return p.createElement("g",null,le.map(e=>{const t=e/r*i;return p.createElement("g",{key:e},p.createElement("circle",{cx:n+s,cy:o+l,r:t,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),p.createElement("text",{x:n+s+t+3,y:o+l-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif"},e,L?" "+L:""))}),z&&p.createElement("g",{transform:`translate(${s+24}, ${l+24})`},p.createElement("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),p.createElement("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),p.createElement("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif"},"N"),p.createElement("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),p.createElement("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),p.createElement("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})),q.foregroundGraphics)},[ie,le,z,L,$,Q,q.foregroundGraphics]),ue=ln(_,o.width,o.height),de=ue?null:sn(r,o.width,o.height,F);cn("DistanceCartogram",V,"xAccessor",a),cn("DistanceCartogram",V,"yAccessor",s);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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:y},null!=r&&{points:V}),ne&&{lines:ne,lineDataAccessor:"coordinates"}),{xAccessor:a,yAccessor:s,pointIdAccessor:l,pointStyle:K,projectionTransform:te}),j&&{transition:{duration:j}}),null!=f&&{graticule:f}),null!=g&&{fitPadding:g}),G&&{zoomable:!0}),b&&{zoomExtent:b}),v&&{onZoom:v}),null!=x&&{dragRotate:x}),k&&{tileURL:k}),w&&{tileAttribution:w}),A&&{tileCacheSize:A}),{size:[o.width,o.height],margin:Q,enableHover:!0,tooltipContent:!1===M?()=>null:at(M)||oe}),J&&{legend:J,legendPosition:ee}),(D||N||T)&&{customHoverBehavior:Z}),(N||T)&&{customClickBehavior:Y}),P&&P.length>0&&{annotations:P}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),I&&{className:I}),q),ce&&{foregroundGraphics:ce});return ue||de||p.createElement(on,{componentName:"DistanceCartogram",width:o.width,height:o.height},p.createElement(tt,Object.assign({ref:re},pe)))});kn.displayName="DistanceCartogram",exports.ChoroplethMap=bn,exports.DistanceCartogram=kn,exports.FlowMap=xn,exports.ProportionalSymbolMap=vn,exports.StreamGeoFrame=tt,exports.mergeData=function(e,t,n){const{featureKey:o,dataKey:r}=n,i=new Map;for(const e of t)i.set(e[r]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=null==n?void 0:n[e];return(null!=n?n:"")+""})(e),n=i.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})},exports.resolveReferenceGeography=fn;
|