semiotic 3.5.1 → 3.5.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.
Files changed (92) hide show
  1. package/CLAUDE.md +21 -19
  2. package/README.md +22 -16
  3. package/ai/chartSuggestions.cjs +191 -3
  4. package/ai/componentMetadata.cjs +3 -3
  5. package/ai/dist/mcp-server.js +266 -48
  6. package/ai/examples.md +68 -0
  7. package/ai/schema.json +900 -1
  8. package/ai/system-prompt.md +4 -1
  9. package/dist/components/Tooltip/FlippingTooltip.d.ts +16 -1
  10. package/dist/components/charts/geo/FlowMap.d.ts +13 -4
  11. package/dist/components/charts/index.d.ts +6 -0
  12. package/dist/components/charts/network/OrbitDiagram.d.ts +5 -5
  13. package/dist/components/charts/network/ProcessSankey.d.ts +141 -0
  14. package/dist/components/charts/network/processSankey/algorithm.d.ts +136 -0
  15. package/dist/components/charts/network/processSankey/buildScenes.d.ts +45 -0
  16. package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +32 -0
  17. package/dist/components/charts/network/processSankey/streamingLayout.d.ts +58 -0
  18. package/dist/components/charts/network/processSankey/tooltipUtils.d.ts +41 -0
  19. package/dist/components/charts/ordinal/BarChart.d.ts +12 -0
  20. package/dist/components/charts/ordinal/DotPlot.d.ts +9 -0
  21. package/dist/components/charts/ordinal/GaugeChart.d.ts +20 -0
  22. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +5 -0
  23. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +14 -11
  24. package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +19 -0
  25. package/dist/components/charts/shared/axisExtent.d.ts +59 -0
  26. package/dist/components/charts/shared/chartSpecs.d.ts +75 -0
  27. package/dist/components/charts/shared/colorUtils.d.ts +8 -2
  28. package/dist/components/charts/shared/networkUtils.d.ts +3 -5
  29. package/dist/components/charts/shared/radialGeometry.d.ts +99 -0
  30. package/dist/components/charts/shared/regressionUtils.d.ts +59 -0
  31. package/dist/components/charts/shared/selectionUtils.d.ts +8 -1
  32. package/dist/components/charts/shared/streamPropsHelpers.d.ts +5 -0
  33. package/dist/components/charts/shared/types.d.ts +13 -0
  34. package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +75 -0
  35. package/dist/components/charts/shared/useEncodingDomain.d.ts +48 -0
  36. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -1
  37. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +148 -0
  38. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +87 -0
  39. package/dist/components/charts/shared/useSeriesFeatures.d.ts +57 -0
  40. package/dist/components/charts/shared/useStreamStatus.d.ts +33 -0
  41. package/dist/components/charts/shared/useXYLineStyle.d.ts +69 -0
  42. package/dist/components/charts/shared/useXYPointStyle.d.ts +87 -0
  43. package/dist/components/charts/xy/AreaChart.d.ts +24 -0
  44. package/dist/components/charts/xy/BubbleChart.d.ts +9 -0
  45. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +16 -0
  46. package/dist/components/charts/xy/DifferenceChart.d.ts +172 -0
  47. package/dist/components/charts/xy/Scatterplot.d.ts +34 -0
  48. package/dist/components/geometry/ribbonGeometry.d.ts +76 -0
  49. package/dist/components/semiotic-ai.d.ts +2 -0
  50. package/dist/components/semiotic-network.d.ts +4 -0
  51. package/dist/components/semiotic-realtime.d.ts +2 -0
  52. package/dist/components/semiotic-utils.d.ts +4 -0
  53. package/dist/components/semiotic-xy.d.ts +2 -0
  54. package/dist/components/semiotic.d.ts +3 -3
  55. package/dist/components/server/serverChartConfigs.d.ts +2 -0
  56. package/dist/components/stream/GeoPipelineStore.d.ts +21 -0
  57. package/dist/components/stream/OrdinalSVGOverlay.d.ts +8 -0
  58. package/dist/components/stream/PipelineStore.d.ts +5 -0
  59. package/dist/components/stream/SVGOverlay.d.ts +18 -0
  60. package/dist/components/stream/annotationAccessorResolver.d.ts +39 -0
  61. package/dist/components/stream/geoTypes.d.ts +12 -0
  62. package/dist/components/stream/ordinalTypes.d.ts +12 -0
  63. package/dist/components/stream/renderers/cornerRadii.d.ts +33 -0
  64. package/dist/components/stream/types.d.ts +23 -0
  65. package/dist/components/types/legendTypes.d.ts +1 -1
  66. package/dist/geo.min.js +1 -1
  67. package/dist/geo.module.min.js +1 -1
  68. package/dist/network.min.js +1 -1
  69. package/dist/network.module.min.js +1 -1
  70. package/dist/ordinal.min.js +1 -1
  71. package/dist/ordinal.module.min.js +1 -1
  72. package/dist/realtime.min.js +1 -1
  73. package/dist/realtime.module.min.js +1 -1
  74. package/dist/semiotic-ai.d.ts +2 -0
  75. package/dist/semiotic-ai.min.js +1 -1
  76. package/dist/semiotic-ai.module.min.js +1 -1
  77. package/dist/semiotic-network.d.ts +4 -0
  78. package/dist/semiotic-realtime.d.ts +2 -0
  79. package/dist/semiotic-recipes.min.js +1 -1
  80. package/dist/semiotic-recipes.module.min.js +1 -1
  81. package/dist/semiotic-utils.d.ts +4 -0
  82. package/dist/semiotic-utils.min.js +1 -1
  83. package/dist/semiotic-utils.module.min.js +1 -1
  84. package/dist/semiotic-xy.d.ts +2 -0
  85. package/dist/semiotic.d.ts +3 -3
  86. package/dist/semiotic.min.js +1 -1
  87. package/dist/semiotic.module.min.js +1 -1
  88. package/dist/server.min.js +1 -1
  89. package/dist/server.module.min.js +1 -1
  90. package/dist/xy.min.js +1 -1
  91. package/dist/xy.module.min.js +1 -1
  92. package/package.json +10 -5
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useContext as l,useCallback as s,useSyncExternalStore as a,createContext as c,useState as u,useEffect as d,useLayoutEffect as h,forwardRef as f,useImperativeHandle as p,useId as g}from"react";import{geoPath as y,geoGraticule as v,geoDistance as m,geoInterpolate as b,geoEqualEarth as x,geoEquirectangular as k,geoNaturalEarth1 as w,geoOrthographic as j,geoAlbersUsa as O,geoMercator as S}from"d3-geo";import{scaleLinear as M,scaleOrdinal as A,scaleSequential as C}from"d3-scale";import{quadtree as z}from"d3-quadtree";import{bin as P,extent as L}from"d3-array";import{packEnclose as I}from"d3-hierarchy";import{area as D,curveCatmullRom as $,curveCardinal as R,curveBasis as W,curveStepBefore as B,curveStepAfter as T,curveStep as N,curveMonotoneY as E,curveMonotoneX as _,curveLinear as H,curveNatural as F,line as q}from"d3-shape";import G from"regression";import{zoomIdentity as V,zoom as U}from"d3-zoom";import{select as Z}from"d3-selection";class Y{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,l=this.buffer[r];if(e(l)){let e;e="object"!=typeof l||null===l?l:Array.isArray(l)?[...l]:Object.assign({},l),n.push(e),this.buffer[r]=t(l)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function X(e,t,n){return e+(t-e)*n}function Q(e,t,n){var o,i,r;if(1>=n)return 1;const l=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return l+(1-s/(n-1))*(1-l);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return l+Math.pow(.5,s/t)*(1-l)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>s?1:l;default:return 1}}const K={mercator:S,equalEarth:x,albersUsa:O,orthographic:j,naturalEarth:w,equirectangular:k};function J(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function ee(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function te(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function ne(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let i=[e[0]];for(let t=1;e.length>t;t++){const r=e[t];Math.abs(r[0]-e[t-1][0])>n?(2>i.length||o.push(i),i=[r]):i.push(r)}return 2>i.length||o.push(i),o}function oe(e,t,n=24){const o=t[0]-e[0],i=t[1]-e[1],r=Math.sqrt(o*o+i*i);if(0===r)return[e,t];const l=-i/r,s=o/r,a=Math.min(.3*r,80),c=(e[0]+t[0])/2+l*a,u=(e[1]+t[1])/2+s*a,d=[];for(let o=0;n>=o;o++){const i=o/n,r=1-i;d.push([r*r*e[0]+2*r*i*c+i*i*t[0],r*r*e[1]+2*r*i*u+i*i*t[1]])}return d}function ie(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const i=e[t];let r,l;0===t?(r=e[1][0]-i[0],l=e[1][1]-i[1]):t===e.length-1?(r=i[0]-e[t-1][0],l=i[1]-e[t-1][1]):(r=e[t+1][0]-e[t-1][0],l=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(r*r+l*l)||1;o.push([i[0]+l/s*n,i[1]+-r/s*n])}return o}function re(e,t,n,o,i){const r=t[0]-e[0],l=t[1]-e[1],s=Math.sqrt(r*r+l*l);if(0===s)return[e,t];const a=l/s,c=-r/s,u=i/2+1;return[[e[0]+a*u,e[1]+c*u],[t[0]+a*u,t[1]+c*u]]}class le{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e}initStreaming(e=500){this.pointBuffer=new Y(e),this.timestampBuffer=new Y(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return x();if("string"==typeof e){const t=K[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),x())}if("object"==typeof e&&"type"in e){const t=K[e.type],n=t?t():x();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=y(this.projection),this.fitProjection(e),this.geoPath=y(this.projection);const n=this.projection;this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null};const o=this.scene;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&o.length>0&&this.startTransition(o),this.version++}fitProjection(e){var t,n,o,i,r;const l=this.projection,s=this.config,a=[...this.areas],c=J(s.xAccessor,"lon"),u=J(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=ee(s.lineDataAccessor);for(const e of this.lineData){const t=h(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==a.length){if(s.projectionExtent){const[[t,n],[o,i]]=s.projectionExtent;l.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,i],[t,i],[t,n]]]}})}else if(l.clipAngle&&(null!==(t=l.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=s.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);l.scale(o/2-o*t),l.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,i=e.height*t;l.fitExtent([[n,i],[e.width-n,e.height-i]],{type:"FeatureCollection",features:a})}this.baseScale=l.scale(),this.baseTranslate=l.translate(),this.baseRotation=null!==(r=null===(i=l.rotate)||void 0===i?void 0:i.call(l))&&void 0!==r?r:[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=y(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=y(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;n&&n.rotate&&(n.rotate(e),this.geoPath=y(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,le.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._quadtree=z().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,n,o;const i=[],{config:r}=this,l=this.projection,s=this.geoPath,a=J(r.xAccessor,"lon"),c=J(r.yAccessor,"lat"),u=function(e){var t,n;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.surface)||"#e0e0e0",stroke:(null===(n=e.themeSemantic)||void 0===n?void 0:n.border)||"#999",strokeWidth:.5,fillOpacity:1}}(r),d=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(r),h=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(r);if(r.graticule){const t=!0===r.graticule?{}:r.graticule,n=v();t.step&&n.step(t.step);const o=s(n())||"";o&&i.push({type:"geoarea",pathData:o,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=s(e);if(!t)continue;const n=s.centroid(e),o=s.bounds(e),l=s.area(e),a=te(r.areaStyle,e,u);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:l,style:a,datum:e,interactive:!0})}const f=ee(r.lineDataAccessor);for(const t of this.lineData){const n=f(t);if(!n||2>n.length)continue;let o=[];if("geo"===r.lineType){const e=Array(n.length);for(let t=0;n.length>t;t++)e[t]=[a(n[t]),c(n[t])];for(let t=0;e.length-1>t;t++){const n=e[t],i=e[t+1],r=m(n,i)||0,s=Math.max(2,Math.ceil(r/(Math.PI/180))),a=b(n,i);for(let e=0;s>=e;e++){if(t>0&&0===e)continue;const n=l(a(e/s));null!=n&&o.push(n)}}}else for(let e=0;n.length>e;e++){const t=n[e],i=l([a(t),c(t)]);null!=i&&o.push(i)}if(2>o.length)continue;const s=te(r.lineStyle,t,d),u="number"==typeof s.strokeWidth?s.strokeWidth:1;2!==n.length||2>o.length||"arc"!==r.flowStyle?2!==n.length||2>o.length||"offset"!==r.flowStyle||(o="geo"===r.lineType?ie(o,u):re(o[0],o[o.length-1],0,0,u)):o=oe(o[0],o[o.length-1]);const h=ne(o,e.width);if(h.length>1)for(const e of h){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},s),{_edgeFade:!0}),datum:t};i.push(n)}else i.push({type:"line",path:2>o.length&&h[0]||o,style:s,datum:t})}const p=this.getPoints(),g=r.pointIdAccessor?"function"==typeof r.pointIdAccessor?r.pointIdAccessor:e=>e[r.pointIdAccessor]:null,y=l.clipAngle&&null!==(t=l.clipAngle())&&void 0!==t?t:0,x=y>0?y*Math.PI/180:null,k=l.rotate?l.rotate():[0,0,0],w="function"==typeof l.center?l.center():[0,0],j=[(null!==(n=w[0])&&void 0!==n?n:0)-k[0],(null!==(o=w[1])&&void 0!==o?o:0)-k[1]];for(let e=0;p.length>e;e++){const t=p[e],n=a(t),o=c(t);if(null!=x&&m([n,o],j)>x)continue;const s=l([n,o]);if(!s)continue;const u=r.pointStyle?r.pointStyle(t):Object.assign({},h),d={type:"point",x:s[0],y:s[1],r:u.r||4,style:u,datum:t,pointId:g?g(t)+"":void 0};i.push(d)}return i}applyCartogramTransform(e,t){var n,o,i;const r=this.scene.filter(e=>"point"===e.type);if(2>r.length)return;const l=null!==(n=e.strength)&&void 0!==n?n:1;if(0===l)return;const s=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,a="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=r.find(t=>t.datum&&s(t.datum)+""==e.center+"");if(!c)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const u=c.x,d=c.y,h=r.map(e=>e.datum?a(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),f=Math.max(...h,1),p=Math.min(t.width,t.height)/2,g=M().domain([0,f]).range([0,p]);this.cartogramLayout={cx:u,cy:d,maxCost:f,availableRadius:p},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of r){if(e===c)continue;if(!e.datum)continue;const t=Math.atan2(e.y-d,e.x-u),n=Math.sqrt(Math.pow(e.x-u,2)+Math.pow(e.y-d,2)),o=a(e.datum),i=n+((isFinite(o)?g(o):n)-n)*l;e.x=u+Math.cos(t)*i,e.y=d+Math.sin(t)*i}const y=t.width/2,v=t.height/2,m=y-c.x,b=v-c.y;if(Math.abs(m)>.5||Math.abs(b)>.5)for(const e of r)e.x+=m,e.y+=b;this.cartogramLayout={cx:y,cy:v,maxCost:f,availableRadius:p};const x=this.scene.filter(e=>"line"===e.type);if(x.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of r)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of x){const n=null===(o=t.datum)||void 0===o?void 0:o.source,r=null===(i=t.datum)||void 0===i?void 0:i.target;if(n&&r){const o=e.get(n+""),i=e.get(r+"");o&&i&&(t.path=[o,i])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const i=Q(e,o,t);n[o]._decayOpacity=i,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:i})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,i=performance.now(),r=this.scene.filter(e=>"point"===e.type),l=this.timestampBuffer.toArray();for(let e=0;r.length>e&&l.length>e;e++){const s=i-l[e];o>s&&(r[e]._pulseIntensity=1-s/o,r[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",r[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const i=new Map;for(const t of e)"point"===t.type&&t.pointId&&i.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let l=!1;for(const e of r)if(e.pointId){const t=i.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(l=!0))}l&&(this.activeTransition={startTime:performance.now(),duration:o})}cancelIntroAnimation(){this.activeTransition=null}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=X(e.x,e._targetX,n),e.y=X(t,e._targetY,n)}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0);return this.activeTransition=null,!1}return!0}}function se(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ae(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function ce(e,t){const n=ae(e);if(!n)return!1;const o=ae(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function ue(e,t,n,o,i,r,l=0){if(r){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),l=t-r,s=t+r,a=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,f)=>{if(i>s||l>h||r>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,l=e.y-n,s=Math.sqrt(r*r+l*l);se(e.r,o)>=s&&d>s&&(u=e,d=s),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,l);if(e)return e}else{let i=null,r=o;for(const l of e){if("point"!==l.type)continue;const e=l.x-t,s=l.y-n,a=Math.sqrt(e*e+s*s);se(l.r,o)>=a&&r>a&&(i=l,r=a)}if(i)return{node:i,distance:r}}for(let o=e.length-1;o>=0;o--){const r=e[o];if("geoarea"!==r.type)continue;const l=r;if(!1===l.interactive)continue;const[[s,a],[c,u]]=l.bounds;if(!(s>t||t>c||a>n||n>u)&&(l._cachedPath2D||(l._cachedPath2D=new Path2D(l.pathData)),i.isPointInPath(l._cachedPath2D,t,n)))return{node:l,distance:0}}let s=null,a=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:i}=e,r=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;i.length-1>o;o++){const[l,c]=i[o],[u,d]=i[o+1],h=de(t,n,l,c,u,d);r>=h&&a>h&&(s=e,a=h)}}return s?{node:s,distance:a}:null}function de(e,t,n,o,i,r){const l=i-n,s=r-o,a=l*l+s*s;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*l+(t-o)*s)/a;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*l),2)+Math.pow(t-u,2))}function he(t){let n=null;const o=()=>(n||(n=c(null)),n),u=fe(t);return[function({children:n,initialState:l}){const s=i(l),a=r(()=>fe(t,s.current),[]),c=o();return e(c.Provider,{value:a,children:n})},e=>{var t;const n=o(),r=null!==(t=l(n))&&void 0!==t?t:u,c=i(e);c.current=e;const d=s(()=>c.current(r.getState()),[r]),h=s(()=>c.current(r.getState()),[r]);return a(r.subscribe,d,h)}]}function fe(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function pe(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function ge(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:ye})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}le.QUADTREE_THRESHOLD=500;const ye=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],ve={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},me={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},be={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ye,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function xe(e,t){if("light"===t)return ve;if("dark"===t)return me;if("high-contrast"===t)return be;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?me:ve;return ge(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return ge(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[ke,we]=he(e=>({theme:ve,setTheme(t){e(e=>({theme:xe(e.theme,t)}))}}));const je=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Oe=new WeakMap;let Se=0,Me=!1,Ae=null,Ce=null,ze=null;function Pe(e,t){var n,o;if(!t)return t;const i=je.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Me)return;if("undefined"==typeof window||"undefined"==typeof document)return;Me=!0;const e=()=>{Se++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ae=new MutationObserver(e),Ae.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Ce=window.matchMedia("(prefers-color-scheme: dark)"),ze=e,"function"==typeof Ce.addEventListener?Ce.addEventListener("change",ze):"function"==typeof Ce.addListener&&Ce.addListener(ze)}catch(e){}}();let l=Oe.get(r);l&&l.version===Se||(l={version:Se,map:new Map},Oe.set(r,l));const s=l.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return l.map.set(t,a),a}const Le="undefined"==typeof window?d:h;function Ie(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function De(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return d(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[l,a]=function(e,t,n){const o=i(null),[r,l]=u(null);return d(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),c=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=a[0]-c.left-c.right,f=a[1]-c.top-c.bottom,p=Ie(e.foregroundGraphics,a,c),g=Ie(e.backgroundGraphics,a,c),y=we(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=i(0),k=i(()=>{}),w=s(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);d(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const j=i(()=>{}),O=i(()=>{}),S=i(null),M=i(0),A=s(()=>{M.current=0;const e=S.current;S.current=null,e&&j.current(e)},[]),C=s(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===M.current&&(M.current=requestAnimationFrame(A))},[A]),z=s(()=>{S.current=null,0!==M.current&&(cancelAnimationFrame(M.current),M.current=0),O.current()},[]);d(()=>()=>{S.current=null,0!==M.current&&(cancelAnimationFrame(M.current),M.current=0)},[]);const P=e.themeDirtyRef;return Le(()=>{P&&(Se++,P.current=!0,w())},[y,w,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:l,size:a,margin:c,adjustedWidth:h,adjustedHeight:f,resolvedForeground:p,resolvedBackground:g,currentTheme:y,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:j,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:z}}const $e={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function Re(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,$e[n])(o(e,t)),i}function We(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Be(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Te=(n,o,i,r,l,s,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=n,g=[];let y=0;const v=!(!o&&!i),m="isolate"===d||void 0===d&&null!=l;return p.forEach((n,d)=>{const b=Re(n,d,h,f),x=Be(n,r,l),k=l&&l.size>0&&l.has(n.label);g.push(t("g",{transform:`translate(0,${y})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===s&&d===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?k||!1:void 0,"aria-current":v&&!m&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,k&&e(We,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),y+=22}),g};function Ne({config:n,orientation:i="vertical",width:r=100}){const{colorFn:l,domain:s,label:a,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:l(s[0]+n*(s[1]-s[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),a&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:l(s[1]-n*(s[1]-s[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[a&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])})]})}function Ee(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:f="vertical"}=n,[p,g]=o.useState(0),[y,v]=o.useState(0),m=o.useCallback((e,t)=>{g(e),v(t)},[]),b="vertical"===f?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,f)=>{d+=5,h.push(e("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,t.label&&(d+=16,h.push(e("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),d+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${d})`,children:Te(t,o,i,r,l,s,a,f,c,u)},"legend-group-"+f)),d+=22*t.items.length+8}),h})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let f=0;const p=[];n.forEach((n,o)=>{let g=0;n.label&&(g+=16);const y=((n,o,i,r,l,s,a,c,u,d,h)=>{const{type:f="fill",styleFn:p,items:g}=n,y=[];let v=0,m=0;const b=!(!o&&!i),x="isolate"===d||void 0===d&&null!=l;g.forEach((n,d)=>{const k=Re(n,d,f,p),w=Be(n,r,l),j=l&&l.size>0&&l.has(n.label),O=26+7*n.label.length;h&&h>0&&v>0&&v+O>h&&(m++,v=0),y.push(t("g",{transform:`translate(${v},${22*m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===s&&d===a?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?j||!1:void 0,"aria-current":b&&!x&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+g.length)%g.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,j&&e(We,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),v+=O});let k=0,w=0;for(const e of g){const t=26+7*e.label.length;h&&h>0&&w>0&&w+t>h?(k=Math.max(k,w),w=t):w+=t}k=Math.max(k,w);const j=m+1;return{items:y,offset:k,totalRows:j,totalHeight:22*j}})(n,r,l,s,a,c,u,o,d,h,i);g+=y.offset+5,p.push(Object.assign(Object.assign({label:n.label},y),{offset:g,totalRows:y.totalRows,totalHeight:y.totalHeight})),f+=g+12});let g=f>i?0:Math.max(0,(i-f)/2);const y=[];return p.forEach((t,i)=>{const r=n[i];r.label&&(y.push(e("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),g+=16),y.push(e("g",{className:"legend-item",transform:`translate(${g},0)`,children:t.items},"legend-group-"+i)),g+=t.offset+5,n[i+1]&&y.push(e("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),g+=12}),e("g",{children:y})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}),x=!(!r&&!l);return t("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===f&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function _e(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function He(t){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:l="right",title:s,legendHoverBehavior:a,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const f="top"===l||"bottom"===l;let p,g;return"left"===l?(p=4,g=r.top):"top"===l?(p=0,g=s?32:8):"bottom"===l?(p=0,g=i-r.bottom+50):(p=o-r.right+10,g=r.top),e("g",{transform:`translate(${p}, ${g})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e(Ne,{config:n.gradient,orientation:f?"horizontal":"vertical",width:f?o:100}):_e(n)?e(Ee,{legendGroups:n.legendGroups,title:"",width:f?o:100,orientation:f?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function Fe(e){return"string"==typeof e?{type:e}:e}function qe({orient:n,config:o,values:i,scale:l,size:s,length:a}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=r(()=>{if(0===i.length)return null;const o=l.domain(),r=s-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],l=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*l),whiskerHigh:Math.min(t[n-1],r+1.5*l)}}(i);if(!o)return null;const{q1:s,median:a,q3:d,whiskerLow:h,whiskerHigh:f}=o,p=Math.min(.5*r,20),g=(r-p)/2+4;if(u){const o=l(s),i=l(d),r=l(a),u=l(h),y=l(f),v="top"===n?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:m+v*(g+p/2),x2:y,y2:m+v*(g+p/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:m+v*g,x2:u,y2:m+v*(g+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:m+v*g,x2:y,y2:m+v*(g+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?m-g-p:m+g,width:Math.abs(i-o),height:p,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?m-g-p:m+g,x2:r,y2:"top"===n?m-g:m+g+p,stroke:c.fill,strokeWidth:2})]})}{const o=l(s),i=l(d),r=l(a),u=l(h),y=l(f),v="left"===n?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:m+v*(g+p/2),y1:u,x2:m+v*(g+p/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*g,y1:u,x2:m+v*(g+p),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*g,y1:y,x2:m+v*(g+p),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?m-g-p:m+g,y:Math.min(o,i),width:p,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?m-g-p:m+g,y1:r,x2:"left"===n?m-g:m+g+p,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=P().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=l(t.x0),s=l(t.x1)-l(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(s,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=l(t.x0),s=l(t.x1)-l(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+s),width:i,height:Math.abs(s),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),s=l((e.x0+e.x1)/2);o.push(u?`${s},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${s}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const s=i.length/h*(r/2),a=l((i.x0+i.x1)/2);o.push(u?`${a},${"top"===n?-(t+s):t+s}`:`${"left"===n?-(t+s):t+s},${a}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?l(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=l((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?l(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=l((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,l,c,s,a,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function Ge(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let l="";for(const e of i)l&&l.length+1+e.length>o?(r.push(l),l=e):l=l?`${l} ${e}`:e;return l&&r.push(l),r}function Ve(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Ue(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:l,title:s,orientation:a,align:c,wrap:u=120,noWrap:d}=n;if(!l&&!s)return e("g",{className:"annotation-note"});let h=a;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let f=c;f&&"dynamic"!==f||(f="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let p="start";"topBottom"===h?"right"===f?p="end":"middle"===f&&(p="middle"):p=0>o?"end":"start";const g=16,y=s?d?[s]:Ge(s,u):[],v=l?d?[l]:Ge(l,u):[],m="leftRight"===h?"end"===p?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:p,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-title")),b=y.length*g),v.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:p,y:b,children:v.map((t,n)=>e("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-label"));let w=null;if((s||l)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+v.length)*g+(v.length>0?g:0);let n=0,o=t;"bottom"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const j=Math.max(0,y.length+v.length-1)*g;let O=0;return"topBottom"===h?O=0>i?-(j+2):18:"leftRight"===h&&(O="middle"===f?-(j+g+(v.length>0&&y.length>0?2:0))/2+8:"bottom"===f||0>i?-(j+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),w]})}function Ze(t,n,o,i,r){var l;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&s.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,l=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;s.push(e("line",{x1:i,y1:(n.y1||0)-l,x2:i,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-l;s.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e("line",{x1:0,y1:(n.y1||0)-l,x2:0,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(l=null==n?void 0:n.width)&&void 0!==l?l:null==n?void 0:n.height;void 0!==t&&s.push(e("path",{d:Ve((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:s})}function Ye(t,n,o,i,r,l){const s=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==l?void 0:l.radius)){if("callout-rect"===r&&l){const e=l.width||0,o=l.height||0;if(e>0||o>0){const i=e/2,r=o/2,l=t-i,s=n-r;if(0!==l||0!==s){const t=Math.abs(l),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;a=i+l*h,c=r+s*h}}}else if("bracket"===r&&l){const e=l.width,t=l.height,n=l.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=n,c=t/2)}}else{const e=(l.radius||0)+(l.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(s.push(e("line",{x1:a,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,l=Math.atan2(n-c,t-a);s.push(e("path",{d:`M${a},${c}L${a+o*Math.cos(l+r)},${c+o*Math.sin(l+r)}L${a+o*Math.cos(l-r)},${c+o*Math.sin(l-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e("g",{className:"annotation-connector",children:s})}function Xe(e){const{x:n=0,y:o=0,dx:i,dy:r,nx:l,ny:s,note:a,connector:c,subject:u,type:d,color:h,className:f,disable:p,events:g={},"data-testid":y}=e,v=new Set(Array.isArray(p)?p:[]);let m=i||0,b=r||0;null!=l&&(m=l-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===m&&0===b)if(void 0!==u.width){m=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;m=e+(0>e?-5:5),b=u.height/2}return t("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},g,{children:[!v.has("connector")&&Ye(m,b,c,h,x,u),!v.has("subject")&&Ze(x,u,h,n,o),!v.has("note")&&Ue(a,m,b,h)]}))}function Qe(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,l="string"==typeof i.type?i.type:"label",s=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),s=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e(Xe,Object.assign({"data-testid":"semiotic-annotation"},r,{type:l}),"multi-annotation-"+o)});return e("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e(Xe,Object.assign({"data-testid":"semiotic-annotation",events:s},i,{type:l}),c)}function Ke(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Je(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function et(e,t,n){var o,i,r,l;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,l;const s=e.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let a=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,c=t.y)}if(null!=a&&null!=c||(a=Ke(e,n),c=Je(e,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:a,y:c}),{x:a,y:c};if("sticky"===s){const e=null===(l=n.stickyPositionCache)||void 0===l?void 0:l.get(t);if(e)return e}return null}function tt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const nt={linear:H,monotoneX:_,monotoneY:E,step:N,stepAfter:T,stepBefore:B,basis:W,cardinal:R,catmullRom:$};let ot={positions:new Map};const it=new Set;function rt(){for(const e of it)e()}function lt(e,t){const n=ot.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(ot.positions);o.delete(e),ot={positions:o},rt()}function st(e,t){const n=ot.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(ot.positions);o.delete(e),ot={positions:o},rt()}function at(){return ot}function ct(e){return it.add(e),()=>it.delete(e)}const ut={positions:new Map};function dt(){return()=>{}}function ht(){return ut}function ft(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function pt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let l="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);l+=`L${Math.min(8*e+4,t)},${o+4*i}`,l+=`L${Math.min(n,t)},${o}`}return l}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let l=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);l+=`L${o+4*i},${Math.min(8*e+4,n)}`,l+=`L${o},${Math.min(t,n)}`}return l}}function gt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function yt(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function vt(o){var l,s;const{width:c,height:u,totalWidth:h,totalHeight:f,margin:p,scales:g,showAxes:y,axes:v,xLabel:m,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,showGrid:j,title:O,legend:S,legendHoverBehavior:M,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:z,legendPosition:P="right",foregroundGraphics:L,marginalGraphics:$,xValues:R,yValues:W,annotations:B,svgAnnotationRules:T,xAccessor:N,yAccessor:E,annotationData:_,pointNodes:F,curve:q,underlayRendered:V,canvasObscuresUnderlay:U=!0,linkedCrosshairName:Z,linkedCrosshairSourceId:Y,children:X}=o,Q=r(()=>{var e;if(!y||!g)return[];const t=null==v?void 0:v.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||k||gt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=g.x.ticks(Math.min(o,Math.max(2,Math.floor(c/70)))),r=i.map(e=>e.valueOf()),l=i.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,r)})),s=l.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),a=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(s+8,55)):Math.max(55,s+8);let u=yt(l,a);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=g.x.domain()[1],t=g.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,u.length,r);a>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:i})}}return u},[y,g,v,k,c]),K=r(()=>{var e;if(!y||!g)return[];const t=null==v?void 0:v.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||w||gt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let i=yt(g.y.ticks(Math.min(o,Math.max(2,Math.floor(u/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22);if(i.length>1&&(i=i.filter((e,t)=>0===t||e.label+""!=i[t-1].label+"")),(null==t?void 0:t.includeMax)&&i.length>0){const e=g.y.domain()[1],t=g.y(e),o=i[i.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e);22>Math.abs(t-o)&&i.length>1&&(i=i.slice(0,-1)),i.push({value:e,pixel:t,label:r})}}return i},[y,g,v,w,u]),J=r(()=>{var e;if(!y||!g)return[];const t=null==v?void 0:v.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||w||gt,o=null!==(e=t.ticks)&&void 0!==e?e:5;return yt(g.y.ticks(Math.min(o,Math.max(2,Math.floor(u/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22)},[y,g,v,w,u]),ee=i(new Map),te=i(null!==(l=null==B?void 0:B.length)&&void 0!==l?l:0),ne=null!==(s=null==B?void 0:B.length)&&void 0!==s?s:0;te.current!==ne&&(te.current=ne,ee.current=new Map);const oe=r(()=>{if(!B||0===B.length)return null;const n=function(n,o,i){var r,l,s,a,c,u,d,h,f,p,g,y,v,m,b,x,k,w,j,O,S,M,A,C,z,P,L,$,R,W,B,T,N,E,_,F,q,V,U,Z,Y,X,Q,K,J,ee,te,ne;switch(n.type){case"label":{const t=et(n,o,i);if(!t)return null;const{x:r,y:l}=t;return tt(r,l,i)?e(Qe,{noteData:{x:r,y:l,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const t=et(n,o,i);if(!t)return null;const{x:r,y:l}=t;return tt(r,l,i)?e(Qe,{noteData:{x:r,y:l,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=Ke(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,i);if(null==r)return null;const l=n.color||"#f97316",s=n.labelPosition||"top";let a;return a="bottom"===s?(i.height||0)-4:"center"===s?(i.height||0)/2:12,t("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:r+4,y:a,fill:l,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Je(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,i);if(null==r)return null;const l=n.color||"#f97316",s=n.labelPosition||"right";let a,c;return"left"===s?(a=4,c="start"):"center"===s?(a=(i.width||0)/2,c="middle"):(a=(i.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:a,y:r-4,textAnchor:c,fill:l,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:Ke(Object.assign(Object.assign({},e),{type:"point"}),i),y:Je(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const l=I(r),s=n.padding||10;return t("g",{children:[e("circle",{cx:l.x,cy:l.y,r:l.r+s,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:l.x,y:l.y-l.r-s-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:Ke(Object.assign(Object.assign({},e),{type:"point"}),i),y:Je(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const l=n.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),c=Math.min(...s)-l,u=Math.max(...s)+l,d=Math.min(...a)-l,h=Math.max(...a)+l;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const t=i.data||[],r="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],l={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,o)=>{const r=Ke(t,i),s=Je(t,i);if(null==r||null==s)return null;const a="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||l;return e("circle",Object.assign({cx:r,cy:s,r:a},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const t=Ke(n,i),r=Je(n,i);return e(Qe,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const f=i.xAccessor||"x",p=i.yAccessor||"y",g=h.map(e=>[e[f],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>g.length)return null;const y=null!==(l=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==l?l:null===(s=i.scales)||void 0===s?void 0:s.time,v=null!==(c=null===(a=i.scales)||void 0===a?void 0:a.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!y||!v)return null;const m=n.method||"linear";let b;b="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),l=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(l-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],f+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){s.push([t,r[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))s.push([t,h/u]);else{const e=(u*p-d*h)/g;s.push([t,(h-e*d)/u+e*t])}}return s}(g,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===m?G.polynomial(g,{order:n.order||2}):G.linear(g)).points;const x=b.map(([e,t])=>`${y(e)},${v(t)}`).join(" "),k=n.color||"#6366f1";return t("g",{children:[e("polyline",{points:x,fill:"none",stroke:k,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:y(b[b.length-1][0])+4,y:v(b[b.length-1][1])-4,fill:k,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(f=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==f?f:null===(p=i.scales)||void 0===p?void 0:p.value,l=null!==(g=null==r?void 0:r(n.y0))&&void 0!==g?g:0,s=null!==(y=null==r?void 0:r(n.y1))&&void 0!==y?y:i.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(l,s),width:i.width||0,height:Math.abs(s-l),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(l,s)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const l=i.xAccessor||"x",s=null!==(m=null===(v=i.scales)||void 0===v?void 0:v.x)&&void 0!==m?m:null===(b=i.scales)||void 0===b?void 0:b.time,a=null!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.value;if(!s||!a)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[l]-t[l]);if(2>h.length)return null;const f=nt[i.curve||"linear"]||H,p=D().x(e=>s(e[l])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!p)return null;const g=n.fill||"#6366f1";return t("g",{children:[e("path",{d:p,fill:g,fillOpacity:null!==(j=n.fillOpacity)&&void 0!==j?j:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:s(h[h.length-1][l])+4,y:a(h[h.length-1][c])-4,fill:g,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const l=i.yAccessor||"y",s=null!==(S=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(M=i.scales)||void 0===M?void 0:M.time,a=null!==(C=null===(A=i.scales)||void 0===A?void 0:A.y)&&void 0!==C?C:null===(z=i.scales)||void 0===z?void 0:z.value;if(!s||!a)return null;const c=r.map(e=>e[l]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),f=null!==(P=n.threshold)&&void 0!==P?P:2,p=u-f*h,g=!1!==n.showBand,y=n.fill||"#6366f1",v=null!==(L=n.fillOpacity)&&void 0!==L?L:.1,m=n.anomalyColor||"#ef4444",b=null!==($=n.anomalyRadius)&&void 0!==$?$:6,x=a(u+f*h),k=a(p),w=r.filter(e=>{const t=e[l];return null!=t&&Math.abs(t-u)>f*h});return t("g",{children:[g&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:v}),w.map((t,n)=>{const o=Ke(t,i),r=Je(t,i);return null==o||null==r?null:e("circle",{cx:o,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const l=i.xAccessor||"x",s=i.yAccessor||"y",a=null!==(W=null===(R=i.scales)||void 0===R?void 0:R.x)&&void 0!==W?W:null===(B=i.scales)||void 0===B?void 0:B.time,c=null!==(N=null===(T=i.scales)||void 0===T?void 0:T.y)&&void 0!==N?N:null===(E=i.scales)||void 0===E?void 0:E.value;if(!a||!c)return null;const u=r.map(e=>[e[l],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=G.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const l=(e*i-t*n)/r,s=(n-l*t)/e;d=e=>s+l*e}const h=u.length,f=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(f/Math.max(h-2,1)),g=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),v=null!==(_=n.confidence)&&void 0!==_?_:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,b=null!==(F=n.steps)&&void 0!==F?F:5,x=u[h-1][0],k=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const j=[];for(const e of w){const t=d(e),n=p*Math.sqrt(1+1/h+(y>0?Math.pow(e-g,2)/y:0))*m;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${j.map(e=>`${a(e.x)},${c(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${a(e.x)},${c(e.yLower)}`).join(" L")} Z`,S=j.map(e=>`${a(e.x)},${c(e.yCenter)}`).join(" "),M=`${a(x)},${c(d(x))}`,A=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(q=n.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e("polyline",{points:`${M} ${S}`,fill:"none",stroke:A,strokeWidth:null!==(V=n.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(U=n.strokeDasharray)&&void 0!==U?U:"6,3"}),n.label&&j.length>0&&e("text",{x:a(j[j.length-1].x)+4,y:c(j[j.length-1].yCenter)-4,fill:A,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let t=null,r=null;if(null!=n.px&&null!=n.py)t=n.px,r=n.py;else{const e=et(n,o,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!tt(t,r,i))return null;const l=null!==(Z=n.dx)&&void 0!==Z?Z:0,s=null!==(Y=n.dy)&&void 0!==Y?Y:0,a=null!==(X=n.width)&&void 0!==X?X:32,c=null!==(Q=n.height)&&void 0!==Q?Q:32,u=null!==(K=n.content)&&void 0!==K?K:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+l-a/2,y:r+s-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=et(n,o,i);if(!t)return null;const{x:r,y:l}=t;return e("text",{x:r+(n.dx||0),y:l+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const l=null===(J=i.scales)||void 0===J?void 0:J.o,s=null===(ee=i.scales)||void 0===ee?void 0:ee.x,a=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==l?void 0:l.bandwidth)?l:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!c)return null;const u=c(r);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",f=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return t("g",(i.projection?"vertical"===i.projection:c===s)?{children:[e("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:f}),p&&e("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:f}),p&&e("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:N,yAccessor:E,width:c,height:u,data:_,frameType:"xy",pointNodes:F,curve:q,stickyPositionCache:ee.current};return B.map((e,t)=>{if(T){const i=T(e,t,o);return null!=i?i:n(e,t,o)}return n(e,t,o)}).filter(Boolean)},[B,T,c,u,N,E,_,g,F,q]),ie=function(e){var t;const n=a(e?ct:dt,e?at:ht,e?at:ht);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(Z);return d(()=>{if(!(null==ie?void 0:ie.locked)||!Z)return;const e=e=>{"Escape"===e.key&&st(Z)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==ie?void 0:ie.locked,Z]),y||O||S||L||$||oe&&oe.length>0||j||X||ie?t("svg",{role:"img",width:h,height:f,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof O?O:"XY Chart"}),e("desc",{children:"string"==typeof O?O+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${p.left},${p.top})`,children:[j&&g&&(!V||U)&&(()=>{var n,o;const i=ft(null===(n=null==v?void 0:v.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=ft(null===(o=null==v?void 0:v.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[Q.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:u,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),K.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:c,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&g&&(()=>{const o=null==v?void 0:v.find(e=>"left"===e.orient),i=null==v?void 0:v.find(e=>"bottom"===e.orient),r=!o||!1!==o.baseline,l=!i||!1!==i.baseline,s=(null==o?void 0:o.jaggedBase)||!1,a=(null==i?void 0:i.jaggedBase)||!1,d=null==i?void 0:i.landmarkTicks,h=null==o?void 0:o.landmarkTicks,f="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",k=!!(null==i?void 0:i.autoRotate)&&Q.length>1&&(()=>{const e=c/Math.max(Q.length-1,1);return Q.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(!V||U)&&l&&!a&&e("line",{x1:0,y1:u,x2:c,y2:u,stroke:f,strokeWidth:1}),(!V||U)&&a&&e("path",{d:pt("bottom",c,u),fill:"none",stroke:f,strokeWidth:1}),Q.map((n,o)=>{const i=!!d&&("function"==typeof d?d(n.value,o):ce(n.value,o>0?Q[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${u})`,children:[e("line",{y2:5,stroke:f,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:k?10:18,textAnchor:k?"end":"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:g,style:{userSelect:"none"},transform:k?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"xtick-"+o)}),m&&e("text",{x:c/2,y:u+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:m}),(!V||U)&&r&&!s&&e("line",{x1:0,y1:0,x2:0,y2:u,stroke:f,strokeWidth:1}),(!V||U)&&s&&e("path",{d:pt("left",c,u),fill:"none",stroke:f,strokeWidth:1}),K.map((n,o)=>{const i=!!h&&("function"==typeof h?h(n.value,o):ce(n.value,o>0?K[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:f,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:g,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==o?void 0:o.label)||b;return t?e("text",{x:15-p.left,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-p.left}, ${u/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const o=null==v?void 0:v.find(e=>"right"===e.orient);if(!o||0===J.length)return null;const i=o.landmarkTicks,r=o.label||x;return t(n,{children:[!1!==o.baseline&&e("line",{x1:c,y1:0,x2:c,y2:u,stroke:f,strokeWidth:1}),J.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):ce(n.value,o>0?J[o-1].value:void 0));return t("g",{transform:`translate(${c},${n.pixel})`,children:[e("line",{x2:5,stroke:f,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:c+p.right-15,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${c+p.right-15}, ${u/2})`,style:{userSelect:"none"},children:r})]})})()]})})(),oe,$&&g&&R&&W&&t(n,{children:[$.top&&e("g",{transform:"translate(0, 0)",children:e(qe,{orient:"top",config:Fe($.top),values:R,scale:g.x,size:p.top,length:c})}),$.bottom&&e("g",{transform:`translate(0, ${u})`,children:e(qe,{orient:"bottom",config:Fe($.bottom),values:R,scale:g.x,size:p.bottom,length:c})}),$.left&&e("g",{transform:"translate(0, 0)",children:e(qe,{orient:"left",config:Fe($.left),values:W,scale:g.y,size:p.left,length:u})}),$.right&&e("g",{transform:`translate(${c}, 0)`,children:e(qe,{orient:"right",config:Fe($.right),values:W,scale:g.y,size:p.right,length:u})})]}),L,ie&&ie.sourceId!==Y&&(null==g?void 0:g.x)&&(()=>{const t=g.x(ie.xValue);if(null==t||0>t||t>c)return null;const n=ie.locked;return e("line",{x1:t,y1:0,x2:t,y2:u,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),X]}),O&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof O?O:null}),He({legend:S,totalWidth:h,totalHeight:f,margin:p,legendPosition:P,title:O,legendHoverBehavior:M,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:z})]}):null}function mt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const bt="undefined"==typeof window||"undefined"==typeof document,xt="undefined"!=typeof window?h:d,kt=()=>()=>{},wt=()=>!1,jt=()=>!0;function Ot(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function St(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Mt(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const At=o.createContext(null),Ct={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function zt(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],l=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of l)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const Pt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Lt={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},It={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Dt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},$t={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Rt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},Wt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Bt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Tt({scene:n,chartType:i,tableId:r,chartTitle:l}){var s;const[a,c]=o.useState(!1),u=o.useContext(At),d=null!==(s=null==u?void 0:u.visible)&&void 0!==s&&s,h=a||d,f=o.useRef(null),p=l?"Data summary for "+l:r?`Data summary for ${i} ${r}`:"Data summary for "+i,g=o.useCallback(()=>{a||d||c(!0)},[a,d]),y=o.useCallback(e=>{var t;d||(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:Ct}):null;if(!h)return e("div",{id:r,tabIndex:-1,onFocus:g,style:Ct,role:"region","aria-label":p,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const v=function(e){var t,n,o,i,r,l,s,a,c,u,d,h,f,p,g,y,v,m,b,x,k,w,j,O,S;const M=[];if(!Array.isArray(e))return M;for(const A of e)if(A&&"object"==typeof A)try{switch(A.type){case"point":M.push({label:"Point",values:{x:A.x,y:A.y}});break;case"line":{const e=A.path,t=Array.isArray(A.datum)?A.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&M.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=A.topPath,t=Array.isArray(A.datum)?A.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&M.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=A.datum&&"object"==typeof A.datum?A.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:A.group)&&void 0!==n?n:"",l=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;M.push({label:"Bar",values:{category:r,value:null!=l?l:""}});break}case"heatcell":M.push({label:"Cell",values:{x:A.x,y:A.y,value:A.value}});break;case"wedge":M.push({label:"Wedge",values:{category:null!==(a=null!==(l=null===(r=A.datum)||void 0===r?void 0:r.category)&&void 0!==l?l:null===(s=A.datum)||void 0===s?void 0:s.label)&&void 0!==a?a:"",value:null!==(u=null===(c=A.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":M.push({label:"Node",values:{id:null!==(h=null===(d=A.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(f=A.cx)&&void 0!==f?f:A.x,y:null!==(p=A.cy)&&void 0!==p?p:A.y}});break;case"arc":M.push({label:"Arc",values:{id:null!==(y=null===(g=A.datum)||void 0===g?void 0:g.id)&&void 0!==y?y:"",x:null!==(v=A.cx)&&void 0!==v?v:A.x,y:null!==(m=A.cy)&&void 0!==m?m:A.y}});break;case"candlestick":M.push({label:"Candlestick",values:{x:A.x,open:A.open,high:A.high,low:A.low,close:A.close}});break;case"geoarea":M.push({label:"Region",values:{name:null!==(j=null!==(k=null===(x=null===(b=A.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=A.datum)||void 0===w?void 0:w.name)&&void 0!==j?j:"",value:null!==(S=null===(O=A.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return M}(n),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(v),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Pt(e.min)} to ${Pt(e.max)}, mean ${Pt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(v.length,m),x=v.slice(0,5),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:f,id:r,tabIndex:-1,onBlur:y,style:Lt,role:"region","aria-label":p,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Dt,children:"×"}),e("div",{role:"note",style:It,children:b}),t("table",{role:"table","aria-label":"Sample data for "+i,style:$t,children:[t("caption",{style:Bt,children:["First ",x.length," of ",v.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Rt,children:"type"}),w.map(t=>e("th",{style:Rt,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:Wt,children:n.label}),w.map(t=>{return e("td",{style:Wt,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Pt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function Nt({summary:t}){return t?e("div",{role:"note",style:Ct,children:t}):null}function Et({tableId:t}){return e("a",{href:"#"+t,style:Ct,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Ct)},children:"Skip to data table"})}function _t({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Ct,children:n})}const Ht=Object.freeze([]);function Ft(e){if(!e)return Ht;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}const qt="var(--semiotic-focus, #005fcc)";function Gt({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:l,height:s}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=l&&null!=s){const t=Math.max(l,4),n=Math.max(s,4);u=e("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:qt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:qt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:qt,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Vt({x:t,y:n,containerWidth:i,containerHeight:r,margin:l,children:s,className:a="stream-frame-tooltip",zIndex:c=1}){const u=o.useRef(null),[d,h]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,i,r]);let f;return f=d?`translate(${d.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e("div",{ref:u,className:a,style:{position:"absolute",left:l.left+t,top:l.top+n,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"},children:s})}function Ut(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Zt(e,t,n=.6){var o,i,r,l,s;if(!Ut(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(s=null!==(l=t.cy)&&void 0!==l?l:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Yt(e,t,n,o=.35){Ut(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Xt(e){switch(e){case"monotoneX":return _;case"monotoneY":return E;case"cardinal":return R;case"catmullRom":return $;case"step":return N;case"stepBefore":return B;case"stepAfter":return T;case"basis":return W;case"natural":return F;default:return null}}function Qt(e,t,n){return null==t?n:"string"!=typeof t?t:Pe(e,t)||n}function Kt(e,t,n,o,i,r){const l=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>l.length)return null;const s=e.createLinearGradient(n,o,i,r);for(const e of l)s.addColorStop(e.offset,e.color);return s}function Jt(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function en(e,t,n,o,i,r){if(2>t.length)return;const l=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];l.push(l[e-1]+Math.sqrt(n*n+o*o))}const s=l[l.length-1];if(0===s)return;const a=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(l[n]+l[n+1])/2;let r=i;a>o&&(r*=o/a),a>s-o&&(r*=(s-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function tn(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,l=t[1]*o,s=t[0]+"px",a=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===l||(e.width=r,e.height=l),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function nn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function on([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function rn(e,t,n,o,i){return"function"==typeof e?e(t,n,o,i):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",i>1?"@2x":"")}class ln{constructor(e=256){this.cache=new Map,this.limit=e}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,o]of this.cache)t>o.lastUsed&&(t=o.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}}class sn{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let i=0;this.capacity>i;i++){const r=this.particles[i];if(!r.active)continue;const l=n[r.lineIndex];if(!l||2>l.length){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const s=an(l),a=cn(l,r.t*s),c=(o[r.lineIndex]||2)/2;r.x=a.x+a.nx*r.offset*c*2,r.y=a.y+a.ny*r.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function an(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],i=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+i*i)}return t}function cn(e,t){let n=0;for(let o=1;e.length>o;o++){const i=e[o][0]-e[o-1][0],r=e[o][1]-e[o-1][1],l=Math.sqrt(i*i+r*r);if(n+l>=t||o===e.length-1){const s=l>0?(t-n)/l:0,a=l>.001?l:1;return{x:e[o-1][0]+i*s,y:e[o-1][1]+r*s,nx:-r/a,ny:i/a}}n+=l}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const un={top:10,right:10,bottom:10,left:10},dn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"},hn={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function fn(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function pn(e){return e?e.getContext("2d"):null}function gn({data:n}){var o;if(!n)return null;if(n.properties)return e("div",{className:"semiotic-tooltip",style:dn,children:e("div",{style:{fontWeight:600},children:n.properties.name||n.properties.NAME||n.properties.id||"Feature"})});const i=null!==(o=n.data)&&void 0!==o?o:n,r=Object.entries(i).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return e("div",{className:"semiotic-tooltip",style:dn,children:r.map(([n,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[n,": "]}),e("span",{style:{fontWeight:600},children:o+""})]},n))})}const yn=f(function(n,o){var l,c,h,f,g,y,v,m,b,x;const{projection:k,projectionExtent:w,fitPadding:j,projectionTransform:O,areas:S,points:M,lines:A,xAccessor:C,yAccessor:z,lineDataAccessor:P,pointIdAccessor:L,lineType:I="geo",flowStyle:D="basic",graticule:$,zoomable:R,zoomExtent:W,onZoom:B,dragRotate:T,showParticles:N,particleStyle:E,tileURL:_,tileAttribution:H,tileCacheSize:F,size:G,width:Y,height:X,responsiveWidth:Q,responsiveHeight:K,margin:J,className:ee,background:te,areaStyle:ne,pointStyle:oe,lineStyle:ie,colorScheme:re,enableHover:se=!0,hoverAnnotation:ae,tooltipContent:ce,customClickBehavior:de,customHoverBehavior:he,annotations:fe,decay:ge,pulse:ye,transition:ve,animate:me,staleness:be,backgroundGraphics:xe,foregroundGraphics:ke,title:we,legend:je,legendPosition:Oe,legendHoverBehavior:Se,legendClickBehavior:Me,legendHighlightedCategory:Ae,legendIsolatedCategories:Ce,legendCategoryAccessor:ze,onCategoriesChange:Le,showAxes:Ie,accessibleTable:$e=!0,description:Re,summary:We}=n,Be=G||[Y||600,X||400],Te=i(!0),Ne=De({sizeProp:Be,responsiveWidth:Q,responsiveHeight:K,userMargin:J,marginDefault:un,foregroundGraphics:ke,backgroundGraphics:xe,animate:me,transitionProp:ve,themeDirtyRef:Te}),{reducedMotionRef:Ee,responsiveRef:_e,size:He,margin:Fe,adjustedWidth:qe,adjustedHeight:Ge,resolvedForeground:Ve,resolvedBackground:Ue,transition:Ze,introEnabled:Ye,tableId:Xe,rafRef:Qe,renderFnRef:Ke,scheduleRender:Je,currentTheme:et}=Ne,tt=function(){const[e,t]=u(!1);return xt(()=>{t(!0)},[]),e}(),nt=function(){const e=a(kt,wt,jt);return i(e).current}(),ot=r(()=>Array.isArray(S)?Ft(S):S,[S]),it=r(()=>Ft(M),[M]),rt=r(()=>Ft(A),[A]),lt=r(()=>null!=T?T:"orthographic"===fn(k),[T,k]),st=r(()=>{var e,t;return{projection:k,projectionExtent:w,fitPadding:j,xAccessor:C,yAccessor:z,lineDataAccessor:P,lineType:I,flowStyle:D,areaStyle:ne,pointStyle:oe,lineStyle:ie,colorScheme:re,themeSemantic:pe(et),themeSequential:null===(e=null==et?void 0:et.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==et?void 0:et.colors)||void 0===t?void 0:t.diverging,graticule:$,projectionTransform:O,decay:ge,pulse:ye,transition:Ze,introAnimation:Ye,annotations:fe,pointIdAccessor:L}},[k,w,j,C,z,P,I,D,ne,oe,ie,re,$,O,ge,ye,null==Ze?void 0:Ze.duration,null==Ze?void 0:Ze.easing,Ye,fe,L,et]),at=function(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return St(e,t);if(!Mt(e)||!Mt(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!St(n,i))return!1}else{if(!Mt(n)||!Mt(i))return!1;if(!Ot(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(st),ct=i(null);ct.current||(ct.current=new le(at));const ut=i(null),dt=i(null),ht=i(null),ft=i(null),pt=i(null);_&&!pt.current&&(pt.current=new ln(F||256));const gt=i(fe),yt=i(null),At=i(V),Ct=i(!1),Pt=i(null),Lt=s(e=>{Pt.current=e,_e&&"object"==typeof _e&&(_e.current=e)},[_e]),It=i(null),Dt=i(null),$t=i(null),Rt=i(0);if(N&&!$t.current){const e=null!==(l=null==E?void 0:E.maxPerLine)&&void 0!==l?l:30;$t.current=new sn(50*e)}const Wt=i(null),Bt=i(null),[Ht,qt]=u(null),[Ut,an]=u(0),[cn,dn]=u(!1),yn=i([]),vn=i(ze),mn=i(Le);vn.current=ze,mn.current=Le;const bn=s(()=>{var e,t;const n=vn.current,o=mn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=ct.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,yn.current)||(yn.current=i,o(i))},[]);d(()=>{var e;null===(e=ct.current)||void 0===e||e.updateConfig(at),Te.current=!0,Je()},[at,Je]),d(()=>{const e=ct.current;e&&(ot&&e.setAreas(ot),M&&e.setPoints(it),A&&e.setLines(rt),Te.current=!0,Je())},[ot,M,it,A,rt,Je]);const xn=s(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=ct.current)||void 0===t||t.pushPoint(e),Te.current=!0,Je())},[Je]),kn=s(e=>{var t;const n=Ft(e);0!==n.length&&(null===(t=ct.current)||void 0===t||t.pushMany(n),Te.current=!0,Je())},[Je]),wn=s(()=>{var e;null===(e=ct.current)||void 0===e||e.clear(),Te.current=!0,Je()},[Je]);p(o,()=>({push:xn,pushMany:kn,removePoint:e=>{var t,n;const o=null!==(n=null===(t=ct.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Te.current=!0,Je()),o},clear:wn,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=ct.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.projection)&&void 0!==n?n:null},getGeoPath:()=>{var e,t,n;return null!==(n=null===(t=null===(e=ct.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.geoPath)&&void 0!==n?n:null},getCartogramLayout:()=>{var e,t;return null!==(t=null===(e=ct.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>At.current.k,resetZoom:()=>{const e=Pt.current;e&&yt.current&&Z(e).call(yt.current.transform,V)},getData:()=>{var e,t;return null!==(t=null===(e=ct.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[xn,kn,wn,Je]);const{hoverHandlerRef:jn,onPointerMove:On,onPointerLeave:Sn}=Ne;d(()=>{jn.current=e=>{if(!se)return;const t=ct.current;if(!t||!t.scene.length)return;const n=dt.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-Fe.left,r=e.clientY-o.top-Fe.top;if(0>i||i>qe||0>r||r>Ge)return Wt.current=null,Bt.current=null,qt(null),null==he||he(null),void Je();ft.current||(ft.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const l=pn(ft.current);if(!l)return;const s=ue(t.scene,i,r,30,l,t.quadtree,t.maxPointRadius);if(s){const e=s.node,t=e.datum,n=Array.isArray(t)?null:(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,l;"point"===e.type?(o=e.x,l=e.y):"geoarea"===e.type?(o=e.centroid[0],l=e.centroid[1]):(o=i,l=r);const a=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,__semioticHoverData:!0,x:o,y:l});Wt.current=a,Bt.current=e,qt(a),null==he||he(a),Je()}else Wt.current&&(Wt.current=null,Bt.current=null,qt(null),null==he||he(null),Je())}},[se,qe,Ge,Fe,he,Je]),Ne.hoverLeaveRef.current=()=>{Wt.current=null,Bt.current=null,qt(null),null==he||he(null),Je()};const Mn=s(e=>{if(!de)return;const t=ct.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Fe.left,i=e.clientY-n.top-Fe.top;ft.current||(ft.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=pn(ft.current);if(!r)return;const l=ue(t.scene,o,i,30,r,t.quadtree,t.maxPointRadius);if(l){const e=l.node.datum,t=Array.isArray(e)?null:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;de(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i}))}},[de,Fe]),An=i(-1),Cn=i(null),zn=s(e=>{const t=ct.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)"point"===n.type&&null!=n.x?t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"}):"geoarea"===n.type&&n.centroid&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"circle"});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=An.current,i=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===i)return;if(e.preventDefault(),0>i)return An.current=-1,Cn.current=null,Wt.current=null,Bt.current=null,qt(null),null==he||he(null),void Je();const r=0>o?0:i;An.current=r;const l=n[r];Cn.current={shape:l.shape,w:l.w,h:l.h};const s=l.datum,a=Object.assign(Object.assign(Object.assign({},s||{}),(null==s?void 0:s.properties)||{}),{data:s,properties:null==s?void 0:s.properties,x:l.x,y:l.y,__semioticHoverData:!0});Wt.current=a,qt(a),null==he||he(a),Je()},[he,Je]),Pn=s(e=>{An.current=-1,Cn.current=null,On(e)},[On]);Ke.current=()=>{var e,t,n,o,i,r,l,s;Qe.current=0;const a=dt.current,c=ct.current;if(!a||!c)return;const u=performance.now();let d=!1;const h=Dt.current;h&&(Dt.current=null,c.applyRotation(h,{width:qe,height:Ge}));const f=c.advanceTransition(Ee.current?u+1e6:u),p=!Ee.current&&f;if(Te.current&&!f){const e={width:qe,height:Ge},t=lt?c.getRotation():null;c.computeScene(e);const n=At.current,o=1!==n.k||0!==n.x||0!==n.y;lt&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),Te.current=!1,a.setAttribute("aria-label",zt(c.scene,"Geographic chart")),bn()}const g=nn();if(_&&pt.current){const t=ut.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=tn(t,He,Fe,g);if(e){e.clearRect(-Fe.left,-Fe.top,He[0],He[1]),e.save(),e.beginPath(),e.rect(0,0,qe,Ge),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:i,height:r,tileCache:l,onTileLoad:s}=t,a=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:i=!0,clampY:r=!0}=e,l=Math.max(Math.log(n)/Math.LN2-8,0),s=Math.round(l),a=1<<s,c=Math.pow(2,l-s+8),u=o[0]-n/2,d=o[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?a:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(r?0:-1/0,Math.floor((0-d)/c)),g=Math.min(r?a:1/0,Math.ceil((t[1]-d)/c)),y=[];for(let e=p;g>e;++e)for(let t=h;f>t;++t)y.push([t,e,s]);return{tiles:y,translate:[u/c,d/c],scale:c}}({size:[i,r],scale:2*a*Math.PI,translate:c}),d=nn();let h=!0;for(const t of u.tiles){const[o,i,r]=on(t),a=`${r}/${o}/${i}`;let c=l.get(a);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:a,lastUsed:performance.now()};l.set(a,t),e.onload=()=>{t.loaded=!0,null==s||s()},e.onerror=()=>{t.loaded=!0},e.src=rn(n,r,o,i,d),c=t}if(!c.loaded){h=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return h}(e,{tileURL:_,projection:c.scales.projection,width:qe,height:Ge,tileCache:pt.current,onTileLoad:()=>Je()});e.restore(),t||(d=!0)}}}const y=tn(a,He,Fe,g);if(!y)return;if(y.clearRect(-Fe.left,-Fe.top,He[0],He[1]),te&&!_){const e=Pe(y,te);e&&(y.fillStyle=e,y.fillRect(0,0,qe,Ge))}y.save(),y.beginPath(),y.rect(0,0,qe,Ge),y.clip();const v=c.scene,m={width:qe,height:Ge};if(function(e,t){var n,o,i;const r=t.filter(e=>"geoarea"===e.type);for(const t of r){if(!t.pathData)continue;const r=new Path2D(t.pathData),l=t.style.fill||"#e0e0e0";if("none"!==l&&(e.fillStyle=l,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=Pe(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(i=t._decayOpacity)&&void 0!==i?i:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(r)}Yt(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(y,v),((e,t,n,o)=>{var i,r;const l=t.filter(e=>"line"===e.type);for(const s of l){if(2>s.path.length)continue;const a=s._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const c=s.style.stroke||"#007bff",u=Pe(e,c)||c,d=s.style.strokeWidth||2,h=s.colorThresholds,f=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=d,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const v=null!==(i=s.style.opacity)&&void 0!==i?i:1;en(e,s.path,u,d,v,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=Xt(s.curve),g=h&&h.length>0&&f&&f.length===s.path.length,y=s._decayOpacities;if(y&&y.length===s.path.length&&!g){e.strokeStyle=u;const m=null!==(r=s.style.opacity)&&void 0!==r?r:1;for(let b=0;s.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*m,e.beginPath(),e.moveTo(s.path[b][0],s.path[b][1]),e.lineTo(s.path[b+1][0],s.path[b+1][1]),e.stroke()}else if(g){let x=null,k=null,w=null,j=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function M(){O&&(e.stroke(),O=!1)}for(let A=0;s.path.length>A;A++){const[C,z]=s.path[A],P=f[A],L=Jt(P,h,u);if(null!==x&&null!==j&&null!==w){if(L===j)e.lineTo(C,z);else{const I=[];for(const D of h){const $=D.value;(w>$||$>P)&&($>w||P>$)||w===$||P===$||I.push({t:($-w)/(P-w)})}I.sort((e,t)=>e.t-t.t);for(const R of I){const W=x+(C-x)*R.t,B=k+(z-k)*R.t,T=Jt(w+(P-w)*Math.min(R.t+1e-4,1),h,u);e.lineTo(W,B),M(),S(T,W,B)}e.lineTo(C,z)}x=C,k=z,w=P,j=L}else S(L,C,z),x=C,k=z,w=P,j=L}M()}else{e.beginPath();const N=s.strokeGradient&&s.path.length>=2?Kt(e,s.strokeGradient,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(e.strokeStyle=N||u,p)q().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[E,_]=s.path[0];e.moveTo(E,_);for(let H=1;s.path.length>H;H++)e.lineTo(s.path[H][0],s.path[H][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=Qt(e,s.style.fill,s.style.fill),p&&!g)q().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[G,V]=s.path[0];e.moveTo(G,V);for(let U=1;s.path.length>U;U++)e.lineTo(s.path[U][0],s.path[U][1])}const F=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(F,o.height),e.closePath(),e.fill()}void 0!==a&&1>a&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(y,v,0,m),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=Qt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Qt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),Zt(e,t),e.globalAlpha=1}}finally{e.restore()}}})(y,v),N&&$t.current){const e=$t.current,s=v.filter(e=>"line"===e.type);if(s.length>0){const a=E||{},c=.3*(null!==(t=a.speedMultiplier)&&void 0!==t?t:1),h=null!==(n=a.maxPerLine)&&void 0!==n?n:30,f=null!==(o=a.spawnRate)&&void 0!==o?o:.15,p=null!==(i=a.radius)&&void 0!==i?i:2,g=null!==(r=a.opacity)&&void 0!==r?r:.7,v=u/1e3,m=Rt.current>0?Math.min(v-Rt.current,.1):.016;Rt.current=v;const b=s.map(e=>e.path),x=s.map(e=>e.style.strokeWidth||2);for(let t=0;s.length>t;t++)Math.random()<f&&e.countForLine(t)<h&&e.spawn(t);e.step(m,c,b,x),y.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=s[n.lineIndex],i="function"==typeof a.color?a.color(null!==(l=null==o?void 0:o.datum)&&void 0!==l?l:{}):"source"!==a.color&&a.color?a.color:(null==o?void 0:o.style.stroke)||"#fff";y.beginPath(),y.arc(n.x,n.y,p,0,2*Math.PI),y.fillStyle=i,y.fill()}y.globalAlpha=1,d=!0}}y.restore();const b=ht.current;if(b){const e=tn(b,He,Fe,g);if(e){e.clearRect(-Fe.left,-Fe.top,He[0],He[1]);const t=Bt.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof ae?ae:void 0,i=(null==o?void 0:o.pointColor)||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),i?(e.save(),e.globalAlpha=.4,e.fillStyle=i,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=i||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(be){const e=performance.now()-c.lastIngestTime>(null!==(s=be.threshold)&&void 0!==s?s:5e3);e!==cn&&dn(e)}const x=fe!==gt.current;x&&(gt.current=fe),(Te.current||x)&&an(e=>e+1),(p||null!=c.activeTransition||c.hasActivePulses||d)&&(Qe.current=requestAnimationFrame(()=>Ke.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:l,cleanup:s}=e;xt(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,l.current()},[t,n]);const a=i(s);a.current=s,d(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:tt,wasHydratingFromSSR:nt,storeRef:ct,dirtyRef:Te,renderFnRef:Ke,cleanup:()=>{var e;return null===(e=pt.current)||void 0===e?void 0:e.clear()}}),d(()=>{Te.current=!0,Je()},[qe,Ge,te,Je]),function(e,t,n,o,i,r){d(()=>{if(!e)return;const l=setInterval(()=>{var l;const s=t.current;if(!s||0===s.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(l=e.threshold)&&void 0!==l?l:5e3,u=a-s.lastIngestTime>c;u!==i&&(r(u),n.current=!0,o())},1e3);return()=>clearInterval(l)},[e,i,o])}(be,ct,Te,Je,cn,dn),d(()=>{if("production"!==process.env.NODE_ENV&&_){const e=fn(k);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[_,k]),d(()=>{const e=Pt.current;if(!R||!e)return yt.current&&e&&(Z(e).on(".zoom",null),yt.current=null),void(e&&Z(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=W||[1,8],o={width:qe,height:Ge};if(lt){let i=At.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),At.current=V.scale(i);const l=ct.current;l&&(l.applyZoomScale(i,o),Te.current=!1,Je(),(null===(r=l.scales)||void 0===r?void 0:r.projection)&&(null==B||B({projection:l.scales.projection,zoom:l.currentZoom})))};yt.current={scaleBy:(e,t)=>r(i*t),transform:(e,t)=>{var n;return r(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const l=e=>{e.preventDefault(),r(i*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),r(1.5*i))};e.addEventListener("wheel",l,{passive:!1}),e.addEventListener("dblclick",s);const a=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=ct.current;if(!o)return;const i=o.getRotation();It.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=It.current;t&&(Dt.current=[t.rotation[0]+(e.clientX-t.x)*a,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*a)),t.rotation[2]],Je())},d=t=>{var n;if(!It.current)return;It.current=null,e.releasePointerCapture(t.pointerId);const i=Dt.current;if(i){Dt.current=null;const e=ct.current;e&&(e.applyRotation(i,o),Je())}const r=ct.current;(null===(n=null==r?void 0:r.scales)||void 0===n?void 0:n.projection)&&(null==B||B({projection:r.scales.projection,zoom:r.currentZoom}))};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",l),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),yt.current=null}}const i=U().scaleExtent([t,n]).extent([[0,0],[He[0],He[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;At.current=t,Ct.current=!0;const n=ct.current;n&&(n.applyZoomTransform(t,o),Te.current=!1,Je())}).on("end",e=>{var t;At.current=e.transform,Ct.current=!1;const n=ct.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==B||B({projection:n.scales.projection,zoom:n.currentZoom}))});return yt.current=i,Z(e).call(i),()=>{Z(e).on(".zoom",null)}},[R,W,lt,He,qe,Ge,Fe,B,Je]);const Ln=se&&!1!==ae,In=Ln&&Ht?ce?ce(Ht):e(gn,{data:Ht}):null,Dn=In?e(Vt,{x:Ht.x,y:Ht.y,containerWidth:qe,containerHeight:Ge,margin:Fe,className:"stream-frame-tooltip",zIndex:10,children:In}):null;if(bt||!tt&&nt){const n=ct.current;n&&(ot||M||A)&&(ot&&n.setAreas(ot),M&&n.setPoints(it),A&&n.setLines(rt),n.computeScene({width:qe,height:Ge}));const o=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[];return t("div",{ref:Lt,className:"stream-geo-frame"+(ee?" "+ee:""),role:"img","aria-label":Re||("string"==typeof we?we:"Geographic chart"),style:{position:"relative",width:Q?"100%":He[0],height:K?"100%":He[1]},children:[e(Nt,{summary:We}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:He[0],height:He[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Fe.left},${Fe.top})`,children:Ue}),t("g",{transform:`translate(${Fe.left},${Fe.top})`,children:[te&&e("rect",{x:0,y:0,width:qe,height:Ge,fill:te}),o.map((t,n)=>function(t,n){var o,i,r,l,s,a;switch(t.type){case"geoarea":{const r=t;return r.pathData?e("path",{d:r.pathData,fill:mt(r.style.fill,"#e0e0e0"),fillOpacity:null!==(o=r.style.fillOpacity)&&void 0!==o?o:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(i=r._decayOpacity)&&void 0!==i?i:1},"geoarea-"+n):null}case"point":{const o=t;return e("circle",{cx:o.x,cy:o.y,r:o.r,fill:mt(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(l=o._decayOpacity)&&void 0!==l?l:null!==(s=o.style.opacity)&&void 0!==s?s:1},"point-"+n)}case"line":{const o=t;if(2>o.path.length)return null;const i="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(a=o.style.opacity)&&void 0!==a?a:1},"line-"+n)}default:return null}}(t,n))]})]}),e(vt,{width:qe,height:Ge,totalWidth:He[0],totalHeight:He[1],margin:Fe,scales:null,showAxes:!1,title:we,legend:je,legendPosition:Oe,legendHoverBehavior:Se,legendClickBehavior:Me,legendHighlightedCategory:Ae,legendIsolatedCategories:Ce,foregroundGraphics:Ve,annotations:fe,annotationFrame:0,xValues:[],yValues:[],pointNodes:o.filter(e=>"point"===e.type)})]})}return t("div",{ref:Lt,className:"stream-geo-frame"+(ee?" "+ee:""),role:"group","aria-label":Re||("string"==typeof we?we:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:Q?"100%":He[0],height:K?"100%":He[1],overflow:"hidden"},R?{touchAction:"none"}:{}),onKeyDown:zn,children:[$e&&e(Et,{tableId:Xe}),$e&&e(Tt,{scene:null!==(f=null===(h=ct.current)||void 0===h?void 0:h.scene)&&void 0!==f?f:[],chartType:"Geographic chart",tableId:Xe,chartTitle:"string"==typeof we?we:void 0}),e(Nt,{summary:We}),t("div",{role:"img","aria-label":Re||("string"==typeof we?we:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Ln?Pn:void 0,onMouseLeave:Ln?Sn:void 0,onClick:de?Mn:void 0,children:[Ue&&e("svg",{style:{position:"absolute",left:0,top:0,width:He[0],height:He[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Fe.left},${Fe.top})`,children:Ue})}),_&&e("canvas",{ref:ut,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e("canvas",{ref:dt,"aria-label":zt(null!==(y=null===(g=ct.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:ht,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(_t,{hoverPoint:Ht}),e(vt,{width:qe,height:Ge,totalWidth:He[0],totalHeight:He[1],margin:Fe,scales:null,showAxes:null!=Ie&&Ie,title:we,legend:je,legendPosition:Oe,legendHoverBehavior:Se,legendClickBehavior:Me,legendHighlightedCategory:Ae,legendIsolatedCategories:Ce,foregroundGraphics:Ve,annotations:fe,annotationFrame:Ut,xValues:[],yValues:[],pointNodes:null===(v=ct.current)||void 0===v?void 0:v.scene.filter(e=>"point"===e.type)}),(null==be?void 0:be.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===be.badgePosition?{top:4,left:4}:"bottom-left"===be.badgePosition?{bottom:4,left:4}:"bottom-right"===be.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:cn?"#dc3545":"#28a745",color:"white"}),children:cn?"STALE":"LIVE"}),R&&t("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Fe.bottom+8,left:Fe.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Pt.current,n=yt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(Z(t),1.5)},style:hn,children:"+"}),e("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Pt.current,n=yt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(Z(t),1/1.5)},style:hn,children:"−"})]}),H&&e("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Fe.bottom+2,right:Fe.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:H}),e(Gt,{active:An.current>=0,hoverPoint:Ht,margin:Fe,size:He,shape:null===(m=Cn.current)||void 0===m?void 0:m.shape,width:null===(b=Cn.current)||void 0===b?void 0:b.w,height:null===(x=Cn.current)||void 0===x?void 0:x.h}),Dn]})]})});yn.displayName="StreamGeoFrame";const vn={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function mn(e,t){return"function"==typeof t?t(e):e[t]}function bn(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function xn(n={}){const{fields:o,title:i,format:r,style:l={},className:s=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let a;const c=[];if(i){const e=mn(n,i);a=bn(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const l=mn(n,o);c.push({label:t,value:bn(l,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){a=bn(n[t],r);break}if(!a){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(a=bn(n[e[0]],r))}}const u=Object.assign(Object.assign({},vn),l);return t("div",{className:("semiotic-tooltip "+s).trim(),style:u,children:[a&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:a}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&a?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function kn(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t,r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:vn,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?xn(t):xn())}}function wn(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function jn(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function On(e){const t=e.map(wn),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return jn(e,n,o)}if(e>=1){const[e,o,i]=t[n];return jn(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[l,s,a]=t[i],[c,u,d]=t[i+1];return jn(Math.round(l+(c-l)*r),Math.round(s+(u-s)*r),Math.round(a+(d-a)*r))}}const Sn=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Mn=On(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),An=On(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Cn=On(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),zn=On(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Pn=On(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ln=On(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),In=On(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Dn=On(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),$n=On(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Rn=On(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Wn=On(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Bn=On(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);On(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),On(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),On(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),On(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),On(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),On(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),On(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const Tn={category10:Sn,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Mn,reds:An,greens:Cn,oranges:zn,purples:Pn,viridis:In,plasma:Dn},Nn=Sn,En=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],_n=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Hn(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||_n.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Nn[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%Nn.length]}function Fn(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return A().domain(o).range(n).unknown("#999");const r=Tn[n]||Tn.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:Nn;return A().domain(o).range(e).unknown("#999")}}function qn(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,l]=o,[s,a]=n;return l===r?(s+a)/2:s+(i-r)/(l-r)*(a-s)}const Gn=c(null);function Vn(){return l(Gn)}function Un(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Zn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Yn,Xn]=he(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Zn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Zn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Qn,Kn]=he(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Jn(e){const t=g(),n=e.clientId||t,{name:o}=e,i=Xn(e=>e.selections.get(o)),l=Xn(e=>e.setClause),a=Xn(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Un(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};l(o,{clientId:n,type:"point",fields:t})},[n,o,l]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};l(o,{clientId:n,type:"interval",fields:t})},[n,o,l]),clear:s(()=>{a(o,n)},[a,o,n]),clientId:n}}function eo(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:l}=Jn({name:t});return{onHover:s(e=>{if(!e)return void l();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,l,t]),predicate:o,isActive:i}}const to=c(!1),no=c(null),oo="undefined"==typeof window?d:h;function io(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}function ro(e,t,n){return t?o=>{var i;const r=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(r,n.selectedStyle);else{const e=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}function lo(){return we(e=>e.theme)}o.createContext(void 0);const so="#007bff";function ao(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function co(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function uo(){var e;const t=lo(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function ho({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:l,chartId:a,onClick:c,hoverHighlight:h,colorByField:f}){const p=g(),y=io(t,n),v=Jn({name:(null==e?void 0:e.name)||"__unused__"}),m=eo({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=Kn(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,w]=u(null),j=f||n[0],O=r(()=>{if(!h||null==k||!j)return null;const e=k,t=j;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,j]),S=s(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=ao(e,t,y.xField);null!=n&&function(e,t,n){const o=ot.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n})},rt())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&m.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&lt(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&m.onHover(null);if(h&&j)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[j];w(null!=n?n+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:a};if(e){const r=co(e),l=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(l),b&&b(l)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,m,y,p,i,l,a,b,h,j]),M=s(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=ao(e,t,y.xField);null!=n&&function(e,t,n){const o=ot.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(ot.positions);return t.delete(e),ot={positions:t},rt(),!1}ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n,locked:!0})},rt()}(y.name||"hover",n,p)}if(e&&c){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),c(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:a};if(e){const n=co(e),l=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(l),b&&b(l)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[c,i,b,l,a,y,p]);return d(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{st(e,p),lt(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:M,crosshairSourceId:p}}function fo({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:s="right",userMargin:a,defaults:c={top:50,bottom:60,left:70,right:40},categories:u}){const d=l(to),h=null!==l(no),f=void 0!==o?o:!d&&!!t,p=!!t&&(f||h),y=r(()=>{if(!p)return[];if(void 0!==u)return u;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[u,t,e,p]);!function(e){const t=l(no),n=g(),o=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=i([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(r.current,o)||(r.current=o);const s=r.current;oo(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),oo(()=>{t&&t.registerCategories(n,s)},[t,n,s])}(h&&t?y:[]);const v=r(()=>{if(!f||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:l}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(l&&l.length>0?l:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const l=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=l?o(l,t,n):n?n(i):En[r%En.length];return{label:i+"",color:s}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Hn,categories:y});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[f,t,e,n,y]),m=r(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=Object.assign(Object.assign({},c),e);return v&&("right"===s&&110>t.right?t.right=110:"left"===s&&110>t.left?t.left=110:"top"===s&&50>t.top?t.top=50:"bottom"===s&&80>t.bottom&&(t.bottom=80)),t},[c,a,v,s]);return{legend:v,margin:m,legendPosition:s}}const po={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function go(e,t,n){var o,i,r,l,s,a,c;const u=po[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(i=t.height)&&void 0!==i?i:u.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(l=t.showGrid)&&void 0!==l?l:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:yo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function yo(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function vo(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function mo({componentName:n,message:o,diagnosticHint:i,width:r,height:l}){return e("div",{role:"alert",style:{width:r,height:Math.max(l,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class bo extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(mo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var xo;const ko="undefined"!=typeof process&&"production"!==(null===(xo=process.env)||void 0===xo?void 0:xo.NODE_ENV);function wo({componentName:t,width:n,height:o,children:i}){return e(bo,{fallback:i=>e(mo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const jo={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Oo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function So(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},jo),{width:n,height:o}),children:i||"No data available"}):null}function Mo(t,n,o){if(!t)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),l=Math.max(6,Math.floor(o/(2.5*i))),s=Math.floor((o-(i*(r+l)-l))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Oo),{position:"absolute",top:s+o*(r+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}function Ao(e,t,n,o){if(!ko)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Co(e){const t=we(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function zo(e,t,n,o){return new(n||(n=Promise))(function(i,r){function l(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,s)}a((o=o.apply(e,t||[])).next())})}function Po(e){return e}function Lo(e,t){var n=t.id,o=t.bbox,i=null==t.properties?{}:t.properties,r=function(e,t){var n=function(e){if(null==e)return Po;var t,n,o=e.scale[0],i=e.scale[1],r=e.translate[0],l=e.translate[1];return function(e,s){s||(t=n=0);var a=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+r,u[1]=(n+=e[1])*i+l;c>a;)u[a]=e[a],++a;return u}}(e.transform),o=e.arcs;function i(e,t){t.length&&t.pop();for(var i=o[0>e?~e:e],r=0,l=i.length;l>r;++r)t.push(n(i[r],r));0>e&&function(e,t){for(var n,o=e.length,i=o-t;i<--o;)n=e[i],e[i++]=e[o],e[o]=n}(t,l)}function r(e){return n(e)}function l(e){for(var t=[],n=0,o=e.length;o>n;++n)i(e[n],t);return 2>t.length&&t.push(t[0]),t}function s(e){for(var t=l(e);4>t.length;)t.push(t[0]);return t}function a(e){return e.map(s)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=r(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(r);break;case"LineString":n=l(t.arcs);break;case"MultiLineString":n=t.arcs.map(l);break;case"Polygon":n=a(t.arcs);break;case"MultiPolygon":n=t.arcs.map(a);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:i,geometry:r}:null==o?{type:"Feature",id:n,properties:i,geometry:r}:{type:"Feature",id:n,bbox:o,properties:i,geometry:r}}"function"==typeof SuppressedError&&SuppressedError;const Io=new Map;function Do(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function $o(e){return zo(this,void 0,void 0,function*(){const t=Io.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return zo(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:Do(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Do(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Do(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Do(yield import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}})}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const i=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return Lo(e,t)})}:Lo(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return Io.set(e,r),r})}function Ro(e){const t=r(()=>Array.isArray(e)?e:void 0,[e]),[n,o]=u(null);return d(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return o(null),$o(e).then(e=>{t||o(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),o(null)}else o(null)},[e]),void 0!==t?t:n}const Wo={blues:Mn,reds:An,greens:Cn,viridis:In,oranges:zn,purples:Pn,greys:Ln,plasma:Dn,inferno:$n,magma:Rn,cividis:Wn,turbo:Bn};function Bo(n){var o;const i=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),l=function(){var e;const t=lo();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:s,valueAccessor:a,colorScheme:c,projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:f,zoomExtent:p,onZoom:g,dragRotate:y,tileURL:v,tileAttribution:m,tileCacheSize:b,tooltip:x,areaOpacity:k=1,annotations:w,margin:j,className:O,selection:S,linkedHover:M,onObservation:A,onClick:z,chartId:P,loading:I,emptyContent:D,frameProps:$={},stroke:R,strokeWidth:W,opacity:B}=n,T=null!=f?f:!!v,N=Ro(s),E=r(()=>N?Ft(N):N,[N]),_=r(()=>"function"==typeof a?a:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[a])&&void 0!==n?n:null==e?void 0:e[a]},[a]),H=null!==(o=null!=c?c:l)&&void 0!==o?o:"blues",F=r(()=>{if(!E)return C(Mn).domain([0,1]);const e=E.map(e=>_(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=L(e);return C(Wo[H]||Mn).domain([null!=t?t:0,null!=n?n:1])},[E,_,H]),{activeSelectionHook:q,customHoverBehavior:G,customClickBehavior:V}=ho({selection:S,linkedHover:M,onObservation:A,onClick:z,chartType:"ChoroplethMap",chartId:P}),U=Co(S),Z=r(()=>{const e=vo(e=>{const t=_(e);return{fill:null!=t&&isFinite(t)?F(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}},{stroke:R,strokeWidth:W,opacity:B});return q?ro(e,q,U):e},[_,F,q,U,k,R,W,B]),Y=r(()=>n=>{var o,i;const r=(null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.name)||(null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||"Feature",l=_(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:r}),null!=l&&e("div",{style:{opacity:.7},children:(s=l,"number"==typeof s&&isFinite(s)?Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=s?s:"")+"")})]});var s},[_]),X=r(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof j?{top:j,bottom:j,left:j,right:j}:j),[j]),Q=Mo(I,i.width,i.height)||(E?null:Mo(!0,i.width,i.height)),K=Q?null:So(E,i.width,i.height,D);if(Array.isArray(E)&&E.length>0){const t=E[0];if(!t||"object"!=typeof t||!t.geometry)return e(mo,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:i.width,height:i.height})}const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:u,areas:E,areaStyle:Z,size:[i.width,i.height],margin:X,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?Y:kn(x)||Y},null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),T&&{zoomable:!0}),p&&{zoomExtent:p}),g&&{onZoom:g}),null!=y&&{dragRotate:y}),v&&{tileURL:v}),m&&{tileAttribution:m}),b&&{tileCacheSize:b}),(M||A||z)&&{customHoverBehavior:G}),(A||z)&&{customClickBehavior:V}),w&&w.length>0&&{annotations:w}),i.title&&{title:i.title}),i.description&&{description:i.description}),i.summary&&{summary:i.summary}),void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),$);return Q||K||e(wo,{componentName:"ChoroplethMap",width:i.width,height:i.height,children:e(yn,Object.assign({},J))})}function To(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:l,legendPosition:a,selection:c,linkedHover:d,fallbackFields:h,unwrapData:f=!1,onObservation:p,chartType:g,chartId:y,showLegend:v,userMargin:m,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,emptyContent:j,width:O,height:S}=e,M=void 0===n,A=r(()=>Ft(t),[t]),[C,z]=u([]),P=s(e=>{z(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:I,hoverSelectionHook:D,customHoverBehavior:$,customClickBehavior:R,crosshairSourceId:W}=ho({selection:c,linkedHover:d,fallbackFields:h,unwrapData:f,onObservation:p,chartType:g,chartId:y,onClick:x,hoverHighlight:k,colorByField:L}),B=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(d,W),T=function(e,t,n){const o=Vn(),i=uo();return r(()=>{var r;if(!t)return;const l=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=Fn(n.map(e=>({_cat:e})),"_cat",l);return t=>o[t]||e(t)}return Fn(n.map(e=>({_cat:e})),"_cat",l)}if(o&&Object.keys(o).length>0){const n=Fn(e,t,l);return e=>o[e]||n(e)}return Fn(e,t,l)}if(o&&Object.keys(o).length>0){const e=Fn([{_:"a"}],"_",l);return t=>o[t]||e(t)}},[e,t,n,o,i])}(A,o,i),N=r(()=>{if(!o)return[];const e=new Set;for(const t of A){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[A,o]),E=r(()=>M&&C.length>0?C:N,[M,C,N]),_=function(e,t,n){const[o,i]=u(null),[l,a]=u(new Set),c=s(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,o,l]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(l,o,E),H=r(()=>D||(_.legendSelectionHook?_.legendSelectionHook:I),[D,_.legendSelectionHook,I]),F=Co(c),q=uo(),G=Vn(),V=r(()=>{if(T)return T;if(!o||0===E.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:q&&q.length>0?q:En,t="__streamCat",n=Fn(E.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||n(e)||"#999"},[T,o,E,i,q,G]),{legend:U,margin:Z,legendPosition:Y}=fo({data:A,colorBy:o,colorScale:V,showLegend:v,legendPosition:a,userMargin:m,defaults:b,categories:E}),X=r(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Y),l&&"none"!==l&&(e.legendHoverBehavior=_.onLegendHover,e.legendClickBehavior=_.onLegendClick,e.legendHighlightedCategory=_.highlightedCategory,e.legendIsolatedCategories=_.isolatedCategories),M&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=P),e},[U,Y,l,_.onLegendHover,_.onLegendClick,_.highlightedCategory,_.isolatedCategories,M,o,P]),Q=Array.isArray(n)?Ft(n):n,K=Mo(w,O,S),J=K?null:So(Q,O,S,j);return{data:A,colorScale:T,allCategories:E,legendState:_,effectiveSelectionHook:H,activeSelectionHook:I,customHoverBehavior:$,customClickBehavior:R,legend:U,margin:Z,legendPosition:Y,earlyReturn:K||J||null,legendBehaviorProps:X,crosshairProps:B,resolvedSelection:F}}function No(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,l;const s=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of s){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(l=e.current)||void 0===l||l.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const l=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removePoint(e))&&void 0!==i?i:[];for(const e of l)null===(r=n.current)||void 0===r||r.push(t(e));return l},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}Bo.displayName="ChoroplethMap";const Eo=f(function(n,o){const l=i(null);No(o,{variant:"geo-points",frameRef:l});const s=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:a,xAccessor:c="lon",yAccessor:u="lat",sizeBy:d,sizeRange:h=[3,30],colorBy:f,colorScheme:p,projection:g="equalEarth",graticule:y,fitPadding:v,zoomable:m,zoomExtent:b,onZoom:x,dragRotate:k,tileURL:w,tileAttribution:j,tileCacheSize:O,areas:S,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:A,annotations:C,margin:z,className:P,selection:L,linkedHover:I,onObservation:D,onClick:$,chartId:R,loading:W,emptyContent:B,legendInteraction:T,legendPosition:N,frameProps:E={},stroke:_,strokeWidth:H,opacity:F}=n,q=null!=m?m:!!w,G=Ro(S),V=To({data:null!=a?a:Ht,rawData:a,colorBy:f,colorScheme:p,legendInteraction:T,legendPosition:N,selection:L,linkedHover:I,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:D,onClick:$,chartType:"ProportionalSymbolMap",chartId:R,showLegend:s.showLegend,userMargin:z,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:W,emptyContent:B,width:s.width,height:s.height}),U=V.data,Z=r(()=>{if(!d)return;const e="function"==typeof d?d:e=>null==e?void 0:e[d],t=U.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[U,d]),Y=r(()=>{const e=vo(e=>({fill:f?Hn(e,f,V.colorScale):so,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:d?qn(e,d,h,Z):6}),{stroke:_,strokeWidth:H,opacity:F});return V.effectiveSelectionHook?ro(e,V.effectiveSelectionHook,V.resolvedSelection):e},[f,V.colorScale,V.effectiveSelectionHook,V.resolvedSelection,d,h,Z,_,H,F]),X=r(()=>n=>{const o=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n.NAME)||(null==n?void 0:n.id),i="string"==typeof d?d:null,r=("function"==typeof d?d:e=>e[d])(n),l=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",s="string"==typeof f?f:null,a=s?null==n?void 0:n[s]:null;return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[o&&e("div",{style:{fontWeight:600,marginBottom:2},children:o}),i&&null!=r&&t("div",{children:[t("span",{style:{opacity:.7},children:[i,": "]}),l(r)]}),s&&null!=a&&t("div",{children:[t("span",{style:{opacity:.7},children:[s,": "]}),a+""]}),!o&&!i&&Object.entries(n).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,": "]}),l(n)]},e))]})},[d,f]);Ao("ProportionalSymbolMap",U,"xAccessor",c),Ao("ProportionalSymbolMap",U,"yAccessor",u);const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:g},null!=a&&{points:U}),{xAccessor:c,yAccessor:u,pointStyle:Y}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),G&&{areas:G,areaStyle:M}),null!=y&&{graticule:y}),null!=v&&{fitPadding:v}),q&&{zoomable:!0}),b&&{zoomExtent:b}),x&&{onZoom:x}),null!=k&&{dragRotate:k}),w&&{tileURL:w}),j&&{tileAttribution:j}),O&&{tileCacheSize:O}),{size:[s.width,s.height],margin:V.margin,enableHover:!0,tooltipContent:!1===A?()=>null:kn(A)||X}),V.legendBehaviorProps),(I||D||$)&&{customHoverBehavior:V.customHoverBehavior}),(D||$)&&{customClickBehavior:V.customClickBehavior}),C&&C.length>0&&{annotations:C}),s.title&&{title:s.title}),s.description&&{description:s.description}),s.summary&&{summary:s.summary}),void 0!==s.accessibleTable&&{accessibleTable:s.accessibleTable}),P&&{className:P}),null!=n.animate&&{animate:n.animate}),E);return V.earlyReturn?V.earlyReturn:e(wo,{componentName:"ProportionalSymbolMap",width:s.width,height:s.height,children:e(yn,Object.assign({ref:l},Q))})});function _o(n){const o=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:i,nodes:l,nodeIdAccessor:a="id",xAccessor:c="lon",yAccessor:u="lat",valueAccessor:d="value",projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:g,zoomExtent:y,onZoom:v,dragRotate:m,tileURL:b,tileAttribution:x,tileCacheSize:k,lineType:w="geo",flowStyle:j="basic",areas:O,areaStyle:S={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:A,edgeOpacity:C=.6,edgeWidthRange:z=[1,8],edgeLinecap:P="round",colorScheme:L,showParticles:I,particleStyle:D,tooltip:$,annotations:R,margin:W,className:B,selection:T,linkedHover:N,onObservation:E,onClick:_,chartId:H,loading:F,emptyContent:q,frameProps:G={},legendInteraction:V,legendPosition:U,stroke:Z,strokeWidth:Y,opacity:X}=n,Q=null!=g?g:!!b,K=Ro(O),J=r(()=>Ft(l),[l]),ee=To({data:null!=i?i:Ht,rawData:i,colorBy:A,colorScheme:L,legendInteraction:V,legendPosition:U,selection:T,linkedHover:N,fallbackFields:A?["string"==typeof A?A:""]:[],unwrapData:!1,onObservation:E,onClick:_,chartType:"FlowMap",chartId:H,showLegend:o.showLegend,userMargin:W,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:F,emptyContent:q,width:o.width,height:o.height}),te=ee.data,ne=io(N),oe=eo({name:(null==ne?void 0:ne.name)||"hover",fields:(null==ne?void 0:ne.fields)||[]}),ie=Kn(e=>e.pushObservation),re=r(()=>{const e=new Map;for(const t of J)e.set(t[a]+"",t);return e},[J,a]),le=r(()=>{const e=new Map;for(const t of te)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[te]),se=s(e=>{var t,n;if(N)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=le.get(t[a]+"");e&&oe.onHover(e)}else oe.onHover(t)}else oe.onHover(null);if(E||ie){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:H};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const r=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});E&&E(r),ie&&ie(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});E&&E(e),ie&&ie(e)}}},[N,oe,a,le,E,H,ie]),ae=ee.customClickBehavior,ce=r(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];return te.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=re.get(n.source+""),i=re.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[c]:e(o),[u]:t(o)},{[c]:e(i),[u]:t(i)}]}):null}).filter(Boolean)},[te,re,c,u]),ue=r(()=>{const e=te.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[d])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>z[0]:M().domain([Math.min(...e),Math.max(...e)]).range(z)},[te,d,z]),de=r(()=>e=>{var t;return{stroke:A?Hn(e,A,ee.colorScale):so,strokeWidth:ue(null!==(t=e[d])&&void 0!==t?t:0),strokeLinecap:P,opacity:C}},[A,ee.colorScale,ue,d,C,P]),he=r(()=>{var e;const t=vo(de,{stroke:Z,strokeWidth:Y,opacity:X});if(!ee.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=ee.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return ro(t,ee.effectiveSelectionHook,Object.assign(Object.assign({},ee.resolvedSelection||{}),{unselectedStyle:n}))},[de,ee.effectiveSelectionHook,ee.resolvedSelection,Z,Y,X]),fe=r(()=>vo(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:Z,strokeWidth:Y,opacity:X}),[Z,Y,X]),pe=r(()=>n=>{var o,i,r,l,s,c,u;if((null==n?void 0:n.geometry)||(null==n?void 0:n.properties)||(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.geometry)){const t=(null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i.name)||(null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||(null===(s=null===(l=null==n?void 0:n.data)||void 0===l?void 0:l.properties)||void 0===s?void 0:s.name)||(null===(u=null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.properties)||void 0===u?void 0:u.NAME);if(t)return e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:t})})}if(null!=(null==n?void 0:n.source)&&null!=(null==n?void 0:n.target)){const o=n[d];return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t("div",{style:{fontWeight:600},children:[n.source," → ",n.target]}),null!=o&&e("div",{style:{opacity:.7},children:"number"==typeof o?o.toLocaleString():o})]})}const h=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n[a]);return null!=h?e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:h})}):null},[d,a]),ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h,lines:ce,points:J,xAccessor:c,yAccessor:u,lineDataAccessor:"coordinates",lineType:w,flowStyle:j,lineStyle:he,pointStyle:fe},K&&{areas:K,areaStyle:S}),null!=f&&{graticule:f}),null!=p&&{fitPadding:p}),Q&&{zoomable:!0}),y&&{zoomExtent:y}),v&&{onZoom:v}),null!=m&&{dragRotate:m}),I&&{showParticles:I}),D&&{particleStyle:D}),b&&{tileURL:b}),x&&{tileAttribution:x}),k&&{tileCacheSize:k}),{size:[o.width,o.height],margin:ee.margin,enableHover:!0,tooltipContent:!1===$?()=>null:kn($)||pe}),ee.legendBehaviorProps),(N||E||_)&&{customHoverBehavior:se}),(E||_)&&{customClickBehavior:ae}),R&&R.length>0&&{annotations:R}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),B&&{className:B}),null!=n.animate&&{animate:n.animate}),G);return ee.earlyReturn?ee.earlyReturn:e(wo,{componentName:"FlowMap",width:o.width,height:o.height,children:e(yn,Object.assign({},ge))})}Eo.displayName="ProportionalSymbolMap",_o.displayName="FlowMap";const Ho=f(function(n,o){const l=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:a,lines:c,xAccessor:h="lon",yAccessor:f="lat",nodeIdAccessor:p="id",center:g,costAccessor:y,strength:v=1,lineMode:m="straight",projection:b="mercator",graticule:x,fitPadding:k,zoomable:w,zoomExtent:j,onZoom:O,dragRotate:S,tileURL:M,tileAttribution:A,tileCacheSize:C,transition:z,colorBy:P,colorScheme:L,pointRadius:I=5,tooltip:D,showRings:$=!0,ringStyle:R,showNorth:W=!0,costLabel:B,annotations:T,margin:N,className:E,selection:_,linkedHover:H,onObservation:F,onClick:q,chartId:G,loading:V,emptyContent:U,legendPosition:Z,frameProps:Y={},stroke:X,strokeWidth:Q,opacity:K}=n,J=null!=w?w:!!M,ee=r(()=>Ft(a),[a]),te=To({data:ee,rawData:a,colorBy:P,colorScheme:L,legendInteraction:void 0,legendPosition:Z,selection:_,linkedHover:H,fallbackFields:P?["string"==typeof P?P:""]:[],unwrapData:!1,onObservation:F,onClick:q,chartType:"DistanceCartogram",chartId:G,showLegend:l.showLegend,userMargin:N,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:V,emptyContent:U,width:l.width,height:l.height}),ne=r(()=>{const e=vo(e=>({fill:P?Hn(e,P,te.colorScale):so,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:I}),{stroke:X,strokeWidth:Q,opacity:K});return te.effectiveSelectionHook?ro(e,te.effectiveSelectionHook,te.resolvedSelection):e},[P,te.colorScale,te.effectiveSelectionHook,te.resolvedSelection,I,X,Q,K]),oe=r(()=>({center:g,centerAccessor:p,costAccessor:y,strength:v,lineMode:m}),[g,p,y,v,m]),ie=r(()=>{if(!c)return;const e="function"==typeof h?h:e=>e[h],t="function"==typeof f?f:e=>e[f],n=new Map;for(const e of ee)n.set(e[p]+"",e);return c.map(o=>{if(o.coordinates)return o;const i=n.get(o.source+""),r=n.get(o.target+"");return i&&r?Object.assign(Object.assign({},o),{coordinates:[{[h]:e(i),[f]:t(i)},{[h]:e(r),[f]:t(r)}]}):null}).filter(Boolean)},[c,ee,h,f,p]),re=r(()=>n=>{const o=("function"==typeof y?y:e=>e[y])(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:n[p]||n.name||n.id||"Point"}),null!=o&&t("div",{style:{opacity:.7},children:["Cost: ","number"==typeof o?o.toFixed(1):o]})]})},[y,p]),le=i(null);No(o,{variant:"geo-points",frameRef:le});const[se,ae]=u(null),ce=s(()=>{var e,t;const n=null===(t=null===(e=le.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ae(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);d(()=>{const e=requestAnimationFrame(ce);return()=>cancelAnimationFrame(e)},[ce,v,g,l.width,l.height,ee]);const ue=r(()=>{if(!$||!se)return[];const{maxCost:e}=se;if(0>=e)return[];if(Array.isArray($))return $.filter(t=>t>0&&e>=t);const t="number"==typeof $?$:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[$,se]),de=r(()=>{var n,o;if(!se)return Y.foregroundGraphics||null;const{cx:i,cy:r,maxCost:l,availableRadius:s}=se,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},R),c=null!==(n=te.margin.left)&&void 0!==n?n:10,u=null!==(o=te.margin.top)&&void 0!==o?o:10;return t("g",{children:[ue.map(n=>{const o=n/l*s;return t("g",{children:[e("circle",{cx:i+c,cy:r+u,r:o,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),t("text",{x:i+c+o+3,y:r+u-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif",children:[n,B?" "+B:""]})]},n)}),W&&t("g",{transform:`translate(${c+24}, ${u+24})`,children:[e("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),Y.foregroundGraphics]})},[se,ue,W,B,R,te.margin,Y.foregroundGraphics]);Ao("DistanceCartogram",ee,"xAccessor",h),Ao("DistanceCartogram",ee,"yAccessor",f);const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:b},null!=a&&{points:ee}),ie&&{lines:ie,lineDataAccessor:"coordinates"}),{xAccessor:h,yAccessor:f,pointIdAccessor:p,pointStyle:ne,projectionTransform:oe}),z&&{transition:{duration:z}}),null!=x&&{graticule:x}),null!=k&&{fitPadding:k}),J&&{zoomable:!0}),j&&{zoomExtent:j}),O&&{onZoom:O}),null!=S&&{dragRotate:S}),M&&{tileURL:M}),A&&{tileAttribution:A}),C&&{tileCacheSize:C}),{size:[l.width,l.height],margin:te.margin,enableHover:!0,tooltipContent:!1===D?()=>null:kn(D)||re}),te.legendBehaviorProps),(H||F||q)&&{customHoverBehavior:te.customHoverBehavior}),(F||q)&&{customClickBehavior:te.customClickBehavior}),T&&T.length>0&&{annotations:T}),l.title&&{title:l.title}),l.description&&{description:l.description}),l.summary&&{summary:l.summary}),void 0!==l.accessibleTable&&{accessibleTable:l.accessibleTable}),E&&{className:E}),null!=n.animate&&{animate:n.animate}),Y),de&&{foregroundGraphics:de});return te.earlyReturn?te.earlyReturn:e(wo,{componentName:"DistanceCartogram",width:l.width,height:l.height,children:e(yn,Object.assign({ref:le},he))})});function Fo(e,t,n){const{featureKey:o,dataKey:i}=n,r=new Map;for(const e of t)r.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=null==n?void 0:n[e];return(null!=n?n:"")+""})(e),n=r.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})}Ho.displayName="DistanceCartogram";export{Bo as ChoroplethMap,Ho as DistanceCartogram,_o as FlowMap,Eo as ProportionalSymbolMap,yn as StreamGeoFrame,Fo as mergeData,$o as resolveReferenceGeography};
2
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useContext as l,useCallback as s,useSyncExternalStore as a,createContext as c,useState as u,useEffect as d,useLayoutEffect as h,forwardRef as f,useImperativeHandle as p,useId as g}from"react";import{geoPath as y,geoGraticule as v,geoDistance as m,geoInterpolate as b,geoEqualEarth as x,geoEquirectangular as k,geoNaturalEarth1 as w,geoOrthographic as j,geoAlbersUsa as O,geoMercator as M}from"d3-geo";import{scaleLinear as A,scaleOrdinal as S,scaleSequential as C}from"d3-scale";import{quadtree as L}from"d3-quadtree";import{bin as z,extent as P}from"d3-array";import{packEnclose as D}from"d3-hierarchy";import{area as I,curveCatmullRom as $,curveCardinal as R,curveBasis as W,curveStepBefore as B,curveStepAfter as T,curveStep as N,curveMonotoneY as E,curveMonotoneX as _,curveLinear as H,curveNatural as F,line as q}from"d3-shape";import G from"regression";import{zoomIdentity as V,zoom as U}from"d3-zoom";import{select as Z}from"d3-selection";class Y{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,l=this.buffer[r];if(e(l)){let e;e="object"!=typeof l||null===l?l:Array.isArray(l)?[...l]:Object.assign({},l),n.push(e),this.buffer[r]=t(l)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function X(e,t,n){return e+(t-e)*n}function Q(e,t,n){var o,i,r;if(1>=n)return 1;const l=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return l+(1-s/(n-1))*(1-l);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return l+Math.pow(.5,s/t)*(1-l)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>s?1:l;default:return 1}}const K={mercator:M,equalEarth:x,albersUsa:O,orthographic:j,naturalEarth:w,equirectangular:k};function J(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function ee(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function te(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function ne(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let i=[e[0]];for(let t=1;e.length>t;t++){const r=e[t];Math.abs(r[0]-e[t-1][0])>n?(2>i.length||o.push(i),i=[r]):i.push(r)}return 2>i.length||o.push(i),o}function oe(e,t,n=24){const o=t[0]-e[0],i=t[1]-e[1],r=Math.sqrt(o*o+i*i);if(0===r)return[e,t];const l=-i/r,s=o/r,a=Math.min(.3*r,80),c=(e[0]+t[0])/2+l*a,u=(e[1]+t[1])/2+s*a,d=[];for(let o=0;n>=o;o++){const i=o/n,r=1-i;d.push([r*r*e[0]+2*r*i*c+i*i*t[0],r*r*e[1]+2*r*i*u+i*i*t[1]])}return d}function ie(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const i=e[t];let r,l;0===t?(r=e[1][0]-i[0],l=e[1][1]-i[1]):t===e.length-1?(r=i[0]-e[t-1][0],l=i[1]-e[t-1][1]):(r=e[t+1][0]-e[t-1][0],l=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(r*r+l*l)||1;o.push([i[0]+l/s*n,i[1]+-r/s*n])}return o}function re(e,t,n,o,i){const r=t[0]-e[0],l=t[1]-e[1],s=Math.sqrt(r*r+l*l);if(0===s)return[e,t];const a=l/s,c=-r/s,u=i/2+1;return[[e[0]+a*u,e[1]+c*u],[t[0]+a*u,t[1]+c*u]]}class le{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e.slice()}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}pushLine(e){null!=e&&"object"==typeof e&&(this.lineData.push(e),this.version++)}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return;const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){for(const e of t)this.lineData.push(e);this.version++}}removeLine(e){const{lineIdAccessor:t}=this.config;if(!t)throw Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]),i=[];return this.lineData=this.lineData.filter(e=>!o.has(n(e)+"")||(i.push(e),!1)),i.length>0&&this.version++,i}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return x();if("string"==typeof e){const t=K[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),x())}if("object"==typeof e&&"type"in e){const t=K[e.type],n=t?t():x();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=y(this.projection),this.fitProjection(e),this.geoPath=y(this.projection);const n=this.projection;this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null};const o=this.scene;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&o.length>0&&this.startTransition(o),this.version++}fitProjection(e){var t,n,o,i,r;const l=this.projection,s=this.config,a=[...this.areas],c=J(s.xAccessor,"lon"),u=J(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=ee(s.lineDataAccessor);for(const e of this.lineData){const t=h(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==a.length){if(s.projectionExtent){const[[t,n],[o,i]]=s.projectionExtent;l.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,i],[t,i],[t,n]]]}})}else if(l.clipAngle&&(null!==(t=l.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=s.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);l.scale(o/2-o*t),l.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,i=e.height*t;l.fitExtent([[n,i],[e.width-n,e.height-i]],{type:"FeatureCollection",features:a})}this.baseScale=l.scale(),this.baseTranslate=l.translate(),this.baseRotation=null!==(r=null===(i=l.rotate)||void 0===i?void 0:i.call(l))&&void 0!==r?r:[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=y(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=y(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;n&&n.rotate&&(n.rotate(e),this.geoPath=y(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,le.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._quadtree=L().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,n,o;const i=[],{config:r}=this,l=this.projection,s=this.geoPath,a=J(r.xAccessor,"lon"),c=J(r.yAccessor,"lat"),u=function(e){var t,n;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.surface)||"#e0e0e0",stroke:(null===(n=e.themeSemantic)||void 0===n?void 0:n.border)||"#999",strokeWidth:.5,fillOpacity:1}}(r),d=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(r),h=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(r);if(r.graticule){const t=!0===r.graticule?{}:r.graticule,n=v();t.step&&n.step(t.step);const o=s(n())||"";o&&i.push({type:"geoarea",pathData:o,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=s(e);if(!t)continue;const n=s.centroid(e),o=s.bounds(e),l=s.area(e),a=te(r.areaStyle,e,u);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:l,style:a,datum:e,interactive:!0})}const f=ee(r.lineDataAccessor);for(const t of this.lineData){const n=f(t);if(!n||2>n.length)continue;let o=[];if("geo"===r.lineType){const e=Array(n.length);for(let t=0;n.length>t;t++)e[t]=[a(n[t]),c(n[t])];for(let t=0;e.length-1>t;t++){const n=e[t],i=e[t+1],r=m(n,i)||0,s=Math.max(2,Math.ceil(r/(Math.PI/180))),a=b(n,i);for(let e=0;s>=e;e++){if(t>0&&0===e)continue;const n=l(a(e/s));null!=n&&o.push(n)}}}else for(let e=0;n.length>e;e++){const t=n[e],i=l([a(t),c(t)]);null!=i&&o.push(i)}if(2>o.length)continue;const s=te(r.lineStyle,t,d),u="number"==typeof s.strokeWidth?s.strokeWidth:1;2!==n.length||2>o.length||"arc"!==r.flowStyle?2!==n.length||2>o.length||"offset"!==r.flowStyle||(o="geo"===r.lineType?ie(o,u):re(o[0],o[o.length-1],0,0,u)):o=oe(o[0],o[o.length-1]);const h=ne(o,e.width);if(h.length>1)for(const e of h){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},s),{_edgeFade:!0}),datum:t};i.push(n)}else i.push({type:"line",path:2>o.length&&h[0]||o,style:s,datum:t})}const p=this.getPoints(),g=r.pointIdAccessor?"function"==typeof r.pointIdAccessor?r.pointIdAccessor:e=>e[r.pointIdAccessor]:null,y=l.clipAngle&&null!==(t=l.clipAngle())&&void 0!==t?t:0,x=y>0?y*Math.PI/180:null,k=l.rotate?l.rotate():[0,0,0],w="function"==typeof l.center?l.center():[0,0],j=[(null!==(n=w[0])&&void 0!==n?n:0)-k[0],(null!==(o=w[1])&&void 0!==o?o:0)-k[1]];for(let e=0;p.length>e;e++){const t=p[e],n=a(t),o=c(t);if(null!=x&&m([n,o],j)>x)continue;const s=l([n,o]);if(!s)continue;const u=r.pointStyle?r.pointStyle(t):Object.assign({},h),d={type:"point",x:s[0],y:s[1],r:u.r||4,style:u,datum:t,pointId:g?g(t)+"":void 0};i.push(d)}return i}applyCartogramTransform(e,t){var n,o,i;const r=this.scene.filter(e=>"point"===e.type);if(2>r.length)return;const l=null!==(n=e.strength)&&void 0!==n?n:1;if(0===l)return;const s=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,a="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=r.find(t=>t.datum&&s(t.datum)+""==e.center+"");if(!c)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const u=c.x,d=c.y,h=r.map(e=>e.datum?a(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),f=Math.max(...h,1),p=Math.min(t.width,t.height)/2,g=A().domain([0,f]).range([0,p]);this.cartogramLayout={cx:u,cy:d,maxCost:f,availableRadius:p},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of r){if(e===c)continue;if(!e.datum)continue;const t=Math.atan2(e.y-d,e.x-u),n=Math.sqrt(Math.pow(e.x-u,2)+Math.pow(e.y-d,2)),o=a(e.datum),i=n+((isFinite(o)?g(o):n)-n)*l;e.x=u+Math.cos(t)*i,e.y=d+Math.sin(t)*i}const y=t.width/2,v=t.height/2,m=y-c.x,b=v-c.y;if(Math.abs(m)>.5||Math.abs(b)>.5)for(const e of r)e.x+=m,e.y+=b;this.cartogramLayout={cx:y,cy:v,maxCost:f,availableRadius:p};const x=this.scene.filter(e=>"line"===e.type);if(x.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of r)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of x){const n=null===(o=t.datum)||void 0===o?void 0:o.source,r=null===(i=t.datum)||void 0===i?void 0:i.target;if(n&&r){const o=e.get(n+""),i=e.get(r+"");o&&i&&(t.path=[o,i])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const i=Q(e,o,t);n[o]._decayOpacity=i,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:i})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,i=performance.now(),r=this.scene.filter(e=>"point"===e.type),l=this.timestampBuffer.toArray();for(let e=0;r.length>e&&l.length>e;e++){const s=i-l[e];o>s&&(r[e]._pulseIntensity=1-s/o,r[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",r[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const i=new Map;for(const t of e)"point"===t.type&&t.pointId&&i.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let l=!1;for(const e of r)if(e.pointId){const t=i.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(l=!0))}l&&(this.activeTransition={startTime:performance.now(),duration:o})}cancelIntroAnimation(){this.activeTransition=null}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=X(e.x,e._targetX,n),e.y=X(t,e._targetY,n)}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0);return this.activeTransition=null,!1}return!0}}function se(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ae(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function ce(e,t){const n=ae(e);if(!n)return!1;const o=ae(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function ue(e,t,n,o,i,r,l=0){if(r){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),l=t-r,s=t+r,a=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,f)=>{if(i>s||l>h||r>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,l=e.y-n,s=Math.sqrt(r*r+l*l);se(e.r,o)>=s&&d>s&&(u=e,d=s),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,l);if(e)return e}else{let i=null,r=o;for(const l of e){if("point"!==l.type)continue;const e=l.x-t,s=l.y-n,a=Math.sqrt(e*e+s*s);se(l.r,o)>=a&&r>a&&(i=l,r=a)}if(i)return{node:i,distance:r}}for(let o=e.length-1;o>=0;o--){const r=e[o];if("geoarea"!==r.type)continue;const l=r;if(!1===l.interactive)continue;const[[s,a],[c,u]]=l.bounds;if(!(s>t||t>c||a>n||n>u)&&(l._cachedPath2D||(l._cachedPath2D=new Path2D(l.pathData)),i.isPointInPath(l._cachedPath2D,t,n)))return{node:l,distance:0}}let s=null,a=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:i}=e,r=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;i.length-1>o;o++){const[l,c]=i[o],[u,d]=i[o+1],h=de(t,n,l,c,u,d);r>=h&&a>h&&(s=e,a=h)}}return s?{node:s,distance:a}:null}function de(e,t,n,o,i,r){const l=i-n,s=r-o,a=l*l+s*s;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*l+(t-o)*s)/a;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*l),2)+Math.pow(t-u,2))}function he(t){let n=null;const o=()=>(n||(n=c(null)),n),u=fe(t);return[function({children:n,initialState:l}){const s=i(l),a=r(()=>fe(t,s.current),[]),c=o();return e(c.Provider,{value:a,children:n})},e=>{var t;const n=o(),r=null!==(t=l(n))&&void 0!==t?t:u,c=i(e);c.current=e;const d=s(()=>c.current(r.getState()),[r]),h=s(()=>c.current(r.getState()),[r]);return a(r.subscribe,d,h)}]}function fe(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function pe(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function ge(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:ye})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}le.QUADTREE_THRESHOLD=500;const ye=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],ve={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},me={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},be={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ye,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function xe(e,t){if("light"===t)return ve;if("dark"===t)return me;if("high-contrast"===t)return be;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?me:ve;return ge(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return ge(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[ke,we]=he(e=>({theme:ve,setTheme(t){e(e=>({theme:xe(e.theme,t)}))}}));const je=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Oe=new WeakMap;let Me=0,Ae=!1,Se=null,Ce=null,Le=null;function ze(e,t){var n,o;if(!t)return t;const i=je.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Ae)return;if("undefined"==typeof window||"undefined"==typeof document)return;Ae=!0;const e=()=>{Me++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Se=new MutationObserver(e),Se.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Ce=window.matchMedia("(prefers-color-scheme: dark)"),Le=e,"function"==typeof Ce.addEventListener?Ce.addEventListener("change",Le):"function"==typeof Ce.addListener&&Ce.addListener(Le)}catch(e){}}();let l=Oe.get(r);l&&l.version===Me||(l={version:Me,map:new Map},Oe.set(r,l));const s=l.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return l.map.set(t,a),a}const Pe="undefined"==typeof window?d:h;function De(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ie(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return d(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[l,a]=function(e,t,n){const o=i(null),[r,l]=u(null);return d(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),c=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=a[0]-c.left-c.right,f=a[1]-c.top-c.bottom,p=De(e.foregroundGraphics,a,c),g=De(e.backgroundGraphics,a,c),y=we(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=i(0),k=i(()=>{}),w=s(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);d(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const j=i(()=>{}),O=i(()=>{}),M=i(null),A=i(0),S=s(()=>{A.current=0;const e=M.current;M.current=null,e&&j.current(e)},[]),C=s(e=>{M.current={clientX:e.clientX,clientY:e.clientY},0===A.current&&(A.current=requestAnimationFrame(S))},[S]),L=s(()=>{M.current=null,0!==A.current&&(cancelAnimationFrame(A.current),A.current=0),O.current()},[]);d(()=>()=>{M.current=null,0!==A.current&&(cancelAnimationFrame(A.current),A.current=0)},[]);const z=e.themeDirtyRef;return Pe(()=>{z&&(Me++,z.current=!0,w())},[y,w,z]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:l,size:a,margin:c,adjustedWidth:h,adjustedHeight:f,resolvedForeground:p,resolvedBackground:g,currentTheme:y,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:j,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:L}}const $e={fill:t=>e("rect",{style:t,width:16,height:16}),line:t=>e("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function Re(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,$e[n])(o(e,t)),i}function We(){return e("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Be(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Te=(n,o,i,r,l,s,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=n,g=[];let y=0;const v=!(!o&&!i),m="isolate"===d||void 0===d&&null!=l;return p.forEach((n,d)=>{const b=Re(n,d,h,f),x=Be(n,r,l),k=l&&l.size>0&&l.has(n.label);g.push(t("g",{transform:`translate(0,${y})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===s&&d===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&m?k||!1:void 0,"aria-current":v&&!m&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,k&&e(We,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),y+=22}),g};function Ne({config:n,orientation:i="vertical",width:r=100}){const{colorFn:l,domain:s,label:a,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:l(s[0]+n*(s[1]-s[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),a&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:l(s[1]-n*(s[1]-s[0]))},t))}return t("g",{"aria-label":a||"Gradient legend",children:[a&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:a}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])})]})}function Ee(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:f="vertical"}=n,[p,g]=o.useState(0),[y,v]=o.useState(0),m=o.useCallback((e,t)=>{g(e),v(t)},[]),b="vertical"===f?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,f)=>{d+=5,h.push(e("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,t.label&&(d+=16,h.push(e("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),d+=8),h.push(e("g",{className:"legend-item",transform:`translate(0,${d})`,children:Te(t,o,i,r,l,s,a,f,c,u)},"legend-group-"+f)),d+=22*t.items.length+8}),h})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let f=0;const p=[];n.forEach((n,o)=>{let g=0;n.label&&(g+=16);const y=((n,o,i,r,l,s,a,c,u,d,h)=>{const{type:f="fill",styleFn:p,items:g}=n,y=[];let v=0,m=0;const b=!(!o&&!i),x="isolate"===d||void 0===d&&null!=l;g.forEach((n,d)=>{const k=Re(n,d,f,p),w=Be(n,r,l),j=l&&l.size>0&&l.has(n.label),O=26+7*n.label.length;h&&h>0&&v>0&&v+O>h&&(m++,v=0),y.push(t("g",{transform:`translate(${v},${22*m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===s&&d===a?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?j||!1:void 0,"aria-current":b&&!x&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+g.length)%g.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,j&&e(We,{}),e("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),v+=O});let k=0,w=0;for(const e of g){const t=26+7*e.label.length;h&&h>0&&w>0&&w+t>h?(k=Math.max(k,w),w=t):w+=t}k=Math.max(k,w);const j=m+1;return{items:y,offset:k,totalRows:j,totalHeight:22*j}})(n,r,l,s,a,c,u,o,d,h,i);g+=y.offset+5,p.push(Object.assign(Object.assign({label:n.label},y),{offset:g,totalRows:y.totalRows,totalHeight:y.totalHeight})),f+=g+12});let g=f>i?0:Math.max(0,(i-f)/2);const y=[];return p.forEach((t,i)=>{const r=n[i];r.label&&(y.push(e("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),g+=16),y.push(e("g",{className:"legend-item",transform:`translate(${g},0)`,children:t.items},"legend-group-"+i)),g+=t.offset+5,n[i+1]&&y.push(e("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),g+=12}),e("g",{children:y})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:p,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:c}),x=!(!r&&!l);return t("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==a))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===f&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function _e(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function He(t){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:l="right",title:s,legendHoverBehavior:a,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const f="top"===l||"bottom"===l;let p,g;return"left"===l?(p=4,g=r.top):"top"===l?(p=0,g=s?32:8):"bottom"===l?(p=0,g=i-r.bottom+50):(p=o-r.right+10,g=r.top),e("g",{transform:`translate(${p}, ${g})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e(Ne,{config:n.gradient,orientation:f?"horizontal":"vertical",width:f?o:100}):_e(n)?e(Ee,{legendGroups:n.legendGroups,title:"",width:f?o:100,orientation:f?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function Fe(e){return"string"==typeof e?{type:e}:e}function qe({orient:n,config:o,values:i,scale:l,size:s,length:a}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=r(()=>{if(0===i.length)return null;const o=l.domain(),r=s-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],l=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*l),whiskerHigh:Math.min(t[n-1],r+1.5*l)}}(i);if(!o)return null;const{q1:s,median:a,q3:d,whiskerLow:h,whiskerHigh:f}=o,p=Math.min(.5*r,20),g=(r-p)/2+4;if(u){const o=l(s),i=l(d),r=l(a),u=l(h),y=l(f),v="top"===n?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:m+v*(g+p/2),x2:y,y2:m+v*(g+p/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:m+v*g,x2:u,y2:m+v*(g+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:m+v*g,x2:y,y2:m+v*(g+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?m-g-p:m+g,width:Math.abs(i-o),height:p,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?m-g-p:m+g,x2:r,y2:"top"===n?m-g:m+g+p,stroke:c.fill,strokeWidth:2})]})}{const o=l(s),i=l(d),r=l(a),u=l(h),y=l(f),v="left"===n?-1:1,m=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:m+v*(g+p/2),y1:u,x2:m+v*(g+p/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*g,y1:u,x2:m+v*(g+p),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:m+v*g,y1:y,x2:m+v*(g+p),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?m-g-p:m+g,y:Math.min(o,i),width:p,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?m-g-p:m+g,y1:r,x2:"left"===n?m-g:m+g+p,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=z().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=l(t.x0),s=l(t.x1)-l(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(s,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=l(t.x0),s=l(t.x1)-l(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+s),width:i,height:Math.abs(s),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),s=l((e.x0+e.x1)/2);o.push(u?`${s},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${s}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const s=i.length/h*(r/2),a=l((i.x0+i.x1)/2);o.push(u?`${a},${"top"===n?-(t+s):t+s}`:`${"left"===n?-(t+s):t+s},${a}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,o=null!=d[0].x0?l(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=l((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?l(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=l((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,l,c,s,a,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function Ge(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let l="";for(const e of i)l&&l.length+1+e.length>o?(r.push(l),l=e):l=l?`${l} ${e}`:e;return l&&r.push(l),r}function Ve(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Ue(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:l,title:s,orientation:a,align:c,wrap:u=120,noWrap:d}=n;if(!l&&!s)return e("g",{className:"annotation-note"});let h=a;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let f=c;f&&"dynamic"!==f||(f="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let p="start";"topBottom"===h?"right"===f?p="end":"middle"===f&&(p="middle"):p=0>o?"end":"start";const g=16,y=s?d?[s]:Ge(s,u):[],v=l?d?[l]:Ge(l,u):[],m="leftRight"===h?"end"===p?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:p,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-title")),b=y.length*g),v.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:p,y:b,children:v.map((t,n)=>e("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-label"));let w=null;if((s||l)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+v.length)*g+(v.length>0?g:0);let n=0,o=t;"bottom"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const j=Math.max(0,y.length+v.length-1)*g;let O=0;return"topBottom"===h?O=0>i?-(j+2):18:"leftRight"===h&&(O="middle"===f?-(j+g+(v.length>0&&y.length>0?2:0))/2+8:"bottom"===f||0>i?-(j+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),w]})}function Ze(t,n,o,i,r){var l;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&s.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,l=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;s.push(e("line",{x1:i,y1:(n.y1||0)-l,x2:i,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-l;s.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e("line",{x1:0,y1:(n.y1||0)-l,x2:0,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(l=null==n?void 0:n.width)&&void 0!==l?l:null==n?void 0:n.height;void 0!==t&&s.push(e("path",{d:Ve((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:s})}function Ye(t,n,o,i,r,l){const s=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==l?void 0:l.radius)){if("callout-rect"===r&&l){const e=l.width||0,o=l.height||0;if(e>0||o>0){const i=e/2,r=o/2,l=t-i,s=n-r;if(0!==l||0!==s){const t=Math.abs(l),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;a=i+l*h,c=r+s*h}}}else if("bracket"===r&&l){const e=l.width,t=l.height,n=l.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=n,c=t/2)}}else{const e=(l.radius||0)+(l.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(s.push(e("line",{x1:a,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,l=Math.atan2(n-c,t-a);s.push(e("path",{d:`M${a},${c}L${a+o*Math.cos(l+r)},${c+o*Math.sin(l+r)}L${a+o*Math.cos(l-r)},${c+o*Math.sin(l-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e("g",{className:"annotation-connector",children:s})}function Xe(e){const{x:n=0,y:o=0,dx:i,dy:r,nx:l,ny:s,note:a,connector:c,subject:u,type:d,color:h,className:f,disable:p,events:g={},"data-testid":y}=e,v=new Set(Array.isArray(p)?p:[]);let m=i||0,b=r||0;null!=l&&(m=l-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===m&&0===b)if(void 0!==u.width){m=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;m=e+(0>e?-5:5),b=u.height/2}return t("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},g,{children:[!v.has("connector")&&Ye(m,b,c,h,x,u),!v.has("subject")&&Ze(x,u,h,n,o),!v.has("note")&&Ue(a,m,b,h)]}))}function Qe(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,l="string"==typeof i.type?i.type:"label",s=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),s=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e(Xe,Object.assign({"data-testid":"semiotic-annotation"},r,{type:l}),"multi-annotation-"+o)});return e("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e(Xe,Object.assign({"data-testid":"semiotic-annotation",events:s},i,{type:l}),c)}function Ke(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Je(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function et(e,t,n){var o,i,r,l;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,l;const s=e.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let a=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,c=t.y)}if(null!=a&&null!=c||(a=Ke(e,n),c=Je(e,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:a,y:c}),{x:a,y:c};if("sticky"===s){const e=null===(l=n.stickyPositionCache)||void 0===l?void 0:l.get(t);if(e)return e}return null}function tt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const nt={linear:H,monotoneX:_,monotoneY:E,step:N,stepAfter:T,stepBefore:B,basis:W,cardinal:R,catmullRom:$};let ot={positions:new Map};const it=new Set;function rt(){for(const e of it)e()}function lt(e,t){const n=ot.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(ot.positions);o.delete(e),ot={positions:o},rt()}function st(e,t){const n=ot.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(ot.positions);o.delete(e),ot={positions:o},rt()}function at(){return ot}function ct(e){return it.add(e),()=>it.delete(e)}const ut={positions:new Map};function dt(){return()=>{}}function ht(){return ut}function ft(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,l=o instanceof Date?o.getTime():o,s=i instanceof Date?i.getTime():i;if(2>t||l===s)return r?[new Date(l),new Date(s)]:[l,s];const a=(s-l)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?s:l+e*a;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function pt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function gt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let l="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);l+=`L${Math.min(8*e+4,t)},${o+4*i}`,l+=`L${Math.min(n,t)},${o}`}return l}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let l=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);l+=`L${o+4*i},${Math.min(8*e+4,n)}`,l+=`L${o},${Math.min(t,n)}`}return l}}function yt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function vt(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 mt(o){var l,s;const{width:c,height:u,totalWidth:h,totalHeight:f,margin:p,scales:g,showAxes:y,axes:v,xLabel:m,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,axisExtent:j,showGrid:O,title:M,legend:A,legendHoverBehavior:S,legendClickBehavior:C,legendHighlightedCategory:L,legendIsolatedCategories:z,legendPosition:P="right",foregroundGraphics:$,marginalGraphics:R,xValues:W,yValues:B,annotations:T,svgAnnotationRules:N,xAccessor:E,yAccessor:_,annotationData:F,pointNodes:q,curve:V,underlayRendered:U,canvasObscuresUnderlay:Z=!0,linkedCrosshairName:Y,linkedCrosshairSourceId:X,children:Q}=o,K=r(()=>{var e,t;if(!y||!g)return[];const n=null==v?void 0:v.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||k||yt,i=Math.max(2,Math.floor(c/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,l=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:ft(g.x,"exact"===j?Math.max(2,r):Math.min(r,i),j),s=l.map(e=>e.valueOf()),a=l.map((e,t)=>({value:e,pixel:g.x(e),label:o(e,t,s)})),u=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(u+8,55)):Math.max(55,u+8);let h=vt(a,d);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==j&&!(null==n?void 0:n.tickValues)){const e=g.x.domain()[1],t=g.x(e),n=h[h.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,h.length,s);d>t-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[y,g,v,k,c,j]),J=r(()=>{var e,t;if(!y||!g)return[];const n=null==v?void 0:v.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||w||yt,i=Math.max(2,Math.floor(u/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let l=vt((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:ft(g.y,"exact"===j?Math.max(2,r):Math.min(r,i),j)).map(e=>({value:e,pixel:g.y(e),label:o(e)})),22);if(l.length>1&&(l=l.filter((e,t)=>0===t||e.label+""!=l[t-1].label+"")),(null==n?void 0:n.includeMax)&&l.length>0&&"exact"!==j&&!(null==n?void 0:n.tickValues)){const e=g.y.domain()[1],t=g.y(e),n=l[l.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&l.length>1&&(l=l.slice(0,-1)),l.push({value:e,pixel:t,label:i})}}return l},[y,g,v,w,u,j]),ee=r(()=>{var e,t;if(!y||!g)return[];const n=null==v?void 0:v.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||w||yt,i=Math.max(2,Math.floor(u/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return vt((null!==(t=n.tickValues)&&void 0!==t?t:ft(g.y,"exact"===j?Math.max(2,r):Math.min(r,i),j)).map(e=>({value:e,pixel:g.y(e),label:o(e)})),22)},[y,g,v,w,u,j]),te=i(new Map),ne=i(null!==(l=null==T?void 0:T.length)&&void 0!==l?l:0),oe=null!==(s=null==T?void 0:T.length)&&void 0!==s?s:0;ne.current!==oe&&(ne.current=oe,te.current=new Map);const ie=r(()=>{if(!T||0===T.length)return null;const n=function(n,o,i){var r,l,s,a,c,u,d,h,f,p,g,y,v,m,b,x,k,w,j,O,M,A,S,C,L,z,P,$,R,W,B,T,N,E,_,F,q,V,U,Z,Y,X,Q,K,J,ee,te,ne;switch(n.type){case"label":{const t=et(n,o,i);if(!t)return null;const{x:r,y:l}=t;return tt(r,l,i)?e(Qe,{noteData:{x:r,y:l,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const t=et(n,o,i);if(!t)return null;const{x:r,y:l}=t;return tt(r,l,i)?e(Qe,{noteData:{x:r,y:l,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=Ke(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,i);if(null==r)return null;const l=n.color||"#f97316",s=n.labelPosition||"top";let a;return a="bottom"===s?(i.height||0)-4:"center"===s?(i.height||0)/2:12,t("g",{children:[e("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:r+4,y:a,fill:l,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Je(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,i);if(null==r)return null;const l=n.color||"#f97316",s=n.labelPosition||"right";let a,c;return"left"===s?(a=4,c="start"):"center"===s?(a=(i.width||0)/2,c="middle"):(a=(i.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:a,y:r-4,textAnchor:c,fill:l,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:Ke(Object.assign(Object.assign({},e),{type:"point"}),i),y:Je(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const l=D(r),s=n.padding||10;return t("g",{children:[e("circle",{cx:l.x,cy:l.y,r:l.r+s,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:l.x,y:l.y-l.r-s-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:Ke(Object.assign(Object.assign({},e),{type:"point"}),i),y:Je(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const l=n.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),c=Math.min(...s)-l,u=Math.max(...s)+l,d=Math.min(...a)-l,h=Math.max(...a)+l;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const t=i.data||[],r="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],l={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:r.map((t,o)=>{const r=Ke(t,i),s=Je(t,i);if(null==r||null==s)return null;const a="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||l;return e("circle",Object.assign({cx:r,cy:s,r:a},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const t=Ke(n,i),r=Je(n,i);return e(Qe,{noteData:{x:null!=t?t:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const f=i.xAccessor||"x",p=i.yAccessor||"y",g="ordinal"===i.frameType,y="horizontal"===i.projection,v=g?f:null,m=g?p:null;let b;const x=[],k=new Map;if(g&&v&&m){for(const e of h){const t=e[v];if(null==t)continue;const n=t+"";k.has(n)||(k.set(n,x.length),x.push(n))}b=h.map(e=>{const t=e[v],n=e[m];if(null==t||null==n)return null;const o=k.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=h.map(e=>[e[f],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(l=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==l?l:null===(s=i.scales)||void 0===s?void 0:s.time,j=null!==(c=null===(a=i.scales)||void 0===a?void 0:a.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!w||!j)return null;const O=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},M=w,A=j;let S;if(g)if(y){const e=O(A);S=(t,n)=>[M(n),e(t)]}else{const e=O(M);S=(t,n)=>[e(t),A(n)]}else S=(e,t)=>[M(e),A(t)];const C=n.method||"linear";let L;L="loess"===C?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),l=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(l-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],f+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){s.push([t,r[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))s.push([t,h/u]);else{const e=(u*p-d*h)/g;s.push([t,(h-e*d)/u+e*t])}}return s}(b,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===C?G.polynomial(b,{order:n.order||2}):G.linear(b)).points;const z=L.map(([e,t])=>{const[n,o]=S(e,t);return`${n},${o}`}).join(" "),P=n.color||"#6366f1",D=L[L.length-1],[I,$]=S(D[0],D[1]);return t("g",{children:[e("polyline",{points:z,fill:"none",stroke:P,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:I+4,y:$-4,fill:P,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(f=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==f?f:null===(p=i.scales)||void 0===p?void 0:p.value,l=null!==(g=null==r?void 0:r(n.y0))&&void 0!==g?g:0,s=null!==(y=null==r?void 0:r(n.y1))&&void 0!==y?y:i.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(l,s),width:i.width||0,height:Math.abs(s-l),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(l,s)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const l=i.xAccessor||"x",s=null!==(m=null===(v=i.scales)||void 0===v?void 0:v.x)&&void 0!==m?m:null===(b=i.scales)||void 0===b?void 0:b.time,a=null!==(k=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==k?k:null===(w=i.scales)||void 0===w?void 0:w.value;if(!s||!a)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[l]-t[l]);if(2>h.length)return null;const f=nt[i.curve||"linear"]||H,p=I().x(e=>s(e[l])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!p)return null;const g=n.fill||"#6366f1";return t("g",{children:[e("path",{d:p,fill:g,fillOpacity:null!==(j=n.fillOpacity)&&void 0!==j?j:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:s(h[h.length-1][l])+4,y:a(h[h.length-1][c])-4,fill:g,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const l=i.yAccessor||"y",s=null!==(M=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==M?M:null===(A=i.scales)||void 0===A?void 0:A.time,a=null!==(C=null===(S=i.scales)||void 0===S?void 0:S.y)&&void 0!==C?C:null===(L=i.scales)||void 0===L?void 0:L.value;if(!s||!a)return null;const c=r.map(e=>e[l]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),f=null!==(z=n.threshold)&&void 0!==z?z:2,p=u-f*h,g=!1!==n.showBand,y=n.fill||"#6366f1",v=null!==(P=n.fillOpacity)&&void 0!==P?P:.1,m=n.anomalyColor||"#ef4444",b=null!==($=n.anomalyRadius)&&void 0!==$?$:6,x=a(u+f*h),k=a(p),w=r.filter(e=>{const t=e[l];return null!=t&&Math.abs(t-u)>f*h});return t("g",{children:[g&&e("rect",{x:0,y:Math.min(x,k),width:i.width||0,height:Math.abs(k-x),fill:y,fillOpacity:v}),w.map((t,n)=>{const o=Ke(t,i),r=Je(t,i);return null==o||null==r?null:e("circle",{cx:o,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(i.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const l=i.xAccessor||"x",s=i.yAccessor||"y",a=null!==(W=null===(R=i.scales)||void 0===R?void 0:R.x)&&void 0!==W?W:null===(B=i.scales)||void 0===B?void 0:B.time,c=null!==(N=null===(T=i.scales)||void 0===T?void 0:T.y)&&void 0!==N?N:null===(E=i.scales)||void 0===E?void 0:E.value;if(!a||!c)return null;const u=r.map(e=>[e[l],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=G.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const l=(e*i-t*n)/r,s=(n-l*t)/e;d=e=>s+l*e}const h=u.length,f=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(f/Math.max(h-2,1)),g=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),v=null!==(_=n.confidence)&&void 0!==_?_:.95,m=.99>v?.95>v?.9>v?1:1.645:1.96:2.576,b=null!==(F=n.steps)&&void 0!==F?F:5,x=u[h-1][0],k=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const j=[];for(const e of w){const t=d(e),n=p*Math.sqrt(1+1/h+(y>0?Math.pow(e-g,2)/y:0))*m;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${j.map(e=>`${a(e.x)},${c(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${a(e.x)},${c(e.yLower)}`).join(" L")} Z`,M=j.map(e=>`${a(e.x)},${c(e.yCenter)}`).join(" "),A=`${a(x)},${c(d(x))}`,S=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(q=n.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e("polyline",{points:`${A} ${M}`,fill:"none",stroke:S,strokeWidth:null!==(V=n.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(U=n.strokeDasharray)&&void 0!==U?U:"6,3"}),n.label&&j.length>0&&e("text",{x:a(j[j.length-1].x)+4,y:c(j[j.length-1].yCenter)-4,fill:S,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let t=null,r=null;if(null!=n.px&&null!=n.py)t=n.px,r=n.py;else{const e=et(n,o,i);if(!e)return null;t=e.x,r=e.y}if(null==t||null==r)return null;if(!tt(t,r,i))return null;const l=null!==(Z=n.dx)&&void 0!==Z?Z:0,s=null!==(Y=n.dy)&&void 0!==Y?Y:0,a=null!==(X=n.width)&&void 0!==X?X:32,c=null!==(Q=n.height)&&void 0!==Q?Q:32,u=null!==(K=n.content)&&void 0!==K?K:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+l-a/2,y:r+s-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=et(n,o,i);if(!t)return null;const{x:r,y:l}=t;return e("text",{x:r+(n.dx||0),y:l+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const l=null===(J=i.scales)||void 0===J?void 0:J.o,s=null===(ee=i.scales)||void 0===ee?void 0:ee.x,a=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==l?void 0:l.bandwidth)?l:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!c)return null;const u=c(r);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",f=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return t("g",(i.projection?"vertical"===i.projection:c===s)?{children:[e("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:f}),p&&e("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:f}),p&&e("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:E,yAccessor:_,width:c,height:u,data:F,frameType:"xy",pointNodes:q,curve:V,stickyPositionCache:te.current};return T.map((e,t)=>{if(N){const i=N(e,t,o);return null!=i?i:n(e,t,o)}return n(e,t,o)}).filter(Boolean)},[T,N,c,u,E,_,F,g,q,V]),re=function(e){var t;const n=a(e?ct:dt,e?at:ht,e?at:ht);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(Y);return d(()=>{if(!(null==re?void 0:re.locked)||!Y)return;const e=e=>{"Escape"===e.key&&st(Y)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==re?void 0:re.locked,Y]),y||M||A||$||R||ie&&ie.length>0||O||Q||re?t("svg",{role:"img",width:h,height:f,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof M?M:"XY Chart"}),e("desc",{children:"string"==typeof M?M+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${p.left},${p.top})`,children:[O&&g&&(!U||Z)&&(()=>{var n,o;const i=pt(null===(n=null==v?void 0:v.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=pt(null===(o=null==v?void 0:v.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[K.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:u,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),J.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:c,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&g&&(()=>{const o=null==v?void 0:v.find(e=>"left"===e.orient),i=null==v?void 0:v.find(e=>"bottom"===e.orient),r=!o||!1!==o.baseline,l=!i||!1!==i.baseline,s=(null==o?void 0:o.jaggedBase)||!1,a=(null==i?void 0:i.jaggedBase)||!1,d=null==i?void 0:i.landmarkTicks,h=null==o?void 0:o.landmarkTicks,f="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",k=!!(null==i?void 0:i.autoRotate)&&K.length>1&&(()=>{const e=c/Math.max(K.length-1,1);return K.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(!U||Z)&&l&&!a&&e("line",{x1:0,y1:u,x2:c,y2:u,stroke:f,strokeWidth:1}),(!U||Z)&&a&&e("path",{d:gt("bottom",c,u),fill:"none",stroke:f,strokeWidth:1}),K.map((n,o)=>{const i=!!d&&("function"==typeof d?d(n.value,o):ce(n.value,o>0?K[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${u})`,children:[e("line",{y2:5,stroke:f,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:k?10:18,textAnchor:k?"end":"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:g,style:{userSelect:"none"},transform:k?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"xtick-"+o)}),m&&e("text",{x:c/2,y:u+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"},children:m}),(!U||Z)&&r&&!s&&e("line",{x1:0,y1:0,x2:0,y2:u,stroke:f,strokeWidth:1}),(!U||Z)&&s&&e("path",{d:gt("left",c,u),fill:"none",stroke:f,strokeWidth:1}),J.map((n,o)=>{const i=!!h&&("function"==typeof h?h(n.value,o):ce(n.value,o>0?J[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:f,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:i?11:10,fontWeight:i?600:400,fill:g,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==o?void 0:o.label)||b;return t?e("text",{x:15-p.left,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-p.left}, ${u/2})`,style:{userSelect:"none"},children:t}):null})(),(()=>{const o=null==v?void 0:v.find(e=>"right"===e.orient);if(!o||0===ee.length)return null;const i=o.landmarkTicks,r=o.label||x;return t(n,{children:[!1!==o.baseline&&e("line",{x1:c,y1:0,x2:c,y2:u,stroke:f,strokeWidth:1}),ee.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):ce(n.value,o>0?ee[o-1].value:void 0));return t("g",{transform:`translate(${c},${n.pixel})`,children:[e("line",{x2:5,stroke:f,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"},children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"},children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:c+p.right-15,y:u/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${c+p.right-15}, ${u/2})`,style:{userSelect:"none"},children:r})]})})()]})})(),ie,R&&g&&W&&B&&t(n,{children:[R.top&&e("g",{transform:"translate(0, 0)",children:e(qe,{orient:"top",config:Fe(R.top),values:W,scale:g.x,size:p.top,length:c})}),R.bottom&&e("g",{transform:`translate(0, ${u})`,children:e(qe,{orient:"bottom",config:Fe(R.bottom),values:W,scale:g.x,size:p.bottom,length:c})}),R.left&&e("g",{transform:"translate(0, 0)",children:e(qe,{orient:"left",config:Fe(R.left),values:B,scale:g.y,size:p.left,length:u})}),R.right&&e("g",{transform:`translate(${c}, 0)`,children:e(qe,{orient:"right",config:Fe(R.right),values:B,scale:g.y,size:p.right,length:u})})]}),$,re&&re.sourceId!==X&&(null==g?void 0:g.x)&&(()=>{const t=g.x(re.xValue);if(null==t||0>t||t>c)return null;const n=re.locked;return e("line",{x1:t,y1:0,x2:t,y2:u,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Q]}),M&&e("text",{x:h/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof M?M:null}),He({legend:A,totalWidth:h,totalHeight:f,margin:p,legendPosition:P,title:M,legendHoverBehavior:S,legendClickBehavior:C,legendHighlightedCategory:L,legendIsolatedCategories:z})]}):null}function bt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const xt="undefined"==typeof window||"undefined"==typeof document,kt="undefined"!=typeof window?h:d,wt=()=>()=>{},jt=()=>!1,Ot=()=>!0;function Mt(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function At(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function St(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const Ct=o.createContext(null),Lt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function zt(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],l=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of l)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const Pt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Dt={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},It={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},$t={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)"},Rt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Wt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},Bt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Tt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Nt({scene:n,chartType:i,tableId:r,chartTitle:l}){var s;const[a,c]=o.useState(!1),u=o.useContext(Ct),d=null!==(s=null==u?void 0:u.visible)&&void 0!==s&&s,h=a||d,f=o.useRef(null),p=l?"Data summary for "+l:r?`Data summary for ${i} ${r}`:"Data summary for "+i,g=o.useCallback(()=>{a||d||c(!0)},[a,d]),y=o.useCallback(e=>{var t;d||(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:Lt}):null;if(!h)return e("div",{id:r,tabIndex:-1,onFocus:g,style:Lt,role:"region","aria-label":p,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const v=function(e){var t,n,o,i,r,l,s,a,c,u,d,h,f,p,g,y,v,m,b,x,k,w,j,O,M;const A=[];if(!Array.isArray(e))return A;for(const S of e)if(S&&"object"==typeof S)try{switch(S.type){case"point":A.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)&&A.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)&&A.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:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:S.group)&&void 0!==n?n:"",l=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;A.push({label:"Bar",values:{category:r,value:null!=l?l:""}});break}case"heatcell":A.push({label:"Cell",values:{x:S.x,y:S.y,value:S.value}});break;case"wedge":A.push({label:"Wedge",values:{category:null!==(a=null!==(l=null===(r=S.datum)||void 0===r?void 0:r.category)&&void 0!==l?l:null===(s=S.datum)||void 0===s?void 0:s.label)&&void 0!==a?a:"",value:null!==(u=null===(c=S.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":A.push({label:"Node",values:{id:null!==(h=null===(d=S.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(f=S.cx)&&void 0!==f?f:S.x,y:null!==(p=S.cy)&&void 0!==p?p:S.y}});break;case"arc":A.push({label:"Arc",values:{id:null!==(y=null===(g=S.datum)||void 0===g?void 0:g.id)&&void 0!==y?y:"",x:null!==(v=S.cx)&&void 0!==v?v:S.x,y:null!==(m=S.cy)&&void 0!==m?m:S.y}});break;case"candlestick":A.push({label:"Candlestick",values:{x:S.x,open:S.open,high:S.high,low:S.low,close:S.close}});break;case"geoarea":A.push({label:"Region",values:{name:null!==(j=null!==(k=null===(x=null===(b=S.datum)||void 0===b?void 0:b.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!==j?j:"",value:null!==(M=null===(O=S.datum)||void 0===O?void 0:O.value)&&void 0!==M?M:""}})}}catch(e){}return A}(n),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(v),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Pt(e.min)} to ${Pt(e.max)}, mean ${Pt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(v.length,m),x=v.slice(0,5),k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return t("div",{ref:f,id:r,tabIndex:-1,onBlur:y,style:Dt,role:"region","aria-label":p,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:$t,children:"×"}),e("div",{role:"note",style:It,children:b}),t("table",{role:"table","aria-label":"Sample data for "+i,style:Rt,children:[t("caption",{style:Tt,children:["First ",x.length," of ",v.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Wt,children:"type"}),w.map(t=>e("th",{style:Wt,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:Bt,children:n.label}),w.map(t=>{return e("td",{style:Bt,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Pt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function Et({summary:t}){return t?e("div",{role:"note",style:Lt,children:t}):null}function _t({tableId:t}){return e("a",{href:"#"+t,style:Lt,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Lt)},children:"Skip to data table"})}function Ht({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:Lt,children:n})}const Ft=Object.freeze([]);function qt(e){if(!e)return Ft;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}const Gt="var(--semiotic-focus, #005fcc)";function Vt({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:l,height:s}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=l&&null!=s){const t=Math.max(l,4),n=Math.max(s,4);u=e("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Gt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:Gt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:Gt,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}const Ut={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 Zt(e,t){return"function"==typeof t?t(e):e[t]}function Yt(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Xt(n={}){const{fields:o,title:i,format:r,style:l={},className:s=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let a;const c=[];if(i){const e=Zt(n,i);a=Yt(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const l=Zt(n,o);c.push({label:t,value:Yt(l,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){a=Yt(n[t],r);break}if(!a){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(a=Yt(n[e[0]],r))}}const u=Object.assign(Object.assign({},Ut),l);return t("div",{className:("semiotic-tooltip "+s).trim(),style:u,children:[a&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:a}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&a?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function Qt(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t,r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:Ut,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Xt(t):Xt())}}function Kt({x:t,y:n,containerWidth:i,containerHeight:r,margin:l,children:s,className:a="stream-frame-tooltip",zIndex:c=1}){const u=Number.isFinite(t)&&Number.isFinite(n),d=o.useRef(null),[h,f]=o.useState(null);o.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();f(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,i,r]);let p;p=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const g=function(e){if(!o.isValidElement(e))return!1;const t=e.props;if("string"==typeof t.className&&t.className.trim().length>0)return!0;const n=t.style;if(n&&"object"==typeof n){if(null!=n.background&&""!==n.background)return!0;if(null!=n.backgroundColor&&""!==n.backgroundColor)return!0}return!1}(s),y=g?null:Ut;return u?e("div",{ref:d,className:g?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:l.left+t,top:l.top+n,transform:p,pointerEvents:"none",zIndex:c,width:"max-content"}),children:s}):null}function Jt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function en(e,t,n=.6){var o,i,r,l,s;if(!Jt(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(s=null!==(l=t.cy)&&void 0!==l?l:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function tn(e,t,n,o=.35){Jt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function nn(e){switch(e){case"monotoneX":return _;case"monotoneY":return E;case"cardinal":return R;case"catmullRom":return $;case"step":return N;case"stepBefore":return B;case"stepAfter":return T;case"basis":return W;case"natural":return F;default:return null}}function on(e,t,n){return null==t?n:"string"!=typeof t?t:ze(e,t)||n}function rn(e,t,n,o,i,r){const l=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>l.length)return null;const s=e.createLinearGradient(n,o,i,r);for(const e of l)s.addColorStop(e.offset,e.color);return s}function ln(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 sn(e,t,n,o,i,r){if(2>t.length)return;const l=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];l.push(l[e-1]+Math.sqrt(n*n+o*o))}const s=l[l.length-1];if(0===s)return;const a=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(l[n]+l[n+1])/2;let r=i;a>o&&(r*=o/a),a>s-o&&(r*=(s-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function an(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,l=t[1]*o,s=t[0]+"px",a=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===l||(e.width=r,e.height=l),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function cn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function un([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function dn(e,t,n,o,i){return"function"==typeof e?e(t,n,o,i):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",i>1?"@2x":"")}class hn{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 fn{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let i=0;this.capacity>i;i++){const r=this.particles[i];if(!r.active)continue;const l=n[r.lineIndex];if(!l||2>l.length){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const s=pn(l),a=gn(l,r.t*s),c=(o[r.lineIndex]||2)/2;r.x=a.x+a.nx*r.offset*c*2,r.y=a.y+a.ny*r.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function pn(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],i=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+i*i)}return t}function gn(e,t){let n=0;for(let o=1;e.length>o;o++){const i=e[o][0]-e[o-1][0],r=e[o][1]-e[o-1][1],l=Math.sqrt(i*i+r*r);if(n+l>=t||o===e.length-1){const s=l>0?(t-n)/l:0,a=l>.001?l:1;return{x:e[o-1][0]+i*s,y:e[o-1][1]+r*s,nx:-r/a,ny:i/a}}n+=l}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const yn={top:10,right:10,bottom:10,left:10},vn={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"},mn={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 bn(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function xn(e){return e?e.getContext("2d"):null}function kn({data:n}){var o;if(!n)return null;if(n.properties)return e("div",{className:"semiotic-tooltip",style:vn,children:e("div",{style:{fontWeight:600},children:n.properties.name||n.properties.NAME||n.properties.id||"Feature"})});const i=null!==(o=n.data)&&void 0!==o?o:n,r=Object.entries(i).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return e("div",{className:"semiotic-tooltip",style:vn,children:r.map(([n,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[n,": "]}),e("span",{style:{fontWeight:600},children:o+""})]},n))})}const wn=f(function(n,o){var l,c,h,f,g,y,v,m,b,x;const{projection:k,projectionExtent:w,fitPadding:j,projectionTransform:O,areas:M,points:A,lines:S,xAccessor:C,yAccessor:L,lineDataAccessor:z,pointIdAccessor:P,lineIdAccessor:D,lineType:I="geo",flowStyle:$="basic",graticule:R,zoomable:W,zoomExtent:B,onZoom:T,dragRotate:N,showParticles:E,particleStyle:_,tileURL:H,tileAttribution:F,tileCacheSize:G,size:Y,width:X,height:Q,responsiveWidth:K,responsiveHeight:J,margin:ee,className:te,background:ne,areaStyle:oe,pointStyle:ie,lineStyle:re,colorScheme:se,enableHover:ae=!0,hoverAnnotation:ce,tooltipContent:de,customClickBehavior:he,customHoverBehavior:fe,annotations:ge,decay:ye,pulse:ve,transition:me,animate:be,staleness:xe,backgroundGraphics:ke,foregroundGraphics:we,title:je,legend:Oe,legendPosition:Me,legendHoverBehavior:Ae,legendClickBehavior:Se,legendHighlightedCategory:Ce,legendIsolatedCategories:Le,legendCategoryAccessor:Pe,onCategoriesChange:De,showAxes:$e,accessibleTable:Re=!0,description:We,summary:Be}=n,Te=Y||[X||600,Q||400],Ne=i(!0),Ee=Ie({sizeProp:Te,responsiveWidth:K,responsiveHeight:J,userMargin:ee,marginDefault:yn,foregroundGraphics:we,backgroundGraphics:ke,animate:be,transitionProp:me,themeDirtyRef:Ne}),{reducedMotionRef:_e,responsiveRef:He,size:Fe,margin:qe,adjustedWidth:Ge,adjustedHeight:Ve,resolvedForeground:Ue,resolvedBackground:Ze,transition:Ye,introEnabled:Xe,tableId:Qe,rafRef:Ke,renderFnRef:Je,scheduleRender:et,currentTheme:tt}=Ee,nt=function(){const[e,t]=u(!1);return kt(()=>{t(!0)},[]),e}(),ot=function(){const e=a(wt,jt,Ot);return i(e).current}(),it=r(()=>Array.isArray(M)?qt(M):M,[M]),rt=r(()=>qt(A),[A]),lt=r(()=>qt(S),[S]),st=r(()=>null!=N?N:"orthographic"===bn(k),[N,k]),at=r(()=>{var e,t;return{projection:k,projectionExtent:w,fitPadding:j,xAccessor:C,yAccessor:L,lineDataAccessor:z,lineType:I,flowStyle:$,areaStyle:oe,pointStyle:ie,lineStyle:re,colorScheme:se,themeSemantic:pe(tt),themeSequential:null===(e=null==tt?void 0:tt.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==tt?void 0:tt.colors)||void 0===t?void 0:t.diverging,graticule:R,projectionTransform:O,decay:ye,pulse:ve,transition:Ye,introAnimation:Xe,annotations:ge,pointIdAccessor:P,lineIdAccessor:D}},[k,w,j,C,L,z,I,$,oe,ie,re,se,R,O,ye,ve,null==Ye?void 0:Ye.duration,null==Ye?void 0:Ye.easing,Xe,ge,P,D,tt]),ct=function(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return At(e,t);if(!St(e)||!St(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!At(n,i))return!1}else{if(!St(n)||!St(i))return!1;if(!Mt(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(at),ut=i(null);ut.current||(ut.current=new le(ct));const dt=i(null),ht=i(null),ft=i(null),pt=i(null),gt=i(null);H&&!gt.current&&(gt.current=new hn(G||256));const yt=i(ge),vt=i(null),Ct=i(V),Lt=i(!1),Pt=i(null),Dt=s(e=>{Pt.current=e,He&&"object"==typeof He&&(He.current=e)},[He]),It=i(null),$t=i(null),Rt=i(null),Wt=i(0);if(E&&!Rt.current){const e=null!==(l=null==_?void 0:_.maxPerLine)&&void 0!==l?l:30;Rt.current=new fn(50*e)}const Bt=i(null),Tt=i(null),[Ft,Gt]=u(null),[Ut,Zt]=u(0),[Yt,Xt]=u(!1),Qt=i([]),Jt=i(Pe),pn=i(De);Jt.current=Pe,pn.current=De;const gn=s(()=>{var e,t;const n=Jt.current,o=pn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=ut.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,Qt.current)||(Qt.current=i,o(i))},[]);d(()=>{var e;null===(e=ut.current)||void 0===e||e.updateConfig(ct),Ne.current=!0,et()},[ct,et]),d(()=>{const e=ut.current;e&&(it&&e.setAreas(it),A&&e.setPoints(rt),S&&e.setLines(lt),Ne.current=!0,et())},[it,A,rt,S,lt,et]);const vn=s(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=ut.current)||void 0===t||t.pushPoint(e),Ne.current=!0,et())},[et]),wn=s(e=>{var t;const n=qt(e);0!==n.length&&(null===(t=ut.current)||void 0===t||t.pushMany(n),Ne.current=!0,et())},[et]),jn=s(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=ut.current)||void 0===t||t.pushLine(e),Ne.current=!0,et())},[et]),On=s(e=>{var t;const n=qt(e);0!==n.length&&(null===(t=ut.current)||void 0===t||t.pushManyLines(n),Ne.current=!0,et())},[et]),Mn=s(()=>{var e;null===(e=ut.current)||void 0===e||e.clear(),Ne.current=!0,et()},[et]);p(o,()=>({push:vn,pushMany:wn,removePoint:e=>{var t,n;const o=null!==(n=null===(t=ut.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Ne.current=!0,et()),o},pushLine:jn,pushManyLines:On,removeLine:e=>{var t,n;const o=null!==(n=null===(t=ut.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[];return o.length>0&&(Ne.current=!0,et()),o},getLines:()=>{var e,t;return null!==(t=null===(e=ut.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]},clear:Mn,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:()=>Ct.current.k,resetZoom:()=>{const e=Pt.current;e&&vt.current&&Z(e).call(vt.current.transform,V)},getData:()=>{var e,t;return null!==(t=null===(e=ut.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[vn,wn,jn,On,Mn,et]);const{hoverHandlerRef:An,onPointerMove:Sn,onPointerLeave:Cn}=Ee;d(()=>{An.current=e=>{if(!ae)return;const t=ut.current;if(!t||!t.scene.length)return;const n=ht.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-qe.left,r=e.clientY-o.top-qe.top;if(0>i||i>Ge||0>r||r>Ve)return Bt.current=null,Tt.current=null,Gt(null),null==fe||fe(null),void et();pt.current||(pt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const l=xn(pt.current);if(!l)return;const s=ue(t.scene,i,r,30,l,t.quadtree,t.maxPointRadius);if(s){const e=s.node,t=e.datum,n=Array.isArray(t)?null:(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,l;"point"===e.type?(o=e.x,l=e.y):"geoarea"===e.type?(o=e.centroid[0],l=e.centroid[1]):(o=i,l=r);const a=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,__semioticHoverData:!0,x:o,y:l});Bt.current=a,Tt.current=e,Gt(a),null==fe||fe(a),et()}else Bt.current&&(Bt.current=null,Tt.current=null,Gt(null),null==fe||fe(null),et())}},[ae,Ge,Ve,qe,fe,et]),Ee.hoverLeaveRef.current=()=>{Bt.current=null,Tt.current=null,Gt(null),null==fe||fe(null),et()};const Ln=s(e=>{if(!he)return;const t=ut.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-qe.left,i=e.clientY-n.top-qe.top;pt.current||(pt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=xn(pt.current);if(!r)return;const l=ue(t.scene,o,i,30,r,t.quadtree,t.maxPointRadius);if(l){const e=l.node.datum,t=Array.isArray(e)?null:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;he(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i}))}},[he,qe]),zn=i(-1),Pn=i(null),Dn=s(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=zn.current,i=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===i)return;if(e.preventDefault(),0>i)return zn.current=-1,Pn.current=null,Bt.current=null,Tt.current=null,Gt(null),null==fe||fe(null),void et();const r=0>o?0:i;zn.current=r;const l=n[r];Pn.current={shape:l.shape,w:l.w,h:l.h};const s=l.datum,a=Object.assign(Object.assign(Object.assign({},s||{}),(null==s?void 0:s.properties)||{}),{data:s,properties:null==s?void 0:s.properties,x:l.x,y:l.y,__semioticHoverData:!0});Bt.current=a,Gt(a),null==fe||fe(a),et()},[fe,et]),In=s(e=>{zn.current=-1,Pn.current=null,Sn(e)},[Sn]);Je.current=()=>{var e,t,n,o,i,r,l,s;Ke.current=0;const a=ht.current,c=ut.current;if(!a||!c)return;const u=performance.now();let d=!1;const h=$t.current;h&&($t.current=null,c.applyRotation(h,{width:Ge,height:Ve}));const f=c.advanceTransition(_e.current?u+1e6:u),p=!_e.current&&f;if(Ne.current&&!f){const e={width:Ge,height:Ve},t=st?c.getRotation():null;c.computeScene(e);const n=Ct.current,o=1!==n.k||0!==n.x||0!==n.y;st&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),Ne.current=!1,a.setAttribute("aria-label",zt(c.scene,"Geographic chart")),gn()}const g=cn();if(H&&gt.current){const t=dt.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=an(t,Fe,qe,g);if(e){e.clearRect(-qe.left,-qe.top,Fe[0],Fe[1]),e.save(),e.beginPath(),e.rect(0,0,Ge,Ve),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:i,height:r,tileCache:l,onTileLoad:s}=t,a=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:i=!0,clampY:r=!0}=e,l=Math.max(Math.log(n)/Math.LN2-8,0),s=Math.round(l),a=1<<s,c=Math.pow(2,l-s+8),u=o[0]-n/2,d=o[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?a:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(r?0:-1/0,Math.floor((0-d)/c)),g=Math.min(r?a:1/0,Math.ceil((t[1]-d)/c)),y=[];for(let e=p;g>e;++e)for(let t=h;f>t;++t)y.push([t,e,s]);return{tiles:y,translate:[u/c,d/c],scale:c}}({size:[i,r],scale:2*a*Math.PI,translate:c}),d=cn();let h=!0;for(const t of u.tiles){const[o,i,r]=un(t),a=`${r}/${o}/${i}`;let c=l.get(a);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:a,lastUsed:performance.now()};l.set(a,t),e.onload=()=>{t.loaded=!0,null==s||s()},e.onerror=()=>{t.loaded=!0},e.src=dn(n,r,o,i,d),c=t}if(!c.loaded){h=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return h}(e,{tileURL:H,projection:c.scales.projection,width:Ge,height:Ve,tileCache:gt.current,onTileLoad:()=>et()});e.restore(),t||(d=!0)}}}const y=an(a,Fe,qe,g);if(!y)return;if(y.clearRect(-qe.left,-qe.top,Fe[0],Fe[1]),ne&&!H){const e=ze(y,ne);e&&(y.fillStyle=e,y.fillRect(0,0,Ge,Ve))}y.save(),y.beginPath(),y.rect(0,0,Ge,Ve),y.clip();const v=c.scene,m={width:Ge,height:Ve};if(function(e,t){var n,o,i;const r=t.filter(e=>"geoarea"===e.type);for(const t of r){if(!t.pathData)continue;const r=new Path2D(t.pathData),l=t.style.fill||"#e0e0e0";if("none"!==l&&(e.fillStyle=l,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(i=t._decayOpacity)&&void 0!==i?i:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(r)}tn(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(y,v),((e,t,n,o)=>{var i,r;const l=t.filter(e=>"line"===e.type);for(const s of l){if(2>s.path.length)continue;const a=s._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const c=s.style.stroke||"#007bff",u=ze(e,c)||c,d=s.style.strokeWidth||2,h=s.colorThresholds,f=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=d,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const v=null!==(i=s.style.opacity)&&void 0!==i?i:1;sn(e,s.path,u,d,v,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=nn(s.curve),g=h&&h.length>0&&f&&f.length===s.path.length,y=s._decayOpacities;if(y&&y.length===s.path.length&&!g){e.strokeStyle=u;const m=null!==(r=s.style.opacity)&&void 0!==r?r:1;for(let b=0;s.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*m,e.beginPath(),e.moveTo(s.path[b][0],s.path[b][1]),e.lineTo(s.path[b+1][0],s.path[b+1][1]),e.stroke()}else if(g){let x=null,k=null,w=null,j=null,O=!1;function M(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function A(){O&&(e.stroke(),O=!1)}for(let S=0;s.path.length>S;S++){const[C,L]=s.path[S],z=f[S],P=ln(z,h,u);if(null!==x&&null!==j&&null!==w){if(P===j)e.lineTo(C,L);else{const D=[];for(const I of h){const $=I.value;(w>$||$>z)&&($>w||z>$)||w===$||z===$||D.push({t:($-w)/(z-w)})}D.sort((e,t)=>e.t-t.t);for(const R of D){const W=x+(C-x)*R.t,B=k+(L-k)*R.t,T=ln(w+(z-w)*Math.min(R.t+1e-4,1),h,u);e.lineTo(W,B),A(),M(T,W,B)}e.lineTo(C,L)}x=C,k=L,w=z,j=P}else M(P,C,L),x=C,k=L,w=z,j=P}A()}else{e.beginPath();const N=s.strokeGradient&&s.path.length>=2?rn(e,s.strokeGradient,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(e.strokeStyle=N||u,p)q().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[E,_]=s.path[0];e.moveTo(E,_);for(let H=1;s.path.length>H;H++)e.lineTo(s.path[H][0],s.path[H][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=on(e,s.style.fill,s.style.fill),p&&!g)q().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[G,V]=s.path[0];e.moveTo(G,V);for(let U=1;s.path.length>U;U++)e.lineTo(s.path[U][0],s.path[U][1])}const F=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(F,o.height),e.closePath(),e.fill()}void 0!==a&&1>a&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(y,v,0,m),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=on(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),en(e,t),e.globalAlpha=1}}finally{e.restore()}}})(y,v),E&&Rt.current){const e=Rt.current,s=v.filter(e=>"line"===e.type);if(s.length>0){const a=_||{},c=.3*(null!==(t=a.speedMultiplier)&&void 0!==t?t:1),h=null!==(n=a.maxPerLine)&&void 0!==n?n:30,f=null!==(o=a.spawnRate)&&void 0!==o?o:.15,p=null!==(i=a.radius)&&void 0!==i?i:2,g=null!==(r=a.opacity)&&void 0!==r?r:.7,v=u/1e3,m=Wt.current>0?Math.min(v-Wt.current,.1):.016;Wt.current=v;const b=s.map(e=>e.path),x=s.map(e=>e.style.strokeWidth||2);for(let t=0;s.length>t;t++)Math.random()<f&&e.countForLine(t)<h&&e.spawn(t);e.step(m,c,b,x),y.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=s[n.lineIndex],i="function"==typeof a.color?a.color(null!==(l=null==o?void 0:o.datum)&&void 0!==l?l:{}):"source"!==a.color&&a.color?a.color:(null==o?void 0:o.style.stroke)||"#fff";y.beginPath(),y.arc(n.x,n.y,p,0,2*Math.PI),y.fillStyle=i,y.fill()}y.globalAlpha=1,d=!0}}y.restore();const b=ft.current;if(b){const e=an(b,Fe,qe,g);if(e){e.clearRect(-qe.left,-qe.top,Fe[0],Fe[1]);const t=Tt.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 ce?ce:void 0,i=(null==o?void 0:o.pointColor)||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),i?(e.save(),e.globalAlpha=.4,e.fillStyle=i,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=i||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(xe){const e=performance.now()-c.lastIngestTime>(null!==(s=xe.threshold)&&void 0!==s?s:5e3);e!==Yt&&Xt(e)}const x=ge!==yt.current;x&&(yt.current=ge),(Ne.current||x)&&Zt(e=>e+1),(p||null!=c.activeTransition||c.hasActivePulses||d)&&(Ke.current=requestAnimationFrame(()=>Je.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:l,cleanup:s}=e;kt(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,l.current()},[t,n]);const a=i(s);a.current=s,d(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:nt,wasHydratingFromSSR:ot,storeRef:ut,dirtyRef:Ne,renderFnRef:Je,cleanup:()=>{var e;return null===(e=gt.current)||void 0===e?void 0:e.clear()}}),d(()=>{Ne.current=!0,et()},[Ge,Ve,ne,et]),function(e,t,n,o,i,r){d(()=>{if(!e)return;const l=setInterval(()=>{var l;const s=t.current;if(!s||0===s.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(l=e.threshold)&&void 0!==l?l:5e3,u=a-s.lastIngestTime>c;u!==i&&(r(u),n.current=!0,o())},1e3);return()=>clearInterval(l)},[e,i,o])}(xe,ut,Ne,et,Yt,Xt),d(()=>{if("production"!==process.env.NODE_ENV&&H){const e=bn(k);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[H,k]),d(()=>{const e=Pt.current;if(!W||!e)return vt.current&&e&&(Z(e).on(".zoom",null),vt.current=null),void(e&&Z(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=B||[1,8],o={width:Ge,height:Ve};if(st){let i=Ct.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),Ct.current=V.scale(i);const l=ut.current;l&&(l.applyZoomScale(i,o),Ne.current=!1,et(),(null===(r=l.scales)||void 0===r?void 0:r.projection)&&(null==T||T({projection:l.scales.projection,zoom:l.currentZoom})))};vt.current={scaleBy:(e,t)=>r(i*t),transform:(e,t)=>{var n;return r(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const l=e=>{e.preventDefault(),r(i*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),r(1.5*i))};e.addEventListener("wheel",l,{passive:!1}),e.addEventListener("dblclick",s);const a=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=ut.current;if(!o)return;const i=o.getRotation();It.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=It.current;t&&($t.current=[t.rotation[0]+(e.clientX-t.x)*a,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*a)),t.rotation[2]],et())},d=t=>{var n;if(!It.current)return;It.current=null,e.releasePointerCapture(t.pointerId);const i=$t.current;if(i){$t.current=null;const e=ut.current;e&&(e.applyRotation(i,o),et())}const r=ut.current;(null===(n=null==r?void 0:r.scales)||void 0===n?void 0:n.projection)&&(null==T||T({projection:r.scales.projection,zoom:r.currentZoom}))};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",l),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),vt.current=null}}const i=U().scaleExtent([t,n]).extent([[0,0],[Fe[0],Fe[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;Ct.current=t,Lt.current=!0;const n=ut.current;n&&(n.applyZoomTransform(t,o),Ne.current=!1,et())}).on("end",e=>{var t;Ct.current=e.transform,Lt.current=!1;const n=ut.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==T||T({projection:n.scales.projection,zoom:n.currentZoom}))});return vt.current=i,Z(e).call(i),()=>{Z(e).on(".zoom",null)}},[W,B,st,Fe,Ge,Ve,qe,T,et]);const $n=ae&&!1!==ce,Rn=$n&&Ft?de?de(Ft):e(kn,{data:Ft}):null,Wn=Rn?e(Kt,{x:Ft.x,y:Ft.y,containerWidth:Ge,containerHeight:Ve,margin:qe,className:"stream-frame-tooltip",zIndex:10,children:Rn}):null;if(xt||!nt&&ot){const n=ut.current;n&&(it||A||S)&&(it&&n.setAreas(it),A&&n.setPoints(rt),S&&n.setLines(lt),n.computeScene({width:Ge,height:Ve}));const o=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[];return t("div",{ref:Dt,className:"stream-geo-frame"+(te?" "+te:""),role:"img","aria-label":We||("string"==typeof je?je:"Geographic chart"),style:{position:"relative",width:K?"100%":Fe[0],height:J?"100%":Fe[1]},children:[e(Et,{summary:Be}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Fe[0],height:Fe[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${qe.left},${qe.top})`,children:Ze}),t("g",{transform:`translate(${qe.left},${qe.top})`,children:[ne&&e("rect",{x:0,y:0,width:Ge,height:Ve,fill:ne}),o.map((t,n)=>function(t,n){var o,i,r,l,s,a;switch(t.type){case"geoarea":{const r=t;return r.pathData?e("path",{d:r.pathData,fill:bt(r.style.fill,"#e0e0e0"),fillOpacity:null!==(o=r.style.fillOpacity)&&void 0!==o?o:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(i=r._decayOpacity)&&void 0!==i?i:1},"geoarea-"+n):null}case"point":{const o=t;return e("circle",{cx:o.x,cy:o.y,r:o.r,fill:bt(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(l=o._decayOpacity)&&void 0!==l?l:null!==(s=o.style.opacity)&&void 0!==s?s:1},"point-"+n)}case"line":{const o=t;if(2>o.path.length)return null;const i="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(a=o.style.opacity)&&void 0!==a?a:1},"line-"+n)}default:return null}}(t,n))]})]}),e(mt,{width:Ge,height:Ve,totalWidth:Fe[0],totalHeight:Fe[1],margin:qe,scales:null,showAxes:!1,title:je,legend:Oe,legendPosition:Me,legendHoverBehavior:Ae,legendClickBehavior:Se,legendHighlightedCategory:Ce,legendIsolatedCategories:Le,foregroundGraphics:Ue,annotations:ge,annotationFrame:0,xValues:[],yValues:[],pointNodes:o.filter(e=>"point"===e.type)})]})}return t("div",{ref:Dt,className:"stream-geo-frame"+(te?" "+te:""),role:"group","aria-label":We||("string"==typeof je?je:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:K?"100%":Fe[0],height:J?"100%":Fe[1],overflow:"hidden"},W?{touchAction:"none"}:{}),onKeyDown:Dn,children:[Re&&e(_t,{tableId:Qe}),Re&&e(Nt,{scene:null!==(f=null===(h=ut.current)||void 0===h?void 0:h.scene)&&void 0!==f?f:[],chartType:"Geographic chart",tableId:Qe,chartTitle:"string"==typeof je?je:void 0}),e(Et,{summary:Be}),t("div",{role:"img","aria-label":We||("string"==typeof je?je:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:$n?In:void 0,onMouseLeave:$n?Cn:void 0,onClick:he?Ln:void 0,children:[Ze&&e("svg",{style:{position:"absolute",left:0,top:0,width:Fe[0],height:Fe[1],pointerEvents:"none"},children:e("g",{transform:`translate(${qe.left},${qe.top})`,children:Ze})}),H&&e("canvas",{ref:dt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e("canvas",{ref:ht,"aria-label":zt(null!==(y=null===(g=ut.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:ft,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Ht,{hoverPoint:Ft}),e(mt,{width:Ge,height:Ve,totalWidth:Fe[0],totalHeight:Fe[1],margin:qe,scales:null,showAxes:null!=$e&&$e,title:je,legend:Oe,legendPosition:Me,legendHoverBehavior:Ae,legendClickBehavior:Se,legendHighlightedCategory:Ce,legendIsolatedCategories:Le,foregroundGraphics:Ue,annotations:ge,annotationFrame:Ut,xValues:[],yValues:[],pointNodes:null===(v=ut.current)||void 0===v?void 0:v.scene.filter(e=>"point"===e.type)}),(null==xe?void 0:xe.showBadge)&&e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===xe.badgePosition?{top:4,left:4}:"bottom-left"===xe.badgePosition?{bottom:4,left:4}:"bottom-right"===xe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Yt?"#dc3545":"#28a745",color:"white"}),children:Yt?"STALE":"LIVE"}),W&&t("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:qe.bottom+8,left:qe.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Pt.current,n=vt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(Z(t),1.5)},style:mn,children:"+"}),e("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Pt.current,n=vt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(Z(t),1/1.5)},style:mn,children:"−"})]}),F&&e("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:qe.bottom+2,right:qe.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:F}),e(Vt,{active:zn.current>=0,hoverPoint:Ft,margin:qe,size:Fe,shape:null===(m=Pn.current)||void 0===m?void 0:m.shape,width:null===(b=Pn.current)||void 0===b?void 0:b.w,height:null===(x=Pn.current)||void 0===x?void 0:x.h}),Wn]})]})});function jn(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function On(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Mn(e){const t=e.map(jn),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return On(e,n,o)}if(e>=1){const[e,o,i]=t[n];return On(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[l,s,a]=t[i],[c,u,d]=t[i+1];return On(Math.round(l+(c-l)*r),Math.round(s+(u-s)*r),Math.round(a+(d-a)*r))}}wn.displayName="StreamGeoFrame";const An=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Sn=Mn(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Cn=Mn(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ln=Mn(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),zn=Mn(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Pn=Mn(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Dn=Mn(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),In=Mn(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),$n=Mn(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Rn=Mn(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Wn=Mn(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Bn=Mn(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Tn=Mn(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);Mn(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Mn(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Mn(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Mn(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Mn(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Mn(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Mn(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const Nn={category10:An,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Sn,reds:Cn,greens:Ln,oranges:zn,purples:Pn,viridis:In,plasma:$n},En=An,_n=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Hn=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 Fn(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")||Hn.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):En[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))%En.length]}function qn(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return S().domain(o).range(n).unknown("#999");const r=Nn[n]||Nn.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:En;return S().domain(o).range(e).unknown("#999")}}function Gn(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,l]=o,[s,a]=n;if(l===r)return(s+a)/2;let c=(i-r)/(l-r);return 0>c?c=0:c>1&&(c=1),s+c*(a-s)}const Vn=c(null);function Un(){return l(Vn)}function Zn(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Yn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Xn,Qn]=he(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Yn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Yn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Kn,Jn]=he(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function eo(e){const t=g(),n=e.clientId||t,{name:o}=e,i=Qn(e=>e.selections.get(o)),l=Qn(e=>e.setClause),a=Qn(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Zn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};l(o,{clientId:n,type:"point",fields:t})},[n,o,l]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};l(o,{clientId:n,type:"interval",fields:t})},[n,o,l]),clear:s(()=>{a(o,n)},[a,o,n]),clientId:n}}function to(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:l}=eo({name:t});return{onHover:s(e=>{if(!e)return void l();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,l,t]),predicate:o,isActive:i}}const no=c(!1),oo=c(null),io="undefined"==typeof window?d:h;function ro(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 lo(e,t,n){return t?(o,...i)=>{var r;const l=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(l,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;l.opacity=e,l.fillOpacity=e,l.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(l,n.unselectedStyle)}return l}:e}function so(){return we(e=>e.theme)}o.createContext(void 0);const ao="#007bff";function co(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function uo(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function ho(){var e;const t=so(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function fo({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:l,chartId:a,onClick:c,hoverHighlight:h,colorByField:f}){const p=g(),y=ro(t,n),v=eo({name:(null==e?void 0:e.name)||"__unused__"}),m=to({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=Jn(e=>e.pushObservation),x=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,w]=u(null),j=f||n[0],O=r(()=>{if(!h||null==k||!j)return null;const e=k,t=j;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,j]),M=s(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=co(e,t,y.xField);null!=n&&function(e,t,n){const o=ot.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n})},rt())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&m.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&lt(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&m.onHover(null);if(h&&j)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[j];w(null!=n?n+"":null)}else w(null);if(i||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:a};if(e){const r=uo(e),l=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(l),b&&b(l)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),b&&b(e)}}},[t,m,y,p,i,l,a,b,h,j]),A=s(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=co(e,t,y.xField);null!=n&&function(e,t,n){const o=ot.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(ot.positions);return t.delete(e),ot={positions:t},rt(),!1}ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n,locked:!0})},rt()}(y.name||"hover",n,p)}if(e&&c){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),c(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:a};if(e){const n=uo(e),l=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(l),b&&b(l)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),b&&b(e)}}},[c,i,b,l,a,y,p]);return d(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{st(e,p),lt(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:M,customClickBehavior:A,crosshairSourceId:p}}function po({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:s="right",userMargin:a,defaults:c={top:50,bottom:60,left:70,right:40},categories:u}){const d=l(no),h=null!==l(oo),f=void 0!==o?o:!d&&!!t,p=!!t&&(f||h),y=r(()=>{if(!p)return[];if(void 0!==u)return u;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[u,t,e,p]);!function(e){const t=l(oo),n=g(),o=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=i([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(r.current,o)||(r.current=o);const s=r.current;io(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),io(()=>{t&&t.registerCategories(n,s)},[t,n,s])}(h&&t?y:[]);const v=r(()=>{if(!f||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:l}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(l&&l.length>0?l:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const l=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=l?o(l,t,n):n?n(i):_n[r%_n.length];return{label:i+"",color:s}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Fn,categories:y});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[f,t,e,n,y]),m=r(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=Object.assign(Object.assign({},c),e);return v&&("right"===s&&110>t.right?t.right=110:"left"===s&&110>t.left?t.left=110:"top"===s&&50>t.top?t.top=50:"bottom"===s&&80>t.bottom&&(t.bottom=80)),t},[c,a,v,s]);return{legend:v,margin:m,legendPosition:s}}const go={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 yo(e,t,n){var o,i,r,l,s,a,c;const u=go[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(i=t.height)&&void 0!==i?i:u.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(l=t.showGrid)&&void 0!==l?l:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:vo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function vo(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 mo(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function bo({componentName:n,message:o,diagnosticHint:i,width:r,height:l}){return e("div",{role:"alert",style:{width:r,height:Math.max(l,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class xo extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(bo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var ko;const wo="undefined"!=typeof process&&"production"!==(null===(ko=process.env)||void 0===ko?void 0:ko.NODE_ENV);function jo({componentName:t,width:n,height:o,children:i}){return e(xo,{fallback:i=>e(bo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Oo={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Mo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Ao(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},Oo),{width:n,height:o}),children:i||"No data available"}):null}function So(t,n,o){if(!t)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),l=Math.max(6,Math.floor(o/(2.5*i))),s=Math.floor((o-(i*(r+l)-l))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Mo),{position:"absolute",top:s+o*(r+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}function Co(e,t,n,o){if(!wo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Lo(e){const t=we(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function zo(e,t,n,o){return new(n||(n=Promise))(function(i,r){function l(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,s)}a((o=o.apply(e,t||[])).next())})}function Po(e){return e}function Do(e,t){var n=t.id,o=t.bbox,i=null==t.properties?{}:t.properties,r=function(e,t){var n=function(e){if(null==e)return Po;var t,n,o=e.scale[0],i=e.scale[1],r=e.translate[0],l=e.translate[1];return function(e,s){s||(t=n=0);var a=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+r,u[1]=(n+=e[1])*i+l;c>a;)u[a]=e[a],++a;return u}}(e.transform),o=e.arcs;function i(e,t){t.length&&t.pop();for(var i=o[0>e?~e:e],r=0,l=i.length;l>r;++r)t.push(n(i[r],r));0>e&&function(e,t){for(var n,o=e.length,i=o-t;i<--o;)n=e[i],e[i++]=e[o],e[o]=n}(t,l)}function r(e){return n(e)}function l(e){for(var t=[],n=0,o=e.length;o>n;++n)i(e[n],t);return 2>t.length&&t.push(t[0]),t}function s(e){for(var t=l(e);4>t.length;)t.push(t[0]);return t}function a(e){return e.map(s)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=r(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(r);break;case"LineString":n=l(t.arcs);break;case"MultiLineString":n=t.arcs.map(l);break;case"Polygon":n=a(t.arcs);break;case"MultiPolygon":n=t.arcs.map(a);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:i,geometry:r}:null==o?{type:"Feature",id:n,properties:i,geometry:r}:{type:"Feature",id:n,bbox:o,properties:i,geometry:r}}"function"==typeof SuppressedError&&SuppressedError;const Io=new Map;function $o(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function Ro(e){return zo(this,void 0,void 0,function*(){const t=Io.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return zo(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:$o(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:$o(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:$o(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:$o(yield import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}})}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const i=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return Do(e,t)})}:Do(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return Io.set(e,r),r})}function Wo(e){const t=r(()=>Array.isArray(e)?e:void 0,[e]),[n,o]=u(null);return d(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return o(null),Ro(e).then(e=>{t||o(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),o(null)}else o(null)},[e]),void 0!==t?t:n}const Bo={blues:Sn,reds:Cn,greens:Ln,viridis:In,oranges:zn,purples:Pn,greys:Dn,plasma:$n,inferno:Rn,magma:Wn,cividis:Bn,turbo:Tn};function To(n){var o;const i=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),l=function(){var e;const t=so();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:s,valueAccessor:a,colorScheme:c,projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:f,zoomExtent:p,onZoom:g,dragRotate:y,tileURL:v,tileAttribution:m,tileCacheSize:b,tooltip:x,areaOpacity:k=1,annotations:w,margin:j,className:O,selection:M,linkedHover:A,onObservation:S,onClick:L,chartId:z,loading:D,emptyContent:I,frameProps:$={},stroke:R,strokeWidth:W,opacity:B}=n,T=null!=f?f:!!v,N=Wo(s),E=r(()=>N?qt(N):N,[N]),_=r(()=>"function"==typeof a?a:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[a])&&void 0!==n?n:null==e?void 0:e[a]},[a]),H=null!==(o=null!=c?c:l)&&void 0!==o?o:"blues",F=r(()=>{if(!E)return C(Sn).domain([0,1]);const e=E.map(e=>_(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=P(e);return C(Bo[H]||Sn).domain([null!=t?t:0,null!=n?n:1])},[E,_,H]),{activeSelectionHook:q,customHoverBehavior:G,customClickBehavior:V}=fo({selection:M,linkedHover:A,onObservation:S,onClick:L,chartType:"ChoroplethMap",chartId:z}),U=Lo(M),Z=r(()=>{const e=mo(e=>{const t=_(e);return{fill:null!=t&&isFinite(t)?F(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}},{stroke:R,strokeWidth:W,opacity:B});return q?lo(e,q,U):e},[_,F,q,U,k,R,W,B]),Y=r(()=>n=>{var o,i;const r=(null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.name)||(null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||"Feature",l=_(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:r}),null!=l&&e("div",{style:{opacity:.7},children:(s=l,"number"==typeof s&&isFinite(s)?Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=s?s:"")+"")})]});var s},[_]),X=r(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof j?{top:j,bottom:j,left:j,right:j}:j),[j]),Q=So(D,i.width,i.height)||(E?null:So(!0,i.width,i.height)),K=Q?null:Ao(E,i.width,i.height,I);if(Array.isArray(E)&&E.length>0){const t=E[0];if(!t||"object"!=typeof t||!t.geometry)return e(bo,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:i.width,height:i.height})}const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:u,areas:E,areaStyle:Z,size:[i.width,i.height],margin:X,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?Y:Qt(x)||Y},null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),T&&{zoomable:!0}),p&&{zoomExtent:p}),g&&{onZoom:g}),null!=y&&{dragRotate:y}),v&&{tileURL:v}),m&&{tileAttribution:m}),b&&{tileCacheSize:b}),(A||S||L)&&{customHoverBehavior:G}),(S||L)&&{customClickBehavior:V}),w&&w.length>0&&{annotations:w}),i.title&&{title:i.title}),i.description&&{description:i.description}),i.summary&&{summary:i.summary}),void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),$);return Q||K||e(jo,{componentName:"ChoroplethMap",width:i.width,height:i.height,children:e(wn,Object.assign({},J))})}function No(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:l,legendPosition:a,selection:c,linkedHover:d,fallbackFields:h,unwrapData:f=!1,onObservation:p,chartType:g,chartId:y,showLegend:v,userMargin:m,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,emptyContent:j,width:O,height:M}=e,A=void 0===n,S=r(()=>qt(t),[t]),[C,L]=u([]),z=s(e=>{L(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),P="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:D,hoverSelectionHook:I,customHoverBehavior:$,customClickBehavior:R,crosshairSourceId:W}=fo({selection:c,linkedHover:d,fallbackFields:h,unwrapData:f,onObservation:p,chartType:g,chartId:y,onClick:x,hoverHighlight:k,colorByField:P}),B=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(d,W),T=function(e,t,n){const o=Un(),i=ho();return r(()=>{var r;if(!t)return;const l=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=qn(n.map(e=>({_cat:e})),"_cat",l);return t=>o[t]||e(t)}return qn(n.map(e=>({_cat:e})),"_cat",l)}if(o&&Object.keys(o).length>0){const n=qn(e,t,l);return e=>o[e]||n(e)}return qn(e,t,l)}if(o&&Object.keys(o).length>0){const e=qn([{_:"a"}],"_",l);return t=>o[t]||e(t)}},[e,t,n,o,i])}(S,o,i),N=r(()=>{if(!o)return[];const e=new Set;for(const t of S){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[S,o]),E=r(()=>A&&C.length>0?C:N,[A,C,N]),_=function(e,t,n){const[o,i]=u(null),[l,a]=u(new Set),c=s(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,o,l]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(l,o,E),H=r(()=>I||(_.legendSelectionHook?_.legendSelectionHook:D),[I,_.legendSelectionHook,D]),F=Lo(c),q=ho(),G=Un(),V=r(()=>{if(T)return T;if(!o||0===E.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:q&&q.length>0?q:_n,t="__streamCat",n=qn(E.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||n(e)||"#999"},[T,o,E,i,q,G]),{legend:U,margin:Z,legendPosition:Y}=po({data:S,colorBy:o,colorScale:V,showLegend:v,legendPosition:a,userMargin:m,defaults:b,categories:E}),X=r(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Y),l&&"none"!==l&&(e.legendHoverBehavior=_.onLegendHover,e.legendClickBehavior=_.onLegendClick,e.legendHighlightedCategory=_.highlightedCategory,e.legendIsolatedCategories=_.isolatedCategories),A&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=z),e},[U,Y,l,_.onLegendHover,_.onLegendClick,_.highlightedCategory,_.isolatedCategories,A,o,z]),Q=Array.isArray(n)?qt(n):n,K=So(w,O,M),J=K?null:Ao(Q,O,M,j);return{data:S,colorScale:T,allCategories:E,legendState:_,effectiveSelectionHook:H,activeSelectionHook:D,customHoverBehavior:$,customClickBehavior:R,legend:U,margin:Z,legendPosition:Y,earlyReturn:K||J||null,legendBehaviorProps:X,crosshairProps:B,resolvedSelection:F}}function Eo(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,l;const s=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of s){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(l=e.current)||void 0===l||l.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const l=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of l)null===(r=e.current)||void 0===r||r.push(n(t));return l},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const l=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of l)null===(r=n.current)||void 0===r||r.pushLine(t(e));return l},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}To.displayName="ChoroplethMap";const _o=f(function(n,o){const l=i(null);Eo(o,{variant:"geo-points",frameRef:l});const s=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:a,xAccessor:c="lon",yAccessor:u="lat",sizeBy:d,sizeRange:h=[3,30],colorBy:f,colorScheme:p,projection:g="equalEarth",graticule:y,fitPadding:v,zoomable:m,zoomExtent:b,onZoom:x,dragRotate:k,tileURL:w,tileAttribution:j,tileCacheSize:O,areas:M,areaStyle:A={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:S,annotations:C,margin:L,className:z,selection:P,linkedHover:D,onObservation:I,onClick:$,chartId:R,loading:W,emptyContent:B,legendInteraction:T,legendPosition:N,frameProps:E={},stroke:_,strokeWidth:H,opacity:F}=n,q=null!=m?m:!!w,G=Wo(M),V=No({data:null!=a?a:Ft,rawData:a,colorBy:f,colorScheme:p,legendInteraction:T,legendPosition:N,selection:P,linkedHover:D,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:I,onClick:$,chartType:"ProportionalSymbolMap",chartId:R,showLegend:s.showLegend,userMargin:L,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:W,emptyContent:B,width:s.width,height:s.height}),U=V.data,Z=r(()=>{if(!d)return;const e="function"==typeof d?d:e=>null==e?void 0:e[d],t=U.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[U,d]),Y=r(()=>{const e=mo(e=>({fill:f?Fn(e,f,V.colorScale):ao,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:d?Gn(e,d,h,Z):6}),{stroke:_,strokeWidth:H,opacity:F});return V.effectiveSelectionHook?lo(e,V.effectiveSelectionHook,V.resolvedSelection):e},[f,V.colorScale,V.effectiveSelectionHook,V.resolvedSelection,d,h,Z,_,H,F]),X=r(()=>n=>{const o=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n.NAME)||(null==n?void 0:n.id),i="string"==typeof d?d:null,r=("function"==typeof d?d:e=>e[d])(n),l=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",s="string"==typeof f?f:null,a=s?null==n?void 0:n[s]:null;return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[o&&e("div",{style:{fontWeight:600,marginBottom:2},children:o}),i&&null!=r&&t("div",{children:[t("span",{style:{opacity:.7},children:[i,": "]}),l(r)]}),s&&null!=a&&t("div",{children:[t("span",{style:{opacity:.7},children:[s,": "]}),a+""]}),!o&&!i&&Object.entries(n).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,": "]}),l(n)]},e))]})},[d,f]);Co("ProportionalSymbolMap",U,"xAccessor",c),Co("ProportionalSymbolMap",U,"yAccessor",u);const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:g},null!=a&&{points:U}),{xAccessor:c,yAccessor:u,pointStyle:Y}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),G&&{areas:G,areaStyle:A}),null!=y&&{graticule:y}),null!=v&&{fitPadding:v}),q&&{zoomable:!0}),b&&{zoomExtent:b}),x&&{onZoom:x}),null!=k&&{dragRotate:k}),w&&{tileURL:w}),j&&{tileAttribution:j}),O&&{tileCacheSize:O}),{size:[s.width,s.height],margin:V.margin,enableHover:!0,tooltipContent:!1===S?()=>null:Qt(S)||X}),V.legendBehaviorProps),(D||I||$)&&{customHoverBehavior:V.customHoverBehavior}),(I||$)&&{customClickBehavior:V.customClickBehavior}),C&&C.length>0&&{annotations:C}),s.title&&{title:s.title}),s.description&&{description:s.description}),s.summary&&{summary:s.summary}),void 0!==s.accessibleTable&&{accessibleTable:s.accessibleTable}),z&&{className:z}),null!=n.animate&&{animate:n.animate}),E);return V.earlyReturn?V.earlyReturn:e(jo,{componentName:"ProportionalSymbolMap",width:s.width,height:s.height,children:e(wn,Object.assign({ref:l},Q))})});_o.displayName="ProportionalSymbolMap";const Ho="__semiotic_x",Fo="__semiotic_y",qo=f(function(n,o){const l=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:a,nodes:c,nodeIdAccessor:u="id",xAccessor:d="lon",yAccessor:h="lat",valueAccessor:f="value",projection:p="equalEarth",graticule:g,fitPadding:y,zoomable:v,zoomExtent:m,onZoom:b,dragRotate:x,tileURL:k,tileAttribution:w,tileCacheSize:j,lineType:O="geo",flowStyle:M="basic",areas:S,areaStyle:C={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:L,edgeOpacity:z=.6,edgeWidthRange:P=[1,8],edgeLinecap:D="round",colorScheme:I,showParticles:$,particleStyle:R,tooltip:W,annotations:B,margin:T,className:N,selection:E,linkedHover:_,onObservation:H,onClick:F,chartId:q,loading:G,emptyContent:V,frameProps:U={},legendInteraction:Z,legendPosition:Y,stroke:X,strokeWidth:Q,opacity:K,lineIdAccessor:J}=n,ee=null!=v?v:!!k,te=Wo(S),ne=r(()=>qt(c),[c]),oe=No({data:null!=a?a:Ft,rawData:a,colorBy:L,colorScheme:I,legendInteraction:Z,legendPosition:Y,selection:E,linkedHover:_,fallbackFields:L?["string"==typeof L?L:""]:[],unwrapData:!1,onObservation:H,onClick:F,chartType:"FlowMap",chartId:q,showLegend:l.showLegend,userMargin:T,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:G,emptyContent:V,width:l.width,height:l.height}),ie=oe.data,re=ro(_),le=to({name:(null==re?void 0:re.name)||"hover",fields:(null==re?void 0:re.fields)||[]}),se=Jn(e=>e.pushObservation),ae=r(()=>{const e=new Map;for(const t of ne)e.set(t[u]+"",t);return e},[ne,u]),ce=i(null),ue=i(ae);ue.current=ae;const de=i(d);de.current=d;const he=i(h);he.current=h;const fe=s(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ue.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const i="function"==typeof de.current?de.current:e=>e[de.current],r="function"==typeof he.current?he.current:e=>e[he.current];return Object.assign(Object.assign({},e),{coordinates:[{[Ho]:i(n),[Fo]:r(n)},{[Ho]:i(o),[Fo]:r(o)}]})},[]);Eo(o,{variant:"geo-lines",frameRef:ce,overrides:{push:e=>{var t;const n=fe(e);n&&(null===(t=ce.current)||void 0===t||t.pushLine(n))},pushMany:e=>{var t;const n=[];for(const t of e){const e=fe(t);e&&n.push(e)}n.length>0&&(null===(t=ce.current)||void 0===t||t.pushManyLines(n))}}});const pe=r(()=>{const e=new Map;for(const t of ie)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},[ie]),ge=s(e=>{var t,n;if(_)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=pe.get(t[u]+"");e&&le.onHover(e)}else le.onHover(t)}else le.onHover(null);if(H||se){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:q};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const r=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});H&&H(r),se&&se(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});H&&H(e),se&&se(e)}}},[_,le,u,pe,H,q,se]),ye=oe.customClickBehavior,ve=r(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof h?h:e=>e[h];return ie.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ae.get(n.source+""),i=ae.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[Ho]:e(o),[Fo]:t(o)},{[Ho]:e(i),[Fo]:t(i)}]}):null}).filter(Boolean)},[ie,ae,d,h]),me=r(()=>{const e="function"==typeof d?d:e=>e[d];return t=>null!=t&&"object"==typeof t&&Ho in t?t[Ho]:e(t)},[d]),be=r(()=>{const e="function"==typeof h?h:e=>e[h];return t=>null!=t&&"object"==typeof t&&Fo in t?t[Fo]:e(t)},[h]),xe=r(()=>{const e=ie.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[f])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>P[0]:A().domain([Math.min(...e),Math.max(...e)]).range(P)},[ie,f,P]),ke=r(()=>e=>{var t;return{stroke:L?Fn(e,L,oe.colorScale):ao,strokeWidth:xe(null!==(t=e[f])&&void 0!==t?t:0),strokeLinecap:D,opacity:z}},[L,oe.colorScale,xe,f,z,D]),we=r(()=>{var e;const t=mo(ke,{stroke:X,strokeWidth:Q,opacity:K});if(!oe.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=oe.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return lo(t,oe.effectiveSelectionHook,Object.assign(Object.assign({},oe.resolvedSelection||{}),{unselectedStyle:n}))},[ke,oe.effectiveSelectionHook,oe.resolvedSelection,X,Q,K]),je=r(()=>mo(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:X,strokeWidth:Q,opacity:K}),[X,Q,K]),Oe=r(()=>n=>{var o,i,r,l,s,a,c;if((null==n?void 0:n.geometry)||(null==n?void 0:n.properties)||(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.geometry)){const t=(null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i.name)||(null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||(null===(s=null===(l=null==n?void 0:n.data)||void 0===l?void 0:l.properties)||void 0===s?void 0:s.name)||(null===(c=null===(a=null==n?void 0:n.data)||void 0===a?void 0:a.properties)||void 0===c?void 0:c.NAME);if(t)return e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:t})})}if(null!=(null==n?void 0:n.source)&&null!=(null==n?void 0:n.target)){const o=n[f];return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t("div",{style:{fontWeight:600},children:[n.source," → ",n.target]}),null!=o&&e("div",{style:{opacity:.7},children:"number"==typeof o?o.toLocaleString():o})]})}const d=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n[u]);return null!=d?e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:d})}):null},[f,u]),Me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:p},null!=a&&{lines:ve}),{points:ne,xAccessor:me,yAccessor:be,lineDataAccessor:"coordinates"}),null!=J&&{lineIdAccessor:J}),{lineType:O,flowStyle:M,lineStyle:we,pointStyle:je}),te&&{areas:te,areaStyle:C}),null!=g&&{graticule:g}),null!=y&&{fitPadding:y}),ee&&{zoomable:!0}),m&&{zoomExtent:m}),b&&{onZoom:b}),null!=x&&{dragRotate:x}),$&&{showParticles:$}),R&&{particleStyle:R}),k&&{tileURL:k}),w&&{tileAttribution:w}),j&&{tileCacheSize:j}),{size:[l.width,l.height],margin:oe.margin,enableHover:!0,tooltipContent:!1===W?()=>null:Qt(W)||Oe}),oe.legendBehaviorProps),(_||H||F)&&{customHoverBehavior:ge}),(H||F)&&{customClickBehavior:ye}),B&&B.length>0&&{annotations:B}),l.title&&{title:l.title}),l.description&&{description:l.description}),l.summary&&{summary:l.summary}),void 0!==l.accessibleTable&&{accessibleTable:l.accessibleTable}),N&&{className:N}),null!=n.animate&&{animate:n.animate}),U);return oe.earlyReturn?oe.earlyReturn:e(jo,{componentName:"FlowMap",width:l.width,height:l.height,children:e(wn,Object.assign({ref:ce},Me))})});qo.displayName="FlowMap";const Go=f(function(n,o){const l=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:a,lines:c,xAccessor:h="lon",yAccessor:f="lat",nodeIdAccessor:p="id",center:g,costAccessor:y,strength:v=1,lineMode:m="straight",projection:b="mercator",graticule:x,fitPadding:k,zoomable:w,zoomExtent:j,onZoom:O,dragRotate:M,tileURL:A,tileAttribution:S,tileCacheSize:C,transition:L,colorBy:z,colorScheme:P,pointRadius:D=5,tooltip:I,showRings:$=!0,ringStyle:R,showNorth:W=!0,costLabel:B,annotations:T,margin:N,className:E,selection:_,linkedHover:H,onObservation:F,onClick:q,chartId:G,loading:V,emptyContent:U,legendPosition:Z,frameProps:Y={},stroke:X,strokeWidth:Q,opacity:K}=n,J=null!=w?w:!!A,ee=r(()=>qt(a),[a]),te=No({data:ee,rawData:a,colorBy:z,colorScheme:P,legendInteraction:void 0,legendPosition:Z,selection:_,linkedHover:H,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!1,onObservation:F,onClick:q,chartType:"DistanceCartogram",chartId:G,showLegend:l.showLegend,userMargin:N,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:V,emptyContent:U,width:l.width,height:l.height}),ne=r(()=>{const e=mo(e=>({fill:z?Fn(e,z,te.colorScale):ao,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:D}),{stroke:X,strokeWidth:Q,opacity:K});return te.effectiveSelectionHook?lo(e,te.effectiveSelectionHook,te.resolvedSelection):e},[z,te.colorScale,te.effectiveSelectionHook,te.resolvedSelection,D,X,Q,K]),oe=r(()=>({center:g,centerAccessor:p,costAccessor:y,strength:v,lineMode:m}),[g,p,y,v,m]),ie=r(()=>{if(!c)return;const e="function"==typeof h?h:e=>e[h],t="function"==typeof f?f:e=>e[f],n=new Map;for(const e of ee)n.set(e[p]+"",e);return c.map(o=>{if(o.coordinates)return o;const i=n.get(o.source+""),r=n.get(o.target+"");return i&&r?Object.assign(Object.assign({},o),{coordinates:[{[h]:e(i),[f]:t(i)},{[h]:e(r),[f]:t(r)}]}):null}).filter(Boolean)},[c,ee,h,f,p]),re=r(()=>n=>{const o=("function"==typeof y?y:e=>e[y])(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:n[p]||n.name||n.id||"Point"}),null!=o&&t("div",{style:{opacity:.7},children:["Cost: ","number"==typeof o?o.toFixed(1):o]})]})},[y,p]),le=i(null);Eo(o,{variant:"geo-points",frameRef:le});const[se,ae]=u(null),ce=s(()=>{var e,t;const n=null===(t=null===(e=le.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ae(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);d(()=>{const e=requestAnimationFrame(ce);return()=>cancelAnimationFrame(e)},[ce,v,g,l.width,l.height,ee]);const ue=r(()=>{if(!$||!se)return[];const{maxCost:e}=se;if(0>=e)return[];if(Array.isArray($))return $.filter(t=>t>0&&e>=t);const t="number"==typeof $?$:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[$,se]),de=r(()=>{var n,o;if(!se)return Y.foregroundGraphics||null;const{cx:i,cy:r,maxCost:l,availableRadius:s}=se,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},R),c=null!==(n=te.margin.left)&&void 0!==n?n:10,u=null!==(o=te.margin.top)&&void 0!==o?o:10;return t("g",{children:[ue.map(n=>{const o=n/l*s;return t("g",{children:[e("circle",{cx:i+c,cy:r+u,r:o,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),t("text",{x:i+c+o+3,y:r+u-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif",children:[n,B?" "+B:""]})]},n)}),W&&t("g",{transform:`translate(${c+24}, ${u+24})`,children:[e("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),Y.foregroundGraphics]})},[se,ue,W,B,R,te.margin,Y.foregroundGraphics]);Co("DistanceCartogram",ee,"xAccessor",h),Co("DistanceCartogram",ee,"yAccessor",f);const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:b},null!=a&&{points:ee}),ie&&{lines:ie,lineDataAccessor:"coordinates"}),{xAccessor:h,yAccessor:f,pointIdAccessor:p,pointStyle:ne,projectionTransform:oe}),L&&{transition:{duration:L}}),null!=x&&{graticule:x}),null!=k&&{fitPadding:k}),J&&{zoomable:!0}),j&&{zoomExtent:j}),O&&{onZoom:O}),null!=M&&{dragRotate:M}),A&&{tileURL:A}),S&&{tileAttribution:S}),C&&{tileCacheSize:C}),{size:[l.width,l.height],margin:te.margin,enableHover:!0,tooltipContent:!1===I?()=>null:Qt(I)||re}),te.legendBehaviorProps),(H||F||q)&&{customHoverBehavior:te.customHoverBehavior}),(F||q)&&{customClickBehavior:te.customClickBehavior}),T&&T.length>0&&{annotations:T}),l.title&&{title:l.title}),l.description&&{description:l.description}),l.summary&&{summary:l.summary}),void 0!==l.accessibleTable&&{accessibleTable:l.accessibleTable}),E&&{className:E}),null!=n.animate&&{animate:n.animate}),Y),de&&{foregroundGraphics:de});return te.earlyReturn?te.earlyReturn:e(jo,{componentName:"DistanceCartogram",width:l.width,height:l.height,children:e(wn,Object.assign({ref:le},he))})});function Vo(e,t,n){const{featureKey:o,dataKey:i}=n,r=new Map;for(const e of t)r.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=null==n?void 0:n[e];return(null!=n?n:"")+""})(e),n=r.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})}Go.displayName="DistanceCartogram";export{To as ChoroplethMap,Go as DistanceCartogram,qo as FlowMap,_o as ProportionalSymbolMap,wn as StreamGeoFrame,Vo as mergeData,Ro as resolveReferenceGeography};