semiotic 3.7.1 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/geo.min.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-geo"),o=require("d3-scale"),i=require("d3-quadtree"),r=require("d3-array"),s=require("d3-hierarchy"),l=require("d3-shape"),a=require("regression"),c=require("d3-zoom"),u=require("d3-selection");function d(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const f=h(t),p=d(a);class g{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;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,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function m(e,t,n){return e+(t-e)*n}function y(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,l=n-1-t;switch(e.type){case"linear":return s+(1-l/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,l/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>l?1:s;default:return 1}}const v={mercator:n.geoMercator,equalEarth:n.geoEqualEarth,albersUsa:n.geoAlbersUsa,orthographic:n.geoOrthographic,naturalEarth:n.geoNaturalEarth1,equirectangular:n.geoEquirectangular};function b(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function x(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function j(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function k(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 w(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 s=-i/r,l=o/r,a=Math.min(.3*r,80),c=(e[0]+t[0])/2+s*a,u=(e[1]+t[1])/2+l*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 M(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,s;0===t?(r=e[1][0]-i[0],s=e[1][1]-i[1]):t===e.length-1?(r=i[0]-e[t-1][0],s=i[1]-e[t-1][1]):(r=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const l=Math.sqrt(r*r+s*s)||1;o.push([i[0]+s/l*n,i[1]+-r/l*n])}return o}function O(e,t,n,o,i){const r=t[0]-e[0],s=t[1]-e[1],l=Math.sqrt(r*r+s*s);if(0===l)return[e,t];const a=s/l,c=-r/l,u=i/2+1;return[[e[0]+a*u,e[1]+c*u],[t[0]+a*u,t[1]+c*u]]}class S{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 g(e),this.timestampBuffer=new g(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}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 n.geoEqualEarth();if("string"==typeof e){const t=v[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),n.geoEqualEarth())}if("object"==typeof e&&"type"in e){const t=v[e.type],o=t?t():n.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(t.projection),this.geoPath=n.geoPath(this.projection),this.fitProjection(e),this.geoPath=n.geoPath(this.projection);const o=this.projection;this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null};const i=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&&i.length>0&&this.startTransition(i),this.version++}fitProjection(e){var t,n,o,i,r;const s=this.projection,l=this.config,a=[...this.areas],c=b(l.xAccessor,"lon"),u=b(l.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=x(l.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(l.projectionExtent){const[[t,n],[o,i]]=l.projectionExtent;s.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(s.clipAngle&&(null!==(t=s.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=l.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);s.scale(o/2-o*t),s.translate([e.width/2,e.height/2])}else{const t=null!==(o=l.fitPadding)&&void 0!==o?o:0,n=e.width*t,i=e.height*t;s.fitExtent([[n,i],[e.width-n,e.height-i]],{type:"FeatureCollection",features:a})}this.baseScale=s.scale(),this.baseTranslate=s.translate(),this.baseRotation=null!==(r=null===(i=s.rotate)||void 0===i?void 0:i.call(s))&&void 0!==r?r:[0,0,0]}}applyZoomTransform(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e.k),o.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(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,S.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=i.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,o,i;const r=[],{config:s}=this,l=this.projection,a=this.geoPath,c=b(s.xAccessor,"lon"),u=b(s.yAccessor,"lat"),d=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}}(s),h=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(s),f=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(s);if(s.graticule){const t=!0===s.graticule?{}:s.graticule,o=n.geoGraticule();t.step&&o.step(t.step);const i=a(o())||"";i&&r.push({type:"geoarea",pathData:i,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=a(e);if(!t)continue;const n=a.centroid(e),o=a.bounds(e),i=a.area(e),l=j(s.areaStyle,e,d);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:i,style:l,datum:e,interactive:!0})}const p=x(s.lineDataAccessor);for(const t of this.lineData){const o=p(t);if(!o||2>o.length)continue;let i=[];if("geo"===s.lineType){const e=Array(o.length);for(let t=0;o.length>t;t++)e[t]=[c(o[t]),u(o[t])];for(let t=0;e.length-1>t;t++){const o=e[t],r=e[t+1],s=n.geoDistance(o,r)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),c=n.geoInterpolate(o,r);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const n=l(c(e/a));null!=n&&i.push(n)}}}else for(let e=0;o.length>e;e++){const t=o[e],n=l([c(t),u(t)]);null!=n&&i.push(n)}if(2>i.length)continue;const a=j(s.lineStyle,t,h),d="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==o.length||2>i.length||"arc"!==s.flowStyle?2!==o.length||2>i.length||"offset"!==s.flowStyle||(i="geo"===s.lineType?M(i,d):O(i[0],i[i.length-1],0,0,d)):i=w(i[0],i[i.length-1]);const f=k(i,e.width);if(f.length>1)for(const e of f){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},a),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>i.length&&f[0]||i,style:a,datum:t})}const g=this.getPoints(),m=s.pointIdAccessor?"function"==typeof s.pointIdAccessor?s.pointIdAccessor:e=>e[s.pointIdAccessor]:null,y=l.clipAngle&&null!==(t=l.clipAngle())&&void 0!==t?t:0,v=y>0?y*Math.PI/180:null,S=l.rotate?l.rotate():[0,0,0],A="function"==typeof l.center?l.center():[0,0],C=[(null!==(o=A[0])&&void 0!==o?o:0)-S[0],(null!==(i=A[1])&&void 0!==i?i:0)-S[1]];for(let e=0;g.length>e;e++){const t=g[e],o=c(t),i=u(t);if(null!=v&&n.geoDistance([o,i],C)>v)continue;const a=l([o,i]);if(!a)continue;const d=s.pointStyle?s.pointStyle(t):Object.assign({},f),h={type:"point",x:a[0],y:a[1],r:d.r||4,style:d,datum:t,pointId:m?m(t)+"":void 0};r.push(h)}return r}applyCartogramTransform(e,t){var n,i,r;const s=this.scene.filter(e=>"point"===e.type);if(2>s.length)return;const l=null!==(n=e.strength)&&void 0!==n?n:1;if(0===l)return;const a=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,c="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],u=s.find(t=>t.datum&&a(t.datum)+""==e.center+"");if(!u)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const d=u.x,h=u.y,f=s.map(e=>e.datum?c(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),p=Math.max(...f,1),g=Math.min(t.width,t.height)/2,m=o.scaleLinear().domain([0,p]).range([0,g]);this.cartogramLayout={cx:d,cy:h,maxCost:p,availableRadius:g},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of s){if(e===u)continue;if(!e.datum)continue;const t=Math.atan2(e.y-h,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-h,2)),o=c(e.datum),i=n+((isFinite(o)?m(o):n)-n)*l;e.x=d+Math.cos(t)*i,e.y=h+Math.sin(t)*i}const y=t.width/2,v=t.height/2,b=y-u.x,x=v-u.y;if(Math.abs(b)>.5||Math.abs(x)>.5)for(const e of s)e.x+=b,e.y+=x;this.cartogramLayout={cx:y,cy:v,maxCost:p,availableRadius:g};const j=this.scene.filter(e=>"line"===e.type);if(j.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of s)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of j){const n=null===(i=t.datum)||void 0===i?void 0:i.source,o=null===(r=t.datum)||void 0===r?void 0:r.target;if(n&&o){const i=e.get(n+""),r=e.get(o+"");i&&r&&(t.path=[i,r])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const i=y(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),s=this.timestampBuffer.toArray();for(let e=0;r.length>e&&s.length>e;e++){const l=i-s[e];o>l&&(r[e]._pulseIntensity=1-l/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 s=!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)&&(s=!0))}s&&(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=m(e.x,e._targetX,n),e.y=m(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 A(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function C(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function P(e,t){const n=C(e);if(!n)return!1;const o=C(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function L(e,t,n,o,i,r,s=0){if(r){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,l=t+r,a=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,f)=>{if(i>l||s>h||r>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,l=Math.sqrt(r*r+s*s);A(e.r,o)>=l&&d>l&&(u=e,d=l),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,s);if(e)return e}else{let i=null,r=o;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,l=s.y-n,a=Math.sqrt(e*e+l*l);A(s.r,o)>=a&&r>a&&(i=s,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 s=r;if(!1===s.interactive)continue;const[[l,a],[c,u]]=s.bounds;if(!(l>t||t>c||a>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),i.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let l=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[s,c]=i[o],[u,d]=i[o+1],h=z(t,n,s,c,u,d);r>=h&&a>h&&(l=e,a=h)}}return l?{node:l,distance:a}:null}function z(e,t,n,o,i,r){const s=i-n,l=r-o,a=s*s+l*l;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*l)/a;c=Math.max(0,Math.min(1,c));const u=o+c*l;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function R(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=D(n);return[function({children:o,initialState:r}){const s=t.useRef(r),l=t.useMemo(()=>D(n,s.current),[]),a=i();return e.jsx(a.Provider,{value:l,children:o})},e=>{var n;const o=i(),s=null!==(n=t.useContext(o))&&void 0!==n?n:r,l=t.useRef(e);l.current=e;const a=t.useCallback(()=>l.current(s.getState()),[s]),c=t.useCallback(()=>l.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,a,c)}]}function D(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 I(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function $(e){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:E})})),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}S.QUADTREE_THRESHOLD=500;const E=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],N={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:12}},W={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:12}},B={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:E,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 T(e,t){if("light"===t)return N;if("dark"===t)return W;if("high-contrast"===t)return B;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?W:N;return $(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 $(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[_,F]=R(e=>({theme:N,setTheme(t){e(e=>({theme:T(e.theme,t)}))}}));const H=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,q=new WeakMap;let G=0,V=!1,U=null,Z=null,Y=null;function X(e,t){var n,o;if(!t)return t;const i=H.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(V)return;if("undefined"==typeof window||"undefined"==typeof document)return;V=!0;const e=()=>{G++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(U=new MutationObserver(e),U.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Z=window.matchMedia("(prefers-color-scheme: dark)"),Y=e,"function"==typeof Z.addEventListener?Z.addEventListener("change",Y):"function"==typeof Z.addListener&&Z.addListener(Y)}catch(e){}}();let s=q.get(r);s&&s.version===G||(s={version:G,map:new Map},q.set(r,s));const l=s.map.get(t);if(void 0!==l)return l;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,a),a}const Q="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function K(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function J(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(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=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=function(e,n,o){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),l=r[0]-s.left-s.right,a=r[1]-s.top-s.bottom,c=K(e.foregroundGraphics,r,s),u=K(e.backgroundGraphics,r,s),d=F(e=>e.theme),{transition:h,introEnabled:p}=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),g="semiotic-table-"+f.useId(),m=t.useRef(0),y=t.useRef(()=>{}),v=t.useCallback(()=>{m.current||(m.current=requestAnimationFrame(()=>y.current()))},[]);t.useEffect(()=>()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),j=t.useRef(null),k=t.useRef(0),w=t.useCallback(()=>{k.current=0;const e=j.current;j.current=null,e&&b.current(e)},[]),M=t.useCallback(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(w))},[w]),O=t.useCallback(()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=e.themeDirtyRef;return Q(()=>{S&&(G++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:l,adjustedHeight:a,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:g,rafRef:m,renderFnRef:y,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:M,onPointerLeave:O}}const ee={fill:(t,n)=>e.jsx("rect",{style:t,width:n,height:n}),line:(t,n)=>e.jsx("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function te(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,ee[n])(o(e,t),i),r}function ne({swatchSize:t}){return e.jsx("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 oe(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ie=(t,n,o,i,r,s,l,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=t,g=[];let m=0;const y=!(!n&&!o),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:j}=d;return p.forEach((t,u)=>{const d=te(t,u,h,f,b),k=oe(t,i,r),w=r&&r.size>0&&r.has(t.label);g.push(e.jsxs("g",{transform:`translate(0,${m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===s&&u===l?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&v?w||!1:void 0,"aria-current":y&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+p.length)%p.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,w&&e.jsx(ne,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),m+=j}),g};function re({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:s,format:l}=t,a=l||(e=>Math.round(100*e)/100+""),c="grad-legend-"+f.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),l=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:l+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:l,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:l,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),e.jsx("text",{x:l+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function se(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:l,title:a="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:h}=t,p=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),l=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,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:l,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}}(h),[g,m]=f.useState(0),[y,v]=f.useState(0),b=f.useCallback((e,t)=>{m(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,p)=>{h+=5,f.push(e.jsx("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.jsx("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.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:ie(t,o,i,r,s,l,a,p,c,u,d)},"legend-group-"+p)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:l,metrics:p}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:a,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var f;let p=0;const g=[];t.forEach((t,n)=>{var f;let m=0;t.label&&(m+=16);const y=((t,n,o,i,r,s,l,a,c,u,d,h)=>{const{type:f="fill",styleFn:p,items:g}=t,m=[],{swatchSize:y,labelGap:v,itemGap:b,rowHeight:x,align:j}=d,k=!(!n&&!o),w="isolate"===u||void 0===u&&null!=r,M=g.map(e=>y+v+7*e.label.length),O=[];let S=0,A=0;M.forEach((e,t)=>{const n=0===A?e:A+b+e;h&&h>0&&A>0&&n>h?(O.push({start:S,end:t,width:A}),S=t,A=e):A=n}),g.length>0&&O.push({start:S,end:g.length,width:A}),O.forEach((t,u)=>{let d="center"===j?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===j?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=g[h],j=te(t,h,f,p,y),O=oe(t,i,r),S=r&&r.size>0&&r.has(t.label);m.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?a===s&&h===l?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?S||!1:void 0,"aria-current":k&&!w&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:k?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+g.length)%g.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:k?e=>{c(a,h),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:O,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+v+2+7*t.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),j,S&&e.jsx(ne,{swatchSize:y}),e.jsx("text",{y:y/2,x:y+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=M[h]+b}});const C=Math.max(0,...O.map(e=>e.width)),P=O.length;return{items:m,offset:C,totalRows:P,totalHeight:P*x}})(t,i,r,s,l,a,c,n,u,d,h,null!==(f=h.maxWidth)&&void 0!==f?f:o);m+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:m,totalRows:y.totalRows,totalHeight:y.totalHeight})),p+=m+12});const m=null!==(f=h.maxWidth)&&void 0!==f?f:o;let y=p>m?0:"center"===h.align?Math.max(0,(m-p)/2):"end"===h.align?Math.max(0,m-p):0;const v=[];return g.forEach((o,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${y},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)),y+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${y},0)`,children:o.items},"legend-group-"+i)),y+=o.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),e.jsx("g",{children:v})})({legendGroups:n||[],title:a,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:l,metrics:p}),j=!(!o&&!i);return e.jsxs("g",{role:j?"listbox":void 0,"aria-multiselectable":!(!j||"isolate"!==l&&(void 0!==l||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}function le(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ae(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:l="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:p}=t;if(!o)return null;const g="top"===l||"bottom"===l,m=!!c,y=Math.max(1,g?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===l?(v=Math.max(4,s.left-y-10),b=s.top):"top"===l?(v=s.left,b=m?32:8):"bottom"===l?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e.jsx(re,{config:o.gradient,orientation:g?"horizontal":"vertical",width:y}):le(o)?e.jsx(se,{legendGroups:o.legendGroups,title:"",width:y,orientation:g?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:p}):o)});var x}function ce(e){return"string"==typeof e?{type:e}:e}function ue({orient:n,config:o,values:i,scale:s,size:l,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=t.useMemo(()=>{if(0===i.length)return null;const t=s.domain(),o=l-8;if("boxplot"===c.type){const t=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)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!t)return null;const{q1:r,median:l,q3:a,whiskerLow:d,whiskerHigh:h}=t,f=Math.min(.5*o,20),p=(o-f)/2+4;if(u){const t=s(r),o=s(a),i=s(l),u=s(d),g=s(h),m="top"===n?-1:1,y=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:y+m*(p+f/2),x2:g,y2:y+m*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:y+m*p,x2:u,y2:y+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:g,y1:y+m*p,x2:g,y2:y+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?y-p-f:y+p,width:Math.abs(o-t),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?y-p-f:y+p,x2:i,y2:"top"===n?y-p:y+p+f,stroke:c.fill,strokeWidth:2})]})}{const t=s(r),o=s(a),i=s(l),u=s(d),g=s(h),m="left"===n?-1:1,y=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:y+m*(p+f/2),y1:u,x2:y+m*(p+f/2),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:y+m*p,y1:u,x2:y+m*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:y+m*p,y1:g,x2:y+m*(p+f),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?y-p-f:y+p,y:Math.min(t,o),width:f,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?y-p-f:y+p,y1:i,x2:"left"===n?y-p:y+p+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=r.bin().domain(t).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.jsx("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/h*o;if(u){const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-r:4,width:Math.max(l,.5),height:r,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:"left"===n?-4-r:4,y:Math.min(o,o+l),width:r,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*(o/2),l=s((e.x0+e.x1)/2);i.push(u?`${l},${"top"===n?-(t-r):t-r}`:`${"left"===n?-(t-r):t-r},${l}`)}for(let e=d.length-1;e>=0;e--){const r=d[e];if(null==r.x0||null==r.x1)continue;const l=r.length/h*(o/2),a=s((r.x0+r.x1)/2);i.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.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,i=null!=d[0].x0?s(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=s((e.x0+e.x1)/2);t.push(`L${r},${"top"===n?-i-4:i+4}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${r},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${r}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${e},${r}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,l,a,n,u,4]);return d?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function de(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function he(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 fe(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:l,align:a,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=l;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===d?"right"===h?f="end":"middle"===h&&(f="middle"):f=0>n?"end":"start";const p=16,g=s?u?[s]:de(s,c):[],m=r?u?[r]:de(r,c):[],y="leftRight"===d?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";g.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:g.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:p,children:t},n))},"annotation-note-title")),v=g.length*p),m.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:m.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let j=null;if((s||r)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(g.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,g.length+m.length-1)*p;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===h?-(k+p+(m.length>0&&g.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),j]})}function pe(t,n,o,i,r){var s;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.push(e.jsx("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)&&l.push(e.jsx("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)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e.jsx("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;l.push(e.jsx("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)?l.push(e.jsx("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)||l.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&l.push(e.jsx("path",{d:he((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.jsx("g",{className:"annotation-subject",children:l})}function ge(t,n,o,i,r,s){var l;const a=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,l=n-r;if(0!==s||0!==l){const t=Math.abs(s),n=Math.abs(l),a=e/2,d=o/2,h=t*d>n*a?a/t:d/n;c=i+s*h,u=r+l*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);c=Math.cos(o)*e,u=Math.sin(o)*e}}const d=Math.sqrt(Math.pow(t-c,2)+Math.pow(n-u,2));if(d>.5){const r=i||"var(--semiotic-text-secondary, currentColor)",s="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(s){const i=(null!==(l=null==o?void 0:o.curve)&&void 0!==l?l:.25)*d,s=(c+t)/2+-(n-u)/d*i,f=(u+n)/2+(t-c)/d*i;a.push(e.jsx("path",{className:"connector-curve",d:`M${c},${u}Q${s},${f} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(f-u,s-c)}else a.push(e.jsx("line",{x1:c,y1:u,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;a.push(e.jsx("path",{d:`M${c},${u}L${c+t*Math.cos(h+n)},${u+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${u+t*Math.sin(h-n)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e.jsx("g",{className:"annotation-connector",children:a})}function me(t){var n,o;const{x:i=0,y:r=0,dx:s,dy:l,nx:a,ny:c,note:u,connector:d,subject:h,type:f,color:p,className:g,disable:m,opacity:y,strokeDasharray:v,events:b={},"data-testid":x}=t,j=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,k=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,w=new Set(Array.isArray(m)?m:[]);let M=s||0,O=l||0;null!=a&&(M=a-j),null!=c&&(O=c-k);const S="string"==typeof f?f:"label";if("bracket"===S&&h&&0===M&&0===O)if(void 0!==h.width){M=h.width/2;const e=h.depth||30;O=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;M=e+(0>e?-5:5),O=h.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${j},${k})`,"data-testid":x},null!=y&&{opacity:y},v&&{strokeDasharray:v},b,{children:[!w.has("connector")&&ge(M,O,d,p,S,h),!w.has("subject")&&pe(S,h,p,j,k),!w.has("note")&&fe(u,M,O,p)]}))}function ye(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=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:l});return e.jsx(me,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e.jsx(me,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:s}),c)}function ve(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 be(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 xe(e){return null==e?null:e+""}function je(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function ke(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return je(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,s;const l=e.data;if(!l||0===l.length)return null;const a=l[l.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===(s=e.scales)||void 0===s?void 0:s.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 o?je(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return xe(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const s=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>xe(e.pointId)===r);if(s)return je(t,n,{x:s.x,y:s.y});const l=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return xe(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!l)return null;const a=ve(l,n),c=be(l,n);return null==a||null==c?null:je(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let s=null,l=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,l=t.y)}if(null!=s&&null!=l||(s=ve(e,n),l=be(e,n)),null!=s&&null!=l)return je(t,n,{x:s,y:l});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function we(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Me={secondary:0,primary:3};function Oe(e){return!0===(null==e?void 0:e._annotationDeferred)}function Se(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function Ae(e){var t;const n=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;return"number"==typeof n&&Number.isFinite(n)?Math.max(0,Math.min(1,n)):null}function Ce(e){return Math.max(.72,.95-.06*e)}const Pe={linear:l.curveLinear,monotoneX:l.curveMonotoneX,monotoneY:l.curveMonotoneY,step:l.curveStep,stepAfter:l.curveStepAfter,stepBefore:l.curveStepBefore,basis:l.curveBasis,cardinal:l.curveCardinal,catmullRom:l.curveCatmullRom};const Le=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function ze(e){return!!e&&"object"==typeof e&&Le.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function Re(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function De(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Ie(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}new Set(["label","callout","callout-circle","callout-rect"]);const $e=32,Ee=6,Ne=4,We=8,Be=72;const Te={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function _e(e){return ze(e)}function Fe(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function He(e,t,n,o,i){const r=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?s-i.height:s,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?s-i.height-4:s+4,width:i.width,height:i.height}}function qe(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Ge(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function Ve(e,t,n,o,i,r,s,l){const a=qe(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(a,i,r,l);for(const e of n)c+=12*Ge(a,e);for(const e of o)c+=4*Ge(a,e);return c}function Ue(e){var t;const{annotations:n,context:o,defaultOffset:i=$e,notePadding:r=Ee,markPadding:s=Ne,edgePadding:l=We,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=Be,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:p,cohesion:g,audience:m}=e,y=o.width||0,v=o.height||0;if(0===n.length||0>=y||0>=v)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,s);let j=!1;const k=n.map((e,t)=>{if(!_e(e))return e;const n=function(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const s=e.coordinates,l=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(s)&&s.length>=2&&l){const e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){const n=l([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?ke(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const s=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...Fe("string"==typeof e.title?e.title:void 0,t),...Fe("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return b.push(qe(He(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,s),r)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){const t=Ve(He(n.x,n.y,e.dx,e.dy,s),e,b,x,y,v,r,l);f>t&&(h=e,f=t)}if(!h)return e;const p=qe(He(n.x,n.y,h.dx,h.dy,s),r);b.push(p);const g=Math.hypot(h.dx,h.dy),m=c&&g>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return j=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),m?{connector:m}:{})}),w=j?k:n.slice();let M=w;if(f){let e=!1;const t=w.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});M=e?t:w}{let e=!1;const t=M.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=Te[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),s="string"==typeof e.label?e.label:"";return s.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:s?`${s} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});M=e?t:M}const O=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(m),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:De(y,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),s=De(o,i,e),l=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,ze(n))};var n}),a=l.filter(e=>e.note);if(0===a.length||s>=a.length)return{visible:n.slice(),deferred:[],budget:s};const c=a.filter(e=>Re(e.annotation)),u=a.filter(e=>!Re(e.annotation)).sort((e,t)=>Ie(t.annotation)-Ie(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,s-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],p=[];for(const{annotation:e,index:t,note:n}of l)!n||h.has(t)?f.push(e):p.push(e);return{visible:f,deferred:p,budget:s}}(Object.assign({annotations:M,width:y,height:v},o));for(const e of i)O.add(e)}if(p&&("object"==typeof p&&"number"==typeof p.minWidth?p.minWidth:480)>=y)for(const e of M)_e(e)&&"secondary"===e.emphasis&&O.add(e);if(O.size>0)for(const e of M)!0===(null==e?void 0:e.defensive)&&O.delete(e);let S;return S=0===O.size?M:h?M.map(e=>O.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):M.filter(e=>!O.has(e)),g?function(e,t){let n=!1;const o=e.map(e=>_e(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(S,g):S}let Ze={positions:new Map};const Ye=new Set;function Xe(){for(const e of Ye)e()}function Qe(e,t){const n=Ze.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Ze.positions);o.delete(e),Ze={positions:o},Xe()}function Ke(e,t){const n=Ze.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Ze.positions);o.delete(e),Ze={positions:o},Xe()}function Je(){return Ze}function et(e){return Ye.add(e),()=>Ye.delete(e)}const tt={positions:new Map};function nt(){return()=>{}}function ot(){return tt}function it(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,s=o instanceof Date?o.getTime():o,l=i instanceof Date?i.getTime():i;if(2>t||s===l)return r?[new Date(s),new Date(l)]:[s,l];const a=(l-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?l:s+e*a;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function rt(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function st(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function lt(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 at(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function ct(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 s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function ut(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function dt(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 ht(n){var o,i;const{width:r,height:a,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:g,axes:m,xLabel:y,yLabel:v,yLabelRight:b,xFormat:x,yFormat:j,axisExtent:k,showGrid:w,title:M,legend:O,legendHoverBehavior:S,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:L,legendPosition:z="right",legendLayout:R,foregroundGraphics:D,marginalGraphics:I,xValues:$,yValues:E,annotations:N,autoPlaceAnnotations:W,svgAnnotationRules:B,xAccessor:T,yAccessor:_,annotationData:F,pointNodes:H,curve:q,underlayRendered:G,canvasObscuresUnderlay:V=!0,linkedCrosshairName:U,linkedCrosshairSourceId:Z,children:Y}=n,X=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||x||ut,i=Math.max(2,Math.floor(r/70)),s=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:it(h.x,"exact"===k?Math.max(2,s):Math.min(s,i),k),a=l.map(e=>e.valueOf()),c=l.map((e,t)=>({value:e,pixel:h.x(e),label:o(e,t,a)})),u=c.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 f=dt(c,d);if(f.length>1&&(f=f.filter((e,t)=>0===t||e.label+""!=f[t-1].label+"")),(null==n?void 0:n.includeMax)&&f.length>0&&"exact"!==k&&!(null==n?void 0:n.tickValues)){const e=h.x.domain()[1],t=h.x(e),n=f[f.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,f.length,a);d>t-n&&f.length>1&&(f=f.slice(0,-1)),f.push({value:e,pixel:t,label:i})}}return f},[g,h,m,x,r,k]),Q=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||j||ut,i=Math.max(2,Math.floor(a/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let s=dt((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:it(h.y,"exact"===k?Math.max(2,r):Math.min(r,i),k)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22);if(s.length>1&&(s=s.filter((e,t)=>0===t||e.label+""!=s[t-1].label+"")),(null==n?void 0:n.includeMax)&&s.length>0&&"exact"!==k&&!(null==n?void 0:n.tickValues)){const e=h.y.domain()[1],t=h.y(e),n=s[s.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&s.length>1&&(s=s.slice(0,-1)),s.push({value:e,pixel:t,label:i})}}return s},[g,h,m,j,a,k]),K=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||j||ut,i=Math.max(2,Math.floor(a/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return dt((null!==(t=n.tickValues)&&void 0!==t?t:it(h.y,"exact"===k?Math.max(2,r):Math.min(r,i),k)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22)},[g,h,m,j,a,k]),J=t.useRef(new Map),ee=t.useRef(null!==(o=null==N?void 0:N.length)&&void 0!==o?o:0),te=null!==(i=null==N?void 0:N.length)&&void 0!==i?i:0;ee.current!==te&&(ee.current=te,J.current=new Map);const ne=t.useMemo(()=>{if(!N||0===N.length)return null;const t=function(t,n,o){var i,r,a,c,u,d,h,g,m,y,v,b,x,j,k,w,M,O,S,A,C,P,L,z,R,D,I,$,E,N,W,B,T,_,F,H,q,G,V,U,Z,Y,X,Q,K,J,ee,te,ne,oe,ie;switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const s=ke(t,n,o);if(!s)return null;const{x:l,y:c}=s;if(!we(l,c,o))return null;const u="callout"===t.type?"callout-circle":t.type,d="callout-circle"===u?{radius:null!==(i=t.radius)&&void 0!==i?i:12,radiusPadding:t.radiusPadding}:"callout-rect"===u?{width:t.width,height:t.height}:void 0;return e.jsx(ye,{noteData:Object.assign(Object.assign({x:l,y:c,dx:null!==(r=t.dx)&&void 0!==r?r:30,dy:null!==(a=t.dy)&&void 0!==a?a:-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:u},d?{subject:d}:{}),{connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className})},"ann-"+n)}case"x-threshold":{const i=ve(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let l;return l="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=be(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let l,a;return"left"===s?(l=4,a="start"):"center"===s?(l=(o.width||0)/2,a="middle"):(l=(o.width||0)-4,a="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:l,y:i-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:ve(Object.assign(Object.assign({},e),{type:"point"}),o),y:be(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=s.packEnclose(i),l=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+l,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-l-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:ve(Object.assign(Object.assign({},e),{type:"point"}),o),y:be(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),l=i.map(e=>e.y),a=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...l)-r,d=Math.max(...l)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:a,y:u,width:c-a,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(a+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=ve(n,o),l=be(n,o);if(null==r||null==l)return null;const a="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:l,r:a},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=ve(t,o),r=be(t,o);return e.jsx(ye,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",l="ordinal"===o.frameType,a="horizontal"===o.projection,f=l?r:null,v=l?s:null;let b;const x=[],j=new Map;if(l&&f&&v){for(const e of i){const t=e[f];if(null==t)continue;const n=t+"";j.has(n)||(j.set(n,x.length),x.push(n))}b=i.map(e=>{const t=e[f],n=e[v];if(null==t||null==n)return null;const o=j.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.time,w=null!==(g=null===(h=o.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(m=o.scales)||void 0===m?void 0:m.value;if(!k||!w)return null;const M=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},O=k,S=w;let A;if(l)if(a){const e=M(S);A=(t,n)=>[O(n),e(t)]}else{const e=M(O);A=(t,n)=>[e(t),S(n)]}else A=(e,t)=>[O(e),S(t)];const C=t.method||"linear";let P;P="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]),s=Math.max(2,Math.ceil(t*n)),l=[];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(s-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){l.push([t,r[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))l.push([t,h/u]);else{const e=(u*p-d*h)/g;l.push([t,(h-e*d)/u+e*t])}}return l}(b,null!==(y=t.bandwidth)&&void 0!==y?y:.3):("polynomial"===C?p.default.polynomial(b,{order:t.order||2}):p.default.linear(b)).points;const L=P.map(([e,t])=>{const[n,o]=A(e,t);return`${n},${o}`}).join(" "),z=t.color||"#6366f1",R=P[P.length-1],[D,I]=A(R[0],R[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:L,fill:"none",stroke:z,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:D+4,y:I-4,fill:z,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(b=null===(v=o.scales)||void 0===v?void 0:v.y)&&void 0!==b?b:null===(x=o.scales)||void 0===x?void 0:x.value,r=null!==(j=null==i?void 0:i(t.y0))&&void 0!==j?j:0,s=null!==(k=null==i?void 0:i(t.y1))&&void 0!==k?k:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",s=null!==(M=null===(w=o.scales)||void 0===w?void 0:w.x)&&void 0!==M?M:null===(O=o.scales)||void 0===O?void 0:O.time,a=null!==(A=null===(S=o.scales)||void 0===S?void 0:S.y)&&void 0!==A?A:null===(C=o.scales)||void 0===C?void 0:C.value;if(!s||!a)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const f=Pe[o.curve||"linear"]||l.curveLinear,p=l.area().x(e=>s(e[r])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!p)return null;const g=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:p,fill:g,fillOpacity:null!==(P=t.fillOpacity)&&void 0!==P?P:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:s(h[h.length-1][r])+4,y:a(h[h.length-1][c])-4,fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(z=null===(L=o.scales)||void 0===L?void 0:L.x)&&void 0!==z?z:null===(R=o.scales)||void 0===R?void 0:R.time,l=null!==(I=null===(D=o.scales)||void 0===D?void 0:D.y)&&void 0!==I?I:null===($=o.scales)||void 0===$?void 0:$.value;if(!s||!l)return null;const a=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,d=Math.sqrt(u),h=null!==(E=t.threshold)&&void 0!==E?E:2,f=c-h*d,p=!1!==t.showBand,g=t.fill||"#6366f1",m=null!==(N=t.fillOpacity)&&void 0!==N?N:.1,y=t.anomalyColor||"#ef4444",v=null!==(W=t.anomalyRadius)&&void 0!==W?W:6,b=l(c+h*d),x=l(f),j=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[p&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:g,fillOpacity:m}),j.map((t,n)=>{const i=ve(t,o),r=be(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",l=null!==(T=null===(B=o.scales)||void 0===B?void 0:B.x)&&void 0!==T?T:null===(_=o.scales)||void 0===_?void 0:_.time,a=null!==(H=null===(F=o.scales)||void 0===F?void 0:F.y)&&void 0!==H?H:null===(q=o.scales)||void 0===q?void 0:q.value;if(!l||!a)return null;const c=i.map(e=>[e[r],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>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=p.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)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 s=(e*i-t*n)/r,l=(n-s*t)/e;u=e=>l+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),g=c.reduce((e,t)=>e+t[0],0)/d,m=c.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),y=null!==(G=t.confidence)&&void 0!==G?G:.95,v=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=null!==(V=t.steps)&&void 0!==V?V:5,x=c[d-1][0],j=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*j);const w=[];for(const e of k){const t=u(e),n=f*Math.sqrt(1+1/d+(m>0?Math.pow(e-g,2)/m:0))*v;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const M=`M${w.map(e=>`${l(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${l(e.x)},${a(e.yLower)}`).join(" L")} Z`,O=w.map(e=>`${l(e.x)},${a(e.yCenter)}`).join(" "),S=`${l(x)},${a(u(x))}`,A=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:M,fill:t.fill||"#6366f1",fillOpacity:null!==(U=t.fillOpacity)&&void 0!==U?U:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:A,strokeWidth:null!==(Z=t.strokeWidth)&&void 0!==Z?Z:2,strokeDasharray:null!==(Y=t.strokeDasharray)&&void 0!==Y?Y:"6,3"}),t.label&&w.length>0&&e.jsx("text",{x:l(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:A,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=ke(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!we(i,r,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,l=null!==(Q=t.dy)&&void 0!==Q?Q:0,a=null!==(K=t.width)&&void 0!==K?K:32,c=null!==(J=t.height)&&void 0!==J?J:32,u=null!==(ee=t.content)&&void 0!==ee?ee:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-a/2,y:r+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=ke(t,n,o);if(!i)return null;const{x:r,y:s}=i,l=r+(t.dx||0),a=s+(t.dy||0),c=t.color||"var(--semiotic-text, #333)",u=e.jsx("text",{x:l,y:a,fill:c,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?f.cloneElement(u,{key:"ann-text-"+n}):e.jsxs("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[e.jsx("line",{x1:r,y1:s,x2:l,y2:a,stroke:c,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),f.cloneElement(u,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(te=o.scales)||void 0===te?void 0:te.o,l=null===(ne=o.scales)||void 0===ne?void 0:ne.x,a=null===(oe=o.scales)||void 0===oe?void 0:oe.y,c=r(s)?s:r(l)?l:r(a)?a:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",f=null!==(ie=t.opacity)&&void 0!==ie?ie:.15,p=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===l)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+n)}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:T,yAccessor:_,width:r,height:a,data:F,frameType:"xy",pointNodes:H,curve:q,stickyPositionCache:J.current};return function(t,n,o,i){const r=[];return t.forEach((e,t)=>{let s;if(o){const r=o(e,t,i);s=null!=r?r:n(e,t,i)}else s=n(e,t,i);s&&r.push({node:s,annotation:e})}),function(t){const n=t.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===(null==n?void 0:n.emphasis)||"secondary"===(null==n?void 0:n.emphasis)?n.emphasis:null),confidence:Ae(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>Oe(e.annotation)),r=t.some(e=>null!=Se(e.annotation)),s=t.some(e=>"layer"===Se(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const l=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});l.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,l.length)});for(const e of n)e.emphasis&&(e.rank=Me[e.emphasis]);const a=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,s=Oe(n.annotation);let l=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;l=e.jsx("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:Ce(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const a=Se(n.annotation);return a&&(l=e.jsx("g",{className:"annotation-cohesion--"+a,children:l},"annotation-cohesion-"+o)),s&&(l=e.jsx("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:l},"annotation-deferred-"+o)),l});return i&&a.unshift(e.jsx("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),s&&a.unshift(e.jsx("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(W?Ue(Object.assign({annotations:N,context:n},"object"==typeof W?W:{})):N,t,B,n)},[N,W,B,r,a,T,_,F,h,H,q]),oe=function(e){var n;const o=t.useSyncExternalStore(e?et:nt,e?Je:ot,e?Je:ot);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}(U);return t.useEffect(()=>{if(!(null==oe?void 0:oe.locked)||!U)return;const e=e=>{"Escape"===e.key&&Ke(U)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,U]),g||M||O||D||I||ne&&ne.length>0||w||Y||oe?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof M?M:"XY Chart"}),e.jsx("desc",{children:"string"==typeof M?M+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[w&&h&&(!G||V)&&(()=>{var t,n;const o=at(null===(t=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=at(null===(n=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[X.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:a,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),Q.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),g&&h&&(()=>{const t=null==m?void 0:m.find(e=>"left"===e.orient),n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,s=(null==t?void 0:t.jaggedBase)||!1,l=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",g=!!(null==n?void 0:n.autoRotate)&&X.length>1&&(()=>{const e=r/Math.max(X.length-1,1);return X.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x={fontSize:"var(--semiotic-tick-font-size, 12px)"},j={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},k={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},w=null==n?void 0:n.tickAnchor,M=null==t?void 0:t.tickAnchor,O=lt(X),S=lt(Q);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!G||V)&&i&&!l&&e.jsx("line",{x1:0,y1:a,x2:r,y2:a,stroke:h,strokeWidth:1}),(!G||V)&&l&&e.jsx("path",{d:ct("bottom",r,a),fill:"none",stroke:h,strokeWidth:1}),X.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):P(t.value,n>0?X[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${a})`,children:[e.jsx("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:g?10:18,textAnchor:g?"end":rt(w,t.pixel===O.min,t.pixel===O.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:x),transform:g?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},x),children:t.label})})]},"xtick-"+n)}),y&&e.jsx("text",{x:r/2,y:a+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:y})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!G||V)&&o&&!s&&e.jsx("line",{x1:0,y1:0,x2:0,y2:a,stroke:h,strokeWidth:1}),(!G||V)&&s&&e.jsx("path",{d:ct("left",r,a),fill:"none",stroke:h,strokeWidth:1}),Q.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):P(t.value,n>0?Q[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:st(M,t.pixel===S.min,t.pixel===S.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:x),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},x),children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||v;return n?e.jsx("text",{x:15-d.left,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-d.left}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:n}):null})()]}),(()=>{const t=null==m?void 0:m.find(e=>"right"===e.orient);if(!t||0===K.length)return null;const n=!1!==t.baseline,o=t.landmarkTicks,i=t.label||b,s=t.tickAnchor,l=lt(K);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&e.jsx("line",{x1:r,y1:0,x2:r,y2:a,stroke:h,strokeWidth:1}),K.map((t,n)=>{const i=!!o&&("function"==typeof o?o(t.value,n):P(t.value,n>0?K[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:st(s,t.pixel===l.min,t.pixel===l.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?j:x),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},x),children:t.label})})]},"ytick-r-"+n)}),i&&e.jsx("text",{x:r+d.right-15,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${r+d.right-15}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:i})]})})()]})})(),ne,I&&h&&$&&E&&e.jsxs(e.Fragment,{children:[I.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ue,{orient:"top",config:ce(I.top),values:$,scale:h.x,size:d.top,length:r})}),I.bottom&&e.jsx("g",{transform:`translate(0, ${a})`,children:e.jsx(ue,{orient:"bottom",config:ce(I.bottom),values:$,scale:h.x,size:d.bottom,length:r})}),I.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ue,{orient:"left",config:ce(I.left),values:E,scale:h.y,size:d.left,length:a})}),I.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(ue,{orient:"right",config:ce(I.right),values:E,scale:h.y,size:d.right,length:a})})]}),D,oe&&oe.sourceId!==Z&&(null==h?void 0:h.x)&&(()=>{const t=h.x(oe.xValue);if(null==t||0>t||t>r)return null;const n=oe.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:a,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Y]}),M&&e.jsx("text",{x:c/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}),ae({legend:O,totalWidth:c,totalHeight:u,margin:d,legendPosition:z,title:M,legendLayout:R,legendHoverBehavior:S,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:L})]}):null}function ft(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const pt="undefined"==typeof window||"undefined"==typeof document,gt="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,mt=()=>()=>{},yt=()=>!1,vt=()=>!0;function bt(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 xt(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 jt(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 kt=f.createContext(null),wt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Mt(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"],s=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 s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const Ot=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function St(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}const At="semiotic-accessible-data-table",Ct=At+" semiotic-accessible-data-table-hidden",Pt=At+" semiotic-accessible-data-table-visible",Lt={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"},zt={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Rt={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)"},Dt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},It={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))"},$t={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Et={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Nt={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function Wt({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,l]=f.useState(!1),[a,c]=f.useState(5),u=f.useContext(kt),d=null!==(r=null==u?void 0:u.visible)&&void 0!==r&&r,h=s||d,p=f.useRef(null),g=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n;f.useEffect(()=>{h||c(5)},[h]);const m=f.useCallback(e=>{e.target===e.currentTarget&&(s||d||l(!0))},[s,d]),y=f.useCallback(e=>{var t;d||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||l(!1)},[d]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:wt}):null;if(!h)return e.jsx("div",{id:o,className:Ct,tabIndex:-1,onFocus:m,style:wt,role:"region","aria-label":g,children:e.jsxs("button",{type:"button",onClick:()=>l(!0),children:["View data summary (",t.length," elements)"]})});const v=function(e){var t,n,o,i,r,s,l,a,c,u,d,h,f,p,g,m,y;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:St(x.datum)});break;case"line":case"area":{const e=Array.isArray(x.datum)?x.datum:[],t="line"===x.type?"Line point":"Area point";for(const n of e)v.push({label:t,values:St(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":{const e=St(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(a=null!==(s=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(l=x.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:St(x.datum)});break;case"arc":v.push({label:"Arc",values:St(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:St(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(g=null!==(f=null===(h=null===(d=x.datum)||void 0===d?void 0:d.properties)||void 0===h?void 0:h.name)&&void 0!==f?f:null===(p=x.datum)||void 0===p?void 0:p.name)&&void 0!==g?g:"",value:null!==(y=null===(m=x.datum)||void 0===m?void 0:m.value)&&void 0!==y?y:""}})}}catch(e){}return v}(t),b=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],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),x=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Ot(e.min)} to ${Ot(e.max)}, mean ${Ot(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,b),j=Math.min(a,v.length),k=v.slice(0,j),w=v.length-j,M=new Set;for(const e of k)for(const t of Object.keys(e.values))M.add(t);const O=Array.from(M);return e.jsxs("div",{ref:p,id:o,className:Pt,tabIndex:-1,onBlur:y,style:Lt,role:"region","aria-label":g,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),l(!1)},"aria-label":"Close data summary",style:Rt,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:zt,children:x}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:Dt,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:Et,children:w>0?`First ${j} of ${v.length} data points`:`All ${v.length} data points`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:It,children:"type"}),O.map(t=>e.jsx("th",{style:It,children:t},t))]})}),e.jsx("tbody",{children:k.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:$t,children:t.label}),O.map(n=>{return e.jsx("td",{style:$t,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ot(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]}),w>0&&e.jsxs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>c(e=>e+25),style:Nt,children:["Show ",Math.min(25,w)," more"," ",1===w?"row":"rows"," (",w," remaining)"]})]})}function Bt({summary:t}){return t?e.jsx("div",{role:"note",style:wt,children:t}):null}function Tt({tableId:t}){return e.jsx("a",{href:"#"+t,style:wt,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,wt)},children:"Skip to data table"})}function _t({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:wt,children:n})}const Ft=Object.freeze([]);function Ht(e){if(!e)return Ft;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}const qt="var(--semiotic-focus, #005fcc)";function Gt({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:l}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=l){const t=Math.max(s,4),n=Math.max(l,4);u=e.jsx("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.jsx("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.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}const Vt={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Ut(e,t){return"function"==typeof t?t(e):e[t]}function Zt(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 Yt(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let l;const a=[];if(o){const e=Ut(t,o);l=Zt(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=Ut(t,o);a.push({label:n,value:Zt(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){l=Zt(t[n],i);break}if(!l){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(l=Zt(t[e[0]],i))}}const c=Object.assign(Object.assign({},Vt),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[l&&e.jsx("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:l}),a.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Xt(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 s=n(i);return null==s?null:e.jsx("div",{className:"semiotic-tooltip",style:Vt,children:s})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Yt(t):Yt())}}function Qt({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:l="stream-frame-tooltip",zIndex:a=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=f.useRef(null),[d,h]=f.useState(null);f.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,l,o,i]);let p;p=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const g=function(e){if(!f.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 o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(s),m=g?null:Vt;return c?e.jsx("div",{ref:u,className:g?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},m||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:p,pointerEvents:"none",zIndex:a,width:"max-content"}),children:s}):null}function Kt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Jt(e,t,n=.6){var o,i,r,s,l;if(!Kt(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!==(l=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==l?l: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 en(e,t,n,o=.35){Kt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function tn(e){switch(e){case"monotoneX":return l.curveMonotoneX;case"monotoneY":return l.curveMonotoneY;case"cardinal":return l.curveCardinal;case"catmullRom":return l.curveCatmullRom;case"step":return l.curveStep;case"stepBefore":return l.curveStepBefore;case"stepAfter":return l.curveStepAfter;case"basis":return l.curveBasis;case"natural":return l.curveNatural;default:return null}}function nn(e,t,n){return null==t?n:"string"!=typeof t?t:X(e,t)||n}function on(e,t,n,o,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const l=e.createLinearGradient(n,o,i,r);for(const e of s)l.addColorStop(e.offset,e.color);return l}function rn(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function sn(e,t,n,o,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const l=s[s.length-1];if(0===l)return;const a=Math.min(.2*l,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;a>o&&(r*=o/a),a>l-o&&(r*=(l-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 ln(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,l=t[0]+"px",a=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function an(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function cn([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function un(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 dn{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 hn{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 s=n[r.lineIndex];if(!s||2>s.length){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const l=fn(s),a=pn(s,r.t*l),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 fn(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 pn(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],s=Math.sqrt(i*i+r*r);if(n+s>=t||o===e.length-1){const l=s>0?(t-n)/s:0,a=s>.001?s:1;return{x:e[o-1][0]+i*l,y:e[o-1][1]+r*l,nx:-r/a,ny:i/a}}n+=s}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const gn={top:10,right:10,bottom:10,left:10},mn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"},yn={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function vn(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function bn(e){return e?e.getContext("2d"):null}function xn({data:t}){if(!t)return null;if(t.properties)return e.jsx("div",{className:"semiotic-tooltip",style:mn,children:e.jsx("div",{style:{fontWeight:600},children:t.properties.name||t.properties.NAME||t.properties.id||"Feature"})});const n=null!=t.data?t.data:t;if(!n||"object"!=typeof n)return null;const o=Object.entries(n).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return 0===o.length?null:e.jsx("div",{className:"semiotic-tooltip",style:mn,children:o.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),e.jsx("span",{style:{fontWeight:600},children:n+""})]},t))})}xn.ownsChrome=!0;const jn=t.forwardRef(function(n,o){var i,r,s,a,d,h,f,p,g,m;const{projection:y,projectionExtent:v,fitPadding:b,projectionTransform:x,areas:j,points:k,lines:w,xAccessor:M,yAccessor:O,lineDataAccessor:A,pointIdAccessor:C,lineIdAccessor:P,lineType:z="geo",flowStyle:R="basic",graticule:D,zoomable:$,zoomExtent:E,onZoom:N,dragRotate:W,showParticles:B,particleStyle:T,tileURL:_,tileAttribution:F,tileCacheSize:H,size:q,width:G,height:V,responsiveWidth:U,responsiveHeight:Z,margin:Y,className:Q,background:K,areaStyle:ee,pointStyle:te,lineStyle:ne,colorScheme:oe,enableHover:ie=!0,hoverAnnotation:re,tooltipContent:se,customClickBehavior:le,customHoverBehavior:ae,annotations:ce,autoPlaceAnnotations:ue,decay:de,pulse:he,transition:fe,animate:pe,staleness:ge,backgroundGraphics:me,foregroundGraphics:ye,title:ve,legend:be,legendPosition:xe,legendLayout:je,legendHoverBehavior:ke,legendClickBehavior:we,legendHighlightedCategory:Me,legendIsolatedCategories:Oe,legendCategoryAccessor:Se,onCategoriesChange:Ae,showAxes:Ce,accessibleTable:Pe=!0,description:Le,summary:ze}=n,Re=q||[G||600,V||400],De=t.useRef(!0),Ie=J({sizeProp:Re,responsiveWidth:U,responsiveHeight:Z,userMargin:Y,marginDefault:gn,foregroundGraphics:ye,backgroundGraphics:me,animate:pe,transitionProp:fe,themeDirtyRef:De}),{reducedMotionRef:$e,responsiveRef:Ee,size:Ne,margin:We,adjustedWidth:Be,adjustedHeight:Te,resolvedForeground:_e,resolvedBackground:Fe,transition:He,introEnabled:qe,tableId:Ge,rafRef:Ve,renderFnRef:Ue,scheduleRender:Ze,currentTheme:Ye}=Ie,Xe=function(){const[e,n]=t.useState(!1);return gt(()=>{n(!0)},[]),e}(),Qe=function(){const e=t.useSyncExternalStore(mt,yt,vt);return t.useRef(e).current}(),Ke=t.useMemo(()=>Array.isArray(j)?Ht(j):j,[j]),Je=t.useMemo(()=>Ht(k),[k]),et=t.useMemo(()=>Ht(w),[w]),tt=t.useMemo(()=>null!=W?W:"orthographic"===vn(y),[W,y]),nt=t.useMemo(()=>{var e,t;return{projection:y,projectionExtent:v,fitPadding:b,xAccessor:M,yAccessor:O,lineDataAccessor:A,lineType:z,flowStyle:R,areaStyle:ee,pointStyle:te,lineStyle:ne,colorScheme:oe,themeSemantic:I(Ye),themeSequential:null===(e=null==Ye?void 0:Ye.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==Ye?void 0:Ye.colors)||void 0===t?void 0:t.diverging,graticule:D,projectionTransform:x,decay:de,pulse:he,transition:He,introAnimation:qe,annotations:ce,pointIdAccessor:C,lineIdAccessor:P}},[y,v,b,M,O,A,z,R,ee,te,ne,oe,D,x,de,he,null==He?void 0:He.duration,null==He?void 0:He.easing,qe,ce,C,P,Ye]),ot=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return xt(e,t);if(!jt(e)||!jt(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(!xt(n,i))return!1}else{if(!jt(n)||!jt(i))return!1;if(!bt(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(nt),it=t.useRef(null);it.current||(it.current=new S(ot));const rt=t.useRef(null),st=t.useRef(null),lt=t.useRef(null),at=t.useRef(null),ct=t.useRef(null);_&&!ct.current&&(ct.current=new dn(H||256));const ut=t.useRef(ce),dt=t.useRef(null),kt=t.useRef(c.zoomIdentity),wt=t.useRef(!1),Ot=t.useRef(null),St=t.useCallback(e=>{Ot.current=e,Ee&&"object"==typeof Ee&&(Ee.current=e)},[Ee]),At=t.useRef(null),Ct=t.useRef(null),Pt=t.useRef(null),Lt=t.useRef(0);if(B&&!Pt.current){const e=null!==(i=null==T?void 0:T.maxPerLine)&&void 0!==i?i:30;Pt.current=new hn(50*e)}const zt=t.useRef(null),Rt=t.useRef(null),[Dt,It]=t.useState(null),[$t,Et]=t.useState(0),[Nt,Ft]=t.useState(!1),qt=t.useRef([]),Vt=t.useRef(Se),Ut=t.useRef(Ae);Vt.current=Se,Ut.current=Ae;const Zt=t.useCallback(()=>{var e,t;const n=Vt.current,o=Ut.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=it.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))},[]);t.useEffect(()=>{var e;null===(e=it.current)||void 0===e||e.updateConfig(ot),De.current=!0,Ze()},[ot,Ze]),t.useEffect(()=>{const e=it.current;e&&(Ke&&e.setAreas(Ke),k&&e.setPoints(Je),w&&e.setLines(et),De.current=!0,Ze())},[Ke,k,Je,w,et,Ze]);const Yt=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=it.current)||void 0===t||t.pushPoint(e),De.current=!0,Ze())},[Ze]),Xt=t.useCallback(e=>{var t;const n=Ht(e);0!==n.length&&(null===(t=it.current)||void 0===t||t.pushMany(n),De.current=!0,Ze())},[Ze]),Kt=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=it.current)||void 0===t||t.pushLine(e),De.current=!0,Ze())},[Ze]),fn=t.useCallback(e=>{var t;const n=Ht(e);0!==n.length&&(null===(t=it.current)||void 0===t||t.pushManyLines(n),De.current=!0,Ze())},[Ze]),pn=t.useCallback(()=>{var e;null===(e=it.current)||void 0===e||e.clear(),De.current=!0,Ze()},[Ze]);t.useImperativeHandle(o,()=>({push:Yt,pushMany:Xt,removePoint:e=>{var t,n;const o=null!==(n=null===(t=it.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(De.current=!0,Ze()),o},pushLine:Kt,pushManyLines:fn,removeLine:e=>{var t,n;const o=null!==(n=null===(t=it.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[];return o.length>0&&(De.current=!0,Ze()),o},getLines:()=>{var e,t;return null!==(t=null===(e=it.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]},clear:pn,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=it.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=it.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=it.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>kt.current.k,resetZoom:()=>{const e=Ot.current;e&&dt.current&&u.select(e).call(dt.current.transform,c.zoomIdentity)},getData:()=>{var e,t;return null!==(t=null===(e=it.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[Yt,Xt,Kt,fn,pn,Ze]);const{hoverHandlerRef:mn,onPointerMove:jn,onPointerLeave:kn}=Ie;t.useEffect(()=>{mn.current=e=>{if(!ie)return;const t=it.current;if(!t||!t.scene.length)return;const n=st.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-We.left,r=e.clientY-o.top-We.top;if(0>i||i>Be||0>r||r>Te)return zt.current=null,Rt.current=null,It(null),null==ae||ae(null),void Ze();at.current||(at.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=bn(at.current);if(!s)return;const l=L(t.scene,i,r,30,s,t.quadtree,t.maxPointRadius);if(l){const e=l.node,t=e.datum,n=Array.isArray(t)?null:(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,s;"point"===e.type?(o=e.x,s=e.y):"geoarea"===e.type?(o=e.centroid[0],s=e.centroid[1]):(o=i,s=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:s});zt.current=a,Rt.current=e,It(a),null==ae||ae(a),Ze()}else zt.current&&(zt.current=null,Rt.current=null,It(null),null==ae||ae(null),Ze())}},[ie,Be,Te,We,ae,Ze]),Ie.hoverLeaveRef.current=()=>{zt.current=null,Rt.current=null,It(null),null==ae||ae(null),Ze()};const wn=t.useCallback(e=>{if(!le)return;const t=it.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-We.left,i=e.clientY-n.top-We.top;at.current||(at.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=bn(at.current);if(!r)return;const s=L(t.scene,o,i,30,r,t.quadtree,t.maxPointRadius);if(s){const e=s.node.datum,t=Array.isArray(e)?null:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;le(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i}))}},[le,We]),Mn=t.useRef(-1),On=t.useRef(null),Sn=t.useCallback(e=>{const t=it.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=Mn.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 Mn.current=-1,On.current=null,zt.current=null,Rt.current=null,It(null),null==ae||ae(null),void Ze();const r=0>o?0:i;Mn.current=r;const s=n[r];On.current={shape:s.shape,w:s.w,h:s.h};const l=s.datum,a=Object.assign(Object.assign(Object.assign({},l||{}),(null==l?void 0:l.properties)||{}),{data:l,properties:null==l?void 0:l.properties,x:s.x,y:s.y,__semioticHoverData:!0});zt.current=a,It(a),null==ae||ae(a),Ze()},[ae,Ze]),An=t.useCallback(e=>{Mn.current=-1,On.current=null,jn(e)},[jn]);Ue.current=()=>{var e,t,n,o,i,r,s,a;Ve.current=0;const c=st.current,u=it.current;if(!c||!u)return;const d=performance.now();let h=!1;const f=Ct.current;f&&(Ct.current=null,u.applyRotation(f,{width:Be,height:Te}));const p=u.advanceTransition($e.current?d+1e6:d),g=!$e.current&&p;if(De.current&&!p){const e={width:Be,height:Te},t=tt?u.getRotation():null;u.computeScene(e);const n=kt.current,o=1!==n.k||0!==n.x||0!==n.y;tt&&t?o?(u.setRotation(t),u.applyZoomScale(n.k,e)):u.applyRotation(t,e):o&&u.applyZoomTransform(n,e),De.current=!1,c.setAttribute("aria-label",Mt(u.scene,"Geographic chart")),Zt()}const m=an();if(_&&ct.current){const t=rt.current;if(t&&(null===(e=u.scales)||void 0===e?void 0:e.projection)){const e=ln(t,Ne,We,m);if(e){e.clearRect(-We.left,-We.top,Ne[0],Ne[1]),e.save(),e.beginPath(),e.rect(0,0,Be,Te),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:i,height:r,tileCache:s,onTileLoad:l}=t,a=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:i=!0,clampY:r=!0}=e,s=Math.max(Math.log(n)/Math.LN2-8,0),l=Math.round(s),a=1<<l,c=Math.pow(2,s-l+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)),m=[];for(let e=p;g>e;++e)for(let t=h;f>t;++t)m.push([t,e,l]);return{tiles:m,translate:[u/c,d/c],scale:c}}({size:[i,r],scale:2*a*Math.PI,translate:c}),d=an();let h=!0;for(const t of u.tiles){const[o,i,r]=cn(t),a=`${r}/${o}/${i}`;let c=s.get(a);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:a,lastUsed:performance.now()};s.set(a,t),e.onload=()=>{t.loaded=!0,null==l||l()},e.onerror=()=>{t.loaded=!0},e.src=un(n,r,o,i,d),c=t}if(!c.loaded){h=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return h}(e,{tileURL:_,projection:u.scales.projection,width:Be,height:Te,tileCache:ct.current,onTileLoad:()=>Ze()});e.restore(),t||(h=!0)}}}const y=ln(c,Ne,We,m);if(!y)return;if(y.clearRect(-We.left,-We.top,Ne[0],Ne[1]),K&&!_){const e=X(y,K);e&&(y.fillStyle=e,y.fillRect(0,0,Be,Te))}y.save(),y.beginPath(),y.rect(0,0,Be,Te),y.clip();const v=u.scene,b={width:Be,height:Te};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),s=t.style.fill||"#e0e0e0";if("none"!==s&&(e.fillStyle=s,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=X(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)}en(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(y,v),((e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const c=a._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=a.style.stroke||"#007bff",d=X(e,u)||u,h=a.style.strokeWidth||2,f=a.colorThresholds,p=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=h,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;sn(e,a.path,d,h,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=tn(a.curve),m=f&&f.length>0&&p&&p.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!m){e.strokeStyle=d;const b=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(y[x]+y[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(m){let j=null,k=null,w=null,M=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function A(){O&&(e.stroke(),O=!1)}for(let C=0;a.path.length>C;C++){const[P,L]=a.path[C],z=p[C],R=rn(z,f,d);if(null!==j&&null!==M&&null!==w){if(R===M)e.lineTo(P,L);else{const D=[];for(const I of f){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 E of D){const N=j+(P-j)*E.t,W=k+(L-k)*E.t,B=rn(w+(z-w)*Math.min(E.t+1e-4,1),f,d);e.lineTo(N,W),A(),S(B,N,W)}e.lineTo(P,L)}j=P,k=L,w=z,M=R}else S(R,P,L),j=P,k=L,w=z,M=R}A()}else{e.beginPath();const T=a.strokeGradient&&a.path.length>=2?on(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=T||d,g)l.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[_,F]=a.path[0];e.moveTo(_,F);for(let H=1;a.path.length>H;H++)e.lineTo(a.path[H][0],a.path[H][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=nn(e,a.style.fill,a.style.fill),g&&!m)l.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[G,V]=a.path[0];e.moveTo(G,V);for(let U=1;a.path.length>U;U++)e.lineTo(a.path[U][0],a.path[U][1])}const q=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(q,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(y,v,0,b),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=nn(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=nn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),Jt(e,t),e.globalAlpha=1}}finally{e.restore()}}})(y,v),B&&Pt.current){const e=Pt.current,l=v.filter(e=>"line"===e.type);if(l.length>0){const a=T||{},c=.3*(null!==(t=a.speedMultiplier)&&void 0!==t?t:1),u=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=d/1e3,v=Lt.current>0?Math.min(m-Lt.current,.1):.016;Lt.current=m;const b=l.map(e=>e.path),x=l.map(e=>e.style.strokeWidth||2);for(let t=0;l.length>t;t++)Math.random()<f&&e.countForLine(t)<u&&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=l[n.lineIndex],i="function"==typeof a.color?a.color(null!==(s=null==o?void 0:o.datum)&&void 0!==s?s:{}):"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,h=!0}}y.restore();const x=lt.current;if(x){const e=ln(x,Ne,We,m);if(e){e.clearRect(-We.left,-We.top,Ne[0],Ne[1]);const t=Rt.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof re?re:void 0,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(ge){const e=performance.now()-u.lastIngestTime>(null!==(a=ge.threshold)&&void 0!==a?a:5e3);e!==Nt&&Ft(e)}const j=ce!==ut.current;j&&(ut.current=ce),(De.current||j)&&Et(e=>e+1),(g||null!=u.activeTransition||u.hasActivePulses||h)&&(Ve.current=requestAnimationFrame(()=>Ue.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:l}=e;gt(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[n,o]);const a=t.useRef(l);a.current=l,t.useEffect(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:Xe,wasHydratingFromSSR:Qe,storeRef:it,dirtyRef:De,renderFnRef:Ue,cleanup:()=>{var e;return null===(e=ct.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{De.current=!0,Ze()},[Be,Te,K,Ze]),function(e,n,o,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const l=n.current;if(!l||0===l.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=a-l.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(ge,it,De,Ze,Nt,Ft),t.useEffect(()=>{if("production"!==process.env.NODE_ENV&&_){const e=vn(y);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.`)}},[_,y]),t.useEffect(()=>{const e=Ot.current;if(!$||!e)return dt.current&&e&&(u.select(e).on(".zoom",null),dt.current=null),void(e&&u.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=E||[1,8],o={width:Be,height:Te};if(tt){let i=kt.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),kt.current=c.zoomIdentity.scale(i);const s=it.current;s&&(s.applyZoomScale(i,o),De.current=!1,Ze(),(null===(r=s.scales)||void 0===r?void 0:r.projection)&&(null==N||N({projection:s.scales.projection,zoom:s.currentZoom})))};dt.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 s=e=>{e.preventDefault(),r(i*(0>e.deltaY?1.1:1/1.1))},l=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),r(1.5*i))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",l);const a=.4,u=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=it.current;if(!o)return;const i=o.getRotation();At.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=At.current;t&&(Ct.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]],Ze())},h=t=>{var n;if(!At.current)return;At.current=null,e.releasePointerCapture(t.pointerId);const i=Ct.current;if(i){Ct.current=null;const e=it.current;e&&(e.applyRotation(i,o),Ze())}const r=it.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",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",l),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),dt.current=null}}const i=c.zoom().scaleExtent([t,n]).extent([[0,0],[Ne[0],Ne[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;kt.current=t,wt.current=!0;const n=it.current;n&&(n.applyZoomTransform(t,o),De.current=!1,Ze())}).on("end",e=>{var t;kt.current=e.transform,wt.current=!1;const n=it.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 dt.current=i,u.select(e).call(i),()=>{u.select(e).on(".zoom",null)}},[$,E,tt,Ne,Be,Te,We,N,Ze]);const Cn=ie&&!1!==re,Pn=Cn&&Dt?se?se(Dt):e.jsx(xn,{data:Dt}):null,Ln=Pn?e.jsx(Qt,{x:Dt.x,y:Dt.y,containerWidth:Be,containerHeight:Te,margin:We,className:"stream-frame-tooltip",zIndex:10,children:Pn}):null;if(pt||!Xe&&Qe){const t=it.current;t&&(Ke||k||w)&&(Ke&&t.setAreas(Ke),k&&t.setPoints(Je),w&&t.setLines(et),t.computeScene({width:Be,height:Te}));const n=null!==(r=null==t?void 0:t.scene)&&void 0!==r?r:[];return e.jsxs("div",{ref:St,className:"stream-geo-frame"+(Q?" "+Q:""),role:"img","aria-label":Le||("string"==typeof ve?ve:"Geographic chart"),style:{position:"relative",width:U?"100%":Ne[0],height:Z?"100%":Ne[1]},children:[e.jsx(Bt,{summary:ze}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ne[0],height:Ne[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${We.left},${We.top})`,children:Fe}),e.jsxs("g",{transform:`translate(${We.left},${We.top})`,children:[K&&e.jsx("rect",{x:0,y:0,width:Be,height:Te,fill:K}),n.map((t,n)=>function(t,n){var o,i,r,s,l,a;switch(t.type){case"geoarea":{const r=t;return r.pathData?e.jsx("path",{d:r.pathData,fill:ft(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.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:ft(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(s=o._decayOpacity)&&void 0!==s?s:null!==(l=o.style.opacity)&&void 0!==l?l: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.jsx("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.jsx(ht,{width:Be,height:Te,totalWidth:Ne[0],totalHeight:Ne[1],margin:We,scales:null,showAxes:!1,title:ve,legend:be,legendPosition:xe,legendLayout:je,legendHoverBehavior:ke,legendClickBehavior:we,legendHighlightedCategory:Me,legendIsolatedCategories:Oe,foregroundGraphics:_e,annotations:ce,autoPlaceAnnotations:ue,annotationFrame:0,xValues:[],yValues:[],pointNodes:n.filter(e=>"point"===e.type)})]})}return e.jsxs("div",{ref:St,className:"stream-geo-frame"+(Q?" "+Q:""),role:"group","aria-label":Le||("string"==typeof ve?ve:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:U?"100%":Ne[0],height:Z?"100%":Ne[1],overflow:"hidden"},$?{touchAction:"none"}:{}),onKeyDown:Sn,children:[Pe&&e.jsx(Tt,{tableId:Ge}),Pe&&e.jsx(Wt,{scene:null!==(a=null===(s=it.current)||void 0===s?void 0:s.scene)&&void 0!==a?a:[],chartType:"Geographic chart",tableId:Ge,chartTitle:"string"==typeof ve?ve:void 0}),e.jsx(Bt,{summary:ze}),e.jsx(_t,{hoverPoint:Dt}),e.jsxs("div",{role:"img","aria-label":Le||("string"==typeof ve?ve:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Cn?An:void 0,onMouseLeave:Cn?kn:void 0,onClick:le?wn:void 0,children:[Fe&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:Ne[0],height:Ne[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${We.left},${We.top})`,children:Fe})}),_&&e.jsx("canvas",{ref:rt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx("canvas",{ref:st,"aria-label":Mt(null!==(h=null===(d=it.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:lt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(ht,{width:Be,height:Te,totalWidth:Ne[0],totalHeight:Ne[1],margin:We,scales:null,showAxes:null!=Ce&&Ce,title:ve,legend:be,legendPosition:xe,legendLayout:je,legendHoverBehavior:ke,legendClickBehavior:we,legendHighlightedCategory:Me,legendIsolatedCategories:Oe,foregroundGraphics:_e,annotations:ce,autoPlaceAnnotations:ue,annotationFrame:$t,xValues:[],yValues:[],pointNodes:null===(f=it.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type)}),(null==ge?void 0:ge.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ge.badgePosition?{top:4,left:4}:"bottom-left"===ge.badgePosition?{bottom:4,left:4}:"bottom-right"===ge.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Nt?"#dc3545":"#28a745",color:"white"}),children:Nt?"STALE":"LIVE"}),$&&e.jsxs("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:We.bottom+8,left:We.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e.jsx("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Ot.current,n=dt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1.5)},style:yn,children:"+"}),e.jsx("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Ot.current,n=dt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1/1.5)},style:yn,children:"−"})]}),F&&e.jsx("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:We.bottom+2,right:We.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.jsx(Gt,{active:Mn.current>=0,hoverPoint:Dt,margin:We,size:Ne,shape:null===(p=On.current)||void 0===p?void 0:p.shape,width:null===(g=On.current)||void 0===g?void 0:g.w,height:null===(m=On.current)||void 0===m?void 0:m.h}),Ln]})]})});function kn(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function wn(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Mn(e){const t=e.map(kn),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return wn(e,n,o)}if(e>=1){const[e,o,i]=t[n];return wn(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,l,a]=t[i],[c,u,d]=t[i+1];return wn(Math.round(s+(c-s)*r),Math.round(l+(u-l)*r),Math.round(a+(d-a)*r))}}jn.displayName="StreamGeoFrame";const On=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Sn=Mn(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),An=Mn(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Cn=Mn(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Pn=Mn(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Ln=Mn(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),zn=Mn(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Rn=Mn(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Dn=Mn(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),In=Mn(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),$n=Mn(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),En=Mn(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Nn=Mn(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);Mn(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Mn(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Mn(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Mn(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Mn(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Mn(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Mn(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const Wn={category10:On,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Sn,reds:An,greens:Cn,oranges:Pn,purples:Ln,viridis:Rn,plasma:Dn},Bn=On,Tn=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],_n=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Fn(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||_n.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Bn[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))%Bn.length]}function Hn(e,t,n="category10"){const i=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=i.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return o.scaleOrdinal().domain(i).range(n).unknown("#999");const s=Wn[n]||Wn.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of i){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:Bn;return o.scaleOrdinal().domain(i).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,s]=o,[l,a]=n;if(s===r)return(l+a)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),l+c*(a-l)}const Gn=t.createContext(null);function Vn(){return t.useContext(Gn)}function Un(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Zn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Yn,Xn]=R(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Zn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Zn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Qn,Kn]=R(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Jn(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=Xn(e=>e.selections.get(i)),s=Xn(e=>e.setClause),l=Xn(e=>e.clearClause),a=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Un(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:a,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{l(i,o)},[l,i,o]),clientId:o}}function eo(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:l}=Jn({name:n});return{onHover:t.useCallback(e=>{if(!e)return void l();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,l,n]),predicate:i,isActive:r}}const to=t.createContext(!1),no=t.createContext(null),oo="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function io(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}function ro(e,t,n){return t?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}function so(){return F(e=>e.theme)}f.createContext(void 0);const lo="#007bff";function ao(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function co(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function uo(){var e;const t=so(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function ho({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:l,onClick:a,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=io(n,o),f="series"===(null==h?void 0:h.mode)?[h.seriesField||u||o[0]].filter(e=>!!e):(null==h?void 0:h.fields)||o||[],p=Jn({name:(null==e?void 0:e.name)||"__unused__"}),g=eo({name:(null==h?void 0:h.name)||"hover",fields:f}),m=Kn(e=>e.pushObservation),y=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,b]=t.useState(null),x=u||o[0],j=t.useMemo(()=>{if(!c||null==v||!x)return null;const e=v,t=x;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,v,x]),k=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const n=ao(e,t,h.xField);null!=n&&function(e,t,n){const o=Ze.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Ze={positions:new Map(Ze.positions).set(e,{xValue:t,sourceId:n})},Xe())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&g.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Qe(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&g.onHover(null);if(c&&x)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[x];b(null!=n?n+"":null)}else b(null);if(r||m){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const i=co(e),s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),m&&m(e)}}},[n,g,h,d,r,s,l,m,c,x]),w=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=ao(e,t,h.xField);null!=n&&function(e,t,n){const o=Ze.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Ze.positions);return t.delete(e),Ze={positions:t},Xe(),!1}Ze={positions:new Map(Ze.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Xe()}(h.name||"hover",n,d)}if(e&&a){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),a(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||m){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const n=co(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),m&&m(e)}}},[a,r,m,s,l,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{Ke(e,d),Qe(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:j,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:d}}function fo({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:a}){const c=t.useContext(to),u=null!==t.useContext(no),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),f=t.useMemo(()=>{if(!h)return[];if(void 0!==a)return a;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[a,n,e,h]);!function(e){const n=t.useContext(no),o=t.useId(),i=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=t.useRef([]);(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,i)||(r.current=i);const s=r.current;oo(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),oo(()=>{n&&n.registerCategories(o,s)},[n,o,s])}(u&&n?f:[]);const p=t.useMemo(()=>{if(!d||!n)return;const t=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){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:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),l=s?o(s,t,n):n?n(i):Tn[r%Tn.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:Fn,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,f]),g=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:l[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[l,s,p,r]);return{legend:p,margin:g,legendPosition:r}}const po={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function go(e,t,n){var o,i,r,s,l,a,c;const u=po[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(i=t.height)&&void 0!==i?i:u.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(l=t.enableHover)&&void 0!==l?l:!!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:mo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function mo(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 yo(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 vo({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("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:o})]})})}class bo extends f.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.jsx(vo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var xo;const jo="undefined"!=typeof process&&"production"!==(null===(xo=process.env)||void 0===xo?void 0:xo.NODE_ENV);function ko({componentName:t,width:n,height:o,children:i}){return e.jsx(bo,{fallback:i=>e.jsx(vo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const wo={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Mo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Oo(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},wo),{width:n,height:o}),children:i||"No data available"}):null}function So(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("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)),s=Math.max(8,Math.floor(o/(3*r))),l=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(s+l)-l))/2);return e.jsx("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.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Mo),{position:"absolute",top:a+o*(s+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}function Ao(e,t,n,o){if(!jo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Co(e){const n=F(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function Po(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(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(s,l)}a((o=o.apply(e,t||[])).next())})}function Lo(e){return e}function zo(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 Lo;var t,n,o=e.scale[0],i=e.scale[1],r=e.translate[0],s=e.translate[1];return function(e,l){l||(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+s;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,s=i.length;s>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,s)}function r(e){return n(e)}function s(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 l(e){for(var t=s(e);4>t.length;)t.push(t[0]);return t}function a(e){return e.map(l)}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=s(t.arcs);break;case"MultiLineString":n=t.arcs.map(s);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 Ro=new Map;function Do(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function Io(e){return Po(this,void 0,void 0,function*(){const t=Ro.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return Po(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:Do(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Do(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Do(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Do(yield import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}})}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const i=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return zo(e,t)})}:zo(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return Ro.set(e,r),r})}function $o(e){const n=t.useMemo(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=t.useState(null);return t.useEffect(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),Io(e).then(e=>{t||i(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".`),i(null)}else i(null)},[e]),void 0!==n?n:o}const Eo={blues:Sn,reds:An,greens:Cn,viridis:Rn,oranges:Pn,purples:Ln,greys:zn,plasma:Dn,inferno:In,magma:$n,cividis:En,turbo:Nn};function No(n){var i;const s=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),l=function(){var e;const t=so();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:a,valueAccessor:c,colorScheme:u,projection:d="equalEarth",graticule:h,fitPadding:f,zoomable:p,zoomExtent:g,onZoom:m,dragRotate:y,tileURL:v,tileAttribution:b,tileCacheSize:x,tooltip:j,areaOpacity:k=1,annotations:w,margin:M,className:O,selection:S,linkedHover:A,onObservation:C,onClick:P,chartId:L,loading:z,loadingContent:R,emptyContent:D,frameProps:I={},stroke:$,strokeWidth:E,opacity:N}=n,W=null!=p?p:!!v,B=$o(a),T=t.useMemo(()=>B?Ht(B):B,[B]),_=t.useMemo(()=>"function"==typeof c?c:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[c])&&void 0!==n?n:null==e?void 0:e[c]},[c]),F=null!==(i=null!=u?u:l)&&void 0!==i?i:"blues",H=t.useMemo(()=>{if(!T)return o.scaleSequential(Sn).domain([0,1]);const e=T.map(e=>_(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=r.extent(e);return o.scaleSequential(Eo[F]||Sn).domain([null!=t?t:0,null!=n?n:1])},[T,_,F]),{activeSelectionHook:q,customHoverBehavior:G,customClickBehavior:V}=ho({selection:S,linkedHover:A,onObservation:C,onClick:P,chartType:"ChoroplethMap",chartId:L}),U=Co(S),Z=t.useMemo(()=>{const e=yo(e=>{const t=_(e);return{fill:null!=t&&isFinite(t)?H(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}},{stroke:$,strokeWidth:E,opacity:N});return q?ro(e,q,U):e},[_,H,q,U,k,$,E,N]),Y=t.useMemo(()=>t=>{var n,o;const i=(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.name)||(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||"Feature",r=_(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:i}),null!=r&&e.jsx("div",{style:{opacity:.7},children:(s=r,"number"==typeof s&&isFinite(s)?Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=s?s:"")+"")})]});var s},[_]),X=t.useMemo(()=>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}(M)),[M]),Q=So(z,s.width,s.height,R)||(T?null:So(!0,s.width,s.height,R)),K=Q?null:Oo(T,s.width,s.height,D);if(Array.isArray(T)&&T.length>0){const t=T[0];if(!t||"object"!=typeof t||!t.geometry)return e.jsx(vo,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:s.width,height:s.height})}const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:d,areas:T,areaStyle:Z,size:[s.width,s.height],margin:X,enableHover:!0,tooltipContent:!1===j?()=>null:!0===j?Y:Xt(j)||Y},null!=h&&{graticule:h}),null!=f&&{fitPadding:f}),W&&{zoomable:!0}),g&&{zoomExtent:g}),m&&{onZoom:m}),null!=y&&{dragRotate:y}),v&&{tileURL:v}),b&&{tileAttribution:b}),x&&{tileCacheSize:x}),(A||C||P)&&{customHoverBehavior:G}),(C||P)&&{customClickBehavior:V}),w&&w.length>0&&{annotations:w}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),s.title&&{title:s.title}),s.description&&{description:s.description}),s.summary&&{summary:s.summary}),void 0!==s.accessibleTable&&{accessibleTable:s.accessibleTable}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),I);return Q||K||e.jsx(ko,{componentName:"ChoroplethMap",width:s.width,height:s.height,children:e.jsx(jn,Object.assign({},J))})}function Wo(e){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:l,selection:a,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:f,chartId:p,showLegend:g,userMargin:m,marginDefaults:y,onClick:v,hoverHighlight:b,loading:x,loadingContent:j,emptyContent:k,width:w,height:M}=e,O=void 0===o,S=t.useMemo(()=>Ht(n),[n]),[A,C]=t.useState([]),P=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:z,hoverSelectionHook:R,customHoverBehavior:D,customClickBehavior:I,crosshairSourceId:$}=ho({selection:a,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:f,chartId:p,onClick:v,hoverHighlight:b,colorByField:L}),E=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}}(c,$),N=function(e,n,o){const i=Vn(),r=uo();return t.useMemo(()=>{var t;if(!n)return;const s=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(i&&Object.keys(i).length>0){const e=Hn(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return Hn(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=Hn(e,n,s);return e=>i[e]||t(e)}return Hn(e,n,s)}if(i&&Object.keys(i).length>0){const e=Hn([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,n,o,i,r])}(S,i,r),W=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of S){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[S,i]),B=t.useMemo(()=>O&&A.length>0?A:W,[O,A,W]),T=function(e,n,o){const[i,r]=t.useState(null),[s,l]=t.useState(new Set),a=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:a,onLegendClick:c,legendSelectionHook:u}}(s,i,B),_=t.useMemo(()=>R||(T.legendSelectionHook?T.legendSelectionHook:z),[R,T.legendSelectionHook,z]),F=Co(a),H=uo(),q=Vn(),G=t.useMemo(()=>{if(N)return N;if(!i||0===B.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:H&&H.length>0?H:Tn,t="__streamCat",n=Hn(B.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||n(e)||"#999"},[N,i,B,r,H,q]),{legend:V,margin:U,legendPosition:Z}=fo({data:S,colorBy:i,colorScale:G,showLegend:g,legendPosition:l,userMargin:m,defaults:y,categories:B}),Y=t.useMemo(()=>{const e={};return V&&(e.legend=V,e.legendPosition=Z),s&&"none"!==s&&(e.legendHoverBehavior=T.onLegendHover,e.legendClickBehavior=T.onLegendClick,e.legendHighlightedCategory=T.highlightedCategory,e.legendIsolatedCategories=T.isolatedCategories),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=P),e},[V,Z,s,T.onLegendHover,T.onLegendClick,T.highlightedCategory,T.isolatedCategories,O,i,P]),X=Array.isArray(o)?Ht(o):o,Q=So(x,w,M,j),K=Q?null:Oo(X,w,M,k);return{data:S,colorScale:N,allCategories:B,legendState:T,effectiveSelectionHook:_,activeSelectionHook:z,customHoverBehavior:D,customClickBehavior:I,legend:V,margin:U,legendPosition:Z,earlyReturn:Q||K||null,legendBehaviorProps:Y,crosshairProps:E,resolvedSelection:F}}function Bo(e,n){const{variant:o,frameRef:i,overrides:r,deps:s}=n;t.useImperativeHandle(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,s;const l=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 l){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===(s=e.current)||void 0===s||s.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 s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},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 s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},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:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}No.displayName="ChoroplethMap";const To=t.forwardRef(function(n,o){const i=t.useRef(null);Bo(o,{variant:"geo-points",frameRef:i});const r=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:s,xAccessor:l="lon",yAccessor:a="lat",sizeBy:c,sizeRange:u=[3,30],colorBy:d,colorScheme:h,projection:f="equalEarth",graticule:p,fitPadding:g,zoomable:m,zoomExtent:y,onZoom:v,dragRotate:b,tileURL:x,tileAttribution:j,tileCacheSize:k,areas:w,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:O,annotations:S,margin:A,className:C,selection:P,linkedHover:L,onObservation:z,onClick:R,chartId:D,loading:I,loadingContent:$,emptyContent:E,legendInteraction:N,legendPosition:W,frameProps:B={},stroke:T,strokeWidth:_,opacity:F}=n,H=null!=m?m:!!x,q=$o(w),G=Wo({data:null!=s?s:Ft,rawData:s,colorBy:d,colorScheme:h,legendInteraction:N,legendPosition:W,selection:P,linkedHover:L,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!1,onObservation:z,onClick:R,chartType:"ProportionalSymbolMap",chartId:D,showLegend:r.showLegend,userMargin:A,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:I,loadingContent:$,emptyContent:E,width:r.width,height:r.height}),V=G.data,U=t.useMemo(()=>{if(!c)return;const e="function"==typeof c?c:e=>null==e?void 0:e[c],t=V.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[V,c]),Z=t.useMemo(()=>{const e=yo(e=>({fill:d?Fn(e,d,G.colorScale):lo,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:c?qn(e,c,u,U):6}),{stroke:T,strokeWidth:_,opacity:F});return G.effectiveSelectionHook?ro(e,G.effectiveSelectionHook,G.resolvedSelection):e},[d,G.colorScale,G.effectiveSelectionHook,G.resolvedSelection,c,u,U,T,_,F]),Y=t.useMemo(()=>t=>{const n=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t.NAME)||(null==t?void 0:t.id),o="string"==typeof c?c:null,i=("function"==typeof c?c:e=>e[c])(t),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",s="string"==typeof d?d:null,l=s?null==t?void 0:t[s]:null;return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[n&&e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:n}),o&&null!=i&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[o,": "]}),r(i)]}),s&&null!=l&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[s,": "]}),l+""]}),!n&&!o&&Object.entries(t).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),r(n)]},t))]})},[c,d]);if(G.earlyReturn)return G.earlyReturn;Ao("ProportionalSymbolMap",V,"xAccessor",l),Ao("ProportionalSymbolMap",V,"yAccessor",a);const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:f},null!=s&&{points:V}),{xAccessor:l,yAccessor:a,pointStyle:Z}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),q&&{areas:q,areaStyle:M}),null!=p&&{graticule:p}),null!=g&&{fitPadding:g}),H&&{zoomable:!0}),y&&{zoomExtent:y}),v&&{onZoom:v}),null!=b&&{dragRotate:b}),x&&{tileURL:x}),j&&{tileAttribution:j}),k&&{tileCacheSize:k}),{size:[r.width,r.height],margin:G.margin,enableHover:!0,tooltipContent:!1===O?()=>null:Xt(O)||Y}),G.legendBehaviorProps),(L||z||R)&&{customHoverBehavior:G.customHoverBehavior}),(z||R)&&{customClickBehavior:G.customClickBehavior}),S&&S.length>0&&{annotations:S}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),C&&{className:C}),null!=n.animate&&{animate:n.animate}),B);return e.jsx(ko,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:e.jsx(jn,Object.assign({ref:i},X))})});To.displayName="ProportionalSymbolMap";const _o="__semiotic_x",Fo="__semiotic_y",Ho=t.forwardRef(function(n,i){const r=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:s,nodes:l,nodeIdAccessor:a="id",xAccessor:c="lon",yAccessor:u="lat",valueAccessor:d="value",projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:g,zoomExtent:m,onZoom:y,dragRotate:v,tileURL:b,tileAttribution:x,tileCacheSize:j,lineType:k="geo",flowStyle:w="basic",areas:M,areaStyle:O={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:S,edgeOpacity:A=.6,edgeWidthRange:C=[1,8],edgeLinecap:P="round",colorScheme:L,showParticles:z,particleStyle:R,tooltip:D,annotations:I,margin:$,className:E,selection:N,linkedHover:W,onObservation:B,onClick:T,chartId:_,loading:F,loadingContent:H,emptyContent:q,frameProps:G={},legendInteraction:V,legendPosition:U,stroke:Z,strokeWidth:Y,opacity:X,lineIdAccessor:Q}=n,K=null!=g?g:!!b,J=$o(M),ee=t.useMemo(()=>Ht(l),[l]),te=Wo({data:null!=s?s:Ft,rawData:s,colorBy:S,colorScheme:L,legendInteraction:V,legendPosition:U,selection:N,linkedHover:W,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:B,onClick:T,chartType:"FlowMap",chartId:_,showLegend:r.showLegend,userMargin:$,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:F,loadingContent:H,emptyContent:q,width:r.width,height:r.height}),ne=te.data,oe=io(W),ie=eo({name:(null==oe?void 0:oe.name)||"hover",fields:(null==oe?void 0:oe.fields)||[]}),re=Kn(e=>e.pushObservation),se=t.useMemo(()=>{const e=new Map;for(const t of ee)e.set(t[a]+"",t);return e},[ee,a]),le=t.useRef(null),ae=t.useRef(se);ae.current=se;const ce=t.useRef(c);ce.current=c;const ue=t.useRef(u);ue.current=u;const de=t.useCallback(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const i="function"==typeof ce.current?ce.current:e=>e[ce.current],r="function"==typeof ue.current?ue.current:e=>e[ue.current];return Object.assign(Object.assign({},e),{coordinates:[{[_o]:i(n),[Fo]:r(n)},{[_o]:i(o),[Fo]:r(o)}]})},[]);Bo(i,{variant:"geo-lines",frameRef:le,overrides:{push:e=>{var t;const n=de(e);n&&(null===(t=le.current)||void 0===t||t.pushLine(n))},pushMany:e=>{var t;const n=[];for(const t of e){const e=de(t);e&&n.push(e)}n.length>0&&(null===(t=le.current)||void 0===t||t.pushManyLines(n))}}});const he=t.useMemo(()=>{const e=new Map;for(const t of ne)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[ne]),fe=t.useCallback(e=>{var t,n;if(W)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=he.get(t[a]+"");e&&ie.onHover(e)}else ie.onHover(t)}else ie.onHover(null);if(B||re){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:_};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});B&&B(r),re&&re(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});B&&B(e),re&&re(e)}}},[W,ie,a,he,B,_,re]),pe=te.customClickBehavior,ge=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];return ne.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=se.get(n.source+""),i=se.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[_o]:e(o),[Fo]:t(o)},{[_o]:e(i),[Fo]:t(i)}]}):null}).filter(Boolean)},[ne,se,c,u]),me=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c];return t=>null!=t&&"object"==typeof t&&_o in t?t[_o]:e(t)},[c]),ye=t.useMemo(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&Fo in t?t[Fo]:e(t)},[u]),ve=t.useMemo(()=>{const e=ne.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[d])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>C[0]:o.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(C)},[ne,d,C]),be=t.useMemo(()=>e=>{var t;return{stroke:S?Fn(e,S,te.colorScale):lo,strokeWidth:ve(null!==(t=e[d])&&void 0!==t?t:0),strokeLinecap:P,opacity:A}},[S,te.colorScale,ve,d,A,P]),xe=t.useMemo(()=>{var e;const t=yo(be,{stroke:Z,strokeWidth:Y,opacity:X});if(!te.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=te.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return ro(t,te.effectiveSelectionHook,Object.assign(Object.assign({},te.resolvedSelection||{}),{unselectedStyle:n}))},[be,te.effectiveSelectionHook,te.resolvedSelection,Z,Y,X]),je=t.useMemo(()=>yo(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:Z,strokeWidth:Y,opacity:X}),[Z,Y,X]),ke=t.useMemo(()=>t=>{var n,o,i,r,s,l,c;if((null==t?void 0:t.geometry)||(null==t?void 0:t.properties)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.geometry)){const n=(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.name)||(null===(i=null==t?void 0:t.properties)||void 0===i?void 0:i.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||(null===(s=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.properties)||void 0===s?void 0:s.name)||(null===(c=null===(l=null==t?void 0:t.data)||void 0===l?void 0:l.properties)||void 0===c?void 0:c.NAME);if(n)return e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:n})})}if(null!=(null==t?void 0:t.source)&&null!=(null==t?void 0:t.target)){const n=t[d];return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsxs("div",{style:{fontWeight:600},children:[t.source," → ",t.target]}),null!=n&&e.jsx("div",{style:{opacity:.7},children:"number"==typeof n?n.toLocaleString():n})]})}const u=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t[a]);return null!=u?e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:u})}):null},[d,a]);if(te.earlyReturn)return te.earlyReturn;const we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=s&&{lines:ge}),{points:ee,xAccessor:me,yAccessor:ye,lineDataAccessor:"coordinates"}),null!=Q&&{lineIdAccessor:Q}),{lineType:k,flowStyle:w,lineStyle:xe,pointStyle:je}),J&&{areas:J,areaStyle:O}),null!=f&&{graticule:f}),null!=p&&{fitPadding:p}),K&&{zoomable:!0}),m&&{zoomExtent:m}),y&&{onZoom:y}),null!=v&&{dragRotate:v}),z&&{showParticles:z}),R&&{particleStyle:R}),b&&{tileURL:b}),x&&{tileAttribution:x}),j&&{tileCacheSize:j}),{size:[r.width,r.height],margin:te.margin,enableHover:!0,tooltipContent:!1===D?()=>null:Xt(D)||ke}),te.legendBehaviorProps),(W||B||T)&&{customHoverBehavior:fe}),(B||T)&&{customClickBehavior:pe}),I&&I.length>0&&{annotations:I}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),E&&{className:E}),null!=n.animate&&{animate:n.animate}),G);return e.jsx(ko,{componentName:"FlowMap",width:r.width,height:r.height,children:e.jsx(jn,Object.assign({ref:le},we))})});Ho.displayName="FlowMap";const qo=t.forwardRef(function(n,o){const i=go(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:r,lines:s,xAccessor:l="lon",yAccessor:a="lat",nodeIdAccessor:c="id",center:u,costAccessor:d,strength:h=1,lineMode:f="straight",projection:p="mercator",graticule:g,fitPadding:m,zoomable:y,zoomExtent:v,onZoom:b,dragRotate:x,tileURL:j,tileAttribution:k,tileCacheSize:w,transition:M,colorBy:O,colorScheme:S,pointRadius:A=5,tooltip:C,showRings:P=!0,ringStyle:L,showNorth:z=!0,costLabel:R,annotations:D,margin:I,className:$,selection:E,linkedHover:N,onObservation:W,onClick:B,chartId:T,loading:_,loadingContent:F,emptyContent:H,legendPosition:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=n,Y=null!=y?y:!!j,X=t.useMemo(()=>Ht(r),[r]),Q=Wo({data:X,rawData:r,colorBy:O,colorScheme:S,legendInteraction:void 0,legendPosition:q,selection:E,linkedHover:N,fallbackFields:O?["string"==typeof O?O:""]:[],unwrapData:!1,onObservation:W,onClick:B,chartType:"DistanceCartogram",chartId:T,showLegend:i.showLegend,userMargin:I,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:_,loadingContent:F,emptyContent:H,width:i.width,height:i.height}),K=t.useMemo(()=>{const e=yo(e=>({fill:O?Fn(e,O,Q.colorScale):lo,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:A}),{stroke:V,strokeWidth:U,opacity:Z});return Q.effectiveSelectionHook?ro(e,Q.effectiveSelectionHook,Q.resolvedSelection):e},[O,Q.colorScale,Q.effectiveSelectionHook,Q.resolvedSelection,A,V,U,Z]),J=t.useMemo(()=>({center:u,centerAccessor:c,costAccessor:d,strength:h,lineMode:f}),[u,c,d,h,f]),ee=t.useMemo(()=>{if(!s)return;const e="function"==typeof l?l:e=>e[l],t="function"==typeof a?a:e=>e[a],n=new Map;for(const e of X)n.set(e[c]+"",e);return s.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:[{[l]:e(i),[a]:t(i)},{[l]:e(r),[a]:t(r)}]}):null}).filter(Boolean)},[s,X,l,a,c]),te=t.useMemo(()=>t=>{const n=("function"==typeof d?d:e=>e[d])(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:t[c]||t.name||t.id||"Point"}),null!=n&&e.jsxs("div",{style:{opacity:.7},children:["Cost: ","number"==typeof n?n.toFixed(1):n]})]})},[d,c]),ne=t.useRef(null);Bo(o,{variant:"geo-points",frameRef:ne});const[oe,ie]=t.useState(null),re=t.useCallback(()=>{var e,t;const n=null===(t=null===(e=ne.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ie(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);t.useEffect(()=>{const e=requestAnimationFrame(re);return()=>cancelAnimationFrame(e)},[re,h,u,i.width,i.height,X]);const se=t.useMemo(()=>{if(!P||!oe)return[];const{maxCost:e}=oe;if(0>=e)return[];if(Array.isArray(P))return P.filter(t=>t>0&&e>=t);const t="number"==typeof P?P: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},[P,oe]),le=t.useMemo(()=>{var t,n;if(!oe)return G.foregroundGraphics||null;const{cx:o,cy:i,maxCost:r,availableRadius:s}=oe,l=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},L),a=null!==(t=Q.margin.left)&&void 0!==t?t:10,c=null!==(n=Q.margin.top)&&void 0!==n?n:10;return e.jsxs("g",{children:[se.map(t=>{const n=t/r*s;return e.jsxs("g",{children:[e.jsx("circle",{cx:o+a,cy:i+c,r:n,fill:"none",stroke:l.stroke,strokeWidth:l.strokeWidth,strokeDasharray:l.strokeDasharray,opacity:.5}),e.jsxs("text",{x:o+a+n+3,y:i+c-2,fontSize:l.labelSize,fill:l.labelColor,fontFamily:"system-ui, sans-serif",children:[t,R?" "+R:""]})]},t)}),z&&e.jsxs("g",{transform:`translate(${a+24}, ${c+24})`,children:[e.jsx("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e.jsx("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.jsx("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e.jsx("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[oe,se,z,R,L,Q.margin,G.foregroundGraphics]);if(Q.earlyReturn)return Q.earlyReturn;Ao("DistanceCartogram",X,"xAccessor",l),Ao("DistanceCartogram",X,"yAccessor",a);const 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({projection:p},null!=r&&{points:X}),ee&&{lines:ee,lineDataAccessor:"coordinates"}),{xAccessor:l,yAccessor:a,pointIdAccessor:c,pointStyle:K,projectionTransform:J}),M&&{transition:{duration:M}}),null!=g&&{graticule:g}),null!=m&&{fitPadding:m}),Y&&{zoomable:!0}),v&&{zoomExtent:v}),b&&{onZoom:b}),null!=x&&{dragRotate:x}),j&&{tileURL:j}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[i.width,i.height],margin:Q.margin,enableHover:!0,tooltipContent:!1===C?()=>null:Xt(C)||te}),Q.legendBehaviorProps),(N||W||B)&&{customHoverBehavior:Q.customHoverBehavior}),(W||B)&&{customClickBehavior:Q.customClickBehavior}),D&&D.length>0&&{annotations:D}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),i.title&&{title:i.title}),i.description&&{description:i.description}),i.summary&&{summary:i.summary}),void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable}),$&&{className:$}),null!=n.animate&&{animate:n.animate}),G),le&&{foregroundGraphics:le});return e.jsx(ko,{componentName:"DistanceCartogram",width:i.width,height:i.height,children:e.jsx(jn,Object.assign({ref:ne},ae))})});qo.displayName="DistanceCartogram",exports.ChoroplethMap=No,exports.DistanceCartogram=qo,exports.FlowMap=Ho,exports.ProportionalSymbolMap=To,exports.StreamGeoFrame=jn,exports.mergeData=function(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})},exports.resolveReferenceGeography=Io;
2
+ "use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-geo"),o=require("d3-scale"),i=require("d3-quadtree"),r=require("d3-array"),s=require("d3-hierarchy"),l=require("d3-shape"),a=require("regression"),c=require("d3-zoom"),u=require("d3-selection");function d(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const f=h(t),p=d(a);class g{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;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,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function m(e,t,n){return e+(t-e)*n}function y(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,l=n-1-t;switch(e.type){case"linear":return s+(1-l/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,l/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>l?1:s;default:return 1}}function v(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,r=n-t;return i>r?1-r/i:0}const b={mercator:n.geoMercator,equalEarth:n.geoEqualEarth,albersUsa:n.geoAlbersUsa,orthographic:n.geoOrthographic,naturalEarth:n.geoNaturalEarth1,equirectangular:n.geoEquirectangular};function x(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function j(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function k(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function w(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 M(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 s=-i/r,l=o/r,a=Math.min(.3*r,80),c=(e[0]+t[0])/2+s*a,u=(e[1]+t[1])/2+l*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 O(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,s;0===t?(r=e[1][0]-i[0],s=e[1][1]-i[1]):t===e.length-1?(r=i[0]-e[t-1][0],s=i[1]-e[t-1][1]):(r=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const l=Math.sqrt(r*r+s*s)||1;o.push([i[0]+s/l*n,i[1]+-r/l*n])}return o}function S(e,t,n,o,i){const r=t[0]-e[0],s=t[1]-e[1],l=Math.sqrt(r*r+s*s);if(0===l)return[e,t];const a=s/l,c=-r/l,u=i/2+1;return[[e[0]+a*u,e[1]+c*u],[t[0]+a*u,t[1]+c*u]]}class A{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 g(e),this.timestampBuffer=new g(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}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 n.geoEqualEarth();if("string"==typeof e){const t=b[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),n.geoEqualEarth())}if("object"==typeof e&&"type"in e){const t=b[e.type],o=t?t():n.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(t.projection),this.geoPath=n.geoPath(this.projection),this.fitProjection(e),this.geoPath=n.geoPath(this.projection);const o=this.projection;this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null};const i=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&&i.length>0&&this.startTransition(i),this.version++}fitProjection(e){var t,n,o,i,r;const s=this.projection,l=this.config,a=[...this.areas],c=x(l.xAccessor,"lon"),u=x(l.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=j(l.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(l.projectionExtent){const[[t,n],[o,i]]=l.projectionExtent;s.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(s.clipAngle&&(null!==(t=s.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=l.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);s.scale(o/2-o*t),s.translate([e.width/2,e.height/2])}else{const t=null!==(o=l.fitPadding)&&void 0!==o?o:0,n=e.width*t,i=e.height*t;s.fitExtent([[n,i],[e.width-n,e.height-i]],{type:"FeatureCollection",features:a})}this.baseScale=s.scale(),this.baseTranslate=s.translate(),this.baseRotation=null!==(r=null===(i=s.rotate)||void 0===i?void 0:i.call(s))&&void 0!==r?r:[0,0,0]}}applyZoomTransform(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e.k),o.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(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,A.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=i.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,o,i;const r=[],{config:s}=this,l=this.projection,a=this.geoPath,c=x(s.xAccessor,"lon"),u=x(s.yAccessor,"lat"),d=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}}(s),h=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(s),f=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(s);if(s.graticule){const t=!0===s.graticule?{}:s.graticule,o=n.geoGraticule();t.step&&o.step(t.step);const i=a(o())||"";i&&r.push({type:"geoarea",pathData:i,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=a(e);if(!t)continue;const n=a.centroid(e),o=a.bounds(e),i=a.area(e),l=k(s.areaStyle,e,d);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:i,style:l,datum:e,interactive:!0})}const p=j(s.lineDataAccessor);for(const t of this.lineData){const o=p(t);if(!o||2>o.length)continue;let i=[];if("geo"===s.lineType){const e=Array(o.length);for(let t=0;o.length>t;t++)e[t]=[c(o[t]),u(o[t])];for(let t=0;e.length-1>t;t++){const o=e[t],r=e[t+1],s=n.geoDistance(o,r)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),c=n.geoInterpolate(o,r);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const n=l(c(e/a));null!=n&&i.push(n)}}}else for(let e=0;o.length>e;e++){const t=o[e],n=l([c(t),u(t)]);null!=n&&i.push(n)}if(2>i.length)continue;const a=k(s.lineStyle,t,h),d="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==o.length||2>i.length||"arc"!==s.flowStyle?2!==o.length||2>i.length||"offset"!==s.flowStyle||(i="geo"===s.lineType?O(i,d):S(i[0],i[i.length-1],0,0,d)):i=M(i[0],i[i.length-1]);const f=w(i,e.width);if(f.length>1)for(const e of f){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},a),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>i.length&&f[0]||i,style:a,datum:t})}const g=this.getPoints(),m=s.pointIdAccessor?"function"==typeof s.pointIdAccessor?s.pointIdAccessor:e=>e[s.pointIdAccessor]:null,y=l.clipAngle&&null!==(t=l.clipAngle())&&void 0!==t?t:0,v=y>0?y*Math.PI/180:null,b=l.rotate?l.rotate():[0,0,0],A="function"==typeof l.center?l.center():[0,0],C=[(null!==(o=A[0])&&void 0!==o?o:0)-b[0],(null!==(i=A[1])&&void 0!==i?i:0)-b[1]];for(let e=0;g.length>e;e++){const t=g[e],o=c(t),i=u(t);if(null!=v&&n.geoDistance([o,i],C)>v)continue;const a=l([o,i]);if(!a)continue;const d=s.pointStyle?s.pointStyle(t):Object.assign({},f),h={type:"point",x:a[0],y:a[1],r:d.r||4,style:d,datum:t,pointId:m?m(t)+"":void 0};r.push(h)}return r}applyCartogramTransform(e,t){var n,i,r;const s=this.scene.filter(e=>"point"===e.type);if(2>s.length)return;const l=null!==(n=e.strength)&&void 0!==n?n:1;if(0===l)return;const a=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,c="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],u=s.find(t=>t.datum&&a(t.datum)+""==e.center+"");if(!u)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const d=u.x,h=u.y,f=s.map(e=>e.datum?c(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),p=Math.max(...f,1),g=Math.min(t.width,t.height)/2,m=o.scaleLinear().domain([0,p]).range([0,g]);this.cartogramLayout={cx:d,cy:h,maxCost:p,availableRadius:g},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of s){if(e===u)continue;if(!e.datum)continue;const t=Math.atan2(e.y-h,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-h,2)),o=c(e.datum),i=n+((isFinite(o)?m(o):n)-n)*l;e.x=d+Math.cos(t)*i,e.y=h+Math.sin(t)*i}const y=t.width/2,v=t.height/2,b=y-u.x,x=v-u.y;if(Math.abs(b)>.5||Math.abs(x)>.5)for(const e of s)e.x+=b,e.y+=x;this.cartogramLayout={cx:y,cy:v,maxCost:p,availableRadius:g};const j=this.scene.filter(e=>"line"===e.type);if(j.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of s)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of j){const n=null===(i=t.datum)||void 0===i?void 0:i.source,o=null===(r=t.datum)||void 0===r?void 0:r.target;if(n&&o){const i=e.get(n+""),r=e.get(o+"");i&&r&&(t.path=[i,r])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const i=y(e,o,t);n[o]._decayOpacity=i,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:i})}}applyPulse(){var e;const t=this.config.pulse;if(!t||!this.timestampBuffer)return;const n=performance.now(),o=this.scene.filter(e=>"point"===e.type),i=this.timestampBuffer.toArray();for(let r=0;o.length>r&&i.length>r;r++){const s=v(t,i[r],n);s>0&&(o[r]._pulseIntensity=s,o[r]._pulseColor=t.color||"rgba(255,255,255,0.6)",o[r]._pulseGlowRadius=null!==(e=t.glowRadius)&&void 0!==e?e:4)}}get hasActivePulses(){var e;return function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-r}(null!==(e=this.config.pulse)&&void 0!==e?e:{},this.timestampBuffer)}startTransition(e){var t,n,o,i;const r=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=r)return;const s=new Map;for(const t of e)"point"===t.type&&t.pointId&&s.set(t.pointId,[t.x,t.y]);const l=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of l)if(e.pointId){const t=s.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(a=!0))}for(const e of l)e.pointId&&!s.has(e.pointId)&&(e._targetOpacity=null!==(i=null===(o=e.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1,e.style=Object.assign(Object.assign({},e.style),{opacity:0}),a=!0);a&&(this.activeTransition={startTime:performance.now(),duration:r})}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=m(e.x,e._targetX,n),e.y=m(t,e._targetY,n)}null!=e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style),{opacity:e._targetOpacity*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),null!=e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style),{opacity:e._targetOpacity}),e._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}}function C(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function P(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function L(e,t){const n=P(e);if(!n)return!1;const o=P(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function z(e,t,n,o,i,r,s=0){if(r){const e=function(e,t,n,o,i,r=e=>e.x,s=e=>e.y,l=e=>e.r){const a=Math.max(o,i+5,12),c=t-a,u=t+a,d=n-a,h=n+a;let f=null,p=1/0;return e.visit((e,i,a,g,m)=>{if(i>u||c>g||a>h||d>m)return!0;if(!e.length){let i=e;do{const e=i.data,a=r(e)-t,c=s(e)-n,u=Math.sqrt(a*a+c*c);C(l(e),o)>=u&&p>u&&(f=e,p=u),i=i.next}while(i)}return!1}),f?{node:f,distance:p}:null}(r,t,n,o,s);if(e)return e}else{let i=null,r=o;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,l=s.y-n,a=Math.sqrt(e*e+l*l);C(s.r,o)>=a&&r>a&&(i=s,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 s=r;if(!1===s.interactive)continue;const[[l,a],[c,u]]=s.bounds;if(!(l>t||t>c||a>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),i.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let l=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[s,c]=i[o],[u,d]=i[o+1],h=R(t,n,s,c,u,d);r>=h&&a>h&&(l=e,a=h)}}return l?{node:l,distance:a}:null}function R(e,t,n,o,i,r){const s=i-n,l=r-o,a=s*s+l*l;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*l)/a;c=Math.max(0,Math.min(1,c));const u=o+c*l;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function D(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=I(n);return[function({children:o,initialState:r}){const s=t.useRef(r),l=t.useMemo(()=>I(n,s.current),[]),a=i();return e.jsx(a.Provider,{value:l,children:o})},e=>{var n;const o=i(),s=null!==(n=t.useContext(o))&&void 0!==n?n:r,l=t.useRef(e);l.current=e;const a=t.useCallback(()=>l.current(s.getState()),[s]),c=t.useCallback(()=>l.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,a,c)}]}function I(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 $(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function E(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:N})})),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}A.QUADTREE_THRESHOLD=500;const N=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],W={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:12}},B={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:12}},_={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:N,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 T(e,t){if("light"===t)return W;if("dark"===t)return B;if("high-contrast"===t)return _;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?B:W;return E(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return E(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[F,H]=D(e=>({theme:W,setTheme(t){e(e=>({theme:T(e.theme,t)}))}}));const q=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,G=new WeakMap;let V=0,U=!1,Z=null,Y=null,X=null;function Q(e,t){var n,o;if(!t)return t;const i=q.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(U)return;if("undefined"==typeof window||"undefined"==typeof document)return;U=!0;const e=()=>{V++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Z=new MutationObserver(e),Z.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Y=window.matchMedia("(prefers-color-scheme: dark)"),X=e,"function"==typeof Y.addEventListener?Y.addEventListener("change",X):"function"==typeof Y.addListener&&Y.addListener(X)}catch(e){}}();let s=G.get(r);s&&s.version===V||(s={version:V,map:new Map},G.set(r,s));const l=s.map.get(t);if(void 0!==l)return l;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,a),a}const K="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function J(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function ee(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(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=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=function(e,n,o){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),l=r[0]-s.left-s.right,a=r[1]-s.top-s.bottom,c=J(e.foregroundGraphics,r,s),u=J(e.backgroundGraphics,r,s),d=H(e=>e.theme),{transition:h,introEnabled:p}=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),g="semiotic-table-"+f.useId(),m=t.useRef(0),y=t.useRef(()=>{}),v=t.useCallback(()=>{m.current||(m.current=requestAnimationFrame(()=>y.current()))},[]);t.useEffect(()=>()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),j=t.useRef(null),k=t.useRef(0),w=t.useCallback(()=>{k.current=0;const e=j.current;j.current=null,e&&b.current(e)},[]),M=t.useCallback(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(w))},[w]),O=t.useCallback(()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=e.themeDirtyRef;return K(()=>{S&&(V++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:l,adjustedHeight:a,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:g,rafRef:m,renderFnRef:y,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:M,onPointerLeave:O}}function te({isStale:t,position:n}){return e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===n?{top:4,left:4}:"bottom-left"===n?{bottom:4,left:4}:"bottom-right"===n?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"}),children:t?"STALE":"LIVE"})}const ne={fill:(t,n)=>e.jsx("rect",{style:t,width:n,height:n}),line:(t,n)=>e.jsx("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function oe(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,ne[n])(o(e,t),i),r}function ie({swatchSize:t}){return e.jsx("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 re(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const se=(t,n,o,i,r,s,l,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=t,g=[];let m=0;const y=!(!n&&!o),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:j}=d;return p.forEach((t,u)=>{const d=oe(t,u,h,f,b),k=re(t,i,r),w=r&&r.size>0&&r.has(t.label);g.push(e.jsxs("g",{transform:`translate(0,${m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===s&&u===l?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&v?w||!1:void 0,"aria-current":y&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+p.length)%p.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,w&&e.jsx(ie,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),m+=j}),g};function le({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:s,format:l}=t,a=l||(e=>Math.round(100*e)/100+""),c="grad-legend-"+f.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),l=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:l+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:l,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:l,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),e.jsx("text",{x:l+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function ae(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:l,title:a="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:h}=t,p=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),l=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,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:l,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}}(h),[g,m]=f.useState(0),[y,v]=f.useState(0),b=f.useCallback((e,t)=>{m(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,p)=>{h+=5,f.push(e.jsx("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.jsx("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.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:se(t,o,i,r,s,l,a,p,c,u,d)},"legend-group-"+p)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:l,metrics:p}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:a,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var f;let p=0;const g=[];t.forEach((t,n)=>{var f;let m=0;t.label&&(m+=16);const y=((t,n,o,i,r,s,l,a,c,u,d,h)=>{const{type:f="fill",styleFn:p,items:g}=t,m=[],{swatchSize:y,labelGap:v,itemGap:b,rowHeight:x,align:j}=d,k=!(!n&&!o),w="isolate"===u||void 0===u&&null!=r,M=g.map(e=>y+v+7*e.label.length),O=[];let S=0,A=0;M.forEach((e,t)=>{const n=0===A?e:A+b+e;h&&h>0&&A>0&&n>h?(O.push({start:S,end:t,width:A}),S=t,A=e):A=n}),g.length>0&&O.push({start:S,end:g.length,width:A}),O.forEach((t,u)=>{let d="center"===j?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===j?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=g[h],j=oe(t,h,f,p,y),O=re(t,i,r),S=r&&r.size>0&&r.has(t.label);m.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?a===s&&h===l?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?S||!1:void 0,"aria-current":k&&!w&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:k?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+g.length)%g.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:k?e=>{c(a,h),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:O,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+v+2+7*t.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),j,S&&e.jsx(ie,{swatchSize:y}),e.jsx("text",{y:y/2,x:y+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=M[h]+b}});const C=Math.max(0,...O.map(e=>e.width)),P=O.length;return{items:m,offset:C,totalRows:P,totalHeight:P*x}})(t,i,r,s,l,a,c,n,u,d,h,null!==(f=h.maxWidth)&&void 0!==f?f:o);m+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:m,totalRows:y.totalRows,totalHeight:y.totalHeight})),p+=m+12});const m=null!==(f=h.maxWidth)&&void 0!==f?f:o;let y=p>m?0:"center"===h.align?Math.max(0,(m-p)/2):"end"===h.align?Math.max(0,m-p):0;const v=[];return g.forEach((o,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${y},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)),y+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${y},0)`,children:o.items},"legend-group-"+i)),y+=o.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),e.jsx("g",{children:v})})({legendGroups:n||[],title:a,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:l,metrics:p}),j=!(!o&&!i);return e.jsxs("g",{role:j?"listbox":void 0,"aria-multiselectable":!(!j||"isolate"!==l&&(void 0!==l||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}function ce(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ue(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:l="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:p}=t;if(!o)return null;const g="top"===l||"bottom"===l,m=!!c,y=Math.max(1,g?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===l?(v=Math.max(4,s.left-y-10),b=s.top):"top"===l?(v=s.left,b=m?32:8):"bottom"===l?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e.jsx(le,{config:o.gradient,orientation:g?"horizontal":"vertical",width:y}):ce(o)?e.jsx(ae,{legendGroups:o.legendGroups,title:"",width:y,orientation:g?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:p}):o)});var x}function de(e){return"string"==typeof e?{type:e}:e}function he({orient:n,config:o,values:i,scale:s,size:l,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=t.useMemo(()=>{if(0===i.length)return null;const t=s.domain(),o=l-8;if("boxplot"===c.type){const t=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)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!t)return null;const{q1:r,median:l,q3:a,whiskerLow:d,whiskerHigh:h}=t,f=Math.min(.5*o,20),p=(o-f)/2+4;if(u){const t=s(r),o=s(a),i=s(l),u=s(d),g=s(h),m="top"===n?-1:1,y=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:y+m*(p+f/2),x2:g,y2:y+m*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:y+m*p,x2:u,y2:y+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:g,y1:y+m*p,x2:g,y2:y+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?y-p-f:y+p,width:Math.abs(o-t),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?y-p-f:y+p,x2:i,y2:"top"===n?y-p:y+p+f,stroke:c.fill,strokeWidth:2})]})}{const t=s(r),o=s(a),i=s(l),u=s(d),g=s(h),m="left"===n?-1:1,y=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:y+m*(p+f/2),y1:u,x2:y+m*(p+f/2),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:y+m*p,y1:u,x2:y+m*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:y+m*p,y1:g,x2:y+m*(p+f),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?y-p-f:y+p,y:Math.min(t,o),width:f,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?y-p-f:y+p,y1:i,x2:"left"===n?y-p:y+p+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=r.bin().domain(t).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.jsx("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/h*o;if(u){const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-r:4,width:Math.max(l,.5),height:r,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:"left"===n?-4-r:4,y:Math.min(o,o+l),width:r,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*(o/2),l=s((e.x0+e.x1)/2);i.push(u?`${l},${"top"===n?-(t-r):t-r}`:`${"left"===n?-(t-r):t-r},${l}`)}for(let e=d.length-1;e>=0;e--){const r=d[e];if(null==r.x0||null==r.x1)continue;const l=r.length/h*(o/2),a=s((r.x0+r.x1)/2);i.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.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,i=null!=d[0].x0?s(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=s((e.x0+e.x1)/2);t.push(`L${r},${"top"===n?-i-4:i+4}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${r},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${r}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${e},${r}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,l,a,n,u,4]);return d?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function fe(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function pe(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 ge(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:l,align:a,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=l;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===d?"right"===h?f="end":"middle"===h&&(f="middle"):f=0>n?"end":"start";const p=16,g=s?u?[s]:fe(s,c):[],m=r?u?[r]:fe(r,c):[],y="leftRight"===d?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";g.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:g.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:p,children:t},n))},"annotation-note-title")),v=g.length*p),m.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:m.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let j=null;if((s||r)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(g.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,g.length+m.length-1)*p;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===h?-(k+p+(m.length>0&&g.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),j]})}function me(t,n,o,i,r){var s;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.push(e.jsx("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)&&l.push(e.jsx("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)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e.jsx("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;l.push(e.jsx("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)?l.push(e.jsx("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)||l.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&l.push(e.jsx("path",{d:pe((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.jsx("g",{className:"annotation-subject",children:l})}function ye(t,n,o,i,r,s){var l;const a=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,l=n-r;if(0!==s||0!==l){const t=Math.abs(s),n=Math.abs(l),a=e/2,d=o/2,h=t*d>n*a?a/t:d/n;c=i+s*h,u=r+l*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);c=Math.cos(o)*e,u=Math.sin(o)*e}}const d=Math.sqrt(Math.pow(t-c,2)+Math.pow(n-u,2));if(d>.5){const r=i||"var(--semiotic-text-secondary, currentColor)",s="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(s){const i=(null!==(l=null==o?void 0:o.curve)&&void 0!==l?l:.25)*d,s=(c+t)/2+-(n-u)/d*i,f=(u+n)/2+(t-c)/d*i;a.push(e.jsx("path",{className:"connector-curve",d:`M${c},${u}Q${s},${f} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(f-u,s-c)}else a.push(e.jsx("line",{x1:c,y1:u,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;a.push(e.jsx("path",{d:`M${c},${u}L${c+t*Math.cos(h+n)},${u+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${u+t*Math.sin(h-n)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e.jsx("g",{className:"annotation-connector",children:a})}function ve(t){var n,o;const{x:i=0,y:r=0,dx:s,dy:l,nx:a,ny:c,note:u,connector:d,subject:h,type:f,color:p,className:g,disable:m,opacity:y,strokeDasharray:v,events:b={},"data-testid":x}=t,j=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,k=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,w=new Set(Array.isArray(m)?m:[]);let M=s||0,O=l||0;null!=a&&(M=a-j),null!=c&&(O=c-k);const S="string"==typeof f?f:"label";if("bracket"===S&&h&&0===M&&0===O)if(void 0!==h.width){M=h.width/2;const e=h.depth||30;O=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;M=e+(0>e?-5:5),O=h.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${j},${k})`,"data-testid":x},null!=y&&{opacity:y},v&&{strokeDasharray:v},b,{children:[!w.has("connector")&&ye(M,O,d,p,S,h),!w.has("subject")&&me(S,h,p,j,k),!w.has("note")&&ge(u,M,O,p)]}))}function be(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=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:l});return e.jsx(ve,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e.jsx(ve,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:s}),c)}function xe(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 ke(e){return null==e?null:e+""}function we(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function Me(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return we(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,s;const l=e.data;if(!l||0===l.length)return null;const a=l[l.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===(s=e.scales)||void 0===s?void 0:s.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 o?we(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return ke(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const s=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>ke(e.pointId)===r);if(s)return we(t,n,{x:s.x,y:s.y});const l=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return ke(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!l)return null;const a=xe(l,n),c=je(l,n);return null==a||null==c?null:we(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let s=null,l=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,l=t.y)}if(null!=s&&null!=l||(s=xe(e,n),l=je(e,n)),null!=s&&null!=l)return we(t,n,{x:s,y:l});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function Oe(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Se={secondary:0,primary:3};function Ae(e){return!0===(null==e?void 0:e._annotationDeferred)}function Ce(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function Pe(e){var t;const n=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;return"number"==typeof n&&Number.isFinite(n)?Math.max(0,Math.min(1,n)):null}function Le(e){return Math.max(.72,.95-.06*e)}const ze={linear:l.curveLinear,monotoneX:l.curveMonotoneX,monotoneY:l.curveMonotoneY,step:l.curveStep,stepAfter:l.curveStepAfter,stepBefore:l.curveStepBefore,basis:l.curveBasis,cardinal:l.curveCardinal,catmullRom:l.curveCatmullRom};const Re=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function De(e){return!!e&&"object"==typeof e&&Re.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function Ie(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function $e(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Ee(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}new Set(["label","callout","callout-circle","callout-rect"]);const Ne=32,We=6,Be=4,_e=8,Te=72;const Fe={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function He(e){return De(e)}function qe(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function Ge(e,t,n,o,i){const r=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?s-i.height:s,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?s-i.height-4:s+4,width:i.width,height:i.height}}function Ve(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Ue(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function Ze(e,t,n,o,i,r,s,l){const a=Ve(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(a,i,r,l);for(const e of n)c+=12*Ue(a,e);for(const e of o)c+=4*Ue(a,e);return c}function Ye(e){var t;const{annotations:n,context:o,defaultOffset:i=Ne,notePadding:r=We,markPadding:s=Be,edgePadding:l=_e,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=Te,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:p,cohesion:g,audience:m}=e,y=o.width||0,v=o.height||0;if(0===n.length||0>=y||0>=v)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,s);let j=!1;const k=n.map((e,t)=>{if(!He(e))return e;const n=function(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const s=e.coordinates,l=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(s)&&s.length>=2&&l){const e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){const n=l([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?Me(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const s=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...qe("string"==typeof e.title?e.title:void 0,t),...qe("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return b.push(Ve(Ge(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,s),r)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){const t=Ze(Ge(n.x,n.y,e.dx,e.dy,s),e,b,x,y,v,r,l);f>t&&(h=e,f=t)}if(!h)return e;const p=Ve(Ge(n.x,n.y,h.dx,h.dy,s),r);b.push(p);const g=Math.hypot(h.dx,h.dy),m=c&&g>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return j=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),m?{connector:m}:{})}),w=j?k:n.slice();let M=w;if(f){let e=!1;const t=w.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});M=e?t:w}{let e=!1;const t=M.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=Fe[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),s="string"==typeof e.label?e.label:"";return s.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:s?`${s} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});M=e?t:M}const O=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(m),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:$e(y,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),s=$e(o,i,e),l=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,De(n))};var n}),a=l.filter(e=>e.note);if(0===a.length||s>=a.length)return{visible:n.slice(),deferred:[],budget:s};const c=a.filter(e=>Ie(e.annotation)),u=a.filter(e=>!Ie(e.annotation)).sort((e,t)=>Ee(t.annotation)-Ee(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,s-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],p=[];for(const{annotation:e,index:t,note:n}of l)!n||h.has(t)?f.push(e):p.push(e);return{visible:f,deferred:p,budget:s}}(Object.assign({annotations:M,width:y,height:v},o));for(const e of i)O.add(e)}if(p&&("object"==typeof p&&"number"==typeof p.minWidth?p.minWidth:480)>=y)for(const e of M)He(e)&&"secondary"===e.emphasis&&O.add(e);if(O.size>0)for(const e of M)!0===(null==e?void 0:e.defensive)&&O.delete(e);let S;return S=0===O.size?M:h?M.map(e=>O.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):M.filter(e=>!O.has(e)),g?function(e,t){let n=!1;const o=e.map(e=>He(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(S,g):S}let Xe={positions:new Map};const Qe=new Set;function Ke(){for(const e of Qe)e()}function Je(e,t){const n=Xe.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Xe.positions);o.delete(e),Xe={positions:o},Ke()}function et(e,t){const n=Xe.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Xe.positions);o.delete(e),Xe={positions:o},Ke()}function tt(){return Xe}function nt(e){return Qe.add(e),()=>Qe.delete(e)}const ot={positions:new Map};function it(){return()=>{}}function rt(){return ot}function st(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,s=o instanceof Date?o.getTime():o,l=i instanceof Date?i.getTime():i;if(2>t||s===l)return r?[new Date(s),new Date(l)]:[s,l];const a=(l-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?l:s+e*a;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function lt(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function at(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function ct(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 ut(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function dt(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 s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function ht(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function ft(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 pt(n){var o,i;const{width:r,height:a,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:g,axes:m,xLabel:y,yLabel:v,yLabelRight:b,xFormat:x,yFormat:j,axisExtent:k,showGrid:w,title:M,legend:O,legendHoverBehavior:S,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:P,legendPosition:z="right",legendLayout:R,foregroundGraphics:D,marginalGraphics:I,xValues:$,yValues:E,annotations:N,autoPlaceAnnotations:W,svgAnnotationRules:B,xAccessor:_,yAccessor:T,annotationData:F,pointNodes:H,curve:q,underlayRendered:G,canvasObscuresUnderlay:V=!0,linkedCrosshairName:U,linkedCrosshairSourceId:Z,children:Y}=n,X=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||x||ht,i=Math.max(2,Math.floor(r/70)),s=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:st(h.x,"exact"===k?Math.max(2,s):Math.min(s,i),k),a=l.map(e=>e.valueOf()),c=l.map((e,t)=>({value:e,pixel:h.x(e),label:o(e,t,a)})),u=c.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 f=ft(c,d);if(f.length>1&&(f=f.filter((e,t)=>0===t||e.label+""!=f[t-1].label+"")),(null==n?void 0:n.includeMax)&&f.length>0&&"exact"!==k&&!(null==n?void 0:n.tickValues)){const e=h.x.domain()[1],t=h.x(e),n=f[f.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,f.length,a);d>t-n&&f.length>1&&(f=f.slice(0,-1)),f.push({value:e,pixel:t,label:i})}}return f},[g,h,m,x,r,k]),Q=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||j||ht,i=Math.max(2,Math.floor(a/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let s=ft((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:st(h.y,"exact"===k?Math.max(2,r):Math.min(r,i),k)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22);if(s.length>1&&(s=s.filter((e,t)=>0===t||e.label+""!=s[t-1].label+"")),(null==n?void 0:n.includeMax)&&s.length>0&&"exact"!==k&&!(null==n?void 0:n.tickValues)){const e=h.y.domain()[1],t=h.y(e),n=s[s.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&s.length>1&&(s=s.slice(0,-1)),s.push({value:e,pixel:t,label:i})}}return s},[g,h,m,j,a,k]),K=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||j||ht,i=Math.max(2,Math.floor(a/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return ft((null!==(t=n.tickValues)&&void 0!==t?t:st(h.y,"exact"===k?Math.max(2,r):Math.min(r,i),k)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22)},[g,h,m,j,a,k]),J=t.useRef(new Map),ee=t.useRef(null!==(o=null==N?void 0:N.length)&&void 0!==o?o:0),te=null!==(i=null==N?void 0:N.length)&&void 0!==i?i:0;ee.current!==te&&(ee.current=te,J.current=new Map);const ne=t.useMemo(()=>{if(!N||0===N.length)return null;const t=function(t,n,o){var i,r,a,c,u,d,h,g,m,y,v,b,x,j,k,w,M,O,S,A,C,P,L,z,R,D,I,$,E,N,W,B,_,T,F,H,q,G,V,U,Z,Y,X,Q,K,J,ee,te,ne,oe,ie;switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const s=Me(t,n,o);if(!s)return null;const{x:l,y:c}=s;if(!Oe(l,c,o))return null;const u="callout"===t.type?"callout-circle":t.type,d="callout-circle"===u?{radius:null!==(i=t.radius)&&void 0!==i?i:12,radiusPadding:t.radiusPadding}:"callout-rect"===u?{width:t.width,height:t.height}:void 0;return e.jsx(be,{noteData:Object.assign(Object.assign({x:l,y:c,dx:null!==(r=t.dx)&&void 0!==r?r:30,dy:null!==(a=t.dy)&&void 0!==a?a:-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:u},d?{subject:d}:{}),{connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className})},"ann-"+n)}case"x-threshold":{const i=xe(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let l;return l="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=je(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let l,a;return"left"===s?(l=4,a="start"):"center"===s?(l=(o.width||0)/2,a="middle"):(l=(o.width||0)-4,a="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:l,y:i-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:xe(Object.assign(Object.assign({},e),{type:"point"}),o),y:je(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=s.packEnclose(i),l=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+l,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-l-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:xe(Object.assign(Object.assign({},e),{type:"point"}),o),y:je(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),l=i.map(e=>e.y),a=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...l)-r,d=Math.max(...l)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:a,y:u,width:c-a,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(a+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=xe(n,o),l=je(n,o);if(null==r||null==l)return null;const a="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:l,r:a},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=xe(t,o),r=je(t,o);return e.jsx(be,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",l="ordinal"===o.frameType,a="horizontal"===o.projection,f=l?r:null,v=l?s:null;let b;const x=[],j=new Map;if(l&&f&&v){for(const e of i){const t=e[f];if(null==t)continue;const n=t+"";j.has(n)||(j.set(n,x.length),x.push(n))}b=i.map(e=>{const t=e[f],n=e[v];if(null==t||null==n)return null;const o=j.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.time,w=null!==(g=null===(h=o.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(m=o.scales)||void 0===m?void 0:m.value;if(!k||!w)return null;const M=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},O=k,S=w;let A;if(l)if(a){const e=M(S);A=(t,n)=>[O(n),e(t)]}else{const e=M(O);A=(t,n)=>[e(t),S(n)]}else A=(e,t)=>[O(e),S(t)];const C=t.method||"linear";let P;P="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]),s=Math.max(2,Math.ceil(t*n)),l=[];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(s-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){l.push([t,r[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))l.push([t,h/u]);else{const e=(u*p-d*h)/g;l.push([t,(h-e*d)/u+e*t])}}return l}(b,null!==(y=t.bandwidth)&&void 0!==y?y:.3):("polynomial"===C?p.default.polynomial(b,{order:t.order||2}):p.default.linear(b)).points;const L=P.map(([e,t])=>{const[n,o]=A(e,t);return`${n},${o}`}).join(" "),z=t.color||"#6366f1",R=P[P.length-1],[D,I]=A(R[0],R[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:L,fill:"none",stroke:z,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:D+4,y:I-4,fill:z,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(b=null===(v=o.scales)||void 0===v?void 0:v.y)&&void 0!==b?b:null===(x=o.scales)||void 0===x?void 0:x.value,r=null!==(j=null==i?void 0:i(t.y0))&&void 0!==j?j:0,s=null!==(k=null==i?void 0:i(t.y1))&&void 0!==k?k:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",s=null!==(M=null===(w=o.scales)||void 0===w?void 0:w.x)&&void 0!==M?M:null===(O=o.scales)||void 0===O?void 0:O.time,a=null!==(A=null===(S=o.scales)||void 0===S?void 0:S.y)&&void 0!==A?A:null===(C=o.scales)||void 0===C?void 0:C.value;if(!s||!a)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const f=ze[o.curve||"linear"]||l.curveLinear,p=l.area().x(e=>s(e[r])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!p)return null;const g=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:p,fill:g,fillOpacity:null!==(P=t.fillOpacity)&&void 0!==P?P:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:s(h[h.length-1][r])+4,y:a(h[h.length-1][c])-4,fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(z=null===(L=o.scales)||void 0===L?void 0:L.x)&&void 0!==z?z:null===(R=o.scales)||void 0===R?void 0:R.time,l=null!==(I=null===(D=o.scales)||void 0===D?void 0:D.y)&&void 0!==I?I:null===($=o.scales)||void 0===$?void 0:$.value;if(!s||!l)return null;const a=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,d=Math.sqrt(u),h=null!==(E=t.threshold)&&void 0!==E?E:2,f=c-h*d,p=!1!==t.showBand,g=t.fill||"#6366f1",m=null!==(N=t.fillOpacity)&&void 0!==N?N:.1,y=t.anomalyColor||"#ef4444",v=null!==(W=t.anomalyRadius)&&void 0!==W?W:6,b=l(c+h*d),x=l(f),j=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[p&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:g,fillOpacity:m}),j.map((t,n)=>{const i=xe(t,o),r=je(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",l=null!==(_=null===(B=o.scales)||void 0===B?void 0:B.x)&&void 0!==_?_:null===(T=o.scales)||void 0===T?void 0:T.time,a=null!==(H=null===(F=o.scales)||void 0===F?void 0:F.y)&&void 0!==H?H:null===(q=o.scales)||void 0===q?void 0:q.value;if(!l||!a)return null;const c=i.map(e=>[e[r],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>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=p.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)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 s=(e*i-t*n)/r,l=(n-s*t)/e;u=e=>l+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),g=c.reduce((e,t)=>e+t[0],0)/d,m=c.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),y=null!==(G=t.confidence)&&void 0!==G?G:.95,v=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=null!==(V=t.steps)&&void 0!==V?V:5,x=c[d-1][0],j=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*j);const w=[];for(const e of k){const t=u(e),n=f*Math.sqrt(1+1/d+(m>0?Math.pow(e-g,2)/m:0))*v;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const M=`M${w.map(e=>`${l(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${l(e.x)},${a(e.yLower)}`).join(" L")} Z`,O=w.map(e=>`${l(e.x)},${a(e.yCenter)}`).join(" "),S=`${l(x)},${a(u(x))}`,A=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:M,fill:t.fill||"#6366f1",fillOpacity:null!==(U=t.fillOpacity)&&void 0!==U?U:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:A,strokeWidth:null!==(Z=t.strokeWidth)&&void 0!==Z?Z:2,strokeDasharray:null!==(Y=t.strokeDasharray)&&void 0!==Y?Y:"6,3"}),t.label&&w.length>0&&e.jsx("text",{x:l(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:A,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=Me(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!Oe(i,r,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,l=null!==(Q=t.dy)&&void 0!==Q?Q:0,a=null!==(K=t.width)&&void 0!==K?K:32,c=null!==(J=t.height)&&void 0!==J?J:32,u=null!==(ee=t.content)&&void 0!==ee?ee:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-a/2,y:r+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=Me(t,n,o);if(!i)return null;const{x:r,y:s}=i,l=r+(t.dx||0),a=s+(t.dy||0),c=t.color||"var(--semiotic-text, #333)",u=e.jsx("text",{x:l,y:a,fill:c,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?f.cloneElement(u,{key:"ann-text-"+n}):e.jsxs("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[e.jsx("line",{x1:r,y1:s,x2:l,y2:a,stroke:c,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),f.cloneElement(u,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(te=o.scales)||void 0===te?void 0:te.o,l=null===(ne=o.scales)||void 0===ne?void 0:ne.x,a=null===(oe=o.scales)||void 0===oe?void 0:oe.y,c=r(s)?s:r(l)?l:r(a)?a:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",f=null!==(ie=t.opacity)&&void 0!==ie?ie:.15,p=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===l)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+n)}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:_,yAccessor:T,width:r,height:a,data:F,frameType:"xy",pointNodes:H,curve:q,stickyPositionCache:J.current};return function(t,n,o,i){const r=[];return t.forEach((e,t)=>{let s;if(o){const r=o(e,t,i);s=null!=r?r:n(e,t,i)}else s=n(e,t,i);s&&r.push({node:s,annotation:e})}),function(t){const n=t.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===(null==n?void 0:n.emphasis)||"secondary"===(null==n?void 0:n.emphasis)?n.emphasis:null),confidence:Pe(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>Ae(e.annotation)),r=t.some(e=>null!=Ce(e.annotation)),s=t.some(e=>"layer"===Ce(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const l=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});l.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,l.length)});for(const e of n)e.emphasis&&(e.rank=Se[e.emphasis]);const a=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,s=Ae(n.annotation);let l=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;l=e.jsx("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:Le(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const a=Ce(n.annotation);return a&&(l=e.jsx("g",{className:"annotation-cohesion--"+a,children:l},"annotation-cohesion-"+o)),s&&(l=e.jsx("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:l},"annotation-deferred-"+o)),l});return i&&a.unshift(e.jsx("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),s&&a.unshift(e.jsx("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(W?Ye(Object.assign({annotations:N,context:n},"object"==typeof W?W:{})):N,t,B,n)},[N,W,B,r,a,_,T,F,h,H,q]),oe=function(e){var n;const o=t.useSyncExternalStore(e?nt:it,e?tt:rt,e?tt:rt);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}(U);return t.useEffect(()=>{if(!(null==oe?void 0:oe.locked)||!U)return;const e=e=>{"Escape"===e.key&&et(U)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,U]),g||M||O||D||I||ne&&ne.length>0||w||Y||oe?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof M?M:"XY Chart"}),e.jsx("desc",{children:"string"==typeof M?M+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[w&&h&&(!G||V)&&(()=>{var t,n;const o=ut(null===(t=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=ut(null===(n=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[X.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:a,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),Q.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),g&&h&&(()=>{const t=null==m?void 0:m.find(e=>"left"===e.orient),n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,s=(null==t?void 0:t.jaggedBase)||!1,l=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",g=!!(null==n?void 0:n.autoRotate)&&X.length>1&&(()=>{const e=r/Math.max(X.length-1,1);return X.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x={fontSize:"var(--semiotic-tick-font-size, 12px)"},j={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},k={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},w=null==n?void 0:n.tickAnchor,M=null==t?void 0:t.tickAnchor,O=ct(X),S=ct(Q);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!G||V)&&i&&!l&&e.jsx("line",{x1:0,y1:a,x2:r,y2:a,stroke:h,strokeWidth:1}),(!G||V)&&l&&e.jsx("path",{d:dt("bottom",r,a),fill:"none",stroke:h,strokeWidth:1}),X.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):L(t.value,n>0?X[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${a})`,children:[e.jsx("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:g?10:18,textAnchor:g?"end":lt(w,t.pixel===O.min,t.pixel===O.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:x),transform:g?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},x),children:t.label})})]},"xtick-"+n)}),y&&e.jsx("text",{x:r/2,y:a+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:y})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!G||V)&&o&&!s&&e.jsx("line",{x1:0,y1:0,x2:0,y2:a,stroke:h,strokeWidth:1}),(!G||V)&&s&&e.jsx("path",{d:dt("left",r,a),fill:"none",stroke:h,strokeWidth:1}),Q.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):L(t.value,n>0?Q[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:at(M,t.pixel===S.min,t.pixel===S.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:x),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},x),children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||v;return n?e.jsx("text",{x:15-d.left,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-d.left}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:n}):null})()]}),(()=>{const t=null==m?void 0:m.find(e=>"right"===e.orient);if(!t||0===K.length)return null;const n=!1!==t.baseline,o=t.landmarkTicks,i=t.label||b,s=t.tickAnchor,l=ct(K);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&e.jsx("line",{x1:r,y1:0,x2:r,y2:a,stroke:h,strokeWidth:1}),K.map((t,n)=>{const i=!!o&&("function"==typeof o?o(t.value,n):L(t.value,n>0?K[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:at(s,t.pixel===l.min,t.pixel===l.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?j:x),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},x),children:t.label})})]},"ytick-r-"+n)}),i&&e.jsx("text",{x:r+d.right-15,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${r+d.right-15}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:i})]})})()]})})(),ne,I&&h&&$&&E&&e.jsxs(e.Fragment,{children:[I.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(he,{orient:"top",config:de(I.top),values:$,scale:h.x,size:d.top,length:r})}),I.bottom&&e.jsx("g",{transform:`translate(0, ${a})`,children:e.jsx(he,{orient:"bottom",config:de(I.bottom),values:$,scale:h.x,size:d.bottom,length:r})}),I.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(he,{orient:"left",config:de(I.left),values:E,scale:h.y,size:d.left,length:a})}),I.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(he,{orient:"right",config:de(I.right),values:E,scale:h.y,size:d.right,length:a})})]}),D,oe&&oe.sourceId!==Z&&(null==h?void 0:h.x)&&(()=>{const t=h.x(oe.xValue);if(null==t||0>t||t>r)return null;const n=oe.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:a,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Y]}),M&&e.jsx("text",{x:c/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}),ue({legend:O,totalWidth:c,totalHeight:u,margin:d,legendPosition:z,title:M,legendLayout:R,legendHoverBehavior:S,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:P})]}):null}function gt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const mt="undefined"==typeof window||"undefined"==typeof document,yt="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,vt=()=>()=>{},bt=()=>!1,xt=()=>!0;function jt(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 kt(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 wt(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 Mt=f.createContext(null),Ot={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function St(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"],s=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 s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const At=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function Ct(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}const Pt="semiotic-accessible-data-table",Lt=Pt+" semiotic-accessible-data-table-hidden",zt=Pt+" semiotic-accessible-data-table-visible",Rt={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"},Dt={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},It={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"},Et={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))"},Nt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Wt={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Bt={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function _t({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,l]=f.useState(!1),[a,c]=f.useState(5),u=f.useContext(Mt),d=null!==(r=null==u?void 0:u.visible)&&void 0!==r&&r,h=s||d,p=f.useRef(null),g=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n;f.useEffect(()=>{h||c(5)},[h]);const m=f.useCallback(e=>{e.target===e.currentTarget&&(s||d||l(!0))},[s,d]),y=f.useCallback(e=>{var t;d||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||l(!1)},[d]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:Ot}):null;if(!h)return e.jsx("div",{id:o,className:Lt,tabIndex:-1,onFocus:m,style:Ot,role:"region","aria-label":g,children:e.jsxs("button",{type:"button",onClick:()=>l(!0),children:["View data summary (",t.length," elements)"]})});const v=function(e){var t,n,o,i,r,s,l,a,c,u,d,h,f,p,g,m,y;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:Ct(x.datum)});break;case"line":case"area":{const e=Array.isArray(x.datum)?x.datum:[],t="line"===x.type?"Line point":"Area point";for(const n of e)v.push({label:t,values:Ct(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":{const e=Ct(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(a=null!==(s=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(l=x.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:Ct(x.datum)});break;case"arc":v.push({label:"Arc",values:Ct(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:Ct(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(g=null!==(f=null===(h=null===(d=x.datum)||void 0===d?void 0:d.properties)||void 0===h?void 0:h.name)&&void 0!==f?f:null===(p=x.datum)||void 0===p?void 0:p.name)&&void 0!==g?g:"",value:null!==(y=null===(m=x.datum)||void 0===m?void 0:m.value)&&void 0!==y?y:""}})}}catch(e){}return v}(t),b=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],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),x=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${At(e.min)} to ${At(e.max)}, mean ${At(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,b),j=Math.min(a,v.length),k=v.slice(0,j),w=v.length-j,M=new Set;for(const e of k)for(const t of Object.keys(e.values))M.add(t);const O=Array.from(M);return e.jsxs("div",{ref:p,id:o,className:zt,tabIndex:-1,onBlur:y,style:Rt,role:"region","aria-label":g,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),l(!1)},"aria-label":"Close data summary",style:It,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Dt,children:x}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:$t,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:Wt,children:w>0?`First ${j} of ${v.length} data points`:`All ${v.length} data points`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:Et,children:"type"}),O.map(t=>e.jsx("th",{style:Et,children:t},t))]})}),e.jsx("tbody",{children:k.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:Nt,children:t.label}),O.map(n=>{return e.jsx("td",{style:Nt,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":At(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]}),w>0&&e.jsxs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>c(e=>e+25),style:Bt,children:["Show ",Math.min(25,w)," more"," ",1===w?"row":"rows"," (",w," remaining)"]})]})}function Tt({summary:t}){return t?e.jsx("div",{role:"note",style:Ot,children:t}):null}function Ft({tableId:t}){return e.jsx("a",{href:"#"+t,style:Ot,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,Ot)},children:"Skip to data table"})}function Ht({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Ot,children:n})}const qt=Object.freeze([]);function Gt(e){if(!e)return qt;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 Vt="var(--semiotic-focus, #005fcc)";function Ut({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:l}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=l){const t=Math.max(s,4),n=Math.max(l,4);u=e.jsx("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Vt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:Vt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:Vt,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}const Zt={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 Yt(e,t){return"function"==typeof t?t(e):e[t]}function Xt(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 Qt(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let l;const a=[];if(o){const e=Yt(t,o);l=Xt(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=Yt(t,o);a.push({label:n,value:Xt(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){l=Xt(t[n],i);break}if(!l){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(l=Xt(t[e[0]],i))}}const c=Object.assign(Object.assign({},Zt),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[l&&e.jsx("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:l}),a.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Kt(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 s=n(i);return null==s?null:e.jsx("div",{className:"semiotic-tooltip",style:Zt,children:s})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Qt(t):Qt())}}function Jt({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:l="stream-frame-tooltip",zIndex:a=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=f.useRef(null),[d,h]=f.useState(null);f.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,l,o,i]);let p;p=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const g=function(e){if(!f.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 o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(s),m=g?null:Zt;return c?e.jsx("div",{ref:u,className:g?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},m||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:p,pointerEvents:"none",zIndex:a,width:"max-content"}),children:s}):null}function en(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function tn(e,t,n=.6){var o,i,r,s,l;if(!en(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!==(l=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==l?l: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 nn(e,t,n,o=.35){en(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function on(e){switch(e){case"monotoneX":return l.curveMonotoneX;case"monotoneY":return l.curveMonotoneY;case"cardinal":return l.curveCardinal;case"catmullRom":return l.curveCatmullRom;case"step":return l.curveStep;case"stepBefore":return l.curveStepBefore;case"stepAfter":return l.curveStepAfter;case"basis":return l.curveBasis;case"natural":return l.curveNatural;default:return null}}function rn(e,t,n){return null==t?n:"string"!=typeof t?t:Q(e,t)||n}function sn(e,t,n,o,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const l=e.createLinearGradient(n,o,i,r);for(const e of s)l.addColorStop(e.offset,e.color);return l}function ln(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function an(e,t,n,o,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const l=s[s.length-1];if(0===l)return;const a=Math.min(.2*l,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;a>o&&(r*=o/a),a>l-o&&(r*=(l-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 cn(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,l=t[0]+"px",a=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function un(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function dn([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function hn(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 fn{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 pn{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 s=n[r.lineIndex];if(!s||2>s.length){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const l=gn(s),a=mn(s,r.t*l),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 gn(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],s=Math.sqrt(i*i+r*r);if(n+s>=t||o===e.length-1){const l=s>0?(t-n)/s:0,a=s>.001?s:1;return{x:e[o-1][0]+i*l,y:e[o-1][1]+r*l,nx:-r/a,ny:i/a}}n+=s}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const yn={top:10,right:10,bottom:10,left:10},vn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"},bn={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 xn(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 kn({data:t}){if(!t)return null;if(t.properties)return e.jsx("div",{className:"semiotic-tooltip",style:vn,children:e.jsx("div",{style:{fontWeight:600},children:t.properties.name||t.properties.NAME||t.properties.id||"Feature"})});const n=null!=t.data?t.data:t;if(!n||"object"!=typeof n)return null;const o=Object.entries(n).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return 0===o.length?null:e.jsx("div",{className:"semiotic-tooltip",style:vn,children:o.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),e.jsx("span",{style:{fontWeight:600},children:n+""})]},t))})}kn.ownsChrome=!0;const wn=t.forwardRef(function(n,o){var i,r,s,a,d,h,f,p,g,m;const{projection:y,projectionExtent:v,fitPadding:b,projectionTransform:x,areas:j,points:k,lines:w,xAccessor:M,yAccessor:O,lineDataAccessor:S,pointIdAccessor:C,lineIdAccessor:P,lineType:L="geo",flowStyle:R="basic",graticule:D,zoomable:I,zoomExtent:E,onZoom:N,dragRotate:W,showParticles:B,particleStyle:_,tileURL:T,tileAttribution:F,tileCacheSize:H,size:q,width:G,height:V,responsiveWidth:U,responsiveHeight:Z,margin:Y,className:X,background:K,areaStyle:J,pointStyle:ne,lineStyle:oe,colorScheme:ie,enableHover:re=!0,hoverAnnotation:se,tooltipContent:le,customClickBehavior:ae,customHoverBehavior:ce,annotations:ue,autoPlaceAnnotations:de,decay:he,pulse:fe,transition:pe,animate:ge,staleness:me,backgroundGraphics:ye,foregroundGraphics:ve,title:be,legend:xe,legendPosition:je,legendLayout:ke,legendHoverBehavior:we,legendClickBehavior:Me,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,legendCategoryAccessor:Ae,onCategoriesChange:Ce,showAxes:Pe,accessibleTable:Le=!0,description:ze,summary:Re}=n,De=q||[G||600,V||400],Ie=t.useRef(!0),$e=ee({sizeProp:De,responsiveWidth:U,responsiveHeight:Z,userMargin:Y,marginDefault:yn,foregroundGraphics:ve,backgroundGraphics:ye,animate:ge,transitionProp:pe,themeDirtyRef:Ie}),{reducedMotionRef:Ee,responsiveRef:Ne,size:We,margin:Be,adjustedWidth:_e,adjustedHeight:Te,resolvedForeground:Fe,resolvedBackground:He,transition:qe,introEnabled:Ge,tableId:Ve,rafRef:Ue,renderFnRef:Ze,scheduleRender:Ye,currentTheme:Xe}=$e,Qe=function(){const[e,n]=t.useState(!1);return yt(()=>{n(!0)},[]),e}(),Ke=function(){const e=t.useSyncExternalStore(vt,bt,xt);return t.useRef(e).current}(),Je=t.useMemo(()=>Array.isArray(j)?Gt(j):j,[j]),et=t.useMemo(()=>Gt(k),[k]),tt=t.useMemo(()=>Gt(w),[w]),nt=t.useMemo(()=>null!=W?W:"orthographic"===xn(y),[W,y]),ot=t.useMemo(()=>{var e,t;return{projection:y,projectionExtent:v,fitPadding:b,xAccessor:M,yAccessor:O,lineDataAccessor:S,lineType:L,flowStyle:R,areaStyle:J,pointStyle:ne,lineStyle:oe,colorScheme:ie,themeSemantic:$(Xe),themeSequential:null===(e=null==Xe?void 0:Xe.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==Xe?void 0:Xe.colors)||void 0===t?void 0:t.diverging,graticule:D,projectionTransform:x,decay:he,pulse:fe,transition:qe,introAnimation:Ge,annotations:ue,pointIdAccessor:C,lineIdAccessor:P}},[y,v,b,M,O,S,L,R,J,ne,oe,ie,D,x,he,fe,null==qe?void 0:qe.duration,null==qe?void 0:qe.easing,Ge,ue,C,P,Xe]),it=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return kt(e,t);if(!wt(e)||!wt(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(!kt(n,i))return!1}else{if(!wt(n)||!wt(i))return!1;if(!jt(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(ot),rt=t.useRef(null);rt.current||(rt.current=new A(it));const st=t.useRef(null),lt=t.useRef(null),at=t.useRef(null),ct=t.useRef(null),ut=t.useRef(null);T&&!ut.current&&(ut.current=new fn(H||256));const dt=t.useRef(ue),ht=t.useRef(null),ft=t.useRef(c.zoomIdentity),Mt=t.useRef(!1),Ot=t.useRef(null),At=t.useCallback(e=>{Ot.current=e,Ne&&"object"==typeof Ne&&(Ne.current=e)},[Ne]),Ct=t.useRef(null),Pt=t.useRef(null),Lt=t.useRef(null),zt=t.useRef(0);if(B&&!Lt.current){const e=null!==(i=null==_?void 0:_.maxPerLine)&&void 0!==i?i:30;Lt.current=new pn(50*e)}const Rt=t.useRef(null),Dt=t.useRef(null),[It,$t]=t.useState(null),[Et,Nt]=t.useState(0),[Wt,Bt]=t.useState(!1),qt=t.useRef([]),Vt=t.useRef(Ae),Zt=t.useRef(Ce);Vt.current=Ae,Zt.current=Ce;const Yt=t.useCallback(()=>{var e,t;const n=Vt.current,o=Zt.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=rt.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))},[]);t.useEffect(()=>{var e;null===(e=rt.current)||void 0===e||e.updateConfig(it),Ie.current=!0,Ye()},[it,Ye]),t.useEffect(()=>{const e=rt.current;e&&(Je&&e.setAreas(Je),k&&e.setPoints(et),w&&e.setLines(tt),Ie.current=!0,Ye())},[Je,k,et,w,tt,Ye]);const Xt=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=rt.current)||void 0===t||t.pushPoint(e),Ie.current=!0,Ye())},[Ye]),Qt=t.useCallback(e=>{var t;const n=Gt(e);0!==n.length&&(null===(t=rt.current)||void 0===t||t.pushMany(n),Ie.current=!0,Ye())},[Ye]),Kt=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=rt.current)||void 0===t||t.pushLine(e),Ie.current=!0,Ye())},[Ye]),en=t.useCallback(e=>{var t;const n=Gt(e);0!==n.length&&(null===(t=rt.current)||void 0===t||t.pushManyLines(n),Ie.current=!0,Ye())},[Ye]),gn=t.useCallback(()=>{var e;null===(e=rt.current)||void 0===e||e.clear(),Ie.current=!0,Ye()},[Ye]);t.useImperativeHandle(o,()=>({push:Xt,pushMany:Qt,removePoint:e=>{var t,n;const o=null!==(n=null===(t=rt.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Ie.current=!0,Ye()),o},pushLine:Kt,pushManyLines:en,removeLine:e=>{var t,n;const o=null!==(n=null===(t=rt.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[];return o.length>0&&(Ie.current=!0,Ye()),o},getLines:()=>{var e,t;return null!==(t=null===(e=rt.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]},clear:gn,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=rt.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=rt.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=rt.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>ft.current.k,resetZoom:()=>{const e=Ot.current;e&&ht.current&&u.select(e).call(ht.current.transform,c.zoomIdentity)},getData:()=>{var e,t;return null!==(t=null===(e=rt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[Xt,Qt,Kt,en,gn,Ye]);const{hoverHandlerRef:mn,onPointerMove:vn,onPointerLeave:wn}=$e;t.useEffect(()=>{mn.current=e=>{if(!re)return;const t=rt.current;if(!t||!t.scene.length)return;const n=lt.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-Be.left,r=e.clientY-o.top-Be.top;if(0>i||i>_e||0>r||r>Te)return Rt.current=null,Dt.current=null,$t(null),null==ce||ce(null),void Ye();ct.current||(ct.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=jn(ct.current);if(!s)return;const l=z(t.scene,i,r,30,s,t.quadtree,t.maxPointRadius);if(l){const e=l.node,t=e.datum,n=Array.isArray(t)?null:(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,s;"point"===e.type?(o=e.x,s=e.y):"geoarea"===e.type?(o=e.centroid[0],s=e.centroid[1]):(o=i,s=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:s});Rt.current=a,Dt.current=e,$t(a),null==ce||ce(a),Ye()}else Rt.current&&(Rt.current=null,Dt.current=null,$t(null),null==ce||ce(null),Ye())}},[re,_e,Te,Be,ce,Ye]),$e.hoverLeaveRef.current=()=>{Rt.current=null,Dt.current=null,$t(null),null==ce||ce(null),Ye()};const Mn=t.useCallback(e=>{if(!ae)return;const t=rt.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Be.left,i=e.clientY-n.top-Be.top;ct.current||(ct.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=jn(ct.current);if(!r)return;const s=z(t.scene,o,i,30,r,t.quadtree,t.maxPointRadius);if(s){const e=s.node.datum,t=Array.isArray(e)?null:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;ae(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i}))}},[ae,Be]),On=t.useRef(-1),Sn=t.useRef(null),An=t.useCallback(e=>{const t=rt.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=On.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 On.current=-1,Sn.current=null,Rt.current=null,Dt.current=null,$t(null),null==ce||ce(null),void Ye();const r=0>o?0:i;On.current=r;const s=n[r];Sn.current={shape:s.shape,w:s.w,h:s.h};const l=s.datum,a=Object.assign(Object.assign(Object.assign({},l||{}),(null==l?void 0:l.properties)||{}),{data:l,properties:null==l?void 0:l.properties,x:s.x,y:s.y,__semioticHoverData:!0});Rt.current=a,$t(a),null==ce||ce(a),Ye()},[ce,Ye]),Cn=t.useCallback(e=>{On.current=-1,Sn.current=null,vn(e)},[vn]);Ze.current=()=>{var e,t,n,o,i,r,s;Ue.current=0;const a=lt.current,c=rt.current;if(!a||!c)return;const u=performance.now();let d=!1;const h=Pt.current;h&&(Pt.current=null,c.applyRotation(h,{width:_e,height:Te}));const f=c.advanceTransition(Ee.current?u+1e6:u),p=!Ee.current&&f;if(Ie.current&&!f){const e={width:_e,height:Te},t=nt?c.getRotation():null;c.computeScene(e);const n=ft.current,o=1!==n.k||0!==n.x||0!==n.y;nt&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),Ie.current=!1,a.setAttribute("aria-label",St(c.scene,"Geographic chart")),Yt()}const g=un();if(T&&ut.current){const t=st.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=cn(t,We,Be,g);if(e){e.clearRect(-Be.left,-Be.top,We[0],We[1]),e.save(),e.beginPath(),e.rect(0,0,_e,Te),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:i,height:r,tileCache:s,onTileLoad:l}=t,a=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:i=!0,clampY:r=!0}=e,s=Math.max(Math.log(n)/Math.LN2-8,0),l=Math.round(s),a=1<<l,c=Math.pow(2,s-l+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)),m=[];for(let e=p;g>e;++e)for(let t=h;f>t;++t)m.push([t,e,l]);return{tiles:m,translate:[u/c,d/c],scale:c}}({size:[i,r],scale:2*a*Math.PI,translate:c}),d=un();let h=!0;for(const t of u.tiles){const[o,i,r]=dn(t),a=`${r}/${o}/${i}`;let c=s.get(a);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:a,lastUsed:performance.now()};s.set(a,t),e.onload=()=>{t.loaded=!0,null==l||l()},e.onerror=()=>{t.loaded=!0},e.src=hn(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:T,projection:c.scales.projection,width:_e,height:Te,tileCache:ut.current,onTileLoad:()=>Ye()});e.restore(),t||(d=!0)}}}const m=cn(a,We,Be,g);if(!m)return;if(m.clearRect(-Be.left,-Be.top,We[0],We[1]),K&&!T){const e=Q(m,K);e&&(m.fillStyle=e,m.fillRect(0,0,_e,Te))}m.save(),m.beginPath(),m.rect(0,0,_e,Te),m.clip();const y=c.scene,v={width:_e,height:Te};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;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const r=t._cachedPath2D,s=t.style.fill||"#e0e0e0";if("none"!==s&&(e.fillStyle=s,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=Q(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)}nn(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(m,y),((e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const c=a._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=a.style.stroke||"#007bff",d=Q(e,u)||u,h=a.style.strokeWidth||2,f=a.colorThresholds,p=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=h,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;an(e,a.path,d,h,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=on(a.curve),m=f&&f.length>0&&p&&p.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!m){e.strokeStyle=d;const b=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(y[x]+y[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(m){let j=null,k=null,w=null,M=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function A(){O&&(e.stroke(),O=!1)}for(let C=0;a.path.length>C;C++){const[P,L]=a.path[C],z=p[C],R=ln(z,f,d);if(null!==j&&null!==M&&null!==w){if(R===M)e.lineTo(P,L);else{const D=[];for(const I of f){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 E of D){const N=j+(P-j)*E.t,W=k+(L-k)*E.t,B=ln(w+(z-w)*Math.min(E.t+1e-4,1),f,d);e.lineTo(N,W),A(),S(B,N,W)}e.lineTo(P,L)}j=P,k=L,w=z,M=R}else S(R,P,L),j=P,k=L,w=z,M=R}A()}else{e.beginPath();const _=a.strokeGradient&&a.path.length>=2?sn(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=_||d,g)l.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[T,F]=a.path[0];e.moveTo(T,F);for(let H=1;a.path.length>H;H++)e.lineTo(a.path[H][0],a.path[H][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=rn(e,a.style.fill,a.style.fill),g&&!m)l.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[G,V]=a.path[0];e.moveTo(G,V);for(let U=1;a.path.length>U;U++)e.lineTo(a.path[U][0],a.path[U][1])}const q=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(q,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(m,y,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=rn(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=rn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),tn(e,t),e.globalAlpha=1}}finally{e.restore()}}})(m,y),B&&Lt.current){const e=Lt.current,l=y.filter(e=>"line"===e.type);if(l.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,y=u/1e3,v=zt.current>0?Math.min(y-zt.current,.1):.016;zt.current=y;const b=l.map(e=>e.path),x=l.map(e=>e.style.strokeWidth||2);for(let t=0;l.length>t;t++)Math.random()<f&&e.countForLine(t)<h&&e.spawn(t);e.step(v,c,b,x),m.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=l[n.lineIndex],i="function"==typeof a.color?a.color(null!==(s=null==o?void 0:o.datum)&&void 0!==s?s:{}):"source"!==a.color&&a.color?a.color:(null==o?void 0:o.style.stroke)||"#fff";m.beginPath(),m.arc(n.x,n.y,p,0,2*Math.PI),m.fillStyle=i,m.fill()}m.globalAlpha=1,d=!0}}m.restore();const b=at.current;if(b){const e=cn(b,We,Be,g);if(e){e.clearRect(-Be.left,-Be.top,We[0],We[1]);const t=Dt.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof se?se:void 0,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()}}}const x=ue!==dt.current;x&&(dt.current=ue),(Ie.current||x)&&Nt(e=>e+1),(p||null!=c.activeTransition||c.hasActivePulses||d)&&(Ue.current=requestAnimationFrame(()=>Ze.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:l}=e;yt(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[n,o]);const a=t.useRef(l);a.current=l,t.useEffect(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:Qe,wasHydratingFromSSR:Ke,storeRef:rt,dirtyRef:Ie,renderFnRef:Ze,cleanup:()=>{var e;return null===(e=ut.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Ie.current=!0,Ye()},[_e,Te,K,Ye]),function(e,n,o,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const l=n.current;if(!l||0===l.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=a-l.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(me,rt,Ie,Ye,Wt,Bt),t.useEffect(()=>{if("production"!==process.env.NODE_ENV&&T){const e=xn(y);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[T,y]),t.useEffect(()=>{const e=Ot.current;if(!I||!e)return ht.current&&e&&(u.select(e).on(".zoom",null),ht.current=null),void(e&&u.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=E||[1,8],o={width:_e,height:Te};if(nt){let i=ft.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),ft.current=c.zoomIdentity.scale(i);const s=rt.current;s&&(s.applyZoomScale(i,o),Ie.current=!1,Ye(),(null===(r=s.scales)||void 0===r?void 0:r.projection)&&(null==N||N({projection:s.scales.projection,zoom:s.currentZoom})))};ht.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 s=e=>{e.preventDefault(),r(i*(0>e.deltaY?1.1:1/1.1))},l=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),r(1.5*i))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",l);const a=.4,u=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=rt.current;if(!o)return;const i=o.getRotation();Ct.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=Ct.current;t&&(Pt.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]],Ye())},h=t=>{var n;if(!Ct.current)return;Ct.current=null,e.releasePointerCapture(t.pointerId);const i=Pt.current;if(i){Pt.current=null;const e=rt.current;e&&(e.applyRotation(i,o),Ye())}const r=rt.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",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",l),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),ht.current=null}}const i=c.zoom().scaleExtent([t,n]).extent([[0,0],[We[0],We[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;ft.current=t,Mt.current=!0;const n=rt.current;n&&(n.applyZoomTransform(t,o),Ie.current=!1,Ye())}).on("end",e=>{var t;ft.current=e.transform,Mt.current=!1;const n=rt.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 ht.current=i,u.select(e).call(i),()=>{u.select(e).on(".zoom",null)}},[I,E,nt,We,_e,Te,Be,N,Ye]);const Pn=re&&!1!==se,Ln=Pn&&It?le?le(It):e.jsx(kn,{data:It}):null,zn=Ln?e.jsx(Jt,{x:It.x,y:It.y,containerWidth:_e,containerHeight:Te,margin:Be,className:"stream-frame-tooltip",zIndex:10,children:Ln}):null;if(mt||!Qe&&Ke){const t=rt.current;t&&(Je||k||w)&&(Je&&t.setAreas(Je),k&&t.setPoints(et),w&&t.setLines(tt),t.computeScene({width:_e,height:Te}));const n=null!==(r=null==t?void 0:t.scene)&&void 0!==r?r:[];return e.jsxs("div",{ref:At,className:"stream-geo-frame"+(X?" "+X:""),role:"img","aria-label":ze||("string"==typeof be?be:"Geographic chart"),style:{position:"relative",width:U?"100%":We[0],height:Z?"100%":We[1]},children:[e.jsx(Tt,{summary:Re}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:We[0],height:We[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${Be.left},${Be.top})`,children:He}),e.jsxs("g",{transform:`translate(${Be.left},${Be.top})`,children:[K&&e.jsx("rect",{x:0,y:0,width:_e,height:Te,fill:K}),n.map((t,n)=>function(t,n){var o,i,r,s,l,a;switch(t.type){case"geoarea":{const r=t;return r.pathData?e.jsx("path",{d:r.pathData,fill:gt(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.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:gt(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(s=o._decayOpacity)&&void 0!==s?s:null!==(l=o.style.opacity)&&void 0!==l?l: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.jsx("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.jsx(pt,{width:_e,height:Te,totalWidth:We[0],totalHeight:We[1],margin:Be,scales:null,showAxes:!1,title:be,legend:xe,legendPosition:je,legendLayout:ke,legendHoverBehavior:we,legendClickBehavior:Me,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,foregroundGraphics:Fe,annotations:ue,autoPlaceAnnotations:de,annotationFrame:0,xValues:[],yValues:[],pointNodes:n.filter(e=>"point"===e.type)})]})}return e.jsxs("div",{ref:At,className:"stream-geo-frame"+(X?" "+X:""),role:"group","aria-label":ze||("string"==typeof be?be:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:U?"100%":We[0],height:Z?"100%":We[1],overflow:"hidden"},I?{touchAction:"none"}:{}),onKeyDown:An,children:[Le&&e.jsx(Ft,{tableId:Ve}),Le&&e.jsx(_t,{scene:null!==(a=null===(s=rt.current)||void 0===s?void 0:s.scene)&&void 0!==a?a:[],chartType:"Geographic chart",tableId:Ve,chartTitle:"string"==typeof be?be:void 0}),e.jsx(Tt,{summary:Re}),e.jsx(Ht,{hoverPoint:It}),e.jsxs("div",{role:"img","aria-label":ze||("string"==typeof be?be:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Pn?Cn:void 0,onMouseLeave:Pn?wn:void 0,onClick:ae?Mn:void 0,children:[He&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:We[0],height:We[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Be.left},${Be.top})`,children:He})}),T&&e.jsx("canvas",{ref:st,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx("canvas",{ref:lt,"aria-label":St(null!==(h=null===(d=rt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:at,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(pt,{width:_e,height:Te,totalWidth:We[0],totalHeight:We[1],margin:Be,scales:null,showAxes:null!=Pe&&Pe,title:be,legend:xe,legendPosition:je,legendLayout:ke,legendHoverBehavior:we,legendClickBehavior:Me,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,foregroundGraphics:Fe,annotations:ue,autoPlaceAnnotations:de,annotationFrame:Et,xValues:[],yValues:[],pointNodes:null===(f=rt.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type)}),(null==me?void 0:me.showBadge)&&e.jsx(te,{isStale:Wt,position:me.badgePosition}),I&&e.jsxs("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Be.bottom+8,left:Be.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e.jsx("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Ot.current,n=ht.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1.5)},style:bn,children:"+"}),e.jsx("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Ot.current,n=ht.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1/1.5)},style:bn,children:"−"})]}),F&&e.jsx("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Be.bottom+2,right:Be.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.jsx(Ut,{active:On.current>=0,hoverPoint:It,margin:Be,size:We,shape:null===(p=Sn.current)||void 0===p?void 0:p.shape,width:null===(g=Sn.current)||void 0===g?void 0:g.w,height:null===(m=Sn.current)||void 0===m?void 0:m.h}),zn]})]})});function Mn(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function On(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Sn(e){const t=e.map(Mn),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return On(e,n,o)}if(e>=1){const[e,o,i]=t[n];return On(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,l,a]=t[i],[c,u,d]=t[i+1];return On(Math.round(s+(c-s)*r),Math.round(l+(u-l)*r),Math.round(a+(d-a)*r))}}wn.displayName="StreamGeoFrame";const An=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Cn=Sn(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Pn=Sn(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ln=Sn(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),zn=Sn(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Rn=Sn(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Dn=Sn(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),In=Sn(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),$n=Sn(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),En=Sn(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Nn=Sn(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Wn=Sn(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Bn=Sn(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);Sn(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Sn(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Sn(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Sn(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Sn(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Sn(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Sn(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const _n={category10:An,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Cn,reds:Pn,greens:Ln,oranges:zn,purples:Rn,viridis:In,plasma:$n},Tn=An,Fn=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Hn=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function qn(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Hn.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Tn[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))%Tn.length]}function Gn(e,t,n="category10"){const i=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=i.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return o.scaleOrdinal().domain(i).range(n).unknown("#999");const s=_n[n]||_n.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of i){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:Tn;return o.scaleOrdinal().domain(i).range(e).unknown("#999")}}function Vn(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,s]=o,[l,a]=n;if(s===r)return(l+a)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),l+c*(a-l)}const Un=t.createContext(null);function Zn(){return t.useContext(Un)}function Yn(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 Xn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Qn,Kn]=D(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Xn(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=Xn(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}})}})),[Jn,eo]=D(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 to(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=Kn(e=>e.selections.get(i)),s=Kn(e=>e.setClause),l=Kn(e=>e.clearClause),a=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Yn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:a,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{l(i,o)},[l,i,o]),clientId:o}}function no(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:l}=to({name:n});return{onHover:t.useCallback(e=>{if(!e)return void l();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,l,n]),predicate:i,isActive:r}}const oo=t.createContext(!1),io=t.createContext(null),ro="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function so(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,seriesField:e.seriesField}:null}function lo(e,t,n){return t?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}function ao(){return H(e=>e.theme)}f.createContext(void 0);const co="#007bff";function uo(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 ho(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 fo(){var e;const t=ao(),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 po({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:l,onClick:a,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=so(n,o),f="series"===(null==h?void 0:h.mode)?[h.seriesField||u||o[0]].filter(e=>!!e):(null==h?void 0:h.fields)||o||[],p=to({name:(null==e?void 0:e.name)||"__unused__"}),g=no({name:(null==h?void 0:h.name)||"hover",fields:f}),m=eo(e=>e.pushObservation),y=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,b]=t.useState(null),x=u||o[0],j=t.useMemo(()=>{if(!c||null==v||!x)return null;const e=v,t=x;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,v,x]),k=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const n=uo(e,t,h.xField);null!=n&&function(e,t,n){const o=Xe.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Xe={positions:new Map(Xe.positions).set(e,{xValue:t,sourceId:n})},Ke())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&g.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Je(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&g.onHover(null);if(c&&x)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[x];b(null!=n?n+"":null)}else b(null);if(r||m){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const i=ho(e),s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),m&&m(e)}}},[n,g,h,d,r,s,l,m,c,x]),w=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=uo(e,t,h.xField);null!=n&&function(e,t,n){const o=Xe.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Xe.positions);return t.delete(e),Xe={positions:t},Ke(),!1}Xe={positions:new Map(Xe.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Ke()}(h.name||"hover",n,d)}if(e&&a){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),a(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||m){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const n=ho(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),m&&m(e)}}},[a,r,m,s,l,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{et(e,d),Je(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:j,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:d}}function go({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:a}){const c=t.useContext(oo),u=null!==t.useContext(io),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),f=t.useMemo(()=>{if(!h)return[];if(void 0!==a)return a;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[a,n,e,h]);!function(e){const n=t.useContext(io),o=t.useId(),i=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=t.useRef([]);(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,i)||(r.current=i);const s=r.current;ro(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),ro(()=>{n&&n.registerCategories(o,s)},[n,o,s])}(u&&n?f:[]);const p=t.useMemo(()=>{if(!d||!n)return;const t=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){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:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),l=s?o(s,t,n):n?n(i):Fn[r%Fn.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:qn,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,f]),g=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:l[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[l,s,p,r]);return{legend:p,margin:g,legendPosition:r}}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 yo(e,t,n){var o,i,r,s,l,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!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(l=t.enableHover)&&void 0!==l?l:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:vo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function vo(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function bo(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 xo({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("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:o})]})})}class jo extends f.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.jsx(xo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var ko;const wo="undefined"!=typeof process&&"production"!==(null===(ko=process.env)||void 0===ko?void 0:ko.NODE_ENV);function Mo({componentName:t,width:n,height:o,children:i}){return e.jsx(jo,{fallback:i=>e.jsx(xo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Oo={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},So={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Ao(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Oo),{width:n,height:o}),children:i||"No data available"}):null}function Co(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("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)),s=Math.max(8,Math.floor(o/(3*r))),l=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(s+l)-l))/2);return e.jsx("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.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},So),{position:"absolute",top:a+o*(s+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}function Po(e,t,n,o){if(!wo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Lo(e){const n=H(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function zo(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(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(s,l)}a((o=o.apply(e,t||[])).next())})}function Ro(e){return e}function Do(e,t){var n=t.id,o=t.bbox,i=null==t.properties?{}:t.properties,r=function(e,t){var n=function(e){if(null==e)return Ro;var t,n,o=e.scale[0],i=e.scale[1],r=e.translate[0],s=e.translate[1];return function(e,l){l||(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+s;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,s=i.length;s>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,s)}function r(e){return n(e)}function s(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 l(e){for(var t=s(e);4>t.length;)t.push(t[0]);return t}function a(e){return e.map(l)}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=s(t.arcs);break;case"MultiLineString":n=t.arcs.map(s);break;case"Polygon":n=a(t.arcs);break;case"MultiPolygon":n=t.arcs.map(a);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:i,geometry:r}:null==o?{type:"Feature",id:n,properties:i,geometry:r}:{type:"Feature",id:n,bbox:o,properties:i,geometry:r}}"function"==typeof SuppressedError&&SuppressedError;const Io=new Map;function $o(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function Eo(e){return zo(this,void 0,void 0,function*(){const t=Io.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return zo(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:$o(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:$o(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:$o(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:$o(yield import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}})}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const i=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return Do(e,t)})}:Do(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return Io.set(e,r),r})}function No(e){const n=t.useMemo(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=t.useState(null);return t.useEffect(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),Eo(e).then(e=>{t||i(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".`),i(null)}else i(null)},[e]),void 0!==n?n:o}const Wo={blues:Cn,reds:Pn,greens:Ln,viridis:In,oranges:zn,purples:Rn,greys:Dn,plasma:$n,inferno:En,magma:Nn,cividis:Wn,turbo:Bn};function Bo(n){var i;const s=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),l=function(){var e;const t=ao();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:a,valueAccessor:c,colorScheme:u,projection:d="equalEarth",graticule:h,fitPadding:f,zoomable:p,zoomExtent:g,onZoom:m,dragRotate:y,tileURL:v,tileAttribution:b,tileCacheSize:x,tooltip:j,areaOpacity:k=1,annotations:w,margin:M,className:O,selection:S,linkedHover:A,onObservation:C,onClick:P,chartId:L,loading:z,loadingContent:R,emptyContent:D,frameProps:I={},stroke:$,strokeWidth:E,opacity:N}=n,W=null!=p?p:!!v,B=No(a),_=t.useMemo(()=>B?Gt(B):B,[B]),T=t.useMemo(()=>"function"==typeof c?c:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[c])&&void 0!==n?n:null==e?void 0:e[c]},[c]),F=null!==(i=null!=u?u:l)&&void 0!==i?i:"blues",H=t.useMemo(()=>{if(!_)return o.scaleSequential(Cn).domain([0,1]);const e=_.map(e=>T(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=r.extent(e);return o.scaleSequential(Wo[F]||Cn).domain([null!=t?t:0,null!=n?n:1])},[_,T,F]),{activeSelectionHook:q,customHoverBehavior:G,customClickBehavior:V}=po({selection:S,linkedHover:A,onObservation:C,onClick:P,chartType:"ChoroplethMap",chartId:L}),U=Lo(S),Z=t.useMemo(()=>{const e=bo(e=>{const t=T(e);return{fill:null!=t&&isFinite(t)?H(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}},{stroke:$,strokeWidth:E,opacity:N});return q?lo(e,q,U):e},[T,H,q,U,k,$,E,N]),Y=t.useMemo(()=>t=>{var n,o;const i=(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.name)||(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||"Feature",r=T(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:i}),null!=r&&e.jsx("div",{style:{opacity:.7},children:(s=r,"number"==typeof s&&isFinite(s)?Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=s?s:"")+"")})]});var s},[T]),X=t.useMemo(()=>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}(M)),[M]),Q=Co(z,s.width,s.height,R)||(_?null:Co(!0,s.width,s.height,R)),K=Q?null:Ao(_,s.width,s.height,D);if(Array.isArray(_)&&_.length>0){const t=_[0];if(!t||"object"!=typeof t||!t.geometry)return e.jsx(xo,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:s.width,height:s.height})}const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:d,areas:_,areaStyle:Z,size:[s.width,s.height],margin:X,enableHover:!0,tooltipContent:!1===j?()=>null:!0===j?Y:Kt(j)||Y},null!=h&&{graticule:h}),null!=f&&{fitPadding:f}),W&&{zoomable:!0}),g&&{zoomExtent:g}),m&&{onZoom:m}),null!=y&&{dragRotate:y}),v&&{tileURL:v}),b&&{tileAttribution:b}),x&&{tileCacheSize:x}),(A||C||P)&&{customHoverBehavior:G}),(C||P)&&{customClickBehavior:V}),w&&w.length>0&&{annotations:w}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),s.title&&{title:s.title}),s.description&&{description:s.description}),s.summary&&{summary:s.summary}),void 0!==s.accessibleTable&&{accessibleTable:s.accessibleTable}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),I);return Q||K||e.jsx(Mo,{componentName:"ChoroplethMap",width:s.width,height:s.height,children:e.jsx(wn,Object.assign({},J))})}function _o(e){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:l,selection:a,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:f,chartId:p,showLegend:g,userMargin:m,marginDefaults:y,onClick:v,hoverHighlight:b,loading:x,loadingContent:j,emptyContent:k,width:w,height:M}=e,O=void 0===o,S=t.useMemo(()=>Gt(n),[n]),[A,C]=t.useState([]),P=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:z,hoverSelectionHook:R,customHoverBehavior:D,customClickBehavior:I,crosshairSourceId:$}=po({selection:a,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:f,chartId:p,onClick:v,hoverHighlight:b,colorByField:L}),E=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}}(c,$),N=function(e,n,o){const i=Zn(),r=fo();return t.useMemo(()=>{var t;if(!n)return;const s=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(i&&Object.keys(i).length>0){const e=Gn(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return Gn(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=Gn(e,n,s);return e=>i[e]||t(e)}return Gn(e,n,s)}if(i&&Object.keys(i).length>0){const e=Gn([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,n,o,i,r])}(S,i,r),W=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of S){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[S,i]),B=t.useMemo(()=>O&&A.length>0?A:W,[O,A,W]),_=function(e,n,o){const[i,r]=t.useState(null),[s,l]=t.useState(new Set),a=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:a,onLegendClick:c,legendSelectionHook:u}}(s,i,B),T=t.useMemo(()=>R||(_.legendSelectionHook?_.legendSelectionHook:z),[R,_.legendSelectionHook,z]),F=Lo(a),H=fo(),q=Zn(),G=t.useMemo(()=>{if(N)return N;if(!i||0===B.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:H&&H.length>0?H:Fn,t="__streamCat",n=Gn(B.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||n(e)||"#999"},[N,i,B,r,H,q]),{legend:V,margin:U,legendPosition:Z}=go({data:S,colorBy:i,colorScale:G,showLegend:g,legendPosition:l,userMargin:m,defaults:y,categories:B}),Y=t.useMemo(()=>{const e={};return V&&(e.legend=V,e.legendPosition=Z),s&&"none"!==s&&(e.legendHoverBehavior=_.onLegendHover,e.legendClickBehavior=_.onLegendClick,e.legendHighlightedCategory=_.highlightedCategory,e.legendIsolatedCategories=_.isolatedCategories),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=P),e},[V,Z,s,_.onLegendHover,_.onLegendClick,_.highlightedCategory,_.isolatedCategories,O,i,P]),X=Array.isArray(o)?Gt(o):o,Q=Co(x,w,M,j),K=Q?null:Ao(X,w,M,k);return{data:S,colorScale:N,allCategories:B,legendState:_,effectiveSelectionHook:T,activeSelectionHook:z,customHoverBehavior:D,customClickBehavior:I,legend:V,margin:U,legendPosition:Z,earlyReturn:Q||K||null,legendBehaviorProps:Y,crosshairProps:E,resolvedSelection:F}}function To(e,n){const{variant:o,frameRef:i,overrides:r,deps:s}=n;t.useImperativeHandle(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,s;const l=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 l){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===(s=e.current)||void 0===s||s.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 s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},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 s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},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:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}Bo.displayName="ChoroplethMap";const Fo=t.forwardRef(function(n,o){const i=t.useRef(null);To(o,{variant:"geo-points",frameRef:i});const r=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:s,xAccessor:l="lon",yAccessor:a="lat",sizeBy:c,sizeRange:u=[3,30],colorBy:d,colorScheme:h,projection:f="equalEarth",graticule:p,fitPadding:g,zoomable:m,zoomExtent:y,onZoom:v,dragRotate:b,tileURL:x,tileAttribution:j,tileCacheSize:k,areas:w,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:O,annotations:S,margin:A,className:C,selection:P,linkedHover:L,onObservation:z,onClick:R,chartId:D,loading:I,loadingContent:$,emptyContent:E,legendInteraction:N,legendPosition:W,frameProps:B={},stroke:_,strokeWidth:T,opacity:F}=n,H=null!=m?m:!!x,q=No(w),G=_o({data:null!=s?s:qt,rawData:s,colorBy:d,colorScheme:h,legendInteraction:N,legendPosition:W,selection:P,linkedHover:L,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!1,onObservation:z,onClick:R,chartType:"ProportionalSymbolMap",chartId:D,showLegend:r.showLegend,userMargin:A,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:I,loadingContent:$,emptyContent:E,width:r.width,height:r.height}),V=G.data,U=t.useMemo(()=>{if(!c)return;const e="function"==typeof c?c:e=>null==e?void 0:e[c],t=V.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[V,c]),Z=t.useMemo(()=>{const e=bo(e=>({fill:d?qn(e,d,G.colorScale):co,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:c?Vn(e,c,u,U):6}),{stroke:_,strokeWidth:T,opacity:F});return G.effectiveSelectionHook?lo(e,G.effectiveSelectionHook,G.resolvedSelection):e},[d,G.colorScale,G.effectiveSelectionHook,G.resolvedSelection,c,u,U,_,T,F]),Y=t.useMemo(()=>t=>{const n=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t.NAME)||(null==t?void 0:t.id),o="string"==typeof c?c:null,i=("function"==typeof c?c:e=>e[c])(t),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",s="string"==typeof d?d:null,l=s?null==t?void 0:t[s]:null;return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[n&&e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:n}),o&&null!=i&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[o,": "]}),r(i)]}),s&&null!=l&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[s,": "]}),l+""]}),!n&&!o&&Object.entries(t).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),r(n)]},t))]})},[c,d]);if(G.earlyReturn)return G.earlyReturn;Po("ProportionalSymbolMap",V,"xAccessor",l),Po("ProportionalSymbolMap",V,"yAccessor",a);const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:f},null!=s&&{points:V}),{xAccessor:l,yAccessor:a,pointStyle:Z}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),q&&{areas:q,areaStyle:M}),null!=p&&{graticule:p}),null!=g&&{fitPadding:g}),H&&{zoomable:!0}),y&&{zoomExtent:y}),v&&{onZoom:v}),null!=b&&{dragRotate:b}),x&&{tileURL:x}),j&&{tileAttribution:j}),k&&{tileCacheSize:k}),{size:[r.width,r.height],margin:G.margin,enableHover:!0,tooltipContent:!1===O?()=>null:Kt(O)||Y}),G.legendBehaviorProps),(L||z||R)&&{customHoverBehavior:G.customHoverBehavior}),(z||R)&&{customClickBehavior:G.customClickBehavior}),S&&S.length>0&&{annotations:S}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),C&&{className:C}),null!=n.animate&&{animate:n.animate}),B);return e.jsx(Mo,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:e.jsx(wn,Object.assign({ref:i},X))})});Fo.displayName="ProportionalSymbolMap";const Ho="__semiotic_x",qo="__semiotic_y",Go=t.forwardRef(function(n,i){const r=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:s,nodes:l,nodeIdAccessor:a="id",xAccessor:c="lon",yAccessor:u="lat",valueAccessor:d="value",projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:g,zoomExtent:m,onZoom:y,dragRotate:v,tileURL:b,tileAttribution:x,tileCacheSize:j,lineType:k="geo",flowStyle:w="basic",areas:M,areaStyle:O={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:S,edgeOpacity:A=.6,edgeWidthRange:C=[1,8],edgeLinecap:P="round",colorScheme:L,showParticles:z,particleStyle:R,tooltip:D,annotations:I,margin:$,className:E,selection:N,linkedHover:W,onObservation:B,onClick:_,chartId:T,loading:F,loadingContent:H,emptyContent:q,frameProps:G={},legendInteraction:V,legendPosition:U,stroke:Z,strokeWidth:Y,opacity:X,lineIdAccessor:Q}=n,K=null!=g?g:!!b,J=No(M),ee=t.useMemo(()=>Gt(l),[l]),te=_o({data:null!=s?s:qt,rawData:s,colorBy:S,colorScheme:L,legendInteraction:V,legendPosition:U,selection:N,linkedHover:W,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:B,onClick:_,chartType:"FlowMap",chartId:T,showLegend:r.showLegend,userMargin:$,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:F,loadingContent:H,emptyContent:q,width:r.width,height:r.height}),ne=te.data,oe=so(W),ie=no({name:(null==oe?void 0:oe.name)||"hover",fields:(null==oe?void 0:oe.fields)||[]}),re=eo(e=>e.pushObservation),se=t.useMemo(()=>{const e=new Map;for(const t of ee)e.set(t[a]+"",t);return e},[ee,a]),le=t.useRef(null),ae=t.useRef(se);ae.current=se;const ce=t.useRef(c);ce.current=c;const ue=t.useRef(u);ue.current=u;const de=t.useCallback(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const i="function"==typeof ce.current?ce.current:e=>e[ce.current],r="function"==typeof ue.current?ue.current:e=>e[ue.current];return Object.assign(Object.assign({},e),{coordinates:[{[Ho]:i(n),[qo]:r(n)},{[Ho]:i(o),[qo]:r(o)}]})},[]);To(i,{variant:"geo-lines",frameRef:le,overrides:{push:e=>{var t;const n=de(e);n&&(null===(t=le.current)||void 0===t||t.pushLine(n))},pushMany:e=>{var t;const n=[];for(const t of e){const e=de(t);e&&n.push(e)}n.length>0&&(null===(t=le.current)||void 0===t||t.pushManyLines(n))}}});const he=t.useMemo(()=>{const e=new Map;for(const t of ne)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[ne]),fe=t.useCallback(e=>{var t,n;if(W)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=he.get(t[a]+"");e&&ie.onHover(e)}else ie.onHover(t)}else ie.onHover(null);if(B||re){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:T};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});B&&B(r),re&&re(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});B&&B(e),re&&re(e)}}},[W,ie,a,he,B,T,re]),pe=te.customClickBehavior,ge=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];return ne.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=se.get(n.source+""),i=se.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[Ho]:e(o),[qo]:t(o)},{[Ho]:e(i),[qo]:t(i)}]}):null}).filter(Boolean)},[ne,se,c,u]),me=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c];return t=>null!=t&&"object"==typeof t&&Ho in t?t[Ho]:e(t)},[c]),ye=t.useMemo(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&qo in t?t[qo]:e(t)},[u]),ve=t.useMemo(()=>{const e=ne.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[d])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>C[0]:o.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(C)},[ne,d,C]),be=t.useMemo(()=>e=>{var t;return{stroke:S?qn(e,S,te.colorScale):co,strokeWidth:ve(null!==(t=e[d])&&void 0!==t?t:0),strokeLinecap:P,opacity:A}},[S,te.colorScale,ve,d,A,P]),xe=t.useMemo(()=>{var e;const t=bo(be,{stroke:Z,strokeWidth:Y,opacity:X});if(!te.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=te.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return lo(t,te.effectiveSelectionHook,Object.assign(Object.assign({},te.resolvedSelection||{}),{unselectedStyle:n}))},[be,te.effectiveSelectionHook,te.resolvedSelection,Z,Y,X]),je=t.useMemo(()=>bo(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:Z,strokeWidth:Y,opacity:X}),[Z,Y,X]),ke=t.useMemo(()=>t=>{var n,o,i,r,s,l,c;if((null==t?void 0:t.geometry)||(null==t?void 0:t.properties)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.geometry)){const n=(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.name)||(null===(i=null==t?void 0:t.properties)||void 0===i?void 0:i.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||(null===(s=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.properties)||void 0===s?void 0:s.name)||(null===(c=null===(l=null==t?void 0:t.data)||void 0===l?void 0:l.properties)||void 0===c?void 0:c.NAME);if(n)return e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:n})})}if(null!=(null==t?void 0:t.source)&&null!=(null==t?void 0:t.target)){const n=t[d];return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsxs("div",{style:{fontWeight:600},children:[t.source," → ",t.target]}),null!=n&&e.jsx("div",{style:{opacity:.7},children:"number"==typeof n?n.toLocaleString():n})]})}const u=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t[a]);return null!=u?e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:u})}):null},[d,a]);if(te.earlyReturn)return te.earlyReturn;const we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=s&&{lines:ge}),{points:ee,xAccessor:me,yAccessor:ye,lineDataAccessor:"coordinates"}),null!=Q&&{lineIdAccessor:Q}),{lineType:k,flowStyle:w,lineStyle:xe,pointStyle:je}),J&&{areas:J,areaStyle:O}),null!=f&&{graticule:f}),null!=p&&{fitPadding:p}),K&&{zoomable:!0}),m&&{zoomExtent:m}),y&&{onZoom:y}),null!=v&&{dragRotate:v}),z&&{showParticles:z}),R&&{particleStyle:R}),b&&{tileURL:b}),x&&{tileAttribution:x}),j&&{tileCacheSize:j}),{size:[r.width,r.height],margin:te.margin,enableHover:!0,tooltipContent:!1===D?()=>null:Kt(D)||ke}),te.legendBehaviorProps),(W||B||_)&&{customHoverBehavior:fe}),(B||_)&&{customClickBehavior:pe}),I&&I.length>0&&{annotations:I}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),E&&{className:E}),null!=n.animate&&{animate:n.animate}),G);return e.jsx(Mo,{componentName:"FlowMap",width:r.width,height:r.height,children:e.jsx(wn,Object.assign({ref:le},we))})});Go.displayName="FlowMap";const Vo=t.forwardRef(function(n,o){const i=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:r,lines:s,xAccessor:l="lon",yAccessor:a="lat",nodeIdAccessor:c="id",center:u,costAccessor:d,strength:h=1,lineMode:f="straight",projection:p="mercator",graticule:g,fitPadding:m,zoomable:y,zoomExtent:v,onZoom:b,dragRotate:x,tileURL:j,tileAttribution:k,tileCacheSize:w,transition:M,colorBy:O,colorScheme:S,pointRadius:A=5,tooltip:C,showRings:P=!0,ringStyle:L,showNorth:z=!0,costLabel:R,annotations:D,margin:I,className:$,selection:E,linkedHover:N,onObservation:W,onClick:B,chartId:_,loading:T,loadingContent:F,emptyContent:H,legendPosition:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=n,Y=null!=y?y:!!j,X=t.useMemo(()=>Gt(r),[r]),Q=_o({data:X,rawData:r,colorBy:O,colorScheme:S,legendInteraction:void 0,legendPosition:q,selection:E,linkedHover:N,fallbackFields:O?["string"==typeof O?O:""]:[],unwrapData:!1,onObservation:W,onClick:B,chartType:"DistanceCartogram",chartId:_,showLegend:i.showLegend,userMargin:I,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:T,loadingContent:F,emptyContent:H,width:i.width,height:i.height}),K=t.useMemo(()=>{const e=bo(e=>({fill:O?qn(e,O,Q.colorScale):co,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:A}),{stroke:V,strokeWidth:U,opacity:Z});return Q.effectiveSelectionHook?lo(e,Q.effectiveSelectionHook,Q.resolvedSelection):e},[O,Q.colorScale,Q.effectiveSelectionHook,Q.resolvedSelection,A,V,U,Z]),J=t.useMemo(()=>({center:u,centerAccessor:c,costAccessor:d,strength:h,lineMode:f}),[u,c,d,h,f]),ee=t.useMemo(()=>{if(!s)return;const e="function"==typeof l?l:e=>e[l],t="function"==typeof a?a:e=>e[a],n=new Map;for(const e of X)n.set(e[c]+"",e);return s.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:[{[l]:e(i),[a]:t(i)},{[l]:e(r),[a]:t(r)}]}):null}).filter(Boolean)},[s,X,l,a,c]),te=t.useMemo(()=>t=>{const n=("function"==typeof d?d:e=>e[d])(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:t[c]||t.name||t.id||"Point"}),null!=n&&e.jsxs("div",{style:{opacity:.7},children:["Cost: ","number"==typeof n?n.toFixed(1):n]})]})},[d,c]),ne=t.useRef(null);To(o,{variant:"geo-points",frameRef:ne});const[oe,ie]=t.useState(null),re=t.useCallback(()=>{var e,t;const n=null===(t=null===(e=ne.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ie(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);t.useEffect(()=>{const e=requestAnimationFrame(re);return()=>cancelAnimationFrame(e)},[re,h,u,i.width,i.height,X]);const se=t.useMemo(()=>{if(!P||!oe)return[];const{maxCost:e}=oe;if(0>=e)return[];if(Array.isArray(P))return P.filter(t=>t>0&&e>=t);const t="number"==typeof P?P: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},[P,oe]),le=t.useMemo(()=>{var t,n;if(!oe)return G.foregroundGraphics||null;const{cx:o,cy:i,maxCost:r,availableRadius:s}=oe,l=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},L),a=null!==(t=Q.margin.left)&&void 0!==t?t:10,c=null!==(n=Q.margin.top)&&void 0!==n?n:10;return e.jsxs("g",{children:[se.map(t=>{const n=t/r*s;return e.jsxs("g",{children:[e.jsx("circle",{cx:o+a,cy:i+c,r:n,fill:"none",stroke:l.stroke,strokeWidth:l.strokeWidth,strokeDasharray:l.strokeDasharray,opacity:.5}),e.jsxs("text",{x:o+a+n+3,y:i+c-2,fontSize:l.labelSize,fill:l.labelColor,fontFamily:"system-ui, sans-serif",children:[t,R?" "+R:""]})]},t)}),z&&e.jsxs("g",{transform:`translate(${a+24}, ${c+24})`,children:[e.jsx("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e.jsx("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.jsx("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e.jsx("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[oe,se,z,R,L,Q.margin,G.foregroundGraphics]);if(Q.earlyReturn)return Q.earlyReturn;Po("DistanceCartogram",X,"xAccessor",l),Po("DistanceCartogram",X,"yAccessor",a);const 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({projection:p},null!=r&&{points:X}),ee&&{lines:ee,lineDataAccessor:"coordinates"}),{xAccessor:l,yAccessor:a,pointIdAccessor:c,pointStyle:K,projectionTransform:J}),M&&{transition:{duration:M}}),null!=g&&{graticule:g}),null!=m&&{fitPadding:m}),Y&&{zoomable:!0}),v&&{zoomExtent:v}),b&&{onZoom:b}),null!=x&&{dragRotate:x}),j&&{tileURL:j}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[i.width,i.height],margin:Q.margin,enableHover:!0,tooltipContent:!1===C?()=>null:Kt(C)||te}),Q.legendBehaviorProps),(N||W||B)&&{customHoverBehavior:Q.customHoverBehavior}),(W||B)&&{customClickBehavior:Q.customClickBehavior}),D&&D.length>0&&{annotations:D}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),i.title&&{title:i.title}),i.description&&{description:i.description}),i.summary&&{summary:i.summary}),void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable}),$&&{className:$}),null!=n.animate&&{animate:n.animate}),G),le&&{foregroundGraphics:le});return e.jsx(Mo,{componentName:"DistanceCartogram",width:i.width,height:i.height,children:e.jsx(wn,Object.assign({ref:ne},ae))})});Vo.displayName="DistanceCartogram",exports.ChoroplethMap=Bo,exports.DistanceCartogram=Vo,exports.FlowMap=Go,exports.ProportionalSymbolMap=Fo,exports.StreamGeoFrame=wn,exports.mergeData=function(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})},exports.resolveReferenceGeography=Eo;