semiotic 3.5.3 → 3.5.4

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 (63) hide show
  1. package/CLAUDE.md +2 -2
  2. package/README.md +5 -5
  3. package/ai/componentMetadata.cjs +9 -2
  4. package/ai/dist/mcp-server.js +4 -1
  5. package/ai/examples.md +27 -0
  6. package/ai/schema.json +286 -41
  7. package/ai/system-prompt.md +1 -1
  8. package/dist/components/charts/index.d.ts +3 -3
  9. package/dist/components/charts/network/Treemap.d.ts +8 -0
  10. package/dist/components/charts/ordinal/GaugeChart.d.ts +10 -0
  11. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +22 -0
  12. package/dist/components/charts/shared/gaugeGradient.d.ts +62 -0
  13. package/dist/components/charts/shared/hooks.d.ts +2 -2
  14. package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -2
  15. package/dist/components/charts/shared/types.d.ts +11 -2
  16. package/dist/components/charts/shared/useChartSetup.d.ts +2 -2
  17. package/dist/components/charts/shared/useCustomChartSetup.d.ts +1 -1
  18. package/dist/components/charts/xy/AreaChart.d.ts +15 -0
  19. package/dist/components/semiotic-ai.d.ts +1 -1
  20. package/dist/components/semiotic-realtime.d.ts +3 -3
  21. package/dist/components/semiotic-server.d.ts +1 -0
  22. package/dist/components/semiotic-xy.d.ts +1 -1
  23. package/dist/components/semiotic.d.ts +5 -4
  24. package/dist/components/server/renderToStaticSVG.d.ts +2 -0
  25. package/dist/components/server/staticLegend.d.ts +35 -0
  26. package/dist/components/store/ThemeStore.d.ts +2 -0
  27. package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -1
  28. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -1
  29. package/dist/components/stream/SVGOverlay.d.ts +2 -1
  30. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  31. package/dist/components/stream/geoTypes.d.ts +2 -1
  32. package/dist/components/stream/hoverUtils.d.ts +1 -0
  33. package/dist/components/stream/legendRenderer.d.ts +2 -1
  34. package/dist/components/stream/networkTypes.d.ts +2 -1
  35. package/dist/components/stream/ordinalTypes.d.ts +16 -2
  36. package/dist/components/stream/renderers/wedgePathBuilder.d.ts +31 -0
  37. package/dist/components/stream/types.d.ts +2 -1
  38. package/dist/components/types/legendTypes.d.ts +15 -0
  39. package/dist/components/types/marginType.d.ts +17 -3
  40. package/dist/geo.min.js +1 -1
  41. package/dist/geo.module.min.js +1 -1
  42. package/dist/network.min.js +1 -1
  43. package/dist/network.module.min.js +1 -1
  44. package/dist/ordinal.min.js +1 -1
  45. package/dist/ordinal.module.min.js +1 -1
  46. package/dist/realtime.min.js +1 -1
  47. package/dist/realtime.module.min.js +1 -1
  48. package/dist/semiotic-ai.d.ts +1 -1
  49. package/dist/semiotic-ai.min.js +1 -1
  50. package/dist/semiotic-ai.module.min.js +1 -1
  51. package/dist/semiotic-realtime.d.ts +3 -3
  52. package/dist/semiotic-server.d.ts +1 -0
  53. package/dist/semiotic-utils.min.js +1 -1
  54. package/dist/semiotic-utils.module.min.js +1 -1
  55. package/dist/semiotic-xy.d.ts +1 -1
  56. package/dist/semiotic.d.ts +5 -4
  57. package/dist/semiotic.min.js +1 -1
  58. package/dist/semiotic.module.min.js +1 -1
  59. package/dist/server.min.js +1 -1
  60. package/dist/server.module.min.js +1 -1
  61. package/dist/xy.min.js +1 -1
  62. package/dist/xy.module.min.js +1 -1
  63. package/package.json +13 -21
@@ -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 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 N,curveStep as T,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){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.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 Ne=(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 Te({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:Ne(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(Te,{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:T,stepAfter:N,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,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function gt(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function yt(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function vt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function mt(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 bt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function xt(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 kt(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:N,svgAnnotationRules:T,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||bt,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=xt(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||bt,i=Math.max(2,Math.floor(u/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let l=xt((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||bt,i=Math.max(2,Math.floor(u/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return xt((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==N?void 0:N.length)&&void 0!==l?l:0),oe=null!==(s=null==N?void 0:N.length)&&void 0!==s?s:0;ne.current!==oe&&(ne.current=oe,te.current=new Map);const ie=r(()=>{if(!N||0===N.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,N,T,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!==(T=null===(N=i.scales)||void 0===N?void 0:N.y)&&void 0!==T?T: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=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,c=null===(te=i.scales)||void 0===te?void 0:te.y,u=l(s)?s:l(a)?a:l(c)?c:null;if(!u)return null;const d=u(r+"");if(null==d)return null;const h=u.bandwidth(),f=n.color||"var(--semiotic-primary, #4589ff)",p=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,g=n.label;return t("g",(i.projection?"vertical"===i.projection:u===a)?{children:[e("rect",{x:d,y:0,width:h,height:i.height||0,fill:f,fillOpacity:p}),g&&e("text",{x:d+h/2,y:12,textAnchor:"middle",fill:f,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e("rect",{x:0,y:d,width:i.width||0,height:h,fill:f,fillOpacity:p}),g&&e("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:f,fontSize:12,fontWeight:"bold",children:g})]},"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 N.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)},[N,T,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=vt(null===(n=null==v?void 0:v.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=vt(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 n=null==v?void 0:v.find(e=>"left"===e.orient),o=null==v?void 0:v.find(e=>"bottom"===e.orient),i=!n||!1!==n.baseline,r=!o||!1!==o.baseline,l=(null==n?void 0:n.jaggedBase)||!1,s=(null==o?void 0:o.jaggedBase)||!1,a=null==o?void 0:o.landmarkTicks,d=null==n?void 0:n.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",y=!!(null==o?void 0:o.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})(),k={fontSize:"var(--semiotic-tick-font-size, 10px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},j={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},O=null==o?void 0:o.tickAnchor,M=null==n?void 0:n.tickAnchor,A=yt(K),S=yt(J);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!U||Z)&&r&&!s&&e("line",{x1:0,y1:u,x2:c,y2:u,stroke:h,strokeWidth:1}),(!U||Z)&&s&&e("path",{d:mt("bottom",c,u),fill:"none",stroke:h,strokeWidth:1}),K.map((n,o)=>{const i=!!a&&("function"==typeof a?a(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:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:y?10:18,textAnchor:y?"end":pt(O,n.pixel===A.min,n.pixel===A.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),transform:y?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},k),children:n.label})})]},"xtick-"+o)}),m&&e("text",{x:c/2,y:u+40,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},j),children:m})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!U||Z)&&i&&!l&&e("line",{x1:0,y1:0,x2:0,y2:u,stroke:h,strokeWidth:1}),(!U||Z)&&l&&e("path",{d:mt("left",c,u),fill:"none",stroke:h,strokeWidth:1}),J.map((n,o)=>{const i=!!d&&("function"==typeof d?d(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:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:gt(M,n.pixel===S.min,n.pixel===S.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},k),children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-p.left,y:u/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-p.left}, ${u/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},j),children:t}):null})()]}),(()=>{const n=null==v?void 0:v.find(e=>"right"===e.orient);if(!n||0===ee.length)return null;const o=!1!==n.baseline,i=n.landmarkTicks,r=n.label||x,l=n.tickAnchor,s=yt(ee);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e("line",{x1:c,y1:0,x2:c,y2:u,stroke:h,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:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:gt(l,n.pixel===s.min,n.pixel===s.max),fontWeight:r?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?w:k),children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},k),children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:c+p.right-15,y:u/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${c+p.right-15}, ${u/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},j),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",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},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 wt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const jt="undefined"==typeof window||"undefined"==typeof document,Ot="undefined"!=typeof window?h:d,Mt=()=>()=>{},At=()=>!1,St=()=>!0;function Ct(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 Lt(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 zt(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 Pt=o.createContext(null),Dt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function It(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){const e=t.type+"";n[e]=(n[e]||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 $t=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Rt={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"},Wt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Bt={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)"},Nt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Tt={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)"},Et={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},_t={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Ht({scene:n,chartType:i,tableId:r,chartTitle:l}){var s;const[a,c]=o.useState(!1),u=o.useContext(Pt),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:Dt}):null;if(!h)return e("div",{id:r,tabIndex:-1,onFocus:g,style:Dt,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}: ${$t(e.min)} to ${$t(e.max)}, mean ${$t(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:Rt,role:"region","aria-label":p,children:[e("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Bt,children:"×"}),e("div",{role:"note",style:Wt,children:b}),t("table",{role:"table","aria-label":"Sample data for "+i,style:Nt,children:[t("caption",{style:_t,children:["First ",x.length," of ",v.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Tt,children:"type"}),w.map(t=>e("th",{style:Tt,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:Et,children:n.label}),w.map(t=>{return e("td",{style:Et,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":$t(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function Ft({summary:t}){return t?e("div",{role:"note",style:Dt,children:t}):null}function qt({tableId:t}){return e("a",{href:"#"+t,style:Dt,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,Dt)},children:"Skip to data table"})}function Gt({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:Dt,children:n})}const Vt=Object.freeze([]);function Ut(e){if(!e)return Vt;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 Zt="var(--semiotic-focus, #005fcc)";function Yt({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:Zt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:Zt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:Zt,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 Xt={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Qt(e,t){return"function"==typeof t?t(e):e[t]}function Kt(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 Jt(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=Qt(n,i);a=Kt(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=Qt(n,o);c.push({label:t,value:Kt(l,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){a=Kt(n[t],r);break}if(!a){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(a=Kt(n[e[0]],r))}}const u=Object.assign(Object.assign({},Xt),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 en(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:Xt,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Jt(t):Jt())}}function tn({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.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(s),y=g?null:Xt;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 nn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function on(e,t,n=.6){var o,i,r,l,s;if(!nn(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 rn(e,t,n,o=.35){nn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function ln(e){switch(e){case"monotoneX":return _;case"monotoneY":return E;case"cardinal":return R;case"catmullRom":return $;case"step":return T;case"stepBefore":return B;case"stepAfter":return N;case"basis":return W;case"natural":return F;default:return null}}function sn(e,t,n){return null==t?n:"string"!=typeof t?t:ze(e,t)||n}function an(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 cn(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 un(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 dn(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 hn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function fn([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function pn(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 gn{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 yn{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=vn(l),a=mn(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 vn(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 mn(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 bn={top:10,right:10,bottom:10,left:10},xn={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"},kn={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 wn(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function jn(e){return e?e.getContext("2d"):null}function On({data:n}){if(!n)return null;if(n.properties)return e("div",{className:"semiotic-tooltip",style:xn,children:e("div",{style:{fontWeight:600},children:n.properties.name||n.properties.NAME||n.properties.id||"Feature"})});const o=null!=n.data?n.data:n;if(!o||"object"!=typeof o)return null;const i=Object.entries(o).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return 0===i.length?null:e("div",{className:"semiotic-tooltip",style:xn,children:i.map(([n,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[n,": "]}),e("span",{style:{fontWeight:600},children:o+""})]},n))})}On.ownsChrome=!0;const Mn=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:N,dragRotate:T,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,Ne=Y||[X||600,Q||400],Te=i(!0),Ee=Ie({sizeProp:Ne,responsiveWidth:K,responsiveHeight:J,userMargin:ee,marginDefault:bn,foregroundGraphics:we,backgroundGraphics:ke,animate:be,transitionProp:me,themeDirtyRef:Te}),{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 Ot(()=>{t(!0)},[]),e}(),ot=function(){const e=a(Mt,At,St);return i(e).current}(),it=r(()=>Array.isArray(M)?Ut(M):M,[M]),rt=r(()=>Ut(A),[A]),lt=r(()=>Ut(S),[S]),st=r(()=>null!=T?T:"orthographic"===wn(k),[T,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 Lt(e,t);if(!zt(e)||!zt(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(!Lt(n,i))return!1}else{if(!zt(n)||!zt(i))return!1;if(!Ct(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 gn(G||256));const yt=i(ge),vt=i(null),mt=i(V),bt=i(!1),xt=i(null),Pt=s(e=>{xt.current=e,He&&"object"==typeof He&&(He.current=e)},[He]),Dt=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 yn(50*e)}const Bt=i(null),Nt=i(null),[Tt,Et]=u(null),[_t,Vt]=u(0),[Zt,Xt]=u(!1),Qt=i([]),Kt=i(Pe),Jt=i(De);Kt.current=Pe,Jt.current=De;const en=s(()=>{var e,t;const n=Kt.current,o=Jt.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),Te.current=!0,et()},[ct,et]),d(()=>{const e=ut.current;e&&(it&&e.setAreas(it),A&&e.setPoints(rt),S&&e.setLines(lt),Te.current=!0,et())},[it,A,rt,S,lt,et]);const nn=s(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=ut.current)||void 0===t||t.pushPoint(e),Te.current=!0,et())},[et]),vn=s(e=>{var t;const n=Ut(e);0!==n.length&&(null===(t=ut.current)||void 0===t||t.pushMany(n),Te.current=!0,et())},[et]),mn=s(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=ut.current)||void 0===t||t.pushLine(e),Te.current=!0,et())},[et]),xn=s(e=>{var t;const n=Ut(e);0!==n.length&&(null===(t=ut.current)||void 0===t||t.pushManyLines(n),Te.current=!0,et())},[et]),Mn=s(()=>{var e;null===(e=ut.current)||void 0===e||e.clear(),Te.current=!0,et()},[et]);p(o,()=>({push:nn,pushMany:vn,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&&(Te.current=!0,et()),o},pushLine:mn,pushManyLines:xn,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&&(Te.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:()=>mt.current.k,resetZoom:()=>{const e=xt.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:[]}}),[nn,vn,mn,xn,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,Nt.current=null,Et(null),null==fe||fe(null),void et();pt.current||(pt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const l=jn(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,Nt.current=e,Et(a),null==fe||fe(a),et()}else Bt.current&&(Bt.current=null,Nt.current=null,Et(null),null==fe||fe(null),et())}},[ae,Ge,Ve,qe,fe,et]),Ee.hoverLeaveRef.current=()=>{Bt.current=null,Nt.current=null,Et(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=jn(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,Nt.current=null,Et(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,Et(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(Te.current&&!f){const e={width:Ge,height:Ve},t=st?c.getRotation():null;c.computeScene(e);const n=mt.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),Te.current=!1,a.setAttribute("aria-label",It(c.scene,"Geographic chart")),en()}const g=hn();if(H&&gt.current){const t=dt.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=dn(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=hn();let h=!0;for(const t of u.tiles){const[o,i,r]=fn(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=pn(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=dn(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)}rn(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;un(e,s.path,u,d,v,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=ln(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=cn(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,N=cn(w+(z-w)*Math.min(R.t+1e-4,1),h,u);e.lineTo(W,B),A(),M(N,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 T=s.strokeGradient&&s.path.length>=2?an(e,s.strokeGradient,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(e.strokeStyle=T||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=sn(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=sn(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=sn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),on(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=dn(b,Fe,qe,g);if(e){e.clearRect(-qe.left,-qe.top,Fe[0],Fe[1]);const t=Nt.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof 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!==Zt&&Xt(e)}const x=ge!==yt.current;x&&(yt.current=ge),(Te.current||x)&&Vt(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;Ot(()=>{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:Te,renderFnRef:Je,cleanup:()=>{var e;return null===(e=gt.current)||void 0===e?void 0:e.clear()}}),d(()=>{Te.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,Te,et,Zt,Xt),d(()=>{if("production"!==process.env.NODE_ENV&&H){const e=wn(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=xt.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=mt.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),mt.current=V.scale(i);const l=ut.current;l&&(l.applyZoomScale(i,o),Te.current=!1,et(),(null===(r=l.scales)||void 0===r?void 0:r.projection)&&(null==N||N({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();Dt.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=Dt.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(!Dt.current)return;Dt.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==N||N({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;mt.current=t,bt.current=!0;const n=ut.current;n&&(n.applyZoomTransform(t,o),Te.current=!1,et())}).on("end",e=>{var t;mt.current=e.transform,bt.current=!1;const n=ut.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==N||N({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,N,et]);const $n=ae&&!1!==ce,Rn=$n&&Tt?de?de(Tt):e(On,{data:Tt}):null,Wn=Rn?e(tn,{x:Tt.x,y:Tt.y,containerWidth:Ge,containerHeight:Ve,margin:qe,className:"stream-frame-tooltip",zIndex:10,children:Rn}):null;if(jt||!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:Pt,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(Ft,{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:wt(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:wt(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(kt,{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:Pt,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(qt,{tableId:Qe}),Re&&e(Ht,{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(Ft,{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":It(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(Gt,{hoverPoint:Tt}),e(kt,{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:_t,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:Zt?"#dc3545":"#28a745",color:"white"}),children:Zt?"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=xt.current,n=vt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(Z(t),1.5)},style:kn,children:"+"}),e("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=xt.current,n=vt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(Z(t),1/1.5)},style:kn,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(Yt,{active:zn.current>=0,hoverPoint:Tt,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 An(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Sn(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Cn(e){const t=e.map(An),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Sn(e,n,o)}if(e>=1){const[e,o,i]=t[n];return Sn(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 Sn(Math.round(l+(c-l)*r),Math.round(s+(u-s)*r),Math.round(a+(d-a)*r))}}Mn.displayName="StreamGeoFrame";const Ln=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],zn=Cn(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Pn=Cn(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Dn=Cn(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),In=Cn(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),$n=Cn(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Rn=Cn(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Wn=Cn(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Bn=Cn(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Nn=Cn(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Tn=Cn(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),En=Cn(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),_n=Cn(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);Cn(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Cn(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Cn(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Cn(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Cn(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Cn(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Cn(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const Hn={category10:Ln,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:zn,reds:Pn,greens:Dn,oranges:In,purples:$n,viridis:Wn,plasma:Bn},Fn=Ln,qn=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Gn=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 Vn(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")||Gn.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Fn[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))%Fn.length]}function Un(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=Hn[n]||Hn.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:Fn;return S().domain(o).range(e).unknown("#999")}}function Zn(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 Yn=c(null);function Xn(){return l(Yn)}function Qn(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 Kn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Jn,eo]=he(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Kn(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=Kn(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}})}})),[to,no]=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 oo(e){const t=g(),n=e.clientId||t,{name:o}=e,i=eo(e=>e.selections.get(o)),l=eo(e=>e.setClause),a=eo(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(Qn(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 io(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:l}=oo({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 ro=c(!1),lo=c(null),so="undefined"==typeof window?d:h;function ao(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 co(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 uo(){return we(e=>e.theme)}o.createContext(void 0);const ho="#007bff";function fo(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 po(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 go(){var e;const t=uo(),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 yo({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=ao(t,n),v=oo({name:(null==e?void 0:e.name)||"__unused__"}),m=io({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=no(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=fo(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=po(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=fo(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=po(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 vo({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(ro),h=null!==l(lo),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(lo),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;so(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),so(()=>{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):qn[r%qn.length];return{label:i+"",color:s}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Vn,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),n=t=>null!=e[t];return v&&("right"===s&&!n("right")&&110>t.right?t.right=110:"left"===s&&!n("left")&&110>t.left?t.left=110:"top"===s&&!n("top")&&50>t.top?t.top=50:"bottom"===s&&!n("bottom")&&80>t.bottom&&(t.bottom=80)),t},[c,a,v,s]);return{legend:v,margin:m,legendPosition:s}}const mo={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 bo(e,t,n){var o,i,r,l,s,a,c;const u=mo[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:xo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function xo(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 ko(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 wo({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 jo 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(wo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Oo;const Mo="undefined"!=typeof process&&"production"!==(null===(Oo=process.env)||void 0===Oo?void 0:Oo.NODE_ENV);function Ao({componentName:t,width:n,height:o,children:i}){return e(jo,{fallback:i=>e(wo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const So={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Co={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Lo(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({},So),{width:n,height:o}),children:i||"No data available"}):null}function zo(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),l=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(l+s)-s))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Co),{position:"absolute",top:a+o*(l+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:l,opacity:.5+o%2*.2})},o))})}function Po(e,t,n,o){if(!Mo)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 Do(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 Io(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 $o(e){return e}function Ro(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 $o;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 Wo=new Map;function Bo(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function No(e){return Io(this,void 0,void 0,function*(){const t=Wo.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return Io(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:Bo(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Bo(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Bo(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Bo(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 Ro(e,t)})}:Ro(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return Wo.set(e,r),r})}function To(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),No(e).then(e=>{t||o(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),o(null)}else o(null)},[e]),void 0!==t?t:n}const Eo={blues:zn,reds:Pn,greens:Dn,viridis:Wn,oranges:In,purples:$n,greys:Rn,plasma:Bn,inferno:Nn,magma:Tn,cividis:En,turbo:_n};function _o(n){var o;const i=bo(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=uo();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,loadingContent:I,emptyContent:$,frameProps:R={},stroke:W,strokeWidth:B,opacity:N}=n,T=null!=f?f:!!v,E=To(s),_=r(()=>E?Ut(E):E,[E]),H=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]),F=null!==(o=null!=c?c:l)&&void 0!==o?o:"blues",q=r(()=>{if(!_)return C(zn).domain([0,1]);const e=_.map(e=>H(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=P(e);return C(Eo[F]||zn).domain([null!=t?t:0,null!=n?n:1])},[_,H,F]),{activeSelectionHook:G,customHoverBehavior:V,customClickBehavior:U}=yo({selection:M,linkedHover:A,onObservation:S,onClick:L,chartType:"ChoroplethMap",chartId:z}),Z=Do(M),Y=r(()=>{const e=ko(e=>{const t=H(e);return{fill:null!=t&&isFinite(t)?q(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}},{stroke:W,strokeWidth:B,opacity:N});return G?co(e,G,Z):e},[H,q,G,Z,k,W,B,N]),X=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=H(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},[H]),Q=r(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof j?{top:j,bottom:j,left:j,right:j}:j),[j]),K=zo(D,i.width,i.height,I)||(_?null:zo(!0,i.width,i.height,I)),J=K?null:Lo(_,i.width,i.height,$);if(Array.isArray(_)&&_.length>0){const t=_[0];if(!t||"object"!=typeof t||!t.geometry)return e(wo,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:i.width,height:i.height})}const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:u,areas:_,areaStyle:Y,size:[i.width,i.height],margin:Q,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?X:en(x)||X},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:V}),(S||L)&&{customClickBehavior:U}),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}),R);return K||J||e(Ao,{componentName:"ChoroplethMap",width:i.width,height:i.height,children:e(Mn,Object.assign({},ee))})}function Ho(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,loadingContent:j,emptyContent:O,width:M,height:A}=e,S=void 0===n,C=r(()=>Ut(t),[t]),[L,z]=u([]),P=s(e=>{z(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),D="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:I,hoverSelectionHook:$,customHoverBehavior:R,customClickBehavior:W,crosshairSourceId:B}=yo({selection:c,linkedHover:d,fallbackFields:h,unwrapData:f,onObservation:p,chartType:g,chartId:y,onClick:x,hoverHighlight:k,colorByField:D}),N=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,B),T=function(e,t,n){const o=Xn(),i=go();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=Un(n.map(e=>({_cat:e})),"_cat",l);return t=>o[t]||e(t)}return Un(n.map(e=>({_cat:e})),"_cat",l)}if(o&&Object.keys(o).length>0){const n=Un(e,t,l);return e=>o[e]||n(e)}return Un(e,t,l)}if(o&&Object.keys(o).length>0){const e=Un([{_:"a"}],"_",l);return t=>o[t]||e(t)}},[e,t,n,o,i])}(C,o,i),E=r(()=>{if(!o)return[];const e=new Set;for(const t of C){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[C,o]),_=r(()=>S&&L.length>0?L:E,[S,L,E]),H=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,_),F=r(()=>$||(H.legendSelectionHook?H.legendSelectionHook:I),[$,H.legendSelectionHook,I]),q=Do(c),G=go(),V=Xn(),U=r(()=>{if(T)return T;if(!o||0===_.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:G&&G.length>0?G:qn,t="__streamCat",n=Un(_.map(e=>({[t]:e})),t,e);return e=>(null==V?void 0:V[e])||n(e)||"#999"},[T,o,_,i,G,V]),{legend:Z,margin:Y,legendPosition:X}=vo({data:C,colorBy:o,colorScale:U,showLegend:v,legendPosition:a,userMargin:m,defaults:b,categories:_}),Q=r(()=>{const e={};return Z&&(e.legend=Z,e.legendPosition=X),l&&"none"!==l&&(e.legendHoverBehavior=H.onLegendHover,e.legendClickBehavior=H.onLegendClick,e.legendHighlightedCategory=H.highlightedCategory,e.legendIsolatedCategories=H.isolatedCategories),S&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=P),e},[Z,X,l,H.onLegendHover,H.onLegendClick,H.highlightedCategory,H.isolatedCategories,S,o,P]),K=Array.isArray(n)?Ut(n):n,J=zo(w,M,A,j),ee=J?null:Lo(K,M,A,O);return{data:C,colorScale:T,allCategories:_,legendState:H,effectiveSelectionHook:F,activeSelectionHook:I,customHoverBehavior:R,customClickBehavior:W,legend:Z,margin:Y,legendPosition:X,earlyReturn:J||ee||null,legendBehaviorProps:Q,crosshairProps:N,resolvedSelection:q}}function Fo(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:[])}_o.displayName="ChoroplethMap";const qo=f(function(n,o){const l=i(null);Fo(o,{variant:"geo-points",frameRef:l});const s=bo(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,loadingContent:B,emptyContent:N,legendInteraction:T,legendPosition:E,frameProps:_={},stroke:H,strokeWidth:F,opacity:q}=n,G=null!=m?m:!!w,V=To(M),U=Ho({data:null!=a?a:Vt,rawData:a,colorBy:f,colorScheme:p,legendInteraction:T,legendPosition:E,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,loadingContent:B,emptyContent:N,width:s.width,height:s.height}),Z=U.data,Y=r(()=>{if(!d)return;const e="function"==typeof d?d:e=>null==e?void 0:e[d],t=Z.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[Z,d]),X=r(()=>{const e=ko(e=>({fill:f?Vn(e,f,U.colorScale):ho,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:d?Zn(e,d,h,Y):6}),{stroke:H,strokeWidth:F,opacity:q});return U.effectiveSelectionHook?co(e,U.effectiveSelectionHook,U.resolvedSelection):e},[f,U.colorScale,U.effectiveSelectionHook,U.resolvedSelection,d,h,Y,H,F,q]),Q=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]);Po("ProportionalSymbolMap",Z,"xAccessor",c),Po("ProportionalSymbolMap",Z,"yAccessor",u);const K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:g},null!=a&&{points:Z}),{xAccessor:c,yAccessor:u,pointStyle:X}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),V&&{areas:V,areaStyle:A}),null!=y&&{graticule:y}),null!=v&&{fitPadding:v}),G&&{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:U.margin,enableHover:!0,tooltipContent:!1===S?()=>null:en(S)||Q}),U.legendBehaviorProps),(D||I||$)&&{customHoverBehavior:U.customHoverBehavior}),(I||$)&&{customClickBehavior:U.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}),_);return U.earlyReturn?U.earlyReturn:e(Ao,{componentName:"ProportionalSymbolMap",width:s.width,height:s.height,children:e(Mn,Object.assign({ref:l},K))})});qo.displayName="ProportionalSymbolMap";const Go="__semiotic_x",Vo="__semiotic_y",Uo=f(function(n,o){const l=bo(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:N,className:T,selection:E,linkedHover:_,onObservation:H,onClick:F,chartId:q,loading:G,loadingContent:V,emptyContent:U,frameProps:Z={},legendInteraction:Y,legendPosition:X,stroke:Q,strokeWidth:K,opacity:J,lineIdAccessor:ee}=n,te=null!=v?v:!!k,ne=To(S),oe=r(()=>Ut(c),[c]),ie=Ho({data:null!=a?a:Vt,rawData:a,colorBy:L,colorScheme:I,legendInteraction:Y,legendPosition:X,selection:E,linkedHover:_,fallbackFields:L?["string"==typeof L?L:""]:[],unwrapData:!1,onObservation:H,onClick:F,chartType:"FlowMap",chartId:q,showLegend:l.showLegend,userMargin:N,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:G,loadingContent:V,emptyContent:U,width:l.width,height:l.height}),re=ie.data,le=ao(_),se=io({name:(null==le?void 0:le.name)||"hover",fields:(null==le?void 0:le.fields)||[]}),ae=no(e=>e.pushObservation),ce=r(()=>{const e=new Map;for(const t of oe)e.set(t[u]+"",t);return e},[oe,u]),ue=i(null),de=i(ce);de.current=ce;const he=i(d);he.current=d;const fe=i(h);fe.current=h;const pe=s(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=de.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const i="function"==typeof he.current?he.current:e=>e[he.current],r="function"==typeof fe.current?fe.current:e=>e[fe.current];return Object.assign(Object.assign({},e),{coordinates:[{[Go]:i(n),[Vo]:r(n)},{[Go]:i(o),[Vo]:r(o)}]})},[]);Fo(o,{variant:"geo-lines",frameRef:ue,overrides:{push:e=>{var t;const n=pe(e);n&&(null===(t=ue.current)||void 0===t||t.pushLine(n))},pushMany:e=>{var t;const n=[];for(const t of e){const e=pe(t);e&&n.push(e)}n.length>0&&(null===(t=ue.current)||void 0===t||t.pushManyLines(n))}}});const ge=r(()=>{const e=new Map;for(const t of re)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},[re]),ye=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=ge.get(t[u]+"");e&&se.onHover(e)}else se.onHover(t)}else se.onHover(null);if(H||ae){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),ae&&ae(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});H&&H(e),ae&&ae(e)}}},[_,se,u,ge,H,q,ae]),ve=ie.customClickBehavior,me=r(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof h?h:e=>e[h];return re.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ce.get(n.source+""),i=ce.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[Go]:e(o),[Vo]:t(o)},{[Go]:e(i),[Vo]:t(i)}]}):null}).filter(Boolean)},[re,ce,d,h]),be=r(()=>{const e="function"==typeof d?d:e=>e[d];return t=>null!=t&&"object"==typeof t&&Go in t?t[Go]:e(t)},[d]),xe=r(()=>{const e="function"==typeof h?h:e=>e[h];return t=>null!=t&&"object"==typeof t&&Vo in t?t[Vo]:e(t)},[h]),ke=r(()=>{const e=re.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)},[re,f,P]),we=r(()=>e=>{var t;return{stroke:L?Vn(e,L,ie.colorScale):ho,strokeWidth:ke(null!==(t=e[f])&&void 0!==t?t:0),strokeLinecap:D,opacity:z}},[L,ie.colorScale,ke,f,z,D]),je=r(()=>{var e;const t=ko(we,{stroke:Q,strokeWidth:K,opacity:J});if(!ie.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=ie.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return co(t,ie.effectiveSelectionHook,Object.assign(Object.assign({},ie.resolvedSelection||{}),{unselectedStyle:n}))},[we,ie.effectiveSelectionHook,ie.resolvedSelection,Q,K,J]),Oe=r(()=>ko(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:Q,strokeWidth:K,opacity:J}),[Q,K,J]),Me=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]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:me}),{points:oe,xAccessor:be,yAccessor:xe,lineDataAccessor:"coordinates"}),null!=ee&&{lineIdAccessor:ee}),{lineType:O,flowStyle:M,lineStyle:je,pointStyle:Oe}),ne&&{areas:ne,areaStyle:C}),null!=g&&{graticule:g}),null!=y&&{fitPadding:y}),te&&{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:ie.margin,enableHover:!0,tooltipContent:!1===W?()=>null:en(W)||Me}),ie.legendBehaviorProps),(_||H||F)&&{customHoverBehavior:ye}),(H||F)&&{customClickBehavior:ve}),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}),T&&{className:T}),null!=n.animate&&{animate:n.animate}),Z);return ie.earlyReturn?ie.earlyReturn:e(Ao,{componentName:"FlowMap",width:l.width,height:l.height,children:e(Mn,Object.assign({ref:ue},Ae))})});Uo.displayName="FlowMap";const Zo=f(function(n,o){const l=bo(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:N,margin:T,className:E,selection:_,linkedHover:H,onObservation:F,onClick:q,chartId:G,loading:V,loadingContent:U,emptyContent:Z,legendPosition:Y,frameProps:X={},stroke:Q,strokeWidth:K,opacity:J}=n,ee=null!=w?w:!!A,te=r(()=>Ut(a),[a]),ne=Ho({data:te,rawData:a,colorBy:z,colorScheme:P,legendInteraction:void 0,legendPosition:Y,selection:_,linkedHover:H,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!1,onObservation:F,onClick:q,chartType:"DistanceCartogram",chartId:G,showLegend:l.showLegend,userMargin:T,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:V,loadingContent:U,emptyContent:Z,width:l.width,height:l.height}),oe=r(()=>{const e=ko(e=>({fill:z?Vn(e,z,ne.colorScale):ho,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:D}),{stroke:Q,strokeWidth:K,opacity:J});return ne.effectiveSelectionHook?co(e,ne.effectiveSelectionHook,ne.resolvedSelection):e},[z,ne.colorScale,ne.effectiveSelectionHook,ne.resolvedSelection,D,Q,K,J]),ie=r(()=>({center:g,centerAccessor:p,costAccessor:y,strength:v,lineMode:m}),[g,p,y,v,m]),re=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 te)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,te,h,f,p]),le=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]),se=i(null);Fo(o,{variant:"geo-points",frameRef:se});const[ae,ce]=u(null),ue=s(()=>{var e,t;const n=null===(t=null===(e=se.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ce(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);d(()=>{const e=requestAnimationFrame(ue);return()=>cancelAnimationFrame(e)},[ue,v,g,l.width,l.height,te]);const de=r(()=>{if(!$||!ae)return[];const{maxCost:e}=ae;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},[$,ae]),he=r(()=>{var n,o;if(!ae)return X.foregroundGraphics||null;const{cx:i,cy:r,maxCost:l,availableRadius:s}=ae,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},R),c=null!==(n=ne.margin.left)&&void 0!==n?n:10,u=null!==(o=ne.margin.top)&&void 0!==o?o:10;return t("g",{children:[de.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})]}),X.foregroundGraphics]})},[ae,de,W,B,R,ne.margin,X.foregroundGraphics]);Po("DistanceCartogram",te,"xAccessor",h),Po("DistanceCartogram",te,"yAccessor",f);const fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:b},null!=a&&{points:te}),re&&{lines:re,lineDataAccessor:"coordinates"}),{xAccessor:h,yAccessor:f,pointIdAccessor:p,pointStyle:oe,projectionTransform:ie}),L&&{transition:{duration:L}}),null!=x&&{graticule:x}),null!=k&&{fitPadding:k}),ee&&{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:ne.margin,enableHover:!0,tooltipContent:!1===I?()=>null:en(I)||le}),ne.legendBehaviorProps),(H||F||q)&&{customHoverBehavior:ne.customHoverBehavior}),(F||q)&&{customClickBehavior:ne.customClickBehavior}),N&&N.length>0&&{annotations:N}),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}),X),he&&{foregroundGraphics:he});return ne.earlyReturn?ne.earlyReturn:e(Ao,{componentName:"DistanceCartogram",width:l.width,height:l.height,children:e(Mn,Object.assign({ref:se},fe))})});function Yo(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})}Zo.displayName="DistanceCartogram";export{_o as ChoroplethMap,Zo as DistanceCartogram,Uo as FlowMap,qo as ProportionalSymbolMap,Mn as StreamGeoFrame,Yo as mergeData,No 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 m,geoDistance as v,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 W,curveBasis as R,curveStepBefore as B,curveStepAfter as N,curveStep as T,curveMonotoneY as E,curveMonotoneX as _,curveLinear as H,curveNatural as F,line as G}from"d3-shape";import q 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=m();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=v(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&&v([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,m=t.height/2,v=y-c.x,b=m-c.y;if(Math.abs(v)>.5||Math.abs(b)>.5)for(const e of r)e.x+=v,e.y+=b;this.cartogramLayout={cx:y,cy:m,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"],me={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}},ve={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 me;if("dark"===t)return ve;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?ve:me;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:me,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){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.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:m,introEnabled:v}=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:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:j,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:L}}const $e={fill:(t,n)=>e("rect",{style:t,width:n,height:n}),line:(t,n)=>e("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function We(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,$e[n])(o(e,t),i),r}function Re({swatchSize:t}){return e("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,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 Ne=(n,o,i,r,l,s,a,c,u,d,h)=>{const{type:f="fill",styleFn:p,items:g}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===d||void 0===d&&null!=l,{swatchSize:x,labelGap:k,rowHeight:w}=h;return g.forEach((n,d)=>{const h=We(n,d,f,p,x),j=Be(n,r,l),O=l&&l.size>0&&l.has(n.label);y.push(t("g",{transform:`translate(0,${m})`,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&&b?O||!1:void 0,"aria-current":v&&!b&&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)+g.length)%g.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),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:j,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+k+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,O&&e(Re,{swatchSize:x}),e("text",{y:x/2,x:x+k,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=w}),y};function Te({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",legendLayout:p}=n,g=function(e){var t,n,o,i,r;const l=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),s=Math.max(l,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:l,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:s,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(p),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),k="vertical"===f?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,p)=>{h+=5,f.push(e("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+p)),h+=8,t.label&&(h+=16,f.push(e("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+p)),h+=8),f.push(e("g",{className:"legend-item",transform:`translate(0,${h})`,children:Ne(t,o,i,r,l,s,a,p,c,u,d)},"legend-group-"+p)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:g}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h,metrics:f})=>{var p;let g=0;const y=[];n.forEach((n,o)=>{var p;let m=0;n.label&&(m+=16);const v=((n,o,i,r,l,s,a,c,u,d,h,f)=>{const{type:p="fill",styleFn:g,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:k,align:w}=h,j=!(!o&&!i),O="isolate"===d||void 0===d&&null!=l,M=y.map(e=>v+b+7*e.label.length),A=[];let S=0,C=0;M.forEach((e,t)=>{const n=0===C?e:C+x+e;f&&f>0&&C>0&&n>f?(A.push({start:S,end:t,width:C}),S=t,C=e):C=n}),y.length>0&&A.push({start:S,end:y.length,width:C}),A.forEach((n,d)=>{let h="center"===w?Math.max(0,((null!=f?f:n.width)-n.width)/2):"end"===w?Math.max(0,(null!=f?f:n.width)-n.width):0;for(let f=n.start;n.end>f;f++){const n=y[f],w=We(n,f,p,g,v),A=Be(n,r,l),S=l&&l.size>0&&l.has(n.label);m.push(t("g",{transform:`translate(${h},${d*k})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:j?c===s&&f===a?0:-1:void 0,role:j?"option":void 0,"aria-selected":j&&O?S||!1:void 0,"aria-current":j&&!O&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:j?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(f+("ArrowRight"===e.key?1:-1)+y.length)%y.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:j?e=>{u(c,f),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:j?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:j?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[j&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,S&&e(Re,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+f)),h+=M[f]+x}});const L=Math.max(0,...A.map(e=>e.width)),z=A.length;return{items:m,offset:L,totalRows:z,totalHeight:z*k}})(n,r,l,s,a,c,u,o,d,h,f,null!==(p=f.maxWidth)&&void 0!==p?p:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),g+=m+12});const m=null!==(p=f.maxWidth)&&void 0!==p?p:i;let v=g>m?0:"center"===f.align?Math.max(0,(m-g)/2):"end"===f.align?Math.max(0,m-g):0;const b=[];return y.forEach((t,i)=>{const r=n[i];r.label&&(b.push(e("text",{transform:`translate(${v},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)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,n[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:g}),w=!(!r&&!l);return t("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"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}),k]})}function _e(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function He(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:l,legendPosition:s="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:p}=t;if(!o)return null;const g="top"===s||"bottom"===s,y=!!c,m=Math.max(1,g?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,i-l.left-l.right):100);let v,b;return"left"===s?(v=Math.max(4,l.left-m-10),b=l.top):"top"===s?(v=l.left,b=y?32:8):"bottom"===s?(v=l.left,b=r-l.bottom+38):(v=i-l.right+10,b=l.top),e("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e(Te,{config:o.gradient,orientation:g?"horizontal":"vertical",width:m}):_e(o)?e(Ee,{legendGroups:o.legendGroups,title:"",width:m,orientation:g?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:p}):o)});var x}function Fe(e){return"string"==typeof e?{type:e}:e}function Ge({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),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:v+m*(g+p/2),x2:y,y2:v+m*(g+p/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:v+m*g,x2:u,y2:v+m*(g+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*g,x2:y,y2:v+m*(g+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-g-p:v+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?v-g-p:v+g,x2:r,y2:"top"===n?v-g:v+g+p,stroke:c.fill,strokeWidth:2})]})}{const o=l(s),i=l(d),r=l(a),u=l(h),y=l(f),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(g+p/2),y1:u,x2:v+m*(g+p/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*g,y1:u,x2:v+m*(g+p),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*g,y1:y,x2:v+m*(g+p),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-g-p:v+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?v-g-p:v+g,y1:r,x2:"left"===n?v-g:v+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 qe(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]:qe(s,u):[],m=l?d?[l]:qe(l,u):[],v="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:v,dy:0===n?0:g,children:t},n))},"annotation-note-title")),b=y.length*g),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:p,y:b,children:m.map((t,n)=>e("tspan",{x:v,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+m.length)*g+(m.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+m.length-1)*g;let O=0;return"topBottom"===h?O=0>i?-(j+2):18:"leftRight"===h&&(O="middle"===f?-(j+g+(m.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,m=new Set(Array.isArray(p)?p:[]);let v=i||0,b=r||0;null!=l&&(v=l-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=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;v=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:[!m.has("connector")&&Ye(v,b,c,h,x,u),!m.has("subject")&&Ze(x,u,h,n,o),!m.has("note")&&Ue(a,v,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:T,stepAfter:N,stepBefore:B,basis:R,cardinal:W,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,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function gt(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function yt(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function mt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function vt(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 bt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function xt(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 kt(o){var l,s;const{width:c,height:u,totalWidth:h,totalHeight:f,margin:p,scales:g,showAxes:y,axes:m,xLabel:v,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",legendLayout:$,foregroundGraphics:W,marginalGraphics:R,xValues:B,yValues:N,annotations:T,svgAnnotationRules:E,xAccessor:_,yAccessor:F,annotationData:G,pointNodes:V,curve:U,underlayRendered:Z,canvasObscuresUnderlay:Y=!0,linkedCrosshairName:X,linkedCrosshairSourceId:Q,children:K}=o,J=r(()=>{var e,t;if(!y||!g)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||k||bt,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=xt(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,m,k,c,j]),ee=r(()=>{var e,t;if(!y||!g)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||w||bt,i=Math.max(2,Math.floor(u/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let l=xt((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,m,w,u,j]),te=r(()=>{var e,t;if(!y||!g)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||w||bt,i=Math.max(2,Math.floor(u/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return xt((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,m,w,u,j]),ne=i(new Map),oe=i(null!==(l=null==T?void 0:T.length)&&void 0!==l?l:0),ie=null!==(s=null==T?void 0:T.length)&&void 0!==s?s:0;oe.current!==ie&&(oe.current=ie,ne.current=new Map);const re=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,m,v,b,x,k,w,j,O,M,A,S,C,L,z,P,$,W,R,B,N,T,E,_,F,G,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,m=g?f:null,v=g?p:null;let b;const x=[],k=new Map;if(g&&m&&v){for(const e of h){const t=e[m];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[m],n=e[v];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?q.polynomial(b,{order:n.order||2}):q.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!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v: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",m=null!==(P=n.fillOpacity)&&void 0!==P?P:.1,v=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:m}),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:v,fillOpacity:.7,stroke:v,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!==(R=null===(W=i.scales)||void 0===W?void 0:W.x)&&void 0!==R?R:null===(B=i.scales)||void 0===B?void 0:B.time,c=null!==(T=null===(N=i.scales)||void 0===N?void 0:N.y)&&void 0!==T?T: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=q.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,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),m=null!==(_=n.confidence)&&void 0!==_?_:.95,v=.99>m?.95>m?.9>m?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))*v;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!==(G=n.fillOpacity)&&void 0!==G?G:.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=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,c=null===(te=i.scales)||void 0===te?void 0:te.y,u=l(s)?s:l(a)?a:l(c)?c:null;if(!u)return null;const d=u(r+"");if(null==d)return null;const h=u.bandwidth(),f=n.color||"var(--semiotic-primary, #4589ff)",p=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,g=n.label;return t("g",(i.projection?"vertical"===i.projection:u===a)?{children:[e("rect",{x:d,y:0,width:h,height:i.height||0,fill:f,fillOpacity:p}),g&&e("text",{x:d+h/2,y:12,textAnchor:"middle",fill:f,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e("rect",{x:0,y:d,width:i.width||0,height:h,fill:f,fillOpacity:p}),g&&e("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:f,fontSize:12,fontWeight:"bold",children:g})]},"ann-"+o)}default:return null}},o={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:_,yAccessor:F,width:c,height:u,data:G,frameType:"xy",pointNodes:V,curve:U,stickyPositionCache:ne.current};return T.map((e,t)=>{if(E){const i=E(e,t,o);return null!=i?i:n(e,t,o)}return n(e,t,o)}).filter(Boolean)},[T,E,c,u,_,F,G,g,V,U]),le=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}(X);return d(()=>{if(!(null==le?void 0:le.locked)||!X)return;const e=e=>{"Escape"===e.key&&st(X)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==le?void 0:le.locked,X]),y||M||A||W||R||re&&re.length>0||O||K||le?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&&(!Z||Y)&&(()=>{var n,o;const i=mt(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=mt(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[J.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)),ee.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 n=null==m?void 0:m.find(e=>"left"===e.orient),o=null==m?void 0:m.find(e=>"bottom"===e.orient),i=!n||!1!==n.baseline,r=!o||!1!==o.baseline,l=(null==n?void 0:n.jaggedBase)||!1,s=(null==o?void 0:o.jaggedBase)||!1,a=null==o?void 0:o.landmarkTicks,d=null==n?void 0:n.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",y=!!(null==o?void 0:o.autoRotate)&&J.length>1&&(()=>{const e=c/Math.max(J.length-1,1);return J.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),k={fontSize:"var(--semiotic-tick-font-size, 10px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},j={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},O=null==o?void 0:o.tickAnchor,M=null==n?void 0:n.tickAnchor,A=yt(J),S=yt(ee);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!Z||Y)&&r&&!s&&e("line",{x1:0,y1:u,x2:c,y2:u,stroke:h,strokeWidth:1}),(!Z||Y)&&s&&e("path",{d:vt("bottom",c,u),fill:"none",stroke:h,strokeWidth:1}),J.map((n,o)=>{const i=!!a&&("function"==typeof a?a(n.value,o):ce(n.value,o>0?J[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${u})`,children:[e("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:y?10:18,textAnchor:y?"end":pt(O,n.pixel===A.min,n.pixel===A.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),transform:y?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},k),children:n.label})})]},"xtick-"+o)}),v&&e("text",{x:c/2,y:u+40,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},j),children:v})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!Z||Y)&&i&&!l&&e("line",{x1:0,y1:0,x2:0,y2:u,stroke:h,strokeWidth:1}),(!Z||Y)&&l&&e("path",{d:vt("left",c,u),fill:"none",stroke:h,strokeWidth:1}),ee.map((n,o)=>{const i=!!d&&("function"==typeof d?d(n.value,o):ce(n.value,o>0?ee[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:gt(M,n.pixel===S.min,n.pixel===S.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},k),children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-p.left,y:u/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-p.left}, ${u/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},j),children:t}):null})()]}),(()=>{const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n||0===te.length)return null;const o=!1!==n.baseline,i=n.landmarkTicks,r=n.label||x,l=n.tickAnchor,s=yt(te);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e("line",{x1:c,y1:0,x2:c,y2:u,stroke:h,strokeWidth:1}),te.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):ce(n.value,o>0?te[o-1].value:void 0));return t("g",{transform:`translate(${c},${n.pixel})`,children:[e("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:gt(l,n.pixel===s.min,n.pixel===s.max),fontWeight:r?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?w:k),children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},k),children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:c+p.right-15,y:u/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${c+p.right-15}, ${u/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},j),children:r})]})})()]})})(),re,R&&g&&B&&N&&t(n,{children:[R.top&&e("g",{transform:"translate(0, 0)",children:e(Ge,{orient:"top",config:Fe(R.top),values:B,scale:g.x,size:p.top,length:c})}),R.bottom&&e("g",{transform:`translate(0, ${u})`,children:e(Ge,{orient:"bottom",config:Fe(R.bottom),values:B,scale:g.x,size:p.bottom,length:c})}),R.left&&e("g",{transform:"translate(0, 0)",children:e(Ge,{orient:"left",config:Fe(R.left),values:N,scale:g.y,size:p.left,length:u})}),R.right&&e("g",{transform:`translate(${c}, 0)`,children:e(Ge,{orient:"right",config:Fe(R.right),values:N,scale:g.y,size:p.right,length:u})})]}),W,le&&le.sourceId!==Q&&(null==g?void 0:g.x)&&(()=>{const t=g.x(le.xValue);if(null==t||0>t||t>c)return null;const n=le.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"})})(),K]}),M&&e("text",{x:h/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof M?M:null}),He({legend:A,totalWidth:h,totalHeight:f,margin:p,legendPosition:P,title:M,legendLayout:$,legendHoverBehavior:S,legendClickBehavior:C,legendHighlightedCategory:L,legendIsolatedCategories:z})]}):null}function wt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const jt="undefined"==typeof window||"undefined"==typeof document,Ot="undefined"!=typeof window?h:d,Mt=()=>()=>{},At=()=>!1,St=()=>!0;function Ct(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 Lt(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 zt(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 Pt=o.createContext(null),Dt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function It(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";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 $t=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Wt="semiotic-accessible-data-table",Rt=Wt+" semiotic-accessible-data-table-hidden",Bt=Wt+" semiotic-accessible-data-table-visible",Nt={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, 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-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Tt={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Et={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, 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"},Ht={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Ft={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Gt={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function qt({scene:n,chartType:i,tableId:r,chartTitle:l}){var s;const[a,c]=o.useState(!1),u=o.useContext(Pt),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:Dt}):null;if(!h)return e("div",{id:r,className:Rt,tabIndex:-1,onFocus:g,style:Dt,role:"region","aria-label":p,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,l,s,a,c,u,d,h,f,p,g,y,m,v,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&&null!==S.datum)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!==(m=S.cx)&&void 0!==m?m:S.x,y:null!==(v=S.cy)&&void 0!==v?v: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),v=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}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${$t(e.min)} to ${$t(e.max)}, mean ${$t(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,v),x=m.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,className:Bt,tabIndex:-1,onBlur:y,style:Nt,role:"region","aria-label":p,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Et,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Tt,children:b}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:_t,children:[t("caption",{className:"semiotic-accessible-data-table-caption",style:Gt,children:["First ",x.length," of ",m.length," data points"]}),e("thead",{children:t("tr",{children:[e("th",{style:Ht,children:"type"}),w.map(t=>e("th",{style:Ht,children:t},t))]})}),e("tbody",{children:x.map((n,o)=>t("tr",{children:[e("td",{style:Ft,children:n.label}),w.map(t=>{return e("td",{style:Ft,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":$t(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]})]})}function Vt({summary:t}){return t?e("div",{role:"note",style:Dt,children:t}):null}function Ut({tableId:t}){return e("a",{href:"#"+t,style:Dt,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,Dt)},children:"Skip to data table"})}function Zt({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:Dt,children:n})}const Yt=Object.freeze([]);function Xt(e){if(!e)return Yt;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 Kt({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})}const Jt={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 en(e,t){return"function"==typeof t?t(e):e[t]}function tn(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 nn(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=en(n,i);a=tn(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=en(n,o);c.push({label:t,value:tn(l,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){a=tn(n[t],r);break}if(!a){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(a=tn(n[e[0]],r))}}const u=Object.assign(Object.assign({},Jt),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 on(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=(r=!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,Array.isArray(r)?r[0]:r);var r;const l=n(i);return null==l?null:e("div",{className:"semiotic-tooltip",style:Jt,children:l})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?nn(t):nn())}}function rn({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.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(s),y=g?null:Jt;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 ln(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function sn(e,t,n=.6){var o,i,r,l,s;if(!ln(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 an(e,t,n,o=.35){ln(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function cn(e){switch(e){case"monotoneX":return _;case"monotoneY":return E;case"cardinal":return W;case"catmullRom":return $;case"step":return T;case"stepBefore":return B;case"stepAfter":return N;case"basis":return R;case"natural":return F;default:return null}}function un(e,t,n){return null==t?n:"string"!=typeof t?t:ze(e,t)||n}function dn(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 hn(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 fn(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 pn(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 gn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function yn([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function mn(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 vn{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 bn{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=xn(l),a=kn(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 xn(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 kn(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 wn={top:10,right:10,bottom:10,left:10},jn={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"},On={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function Mn(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function An(e){return e?e.getContext("2d"):null}function Sn({data:n}){if(!n)return null;if(n.properties)return e("div",{className:"semiotic-tooltip",style:jn,children:e("div",{style:{fontWeight:600},children:n.properties.name||n.properties.NAME||n.properties.id||"Feature"})});const o=null!=n.data?n.data:n;if(!o||"object"!=typeof o)return null;const i=Object.entries(o).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return 0===i.length?null:e("div",{className:"semiotic-tooltip",style:jn,children:i.map(([n,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[n,": "]}),e("span",{style:{fontWeight:600},children:o+""})]},n))})}Sn.ownsChrome=!0;const Cn=f(function(n,o){var l,c,h,f,g,y,m,v,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:W,zoomable:R,zoomExtent:B,onZoom:N,dragRotate:T,showParticles:E,particleStyle:_,tileURL:H,tileAttribution:F,tileCacheSize:q,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:me,transition:ve,animate:be,staleness:xe,backgroundGraphics:ke,foregroundGraphics:we,title:je,legend:Oe,legendPosition:Me,legendLayout:Ae,legendHoverBehavior:Se,legendClickBehavior:Ce,legendHighlightedCategory:Le,legendIsolatedCategories:Pe,legendCategoryAccessor:De,onCategoriesChange:$e,showAxes:We,accessibleTable:Re=!0,description:Be,summary:Ne}=n,Te=Y||[X||600,Q||400],Ee=i(!0),_e=Ie({sizeProp:Te,responsiveWidth:K,responsiveHeight:J,userMargin:ee,marginDefault:wn,foregroundGraphics:we,backgroundGraphics:ke,animate:be,transitionProp:ve,themeDirtyRef:Ee}),{reducedMotionRef:He,responsiveRef:Fe,size:Ge,margin:qe,adjustedWidth:Ve,adjustedHeight:Ue,resolvedForeground:Ze,resolvedBackground:Ye,transition:Xe,introEnabled:Qe,tableId:Ke,rafRef:Je,renderFnRef:et,scheduleRender:tt,currentTheme:nt}=_e,ot=function(){const[e,t]=u(!1);return Ot(()=>{t(!0)},[]),e}(),it=function(){const e=a(Mt,At,St);return i(e).current}(),rt=r(()=>Array.isArray(M)?Xt(M):M,[M]),lt=r(()=>Xt(A),[A]),st=r(()=>Xt(S),[S]),at=r(()=>null!=T?T:"orthographic"===Mn(k),[T,k]),ct=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(nt),themeSequential:null===(e=null==nt?void 0:nt.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==nt?void 0:nt.colors)||void 0===t?void 0:t.diverging,graticule:W,projectionTransform:O,decay:ye,pulse:me,transition:Xe,introAnimation:Qe,annotations:ge,pointIdAccessor:P,lineIdAccessor:D}},[k,w,j,C,L,z,I,$,oe,ie,re,se,W,O,ye,me,null==Xe?void 0:Xe.duration,null==Xe?void 0:Xe.easing,Qe,ge,P,D,nt]),ut=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 Lt(e,t);if(!zt(e)||!zt(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(!Lt(n,i))return!1}else{if(!zt(n)||!zt(i))return!1;if(!Ct(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(ct),dt=i(null);dt.current||(dt.current=new le(ut));const ht=i(null),ft=i(null),pt=i(null),gt=i(null),yt=i(null);H&&!yt.current&&(yt.current=new vn(q||256));const mt=i(ge),vt=i(null),bt=i(V),xt=i(!1),Pt=i(null),Dt=s(e=>{Pt.current=e,Fe&&"object"==typeof Fe&&(Fe.current=e)},[Fe]),$t=i(null),Wt=i(null),Rt=i(null),Bt=i(0);if(E&&!Rt.current){const e=null!==(l=null==_?void 0:_.maxPerLine)&&void 0!==l?l:30;Rt.current=new bn(50*e)}const Nt=i(null),Tt=i(null),[Et,_t]=u(null),[Ht,Ft]=u(0),[Gt,Yt]=u(!1),Qt=i([]),Jt=i(De),en=i($e);Jt.current=De,en.current=$e;const tn=s(()=>{var e,t;const n=Jt.current,o=en.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=dt.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=dt.current)||void 0===e||e.updateConfig(ut),Ee.current=!0,tt()},[ut,tt]),d(()=>{const e=dt.current;e&&(rt&&e.setAreas(rt),A&&e.setPoints(lt),S&&e.setLines(st),Ee.current=!0,tt())},[rt,A,lt,S,st,tt]);const nn=s(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=dt.current)||void 0===t||t.pushPoint(e),Ee.current=!0,tt())},[tt]),on=s(e=>{var t;const n=Xt(e);0!==n.length&&(null===(t=dt.current)||void 0===t||t.pushMany(n),Ee.current=!0,tt())},[tt]),ln=s(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=dt.current)||void 0===t||t.pushLine(e),Ee.current=!0,tt())},[tt]),xn=s(e=>{var t;const n=Xt(e);0!==n.length&&(null===(t=dt.current)||void 0===t||t.pushManyLines(n),Ee.current=!0,tt())},[tt]),kn=s(()=>{var e;null===(e=dt.current)||void 0===e||e.clear(),Ee.current=!0,tt()},[tt]);p(o,()=>({push:nn,pushMany:on,removePoint:e=>{var t,n;const o=null!==(n=null===(t=dt.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Ee.current=!0,tt()),o},pushLine:ln,pushManyLines:xn,removeLine:e=>{var t,n;const o=null!==(n=null===(t=dt.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[];return o.length>0&&(Ee.current=!0,tt()),o},getLines:()=>{var e,t;return null!==(t=null===(e=dt.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]},clear:kn,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=dt.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=dt.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=dt.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>bt.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=dt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[nn,on,ln,xn,kn,tt]);const{hoverHandlerRef:jn,onPointerMove:Cn,onPointerLeave:Ln}=_e;d(()=>{jn.current=e=>{if(!ae)return;const t=dt.current;if(!t||!t.scene.length)return;const n=ft.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>Ve||0>r||r>Ue)return Nt.current=null,Tt.current=null,_t(null),null==fe||fe(null),void tt();gt.current||(gt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const l=An(gt.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});Nt.current=a,Tt.current=e,_t(a),null==fe||fe(a),tt()}else Nt.current&&(Nt.current=null,Tt.current=null,_t(null),null==fe||fe(null),tt())}},[ae,Ve,Ue,qe,fe,tt]),_e.hoverLeaveRef.current=()=>{Nt.current=null,Tt.current=null,_t(null),null==fe||fe(null),tt()};const zn=s(e=>{if(!he)return;const t=dt.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;gt.current||(gt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=An(gt.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]),Pn=i(-1),Dn=i(null),In=s(e=>{const t=dt.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=Pn.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 Pn.current=-1,Dn.current=null,Nt.current=null,Tt.current=null,_t(null),null==fe||fe(null),void tt();const r=0>o?0:i;Pn.current=r;const l=n[r];Dn.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});Nt.current=a,_t(a),null==fe||fe(a),tt()},[fe,tt]),$n=s(e=>{Pn.current=-1,Dn.current=null,Cn(e)},[Cn]);et.current=()=>{var e,t,n,o,i,r,l,s;Je.current=0;const a=ft.current,c=dt.current;if(!a||!c)return;const u=performance.now();let d=!1;const h=Wt.current;h&&(Wt.current=null,c.applyRotation(h,{width:Ve,height:Ue}));const f=c.advanceTransition(He.current?u+1e6:u),p=!He.current&&f;if(Ee.current&&!f){const e={width:Ve,height:Ue},t=at?c.getRotation():null;c.computeScene(e);const n=bt.current,o=1!==n.k||0!==n.x||0!==n.y;at&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),Ee.current=!1,a.setAttribute("aria-label",It(c.scene,"Geographic chart")),tn()}const g=gn();if(H&&yt.current){const t=ht.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=pn(t,Ge,qe,g);if(e){e.clearRect(-qe.left,-qe.top,Ge[0],Ge[1]),e.save(),e.beginPath(),e.rect(0,0,Ve,Ue),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=gn();let h=!0;for(const t of u.tiles){const[o,i,r]=yn(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=mn(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:Ve,height:Ue,tileCache:yt.current,onTileLoad:()=>tt()});e.restore(),t||(d=!0)}}}const y=pn(a,Ge,qe,g);if(!y)return;if(y.clearRect(-qe.left,-qe.top,Ge[0],Ge[1]),ne&&!H){const e=ze(y,ne);e&&(y.fillStyle=e,y.fillRect(0,0,Ve,Ue))}y.save(),y.beginPath(),y.rect(0,0,Ve,Ue),y.clip();const m=c.scene,v={width:Ve,height:Ue};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)}an(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(y,m),((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 m=null!==(i=s.style.opacity)&&void 0!==i?i:1;fn(e,s.path,u,d,m,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=cn(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 v=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])*v,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=hn(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 W of D){const R=x+(C-x)*W.t,B=k+(L-k)*W.t,N=hn(w+(z-w)*Math.min(W.t+1e-4,1),h,u);e.lineTo(R,B),A(),M(N,R,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 T=s.strokeGradient&&s.path.length>=2?dn(e,s.strokeGradient,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(e.strokeStyle=T||u,p)G().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=un(e,s.style.fill,s.style.fill),p&&!g)G().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(s.path);else{const[q,V]=s.path[0];e.moveTo(q,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,m,0,v),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=un(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=un(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),sn(e,t),e.globalAlpha=1}}finally{e.restore()}}})(y,m),E&&Rt.current){const e=Rt.current,s=m.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,m=u/1e3,v=Bt.current>0?Math.min(m-Bt.current,.1):.016;Bt.current=m;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(v,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=pt.current;if(b){const e=pn(b,Ge,qe,g);if(e){e.clearRect(-qe.left,-qe.top,Ge[0],Ge[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!==Gt&&Yt(e)}const x=ge!==mt.current;x&&(mt.current=ge),(Ee.current||x)&&Ft(e=>e+1),(p||null!=c.activeTransition||c.hasActivePulses||d)&&(Je.current=requestAnimationFrame(()=>et.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:l,cleanup:s}=e;Ot(()=>{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:ot,wasHydratingFromSSR:it,storeRef:dt,dirtyRef:Ee,renderFnRef:et,cleanup:()=>{var e;return null===(e=yt.current)||void 0===e?void 0:e.clear()}}),d(()=>{Ee.current=!0,tt()},[Ve,Ue,ne,tt]),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,dt,Ee,tt,Gt,Yt),d(()=>{if("production"!==process.env.NODE_ENV&&H){const e=Mn(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(!R||!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:Ve,height:Ue};if(at){let i=bt.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),bt.current=V.scale(i);const l=dt.current;l&&(l.applyZoomScale(i,o),Ee.current=!1,tt(),(null===(r=l.scales)||void 0===r?void 0:r.projection)&&(null==N||N({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=dt.current;if(!o)return;const i=o.getRotation();$t.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=$t.current;t&&(Wt.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]],tt())},d=t=>{var n;if(!$t.current)return;$t.current=null,e.releasePointerCapture(t.pointerId);const i=Wt.current;if(i){Wt.current=null;const e=dt.current;e&&(e.applyRotation(i,o),tt())}const r=dt.current;(null===(n=null==r?void 0:r.scales)||void 0===n?void 0:n.projection)&&(null==N||N({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],[Ge[0],Ge[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;bt.current=t,xt.current=!0;const n=dt.current;n&&(n.applyZoomTransform(t,o),Ee.current=!1,tt())}).on("end",e=>{var t;bt.current=e.transform,xt.current=!1;const n=dt.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==N||N({projection:n.scales.projection,zoom:n.currentZoom}))});return vt.current=i,Z(e).call(i),()=>{Z(e).on(".zoom",null)}},[R,B,at,Ge,Ve,Ue,qe,N,tt]);const Wn=ae&&!1!==ce,Rn=Wn&&Et?de?de(Et):e(Sn,{data:Et}):null,Bn=Rn?e(rn,{x:Et.x,y:Et.y,containerWidth:Ve,containerHeight:Ue,margin:qe,className:"stream-frame-tooltip",zIndex:10,children:Rn}):null;if(jt||!ot&&it){const n=dt.current;n&&(rt||A||S)&&(rt&&n.setAreas(rt),A&&n.setPoints(lt),S&&n.setLines(st),n.computeScene({width:Ve,height:Ue}));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":Be||("string"==typeof je?je:"Geographic chart"),style:{position:"relative",width:K?"100%":Ge[0],height:J?"100%":Ge[1]},children:[e(Vt,{summary:Ne}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ge[0],height:Ge[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${qe.left},${qe.top})`,children:Ye}),t("g",{transform:`translate(${qe.left},${qe.top})`,children:[ne&&e("rect",{x:0,y:0,width:Ve,height:Ue,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:wt(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:wt(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(kt,{width:Ve,height:Ue,totalWidth:Ge[0],totalHeight:Ge[1],margin:qe,scales:null,showAxes:!1,title:je,legend:Oe,legendPosition:Me,legendLayout:Ae,legendHoverBehavior:Se,legendClickBehavior:Ce,legendHighlightedCategory:Le,legendIsolatedCategories:Pe,foregroundGraphics:Ze,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":Be||("string"==typeof je?je:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:K?"100%":Ge[0],height:J?"100%":Ge[1],overflow:"hidden"},R?{touchAction:"none"}:{}),onKeyDown:In,children:[Re&&e(Ut,{tableId:Ke}),Re&&e(qt,{scene:null!==(f=null===(h=dt.current)||void 0===h?void 0:h.scene)&&void 0!==f?f:[],chartType:"Geographic chart",tableId:Ke,chartTitle:"string"==typeof je?je:void 0}),e(Vt,{summary:Ne}),t("div",{role:"img","aria-label":Be||("string"==typeof je?je:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Wn?$n:void 0,onMouseLeave:Wn?Ln:void 0,onClick:he?zn:void 0,children:[Ye&&e("svg",{style:{position:"absolute",left:0,top:0,width:Ge[0],height:Ge[1],pointerEvents:"none"},children:e("g",{transform:`translate(${qe.left},${qe.top})`,children:Ye})}),H&&e("canvas",{ref:ht,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e("canvas",{ref:ft,"aria-label":It(null!==(y=null===(g=dt.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:pt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Zt,{hoverPoint:Et}),e(kt,{width:Ve,height:Ue,totalWidth:Ge[0],totalHeight:Ge[1],margin:qe,scales:null,showAxes:null!=We&&We,title:je,legend:Oe,legendPosition:Me,legendLayout:Ae,legendHoverBehavior:Se,legendClickBehavior:Ce,legendHighlightedCategory:Le,legendIsolatedCategories:Pe,foregroundGraphics:Ze,annotations:ge,annotationFrame:Ht,xValues:[],yValues:[],pointNodes:null===(m=dt.current)||void 0===m?void 0:m.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:Gt?"#dc3545":"#28a745",color:"white"}),children:Gt?"STALE":"LIVE"}),R&&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:On,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:On,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(Kt,{active:Pn.current>=0,hoverPoint:Et,margin:qe,size:Ge,shape:null===(v=Dn.current)||void 0===v?void 0:v.shape,width:null===(b=Dn.current)||void 0===b?void 0:b.w,height:null===(x=Dn.current)||void 0===x?void 0:x.h}),Bn]})]})});function Ln(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function zn(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Pn(e){const t=e.map(Ln),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return zn(e,n,o)}if(e>=1){const[e,o,i]=t[n];return zn(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 zn(Math.round(l+(c-l)*r),Math.round(s+(u-s)*r),Math.round(a+(d-a)*r))}}Cn.displayName="StreamGeoFrame";const Dn=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],In=Pn(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),$n=Pn(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Wn=Pn(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Rn=Pn(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Bn=Pn(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Nn=Pn(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Tn=Pn(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),En=Pn(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),_n=Pn(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Hn=Pn(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Fn=Pn(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Gn=Pn(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);Pn(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Pn(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Pn(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Pn(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Pn(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Pn(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Pn(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const qn={category10:Dn,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:In,reds:$n,greens:Wn,oranges:Rn,purples:Bn,viridis:Tn,plasma:En},Vn=Dn,Un=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Zn=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 Yn(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")||Zn.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Vn[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))%Vn.length]}function Xn(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=qn[n]||qn.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:Vn;return S().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;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 Kn=c(null);function Jn(){return l(Kn)}function eo(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 to(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[no,oo]=he(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=to(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=to(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}})}})),[io,ro]=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 lo(e){const t=g(),n=e.clientId||t,{name:o}=e,i=oo(e=>e.selections.get(o)),l=oo(e=>e.setClause),a=oo(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(eo(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 so(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:l}=lo({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 ao=c(!1),co=c(null),uo="undefined"==typeof window?d:h;function ho(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 fo(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 po(){return we(e=>e.theme)}o.createContext(void 0);const go="#007bff";function yo(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 mo(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 vo(){var e;const t=po(),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 bo({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=ho(t,n),m=lo({name:(null==e?void 0:e.name)||"__unused__"}),v=so({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=ro(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.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=yo(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)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&lt(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&v.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=mo(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,v,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=yo(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=mo(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 xo({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(ao),h=null!==l(co),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(co),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;uo(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),uo(()=>{t&&t.registerCategories(n,s)},[t,n,s])}(h&&t?y:[]);const m=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):Un[r%Un.length];return{label:i+"",color:s}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Yn,categories:y});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[f,t,e,n,y]),v=r(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=t=>{const n=e[t];return"number"==typeof n?n:c[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return m&&("right"===s&&!o("right")&&110>n.right?n.right=110:"left"===s&&!o("left")&&110>n.left?n.left=110:"top"===s&&!o("top")&&50>n.top?n.top=50:"bottom"===s&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[c,a,m,s]);return{legend:m,margin:v,legendPosition:s}}const ko={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 wo(e,t,n){var o,i,r,l,s,a,c;const u=ko[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:jo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function jo(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 Oo(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 Ao 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 So;const Co="undefined"!=typeof process&&"production"!==(null===(So=process.env)||void 0===So?void 0:So.NODE_ENV);function Lo({componentName:t,width:n,height:o,children:i}){return e(Ao,{fallback:i=>e(Mo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const zo={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"},Po={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Do(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({},zo),{width:n,height:o}),children:i||"No data available"}):null}function Io(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),l=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(l+s)-s))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Po),{position:"absolute",top:a+o*(l+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:l,opacity:.5+o%2*.2})},o))})}function $o(e,t,n,o){if(!Co)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 Wo(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 Ro(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 Bo(e){return e}function No(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 Bo;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 To=new Map;function Eo(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function _o(e){return Ro(this,void 0,void 0,function*(){const t=To.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return Ro(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:Eo(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Eo(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Eo(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Eo(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 No(e,t)})}:No(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return To.set(e,r),r})}function Ho(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 Fo={blues:In,reds:$n,greens:Wn,viridis:Tn,oranges:Rn,purples:Bn,greys:Nn,plasma:En,inferno:_n,magma:Hn,cividis:Fn,turbo:Gn};function Go(n){var o;const i=wo(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=po();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:m,tileAttribution:v,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,loadingContent:I,emptyContent:$,frameProps:W={},stroke:R,strokeWidth:B,opacity:N}=n,T=null!=f?f:!!m,E=Ho(s),_=r(()=>E?Xt(E):E,[E]),H=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]),F=null!==(o=null!=c?c:l)&&void 0!==o?o:"blues",G=r(()=>{if(!_)return C(In).domain([0,1]);const e=_.map(e=>H(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=P(e);return C(Fo[F]||In).domain([null!=t?t:0,null!=n?n:1])},[_,H,F]),{activeSelectionHook:q,customHoverBehavior:V,customClickBehavior:U}=bo({selection:M,linkedHover:A,onObservation:S,onClick:L,chartType:"ChoroplethMap",chartId:z}),Z=Wo(M),Y=r(()=>{const e=Oo(e=>{const t=H(e);return{fill:null!=t&&isFinite(t)?G(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}},{stroke:R,strokeWidth:B,opacity:N});return q?fo(e,q,Z):e},[H,G,q,Z,k,R,B,N]),X=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=H(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},[H]),Q=r(()=>Object.assign({top:10,right:10,bottom:10,left:10},function(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}(j)),[j]),K=Io(D,i.width,i.height,I)||(_?null:Io(!0,i.width,i.height,I)),J=K?null:Do(_,i.width,i.height,$);if(Array.isArray(_)&&_.length>0){const t=_[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 ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:u,areas:_,areaStyle:Y,size:[i.width,i.height],margin:Q,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?X:on(x)||X},null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),T&&{zoomable:!0}),p&&{zoomExtent:p}),g&&{onZoom:g}),null!=y&&{dragRotate:y}),m&&{tileURL:m}),v&&{tileAttribution:v}),b&&{tileCacheSize:b}),(A||S||L)&&{customHoverBehavior:V}),(S||L)&&{customClickBehavior:U}),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}),W);return K||J||e(Lo,{componentName:"ChoroplethMap",width:i.width,height:i.height,children:e(Cn,Object.assign({},ee))})}function qo(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:m,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,loadingContent:j,emptyContent:O,width:M,height:A}=e,S=void 0===n,C=r(()=>Xt(t),[t]),[L,z]=u([]),P=s(e=>{z(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),D="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:I,hoverSelectionHook:$,customHoverBehavior:W,customClickBehavior:R,crosshairSourceId:B}=bo({selection:c,linkedHover:d,fallbackFields:h,unwrapData:f,onObservation:p,chartType:g,chartId:y,onClick:x,hoverHighlight:k,colorByField:D}),N=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,B),T=function(e,t,n){const o=Jn(),i=vo();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=Xn(n.map(e=>({_cat:e})),"_cat",l);return t=>o[t]||e(t)}return Xn(n.map(e=>({_cat:e})),"_cat",l)}if(o&&Object.keys(o).length>0){const n=Xn(e,t,l);return e=>o[e]||n(e)}return Xn(e,t,l)}if(o&&Object.keys(o).length>0){const e=Xn([{_:"a"}],"_",l);return t=>o[t]||e(t)}},[e,t,n,o,i])}(C,o,i),E=r(()=>{if(!o)return[];const e=new Set;for(const t of C){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[C,o]),_=r(()=>S&&L.length>0?L:E,[S,L,E]),H=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,_),F=r(()=>$||(H.legendSelectionHook?H.legendSelectionHook:I),[$,H.legendSelectionHook,I]),G=Wo(c),q=vo(),V=Jn(),U=r(()=>{if(T)return T;if(!o||0===_.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:q&&q.length>0?q:Un,t="__streamCat",n=Xn(_.map(e=>({[t]:e})),t,e);return e=>(null==V?void 0:V[e])||n(e)||"#999"},[T,o,_,i,q,V]),{legend:Z,margin:Y,legendPosition:X}=xo({data:C,colorBy:o,colorScale:U,showLegend:m,legendPosition:a,userMargin:v,defaults:b,categories:_}),Q=r(()=>{const e={};return Z&&(e.legend=Z,e.legendPosition=X),l&&"none"!==l&&(e.legendHoverBehavior=H.onLegendHover,e.legendClickBehavior=H.onLegendClick,e.legendHighlightedCategory=H.highlightedCategory,e.legendIsolatedCategories=H.isolatedCategories),S&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=P),e},[Z,X,l,H.onLegendHover,H.onLegendClick,H.highlightedCategory,H.isolatedCategories,S,o,P]),K=Array.isArray(n)?Xt(n):n,J=Io(w,M,A,j),ee=J?null:Do(K,M,A,O);return{data:C,colorScale:T,allCategories:_,legendState:H,effectiveSelectionHook:F,activeSelectionHook:I,customHoverBehavior:W,customClickBehavior:R,legend:Z,margin:Y,legendPosition:X,earlyReturn:J||ee||null,legendBehaviorProps:Q,crosshairProps:N,resolvedSelection:G}}function Vo(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:[])}Go.displayName="ChoroplethMap";const Uo=f(function(n,o){const l=i(null);Vo(o,{variant:"geo-points",frameRef:l});const s=wo(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:m,zoomable:v,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:W,loading:R,loadingContent:B,emptyContent:N,legendInteraction:T,legendPosition:E,frameProps:_={},stroke:H,strokeWidth:F,opacity:G}=n,q=null!=v?v:!!w,V=Ho(M),U=qo({data:null!=a?a:Yt,rawData:a,colorBy:f,colorScheme:p,legendInteraction:T,legendPosition:E,selection:P,linkedHover:D,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:I,onClick:$,chartType:"ProportionalSymbolMap",chartId:W,showLegend:s.showLegend,userMargin:L,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:R,loadingContent:B,emptyContent:N,width:s.width,height:s.height}),Z=U.data,Y=r(()=>{if(!d)return;const e="function"==typeof d?d:e=>null==e?void 0:e[d],t=Z.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[Z,d]),X=r(()=>{const e=Oo(e=>({fill:f?Yn(e,f,U.colorScale):go,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:d?Qn(e,d,h,Y):6}),{stroke:H,strokeWidth:F,opacity:G});return U.effectiveSelectionHook?fo(e,U.effectiveSelectionHook,U.resolvedSelection):e},[f,U.colorScale,U.effectiveSelectionHook,U.resolvedSelection,d,h,Y,H,F,G]),Q=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]);$o("ProportionalSymbolMap",Z,"xAccessor",c),$o("ProportionalSymbolMap",Z,"yAccessor",u);const K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:g},null!=a&&{points:Z}),{xAccessor:c,yAccessor:u,pointStyle:X}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),V&&{areas:V,areaStyle:A}),null!=y&&{graticule:y}),null!=m&&{fitPadding:m}),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:U.margin,enableHover:!0,tooltipContent:!1===S?()=>null:on(S)||Q}),U.legendBehaviorProps),(D||I||$)&&{customHoverBehavior:U.customHoverBehavior}),(I||$)&&{customClickBehavior:U.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}),_);return U.earlyReturn?U.earlyReturn:e(Lo,{componentName:"ProportionalSymbolMap",width:s.width,height:s.height,children:e(Cn,Object.assign({ref:l},K))})});Uo.displayName="ProportionalSymbolMap";const Zo="__semiotic_x",Yo="__semiotic_y",Xo=f(function(n,o){const l=wo(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:m,zoomExtent:v,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:W,tooltip:R,annotations:B,margin:N,className:T,selection:E,linkedHover:_,onObservation:H,onClick:F,chartId:G,loading:q,loadingContent:V,emptyContent:U,frameProps:Z={},legendInteraction:Y,legendPosition:X,stroke:Q,strokeWidth:K,opacity:J,lineIdAccessor:ee}=n,te=null!=m?m:!!k,ne=Ho(S),oe=r(()=>Xt(c),[c]),ie=qo({data:null!=a?a:Yt,rawData:a,colorBy:L,colorScheme:I,legendInteraction:Y,legendPosition:X,selection:E,linkedHover:_,fallbackFields:L?["string"==typeof L?L:""]:[],unwrapData:!1,onObservation:H,onClick:F,chartType:"FlowMap",chartId:G,showLegend:l.showLegend,userMargin:N,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:q,loadingContent:V,emptyContent:U,width:l.width,height:l.height}),re=ie.data,le=ho(_),se=so({name:(null==le?void 0:le.name)||"hover",fields:(null==le?void 0:le.fields)||[]}),ae=ro(e=>e.pushObservation),ce=r(()=>{const e=new Map;for(const t of oe)e.set(t[u]+"",t);return e},[oe,u]),ue=i(null),de=i(ce);de.current=ce;const he=i(d);he.current=d;const fe=i(h);fe.current=h;const pe=s(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=de.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const i="function"==typeof he.current?he.current:e=>e[he.current],r="function"==typeof fe.current?fe.current:e=>e[fe.current];return Object.assign(Object.assign({},e),{coordinates:[{[Zo]:i(n),[Yo]:r(n)},{[Zo]:i(o),[Yo]:r(o)}]})},[]);Vo(o,{variant:"geo-lines",frameRef:ue,overrides:{push:e=>{var t;const n=pe(e);n&&(null===(t=ue.current)||void 0===t||t.pushLine(n))},pushMany:e=>{var t;const n=[];for(const t of e){const e=pe(t);e&&n.push(e)}n.length>0&&(null===(t=ue.current)||void 0===t||t.pushManyLines(n))}}});const ge=r(()=>{const e=new Map;for(const t of re)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},[re]),ye=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=ge.get(t[u]+"");e&&se.onHover(e)}else se.onHover(t)}else se.onHover(null);if(H||ae){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:G};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),ae&&ae(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});H&&H(e),ae&&ae(e)}}},[_,se,u,ge,H,G,ae]),me=ie.customClickBehavior,ve=r(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof h?h:e=>e[h];return re.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ce.get(n.source+""),i=ce.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[Zo]:e(o),[Yo]:t(o)},{[Zo]:e(i),[Yo]:t(i)}]}):null}).filter(Boolean)},[re,ce,d,h]),be=r(()=>{const e="function"==typeof d?d:e=>e[d];return t=>null!=t&&"object"==typeof t&&Zo in t?t[Zo]:e(t)},[d]),xe=r(()=>{const e="function"==typeof h?h:e=>e[h];return t=>null!=t&&"object"==typeof t&&Yo in t?t[Yo]:e(t)},[h]),ke=r(()=>{const e=re.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)},[re,f,P]),we=r(()=>e=>{var t;return{stroke:L?Yn(e,L,ie.colorScale):go,strokeWidth:ke(null!==(t=e[f])&&void 0!==t?t:0),strokeLinecap:D,opacity:z}},[L,ie.colorScale,ke,f,z,D]),je=r(()=>{var e;const t=Oo(we,{stroke:Q,strokeWidth:K,opacity:J});if(!ie.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=ie.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return fo(t,ie.effectiveSelectionHook,Object.assign(Object.assign({},ie.resolvedSelection||{}),{unselectedStyle:n}))},[we,ie.effectiveSelectionHook,ie.resolvedSelection,Q,K,J]),Oe=r(()=>Oo(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:Q,strokeWidth:K,opacity:J}),[Q,K,J]),Me=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]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:oe,xAccessor:be,yAccessor:xe,lineDataAccessor:"coordinates"}),null!=ee&&{lineIdAccessor:ee}),{lineType:O,flowStyle:M,lineStyle:je,pointStyle:Oe}),ne&&{areas:ne,areaStyle:C}),null!=g&&{graticule:g}),null!=y&&{fitPadding:y}),te&&{zoomable:!0}),v&&{zoomExtent:v}),b&&{onZoom:b}),null!=x&&{dragRotate:x}),$&&{showParticles:$}),W&&{particleStyle:W}),k&&{tileURL:k}),w&&{tileAttribution:w}),j&&{tileCacheSize:j}),{size:[l.width,l.height],margin:ie.margin,enableHover:!0,tooltipContent:!1===R?()=>null:on(R)||Me}),ie.legendBehaviorProps),(_||H||F)&&{customHoverBehavior:ye}),(H||F)&&{customClickBehavior:me}),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}),T&&{className:T}),null!=n.animate&&{animate:n.animate}),Z);return ie.earlyReturn?ie.earlyReturn:e(Lo,{componentName:"FlowMap",width:l.width,height:l.height,children:e(Cn,Object.assign({ref:ue},Ae))})});Xo.displayName="FlowMap";const Qo=f(function(n,o){const l=wo(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:m=1,lineMode:v="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:W,showNorth:R=!0,costLabel:B,annotations:N,margin:T,className:E,selection:_,linkedHover:H,onObservation:F,onClick:G,chartId:q,loading:V,loadingContent:U,emptyContent:Z,legendPosition:Y,frameProps:X={},stroke:Q,strokeWidth:K,opacity:J}=n,ee=null!=w?w:!!A,te=r(()=>Xt(a),[a]),ne=qo({data:te,rawData:a,colorBy:z,colorScheme:P,legendInteraction:void 0,legendPosition:Y,selection:_,linkedHover:H,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!1,onObservation:F,onClick:G,chartType:"DistanceCartogram",chartId:q,showLegend:l.showLegend,userMargin:T,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:V,loadingContent:U,emptyContent:Z,width:l.width,height:l.height}),oe=r(()=>{const e=Oo(e=>({fill:z?Yn(e,z,ne.colorScale):go,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:D}),{stroke:Q,strokeWidth:K,opacity:J});return ne.effectiveSelectionHook?fo(e,ne.effectiveSelectionHook,ne.resolvedSelection):e},[z,ne.colorScale,ne.effectiveSelectionHook,ne.resolvedSelection,D,Q,K,J]),ie=r(()=>({center:g,centerAccessor:p,costAccessor:y,strength:m,lineMode:v}),[g,p,y,m,v]),re=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 te)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,te,h,f,p]),le=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]),se=i(null);Vo(o,{variant:"geo-points",frameRef:se});const[ae,ce]=u(null),ue=s(()=>{var e,t;const n=null===(t=null===(e=se.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ce(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);d(()=>{const e=requestAnimationFrame(ue);return()=>cancelAnimationFrame(e)},[ue,m,g,l.width,l.height,te]);const de=r(()=>{if(!$||!ae)return[];const{maxCost:e}=ae;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},[$,ae]),he=r(()=>{var n,o;if(!ae)return X.foregroundGraphics||null;const{cx:i,cy:r,maxCost:l,availableRadius:s}=ae,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},W),c=null!==(n=ne.margin.left)&&void 0!==n?n:10,u=null!==(o=ne.margin.top)&&void 0!==o?o:10;return t("g",{children:[de.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)}),R&&t("g",{transform:`translate(${c+24}, ${u+24})`,children:[e("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),X.foregroundGraphics]})},[ae,de,R,B,W,ne.margin,X.foregroundGraphics]);$o("DistanceCartogram",te,"xAccessor",h),$o("DistanceCartogram",te,"yAccessor",f);const fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:b},null!=a&&{points:te}),re&&{lines:re,lineDataAccessor:"coordinates"}),{xAccessor:h,yAccessor:f,pointIdAccessor:p,pointStyle:oe,projectionTransform:ie}),L&&{transition:{duration:L}}),null!=x&&{graticule:x}),null!=k&&{fitPadding:k}),ee&&{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:ne.margin,enableHover:!0,tooltipContent:!1===I?()=>null:on(I)||le}),ne.legendBehaviorProps),(H||F||G)&&{customHoverBehavior:ne.customHoverBehavior}),(F||G)&&{customClickBehavior:ne.customClickBehavior}),N&&N.length>0&&{annotations:N}),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}),X),he&&{foregroundGraphics:he});return ne.earlyReturn?ne.earlyReturn:e(Lo,{componentName:"DistanceCartogram",width:l.width,height:l.height,children:e(Cn,Object.assign({ref:se},fe))})});function Ko(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})}Qo.displayName="DistanceCartogram";export{Go as ChoroplethMap,Qo as DistanceCartogram,Xo as FlowMap,Uo as ProportionalSymbolMap,Cn as StreamGeoFrame,Ko as mergeData,_o as resolveReferenceGeography};