semiotic 3.8.5 → 3.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/CLAUDE.md +5 -4
  2. package/README.md +42 -42
  3. package/ai/behaviorContracts.cjs +2 -2
  4. package/ai/componentMetadata.cjs +1 -1
  5. package/ai/dist/mcp-server.js +2 -0
  6. package/ai/examples.md +44 -2
  7. package/ai/schema.json +385 -14
  8. package/ai/surface-manifest.json +6 -4
  9. package/ai/system-prompt.md +1 -1
  10. package/dist/{chunk-chartContainerDataAudit-74TLKIP6.module.min.js → chunk-chartContainerDataAudit-FEOD5GTQ.module.min.js} +1 -1
  11. package/dist/chunk-chunk-2CHN2TA3.module.min.js +1 -0
  12. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
  13. package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
  14. package/dist/chunk-chunk-3SHB24AG.module.min.js +1 -0
  15. package/dist/chunk-chunk-4MMOOYTX.module.min.js +2 -0
  16. package/dist/{chunk-chunk-KT2VAZMZ.module.min.js → chunk-chunk-75OTQSXS.module.min.js} +1 -1
  17. package/dist/chunk-chunk-A5GRQUOF.module.min.js +1 -0
  18. package/dist/chunk-chunk-AAF5LZAU.module.min.js +2 -0
  19. package/dist/{chunk-chunk-4AANPFOX.module.min.js → chunk-chunk-ARZGA4LJ.module.min.js} +1 -1
  20. package/dist/chunk-chunk-CAFLML4L.module.min.js +2 -0
  21. package/dist/chunk-chunk-FHBN7OEB.module.min.js +2 -0
  22. package/dist/{chunk-chunk-TMWIZL3K.module.min.js → chunk-chunk-GFTVACTO.module.min.js} +1 -1
  23. package/dist/chunk-chunk-IP2UE74X.module.min.js +1 -0
  24. package/dist/chunk-chunk-ITDWLZXV.module.min.js +2 -0
  25. package/dist/chunk-chunk-LPSPATPC.module.min.js +1 -0
  26. package/dist/chunk-chunk-OM6NWS4H.module.min.js +2 -0
  27. package/dist/chunk-chunk-PX5YQGDP.module.min.js +2 -0
  28. package/dist/chunk-chunk-Q2BS46W2.module.min.js +2 -0
  29. package/dist/{chunk-chunk-LJLS6DY7.module.min.js → chunk-chunk-RA7JCG7D.module.min.js} +1 -1
  30. package/dist/chunk-chunk-RNUHEXZA.module.min.js +2 -0
  31. package/dist/chunk-chunk-ROZWKEUG.module.min.js +1 -0
  32. package/dist/chunk-chunk-SMVD3EQJ.module.min.js +2 -0
  33. package/dist/chunk-chunk-T2FKJD4O.module.min.js +2 -0
  34. package/dist/{chunk-chunk-K3DMEW22.module.min.js → chunk-chunk-UDREYOLV.module.min.js} +1 -1
  35. package/dist/chunk-chunk-VOWE3SAP.module.min.js +2 -0
  36. package/dist/chunk-chunk-VQPNBUSW.module.min.js +2 -0
  37. package/dist/{chunk-chunk-N5DDKCCF.module.min.js → chunk-chunk-WAWCIHFJ.module.min.js} +1 -1
  38. package/dist/{chunk-chunk-XXWSHGPL.module.min.js → chunk-chunk-WYARAXHR.module.min.js} +1 -1
  39. package/dist/{chunk-chunk-I36PJ4OC.module.min.js → chunk-chunk-XP3OHHFX.module.min.js} +1 -1
  40. package/dist/chunk-chunk-XV3KGYTR.module.min.js +2 -0
  41. package/dist/chunk-chunk-YC2IVEPX.module.min.js +1 -0
  42. package/dist/components/ai/chartCapabilities.d.ts +2 -1
  43. package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
  44. package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
  45. package/dist/components/charts/index.d.ts +3 -0
  46. package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
  47. package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
  48. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
  49. package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
  50. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
  51. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -4
  52. package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
  53. package/dist/components/charts/shared/gradient.d.ts +35 -0
  54. package/dist/components/charts/shared/hatchFill.d.ts +3 -10
  55. package/dist/components/charts/shared/hooks.d.ts +2 -50
  56. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  57. package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
  58. package/dist/components/charts/shared/useChartLegend.d.ts +58 -0
  59. package/dist/components/charts/shared/useChartSetup.d.ts +5 -0
  60. package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
  61. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
  62. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  63. package/dist/components/charts/xy/AreaChart.d.ts +25 -42
  64. package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
  65. package/dist/components/charts/xy/BumpChart.d.ts +161 -0
  66. package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
  67. package/dist/components/charts/xy/Heatmap.d.ts +3 -0
  68. package/dist/components/charts/xy/LineChart.d.ts +6 -8
  69. package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
  70. package/dist/components/legendLayout.d.ts +19 -1
  71. package/dist/components/semiotic-ai.d.ts +2 -1
  72. package/dist/components/semiotic-geo.d.ts +1 -0
  73. package/dist/components/semiotic-network.d.ts +1 -0
  74. package/dist/components/semiotic-ordinal.d.ts +2 -0
  75. package/dist/components/semiotic-physics.d.ts +1 -0
  76. package/dist/components/semiotic-realtime-core.d.ts +1 -0
  77. package/dist/components/semiotic-server-edge.d.ts +1 -1
  78. package/dist/components/semiotic-server.d.ts +1 -1
  79. package/dist/components/semiotic-xy.d.ts +4 -0
  80. package/dist/components/semiotic.d.ts +4 -4
  81. package/dist/components/server/serverChartConfigs.d.ts +1 -0
  82. package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
  83. package/dist/components/server/staticLegend.d.ts +4 -2
  84. package/dist/components/server/staticSVGChrome.d.ts +4 -4
  85. package/dist/components/stream/GeoSVGOverlay.d.ts +4 -10
  86. package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
  87. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
  88. package/dist/components/stream/SVGOverlay.d.ts +2 -6
  89. package/dist/components/stream/StalenessBadge.d.ts +2 -6
  90. package/dist/components/stream/geoTypes.d.ts +3 -6
  91. package/dist/components/stream/legendRenderer.d.ts +2 -6
  92. package/dist/components/stream/ordinalTypes.d.ts +7 -31
  93. package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
  94. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
  95. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
  96. package/dist/components/stream/pipelineConfig.d.ts +7 -15
  97. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
  98. package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
  99. package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
  100. package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
  101. package/dist/components/stream/types.d.ts +32 -56
  102. package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
  103. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
  104. package/dist/components/types/legendTypes.d.ts +15 -6
  105. package/dist/geo.min.js +1 -1
  106. package/dist/geo.module.min.js +1 -1
  107. package/dist/network.min.js +1 -1
  108. package/dist/network.module.min.js +1 -1
  109. package/dist/ordinal.min.js +1 -1
  110. package/dist/ordinal.module.min.js +1 -1
  111. package/dist/physics.min.js +1 -1
  112. package/dist/physics.module.min.js +1 -1
  113. package/dist/physicsWorker.js +1 -1
  114. package/dist/realtime.min.js +1 -1
  115. package/dist/realtime.module.min.js +1 -1
  116. package/dist/semiotic-ai-core.min.js +1 -1
  117. package/dist/semiotic-ai-core.module.min.js +1 -1
  118. package/dist/semiotic-ai.d.ts +2 -1
  119. package/dist/semiotic-ai.min.js +1 -1
  120. package/dist/semiotic-ai.module.min.js +1 -1
  121. package/dist/semiotic-experimental.min.js +1 -1
  122. package/dist/semiotic-experimental.module.min.js +1 -1
  123. package/dist/semiotic-geo.d.ts +1 -0
  124. package/dist/semiotic-network.d.ts +1 -0
  125. package/dist/semiotic-ordinal.d.ts +2 -0
  126. package/dist/semiotic-physics.d.ts +1 -0
  127. package/dist/semiotic-realtime-core.d.ts +1 -0
  128. package/dist/semiotic-realtime-core.min.js +1 -1
  129. package/dist/semiotic-realtime-core.module.min.js +1 -1
  130. package/dist/semiotic-recipes-core.module.min.js +1 -1
  131. package/dist/semiotic-recipes.module.min.js +1 -1
  132. package/dist/semiotic-server-edge.d.ts +1 -1
  133. package/dist/semiotic-server-edge.min.js +1 -1
  134. package/dist/semiotic-server-edge.module.min.js +1 -1
  135. package/dist/semiotic-server-node.min.js +1 -1
  136. package/dist/semiotic-server-node.module.min.js +1 -1
  137. package/dist/semiotic-server.d.ts +1 -1
  138. package/dist/semiotic-utils-core.min.js +1 -1
  139. package/dist/semiotic-utils-core.module.min.js +1 -1
  140. package/dist/semiotic-utils.min.js +1 -1
  141. package/dist/semiotic-utils.module.min.js +1 -1
  142. package/dist/semiotic-xy.d.ts +4 -0
  143. package/dist/semiotic.d.ts +4 -4
  144. package/dist/semiotic.min.js +1 -1
  145. package/dist/semiotic.module.min.js +1 -1
  146. package/dist/server.min.js +1 -1
  147. package/dist/server.module.min.js +1 -1
  148. package/dist/xy.min.js +1 -1
  149. package/dist/xy.module.min.js +1 -1
  150. package/package.json +1 -1
  151. package/dist/chunk-chunk-5I3UZV4Q.module.min.js +0 -2
  152. package/dist/chunk-chunk-74CCPVXB.module.min.js +0 -1
  153. package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
  154. package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
  155. package/dist/chunk-chunk-BANTPINB.module.min.js +0 -2
  156. package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
  157. package/dist/chunk-chunk-CKMD5NV3.module.min.js +0 -2
  158. package/dist/chunk-chunk-CWQ5YIHX.module.min.js +0 -2
  159. package/dist/chunk-chunk-E6TXX6MI.module.min.js +0 -1
  160. package/dist/chunk-chunk-L6EA5V3G.module.min.js +0 -2
  161. package/dist/chunk-chunk-LJPCLYSC.module.min.js +0 -2
  162. package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
  163. package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
  164. package/dist/chunk-chunk-NLO44TOS.module.min.js +0 -2
  165. package/dist/chunk-chunk-PZJ2SBLL.module.min.js +0 -2
  166. package/dist/chunk-chunk-QUJ6TTLY.module.min.js +0 -1
  167. package/dist/chunk-chunk-RBIDBUT4.module.min.js +0 -2
  168. package/dist/chunk-chunk-RFLAG356.module.min.js +0 -1
  169. package/dist/chunk-chunk-RPU4IZAV.module.min.js +0 -2
  170. package/dist/chunk-chunk-SKMBCFIL.module.min.js +0 -2
  171. package/dist/chunk-chunk-TAE7W424.module.min.js +0 -2
  172. package/dist/chunk-chunk-TUBMTZMU.module.min.js +0 -2
  173. package/dist/chunk-chunk-UFFEXJQY.module.min.js +0 -1
  174. package/dist/chunk-chunk-XSCHTS4D.module.min.js +0 -2
  175. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
  176. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
package/dist/geo.min.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,i,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of o(t))s.call(e,l)||l===i||n(e,l,{get:()=>t[l],enumerable:!(a=r(t,l))||a.enumerable});return e},l=(e,r,o)=>(o=null!=e?t(i(e)):{},a(!r&&e&&e.__esModule?o:n(o,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(c,{ChoroplethMap:()=>Os,DEFAULT_HIT_RADIUS:()=>sa,DistanceCartogram:()=>ea,FlowMap:()=>Qs,GeoCustomChart:()=>oa,ProportionalSymbolMap:()=>Gs,StreamGeoFrame:()=>li,composeStyleRules:()=>ls,geoAreaHitTarget:()=>ca,geoHitTarget:()=>la,glyphExtent:()=>We,glyphPlacement:()=>He,hatchFillId:()=>yn,hatchPatternDef:()=>bn,hitTargetPoint:()=>aa,isHatchFill:()=>pn,makeNodeRuleContext:()=>rs,makeRuleValueResolver:()=>ns,matchesThreshold:()=>is,mergeData:()=>ua,resolveReferenceGeography:()=>Ps,resolveResponsiveRules:()=>Hi,resolveStyleRules:()=>as,resolveSvgFill:()=>vn,responsiveRuleMatches:()=>Bi,ruleMatches:()=>ss}),module.exports=(e=c,a(n({},"__esModule",{value:!0}),e));var u=require("react"),d=require("d3-geo"),h=require("d3-quadtree"),f=class{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();let n=0,r=[];t.length>e&&(n=t.length-e,r=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return r}update(e,t){const n=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++){const i=(r+o)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(r=>{e(r)?n.push(r):t.push(r)}),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 p(e,t,n){return e+(t-e)*n}function m(e,t,n){if(1>=n)return 1;const r=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function y(e,t,n){const r=e.duration??500,o=n-t;return r>o?1-o/r:0}function g(e,t,n,r){let o=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,o=!0),e._pulseColor!==n&&(e._pulseColor=n,o=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,o=!0),o):(0!==e._pulseIntensity&&(e._pulseIntensity=0,o=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,o=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,o=!0),o)}var b=require("d3-scale");function v(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function x(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function w(e){const t=e.map(v),n=t.length-1;return e=>{if(0>=e){const[e,n,r]=t[0];return x(e,n,r)}if(e>=1){const[e,r,o]=t[n];return x(e,r,o)}const r=e*n,o=Math.floor(r),i=r-o,[s,a,l]=t[o],[c,u,d]=t[o+1];return x(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var k=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],j=w(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),S=w(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),M=w(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),C=w(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),A=w(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),R=w(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),L=w(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),P=w(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),I=w(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),D=w(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),T=w(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),z=w(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),O={blues:j,reds:S,greens:M,viridis:L,oranges:C,purples:A,greys:R,plasma:P,inferno:I,magma:D,cividis:T,turbo:z};function N(e){return e&&O[e]||j}w(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),w(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),w(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),w(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),w(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var E={category10:k,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...O},B=k,H="#007bff",W=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],_=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 F(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||_.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):B[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)}(r))%B.length]}function $(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function q(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>$(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,b.scaleOrdinal)().domain(r).range(n).unknown("#999");const i=E[n]||E.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:B;return(0,b.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function G(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,s]=r,[a,l]=n;if(s===i)return(a+l)/2;let c=(o-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function V(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&$(n,e)||"#4e79a7":t=>{if(n){const e=$(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}function U(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(U))}function Y(e,t,n){e.has(t)||(e.add(t),console.warn(n))}var Z=require("d3-geo"),X={mercator:Z.geoMercator,equalEarth:Z.geoEqualEarth,albersUsa:Z.geoAlbersUsa,orthographic:Z.geoOrthographic,naturalEarth:Z.geoNaturalEarth1,equirectangular:Z.geoEquirectangular};function Q(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function K(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function J(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function ee(e,t){if(2>e.length)return[e];const n=.4*t,r=[];let o=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>o.length||r.push(o),o=[i]):o.push(i)}return 2>o.length||r.push(o),r}function te(e,t,n=24){const r=t[0]-e[0],o=t[1]-e[1],i=Math.sqrt(r*r+o*o);if(0===i)return[e,t];const s=-o/i,a=r/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+s*l,u=(e[1]+t[1])/2+a*l,d=[];for(let r=0;n>=r;r++){const o=r/n,i=1-o;d.push([i*i*e[0]+2*i*o*c+o*o*t[0],i*i*e[1]+2*i*o*u+o*o*t[1]])}return d}function ne(e,t){if(2>e.length)return e;const n=t/2+1,r=[];for(let t=0;e.length>t;t++){const o=e[t];let i,s;0===t?(i=e[1][0]-o[0],s=e[1][1]-o[1]):t===e.length-1?(i=o[0]-e[t-1][0],s=o[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const a=Math.sqrt(i*i+s*s)||1;r.push([o[0]+s/a*n,o[1]+-i/a*n])}return r}function re(e,t,n,r,o){const i=t[0]-e[0],s=t[1]-e[1],a=Math.sqrt(i*i+s*s);if(0===a)return[e,t];const l=s/a,c=-i/a,u=o/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}var oe=require("d3-scale");function ie(e){let t=1/0,n=-1/0;for(const r of e)t>r&&(t=r),r>n&&(n=r);return[t,n]}function se(e,t,n,r){const o=e.push(t);return n&&n.push(r),o}var ae={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function le(e,t){const n={...e};for(const e of t)n[ae[e]]++;return n}function ce(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:le(n,r)}}var ue=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=ce({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=ce(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},de=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],he=["scene-style","data-paint","accessibility","evidence"],fe=(e,t)=>({retainedData:e,invalidations:t}),pe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],me=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ye=["scene-geometry","data-paint","accessibility","evidence"],ge=["scene-style","data-paint","accessibility","evidence"],be=["overlay","accessibility","evidence"],ve=[],xe={xAccessor:fe("rebuild",pe),yAccessor:fe("rebuild",pe),lineDataAccessor:fe("rebuild",pe),pointIdAccessor:fe("rebuild",ye),lineIdAccessor:fe("rebuild",ye),windowSize:fe("rebuild",pe),projection:fe("preserve",me),projectionExtent:fe("preserve",me),fitPadding:fe("preserve",me),lineType:fe("preserve",me),flowStyle:fe("preserve",me),graticule:fe("preserve",me),projectionTransform:fe("preserve",me),customLayout:fe("preserve",me),layoutConfig:fe("preserve",me),layoutMargin:fe("preserve",me),areaStyle:fe("preserve",ge),pointStyle:fe("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:fe("preserve",ge),colorScheme:fe("preserve",ge),themeCategorical:fe("preserve",ge),themeDiverging:fe("preserve",ge),themeSemantic:fe("preserve",ge),themeSequential:fe("preserve",ge),decay:fe("preserve",ge),pulse:fe("preserve",ge),layoutSelection:fe("preserve",ge),annotations:fe("preserve",be),autoPlaceAnnotations:fe("preserve",be),clock:fe("preserve",ve),transition:fe("preserve",ve),introAnimation:fe("preserve",ve),onLayoutError:fe("preserve",ve)},we=fe("preserve",me),ke=class{constructor(){this.tracker=new ue}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},de)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},he):this.recordNoop("restyle")}recordConfig(e,t={}){const n=function(e){let t="preserve";const n=new Set;for(const r of e){const e=xe[r]??we;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e),r=new Set(n.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}},je=new WeakMap;var Se=require("d3-geo");function Me(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e)&&e>=0&&.5>e)return e;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${e+""}.`)}var Ce=class e{constructor(e){this.updateResults=new ke,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,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=function(e){return{...e,fitPadding:Me(e.fitPadding)}}(e)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}getConfiguredWindowSize(){const e=this.config.windowSize??500;if(!Number.isInteger(e)||1>e)throw Error("GeoPipelineStore windowSize must be a positive integer");return e}retainNewestLines(e=this.getConfiguredWindowSize()){this.lineData.length>e&&(this.lineData=this.lineData.slice(-e))}resizeStreamingWindow(e){if(this.pointBuffer){const t=this.pointBuffer.toArray(),n=this.timestampBuffer?.toArray()??[],r=t.slice(-e),o=n.slice(-r.length),i=this.currentTime();this.pointBuffer=new f(e),this.timestampBuffer=new f(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(o[t]??i)})}this.retainNewestLines(e)}updateConfig(e){const t=function(e){return"fitPadding"in e?{...e,fitPadding:Me(e.fitPadding)}:e}(e),n=this.config,r=this.getConfiguredWindowSize(),o=Object.keys(t).filter(e=>t[e]!==n[e]);this.config={...this.config,...t};const i=this.getConfiguredWindowSize(),s=this.streaming&&i!==r;s&&(this.resizeStreamingWindow(i),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(o,{retainedDataChanged:s})}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}setAreas(e){this.areas=e,this.updateResults.recordData("replace",e.length)}setAreasWithResult(e){return this.setAreas(e),this.updateResults.last}setPoints(e){this.pointData=e.slice(),this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.updateResults.recordData("replace",e.length)}setPointsWithResult(e){return this.setPoints(e),this.updateResults.last}setLines(e){this.lineData=e.slice(),this.streaming&&this.retainNewestLines(),this.updateResults.recordData("replace",e.length)}setLinesWithResult(e){return this.setLines(e),this.updateResults.last}initStreaming(e){void 0!==e&&e!==this.config.windowSize&&(this.config={...this.config,windowSize:e});const t=this.getConfiguredWindowSize(),n=this.pointBuffer?this.pointBuffer.toArray():this.pointData,r=this.timestampBuffer?.toArray()??[],o=n.slice(-t),i=r.slice(-o.length),s=this.currentTime();this.pointBuffer=new f(t),this.timestampBuffer=new f(t),o.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(i[t]??s)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();se(this.pointBuffer,e,this.timestampBuffer,t),this.lastIngestTime=t,this.updateResults.recordData("ingest",1)}pushPointWithResult(e){return this.pushPoint(e),this.updateResults.last}pushMany(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();for(const n of e)se(this.pointBuffer,n,this.timestampBuffer,t);this.lastIngestTime=t,this.updateResults.recordData("ingest",e.length)}pushManyWithResult(e){return this.pushMany(e),this.updateResults.last}pushLine(e){null!=e&&"object"==typeof e?(this.streaming||this.initStreaming(),this.lineData.push(e),this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",1)):this.updateResults.recordNoop("ingest")}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return void this.updateResults.recordNoop("ingest");const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){this.streaming||this.initStreaming();for(const e of t)this.lineData.push(e);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",t.length)}else this.updateResults.recordNoop("ingest")}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],r=new Set(Array.isArray(e)?e:[e]),o=[];return this.lineData=this.lineData.filter(e=>!r.has(n(e)+"")||(o.push(e),!1)),o.length>0?(this.version++,this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),o}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],r=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>r.has(n(e)+"");!function(e,t,n){if(!t||0===t.size)return;const r=new Set;if(e.forEach((e,t)=>{n(e)&&r.add(t)}),0===r.size)return;const o=t.toArray();t.clear();for(let e=0;o.length>e;e++)r.has(e)||t.push(o[e])}(this.pointBuffer,this.timestampBuffer,e);const t=this.pointBuffer.remove(e);return t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}{const e=[];return this.pointData=this.pointData.filter(t=>!r.has(n(t)+"")||(e.push(t),!1)),e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,this.version++,this.updateResults.recordData("clear")}restyleScene(e){const t=this._customRestyle;if(t){for(const n of this.scene){const r=this._baseStyles.get(n)??n.style,o=t(n,e);n.style=o?{...r,...o}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(e){const{config:t}=this,n=this.projection,r=this.geoPath,o=this.scales,i=this.baseScale,s=[...this.baseTranslate],a=[...this.baseRotation],l=this.scene;this.projection=function(e){if(!e)return(0,Z.geoEqualEarth)();if("string"==typeof e){const t=X[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),(0,Z.geoEqualEarth)())}if("object"==typeof e&&"type"in e){const t=X[e.type],n=t?t():(0,Z.geoEqualEarth)();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=(0,d.geoPath)(this.projection),this.fitProjection(e),this.geoPath=(0,d.geoPath)(this.projection);const c=this.projection;this.scales={projection:c,geoPath:this.geoPath,projectedPoint:(e,t)=>c([e,t]),invertedPoint:(e,t)=>c.invert?c.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(e);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=r,this.scales=o,this.baseScale=i,this.baseTranslate=s,this.baseRotation=a):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,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,r=this.scene.filter(e=>"point"===e.type).map(e=>({...e,x:t,y:n}));r.length>0&&this.startTransition(r)}this._hasRenderedOnce=!0,t.transition&&l.length>0&&this.startTransition(l),this.version++}}fitProjection(e){const t=this.projection,n=this.config,r=[...this.areas],o=Q(n.xAccessor,"lon"),i=Q(n.yAccessor,"lat"),s=this.getPoints();if(s.length>0){const e=s.map(e=>[o(e),i(e)]);r.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const a=K(n.lineDataAccessor);for(const e of this.lineData){const t=a(e);if(t&&t.length>0){const e=t.map(e=>[o(e),i(e)]);r.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==r.length){if(n.projectionExtent){const[[r,o],[i,s]]=n.projectionExtent;t.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[r,o],[r,s],[i,s],[i,o],[r,o]]]}})}else if(t.clipAngle&&(t.clipAngle()??0)>0){const r=n.fitPadding??0,o=Math.min(e.width,e.height);t.scale(o/2-o*r),t.translate([e.width/2,e.height/2])}else{const o=n.fitPadding??0,i=e.width*o,s=e.height*o;t.fitExtent([[i,s],[e.width-i,e.height-s]],{type:"FeatureCollection",features:r})}this.baseScale=t.scale(),this.baseTranslate=t.translate(),this.baseRotation=t.rotate?.()??[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,o=this.scales,i=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,o=this.scales,i=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;if(!n||!n.rotate)return;const r=this.geoPath,o=this.scales,i=[...n.rotate()];n.rotate(e),this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const s=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(i),this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=s,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)}hasProjection(){return null!=this.projection}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let t=0,n=0;for(const e of this.scene)"point"===e.type&&(n++,e.r>t&&(t=e.r));if(this._maxPointRadius=t,e.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const r=Array(n);let o=0;for(const e of this.scene)"point"===e.type&&(r[o++]=e);this._quadtree=(0,h.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;const{config:t}=this,n=this.projection,r=this.geoPath;if(t.customLayout&&this.scales){const n=t.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,n=B){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=E[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(t.colorScheme,t.themeCategorical,W),o={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:e.width,height:e.height,margin:n,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:t.themeSemantic??{},categorical:[...r]},resolveColor:V(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null};let i;try{i=t.customLayout(o)}catch(e){const n=null!==this.lastCustomLayoutResult,r=function(e,t,n,r){const o=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}("geo",e,n,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",e);try{t.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return n?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}const s=i.nodes??[];if(this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null,this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const e of s)this._baseStyles.set(e,e.style);this.restyleScene(t.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:o}=e;U(r)&&0===n.length&&Y(o,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&Y(o,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,function({config:e,projection:t,path:n,areas:r,points:o,lines:i,layout:s}){const a=Q(e.xAccessor,"lon"),l=Q(e.yAccessor,"lat"),c=[],u=function(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(e),d=function(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(e),h=function(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(e);if(e.graticule){const t=!0===e.graticule?{}:e.graticule,r=(0,Se.geoGraticule)();t.step&&r.step(t.step);const o=n(r())||"";o&&c.push({type:"geoarea",pathData:o,centroid:[s.width/2,s.height/2],bounds:[[0,0],[s.width,s.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 t of r){const r=n(t);if(!r)continue;const o=n.centroid(t),i=n.bounds(t),s=n.area(t);c.push({type:"geoarea",pathData:r,centroid:o,bounds:i,screenArea:s,style:J(e.areaStyle,t,u),datum:t,interactive:!0})}const f=K(e.lineDataAccessor);for(const n of i){const r=f(n);if(!r||2>r.length)continue;let o=[];if("geo"===e.lineType){const e=Array(r.length);for(let t=0;r.length>t;t++)e[t]=[a(r[t]),l(r[t])];for(let n=0;e.length-1>n;n++){const r=e[n],i=e[n+1],s=(0,Se.geoDistance)(r,i)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),l=(0,Se.geoInterpolate)(r,i);for(let e=0;a>=e;e++){if(n>0&&0===e)continue;const r=t(l(e/a));null!=r&&o.push(r)}}}else for(let e=0;r.length>e;e++){const n=r[e],i=t([a(n),l(n)]);null!=i&&o.push(i)}if(2>o.length)continue;const i=J(e.lineStyle,n,d),u="number"==typeof i.strokeWidth?i.strokeWidth:1;2!==r.length||2>o.length||"arc"!==e.flowStyle?2!==r.length||2>o.length||"offset"!==e.flowStyle||(o="geo"===e.lineType?ne(o,u):re(o[0],o[o.length-1],0,0,u)):o=te(o[0],o[o.length-1]);const h=ee(o,s.width);if(h.length>1)for(const e of h)2>e.length||c.push({type:"line",path:e,style:{...i,_edgeFade:!0},datum:n});else c.push({type:"line",path:2>o.length&&h[0]||o,style:i,datum:n})}const p=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,m=t.clipAngle?t.clipAngle()??0:0,y=m>0?m*Math.PI/180:null,g=t.rotate?t.rotate():[0,0,0],b="function"==typeof t.center?t.center():[0,0],v=[(b[0]??0)-g[0],(b[1]??0)-g[1]];for(const n of o){const r=a(n),o=l(n);if(null!=y&&(0,Se.geoDistance)([r,o],v)>y)continue;const i=t([r,o]);if(!i)continue;const s=e.pointStyle?e.pointStyle(n):{...h},u={type:"point",x:i[0],y:i[1],r:s.r||4,style:s,datum:n,pointId:p?p(n)+"":void 0};c.push(u)}return c}({config:t,projection:n,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){const n=function(e,t,n,r){const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const i=t.strength??1,s="strip"===t.layout?"strip":"radial";if("radial"===s&&0===i)return null;const a=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,l="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],c=o.find(e=>e.datum&&a(e.datum)+""==t.center+"");if(!c)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const u=function(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}(o.map(e=>e.datum?Number(l(e.datum)):NaN).filter(e=>isFinite(e)&&e>=0),1);r>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.");for(let t=e.length-1;t>=0;t--){const n=e[t];"geoarea"===n.type&&n.interactive&&e.splice(t,1)}const d="strip"===s?function(e,t,n,r,o){const i=Math.max(3,Math.min(8,.35*o.height)),s=Math.max(1,o.width-2*i),a=o.height/2,l=(0,oe.scaleLinear)().domain([0,r]).range([0,s]);t.x=i,t.y=a;const c=[];for(const r of e){if(r===t)continue;if(!r.datum){r.x=i,r.y=a;continue}const e=Number(n(r.datum)),o=i+(isFinite(e)&&e>=0?l(e):0);r.x=o,r.y=a,c.push({node:r,x:o})}c.sort((e,t)=>e.x-t.x);const u=Math.max(0,Math.min(o.height/2-1,6));let d=0;for(;c.length>d;){let e=d+1;for(;c.length>e&&3>Math.abs(c[e].x-c[d].x);)e++;const t=e-d;if(t>1&&u>0)for(let e=0;t>e;e++)c[d+e].node.y=a+(e-(t-1)/2)*Math.min(2.5,2*u/Math.max(1,t-1));d=e}return{cx:i,cy:a,maxCost:r,availableRadius:s,layout:"strip"}}(o,c,l,u,n):function(e,t,n,r,o,i){const s=t.x,a=t.y,l=Math.min(i.width,i.height)/2,c=(0,oe.scaleLinear)().domain([0,r]).range([0,l]);for(const r of e){if(r===t)continue;if(!r.datum)continue;const e=Math.atan2(r.y-a,r.x-s),i=Math.sqrt((r.x-s)**2+(r.y-a)**2),l=Number(n(r.datum)),u=i+((isFinite(l)?c(l):i)-i)*o;r.x=s+Math.cos(e)*u,r.y=a+Math.sin(e)*u}const u=i.width/2,d=i.height/2,h=u-t.x,f=d-t.y;if(Math.abs(h)>.5||Math.abs(f)>.5)for(const t of e)t.x+=h,t.y+=f;return{cx:u,cy:d,maxCost:r,availableRadius:l,layout:"radial"}}(o,c,l,u,i,n),h=e.filter(e=>"line"===e.type);if(h.length>0&&"fractional"!==t.lineMode){const e=new Map;for(const t of o)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of h){const n=t.datum?.source,r=t.datum?.target;if(n&&r){const o=e.get(n+""),i=e.get(r+"");o&&i&&(t.path=[o,i])}}}return d}(this.scene,e,t,this.areas.length);n&&(this.cartogramLayout=n)}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 r=0;n.length>r;r++){const o=m(e,r,t);n[r]._decayOpacity=o,n[r].style={...n[r].style,opacity:o}}}applyPulse(e=this.currentTime()){const t=this.config.pulse;if(!t||!this.timestampBuffer)return!1;const n=this.scene.filter(e=>"point"===e.type),r=this.timestampBuffer.toArray(),o=t.color||"rgba(255,255,255,0.6)",i=t.glowRadius??4;let s=!1;for(let a=0;n.length>a&&r.length>a;a++){const l=y(t,r[a],e);s=g(n[a],l,o,i)||s}return s}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,o=t.peek();return null!=o&&r>n-o}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(e){const t=this.config.transition?.duration??300;if(0>=t)return;const n=new Map;for(const t of e)"point"===t.type&&t.pointId&&n.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let o=!1;for(const e of r)if(e.pointId){const t=n.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)&&(o=!0))}for(const e of r)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??1,e.style={...e.style,opacity:0},o=!0);o&&(this.activeTransition={startTime:this.currentTime(),duration:t})}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),r=this.scene.filter(e=>"point"===e.type);for(const e of r){if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=p(e.x,e._targetX,n),e.y=p(t,e._targetY,n)}null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity*n})}if(t>=1){for(const e of r)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0),null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}};Ce.QUADTREE_THRESHOLD=500;var Ae=Ce;Object.assign(Ae.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){je.set(this,!0)},consumeStylePaintPending:function(){const e=!0===je.get(this);return je.delete(this),e}});var Re=require("react"),Le={sceneGeometry:0,layout:0,domain:0};function Pe(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function Ie(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var De="production"!==process.env.NODE_ENV,Te={revisions:Le,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},ze=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Le,this.lastObserved=Le,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){De&&(this.lastObserved=Ie(this.lastObserved,Pe(e)))}beforeCompute(e,t){if(!De)return Te;const n=Ie(Pe(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(De){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},Oe=(0,Re.memo)(function({store:e,diagnostics:t}){return(0,Re.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});function Ne(e,t=30){return Math.max((e??4)+5,12,t)}var Ee=[40,40],Be=[.5,.5];function He(e,t){const[n,r]=e.viewBox??Ee,[o,i]=e.anchor??Be,s=r>0?r:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-o*l,offsetY:-i*c}}function We(e,t){const n=He(e,t),r=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let o=0;for(const[e,t]of r){const n=Math.sqrt(e*e+t*t);n>o&&(o=n)}return o}function _e(e,t,n,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?n:e}var Fe=null;function $e(e){if("undefined"==typeof Path2D)return null;Fe||(Fe=new Map);const t=Fe.get(e);if(t)return t;const n=new Path2D(e);return Fe.size>1024&&Fe.clear(),Fe.set(e,n),n}function qe(e,t,n=0,r="horizontal"){const[o,i]=e.viewBox??Ee,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===r?{x:0,y:i*(1-a),width:o,height:i*(a-s)}:{x:o*s,y:0,width:o*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function Ge(e,t){const n=He(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function Ve(e,t,n,r,o,i=e=>e){for(const s of t.parts){const t=$e(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=o?"none"===s.fill?void 0:o:_e(s.fill,n,r);c&&(e.fillStyle=i(c),e.fill(t));const u=o?s.stroke&&"none"!==s.stroke?o:void 0:_e(s.stroke??"none",n,r);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function Ue(e,t,n,r,o,i,s=0,a=r){if(i){const e=function(e,t,n,r,o,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(r,o+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,p=1/0;return e.visit((e,o,l,m,y)=>{if(o>u||c>m||l>h||d>y)return!0;if(!e.length){let o=e;do{const e=o.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);Ne(a(e),r)>=u&&p>u&&(f=e,p=u),o=o.next}while(o)}return!1}),f?{node:f,distance:p}:null}(i,t,n,r,s);if(e)return e}else{let o=null,i=r;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,a=s.y-n,l=Math.sqrt(e*e+a*a);Ne(s.r,r)>=l&&i>l&&(o=s,i=l)}if(o)return{node:o,distance:i}}let l=null,c=r;for(const o of e){if("glyph"!==o.type)continue;if(null==o.datum)continue;const e=Ge(o.glyph,o.size),i=o.x+e.centerDx-t,s=o.y+e.centerDy-n,a=Math.sqrt(i*i+s*s);Ne(e.radius,r)>=a&&c>a&&(l=o,c=a)}if(l)return{node:l,distance:c};for(let r=e.length-1;r>=0;r--){const i=e[r];if("geoarea"!==i.type)continue;const s=i;if(!1===s.interactive)continue;const[[a,l],[c,u]]=s.bounds;if(!(a>t||t>c||l>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),o.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let u=null,d=a;for(const r of e){if("line"!==r.type)continue;const e=r,{path:o}=e,i=Math.max((e.style.strokeWidth||2)+4,5,a);for(let r=0;o.length-1>r;r++){const[s,a]=o[r],[l,c]=o[r+1],h=Ye(t,n,s,a,l,c);i>=h&&d>h&&(u=e,d=h)}}return u?{node:u,distance:d}:null}function Ye(e,t,n,r,o,i){const s=o-n,a=i-r,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-r)**2);let c=((e-n)*s+(t-r)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(r+c*a))**2)}var Ze=l(require("react")),Xe=require("react"),Qe=require("react"),Ke=require("react/jsx-runtime");function Je(e){let t=null;const n=()=>(t||(t=(0,Qe.createContext)(null)),t),r=et(e);return[function({children:t,initialState:r}){const o=(0,Qe.useRef)(r),i=(0,Qe.useMemo)(()=>et(e,o.current),[]),s=n();return(0,Ke.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const o=n(),i=(0,Qe.useContext)(o)??r,s=(0,Qe.useRef)(e);s.current=e;const a=(0,Qe.useRef)({hasValue:!1,value:void 0}),l=(0,Qe.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Qe.useCallback)(()=>s.current(i.getState()),[i]);return(0,Qe.useSyncExternalStore)(i.subscribe,l,c)}]}function et(e,t){const n=new Set;let r={...e(function(e){const t=e(r);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){r={...r,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>r,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function tt(e){if(!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 nt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:rt}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var rt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],ot={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}},it={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}},st={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:rt,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 at(e,t){if("light"===t)return ot;if("dark"===t)return it;if("high-contrast"===t)return st;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?it:ot;return nt({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return nt({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[lt,ct]=Je(e=>({theme:ot,setTheme(t){e(e=>({theme:at(e.theme,t)}))}})),ut=require("react");var dt=require("react"),ht=new WeakMap,ft=0,pt=!1,mt=null,yt=null;function gt(e,t){if(!t)return t;const n=function(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),r=n.indexOf(",");if(-1===r){const e=n.trim();return e.startsWith("--")?{name:e}:null}const o=n.slice(0,r).trim(),i=n.slice(r+1).trim();return o.startsWith("--")?{name:o,fallback:i||void 0}:null}(t);if(!n)return t;const r=()=>n.fallback?gt(e,n.fallback):t,o=e.canvas;if(!o)return r();!function(){if(pt)return;if("undefined"==typeof window||"undefined"==typeof document)return;pt=!0;const e=()=>{ft++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"],subtree:!0}),"function"==typeof window.matchMedia)try{mt=window.matchMedia("(prefers-color-scheme: dark)"),yt=e,"function"==typeof mt.addEventListener?mt.addEventListener("change",yt):"function"==typeof mt.addListener&&mt.addListener(yt)}catch{}}();let i=ht.get(o);i&&i.version===ft||(i={version:ft,map:new Map},ht.set(o,i));const s=i.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(o).getPropertyValue(n.name).trim()||r()||t;return i.map.set(t,a),a}var bt=()=>"undefined"!=typeof performance?performance.now():Date.now();function vt(e,t){const n=e();return Number.isFinite(n)?n:t}var xt=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??bt,this.lastWallTime=vt(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=vt(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??bt;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=vt(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},wt="undefined"==typeof window?Xe.useEffect:Xe.useLayoutEffect,kt={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function jt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function St(e){const t=function(){const[e,t]=(0,ut.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,ut.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,Xe.useRef)(t);n.current=t;const[r,o]=function(e,t,n){const r=(0,dt.useRef)(null),[o,i]=(0,dt.useState)(null);return(0,dt.useEffect)(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Xe.useMemo)(()=>function(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=o[0]-a.left-a.right,c=o[1]-a.top-a.bottom,u=jt(e.foregroundGraphics,o,a),d=jt(e.backgroundGraphics,o,a),h=ct(e=>e.theme),{transition:f,introEnabled:p}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),m="semiotic-table-"+Ze.useId(),y=(0,Xe.useRef)(null);if(!y.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;y.current=new xt({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=y.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,Xe.useRef)(null),v=(0,Xe.useRef)(e.frameScheduler??kt);v.current=e.frameScheduler??kt;const x=(0,Xe.useRef)(null),w=(0,Xe.useRef)(!1),k=(0,Xe.useRef)(()=>{}),j=(0,Xe.useCallback)(()=>{if(null!==b.current||w.current)return;const e=v.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(w.current=!0),b.current=null,x.current=null;try{k.current()}finally{e&&(w.current=!1)}});n=!0,t||(b.current=r,x.current=e)},[]),S=(0,Xe.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);wt(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,Xe.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,Xe.useEffect)(()=>()=>{S()},[S]);const M=(0,Xe.useRef)(()=>{}),C=(0,Xe.useRef)(()=>{}),A=(0,Xe.useRef)(null),R=(0,Xe.useRef)(null),L=(0,Xe.useRef)(null),P=(0,Xe.useCallback)(()=>{const e=A.current;A.current=null,e&&M.current(e)},[]),I=(0,Xe.useCallback)(e=>{if(A.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===R.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,R.current=null,L.current=null,P()});t||(R.current=n,L.current=e)}},[P]),D=(0,Xe.useCallback)(()=>{A.current=null,null!==R.current&&((L.current??v.current).cancelAnimationFrame(R.current),R.current=null,L.current=null),C.current()},[]);(0,Xe.useEffect)(()=>()=>{A.current=null,null!==R.current&&((L.current??v.current).cancelAnimationFrame(R.current),R.current=null,L.current=null)},[]);const T=e.themeDirtyRef;return wt(()=>{T&&(ft++,T.current=!0,j())},[h,j,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:o,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:p,tableId:m,frameRuntime:g,rafRef:b,renderFnRef:k,scheduleRender:j,cancelRender:S,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:I,onPointerLeave:D}}var Mt=require("react"),Ct=require("react"),At={fresh:1,aging:.7,stale:.45,expired:.25},Rt={alpha:1,band:"fresh",isStale:!1};var Lt=require("react/jsx-runtime");function Pt({isStale:e,position:t}){return(0,Lt.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var It=l(require("react")),[Dt,Tt]=Je(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 zt(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:o}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var Ot=require("react"),Nt=l(require("react")),Et=require("react/jsx-runtime");function Bt(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let s="";for(const e of o)s&&s.length+1+e.length>r?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Ht(e,t,n,r){return"curly"===e?r?`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`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Wt(e,t,n,r){if(!e)return(0,Et.jsx)("g",{className:"annotation-note"});const{label:o,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!o&&!i)return(0,Et.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,p=i?c?[i]:Bt(i,l):[],m=o?c?[o]:Bt(o,l):[],y="leftRight"===u?"end"===h?-4:4:0;let g=0;const b=[],v=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Et.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(p.length+m.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:(0,Et.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Et.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&(0,Et.jsx)("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(p.length>0&&(b.push((0,Et.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:p.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),m.length>0&&b.push((0,Et.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:g,children:m.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+m.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),(0,Et.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Et.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function _t(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Et.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push((0,Et.jsx)("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,s=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push((0,Et.jsx)("line",{x1:r,y1:(t.y1||0)-s,x2:r,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-s;i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Et.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push((0,Et.jsx)("path",{d:Ht(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Et.jsx)("g",{className:"annotation-subject",children:i})}function Ft(e,t,n,r,o,i){const s=[];let a=0,l=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,s=e-o,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;a=o+s*h,l=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);a=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const r=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(n?.curve??.25)*c,p=r+d*f,m=i+h*f;s.push((0,Et.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:o},"connector-line")),u=Math.atan2(m-l,p-a)}else s.push((0,Et.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,Et.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return(0,Et.jsx)("g",{className:"annotation-connector",children:s})}function $t(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:p,strokeDasharray:m,events:y={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=r||0,k=o||0;null!=i&&(w=i-b),null!=s&&(k=s-v);const j="string"==typeof u?u:"label";if("bracket"===j&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,Et.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":g,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...y,children:[!x.has("connector")&&Ft(w,k,l,d,j,c),!x.has("subject")&&_t(j,c,d,b,v),!x.has("note")&&Wt(a,w,k,d)]})}function qt(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return(0,Et.jsx)($t,{"data-testid":"semiotic-annotation",...s,type:r},"multi-annotation-"+i)});return(0,Et.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Et.jsx)($t,{"data-testid":"semiotic-annotation",events:o,...t,type:r},s)}var Gt=require("d3-hierarchy"),Vt=require("d3-shape");function Ut(e){return Math.round(100*e)/100}function Yt(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const s=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));s.push(r)}r.push(s)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(Ut);return{points:e.map(([e])=>[Ut(e),Ut(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}function Zt(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function Xt(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function Qt(e){return null==e?null:e+""}function Kt(e,t,n){return t.stickyPositionCache?.set(e,n),n}function Jt(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const o=n.pointNodes[r];if(o.pointId===e.pointId)return Kt(t,n,{x:o.x,y:o.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,o=e.scales?.y??e.scales?.value;if(!r||!o)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:r(i),y:o(s)}}(n);return r?Kt(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return Qt(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const o=n.pointNodes?.find(e=>Qt(e.pointId)===r);if(o)return Kt(t,n,{x:o.x,y:o.y});const i=n.data?.find(e=>function(e){return Qt(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const s=Zt(i,n),a=Xt(i,n);return null==s||null==a?null:Kt(t,n,{x:s,y:a})}(e,t,n);if(r)return r}let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(o=t.x,i=t.y)}if(null!=o&&null!=i||(o=Zt(e,n),i=Xt(e,n)),null!=o&&null!=i)return Kt(t,n,{x:o,y:i});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function en(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}var tn=require("react/jsx-runtime"),nn={secondary:0,primary:3};function rn(e){return!0===e?._annotationDeferred}function on(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function sn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function an(e){return Math.max(.72,.95-.06*e)}var ln=require("react/jsx-runtime"),cn="var(--semiotic-bg, #ffffff)";function un(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,ln.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:o,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??cn,strokeWidth:h.haloWidth??3});const p=h.padding??{x:6,y:3},m="number"==typeof p?p:p.x,y="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(r,i),b=i+2*y;let v,x;return v="middle"===l?t-g/2-m:"end"===l?t-g-m:t-m,x="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-y:n-.8*i-y,(0,ln.jsxs)("g",{className:d,children:[(0,ln.jsx)("rect",{x:v,y:x,width:g+2*m,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??cn,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}function dn(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var hn=null;var fn=require("react/jsx-runtime");function pn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function mn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function yn(e,t){let n=2166136261;const r=mn(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var gn=new Map;function bn(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,fn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,fn.jsx)("rect",{width:l,height:l,fill:n}),(0,fn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:o,strokeOpacity:a}),(0,fn.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:r,strokeWidth:o,strokeOpacity:a})]},t)}function vn(e,t,n="#4e79a7"){if(pn(e)){const n=yn(t,e);return{fill:`url(#${n})`,def:bn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var xn=require("react/jsx-runtime"),wn={linear:Vt.curveLinear,monotoneX:Vt.curveMonotoneX,monotoneY:Vt.curveMonotoneY,step:Vt.curveStep,stepAfter:Vt.curveStepAfter,stepBefore:Vt.curveStepBefore,basis:Vt.curveBasis,cardinal:Vt.curveCardinal,catmullRom:Vt.curveCatmullRom};var kn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function jn(e){return!!e&&"object"==typeof e&&kn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Sn(e){return"primary"===e?.emphasis||!0===e?.defensive}function Mn(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 Cn(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var An=32,Rn=6,Ln=4,Pn=8,In=72;var Dn={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Tn(e){if(!zn(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function zn(e){return jn(e)}function On(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),o=[];let i="";for(const e of r)i&&i.length+e.length+1>n?(o.push(i),i=e):i=i?`${i} ${e}`:e;return i&&o.push(i),o}function Nn(e,t,n,r,o){const i=e+n,s=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?i-o.width-4:i+4,y:0>r?s-o.height:s,width:o.width,height:o.height}:{x:0>n?i-o.width:i,y:0>r?s-o.height-4:s+4,width:o.width,height:o.height}}function En(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Bn(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 Hn(e,t,n,r,o,i,s,a){const l=En(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const o=Math.max(0,r-e.x),i=Math.max(0,r-e.y);return(o+Math.max(0,e.x+e.width-(t-r)))*e.height+(i+Math.max(0,e.y+e.height-(n-r)))*e.width}(l,o,i,a);for(const e of n)c+=12*Bn(l,e);for(const e of r)c+=4*Bn(l,e);return c}function Wn(e){const{annotations:t,context:n,defaultOffset:r=An,notePadding:o=Rn,markPadding:i=Ln,edgePadding:s=Pn,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=In,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:p,cohesion:m,audience:y}=e,g=n.width||0,b=n.height||0,v="object"==typeof p?p:{},x=v.breakpoint??480,w=!!p&&x>=g,k=w&&!1!==v.preferShortText?t.map(Tn):t,j=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,S=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!m?v.cohesion:m;if(0===k.length||0>=g||0>=b)return k.slice();const A=[],R=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}})}(n,i);let L=!1;const P=k.map((e,t)=>{if(!zn(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=e.pointId??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 o=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(o)&&o.length>=2&&i){const e=o[0],t=o[1];if("number"==typeof e&&"number"==typeof t){const n=i([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?Jt(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=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=[...On("string"==typeof e.title?e.title:void 0,t),...On("string"==typeof e.label?e.label:void 0,t)],r=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+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 A.push(En(Nn(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),o)),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}]}(r)){const t=Hn(Nn(i.x,i.y,e.dx,e.dy,u),e,A,R,g,b,o,s);f>t&&(h=e,f=t)}if(!h)return e;const p=En(Nn(i.x,i.y,h.dx,h.dy,u),o);A.push(p);const m=Math.hypot(h.dx,h.dy),y=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return L=!0,{...e,dx:h.dx,dy:h.dy,...y?{connector:y}:{}}}),I=L?P:k.slice();let D=I;if(h){let e=!1;const t=I.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:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});D=e?t:I}{let e=!1;const t=D.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Dn[t.source]??t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const o=[n,r].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${o})`)?e:{...e,label:i?`${i} (${o})`:`(${o})`}}(t);return n!==t&&(e=!0),n});D=e?t:D}const T=new Set;if(j){const e="object"==typeof j?j:{},t=function(e){if(!e)return 1;const t=function(e){const t=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}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Mn(g,b,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,o=Math.max(0,e.minVisible??1),i=Mn(n,r,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,jn(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Sn(e.annotation)),c=a.filter(e=>!Sn(e.annotation)).sort((e,t)=>Cn(t.annotation)-Cn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,o-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:D,width:g,height:b,...n});for(const e of r)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=g)for(const e of D)zn(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of D)!0===e?.defensive&&T.delete(e);let z;return z=0===T.size?D:S?D.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):D.filter(e=>!T.has(e)),C?function(e,t){let n=!1;const r=e.map(e=>zn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(z,C):z}var _n=l(require("react")),Fn=require("react/jsx-runtime"),$n={fill:(e,t)=>(0,Fn.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Fn.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function qn(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,$n[n])(r(e,t),o),i}function Gn({swatchSize:e}){return(0,Fn.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Vn(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Un=(e,t,n,r,o,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,p=[];let m=0;const y=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=qn(e,c,d,h,b),w=Vn(e,r,o),k=o&&o.size>0&&o.has(e.label);p.push((0,Fn.jsxs)("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&g?k||!1:void 0,"aria-current":y&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,Fn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&(0,Fn.jsx)(Gn,{swatchSize:b}),(0,Fn.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),p};function Yn({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+_n.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Fn.jsx)("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return(0,Fn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Fn.jsx)("defs",{children:(0,Fn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Fn.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Fn.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Fn.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[0])}),(0,Fn.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Fn.jsx)("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return(0,Fn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Fn.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Fn.jsx)("defs",{children:(0,Fn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Fn.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Fn.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[1])}),(0,Fn.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[0])})]})}function Zn(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,p]=_n.useState(0),[m,y]=_n.useState(0),g=_n.useCallback((e,t)=>{p(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const d=[],h=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const o=n;let i;n+=8,e&&(n+=16,i=n,n+=8);const s=n;return n+=r*t+8,{lineY:o,labelY:i,itemsY:s,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const p=h[f];d.push((0,Fn.jsx)("line",{stroke:"gray",x1:0,y1:p.lineY,x2:t,y2:p.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=p.labelY&&d.push((0,Fn.jsx)("text",{y:p.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d.push((0,Fn.jsx)("g",{className:"legend-item",transform:`translate(0,${p.itemsY})`,children:Un(e,n,r,o,i,s,a,f,l,c,u)},"legend-group-"+f))}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,n,r,o,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=e,m=[],{swatchSize:y,labelGap:g,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=o,j=p.map(e=>y+g+7*e.label.length),S=[];let M=0,C=0;j.forEach((e,t)=>{const n=0===C?e:C+b+e;d&&d>0&&C>0&&n>d?(S.push({start:M,end:t,width:C}),M=t,C=e):C=n}),p.length>0&&S.push({start:M,end:p.length,width:C}),S.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=p[d],x=qn(e,d,h,f,y),S=Vn(e,r,o),M=o&&o.size>0&&o.has(e.label);m.push((0,Fn.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?a===i&&d===s?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,d),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&(0,Fn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+g+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,Fn.jsx)(Gn,{swatchSize:y}),(0,Fn.jsx)("text",{y:y/2,x:y+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=j[d]+b}});const A=Math.max(0,...S.map(e=>e.width)),R=S.length;return{items:m,offset:A,totalRows:R,totalHeight:R*v}})(e,r,o,i,s,a,l,t,c,u,d,d.maxWidth??n);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=p+12});const p=d.maxWidth??n;let m=h>p?0:"center"===d.align?Math.max(0,(p-h)/2):"end"===d.align?Math.max(0,p-h):0;const y=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(y.push((0,Fn.jsx)("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),m+=16),y.push((0,Fn.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+r)),m+=n.offset+5,e[r+1]&&y.push((0,Fn.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),(0,Fn.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:h}),v=!(!n&&!r);return(0,Fn.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Fn.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function Xn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}var Qn=require("react/jsx-runtime");function Kn(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,m=Math.max(0,n-o.left-o.right),y=Math.max(1,f?s?.maxWidth??m:100);let g,b;return"left"===i?(g=Math.max(4,o.left-y-10),b=o.top):"top"===i?(g=o.left,b=p?32:8):"bottom"===i?(g=o.left,b=r-o.bottom+38):(g=n-o.right+10,b=o.top),(0,Qn.jsx)("g",{transform:`translate(${g}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,Qn.jsx)(Yn,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):Xn(t)?(0,Qn.jsx)(Zn,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Jn=require("react/jsx-runtime");function er(e){const{width:t,height:n,totalWidth:r,totalHeight:o,margin:i,showAxes:s,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f,legendLayout:p,foregroundGraphics:m,annotations:y,onAnnotationActivate:g,onObservation:b,chartId:v,chartType:x,autoPlaceAnnotations:w,svgAnnotationRules:k,pointNodes:j,geoProjection:S}=e,M=function(e){const t=Tt(e=>e.pushObservation),n=It.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return It.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:g,onObservation:b,chartId:v,chartType:x}),C=(0,Ot.useRef)([y?.length??0,new Map]),A=y?.length??0;C.current[0]!==A&&(C.current=[A,new Map]);const R=(0,Ot.useMemo)(()=>{if(!y||0===y.length)return null;const e=function(e,t={}){const n=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,o=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&o.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&o.has(t)&&!r)})}(y),r=S?e.map(e=>{if(!Array.isArray(e.coordinates)||2>e.coordinates.length)return e;const t=S(Number(e.coordinates[0]),Number(e.coordinates[1]));return t?{...e,x:t[0],y:t[1]}:e}):e,o={scales:{x:e=>Number(e),y:e=>Number(e)},timeAxis:"x",width:t,height:n,frameType:"xy",pointNodes:j,stickyPositionCache:C.current[1]};return function(e,t,n,r){const o=[];return e.forEach((e,i)=>{let s;if(n){const o=n(e,i,r);s=null!=o?o:t(e,i,r)}else s=t(e,i,r);s&&o.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:sn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>rn(e.annotation)),o=e.some(e=>null!=on(e.annotation)),i=e.some(e=>"layer"===on(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=nn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=rn(t.annotation);let s=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;s=(0,tn.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:an(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const a=on(t.annotation);return a&&(s=(0,tn.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,tn.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return r&&a.unshift((0,tn.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")),i&&a.unshift((0,tn.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}(o)}(w?Wn({annotations:r,context:o,..."object"==typeof w?w:{}}):r,function(e,t={}){return function(e,n,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Jt(e,n,r);if(!t)return null;const{x:o,y:i}=t;if(!en(o,i,r))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,xn.jsx)(qt,{noteData:{x:o,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=Zt(null!=e.value?{...e,x:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(r.height||0)-4:"center"===i?(r.height||0)/2:16;const a=t>.6*(r.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,xn.jsxs)("g",{opacity:e.opacity,children:[(0,xn.jsx)("line",{x1:t,y1:0,x2:t,y2:r.height||0,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,xn.jsx)(un,{x:l,y:s,text:e.label,textAnchor:c,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=Xt(null!=e.value?{...e,y:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(r.width||0)/2,l="middle"):(a=(r.width||0)-4,l="end");const c=20>(s=t)?Math.min((r.height||0)-4,s+16):s-4;return(0,xn.jsxs)("g",{opacity:e.opacity,children:[(0,xn.jsx)("line",{x1:0,y1:t,x2:r.width||0,y2:t,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,xn.jsx)(un,{x:a,y:c,text:e.label,textAnchor:l,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:Zt({...e,type:"point"},r),y:Xt({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=(0,Gt.packEnclose)(t),i=e.padding||10;return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("circle",{cx:o.x,cy:o.y,r:o.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,xn.jsx)(un,{x:o.x,y:o.y-o.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:Zt({...e,type:"point"},r),y:Xt({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=ie(i),[c,u]=ie(s),d=a-o,h=l+o,f=c-o;return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("rect",{x:d,y:f,width:h-d,height:u+o-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,xn.jsx)(un,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=r.data||[],o="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,xn.jsx)("g",{children:o.map((t,n)=>{const o=Zt(t,r),s=Xt(t,r);if(null==o||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,xn.jsx)("circle",{cx:o,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Zt(e,r),o=Xt(e,r);return(0,xn.jsx)(qt,{noteData:{x:t??0,y:o??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",s="ordinal"===r.frameType,a="horizontal"===r.projection,l=s?o:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,p=r.scales?.y??r.scales?.value;if(!f||!p)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),o=t-n,i=e(d[n]);return i+(e(d[r])-i)*o},y=f,g=p;let b;if(s)if(a){const e=m(g);b=(t,n)=>[y(n),e(t)]}else{const e=m(y);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[y(e),g(t)];const v=e.method||"linear";let x;if("loess"===v)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:r[e]/l;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*o[e],h+=t*i[e],f+=t*o[e]*o[e],p+=t*o[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*p-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?Yt(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:Ut((n*t[3]-t[0]*t[1])/r),i=Ut(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[Ut(e),Ut(o*e+i)]),equation:[o,i]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),k=e.color||"#6366f1",j=x[x.length-1],[S,M]=b(j[0],j[1]);return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,xn.jsx)("text",{x:S+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=r.scales?.y??r.scales?.value,s=t?.domain?.(),a=e.y0??s?.[0],l=e.y1??s?.[1],c=null!=a&&t?t(a):0,u=null!=l&&t?t(l):r.height||0,d=vn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,xn.jsxs)("g",{opacity:e.opacity,children:[d.def&&(0,xn.jsx)("defs",{children:d.def}),(0,xn.jsx)("rect",{x:0,y:Math.min(c,u),width:r.width||0,height:Math.abs(u-c),fill:d.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,xn.jsx)(un,{x:(r.width||0)-4,y:(o=c,i=u,Math.max(Math.min(o,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=r.scales?.x??r.scales?.time,o=t?.domain?.(),i=e.x0??o?.[0],s=e.x1??o?.[1],a=null!=i&&t?t(i):null,l=null!=s&&t?t(s):null;if(null==a||null==l)return null;const c=vn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,xn.jsxs)("g",{opacity:e.opacity,children:[c.def&&(0,xn.jsx)("defs",{children:c.def}),(0,xn.jsx)("rect",{x:Math.min(a,l),y:0,width:Math.abs(l-a),height:r.height||0,fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,xn.jsx)(un,{x:Math.min(a,l)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[o]-t[o]);if(2>u.length)return null;const d=wn[r.curve||"linear"]||Vt.curveLinear,h=(0,Vt.area)().x(e=>i(e[o])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,xn.jsx)("text",{x:i(u[u.length-1][o])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=r.data||[];if(2>t.length)return null;const o=r.yAccessor||"y",i=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[o]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[o];return null!=t&&Math.abs(t-l)>d*u});return(0,xn.jsxs)("g",{children:[f&&(0,xn.jsx)("rect",{x:0,y:Math.min(b,v),width:r.width||0,height:Math.abs(v-b),fill:p,fillOpacity:m}),x.map((e,t)=>{const n=Zt(e,r),o=Xt(e,r);return null==n||null==o?null:(0,xn.jsx)("circle",{cx:n,cy:o,r:g,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,xn.jsx)("text",{x:(r.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=r.data||[];if(3>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",s=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=Yt(l,e.order||2).equation;c=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=l.length;let t=0,n=0,r=0,o=0;for(const[e,i]of l)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const s=(e*o-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,m=l.reduce((e,t)=>e+(t[0]-p)**2,0),y=e.confidence??.95,g=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;b>=e;e++)w.push(v+e*x);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(m>0?(e-p)**2/m:0))*g;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(v)},${a(c(v))}`,C=e.strokeColor||"#6366f1";return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,xn.jsx)("polyline",{points:`${M} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,xn.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let o,i;if(null!=e.px&&null!=e.py)o=e.px,i=e.py;else{const t=Jt(e,n,r);if(!t)return null;o=t.x,i=t.y}if(!en(o,i,r))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,xn.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,xn.jsx)("foreignObject",{x:o+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,xn.jsx)("div",{...zt(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=Jt(e,n,r);if(!t)return null;const{x:o,y:i}=t,s=o+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,xn.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Nt.cloneElement(c,{key:"ann-text-"+n}):(0,xn.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,xn.jsx)("line",{x1:o,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Nt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const o=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=r.scales?.o,s=r.scales?.x,a=r.scales?.y,l=o(i)?i:o(s)?s:o(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,xn.jsxs)("g",(r.projection?"vertical"===r.projection:l===s)?{children:[(0,xn.jsx)("rect",{x:c,y:0,width:u,height:r.height||0,fill:d,fillOpacity:h}),f&&(0,xn.jsx)(un,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,xn.jsx)("rect",{x:0,y:c,width:r.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,xn.jsx)(un,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var o,i,s}}(0,M),k,o)},[y,w,k,t,n,j,M,S]);return s||a||l||m||R&&R.length>0?(0,Jn.jsxs)("svg",{role:"img",width:r,height:o,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Jn.jsx)("title",{children:"string"==typeof a?a:"XY Chart"}),(0,Jn.jsx)("desc",{children:"string"==typeof a?a+" (XY data visualization)":"XY data visualization"}),(0,Jn.jsxs)("g",{transform:"translate("+i.left+","+i.top+")",children:[R,m]}),a&&"string"==typeof a?(0,Jn.jsx)("text",{x:r/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?(0,Jn.jsx)("foreignObject",{x:0,y:0,width:r,height:i.top,children:a}):null,Kn({legend:l,totalWidth:r,totalHeight:o,margin:i,legendPosition:f,title:a,legendLayout:p,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}):null}l(require("react")),require("d3-shape");var tr=require("d3-shape");function nr(e){switch(e){case"monotoneX":return tr.curveMonotoneX;case"monotoneY":return tr.curveMonotoneY;case"cardinal":return tr.curveCardinal;case"catmullRom":return tr.curveCatmullRom;case"step":return tr.curveStep;case"stepBefore":return tr.curveStepBefore;case"stepAfter":return tr.curveStepAfter;case"basis":return tr.curveBasis;case"natural":return tr.curveNatural;default:return null}}function rr(e,t,n){if(null==t)return n;if(pn(t)){const r=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,r=`${mn(e)}@${n}`,o=gn.get(r);if(void 0!==o)return o;const i=function(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:s=45}=e,a={background:n,stroke:r,lineWidth:o,spacing:i,angle:s},l=Math.max(8,Math.ceil(2*i));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(hn||(hn=document.createElement("canvas")),hn.width=e,hn.height=e,hn)}(l)}catch{return dn(a)}const u=c.getContext("2d");if(!u)return dn(a);n&&"transparent"!==n?(u.fillStyle=n,u.fillRect(0,0,l,l)):u.clearRect(0,0,l,l),u.strokeStyle=r,u.lineWidth=o,u.lineCap="square";const d=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-l;2*l>=t;t+=i)u.beginPath(),u.moveTo(t,0),u.lineTo(t+e*l,l),u.stroke()}else{u.save(),u.translate(l/2,l/2),u.rotate(d);const e=2*l;for(let t=-e;e>=t;t+=i)u.beginPath(),u.moveTo(-e,t),u.lineTo(e,t),u.stroke();u.restore()}return(t||u).createPattern(c,"repeat")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),s=pn(i)?null:i;return gn.set(r,s),s}(t,e);return r||t.background&&gt(e,t.background)||n}return"string"!=typeof t?t:gt(e,t)||n}function or(e,t){if(null==t)return;const n=rr(e,t,"");return""===n?void 0:n}function ir(e,t,n,r,o,i){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 a=e.createLinearGradient(n,r,o,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}var sr=require("react/jsx-runtime");function ar(e,t="#4e79a7"){return pn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}var lr=l(require("react")),cr=require("react/jsx-runtime");require("react/jsx-runtime");var ur="undefined"==typeof window||"undefined"==typeof document,dr=require("react"),hr="undefined"!=typeof window?dr.useLayoutEffect:dr.useEffect,fr=()=>()=>{},pr=()=>!1,mr=()=>!0,yr=require("react"),gr=require("react/jsx-runtime");function br({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?(0,gr.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:(0,gr.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}var vr=require("react");function xr(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function wr(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 kr(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}var jr=l(require("react")),Sr=l(require("react")),Mr=(require("react/jsx-runtime"),Sr.createContext(null)),Cr=require("react/jsx-runtime"),Ar={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Rr({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,Cr.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Ar,children:t})}function Lr(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function Pr(e){return e&&"object"==typeof e?e:{}}function Ir(e){return Pr(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Dr=require("react/jsx-runtime");function Tr(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),r=i.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of s)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}var zr=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Or="semiotic-accessible-data-table",Nr=Or+" semiotic-accessible-data-table-hidden",Er=Or+" semiotic-accessible-data-table-visible",Br={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"},Hr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Wr={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)"},_r={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Fr={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))"},$r={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},qr={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Gr={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 Vr({scene:e,chartType:t,tableId:n,chartTitle:r}){const[o,i]=jr.useState(!1),[s,a]=jr.useState(5),l=Sr.useContext(Mr),c=l?.visible??!1,u=o||c,d=jr.useRef(null),h=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;jr.useEffect(()=>{u||a(5)},[u]);const f=jr.useCallback(e=>{e.target===e.currentTarget&&(o||c||i(!0))},[o,c]),p=jr.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Dr.jsx)("span",{id:n,tabIndex:-1,style:Ar}):null;if(!u)return(0,Dr.jsx)("div",{id:n,className:Nr,tabIndex:-1,onFocus:f,style:Ar,role:"region","aria-label":h,children:(0,Dr.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:Lr(Ir(r))});break;case"line":case"area":{const e=Ir(r),n=Array.isArray(e)?e:[],o="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:o,values:Lr(e)});break}case"rect":{const e=Ir(r),n=null!=e&&"object"==typeof e?e:{},o=n.category??r.group??"",i=n.value??n.__aggregateValue??n.total,s=Lr(n);null==s.category&&""!==o&&(s.category=o+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Lr(Ir(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Ir(r),n=Lr(e);if(null==n.category){const t=Pr(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:Lr(Ir(r))});break;case"arc":t.push({label:"Arc",values:Lr(Ir(r))});break;case"candlestick":t.push({label:"Candlestick",values:Lr(Ir(r))});break;case"geoarea":{const e=Pr(Ir(r)),n=Lr(e);if(null==n.name){const t=Pr(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),y=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 r of t){const t=[],o=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&o.add(e+""))}if(t.length>0){let e=t[0],o=t[0],i=0;for(const n of t)e>n&&(e=n),n>o&&(o=n),i+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:o,mean:i/t.length})}else if(o.size>0){const e=Array.from(o);n.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${zr(e.min)} to ${zr(e.max)}, mean ${zr(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(m.length,y),b=Math.min(s,m.length),v=m.slice(0,b),x=m.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,Dr.jsxs)("div",{ref:d,id:n,className:Er,tabIndex:-1,onBlur:p,style:Br,role:"region","aria-label":h,children:[(0,Dr.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Wr,children:"×"}),(0,Dr.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Hr,children:g}),(0,Dr.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:_r,children:[(0,Dr.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:qr,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),(0,Dr.jsx)("thead",{children:(0,Dr.jsxs)("tr",{children:[(0,Dr.jsx)("th",{style:Fr,children:"type"}),k.map(e=>(0,Dr.jsx)("th",{style:Fr,children:e},e))]})}),(0,Dr.jsx)("tbody",{children:v.map((e,t)=>(0,Dr.jsxs)("tr",{children:[(0,Dr.jsx)("td",{style:$r,children:e.label}),k.map(t=>{return(0,Dr.jsx)("td",{style:$r,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":zr(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,Dr.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:Gr,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Ur({summary:e}){return e?(0,Dr.jsx)("div",{role:"note",style:Ar,children:e}):null}function Yr({tableId:e}){return(0,Dr.jsx)("a",{href:"#"+e,style:Ar,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Ar)},children:"Skip to data table"})}var Zr=require("react");var Xr=Object.freeze([]);function Qr(e){if(!e)return Xr;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var Kr=require("react/jsx-runtime"),Jr="var(--semiotic-focus, #005fcc)";function eo({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==o&&"path"!==o||!a)if("rect"===o&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,Kr.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Jr,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Kr.jsx)("circle","wedge"===o?{cx:l,cy:c,r:12,fill:"none",stroke:Jr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Jr,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Kr.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,Kr.jsx)("path",{d:a,fill:"none",stroke:Jr,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Kr.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var to=l(require("react"));function no(e,t){return"touch"===t?Math.max(e,24):e}var ro=["name","label","title"],oo=["type","kind","category","group","class","status","role","shape"],io=["value","amount","total","count","weight","score"],so=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function ao(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function lo(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,o=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&so.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&o.push({key:t,lower:t.toLowerCase(),value:n})}if(0===o.length)return{entries:[]};let i=o.findIndex(e=>ro.includes(e.lower));const s=i>=0;0>i&&(i=o.findIndex(e=>"id"===e.lower)),0>i&&(i=o.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:o[i];let l=o.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=ao(l,oo),u=ao(l,io),d=new Set(oo),h=new Set(io),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}var co=require("react/jsx-runtime"),uo={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 ho(e,t){return"function"==typeof t?t(e):e[t]}function fo(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 po(e={}){const{fields:t,title:n,format:r,style:o={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=ho(e,n);s=fo(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const s=ho(e,o);a.push({label:n,value:fo(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=fo(e[n],r);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=fo(e[t[0]],r))}}const l={...uo,...o};return(0,co.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,co.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,co.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,co.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function mo(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Array.isArray(r=!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e)?r[0]:r;var r;if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,co.jsx)("div",{className:"semiotic-tooltip",style:uo,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?po(e):"multi"===e?("undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip — prefer charts that set tooltipMode (LineChart, AreaChart, StackedAreaChart, DifferenceChart). Rendering MultiLineTooltip content as a fallback.'),function(e={}){const{fields:t=[],title:n,format:r,style:o={},className:i="",showLabels:s=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=ho(e,n);l.push({value:fo(t,r)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const a=fo(ho(e,o),i);l.push({label:s?n:void 0,value:a})});else{const t=lo(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:fo(t.title,r),bold:!0}),t.entries.forEach(e=>{l.push({label:s?e.key:void 0,value:fo(e.value,r)})})}const c={...uo,...o};return Array.isArray(l)&&0!==l.length?(0,co.jsx)("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>(0,co.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,co.jsxs)("strong",{children:[e.label,a]}),e.value]},t))}):null}}()):po())}}var yo=require("react/jsx-runtime");function go({x:e,y:t,containerWidth:n,containerHeight:r,margin:o,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=to.useRef(null),[u,d]=to.useState(null);to.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,r,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!to.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(i),p=f?null:uo;return l?(0,yo.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:o.left+e,top:o.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var bo=require("d3-zoom"),vo=require("d3-selection");function xo(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function wo(e,t,n=.6){if(!xo(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,o=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(o,i,r,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 ko(e,t,n,r=.35){xo(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var jo=require("d3-shape");function So(e,t,n){let r=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(r=n.color):e>n.value&&(r=n.color);return r}function Mo(e,t,n,r,o,i){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],r=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+r*r))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=r,e.lineCap=i;for(let n=0;t.length-1>n;n++){const r=(s[n]+s[n+1])/2;let i=o;l>r&&(i*=r/l),l>a-r&&(i*=(a-r)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function Co(e,t,n,r,o){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=He(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=rr(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,r),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=o*a*(t.style.fillOpacity??1);const u=qe(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ve(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ve(e,i,c,t.accent,void 0,l),e.restore()}function Ao(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),s=Math.round(t[1]*r),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),o.setTransform(a,0,0,l,0,0),o.translate(n.left,n.top),o}function Ro(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}function Lo([e,t,n]){const r=1<<n;return[e-Math.floor(e/r)*r,t,n]}function Po(e,t,n,r,o){return"function"==typeof e?e(t,n,r,o):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",r+"").replace("{r}",o>1?"@2x":"")}var Io=class{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,r]of this.cache)t>r.lastUsed&&(t=r.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()}};var Do=class{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,t=Math.random){for(let n=0;this.capacity>n;n++){const r=this.particles[n];if(!r.active)return r.active=!0,r.t=0,r.offset=.6*(t()-.5),r.lineIndex=e,r.x=0,r.y=0,r}return null}step(e,t,n,r){for(let o=0;this.capacity>o;o++){const i=this.particles[o];if(!i.active)continue;const s=n[i.lineIndex];if(!s||2>s.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const a=To(s),l=zo(s,i.t*a),c=(r[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}};function To(e){let t=0;for(let n=1;e.length>n;n++){const r=e[n][0]-e[n-1][0],o=e[n][1]-e[n-1][1];t+=Math.sqrt(r*r+o*o)}return t}function zo(e,t){let n=0;for(let r=1;e.length>r;r++){const o=e[r][0]-e[r-1][0],i=e[r][1]-e[r-1][1],s=Math.sqrt(o*o+i*i);if(n+s>=t||r===e.length-1){const a=s>0?(t-n)/s:0,l=s>.001?s:1;return{x:e[r-1][0]+o*a,y:e[r-1][1]+i*a,nx:-i/l,ny:o/l}}n+=s}const r=e[e.length-1];return{x:r[0],y:r[1],nx:0,ny:0}}var Oo=l(require("react"));function No(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Oo.createElement(Oo.Fragment,null,...t)}var Eo=l(require("react")),Bo=require("react/jsx-runtime"),Ho=Eo.createContext(null);function Wo({value:e,children:t}){return(0,Bo.jsx)(Ho.Provider,{value:e,children:t})}function _o(e,t){return null!=e?(0,Bo.jsx)(Wo,{value:t,children:e}):e}var Fo=new Set;function $o(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function qo(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;Fo.has(n)||(Fo.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function Go(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("glyph"===n.type){const e=n,r=Ge(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+r.centerDx,y:e.y+r.centerDy,r:r.radius})}return t}require("react/jsx-runtime");var Vo=require("react/jsx-runtime");function Uo({data:e}){if(!e)return null;if(e.properties)return(0,Vo.jsx)("div",{className:"semiotic-tooltip",style:uo,children:(0,Vo.jsx)("div",{style:{fontWeight:600},children:e.properties.name||e.properties.NAME||e.properties.id||"Feature"})});const t=null!=e.data?e.data:e;if(!t||"object"!=typeof t)return null;const n=lo(t),r=null!=n.title?n.title+"":null;return null==r&&0===n.entries.length?null:(0,Vo.jsxs)("div",{className:"semiotic-tooltip",style:uo,children:[null!=r&&(0,Vo.jsx)("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:r}),n.entries.map(e=>{return(0,Vo.jsxs)("div",{children:[(0,Vo.jsxs)("span",{style:{opacity:.7},children:[e.key,": "]}),(0,Vo.jsx)("span",{style:{fontWeight:600},children:(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")})]},e.key);var t})]})}Uo.ownsChrome=!0;var Yo={top:10,right:10,bottom:10,left:10},Zo=null;function Xo(){if(null!==Zo)return Zo;if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&4>=navigator.hardwareConcurrency,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return Zo=e||t||n}function Qo(){return Xo()?12:30}var Ko={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 Jo(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function ei(e){return e?e.getContext("2d"):null}function ti(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function ni(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}var ri=require("react"),oi=require("react");function ii(e){const t=e.datum;return{...t||{},...t?.properties||{},data:t,properties:t?.properties,x:e.x,y:e.y,__semioticHoverData:!0}}var si=require("react/jsx-runtime"),ai=(0,u.memo)((0,u.forwardRef)(function(e,t){const{projection:n,projectionExtent:r,fitPadding:o,projectionTransform:i,areas:s,points:a,lines:l,customLayout:c,layoutConfig:d,layoutSelection:h,onLayoutError:f,xAccessor:p,yAccessor:m,lineDataAccessor:y,pointIdAccessor:g,lineIdAccessor:b,lineType:v="geo",flowStyle:x="basic",graticule:w,zoomable:k,zoomExtent:j,onZoom:S,dragRotate:M,showParticles:C,particleStyle:A,tileURL:R,tileAttribution:L,tileCacheSize:P,size:I,width:D,height:T,responsiveWidth:z,responsiveHeight:O,margin:N,className:E,background:B,windowSize:H=500,renderMode:W,areaStyle:_,pointStyle:F,lineStyle:$,colorScheme:q,enableHover:G=!0,hoverAnnotation:V,tooltipContent:U,allowTooltipOverflow:Y=!1,customClickBehavior:Z,customHoverBehavior:X,onObservation:Q,annotationObservationCallback:K,chartId:J,annotations:ee,onAnnotationActivate:te,autoPlaceAnnotations:ne,svgAnnotationRules:re,decay:oe,pulse:ie,transition:se,animate:ae,staleness:le,frameScheduler:ce,clock:ue,random:de,seed:he,paused:fe=!1,suspendWhenHidden:pe=!0,backgroundGraphics:me,foregroundGraphics:ye,title:ge,legend:be,legendPosition:ve,legendLayout:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:je,legendIsolatedCategories:Se,legendCategoryAccessor:Me,onCategoriesChange:Ce,showAxes:Le,accessibleTable:Pe=!0,description:Ie,summary:De}=e,{customHoverBehavior:Te,customClickBehavior:Ne,hasClickBehavior:Ee}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r,chartType:o}){return{customHoverBehavior:(0,ri.useCallback)((t,i)=>{e?.(t,i),ti({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:o,chartId:r,context:i})},[r,o,e,n]),customClickBehavior:(0,ri.useCallback)((e,i)=>{t?.(e,i),ni({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:o,chartId:r,context:i})},[r,o,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:X,customClickBehavior:Z,onObservation:Q,chartId:J,chartType:"StreamGeoFrame"}),Be=I||[D||600,T||400],We=(0,u.useRef)(!0),Fe=St({sizeProp:Be,responsiveWidth:z,responsiveHeight:O,userMargin:N,marginDefault:Yo,title:ge,legend:be,legendPosition:ve,foregroundGraphics:ye,backgroundGraphics:me,animate:ae,transitionProp:se,frameScheduler:ce,clock:ue,random:de,seed:he,paused:fe,suspendWhenHidden:pe,themeDirtyRef:We}),{reducedMotionRef:$e,responsiveRef:Ve,size:Ye,margin:Ze,adjustedWidth:Xe,adjustedHeight:Qe,resolvedForeground:Ke,resolvedBackground:Je,transition:et,introEnabled:nt,tableId:rt,frameRuntime:ot,rafRef:it,renderFnRef:st,scheduleRender:at,currentTheme:lt}=Fe,ct=function(){const[e,t]=(0,dr.useState)(!1);return hr(()=>{t(!0)},[]),e}(),ut=function(){const e=(0,dr.useSyncExternalStore)(fr,pr,mr);return(0,dr.useRef)(e).current}(),dt=(0,u.useMemo)(()=>Array.isArray(s)?Qr(s):s,[s]),ht=(0,u.useMemo)(()=>Qr(a),[a]),ft=(0,u.useMemo)(()=>Qr(l),[l]),pt=(0,u.useMemo)(()=>null!=M?M:"orthographic"===Jo(n),[M,n]),mt=function(e){const t=(0,vr.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return wr(e,t);if(!kr(e)||!kr(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const n=e[r],o=t[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!wr(n,o))return!1}else{if(!kr(n)||!kr(o))return!1;if(!xr(n,o))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,u.useMemo)(()=>({projection:n,projectionExtent:r,fitPadding:o,xAccessor:p,yAccessor:m,lineDataAccessor:y,lineType:v,flowStyle:x,areaStyle:_,pointStyle:F,lineStyle:$,colorScheme:q,themeSemantic:tt(lt),themeSequential:lt?.colors?.sequential,themeDiverging:lt?.colors?.diverging,themeCategorical:lt?.colors?.categorical,graticule:w,projectionTransform:i,windowSize:H,clock:ot.now,decay:oe,pulse:ie,transition:et,introAnimation:nt,annotations:ee,pointIdAccessor:g,lineIdAccessor:b,customLayout:c,layoutConfig:d,onLayoutError:f,layoutMargin:Ze}),[n,r,o,p,m,y,v,x,_,F,$,q,lt,w,i,H,ot.now,oe,ie,et,nt,ee,g,b,c,d,f,Ze])),yt=(0,u.useRef)(null);yt.current||(yt.current=new Ae(mt));const bt=(0,u.useRef)(null),vt=(0,u.useRef)(null),xt=(0,u.useRef)(null);R&&!xt.current&&(xt.current=new Io(P||256));const wt=(0,u.useRef)(ee),kt=(0,u.useRef)(null),jt=(0,u.useRef)(bo.zoomIdentity),Lt=(0,u.useRef)(!1),It=(0,u.useRef)(null),Dt=(0,u.useCallback)(e=>{It.current=e,Ve&&"object"==typeof Ve&&(Ve.current=e)},[Ve]),Tt=(0,u.useRef)(null),zt=(0,u.useRef)(null),Ot=(0,u.useRef)(null),Nt=(0,u.useRef)(0);if(C&&!Ot.current){const e=A?.maxPerLine??Qo();Ot.current=new Do(50*e)}const Et=(0,u.useRef)(null),Bt=(0,u.useRef)(null),Ht=(0,u.useRef)(!1),Wt=(0,u.useRef)(!1),_t=(0,Re.useRef)(new ze("StreamGeoFrame")),Ft=(0,u.useRef)(void 0),[$t,qt]=(0,u.useState)(null),[,Gt]=(0,u.useState)(0),Vt=(0,u.useRef)(0),[Ut,Yt]=(0,u.useState)(!1),Zt=function(e,t,n,r){const o=(0,Zr.useRef)({accessor:t,onChange:n,readData:r}),i=(0,Zr.useRef)([]);return o.current={accessor:t,onChange:n,readData:r},(0,Zr.useCallback)(()=>{const{accessor:t,onChange:n,readData:r}=o.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,r=[];for(const o of e){if(!o||"object"!=typeof o)continue;const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),r.push(i))}return r}(e.current?r(e.current):[],t);(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})(s,i.current)||(i.current=s,n(s))},[e])}(yt,Me,Ce,e=>e.getPoints());!function(e,t,n,r){(0,Mt.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}(yt,mt,We,at),function(e,t,n,r){const o=(0,Mt.useRef)(null);(0,Mt.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;o.current!==s&&(o.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,r())},[t,r,e,n])}(yt,h,We,at),(0,u.useEffect)(()=>{const e=yt.current;e&&(dt&&e.setAreas(dt),a&&e.setPoints(ht),l&&e.setLines(ft),We.current=!0,at())},[dt,a,ht,l,ft,at]);const Xt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(yt.current?.pushPoint(e),We.current=!0,at())},[at]),Qt=(0,u.useCallback)(e=>{const t=Qr(e);0!==t.length&&(yt.current?.pushMany(t),We.current=!0,at())},[at]),Kt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(yt.current?.pushLine(e),We.current=!0,at())},[at]),Jt=(0,u.useCallback)(e=>{const t=Qr(e);0!==t.length&&(yt.current?.pushManyLines(t),We.current=!0,at())},[at]),en=(0,u.useCallback)(()=>{yt.current?.clear(),We.current=!0,at()},[at]);(0,u.useImperativeHandle)(t,()=>({push:Xt,pushMany:Qt,removePoint:e=>{const t=yt.current?.removePoint(e)??[];return t.length>0&&(We.current=!0,at()),t},pushLine:Kt,pushManyLines:Jt,removeLine:e=>{const t=yt.current?.removeLine(e)??[];return t.length>0&&(We.current=!0,at()),t},getLines:()=>yt.current?.getLines()??[],clear:en,getProjection:()=>yt.current?.scales?.projection??null,getGeoPath:()=>yt.current?.scales?.geoPath??null,getCartogramLayout:()=>yt.current?.cartogramLayout??null,getCustomLayout:()=>yt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>yt.current?.lastCustomLayoutFailure??null,getZoom:()=>jt.current.k,resetZoom:()=>{const e=It.current;e&&kt.current&&(0,vo.select)(e).call(kt.current.transform,bo.zoomIdentity)},getData:()=>yt.current?.getPoints()??[]}),[Xt,Qt,Kt,Jt,en,at]);const{hoverHandlerRef:tn,onPointerMove:nn,onPointerLeave:rn}=Fe,{canvasRef:on,interactionCanvasRef:sn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,s=(0,yr.useRef)(null),a=(0,yr.useRef)(null),l=(0,yr.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:s,cleanup:a}=e;hr(()=>{const e=r.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():o.current=!0,s?.(),i.current()},[t,n]);const l=(0,dr.useRef)(a);l.current=a,(0,dr.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,yr.useEffect)(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),(0,yr.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(Fe,{hydrated:ct,wasHydratingFromSSR:ut,storeRef:yt,dirtyRef:We,cleanup:()=>xt.current?.clear(),canvasPaintDependencies:[Xe,Qe,B,me,W,at]});(0,u.useEffect)(()=>{tn.current=e=>{if(!G)return;const t=yt.current;if(!t||!t.scene.length)return;const n=on.current;if(!n)return;const r=n.getBoundingClientRect(),o=e.clientX-r.left-Ze.left,i=e.clientY-r.top-Ze.top;if(0>o||o>Xe||0>i||i>Qe)return Et.current=null,Bt.current=null,qt(null),Te?.(null),void at();vt.current||(vt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=ei(vt.current);if(!s)return;const a=no(30,e.pointerType),l=no(6,e.pointerType),c=Ue(t.scene,o,i,a,s,t.quadtree,t.maxPointRadius,l);if(c){const e=c.node,t=e.datum,n=Array.isArray(t)?null:t?.properties?t:t?.data||t;let r,s;"point"===e.type?(r=e.x,s=e.y):"geoarea"===e.type?(r=e.centroid[0],s=e.centroid[1]):(r=o,s=i);const a={...n,...n?.properties||{},data:n,properties:n?.properties,__semioticHoverData:!0,x:r,y:s};Et.current=a,Bt.current=e,qt(a),Te?.(a),at()}else Et.current&&(Et.current=null,Bt.current=null,qt(null),Te?.(null),at())}},[G,Xe,Qe,Ze,Te,at,tn,on]),Fe.hoverLeaveRef.current=()=>{Et.current=null,Bt.current=null,qt(null),Te?.(null),at()};const an=(0,u.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Ne)return;const n=yt.current;if(!n||!n.scene.length)return void Ne(null);const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left-Ze.left,i=e.clientY-r.top-Ze.top;if(0>o||o>Xe||0>i||i>Qe)return void Ne(null);vt.current||(vt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=ei(vt.current);if(!s)return void Ne(null);const a=no(30,Ft.current),l=no(6,Ft.current),c=Ue(n.scene,o,i,a,s,n.quadtree,n.maxPointRadius,l);if(c){const e=c.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,n=t?.properties?{...t,...t.properties}:t;return void Ne({...n,data:t,properties:t?.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i},{type:"activate",inputType:(u=Ft.current,"touch"===u?"touch":"pointer")})}var u;Ne(null)},[Qe,Xe,Ne,Ze]),{kbFocusIndexRef:ln,focusedNavPointRef:cn,onKeyDown:un}=function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:o,customClickBehavior:i,scheduleRender:s}){const a=(0,oi.useRef)(-1),l=(0,oi.useRef)(null),c=(0,oi.useCallback)(c=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(c))return;const u=e.current;if(!u)return;const d=()=>{a.current=-1,l.current=null,t.current=null,n&&(n.current=null),r(null),o(null),s()};if(0===u.scene.length)return void(0>a.current||d());const h=function(e){const t=[];for(const n of e)if("point"===n.type&&null!=n.x)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=Ge(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight})}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(u.scene);if(0===h.length)return void(0>a.current||d());let f=a.current;if(h.length>f||(d(),f=-1),("Enter"===c.key||" "===c.key)&&f>=0)return c.preventDefault(),void i(ii(h[f]),{type:"activate",inputType:"keyboard"});const p=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}}(c.key,0>f?-1:f,h.length);if(null===p)return;if(c.preventDefault(),0>p)return void d();const m=0>f?0:p;a.current=m;const y=h[m];l.current=y;const g=ii(y);t.current=g,r(g),o(g,{type:"focus",inputType:"keyboard"}),s()},[i,o,t,n,s,r,e]);return{kbFocusIndexRef:a,focusedNavPointRef:l,onKeyDown:c}}({storeRef:yt,hoverRef:Et,hoveredNodeRef:Bt,setHoverPoint:qt,customHoverBehavior:Te,customClickBehavior:Ne,scheduleRender:at}),dn=(0,u.useCallback)(e=>{Ft.current=e.pointerType,ln.current=-1,cn.current=null,nn(e)},[cn,ln,nn]),hn=(0,u.useCallback)(e=>{Ft.current=e.pointerType},[]);st.current=()=>{if(it.current=null,!ot.isActive)return;const e=on.current,t=yt.current;if(!e||!t)return;const n=ot.now();let r=!1;const o=zt.current;let i=!1;o&&(zt.current=null,t.applyRotation(o,{width:Xe,height:Qe}),i=!0);const s=t.advanceTransition($e.current?n+1e6:n),a=!$e.current&&s,l=_t.current.beforeCompute(t.getLastUpdateResult(),a);let c=!1;if(We.current&&!s){const n={width:Xe,height:Qe},r=t.hasProjection(),o=pt&&r?t.getRotation():null;t.computeScene(n);const i=jt.current,s=1!==i.k||0!==i.x||0!==i.y;pt&&o?s?(t.setRotation(o),t.applyZoomScale(i.k,n)):t.applyRotation(o,n):s&&t.applyZoomTransform(i,n),We.current=!1,c=!0,e.setAttribute("aria-label",Tr(t.scene,"Geographic chart")),Zt()}_t.current.afterCompute(l,c,!1);const u=Ro(),d=C&&!$e.current&&!!Ot.current,h=t.consumeStylePaintPending(),f=function(e,t,n,r){const o=r.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!o)&&e.refreshPulse(t);return r.current=s,{changed:a,pending:s}}(t,n,c,Wt),p=!!((m={dirtyOrRebuilt:c,transitioning:a,continuous:d,liveEncoding:f.changed,forced:i||h}).dirtyOrRebuilt||m.transitioning||m.animationTicked||m.continuous||m.liveEncoding||m.forced);var m;if(R&&xt.current){const e=bt.current;if(e&&t.scales?.projection){const n=Ao(e,Ye,Ze,u);if(n){n.clearRect(-Ze.left,-Ze.top,Ye[0],Ye[1]),n.save(),n.beginPath(),n.rect(0,0,Xe,Qe),n.clip();const e=function(e,t){const{tileURL:n,projection:r,width:o,height:i,tileCache:s,onTileLoad:a}=t,l=r.scale(),c=r.translate(),u=function(e){const{size:t,scale:n,translate:r,clampX:o=!0,clampY:i=!0}=e,s=Math.max(Math.log(n)/Math.LN2-8,0),a=Math.round(s),l=1<<a,c=Math.pow(2,s-a+8),u=r[0]-n/2,d=r[1]-n/2,h=Math.max(o?0:-1/0,Math.floor((0-u)/c)),f=Math.min(o?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(i?0:-1/0,Math.floor((0-d)/c)),m=Math.min(i?l:1/0,Math.ceil((t[1]-d)/c)),y=[];for(let e=p;m>e;++e)for(let t=h;f>t;++t)y.push([t,e,a]);return{tiles:y,translate:[u/c,d/c],scale:c}}({size:[o,i],scale:2*l*Math.PI,translate:c}),d=Ro();let h=!0;for(const t of u.tiles){const[r,o,i]=Lo(t),l=`${i}/${r}/${o}`;let c=s.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};s.set(l,t),e.onload=()=>{t.loaded=!0,a?.()},e.onerror=()=>{t.loaded=!0},e.src=Po(n,i,r,o,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}(n,{tileURL:R,projection:t.scales.projection,width:Xe,height:Qe,tileCache:xt.current,onTileLoad:()=>at()});n.restore(),e||(r=!0)}}}if(p){const o=Ao(e,Ye,Ze,u);if(!o)return;o.clearRect(-Ze.left,-Ze.top,Ye[0],Ye[1]),R||function(e,t){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:o="",x:i=0,y:s=0,width:a,height:l}=t,c=function(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:r=""}=e;return"transparent"===t||n?null:t||(r&&"transparent"!==r?r:"")||null}({background:n,hasBackgroundGraphics:r,themeBackground:o});if(!c)return!1;const u=gt(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(o,{background:B,hasBackgroundGraphics:!!me,width:Xe,height:Qe}),o.save(),o.beginPath(),o.rect(0,0,Xe,Qe),o.clip();const i=t.scene,s={width:Xe,height:Qe};if(function(e){const{context:t,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:i}=e;if(!r||"sketchy"===r)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=$o(r,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:o})}finally{t.restore()}l||(qo(n.id,e.type??"unknown"),i([e]))}a()}({context:o,nodes:i,renderMode:W,pixelRatio:u,paintBuiltIn:e=>{!function(e,t){const n=t.filter(e=>"geoarea"===e.type);for(const t of n){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const n=t._cachedPath2D,r=or(e,t.style.fill)||"#e0e0e0";if("none"!==r&&(e.fillStyle=r,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=gt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=t._decayOpacity??1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(n)}ko(e,t,n),e.globalAlpha=1,e.setLineDash([])}}(o,e),((e,t,n,r)=>{const o=t.filter(e=>"line"===e.type);for(const t of o){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,r.width*n,r.height),e.clip());const o=t.style.stroke||"#007bff",i=gt(e,o)||o,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Mo(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=nr(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let r=0;t.path.length-1>r;r++)e.globalAlpha=.5*(d[r]+d[r+1])*n,e.beginPath(),e.moveTo(t.path[r][0],t.path[r][1]),e.lineTo(t.path[r+1][0],t.path[r+1][1]),e.stroke()}else if(u){let n=function(t,n,r){e.beginPath(),e.strokeStyle=t,e.moveTo(n,r),d=!0},r=function(){d&&(e.stroke(),d=!1)},o=null,s=null,c=null,u=null,d=!1;for(let d=0;t.path.length>d;d++){const[h,f]=t.path[d],p=l[d],m=So(p,a,i);if(null!==o&&null!==u&&null!==c){if(m===u)e.lineTo(h,f);else{const t=[];for(const e of a){const n=e.value;(c>n||n>p)&&(n>c||p>n)||c===n||p===n||t.push({t:(n-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=o+(h-o)*l.t,u=s+(f-s)*l.t,d=So(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),r(),n(d,t,u)}e.lineTo(h,f)}o=h,s=f,c=p,u=m}else n(m,h,f),o=h,s=f,c=p,u=m}r()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?ir(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,jo.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=rr(e,t.style.fill,t.style.fill),c&&!u)(0,jo.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],r.height),e.lineTo(n,r.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(o,e,0,s),((e,t)=>{const n=t.filter(e=>"point"===e.type);if(0!==n.length){e.save();try{const t=e.globalAlpha;for(const r of n)e.beginPath(),e.arc(r.x,r.y,r.r,0,2*Math.PI),e.globalAlpha=t*(r.style.opacity??r.style.fillOpacity??1),e.fillStyle=rr(e,r.style.fill,"#4e79a7"),e.fill(),r.style.stroke&&(e.strokeStyle=rr(e,r.style.stroke,r.style.stroke),e.lineWidth=r.style.strokeWidth||1,e.stroke()),wo(e,r)}finally{e.restore()}}})(o,e),((e,t)=>{const n=e.globalAlpha;for(const r of t)"glyph"===r.type&&Co(e,r,r.x,r.y,n);e.globalAlpha=n})(o,e)}}),d&&Ot.current){const e=Ot.current,t=i.filter(e=>"line"===e.type);if(t.length>0){const i=A||{},s=.3*(i.speedMultiplier??1),a=i.maxPerLine??Qo(),l=i.spawnRate??(Xo()?.06:.15),c=i.radius??2,u=i.opacity??.7,d=n/1e3,h=Nt.current>0?Math.min(d-Nt.current,.1):.016;Nt.current=d;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth||2);for(let n=0;t.length>n;n++)ot.random()<l&&e.countForLine(n)<a&&e.spawn(n,ot.random);e.step(h,s,f,p),o.globalAlpha=u;for(let n=0;e.particles.length>n;n++){const r=e.particles[n];if(!r.active)continue;const s=t[r.lineIndex],a="function"==typeof i.color?i.color(s?.datum??{}):"source"!==i.color&&i.color?i.color:s?.style.stroke||"#fff";o.beginPath(),o.arc(r.x,r.y,c,0,2*Math.PI),o.fillStyle=a,o.fill()}o.globalAlpha=1,r=!0}}o.restore()}const y=Bt.current,g=!(!y||"geoarea"!==y.type&&"point"!==y.type),b=g||Ht.current;const v=sn.current;if(v&&b){const e=Ao(v,Ye,Ze,u);if(e){if(e.clearRect(-Ze.left,-Ze.top,Ye[0],Ye[1]),y&&"geoarea"===y.type){const t=new Path2D(y.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(t),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(t)}if(y&&"point"===y.type){const t=y,n="object"==typeof V?V:void 0,r=n?.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}(y);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}Ht.current=g}const x=ee!==wt.current;x&&(wt.current=ee),(c||x||a&&ee&&ee.length>0)&&(c||x||n-Vt.current>=33)&&(Gt(e=>e+1),Vt.current=n),(a||null!=t.activeTransition||f.pending||r)&&at()},function(e,t,n,r,o,i){const s=(0,Ct.useRef)("fresh");(0,Ct.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return Rt;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},o=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...At,...e.opacities??{}}[o],band:o,isStale:"fresh"!==o}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Rt}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===o||(s.current=c.band,c.isStale!==o&&i(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(a)},[e,o,r,t,i,n])}(le,yt,We,at,Ut,Yt),(0,u.useEffect)(()=>{if("production"!==process.env.NODE_ENV&&R){const e=Jo(n);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.`)}},[R,n]),(0,u.useEffect)(()=>{const e=It.current;if(!k||!e)return kt.current&&e&&((0,vo.select)(e).on(".zoom",null),kt.current=null),void(e&&(0,vo.select)(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=j||[1,8],r={width:Xe,height:Qe};if(pt){let o=jt.current.k;const i=e=>{o=Math.max(t,Math.min(n,e)),jt.current=bo.zoomIdentity.scale(o);const i=yt.current;i&&(i.applyZoomScale(o,r),We.current=!1,at(),i.scales?.projection&&S?.({projection:i.scales.projection,zoom:i.currentZoom}))};kt.current={scaleBy:(e,t)=>i(o*t),transform:(e,t)=>i(t?.k??1)};const s=e=>{e.preventDefault(),i(o*(0>e.deltaY?1.1:1/1.1))},a=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*o))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",a);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const r=yt.current;if(!r)return;const o=r.getRotation();Tt.current={x:t.clientX,y:t.clientY,rotation:[...o]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=Tt.current;t&&(zt.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],at())},d=t=>{if(!Tt.current)return;Tt.current=null,e.releasePointerCapture(t.pointerId);const n=zt.current;if(n){zt.current=null;const e=yt.current;e&&(e.applyRotation(n,r),at())}const o=yt.current;o?.scales?.projection&&S?.({projection:o.scales.projection,zoom:o.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",a),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),kt.current=null}}const o=(0,bo.zoom)().scaleExtent([t,n]).extent([[0,0],[Ye[0],Ye[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;jt.current=t,Lt.current=!0;const n=yt.current;n&&(n.applyZoomTransform(t,r),We.current=!1,at())}).on("end",e=>{jt.current=e.transform,Lt.current=!1;const t=yt.current;t?.scales?.projection&&S?.({projection:t.scales.projection,zoom:t.currentZoom})});return kt.current=o,(0,vo.select)(e).call(o),()=>{(0,vo.select)(e).on(".zoom",null)}},[k,j,pt,Ye,Xe,Qe,Ze,S,at]);const fn=G&&!1!==V,mn=fn&&$t?U?U($t):(0,si.jsx)(Uo,{data:$t}):null,yn=mn?(0,si.jsx)(go,{x:$t.x,y:$t.y,containerWidth:Xe,containerHeight:Qe,margin:Ze,className:"stream-frame-tooltip",zIndex:10,children:mn}):null;if(ur||!ct&&ut){const e=yt.current;e&&(dt||a||l)&&(dt&&e.setAreas(dt),a&&e.setPoints(ht),l&&e.setLines(ft),e.computeScene({width:Xe,height:Qe}));const t=e?.scene??[];return(0,si.jsxs)("div",{ref:Dt,className:"stream-geo-frame"+(E?" "+E:""),role:"img","aria-label":Ie||("string"==typeof ge?ge:"Geographic chart"),style:{position:"relative",width:z?"100%":Ye[0],height:O?"100%":Ye[1]},children:[(0,si.jsx)(Ur,{summary:De}),(0,si.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ye[0],height:Ye[1],style:{position:"absolute",left:0,top:0},children:[(0,si.jsx)("g",{transform:`translate(${Ze.left},${Ze.top})`,children:Je}),(0,si.jsxs)("g",{transform:`translate(${Ze.left},${Ze.top})`,children:[B&&(0,si.jsx)("rect",{x:0,y:0,width:Xe,height:Qe,fill:B}),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:r,fallback:o}=e,i=$o(r,t);if(!i)return o();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(qo(i.id,t.type??"unknown"),o())}({node:e,index:t,renderMode:W,fallback:()=>function(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=pn(n.style.fill)?bn(n.style.fill,`geoarea-${t}-hatch`):void 0;return(0,cr.jsxs)(lr.Fragment,{children:[r&&(0,cr.jsx)("defs",{children:r}),(0,cr.jsx)("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:ar(n.style.fill,"#e0e0e0"),fillOpacity:n.style.fillOpacity??1,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth||.5,strokeDasharray:n.style.strokeDasharray,opacity:n._decayOpacity??1})]},"geoarea-"+t)}case"point":{const n=e,r=pn(n.style.fill)?bn(n.style.fill,`geopoint-${t}-hatch`):void 0;return(0,cr.jsxs)(lr.Fragment,{children:[r&&(0,cr.jsx)("defs",{children:r}),(0,cr.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:ar(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},"point-"+t)}case"line":{const n=e;if(2>n.path.length)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return(0,cr.jsx)("path",{d:r,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity??1},"line-"+t)}case"glyph":return function(e,t,n,r){const o=e.glyph;if(!o?.parts?.length||0>=e.size)return null;const i=He(o,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=qe(o,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>o.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:_e(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:_e(n.stroke??"none",a,e.accent);return o||i?(0,sr.jsx)("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return(0,sr.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,sr.jsx)("clipPath",{id:c,children:(0,sr.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,sr.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,sr.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}(e,t)}))]})]}),(0,si.jsx)(er,{width:Xe,height:Qe,totalWidth:Ye[0],totalHeight:Ye[1],margin:Ze,showAxes:!1,title:ge,legend:be,legendPosition:ve,legendLayout:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:je,legendIsolatedCategories:Se,foregroundGraphics:No(Ke,_o(yt.current?.customLayoutOverlays,h??null)),annotations:ee,onAnnotationActivate:te,onObservation:K??Q,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,svgAnnotationRules:re,pointNodes:Go(t),geoProjection:yt.current?.scales?.projectedPoint})]})}return(0,si.jsxs)("div",{ref:Dt,className:"stream-geo-frame"+(E?" "+E:""),role:"group","aria-label":Ie||("string"==typeof ge?ge:"Geographic chart"),tabIndex:0,style:{position:"relative",width:z?"100%":Ye[0],height:O?"100%":Ye[1],overflow:Y?"visible":"hidden",...k?{touchAction:"none"}:{}},onKeyDown:un,children:["production"!==process.env.NODE_ENV&&yt.current&&(0,si.jsx)(Oe,{store:yt.current,diagnostics:_t.current}),Pe&&(0,si.jsx)(Yr,{tableId:rt}),Pe&&(0,si.jsx)(Vr,{scene:yt.current?.scene??[],chartType:"Geographic chart",tableId:rt,chartTitle:"string"==typeof ge?ge:void 0}),(0,si.jsx)(Ur,{summary:De}),(0,si.jsx)(Rr,{hoverPoint:$t}),(0,si.jsxs)("div",{role:"img","aria-label":Ie||("string"==typeof ge?ge:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:fn?dn:void 0,onPointerLeave:fn?rn:void 0,onPointerDown:fn||Ee?hn:void 0,onClick:Ee?an:void 0,children:[(0,si.jsx)(br,{size:Ye,margin:Ze,children:Je}),R&&(0,si.jsx)("canvas",{ref:bt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,si.jsx)("canvas",{ref:on,"aria-label":Tr(yt.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),(0,si.jsx)("canvas",{ref:sn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,si.jsx)(er,{width:Xe,height:Qe,totalWidth:Ye[0],totalHeight:Ye[1],margin:Ze,showAxes:Le,title:ge,legend:be,legendPosition:ve,legendLayout:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:je,legendIsolatedCategories:Se,foregroundGraphics:No(Ke,_o(yt.current?.customLayoutOverlays,h??null)),annotations:ee,onAnnotationActivate:te,onObservation:K??Q,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,svgAnnotationRules:re,pointNodes:Go(yt.current?.scene),geoProjection:yt.current?.scales?.projectedPoint}),le?.showBadge&&(0,si.jsx)(Pt,{isStale:Ut,position:le.badgePosition}),k&&(0,si.jsxs)("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Ze.bottom+8,left:Ze.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[(0,si.jsx)("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=It.current,n=kt.current;t&&n?.scaleBy&&n.scaleBy((0,vo.select)(t),1.5)},style:Ko,children:"+"}),(0,si.jsx)("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=It.current,n=kt.current;t&&n?.scaleBy&&n.scaleBy((0,vo.select)(t),1/1.5)},style:Ko,children:"−"})]}),L&&(0,si.jsx)("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Ze.bottom+2,right:Ze.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:L}),(0,si.jsx)(eo,{active:ln.current>=0,hoverPoint:$t,margin:Ze,size:Ye,shape:cn.current?.shape,width:cn.current?.w,height:cn.current?.h,pathData:cn.current?.pathData}),yn]})]})}));ai.displayName="StreamGeoFrame";var li=ai,ci=require("react");function ui(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}var di=require("react"),hi=require("react"),fi=(require("react/jsx-runtime"),(0,hi.createContext)(null));function pi(){return(0,hi.useContext)(fi)}var mi=require("react");function yi(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function gi(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function bi(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[vi,xi]=Je(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,r]of n){const n=t.fields[e];if(!n||!bi(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),s=gi(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=gi(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}})),wi=require("react"),ki=(require("react"),{positions:new Map}),ji=new Set;function Si(){for(const e of ji)e()}function Mi(e,t){const n=ki.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(ki.positions);r.delete(e),ki={positions:r},Si()}function Ci(e,t){const n=ki.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(ki.positions);r.delete(e),ki={positions:r},Si()}function Ai(e){const t=(0,wi.useId)(),n=e.clientId||t,{name:r}=e,o=xi(e=>e.selections.get(r)),i=xi(e=>e.setClause),s=xi(e=>e.clearClause),a=(0,wi.useMemo)(()=>!!o&&o.clauses.size>0,[o]);return{predicate:(0,wi.useMemo)(()=>o&&0!==o.clauses.size?function(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(yi(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(o,n):()=>!0,[o,n]),isActive:a,selectPoints:(0,wi.useCallback)(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:(0,wi.useCallback)(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:(0,wi.useCallback)(()=>{s(r,n)},[s,r,n]),clientId:n}}function Ri(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:s}=Ai({name:t,fields:n});return{onHover:(0,wi.useCallback)(e=>{if(!e)return void s();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(t)&&i(t)},[n,i,s]),predicate:r,isActive:o}}require("react/jsx-runtime");var Li=(0,mi.createContext)(!1);(0,mi.createContext)(!1);var Pi=(0,mi.createContext)(null),Ii="undefined"==typeof window?mi.useEffect:mi.useLayoutEffect;function Di(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}var Ti=.5;function zi(e,t,n){return t?(r,...o)=>{const i={...e(r,...o)};if(t.isActive)if(t.predicate(r))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??Ti;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var Oi=l(require("react"));function Ni(){return ct(e=>e.theme)}function Ei(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Bi(e,t){const{when:n}=e,r=t.width,o=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function Hi(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>Bi(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])Ei(e[r])&&Ei(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}require("react/jsx-runtime"),Oi.createContext(void 0);var Wi=44,_i={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Wi,snap:"nearestDatum",brushHandleSize:Wi,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Fi(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!o&&!i)return _i;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??r??Wi,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Wi,standardControls:a.standardControls??!1}}var $i={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}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}},qi={top:10,bottom:10,left:10,right:10};function Gi(e){return e.compactMode?e.marginDefaults:qi}function Vi(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function Ui(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function Yi(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?{...t,xValue:e.xValue}:t||{}}function Zi(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Xi=[];function Qi(){const e=Ni(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Ki({selection:e,linkedHover:t,fallbackFields:n=Xi,unwrapData:r=!1,onObservation:o,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,di.useId)(),h=(0,di.useMemo)(()=>Di(t,n),[t,n]),f=(0,di.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),p=Ai({name:e?.name||"__unused__",fields:f}),m=Ri({name:h?.name||"hover",fields:f}),y=Tt(e=>e.pushObservation),g=(0,di.useCallback)(e=>{o?.(e),y?.(e)},[o,y]),b=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,x]=(0,di.useState)(null),w=(0,di.useRef)(!1),k=c||n[0],j=(0,di.useMemo)(()=>{if(!l||null==v||!k)return null;const e=v,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,k]),S=(0,di.useCallback)((e,n)=>{const r=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=Ui(e,t,h.xField);null!=n&&function(e,t,n){const r=ki.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(ki={positions:new Map(ki.positions).set(e,{xValue:t,sourceId:n})},Si())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||r||Mi(h.name||"hover",d),"x-position"===h?.mode||r||m.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else r||x(null);(o||y)&&ti({onObservation:g,datum:e?Yi(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,m,h,d,o,i,s,y,g,l,k,u]),M=(0,di.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&x(null),"x-position"===h?.mode&&(Ci(h.name||"hover",d),Mi(h.name||"hover",d))},[t,h,m,e,u,p,l,d]),C=(0,di.useCallback)((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Ui(n,e,h.xField);null!=t&&function(e,t,n){const r=ki.positions.get(e);if(r?.locked){const t=new Map(ki.positions);return t.delete(e),ki={positions:t},Si(),!1}ki={positions:new Map(ki.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Si()}(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const r=Yi(n);if(t&&"x-position"!==h?.mode&&m.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}Zi(e)&&p.selectPoints(e)}if(l&&k){const e=r?.[k];x(null!=e?e+"":null)}}else b&&M();if(n||b){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(o||y)&&ni({onObservation:g,datum:n?Yi(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:r})}},[a,o,y,g,i,s,h,d,u,t,m,e,p,f,l,k,M]);return(0,di.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,di.useEffect)(()=>()=>{w.current&&M(!1)},[M]),(0,di.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Ci(e,d),Mi(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:j,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:d}}function Ji({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a,additionalLegend:l}){const c=(0,mi.useContext)(Li),u=null!==(0,mi.useContext)(Pi),d=void 0!==r?r:!c&&!!t,h=!!t&&(d||u),f=(0,di.useMemo)(()=>{if(!h)return[];if(void 0!==a)return a;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,h]);!function(e){const t=(0,mi.useContext)(Pi),n=(0,mi.useId)(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),o=(0,mi.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})(o.current,r)||(o.current=r);const i=o.current;Ii(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Ii(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(u&&t?f:[]);const p=(0,di.useMemo)(()=>{if(!d||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const s=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),a=s?r(s,t,n):n?n(o):W[i%W.length];return{label:o+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:F,categories:f});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[d,t,e,n,f]),m=(0,di.useMemo)(()=>function(...e){let t;for(const n of e)n&&(t=Xn(t)&&Xn(n)?{legendGroups:[...t.legendGroups,...n.legendGroups]}:n);return t}(p,l),[p,l]),y=(0,di.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return m&&("right"===o&&!r("right")&&110>n.right?n.right=110:"left"===o&&!r("left")&&110>n.left?n.left=110:"top"===o&&!r("top")&&50>n.top?n.top=50:"bottom"===o&&!r("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,m,o]);return{legend:m,margin:y,legendPosition:o}}function es(e,t,n){return function(e,t,n){const r=$i[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,s=Hi({...t,mode:e},{width:t.width??o,height:t.height??i}).props,a=s.mode||e||"primary",l=$i[a],c="context"===a||"sparkline"===a,u="primary"===a&&n?.width?n.width:l.width;return{mode:a,width:s.width??u,height:s.height??("primary"===a&&n?.height?n.height:l.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Vi(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Fi(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}(e,t,n)}function ts(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return 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)=>({...e(...t)||{},...n}):(...e)=>({...n})}function ns(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>os(t(e))}function rs(e,t){const n=ns(t??"value"),r=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=r?r(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function os(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function is(e,t,n){const r=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&r!==e.eq)return!1;if(void 0!==e.ne&&r===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(r))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const o=os(r);if(void 0===o)return!1;if(void 0!==e.gt&&e.gt>=o)return!1;if(void 0!==e.gte&&e.gte>o)return!1;if(void 0!==e.lt&&o>=e.lt)return!1;if(void 0!==e.lte&&o>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>o||o>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(o>=t&&n>=o)return!1}return!0}function ss(e,t,n){const r=e.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(t,n):is(r,t,n))}function as(e,t,n){if(!t||0===t.length)return{};let r={};for(const o of t){if(!ss(o,e,n))continue;const t="function"==typeof o.style?o.style(e,n):o.style;t&&(r={...r,...t})}return r}function ls(e,t,n,r=e=>e){const o=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=r(e),a={...o(e,i)};return Object.assign(a,as(s,t,n(s,i))),a}:o}var cs=require("react/jsx-runtime");function us({componentName:e,message:t,diagnosticHint:n,width:r,height:o}){return(0,cs.jsx)("div",{role:"alert",style:{width:r,height:Math.max(o,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:(0,cs.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,cs.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,cs.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,cs.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:n})]})})}var ds=l(require("react")),hs=require("react/jsx-runtime"),fs=class extends ds.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,hs.jsx)(us,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},ps=require("react/jsx-runtime"),ms="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function ys({componentName:e,width:t,height:n,children:r}){return(0,ps.jsx)(fs,{fallback:r=>(0,ps.jsx)(us,{componentName:e,message:r.message,width:t,height:n}),children:r})}var gs={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"},bs={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function vs(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,ps.jsx)("div",{style:{...gs,width:t,height:n},children:r||"No data available"}):null}function xs(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return(0,ps.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),s=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(i+s)-s))/2);return(0,ps.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(e,n)=>(0,ps.jsx)("div",{className:"semiotic-loading-bar",style:{...bs,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function ws(e,t,n,r){if(!ms)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const o=t[0];if(!o||"object"!=typeof o)return;if(r in o)return;const i=Object.keys(o).join(", ");console.warn(`[semiotic] ${e}: ${n} "${r}" not found in data. Available keys: ${i}`)}var ks=require("react");function js(e){const t=ct(e=>e.theme.colors.selectionOpacity);return(0,ks.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}var Ss=require("d3-scale"),Ms=require("react"),Cs=require("topojson-client"),As=new Map;function Rs(e){return"default"in e?e.default:e}var Ls="Install the optional peer dependency `world-atlas` (`npm install world-atlas`) to use built-in reference geographies, or pass GeoJSON Feature[] to `areas`.";async function Ps(e){const t=As.get(e);if(t)return t;const{topology:n,objectName:r}=await async function(e){try{switch(e){case"world-110m":return{topology:Rs(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Rs(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Rs(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Rs(await import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): ${Ls}`,{cause:t});throw t}}(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 o=(0,Cs.feature)(n,n.objects[r]),i="features"in o?o.features:[o];return As.set(e,i),i}function Is(e){const t=(0,Ms.useMemo)(()=>Array.isArray(e)?e:void 0,[e]),[n,r]=(0,Ms.useState)(null);return(0,Ms.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 r(null),Ps(e).then(e=>{t||r(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".`),r(null)}else r(null)},[e]),void 0!==t?t:n}function Ds(e){const{title:t,description:n,summary:r,accessibleTable:o,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),r&&(c.summary=r),void 0!==o&&(c.accessibleTable=o),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Ts(e){const{linkedHover:t,selection:n,onObservation:r,onClick:o,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};r&&(f.annotationObservationCallback=r);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||r||o||s)&&(f.customHoverBehavior=u),d&&(l||(h?r||o||t:r||o)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=d),null!=p&&(f.hoverRadius=p),f}var zs=require("react/jsx-runtime");function Os(e){const t=es(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=function(){const e=Ni();return e?.colors?.sequential||void 0}(),{areas:r,valueAccessor:o,styleRules:i,colorScheme:s,projection:a="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:h,dragRotate:f,tileURL:p,tileAttribution:m,tileCacheSize:y,tooltip:g,areaOpacity:b=1,annotations:v,margin:x,className:w,selection:k,linkedHover:j,onObservation:S,onClick:M,chartId:C,loading:A,loadingContent:R,emptyContent:L,frameProps:P={},stroke:I,strokeWidth:D,opacity:T}=e,z=u??!!p,O=Is(r),E=(0,ci.useMemo)(()=>O?Qr(O):O,[O]),B=(0,ci.useMemo)(()=>"function"==typeof o?o:e=>e?.properties?.[o]??e?.[o],[o]),H=s??n??"blues",W=(0,ci.useMemo)(()=>{if(!E)return(0,Ss.scaleSequential)(N(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of E){const r=B(n);null!=r&&isFinite(r)&&(e>r&&(e=r),r>t&&(t=r))}const n=N(H);return(0,Ss.scaleSequential)(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[E,B,H]),{activeSelectionHook:_,customHoverBehavior:F,customClickBehavior:$}=Ki({selection:k,linkedHover:j,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:C,mobileInteraction:t.mobileInteraction}),q=js(k),G=(0,ci.useMemo)(()=>{const e=ts(ls(e=>{const t=B(e);return{fill:null!=t&&isFinite(t)?W(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:b}},i,e=>({value:B(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),{stroke:I,strokeWidth:D,opacity:T});return _?zi(e,_,q):e},[B,W,_,q,b,I,D,T,i]),V=(0,ci.useMemo)(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=B(e);return(0,zs.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,zs.jsx)("div",{style:{fontWeight:600},children:t}),null!=n&&(0,zs.jsx)("div",{style:{opacity:.7},children:(r=n,"number"==typeof r&&isFinite(r)?Number.isInteger(r)?r.toLocaleString():r.toLocaleString(void 0,{maximumFractionDigits:2}):(r??"")+"")})]});var r},[B]),U=Gi(t),Y=(0,ci.useMemo)(()=>({...U,...ui(x)}),[U,x]),Z=xs(A,t.width,t.height,R)||(E?null:xs(!0,t.width,t.height,R)),X=Z?null:vs(E,t.width,t.height,L);if(Array.isArray(E)&&E.length>0){const e=E[0];if(!e||"object"!=typeof e||!e.geometry)return(0,zs.jsx)(us,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const Q={projection:a,areas:E,areaStyle:G,size:[t.width,t.height],margin:Y,enableHover:t.enableHover,tooltipContent:!1===g?()=>null:!0===g?V:mo(g)||V,...null!=l&&{graticule:l},...null!=c&&{fitPadding:c},...z&&{zoomable:!0},...d&&{zoomExtent:d},...h&&{onZoom:h},...null!=f&&{dragRotate:f},...p&&{tileURL:p},...m&&{tileAttribution:m},...y&&{tileCacheSize:y},...Ts({linkedHover:j,selection:k,onObservation:S,onClick:M,mobileInteraction:t.mobileInteraction,customHoverBehavior:F,customClickBehavior:$,linkedHoverInClickPredicate:!1}),...v&&v.length>0&&{annotations:v},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...t.title&&{title:t.title},...t.description&&{description:t.description},...t.summary&&{summary:t.summary},...void 0!==t.accessibleTable&&{accessibleTable:t.accessibleTable},...w&&{className:w},...null!=e.animate&&{animate:e.animate},...P};return Z||X||(0,zs.jsx)(ys,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:(0,zs.jsx)(li,{...Q})})}Os.displayName="ChoroplethMap";var Ns=require("react"),Es=require("react");function Bs(e){const{data:t,rawData:n,colorBy:r,colorScheme:o,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:p,legend:m,userMargin:y,marginDefaults:g,onClick:b,hoverHighlight:v,mobileInteraction:x,mobileSemantics:w,loading:k,loadingContent:j,emptyContent:S,width:M,height:C}=e,A=void 0===n,R=(0,Es.useMemo)(()=>Qr(t),[t]),[L,P]=(0,Es.useState)([]),I=(0,Es.useCallback)(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),D="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,Es.useMemo)(()=>Fi(x,{width:M,mobileSemantics:w}),[x,M,w]),{activeSelectionHook:z,hoverSelectionHook:O,customHoverBehavior:N,customClickBehavior:E,crosshairSourceId:B}=Ki({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:b,hoverHighlight:v,colorByField:D,mobileInteraction:T}),H=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,B),_=function(e,t,n){const r=pi(),o=Qi();return(0,di.useMemo)(()=>{if(!t)return;const i=r??void 0,s=n??(o&&o.length>0?o:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&Zi(i)){const e=q(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return q(n.map(e=>({_cat:e})),"_cat",s)}if(i&&Zi(i)){const n=q(e,t,s);return e=>i[e]||n(e)}return q(e,t,s)}if(i&&Zi(i)){const e=q([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,r,o])}(R,r,o),F=(0,Es.useMemo)(()=>{if(!r)return[];const e=new Set;for(const t of R){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[R,r]),$=(0,Es.useMemo)(()=>A&&L.length>0?L:F,[A,L,F]),G=function(e,t,n){const[r,o]=(0,di.useState)(null),[i,s]=(0,di.useState)(new Set),a=(0,di.useMemo)(()=>new Set,[]),l=(0,di.useCallback)(t=>{"highlight"===e&&o(t?t.label:null)},[e]),c=(0,di.useCallback)(t=>{"isolate"===e&&s(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),u=(0,di.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=n?e[n]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,r,$),V=(0,Es.useMemo)(()=>O||(G.legendSelectionHook?G.legendSelectionHook:z),[O,G.legendSelectionHook,z]),U=js(a),Y=Qi(),Z=pi(),X=(0,Es.useMemo)(()=>{if(_)return _;if(!r||0===$.length)return;const e=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:Y&&Y.length>0?Y:W,t="__streamCat",n=q($.map(e=>({[t]:e})),t,e);return e=>Z?.[e]||n(e)||"#999"},[_,r,$,o,Y,Z]),{legend:Q,margin:K,legendPosition:J}=Ji({data:R,colorBy:r,colorScale:X,showLegend:p,legendPosition:s,userMargin:y,defaults:g,categories:$,additionalLegend:m}),ee=(0,Es.useMemo)(()=>{const e={};return Q&&(e.legend=Q,e.legendPosition=J),i&&"none"!==i&&(e.legendHoverBehavior=G.onLegendHover,e.legendClickBehavior=G.onLegendClick,e.legendHighlightedCategory=G.highlightedCategory,e.legendIsolatedCategories=G.isolatedCategories),A&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=I),e},[Q,J,i,G.onLegendHover,G.onLegendClick,G.highlightedCategory,G.isolatedCategories,A,r,I]),te=Array.isArray(n)?Qr(n):n,ne=xs(k,M,C,j),re=ne?null:vs(te,M,C,S);return{data:R,colorScale:_,allCategories:$,legendState:G,effectiveSelectionHook:V,activeSelectionHook:z,customHoverBehavior:N,customClickBehavior:E,mobileInteraction:T,legend:Q,margin:K,legendPosition:J,earlyReturn:ne||re||null,legendBehaviorProps:ee,crosshairProps:H,resolvedSelection:U}}var Hs=require("react");function Ws(e,t){const{variant:n,frameRef:r,overrides:o}=t,i=(0,Hs.useRef)(o);i.current=o,(0,Hs.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],r=e.current?.getTopology()?.nodes??[],o=[];for(const t of n){const n=r.find(e=>e.id===t);n&&o.push({...n.data??{},id:t}),e.current?.removeNode(t)}return o},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const r=e.current?.updateNode(t,n);return r?[{...r,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const r=e.current?.removePoint(t)??[];for(const t of r)e.current?.push(n(t));return r},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const r=n.current?.removeLine(e)??[];for(const e of r)n.current?.pushLine(t(e));return r},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,r);return new Proxy(e,{get(e,t,n){if("string"==typeof t){const e=i.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,n)},has:(e,t)=>!("string"!=typeof t||!i.current||!(t in i.current))||Reflect.has(e,t)})},[])}var _s={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},Fs=require("react/jsx-runtime"),$s=[3,30],qs=[1,4],Gs=(0,Ns.forwardRef)(function(e,t){const n=(0,Ns.useRef)(null);Ws(t,{variant:"geo-points",frameRef:n});const r=es(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:o,xAccessor:i="lon",yAccessor:s="lat",sizeBy:a,sizeRange:l,colorBy:c,styleRules:u,colorScheme:d,projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,areas:k,areaStyle:j=_s,tooltip:S,annotations:M,margin:C,className:A,selection:R,linkedHover:L,onObservation:P,onClick:I,chartId:D,loading:T,loadingContent:z,emptyContent:O,legendInteraction:N,legendPosition:E,frameProps:B={},stroke:W,strokeWidth:_,opacity:$}=e,q=l??("sparkline"===r.mode?qs:$s),V="sparkline"===r.mode?1.5:6,U=m??!!v,Y=Is(k),Z=Bs({data:o??Xr,rawData:o,colorBy:c,colorScheme:d,legendInteraction:N,legendPosition:E,selection:R,linkedHover:L,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:P,onClick:I,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:D,showLegend:r.showLegend,userMargin:C,marginDefaults:Gi(r),loading:T,loadingContent:z,emptyContent:O,width:r.width,height:r.height}),X=Z.data,Q=(0,Ns.useMemo)(()=>{if(!a)return;const e="function"==typeof a?a:e=>e?.[a],t=X.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?ie(t):void 0},[X,a]),K=(0,Ns.useMemo)(()=>{const e=ts(ls(e=>({fill:c?F(e,c,Z.colorScale):H,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:a?G(e,a,q,Q):V}),u,rs(c,a)),{stroke:W,strokeWidth:_,opacity:$});return Z.effectiveSelectionHook?zi(e,Z.effectiveSelectionHook,Z.resolvedSelection):e},[c,Z.colorScale,Z.effectiveSelectionHook,Z.resolvedSelection,a,q,Q,V,W,_,$,u]),J=(0,Ns.useMemo)(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof a?a:null,r=("function"==typeof a?a:e=>e[a])(e),o=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",i="string"==typeof c?c:null,s=i?e?.[i]:null;return(0,Fs.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&(0,Fs.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=r&&(0,Fs.jsxs)("div",{children:[(0,Fs.jsxs)("span",{style:{opacity:.7},children:[n,": "]}),o(r)]}),i&&null!=s&&(0,Fs.jsxs)("div",{children:[(0,Fs.jsxs)("span",{style:{opacity:.7},children:[i,": "]}),s+""]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>(0,Fs.jsxs)("div",{children:[(0,Fs.jsxs)("span",{style:{opacity:.7},children:[e,": "]}),o(t)]},e))]})},[a,c]);if(Z.earlyReturn)return Z.earlyReturn;ws("ProportionalSymbolMap",X,"xAccessor",i),ws("ProportionalSymbolMap",X,"yAccessor",s);const ee={projection:h,...null!=o&&{points:X},xAccessor:i,yAccessor:s,pointStyle:K,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Y&&{areas:Y,areaStyle:j},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...U&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[r.width,r.height],margin:Z.margin,enableHover:r.enableHover,tooltipContent:!1===S?()=>null:mo(S)||J,...Z.legendBehaviorProps,...Ts({linkedHover:L,selection:R,onObservation:P,onClick:I,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior,linkedHoverInClickPredicate:!1}),...M&&M.length>0&&{annotations:M},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...r.title&&{title:r.title},...r.description&&{description:r.description},...r.summary&&{summary:r.summary},...void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable},...A&&{className:A},...null!=e.animate&&{animate:e.animate},...B};return(0,Fs.jsx)(ys,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:(0,Fs.jsx)(li,{ref:n,...ee})})});Gs.displayName="ProportionalSymbolMap";var Vs=require("react"),Us=require("d3-scale"),Ys=require("react/jsx-runtime"),Zs="__semiotic_x",Xs="__semiotic_y",Qs=(0,Vs.forwardRef)(function(e,t){const n=es(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:r,nodes:o,nodeIdAccessor:i="id",xAccessor:s="lon",yAccessor:a="lat",valueAccessor:l="value",projection:c="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:f,onZoom:p,dragRotate:m,tileURL:y,tileAttribution:g,tileCacheSize:b,lineType:v="geo",flowStyle:x="basic",areas:w,areaStyle:k=_s,edgeColorBy:j,edgeOpacity:S=.6,edgeWidthRange:M=[1,8],pointRadius:C,edgeLinecap:A="round",colorScheme:R,showParticles:L,particleStyle:P,tooltip:I,annotations:D,margin:T,className:z,selection:O,linkedHover:N,onObservation:E,onClick:B,chartId:W,loading:_,loadingContent:$,emptyContent:q,frameProps:G={},legendInteraction:V,legendPosition:U,stroke:Y,strokeWidth:Z,opacity:X,lineIdAccessor:Q}=e,K=h??!!y,J=Is(w),ee=(0,Vs.useMemo)(()=>Qr(o),[o]),te=Bs({data:r??Xr,rawData:r,colorBy:j,colorScheme:R,legendInteraction:V,legendPosition:U,selection:O,linkedHover:N,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:E,onClick:B,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:W,showLegend:n.showLegend,userMargin:T,marginDefaults:Gi(n),loading:_,loadingContent:$,emptyContent:q,width:n.width,height:n.height}),ne=te.data,re=Di(N),oe=Ri({name:re?.name||"hover",fields:re?.fields||[]}),se=Tt(e=>e.pushObservation),ae=(0,Vs.useMemo)(()=>{const e=new Map;for(const t of ee)e.set(t[i]+"",t);return e},[ee,i]),le=(0,Vs.useRef)(null),ce=(0,Vs.useRef)(ae);ce.current=ae;const ue=(0,Vs.useRef)(s);ue.current=s;const de=(0,Vs.useRef)(a);de.current=a;const he=(0,Vs.useCallback)(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ce.current,n=t.get(e.source+""),r=t.get(e.target+"");if(!n||!r)return null;const o="function"==typeof ue.current?ue.current:e=>e[ue.current],i="function"==typeof de.current?de.current:e=>e[de.current];return{...e,coordinates:[{[Zs]:o(n),[Xs]:i(n)},{[Zs]:o(r),[Xs]:i(r)}]}},[]);Ws(t,{variant:"geo-lines",frameRef:le,overrides:{push:e=>{const t=he(e);t&&le.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=he(n);e&&t.push(e)}t.length>0&&le.current?.pushManyLines(t)}}});const fe=(0,Vs.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]),pe=(0,Vs.useCallback)(e=>{if(N)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=fe.get(t[i]+"");e&&oe.onHover(e)}else oe.onHover(t)}else oe.onHover(null);if(E||se){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:W};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const r={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};E&&E(r),se&&se(r)}else{const e={...t,type:"hover-end"};E&&E(e),se&&se(e)}}},[N,oe,i,fe,E,W,se]),me=te.customClickBehavior,ye=(0,Vs.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof a?a:e=>e[a];return ne.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const r=ae.get(n.source+""),o=ae.get(n.target+"");return r&&o?{...n,coordinates:[{[Zs]:e(r),[Xs]:t(r)},{[Zs]:e(o),[Xs]:t(o)}]}:null}).filter(Boolean)},[ne,ae,s,a]),ge=(0,Vs.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&Zs in t?t[Zs]:e(t)},[s]),be=(0,Vs.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&Xs in t?t[Xs]:e(t)},[a]),ve=(0,Vs.useMemo)(()=>{const e=ne.filter(e=>e&&"object"==typeof e).map(e=>e[l]??0).filter(e=>isFinite(e));return 0===e.length?()=>M[0]:(0,Us.scaleLinear)().domain(ie(e)).range(M)},[ne,l,M]),xe=(0,Vs.useMemo)(()=>e=>({stroke:j?F(e,j,te.colorScale):H,strokeWidth:ve(e[l]??0),strokeLinecap:A,opacity:S}),[j,te.colorScale,ve,l,S,A]),we=(0,Vs.useMemo)(()=>{const e=ts(xe,{stroke:Y,strokeWidth:Z,opacity:X});if(!te.effectiveSelectionHook)return e;const t={...te.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return zi(e,te.effectiveSelectionHook,{...te.resolvedSelection||{},unselectedStyle:t})},[xe,te.effectiveSelectionHook,te.resolvedSelection,Y,Z,X]),ke=C??("sparkline"===n.mode?1.5:5),je=(0,Vs.useMemo)(()=>ts(()=>({fill:"#333",r:ke,fillOpacity:.8}),{stroke:Y,strokeWidth:Z,opacity:X}),[ke,Y,Z,X]),Se=(0,Vs.useMemo)(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return(0,Ys.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Ys.jsx)("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];return(0,Ys.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Ys.jsxs)("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&(0,Ys.jsx)("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[i];return null!=t?(0,Ys.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Ys.jsx)("div",{style:{fontWeight:600},children:t})}):null},[l,i]);if(te.earlyReturn)return te.earlyReturn;const Me={projection:c,...null!=r&&{lines:ye},points:ee,xAccessor:ge,yAccessor:be,lineDataAccessor:"coordinates",...null!=Q&&{lineIdAccessor:Q},lineType:v,flowStyle:x,lineStyle:we,pointStyle:je,...J&&{areas:J,areaStyle:k},...null!=u&&{graticule:u},...null!=d&&{fitPadding:d},...K&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...L&&{showParticles:L},...P&&{particleStyle:P},...y&&{tileURL:y},...g&&{tileAttribution:g},...b&&{tileCacheSize:b},size:[n.width,n.height],margin:te.margin,enableHover:n.enableHover,tooltipContent:!1===I?()=>null:mo(I)||Se,...te.legendBehaviorProps,...Ts({linkedHover:N,selection:O,onObservation:E,onClick:B,mobileInteraction:te.mobileInteraction,customHoverBehavior:pe,customClickBehavior:me,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...z&&{className:z},...null!=e.animate&&{animate:e.animate},...G};return(0,Ys.jsx)(ys,{componentName:"FlowMap",width:n.width,height:n.height,children:(0,Ys.jsx)(li,{ref:le,...Me})})});Qs.displayName="FlowMap";var Ks=require("react"),Js=require("react/jsx-runtime"),ea=(0,Ks.forwardRef)(function(e,t){const n=es(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:r,lines:o,xAccessor:i="lon",yAccessor:s="lat",nodeIdAccessor:a="id",center:l,costAccessor:c,strength:u=1,lineMode:d="straight",projection:h="mercator",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,transition:k,colorBy:j,styleRules:S,colorScheme:M,pointRadius:C,tooltip:A,showRings:R,showRingLabels:L,ringStyle:P,showNorth:I,costLabel:D,cartogramLayout:T,annotations:z,margin:O,className:N,selection:E,linkedHover:B,onObservation:W,onClick:_,chartId:$,loading:q,loadingContent:G,emptyContent:V,legendPosition:U,frameProps:Y={},stroke:Z,strokeWidth:X,opacity:Q}=e,K="sparkline"===n.mode,J=T??(K?"strip":"radial"),ee=C??(K?1.5:5),te=R??!0,ne=L??("strip"!==J&&!n.compactMode),re=I??("strip"!==J&&!K),oe=m??!!v,ie=(0,Ks.useMemo)(()=>Qr(r),[r]),se=Bs({data:ie,rawData:r,colorBy:j,colorScheme:M,legendInteraction:void 0,legendPosition:U,selection:E,linkedHover:B,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:W,onClick:_,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:$,showLegend:n.showLegend,userMargin:O,marginDefaults:Gi(n),loading:q,loadingContent:G,emptyContent:V,width:n.width,height:n.height}),ae=(0,Ks.useMemo)(()=>{const e=ts(ls(e=>{const t=e?.[a],n=null!=t&&t+""==l+"";return{fill:j?F(e,j,se.colorScale):H,fillOpacity:n?1:.8,stroke:n?"var(--semiotic-text, #222)":"#fff",strokeWidth:n?1.25:1,r:n?1.35*ee:ee}},S,rs(j)),{stroke:Z,strokeWidth:X,opacity:Q});return se.effectiveSelectionHook?zi(e,se.effectiveSelectionHook,se.resolvedSelection):e},[j,se.colorScale,se.effectiveSelectionHook,se.resolvedSelection,ee,Z,X,Q,S,l,a]),le=(0,Ks.useMemo)(()=>({center:l,centerAccessor:a,costAccessor:c,strength:u,lineMode:d,layout:J}),[l,a,c,u,d,J]),ce=(0,Ks.useMemo)(()=>{if(!o)return;const e="function"==typeof i?i:e=>e[i],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of ie)n.set(e[a]+"",e);return o.map(r=>{if(r.coordinates)return r;const o=n.get(r.source+""),a=n.get(r.target+"");return o&&a?{...r,coordinates:[{[i]:e(o),[s]:t(o)},{[i]:e(a),[s]:t(a)}]}:null}).filter(Boolean)},[o,ie,i,s,a]),ue=(0,Ks.useMemo)(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e);return(0,Js.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Js.jsx)("div",{style:{fontWeight:600},children:e[a]||e.name||e.id||"Point"}),null!=t&&(0,Js.jsxs)("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,a]),de=(0,Ks.useRef)(null);Ws(t,{variant:"geo-points",frameRef:de});const[he,fe]=(0,Ks.useState)(null),pe=(0,Ks.useCallback)(()=>{const e=de.current?.getCartogramLayout?.();e&&fe(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius&&t.layout===(e.layout??"radial")?t:{cx:e.cx,cy:e.cy,maxCost:e.maxCost,availableRadius:e.availableRadius,layout:e.layout??"radial"})},[]);(0,Ks.useEffect)(()=>{const e=requestAnimationFrame(pe);return()=>cancelAnimationFrame(e)},[pe,u,l,n.width,n.height,ie,J]);const me=(0,Ks.useMemo)(()=>{if(!te||!he)return[];const{maxCost:e}=he;if(0>=e)return[];if(Array.isArray(te))return te.filter(t=>t>0&&e>=t);const t="number"==typeof te?te:Math.min("strip"===he.layout?3:5,Math.max(2,Math.ceil(e/5))),n=e/t,r=[];for(let e=1;t>=e;e++)r.push(Math.round(n*e*10)/10);return r},[te,he]),ye=(0,Ks.useMemo)(()=>{if(!he)return Y.foregroundGraphics||null;const{cx:e,cy:t,maxCost:n,availableRadius:r,layout:o}=he,i="strip"===o,s={stroke:i?"var(--semiotic-border, #999)":"#999",strokeWidth:i?1:.8,strokeDasharray:i?"none":"4,3",labelColor:"var(--semiotic-text-secondary, #777)",labelSize:i?8:10,...P},a=se.margin.left??10,l=se.margin.top??10,c=e+a,u=t+l;return(0,Js.jsxs)("g",{children:[(0,Js.jsxs)(Js.Fragment,i?{children:[(0,Js.jsx)("line",{x1:c,y1:u,x2:c+r,y2:u,stroke:s.stroke,strokeWidth:s.strokeWidth,strokeLinecap:"round",opacity:.85}),(0,Js.jsx)("line",{x1:c,y1:u-3.5,x2:c,y2:u+3.5,stroke:s.stroke,strokeWidth:s.strokeWidth,opacity:.9}),te&&me.map(e=>{const t=c+(n>0?e/n*r:0);return(0,Js.jsxs)("g",{children:[(0,Js.jsx)("line",{x1:t,y1:u-2.5,x2:t,y2:u+2.5,stroke:s.stroke,strokeWidth:.9,opacity:.65}),ne&&(0,Js.jsxs)("text",{x:t,y:u+Math.min(10,(se.margin.bottom??2)+8),textAnchor:"middle",fontSize:s.labelSize,fill:s.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[e,D?" "+D:""]})]},e)})]}:{children:[me.map(e=>{const t=e/n*r;return(0,Js.jsxs)("g",{children:[(0,Js.jsx)("circle",{cx:c,cy:u,r:t,fill:"none",stroke:s.stroke,strokeWidth:s.strokeWidth,strokeDasharray:s.strokeDasharray,opacity:.5}),ne&&(0,Js.jsxs)("text",{x:c+t+3,y:u-2,fontSize:s.labelSize,fill:s.labelColor,fontFamily:"system-ui, sans-serif",children:[e,D?" "+D:""]})]},e)}),re&&(0,Js.jsxs)("g",{transform:`translate(${a+24}, ${l+24})`,children:[(0,Js.jsx)("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),(0,Js.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"}),(0,Js.jsx)("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),(0,Js.jsx)("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Js.jsx)("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Js.jsx)("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]}),Y.foregroundGraphics]})},[he,me,te,ne,re,D,P,se.margin,Y.foregroundGraphics]);if(se.earlyReturn)return se.earlyReturn;ws("DistanceCartogram",ie,"xAccessor",i),ws("DistanceCartogram",ie,"yAccessor",s);const ge={projection:h,...null!=r&&{points:ie},...ce&&{lines:ce,lineDataAccessor:"coordinates"},xAccessor:i,yAccessor:s,pointIdAccessor:a,pointStyle:ae,projectionTransform:le,...k&&{transition:{duration:k}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...oe&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[n.width,n.height],margin:se.margin,enableHover:n.enableHover,tooltipContent:!1===A?()=>null:mo(A)||ue,...se.legendBehaviorProps,...Ts({linkedHover:B,selection:E,onObservation:W,onClick:_,mobileInteraction:se.mobileInteraction,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior,linkedHoverInClickPredicate:!1}),...z&&z.length>0&&{annotations:z},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...N&&{className:N},...null!=e.animate&&{animate:e.animate},...Y,foregroundGraphics:ye};return(0,Js.jsx)(ys,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:(0,Js.jsx)(li,{ref:de,...ge})})});ea.displayName="DistanceCartogram";var ta=require("react"),na=require("react");var ra=require("react/jsx-runtime"),oa=(0,ta.forwardRef)(function(e,t){const{points:n,areas:r,lines:o,layout:i,layoutConfig:s,onLayoutError:a,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:d,colorBy:h,colorScheme:f,tooltip:p,annotations:m,margin:y,selection:g,linkedHover:b,onObservation:v,onClick:x,chartId:w,loading:k,loadingContent:j,emptyContent:S,className:M,frameProps:C={}}=e,{frameRef:A,resolved:R,normalizedMargin:L}=function(e){const t=(0,na.useRef)(null);return Ws(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:es(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,na.useMemo)(()=>ui(e.margin),[e.margin])}}({imperativeRef:t,imperativeVariant:"geo-points",margin:y,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),P=(0,ta.useMemo)(()=>Qr(n),[n]),I=(0,ta.useMemo)(()=>Qr(r),[r]),D=(0,ta.useMemo)(()=>Qr(o),[o]),T=(0,ta.useMemo)(()=>[...P,...D,...I],[P,D,I]),z=Bs({data:T,rawData:void 0!==n||void 0!==o||void 0!==r?T:void 0,colorBy:h,colorScheme:f,legendInteraction:void 0,selection:g,linkedHover:b,fallbackFields:"string"==typeof h?[h]:[],unwrapData:!1,onObservation:v,onClick:x,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"GeoCustomChart",chartId:w,showLegend:!1,userMargin:L,marginDefaults:R.marginDefaults,loading:k,loadingContent:j,emptyContent:S,width:R.width,height:R.height}),O=z.effectiveSelectionHook,N=(0,ta.useMemo)(()=>O?.isActive?{isActive:!0,predicate:O.predicate}:null,[O?.isActive,O?.predicate]);if(z.earlyReturn)return z.earlyReturn;const{width:E,height:B,enableHover:H,title:W,description:_,summary:F,accessibleTable:$}=R,q=mo(p),G={projection:l,...null!=n&&{points:P},...null!=r&&{areas:I},...null!=o&&{lines:D},xAccessor:c,yAccessor:u,...null!=d&&{lineDataAccessor:d},customLayout:i,layoutConfig:s,onLayoutError:a,layoutSelection:N,colorBy:h,colorScheme:f,size:[E,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:z.margin,enableHover:H,...Ds({title:W,description:_,summary:F,accessibleTable:$,className:M,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:q?{tooltipContent:q}:{},...Ts({linkedHover:b,selection:g,onObservation:v,onClick:x,hoverHighlight:!1,mobileInteraction:z.mobileInteraction,customHoverBehavior:z.customHoverBehavior,customClickBehavior:z.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...C};return(0,ra.jsx)(ys,{componentName:"GeoCustomChart",width:E,height:B,children:(0,ra.jsx)(li,{ref:A,...G})})});oa.displayName="GeoCustomChart";var ia={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},sa=8;function aa(e){const t=function(e){return null==e?void 0:e+""}(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??sa,style:{...ia},datum:e.datum,pointId:t,_transitionKey:t}}function la(e){return aa(e)}function ca(e){const[[t,n],[r,o]]=e.bounds;return{type:"geoarea",pathData:e.pathData,centroid:e.centroid,bounds:e.bounds,screenArea:e.screenArea??Math.abs((r-t)*(o-n)),style:{...ia},datum:e.datum,group:e.group,interactive:!0}}function ua(e,t,n){const{featureKey:r,dataKey:o}=n,i=new Map;for(const e of t)i.set(e[o]+"",e);return e.map(e=>{const t=(e=>{const t=r.split(".");let n=e;for(const e of t)n=null!==n&&"object"==typeof n?n[e]:void 0;return(n??"")+""})(e),n=i.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}
2
+ var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,i,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of o(t))s.call(e,l)||l===i||n(e,l,{get:()=>t[l],enumerable:!(a=r(t,l))||a.enumerable});return e},l=(e,r,o)=>(o=null!=e?t(i(e)):{},a(!r&&e&&e.__esModule?o:n(o,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(c,{ChoroplethMap:()=>Gs,DEFAULT_HIT_RADIUS:()=>ya,DistanceCartogram:()=>ua,FlowMap:()=>aa,GeoCustomChart:()=>pa,ProportionalSymbolMap:()=>ta,StreamGeoFrame:()=>gi,composeStyleRules:()=>bs,geoAreaHitTarget:()=>va,geoHitTarget:()=>ba,glyphExtent:()=>We,glyphPlacement:()=>He,hatchFillId:()=>yn,hatchPatternDef:()=>bn,hitTargetPoint:()=>ga,isHatchFill:()=>pn,makeNodeRuleContext:()=>fs,makeRuleValueResolver:()=>hs,matchesThreshold:()=>ms,mergeData:()=>xa,resolveReferenceGeography:()=>Ws,resolveResponsiveRules:()=>qi,resolveStyleRules:()=>gs,resolveSvgFill:()=>vn,responsiveRuleMatches:()=>$i,ruleMatches:()=>ys}),module.exports=(e=c,a(n({},"__esModule",{value:!0}),e));var u=require("react"),d=require("d3-geo"),h=require("d3-quadtree"),f=class{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();let n=0,r=[];t.length>e&&(n=t.length-e,r=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return r}update(e,t){const n=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++){const i=(r+o)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(r=>{e(r)?n.push(r):t.push(r)}),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 p(e,t,n){return e+(t-e)*n}function m(e,t,n){if(1>=n)return 1;const r=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function y(e,t,n){const r=e.duration??500,o=n-t;return r>o?1-o/r:0}function g(e,t,n,r){let o=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,o=!0),e._pulseColor!==n&&(e._pulseColor=n,o=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,o=!0),o):(0!==e._pulseIntensity&&(e._pulseIntensity=0,o=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,o=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,o=!0),o)}var b=require("d3-scale");function v(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function x(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function w(e){const t=e.map(v),n=t.length-1;return e=>{if(0>=e){const[e,n,r]=t[0];return x(e,n,r)}if(e>=1){const[e,r,o]=t[n];return x(e,r,o)}const r=e*n,o=Math.floor(r),i=r-o,[s,a,l]=t[o],[c,u,d]=t[o+1];return x(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var k=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],j=w(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),S=w(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),M=w(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),C=w(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),A=w(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),R=w(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),L=w(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),P=w(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),I=w(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),D=w(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),T=w(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),z=w(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),N={blues:j,reds:S,greens:M,viridis:L,oranges:C,purples:A,greys:R,plasma:P,inferno:I,magma:D,cividis:T,turbo:z};function O(e){return e&&N[e]||j}w(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),w(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),w(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),w(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),w(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var E={category10:k,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...N},B=k,H="#007bff",W=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],_=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 F(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||_.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):B[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)}(r))%B.length]}function $(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function q(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>$(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,b.scaleOrdinal)().domain(r).range(n).unknown("#999");const i=E[n]||E.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:B;return(0,b.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function G(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,s]=r,[a,l]=n;if(s===i)return(a+l)/2;let c=(o-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function V(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&$(n,e)||"#4e79a7":t=>{if(n){const e=$(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}function U(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(U))}function Y(e,t,n){e.has(t)||(e.add(t),console.warn(n))}var Z=require("d3-geo"),X={mercator:Z.geoMercator,equalEarth:Z.geoEqualEarth,albersUsa:Z.geoAlbersUsa,orthographic:Z.geoOrthographic,naturalEarth:Z.geoNaturalEarth1,equirectangular:Z.geoEquirectangular};function Q(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function K(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function J(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function ee(e,t){if(2>e.length)return[e];const n=.4*t,r=[];let o=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>o.length||r.push(o),o=[i]):o.push(i)}return 2>o.length||r.push(o),r}function te(e,t,n=24){const r=t[0]-e[0],o=t[1]-e[1],i=Math.sqrt(r*r+o*o);if(0===i)return[e,t];const s=-o/i,a=r/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+s*l,u=(e[1]+t[1])/2+a*l,d=[];for(let r=0;n>=r;r++){const o=r/n,i=1-o;d.push([i*i*e[0]+2*i*o*c+o*o*t[0],i*i*e[1]+2*i*o*u+o*o*t[1]])}return d}function ne(e,t){if(2>e.length)return e;const n=t/2+1,r=[];for(let t=0;e.length>t;t++){const o=e[t];let i,s;0===t?(i=e[1][0]-o[0],s=e[1][1]-o[1]):t===e.length-1?(i=o[0]-e[t-1][0],s=o[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const a=Math.sqrt(i*i+s*s)||1;r.push([o[0]+s/a*n,o[1]+-i/a*n])}return r}function re(e,t,n,r,o){const i=t[0]-e[0],s=t[1]-e[1],a=Math.sqrt(i*i+s*s);if(0===a)return[e,t];const l=s/a,c=-i/a,u=o/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}var oe=require("d3-scale");function ie(e){let t=1/0,n=-1/0;for(const r of e)t>r&&(t=r),r>n&&(n=r);return[t,n]}function se(e,t,n,r){const o=e.push(t);return n&&n.push(r),o}var ae={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function le(e,t){const n={...e};for(const e of t)n[ae[e]]++;return n}function ce(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:le(n,r)}}var ue=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=ce({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=ce(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},de=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],he=["scene-style","data-paint","accessibility","evidence"],fe=(e,t)=>({retainedData:e,invalidations:t}),pe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],me=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ye=["scene-geometry","data-paint","accessibility","evidence"],ge=["scene-style","data-paint","accessibility","evidence"],be=["overlay","accessibility","evidence"],ve=[],xe={xAccessor:fe("rebuild",pe),yAccessor:fe("rebuild",pe),lineDataAccessor:fe("rebuild",pe),pointIdAccessor:fe("rebuild",ye),lineIdAccessor:fe("rebuild",ye),windowSize:fe("rebuild",pe),projection:fe("preserve",me),projectionExtent:fe("preserve",me),fitPadding:fe("preserve",me),lineType:fe("preserve",me),flowStyle:fe("preserve",me),graticule:fe("preserve",me),projectionTransform:fe("preserve",me),customLayout:fe("preserve",me),layoutConfig:fe("preserve",me),layoutMargin:fe("preserve",me),areaStyle:fe("preserve",ge),pointStyle:fe("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:fe("preserve",ge),colorScheme:fe("preserve",ge),themeCategorical:fe("preserve",ge),themeDiverging:fe("preserve",ge),themeSemantic:fe("preserve",ge),themeSequential:fe("preserve",ge),decay:fe("preserve",ge),pulse:fe("preserve",ge),layoutSelection:fe("preserve",ge),annotations:fe("preserve",be),autoPlaceAnnotations:fe("preserve",be),clock:fe("preserve",ve),transition:fe("preserve",ve),introAnimation:fe("preserve",ve),onLayoutError:fe("preserve",ve)},we=fe("preserve",me),ke=class{constructor(){this.tracker=new ue}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},de)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},he):this.recordNoop("restyle")}recordConfig(e,t={}){const n=function(e){let t="preserve";const n=new Set;for(const r of e){const e=xe[r]??we;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e),r=new Set(n.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}},je=new WeakMap;var Se=require("d3-geo");function Me(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e)&&e>=0&&.5>e)return e;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${e+""}.`)}var Ce=class e{constructor(e){this.updateResults=new ke,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,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=function(e){return{...e,fitPadding:Me(e.fitPadding)}}(e)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}getConfiguredWindowSize(){const e=this.config.windowSize??500;if(!Number.isInteger(e)||1>e)throw Error("GeoPipelineStore windowSize must be a positive integer");return e}retainNewestLines(e=this.getConfiguredWindowSize()){this.lineData.length>e&&(this.lineData=this.lineData.slice(-e))}resizeStreamingWindow(e){if(this.pointBuffer){const t=this.pointBuffer.toArray(),n=this.timestampBuffer?.toArray()??[],r=t.slice(-e),o=n.slice(-r.length),i=this.currentTime();this.pointBuffer=new f(e),this.timestampBuffer=new f(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(o[t]??i)})}this.retainNewestLines(e)}updateConfig(e){const t=function(e){return"fitPadding"in e?{...e,fitPadding:Me(e.fitPadding)}:e}(e),n=this.config,r=this.getConfiguredWindowSize(),o=Object.keys(t).filter(e=>t[e]!==n[e]);this.config={...this.config,...t};const i=this.getConfiguredWindowSize(),s=this.streaming&&i!==r;s&&(this.resizeStreamingWindow(i),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(o,{retainedDataChanged:s})}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}setAreas(e){this.areas=e,this.updateResults.recordData("replace",e.length)}setAreasWithResult(e){return this.setAreas(e),this.updateResults.last}setPoints(e){this.pointData=e.slice(),this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.updateResults.recordData("replace",e.length)}setPointsWithResult(e){return this.setPoints(e),this.updateResults.last}setLines(e){this.lineData=e.slice(),this.streaming&&this.retainNewestLines(),this.updateResults.recordData("replace",e.length)}setLinesWithResult(e){return this.setLines(e),this.updateResults.last}initStreaming(e){void 0!==e&&e!==this.config.windowSize&&(this.config={...this.config,windowSize:e});const t=this.getConfiguredWindowSize(),n=this.pointBuffer?this.pointBuffer.toArray():this.pointData,r=this.timestampBuffer?.toArray()??[],o=n.slice(-t),i=r.slice(-o.length),s=this.currentTime();this.pointBuffer=new f(t),this.timestampBuffer=new f(t),o.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(i[t]??s)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();se(this.pointBuffer,e,this.timestampBuffer,t),this.lastIngestTime=t,this.updateResults.recordData("ingest",1)}pushPointWithResult(e){return this.pushPoint(e),this.updateResults.last}pushMany(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();for(const n of e)se(this.pointBuffer,n,this.timestampBuffer,t);this.lastIngestTime=t,this.updateResults.recordData("ingest",e.length)}pushManyWithResult(e){return this.pushMany(e),this.updateResults.last}pushLine(e){null!=e&&"object"==typeof e?(this.streaming||this.initStreaming(),this.lineData.push(e),this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",1)):this.updateResults.recordNoop("ingest")}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return void this.updateResults.recordNoop("ingest");const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){this.streaming||this.initStreaming();for(const e of t)this.lineData.push(e);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",t.length)}else this.updateResults.recordNoop("ingest")}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],r=new Set(Array.isArray(e)?e:[e]),o=[];return this.lineData=this.lineData.filter(e=>!r.has(n(e)+"")||(o.push(e),!1)),o.length>0?(this.version++,this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),o}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],r=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>r.has(n(e)+"");!function(e,t,n){if(!t||0===t.size)return;const r=new Set;if(e.forEach((e,t)=>{n(e)&&r.add(t)}),0===r.size)return;const o=t.toArray();t.clear();for(let e=0;o.length>e;e++)r.has(e)||t.push(o[e])}(this.pointBuffer,this.timestampBuffer,e);const t=this.pointBuffer.remove(e);return t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}{const e=[];return this.pointData=this.pointData.filter(t=>!r.has(n(t)+"")||(e.push(t),!1)),e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,this.version++,this.updateResults.recordData("clear")}restyleScene(e){const t=this._customRestyle;if(t){for(const n of this.scene){const r=this._baseStyles.get(n)??n.style,o=t(n,e);n.style=o?{...r,...o}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(e){const{config:t}=this,n=this.projection,r=this.geoPath,o=this.scales,i=this.baseScale,s=[...this.baseTranslate],a=[...this.baseRotation],l=this.scene;this.projection=function(e){if(!e)return(0,Z.geoEqualEarth)();if("string"==typeof e){const t=X[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),(0,Z.geoEqualEarth)())}if("object"==typeof e&&"type"in e){const t=X[e.type],n=t?t():(0,Z.geoEqualEarth)();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=(0,d.geoPath)(this.projection),this.fitProjection(e),this.geoPath=(0,d.geoPath)(this.projection);const c=this.projection;this.scales={projection:c,geoPath:this.geoPath,projectedPoint:(e,t)=>c([e,t]),invertedPoint:(e,t)=>c.invert?c.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(e);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=r,this.scales=o,this.baseScale=i,this.baseTranslate=s,this.baseRotation=a):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,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,r=this.scene.filter(e=>"point"===e.type).map(e=>({...e,x:t,y:n}));r.length>0&&this.startTransition(r)}this._hasRenderedOnce=!0,t.transition&&l.length>0&&this.startTransition(l),this.version++}}fitProjection(e){const t=this.projection,n=this.config,r=[...this.areas],o=Q(n.xAccessor,"lon"),i=Q(n.yAccessor,"lat"),s=this.getPoints();if(s.length>0){const e=s.map(e=>[o(e),i(e)]);r.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const a=K(n.lineDataAccessor);for(const e of this.lineData){const t=a(e);if(t&&t.length>0){const e=t.map(e=>[o(e),i(e)]);r.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==r.length){if(n.projectionExtent){const[[r,o],[i,s]]=n.projectionExtent;t.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[r,o],[r,s],[i,s],[i,o],[r,o]]]}})}else if(t.clipAngle&&(t.clipAngle()??0)>0){const r=n.fitPadding??0,o=Math.min(e.width,e.height);t.scale(o/2-o*r),t.translate([e.width/2,e.height/2])}else{const o=n.fitPadding??0,i=e.width*o,s=e.height*o;t.fitExtent([[i,s],[e.width-i,e.height-s]],{type:"FeatureCollection",features:r})}this.baseScale=t.scale(),this.baseTranslate=t.translate(),this.baseRotation=t.rotate?.()??[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,o=this.scales,i=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,o=this.scales,i=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;if(!n||!n.rotate)return;const r=this.geoPath,o=this.scales,i=[...n.rotate()];n.rotate(e),this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const s=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(i),this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=s,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)}hasProjection(){return null!=this.projection}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let t=0,n=0;for(const e of this.scene)"point"===e.type&&(n++,e.r>t&&(t=e.r));if(this._maxPointRadius=t,e.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const r=Array(n);let o=0;for(const e of this.scene)"point"===e.type&&(r[o++]=e);this._quadtree=(0,h.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;const{config:t}=this,n=this.projection,r=this.geoPath;if(t.customLayout&&this.scales){const n=t.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,n=B){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=E[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(t.colorScheme,t.themeCategorical,W),o={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:e.width,height:e.height,margin:n,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:t.themeSemantic??{},categorical:[...r]},resolveColor:V(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null};let i;try{i=t.customLayout(o)}catch(e){const n=null!==this.lastCustomLayoutResult,r=function(e,t,n,r){const o=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}("geo",e,n,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",e);try{t.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return n?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}const s=i.nodes??[];if(this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null,this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const e of s)this._baseStyles.set(e,e.style);this.restyleScene(t.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:o}=e;U(r)&&0===n.length&&Y(o,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&Y(o,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,function({config:e,projection:t,path:n,areas:r,points:o,lines:i,layout:s}){const a=Q(e.xAccessor,"lon"),l=Q(e.yAccessor,"lat"),c=[],u=function(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(e),d=function(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(e),h=function(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(e);if(e.graticule){const t=!0===e.graticule?{}:e.graticule,r=(0,Se.geoGraticule)();t.step&&r.step(t.step);const o=n(r())||"";o&&c.push({type:"geoarea",pathData:o,centroid:[s.width/2,s.height/2],bounds:[[0,0],[s.width,s.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 t of r){const r=n(t);if(!r)continue;const o=n.centroid(t),i=n.bounds(t),s=n.area(t);c.push({type:"geoarea",pathData:r,centroid:o,bounds:i,screenArea:s,style:J(e.areaStyle,t,u),datum:t,interactive:!0})}const f=K(e.lineDataAccessor);for(const n of i){const r=f(n);if(!r||2>r.length)continue;let o=[];if("geo"===e.lineType){const e=Array(r.length);for(let t=0;r.length>t;t++)e[t]=[a(r[t]),l(r[t])];for(let n=0;e.length-1>n;n++){const r=e[n],i=e[n+1],s=(0,Se.geoDistance)(r,i)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),l=(0,Se.geoInterpolate)(r,i);for(let e=0;a>=e;e++){if(n>0&&0===e)continue;const r=t(l(e/a));null!=r&&o.push(r)}}}else for(let e=0;r.length>e;e++){const n=r[e],i=t([a(n),l(n)]);null!=i&&o.push(i)}if(2>o.length)continue;const i=J(e.lineStyle,n,d),u="number"==typeof i.strokeWidth?i.strokeWidth:1;2!==r.length||2>o.length||"arc"!==e.flowStyle?2!==r.length||2>o.length||"offset"!==e.flowStyle||(o="geo"===e.lineType?ne(o,u):re(o[0],o[o.length-1],0,0,u)):o=te(o[0],o[o.length-1]);const h=ee(o,s.width);if(h.length>1)for(const e of h)2>e.length||c.push({type:"line",path:e,style:{...i,_edgeFade:!0},datum:n});else c.push({type:"line",path:2>o.length&&h[0]||o,style:i,datum:n})}const p=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,m=t.clipAngle?t.clipAngle()??0:0,y=m>0?m*Math.PI/180:null,g=t.rotate?t.rotate():[0,0,0],b="function"==typeof t.center?t.center():[0,0],v=[(b[0]??0)-g[0],(b[1]??0)-g[1]];for(const n of o){const r=a(n),o=l(n);if(null!=y&&(0,Se.geoDistance)([r,o],v)>y)continue;const i=t([r,o]);if(!i)continue;const s=e.pointStyle?e.pointStyle(n):{...h},u={type:"point",x:i[0],y:i[1],r:s.r||4,style:s,datum:n,pointId:p?p(n)+"":void 0};c.push(u)}return c}({config:t,projection:n,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){const n=function(e,t,n,r){const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const i=t.strength??1,s=Number.isFinite(i)?Math.max(0,Math.min(1,i)):1,a="strip"===t.layout?"strip":"radial";if("radial"===a&&0===s)return null;const l=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,c="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],u=o.find(e=>e.datum&&l(e.datum)+""==t.center+"");if(!u)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const d=function(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}(o.map(e=>e.datum?Number(c(e.datum)):NaN).filter(e=>isFinite(e)&&e>=0),1);r>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.");for(let t=e.length-1;t>=0;t--){const n=e[t];"geoarea"===n.type&&n.interactive&&e.splice(t,1)}const h="strip"===a?function(e,t,n,r,o){const i=Math.max(3,Math.min(8,.35*o.height)),s=Math.max(1,o.width-2*i),a=o.height/2,l=(0,oe.scaleLinear)().domain([0,r]).range([0,s]);t.x=i,t.y=a;const c=[];for(const o of e){if(o===t)continue;if(!o.datum){o.x=i,o.y=a;continue}const e=Number(n(o.datum)),s=i+(isFinite(e)&&e>=0&&r>0?l(e):0);o.x=s,o.y=a,c.push({node:o,x:s})}c.sort((e,t)=>e.x-t.x);const u=Math.max(0,Math.min(o.height/2-1,6));let d=0;for(;c.length>d;){let e=d+1;for(;c.length>e&&3>Math.abs(c[e].x-c[d].x);)e++;const t=e-d;if(t>1&&u>0)for(let e=0;t>e;e++)c[d+e].node.y=a+(e-(t-1)/2)*Math.min(2.5,2*u/Math.max(1,t-1));d=e}return{cx:i,cy:a,maxCost:r,availableRadius:s,layout:"strip"}}(o,u,c,d,n):function(e,t,n,r,o,i){const s=t.x,a=t.y,l=i.width/2,c=i.height/2,u=Math.min(i.width,i.height)/2,d=(0,oe.scaleLinear)().domain([0,r]).range([0,u]);for(const i of e){if(i===t)continue;if(!i.datum)continue;const e=i.x,u=i.y,h=Math.atan2(u-a,e-s),f=Math.hypot(e-s,u-a),p=Number(n(i.datum)),m=isFinite(p)&&p>=0?r>0?d(p):0:f,y=l+Math.cos(h)*m,g=c+Math.sin(h)*m;i.x=e+(y-e)*o,i.y=u+(g-u)*o}return t.x=s+(l-s)*o,t.y=a+(c-a)*o,{cx:t.x,cy:t.y,maxCost:r,availableRadius:u,layout:"radial"}}(o,u,c,d,s,n),f=e.filter(e=>"line"===e.type);if(f.length>0){const e=new Map;for(const t of o)null!=t.pointId&&e.set(t.pointId+"",[t.x,t.y]);for(const n of f){const r=n.datum?.source,o=n.datum?.target;if(null!=r&&null!=o){const i=e.get(r+""),s=e.get(o+"");if(i&&s)if("fractional"===t.lineMode&&n.path.length>2){const e=n.path[0],t=n.path[n.path.length-1],r=[i[0]-e[0],i[1]-e[1]],o=[s[0]-t[0],s[1]-t[1]],a=[0];for(let e=1;n.path.length>e;e++)a.push(a[e-1]+Math.hypot(n.path[e][0]-n.path[e-1][0],n.path[e][1]-n.path[e-1][1]));const l=a[a.length-1];n.path=n.path.map((e,t)=>{const i=l>0?a[t]/l:t/(n.path.length-1);return[e[0]+r[0]*(1-i)+o[0]*i,e[1]+r[1]*(1-i)+o[1]*i]})}else n.path=[i,s]}}}return h}(this.scene,e,t,this.areas.length);n&&(this.cartogramLayout=n)}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 r=0;n.length>r;r++){const o=m(e,r,t);n[r]._decayOpacity=o,n[r].style={...n[r].style,opacity:o}}}applyPulse(e=this.currentTime()){const t=this.config.pulse;if(!t||!this.timestampBuffer)return!1;const n=this.scene.filter(e=>"point"===e.type),r=this.timestampBuffer.toArray(),o=t.color||"rgba(255,255,255,0.6)",i=t.glowRadius??4;let s=!1;for(let a=0;n.length>a&&r.length>a;a++){const l=y(t,r[a],e);s=g(n[a],l,o,i)||s}return s}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,o=t.peek();return null!=o&&r>n-o}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(e){const t=this.config.transition?.duration??300;if(0>=t)return;const n=new Map;for(const t of e)"point"===t.type&&t.pointId&&n.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let o=!1;for(const e of r)if(e.pointId){const t=n.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)&&(o=!0))}for(const e of r)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??1,e.style={...e.style,opacity:0},o=!0);o&&(this.activeTransition={startTime:this.currentTime(),duration:t})}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),r=this.scene.filter(e=>"point"===e.type);for(const e of r){if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=p(e.x,e._targetX,n),e.y=p(t,e._targetY,n)}null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity*n})}if(t>=1){for(const e of r)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0),null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}};Ce.QUADTREE_THRESHOLD=500;var Ae=Ce;Object.assign(Ae.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){je.set(this,!0)},consumeStylePaintPending:function(){const e=!0===je.get(this);return je.delete(this),e}});var Re=require("react"),Le={sceneGeometry:0,layout:0,domain:0};function Pe(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function Ie(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var De="production"!==process.env.NODE_ENV,Te={revisions:Le,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},ze=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Le,this.lastObserved=Le,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){De&&(this.lastObserved=Ie(this.lastObserved,Pe(e)))}beforeCompute(e,t){if(!De)return Te;const n=Ie(Pe(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(De){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},Ne=(0,Re.memo)(function({store:e,diagnostics:t}){return(0,Re.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});function Oe(e,t=30){return Math.max((e??4)+5,12,t)}var Ee=[40,40],Be=[.5,.5];function He(e,t){const[n,r]=e.viewBox??Ee,[o,i]=e.anchor??Be,s=r>0?r:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-o*l,offsetY:-i*c}}function We(e,t){const n=He(e,t),r=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let o=0;for(const[e,t]of r){const n=Math.sqrt(e*e+t*t);n>o&&(o=n)}return o}function _e(e,t,n,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?n:e}var Fe=null;function $e(e){if("undefined"==typeof Path2D)return null;Fe||(Fe=new Map);const t=Fe.get(e);if(t)return t;const n=new Path2D(e);return Fe.size>1024&&Fe.clear(),Fe.set(e,n),n}function qe(e,t,n=0,r="horizontal"){const[o,i]=e.viewBox??Ee,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===r?{x:0,y:i*(1-a),width:o,height:i*(a-s)}:{x:o*s,y:0,width:o*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function Ge(e,t){const n=He(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function Ve(e,t,n,r,o,i=e=>e){for(const s of t.parts){const t=$e(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=o?"none"===s.fill?void 0:o:_e(s.fill,n,r);c&&(e.fillStyle=i(c),e.fill(t));const u=o?s.stroke&&"none"!==s.stroke?o:void 0:_e(s.stroke??"none",n,r);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function Ue(e,t,n,r,o,i,s=0,a=r){if(i){const e=function(e,t,n,r,o,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(r,o+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,p=1/0;return e.visit((e,o,l,m,y)=>{if(o>u||c>m||l>h||d>y)return!0;if(!e.length){let o=e;do{const e=o.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);Oe(a(e),r)>=u&&p>u&&(f=e,p=u),o=o.next}while(o)}return!1}),f?{node:f,distance:p}:null}(i,t,n,r,s);if(e)return e}else{let o=null,i=r;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,a=s.y-n,l=Math.sqrt(e*e+a*a);Oe(s.r,r)>=l&&i>l&&(o=s,i=l)}if(o)return{node:o,distance:i}}let l=null,c=r;for(const o of e){if("glyph"!==o.type)continue;if(null==o.datum)continue;const e=Ge(o.glyph,o.size),i=o.x+e.centerDx-t,s=o.y+e.centerDy-n,a=Math.sqrt(i*i+s*s);Oe(e.radius,r)>=a&&c>a&&(l=o,c=a)}if(l)return{node:l,distance:c};for(let r=e.length-1;r>=0;r--){const i=e[r];if("geoarea"!==i.type)continue;const s=i;if(!1===s.interactive)continue;const[[a,l],[c,u]]=s.bounds;if(!(a>t||t>c||l>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),o.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let u=null,d=a;for(const r of e){if("line"!==r.type)continue;const e=r,{path:o}=e,i=Math.max((e.style.strokeWidth||2)+4,5,a);for(let r=0;o.length-1>r;r++){const[s,a]=o[r],[l,c]=o[r+1],h=Ye(t,n,s,a,l,c);i>=h&&d>h&&(u=e,d=h)}}return u?{node:u,distance:d}:null}function Ye(e,t,n,r,o,i){const s=o-n,a=i-r,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-r)**2);let c=((e-n)*s+(t-r)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(r+c*a))**2)}var Ze=l(require("react")),Xe=require("react"),Qe=require("react"),Ke=require("react/jsx-runtime");function Je(e){let t=null;const n=()=>(t||(t=(0,Qe.createContext)(null)),t),r=et(e);return[function({children:t,initialState:r}){const o=(0,Qe.useRef)(r),i=(0,Qe.useMemo)(()=>et(e,o.current),[]),s=n();return(0,Ke.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const o=n(),i=(0,Qe.useContext)(o)??r,s=(0,Qe.useRef)(e);s.current=e;const a=(0,Qe.useRef)({hasValue:!1,value:void 0}),l=(0,Qe.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Qe.useCallback)(()=>s.current(i.getState()),[i]);return(0,Qe.useSyncExternalStore)(i.subscribe,l,c)}]}function et(e,t){const n=new Set;let r={...e(function(e){const t=e(r);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){r={...r,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>r,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function tt(e){if(!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 nt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:rt}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var rt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],ot={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}},it={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}},st={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:rt,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 at(e,t){if("light"===t)return ot;if("dark"===t)return it;if("high-contrast"===t)return st;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?it:ot;return nt({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return nt({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[lt,ct]=Je(e=>({theme:ot,setTheme(t){e(e=>({theme:at(e.theme,t)}))}})),ut=require("react");var dt=require("react"),ht=new WeakMap,ft=0,pt=!1,mt=null,yt=null;function gt(e,t){if(!t)return t;const n=function(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),r=n.indexOf(",");if(-1===r){const e=n.trim();return e.startsWith("--")?{name:e}:null}const o=n.slice(0,r).trim(),i=n.slice(r+1).trim();return o.startsWith("--")?{name:o,fallback:i||void 0}:null}(t);if(!n)return t;const r=()=>n.fallback?gt(e,n.fallback):t,o=e.canvas;if(!o)return r();!function(){if(pt)return;if("undefined"==typeof window||"undefined"==typeof document)return;pt=!0;const e=()=>{ft++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"],subtree:!0}),"function"==typeof window.matchMedia)try{mt=window.matchMedia("(prefers-color-scheme: dark)"),yt=e,"function"==typeof mt.addEventListener?mt.addEventListener("change",yt):"function"==typeof mt.addListener&&mt.addListener(yt)}catch{}}();let i=ht.get(o);i&&i.version===ft||(i={version:ft,map:new Map},ht.set(o,i));const s=i.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(o).getPropertyValue(n.name).trim()||r()||t;return i.map.set(t,a),a}var bt=()=>"undefined"!=typeof performance?performance.now():Date.now();function vt(e,t){const n=e();return Number.isFinite(n)?n:t}var xt=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??bt,this.lastWallTime=vt(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=vt(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??bt;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=vt(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},wt="undefined"==typeof window?Xe.useEffect:Xe.useLayoutEffect,kt={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function jt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function St(e){const t=function(){const[e,t]=(0,ut.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,ut.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,Xe.useRef)(t);n.current=t;const[r,o]=function(e,t,n){const r=(0,dt.useRef)(null),[o,i]=(0,dt.useState)(null);return(0,dt.useEffect)(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Xe.useMemo)(()=>function(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=o[0]-a.left-a.right,c=o[1]-a.top-a.bottom,u=jt(e.foregroundGraphics,o,a),d=jt(e.backgroundGraphics,o,a),h=ct(e=>e.theme),{transition:f,introEnabled:p}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),m="semiotic-table-"+Ze.useId(),y=(0,Xe.useRef)(null);if(!y.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;y.current=new xt({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=y.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,Xe.useRef)(null),v=(0,Xe.useRef)(e.frameScheduler??kt);v.current=e.frameScheduler??kt;const x=(0,Xe.useRef)(null),w=(0,Xe.useRef)(!1),k=(0,Xe.useRef)(()=>{}),j=(0,Xe.useCallback)(()=>{if(null!==b.current||w.current)return;const e=v.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(w.current=!0),b.current=null,x.current=null;try{k.current()}finally{e&&(w.current=!1)}});n=!0,t||(b.current=r,x.current=e)},[]),S=(0,Xe.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);wt(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,Xe.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,Xe.useEffect)(()=>()=>{S()},[S]);const M=(0,Xe.useRef)(()=>{}),C=(0,Xe.useRef)(()=>{}),A=(0,Xe.useRef)(null),R=(0,Xe.useRef)(null),L=(0,Xe.useRef)(null),P=(0,Xe.useCallback)(()=>{const e=A.current;A.current=null,e&&M.current(e)},[]),I=(0,Xe.useCallback)(e=>{if(A.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===R.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,R.current=null,L.current=null,P()});t||(R.current=n,L.current=e)}},[P]),D=(0,Xe.useCallback)(()=>{A.current=null,null!==R.current&&((L.current??v.current).cancelAnimationFrame(R.current),R.current=null,L.current=null),C.current()},[]);(0,Xe.useEffect)(()=>()=>{A.current=null,null!==R.current&&((L.current??v.current).cancelAnimationFrame(R.current),R.current=null,L.current=null)},[]);const T=e.themeDirtyRef;return wt(()=>{T&&(ft++,T.current=!0,j())},[h,j,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:o,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:p,tableId:m,frameRuntime:g,rafRef:b,renderFnRef:k,scheduleRender:j,cancelRender:S,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:I,onPointerLeave:D}}var Mt=require("react"),Ct=require("react"),At={fresh:1,aging:.7,stale:.45,expired:.25},Rt={alpha:1,band:"fresh",isStale:!1};var Lt=require("react/jsx-runtime");function Pt({isStale:e,position:t}){return(0,Lt.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var It=l(require("react")),[Dt,Tt]=Je(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 zt(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:o}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var Nt=require("react"),Ot=l(require("react")),Et=require("react/jsx-runtime");function Bt(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let s="";for(const e of o)s&&s.length+1+e.length>r?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Ht(e,t,n,r){return"curly"===e?r?`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`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Wt(e,t,n,r){if(!e)return(0,Et.jsx)("g",{className:"annotation-note"});const{label:o,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!o&&!i)return(0,Et.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,p=i?c?[i]:Bt(i,l):[],m=o?c?[o]:Bt(o,l):[],y="leftRight"===u?"end"===h?-4:4:0;let g=0;const b=[],v=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Et.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(p.length+m.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:(0,Et.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Et.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&(0,Et.jsx)("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(p.length>0&&(b.push((0,Et.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:p.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),m.length>0&&b.push((0,Et.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:g,children:m.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+m.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),(0,Et.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Et.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function _t(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Et.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push((0,Et.jsx)("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,s=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push((0,Et.jsx)("line",{x1:r,y1:(t.y1||0)-s,x2:r,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-s;i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Et.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push((0,Et.jsx)("path",{d:Ht(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Et.jsx)("g",{className:"annotation-subject",children:i})}function Ft(e,t,n,r,o,i){const s=[];let a=0,l=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,s=e-o,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;a=o+s*h,l=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);a=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const r=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(n?.curve??.25)*c,p=r+d*f,m=i+h*f;s.push((0,Et.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:o},"connector-line")),u=Math.atan2(m-l,p-a)}else s.push((0,Et.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,Et.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return(0,Et.jsx)("g",{className:"annotation-connector",children:s})}function $t(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:p,strokeDasharray:m,events:y={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=r||0,k=o||0;null!=i&&(w=i-b),null!=s&&(k=s-v);const j="string"==typeof u?u:"label";if("bracket"===j&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,Et.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":g,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...y,children:[!x.has("connector")&&Ft(w,k,l,d,j,c),!x.has("subject")&&_t(j,c,d,b,v),!x.has("note")&&Wt(a,w,k,d)]})}function qt(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return(0,Et.jsx)($t,{"data-testid":"semiotic-annotation",...s,type:r},"multi-annotation-"+i)});return(0,Et.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Et.jsx)($t,{"data-testid":"semiotic-annotation",events:o,...t,type:r},s)}var Gt=require("d3-hierarchy"),Vt=require("d3-shape");function Ut(e){return Math.round(100*e)/100}function Yt(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const s=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));s.push(r)}r.push(s)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(Ut);return{points:e.map(([e])=>[Ut(e),Ut(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}function Zt(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function Xt(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function Qt(e){return null==e?null:e+""}function Kt(e,t,n){return t.stickyPositionCache?.set(e,n),n}function Jt(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const o=n.pointNodes[r];if(o.pointId===e.pointId)return Kt(t,n,{x:o.x,y:o.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,o=e.scales?.y??e.scales?.value;if(!r||!o)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:r(i),y:o(s)}}(n);return r?Kt(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return Qt(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const o=n.pointNodes?.find(e=>Qt(e.pointId)===r);if(o)return Kt(t,n,{x:o.x,y:o.y});const i=n.data?.find(e=>function(e){return Qt(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const s=Zt(i,n),a=Xt(i,n);return null==s||null==a?null:Kt(t,n,{x:s,y:a})}(e,t,n);if(r)return r}let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(o=t.x,i=t.y)}if(null!=o&&null!=i||(o=Zt(e,n),i=Xt(e,n)),null!=o&&null!=i)return Kt(t,n,{x:o,y:i});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function en(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}var tn=require("react/jsx-runtime"),nn={secondary:0,primary:3};function rn(e){return!0===e?._annotationDeferred}function on(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function sn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function an(e){return Math.max(.72,.95-.06*e)}var ln=require("react/jsx-runtime"),cn="var(--semiotic-bg, #ffffff)";function un(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,ln.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:o,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??cn,strokeWidth:h.haloWidth??3});const p=h.padding??{x:6,y:3},m="number"==typeof p?p:p.x,y="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(r,i),b=i+2*y;let v,x;return v="middle"===l?t-g/2-m:"end"===l?t-g-m:t-m,x="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-y:n-.8*i-y,(0,ln.jsxs)("g",{className:d,children:[(0,ln.jsx)("rect",{x:v,y:x,width:g+2*m,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??cn,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}function dn(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var hn=null;var fn=require("react/jsx-runtime");function pn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function mn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function yn(e,t){let n=2166136261;const r=mn(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var gn=new Map;function bn(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,fn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,fn.jsx)("rect",{width:l,height:l,fill:n}),(0,fn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:o,strokeOpacity:a}),(0,fn.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:r,strokeWidth:o,strokeOpacity:a})]},t)}function vn(e,t,n="#4e79a7"){if(pn(e)){const n=yn(t,e);return{fill:`url(#${n})`,def:bn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var xn=require("react/jsx-runtime"),wn={linear:Vt.curveLinear,monotoneX:Vt.curveMonotoneX,monotoneY:Vt.curveMonotoneY,step:Vt.curveStep,stepAfter:Vt.curveStepAfter,stepBefore:Vt.curveStepBefore,basis:Vt.curveBasis,cardinal:Vt.curveCardinal,catmullRom:Vt.curveCatmullRom};var kn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function jn(e){return!!e&&"object"==typeof e&&kn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Sn(e){return"primary"===e?.emphasis||!0===e?.defensive}function Mn(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 Cn(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var An=32,Rn=6,Ln=4,Pn=8,In=72;var Dn={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Tn(e){if(!zn(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function zn(e){return jn(e)}function Nn(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),o=[];let i="";for(const e of r)i&&i.length+e.length+1>n?(o.push(i),i=e):i=i?`${i} ${e}`:e;return i&&o.push(i),o}function On(e,t,n,r,o){const i=e+n,s=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?i-o.width-4:i+4,y:0>r?s-o.height:s,width:o.width,height:o.height}:{x:0>n?i-o.width:i,y:0>r?s-o.height-4:s+4,width:o.width,height:o.height}}function En(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Bn(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 Hn(e,t,n,r,o,i,s,a){const l=En(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const o=Math.max(0,r-e.x),i=Math.max(0,r-e.y);return(o+Math.max(0,e.x+e.width-(t-r)))*e.height+(i+Math.max(0,e.y+e.height-(n-r)))*e.width}(l,o,i,a);for(const e of n)c+=12*Bn(l,e);for(const e of r)c+=4*Bn(l,e);return c}function Wn(e){const{annotations:t,context:n,defaultOffset:r=An,notePadding:o=Rn,markPadding:i=Ln,edgePadding:s=Pn,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=In,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:p,cohesion:m,audience:y}=e,g=n.width||0,b=n.height||0,v="object"==typeof p?p:{},x=v.breakpoint??480,w=!!p&&x>=g,k=w&&!1!==v.preferShortText?t.map(Tn):t,j=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,S=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!m?v.cohesion:m;if(0===k.length||0>=g||0>=b)return k.slice();const A=[],R=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}})}(n,i);let L=!1;const P=k.map((e,t)=>{if(!zn(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=e.pointId??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 o=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(o)&&o.length>=2&&i){const e=o[0],t=o[1];if("number"==typeof e&&"number"==typeof t){const n=i([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?Jt(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=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=[...Nn("string"==typeof e.title?e.title:void 0,t),...Nn("string"==typeof e.label?e.label:void 0,t)],r=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+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 A.push(En(On(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),o)),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}]}(r)){const t=Hn(On(i.x,i.y,e.dx,e.dy,u),e,A,R,g,b,o,s);f>t&&(h=e,f=t)}if(!h)return e;const p=En(On(i.x,i.y,h.dx,h.dy,u),o);A.push(p);const m=Math.hypot(h.dx,h.dy),y=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return L=!0,{...e,dx:h.dx,dy:h.dy,...y?{connector:y}:{}}}),I=L?P:k.slice();let D=I;if(h){let e=!1;const t=I.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:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});D=e?t:I}{let e=!1;const t=D.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Dn[t.source]??t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const o=[n,r].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${o})`)?e:{...e,label:i?`${i} (${o})`:`(${o})`}}(t);return n!==t&&(e=!0),n});D=e?t:D}const T=new Set;if(j){const e="object"==typeof j?j:{},t=function(e){if(!e)return 1;const t=function(e){const t=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}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Mn(g,b,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,o=Math.max(0,e.minVisible??1),i=Mn(n,r,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,jn(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Sn(e.annotation)),c=a.filter(e=>!Sn(e.annotation)).sort((e,t)=>Cn(t.annotation)-Cn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,o-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:D,width:g,height:b,...n});for(const e of r)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=g)for(const e of D)zn(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of D)!0===e?.defensive&&T.delete(e);let z;return z=0===T.size?D:S?D.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):D.filter(e=>!T.has(e)),C?function(e,t){let n=!1;const r=e.map(e=>zn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(z,C):z}var _n=l(require("react"));function Fn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function $n(e){return"object"==typeof e&&null!==e&&"gradient"in e}function qn(e){return Math.ceil(7*e.length)}function Gn(e,t){if(Fn(e)){const n=Zn(t),r=e.legendGroups.flatMap(e=>[e.label?qn(e.label):0,...e.items.map(e=>n.swatchSize+n.labelGap+qn(e.label))]);return Math.max(100,...r)}if($n(e)){const{gradient:t}=e,n=t.format||(e=>Math.round(100*e)/100+""),r=Math.max(qn(n(t.domain[0])),qn(n(t.domain[1]))),o=t.label?qn(t.label):0;return Math.max(100,19+r,o)}return 100}function Vn(e){return(Fn(e)||$n(e))&&Number.isFinite(e.legendDistance)?Math.max(0,e.legendDistance):10}function Un(e){return Math.max(0,e?.sideGutter??0)}function Yn(e,t,n){if($n(e))return e.gradient.label?34:26;if(!Fn(e))return 20;const r=Zn(n),o=Math.max(1,n?.maxWidth??t);let i=r.rowHeight;for(const t of e.legendGroups){let e=0,n=0;for(const i of t.items){const t=r.swatchSize+r.labelGap+qn(i.label),s=0===n?t:n+r.itemGap+t;n>0&&s>o?(e+=1,n=t):n=s}t.items.length>0&&(e+=1),i=Math.max(i,e*r.rowHeight,t.label?qn(t.label):0)}return i+(e.legendGroups.length>1?16:0)}function Zn(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}var Xn=require("react/jsx-runtime"),Qn={fill:(e,t)=>(0,Xn.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Xn.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Kn(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,Qn[n])(r(e,t),o),i}function Jn({swatchSize:e}){return(0,Xn.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function er(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var tr=(e,t,n,r,o,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,p=[];let m=0;const y=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=Kn(e,c,d,h,b),w=er(e,r,o),k=o&&o.size>0&&o.has(e.label);p.push((0,Xn.jsxs)("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&g?k||!1:void 0,"aria-current":y&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,Xn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&(0,Xn.jsx)(Jn,{swatchSize:b}),(0,Xn.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),p};function nr({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+_n.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Xn.jsx)("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return(0,Xn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Xn.jsx)("defs",{children:(0,Xn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Xn.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Xn.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Xn.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[0])}),(0,Xn.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Xn.jsx)("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return(0,Xn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Xn.jsx)("text",{x:0,y:-6,textAnchor:"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Xn.jsx)("defs",{children:(0,Xn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Xn.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Xn.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[1])}),(0,Xn.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[0])})]})}function rr(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=Zn(d),[f,p]=_n.useState(0),[m,y]=_n.useState(0),g=_n.useCallback((e,t)=>{p(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const d=[],h=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const o=n;let i;n+=8,e&&(n+=16,i=n,n+=8);const s=n;return n+=r*t+8,{lineY:o,labelY:i,itemsY:s,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const p=h[f];d.push((0,Xn.jsx)("line",{stroke:"gray",x1:0,y1:p.lineY,x2:t,y2:p.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=p.labelY&&d.push((0,Xn.jsx)("text",{y:p.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d.push((0,Xn.jsx)("g",{className:"legend-item",transform:`translate(0,${p.itemsY})`,children:tr(e,n,r,o,i,s,a,f,l,c,u)},"legend-group-"+f))}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,n,r,o,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=e,m=[],{swatchSize:y,labelGap:g,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=o,j=p.map(e=>y+g+7*e.label.length),S=[];let M=0,C=0;j.forEach((e,t)=>{const n=0===C?e:C+b+e;d&&d>0&&C>0&&n>d?(S.push({start:M,end:t,width:C}),M=t,C=e):C=n}),p.length>0&&S.push({start:M,end:p.length,width:C}),S.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=p[d],x=Kn(e,d,h,f,y),S=er(e,r,o),M=o&&o.size>0&&o.has(e.label);m.push((0,Xn.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?a===i&&d===s?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,d),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&(0,Xn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+g+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,Xn.jsx)(Jn,{swatchSize:y}),(0,Xn.jsx)("text",{y:y/2,x:y+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=j[d]+b}});const A=Math.max(0,...S.map(e=>e.width)),R=S.length;return{items:m,offset:A,totalRows:R,totalHeight:R*v}})(e,r,o,i,s,a,l,t,c,u,d,d.maxWidth??n);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=p+12});const p=d.maxWidth??n;let m=h>p?0:"center"===d.align?Math.max(0,(p-h)/2):"end"===d.align?Math.max(0,p-h):0;const y=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(y.push((0,Xn.jsx)("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),m+=16),y.push((0,Xn.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+r)),m+=n.offset+5,e[r+1]&&y.push((0,Xn.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),(0,Xn.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:h}),v=!(!n&&!r);return(0,Xn.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Xn.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}var or=require("react/jsx-runtime");function ir(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:s,legendHoverBehavior:a,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const h="top"===i||"bottom"===i,f=Math.max(0,n-o.left-o.right),p=Math.max(1,h?s?.maxWidth??f:Gn(t,s)),m=Vn(t),y=Un(s),g=Yn(t,f,s);let b,v;return"left"===i?(b=o.left-y-p-m,v=o.top):"top"===i?(b=o.left,v=o.top-m-g):"bottom"===i?(b=o.left,v=r-o.bottom+m):(b=n-o.right+y+m,v=o.top),(0,or.jsx)("g",{transform:`translate(${b}, ${v})`,children:$n(t)?(0,or.jsx)(nr,{config:t.gradient,orientation:h?"horizontal":"vertical",width:p}):Fn(t)?(0,or.jsx)(rr,{legendGroups:t.legendGroups,title:"",width:p,orientation:h?"horizontal":"vertical",legendLayout:s,customHoverBehavior:a,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t})}var sr=require("react/jsx-runtime");function ar(e){const{width:t,height:n,totalWidth:r,totalHeight:o,margin:i,showAxes:s,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f,legendLayout:p,foregroundGraphics:m,annotations:y,onAnnotationActivate:g,onObservation:b,chartId:v,chartType:x,autoPlaceAnnotations:w,svgAnnotationRules:k,pointNodes:j,geoProjection:S}=e,M=function(e){const t=Tt(e=>e.pushObservation),n=It.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return It.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:g,onObservation:b,chartId:v,chartType:x}),C=(0,Nt.useRef)([y?.length??0,new Map]),A=y?.length??0;C.current[0]!==A&&(C.current=[A,new Map]);const R=(0,Nt.useMemo)(()=>{if(!y||0===y.length)return null;const e=function(e,t={}){const n=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,o=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&o.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&o.has(t)&&!r)})}(y),r=S?e.map(e=>{if(!Array.isArray(e.coordinates)||2>e.coordinates.length)return e;const t=S(Number(e.coordinates[0]),Number(e.coordinates[1]));return t?{...e,x:t[0],y:t[1]}:e}):e,o={scales:{x:e=>Number(e),y:e=>Number(e)},timeAxis:"x",width:t,height:n,frameType:"xy",pointNodes:j,stickyPositionCache:C.current[1]};return function(e,t,n,r){const o=[];return e.forEach((e,i)=>{let s;if(n){const o=n(e,i,r);s=null!=o?o:t(e,i,r)}else s=t(e,i,r);s&&o.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:sn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>rn(e.annotation)),o=e.some(e=>null!=on(e.annotation)),i=e.some(e=>"layer"===on(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=nn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=rn(t.annotation);let s=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;s=(0,tn.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:an(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const a=on(t.annotation);return a&&(s=(0,tn.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,tn.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return r&&a.unshift((0,tn.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")),i&&a.unshift((0,tn.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}(o)}(w?Wn({annotations:r,context:o,..."object"==typeof w?w:{}}):r,function(e,t={}){return function(e,n,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Jt(e,n,r);if(!t)return null;const{x:o,y:i}=t;if(!en(o,i,r))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,xn.jsx)(qt,{noteData:{x:o,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=Zt(null!=e.value?{...e,x:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(r.height||0)-4:"center"===i?(r.height||0)/2:16;const a=t>.6*(r.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,xn.jsxs)("g",{opacity:e.opacity,children:[(0,xn.jsx)("line",{x1:t,y1:0,x2:t,y2:r.height||0,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,xn.jsx)(un,{x:l,y:s,text:e.label,textAnchor:c,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=Xt(null!=e.value?{...e,y:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(r.width||0)/2,l="middle"):(a=(r.width||0)-4,l="end");const c=20>(s=t)?Math.min((r.height||0)-4,s+16):s-4;return(0,xn.jsxs)("g",{opacity:e.opacity,children:[(0,xn.jsx)("line",{x1:0,y1:t,x2:r.width||0,y2:t,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,xn.jsx)(un,{x:a,y:c,text:e.label,textAnchor:l,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:Zt({...e,type:"point"},r),y:Xt({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=(0,Gt.packEnclose)(t),i=e.padding||10;return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("circle",{cx:o.x,cy:o.y,r:o.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,xn.jsx)(un,{x:o.x,y:o.y-o.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:Zt({...e,type:"point"},r),y:Xt({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=ie(i),[c,u]=ie(s),d=a-o,h=l+o,f=c-o;return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("rect",{x:d,y:f,width:h-d,height:u+o-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,xn.jsx)(un,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=r.data||[],o="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,xn.jsx)("g",{children:o.map((t,n)=>{const o=Zt(t,r),s=Xt(t,r);if(null==o||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,xn.jsx)("circle",{cx:o,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Zt(e,r),o=Xt(e,r);return(0,xn.jsx)(qt,{noteData:{x:t??0,y:o??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",s="ordinal"===r.frameType,a="horizontal"===r.projection,l=s?o:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,p=r.scales?.y??r.scales?.value;if(!f||!p)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),o=t-n,i=e(d[n]);return i+(e(d[r])-i)*o},y=f,g=p;let b;if(s)if(a){const e=m(g);b=(t,n)=>[y(n),e(t)]}else{const e=m(y);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[y(e),g(t)];const v=e.method||"linear";let x;if("loess"===v)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:r[e]/l;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*o[e],h+=t*i[e],f+=t*o[e]*o[e],p+=t*o[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*p-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?Yt(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:Ut((n*t[3]-t[0]*t[1])/r),i=Ut(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[Ut(e),Ut(o*e+i)]),equation:[o,i]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),k=e.color||"#6366f1",j=x[x.length-1],[S,M]=b(j[0],j[1]);return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,xn.jsx)("text",{x:S+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=r.scales?.y??r.scales?.value,s=t?.domain?.(),a=e.y0??s?.[0],l=e.y1??s?.[1],c=null!=a&&t?t(a):0,u=null!=l&&t?t(l):r.height||0,d=vn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,xn.jsxs)("g",{opacity:e.opacity,children:[d.def&&(0,xn.jsx)("defs",{children:d.def}),(0,xn.jsx)("rect",{x:0,y:Math.min(c,u),width:r.width||0,height:Math.abs(u-c),fill:d.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,xn.jsx)(un,{x:(r.width||0)-4,y:(o=c,i=u,Math.max(Math.min(o,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=r.scales?.x??r.scales?.time,o=t?.domain?.(),i=e.x0??o?.[0],s=e.x1??o?.[1],a=null!=i&&t?t(i):null,l=null!=s&&t?t(s):null;if(null==a||null==l)return null;const c=vn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,xn.jsxs)("g",{opacity:e.opacity,children:[c.def&&(0,xn.jsx)("defs",{children:c.def}),(0,xn.jsx)("rect",{x:Math.min(a,l),y:0,width:Math.abs(l-a),height:r.height||0,fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,xn.jsx)(un,{x:Math.min(a,l)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[o]-t[o]);if(2>u.length)return null;const d=wn[r.curve||"linear"]||Vt.curveLinear,h=(0,Vt.area)().x(e=>i(e[o])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,xn.jsx)("text",{x:i(u[u.length-1][o])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=r.data||[];if(2>t.length)return null;const o=r.yAccessor||"y",i=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[o]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[o];return null!=t&&Math.abs(t-l)>d*u});return(0,xn.jsxs)("g",{children:[f&&(0,xn.jsx)("rect",{x:0,y:Math.min(b,v),width:r.width||0,height:Math.abs(v-b),fill:p,fillOpacity:m}),x.map((e,t)=>{const n=Zt(e,r),o=Xt(e,r);return null==n||null==o?null:(0,xn.jsx)("circle",{cx:n,cy:o,r:g,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,xn.jsx)("text",{x:(r.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=r.data||[];if(3>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",s=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=Yt(l,e.order||2).equation;c=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=l.length;let t=0,n=0,r=0,o=0;for(const[e,i]of l)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const s=(e*o-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,m=l.reduce((e,t)=>e+(t[0]-p)**2,0),y=e.confidence??.95,g=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;b>=e;e++)w.push(v+e*x);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(m>0?(e-p)**2/m:0))*g;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(v)},${a(c(v))}`,C=e.strokeColor||"#6366f1";return(0,xn.jsxs)("g",{children:[(0,xn.jsx)("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,xn.jsx)("polyline",{points:`${M} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,xn.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let o,i;if(null!=e.px&&null!=e.py)o=e.px,i=e.py;else{const t=Jt(e,n,r);if(!t)return null;o=t.x,i=t.y}if(!en(o,i,r))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,xn.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,xn.jsx)("foreignObject",{x:o+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,xn.jsx)("div",{...zt(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=Jt(e,n,r);if(!t)return null;const{x:o,y:i}=t,s=o+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,xn.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Ot.cloneElement(c,{key:"ann-text-"+n}):(0,xn.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,xn.jsx)("line",{x1:o,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Ot.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const o=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=r.scales?.o,s=r.scales?.x,a=r.scales?.y,l=o(i)?i:o(s)?s:o(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,xn.jsxs)("g",(r.projection?"vertical"===r.projection:l===s)?{children:[(0,xn.jsx)("rect",{x:c,y:0,width:u,height:r.height||0,fill:d,fillOpacity:h}),f&&(0,xn.jsx)(un,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,xn.jsx)("rect",{x:0,y:c,width:r.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,xn.jsx)(un,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var o,i,s}}(0,M),k,o)},[y,w,k,t,n,j,M,S]);return s||a||l||m||R&&R.length>0?(0,sr.jsxs)("svg",{role:"img",width:r,height:o,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,sr.jsx)("title",{children:"string"==typeof a?a:"XY Chart"}),(0,sr.jsx)("desc",{children:"string"==typeof a?a+" (XY data visualization)":"XY data visualization"}),(0,sr.jsxs)("g",{transform:"translate("+i.left+","+i.top+")",children:[R,m]}),a&&"string"==typeof a?(0,sr.jsx)("text",{x:r/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?(0,sr.jsx)("foreignObject",{x:0,y:0,width:r,height:i.top,children:a}):null,ir({legend:l,totalWidth:r,totalHeight:o,margin:i,legendPosition:f,title:a,legendLayout:p,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}):null}l(require("react")),require("d3-shape");var lr=require("d3-shape");function cr(e){switch(e){case"monotoneX":return lr.curveMonotoneX;case"monotoneY":return lr.curveMonotoneY;case"cardinal":return lr.curveCardinal;case"catmullRom":return lr.curveCatmullRom;case"step":return lr.curveStep;case"stepBefore":return lr.curveStepBefore;case"stepAfter":return lr.curveStepAfter;case"basis":return lr.curveBasis;case"natural":return lr.curveNatural;default:return null}}function ur(e,t,n){if(null==t)return n;if(pn(t)){const r=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,r=`${mn(e)}@${n}`,o=gn.get(r);if(void 0!==o)return o;const i=function(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:s=45}=e,a={background:n,stroke:r,lineWidth:o,spacing:i,angle:s},l=Math.max(8,Math.ceil(2*i));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(hn||(hn=document.createElement("canvas")),hn.width=e,hn.height=e,hn)}(l)}catch{return dn(a)}const u=c.getContext("2d");if(!u)return dn(a);n&&"transparent"!==n?(u.fillStyle=n,u.fillRect(0,0,l,l)):u.clearRect(0,0,l,l),u.strokeStyle=r,u.lineWidth=o,u.lineCap="square";const d=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-l;2*l>=t;t+=i)u.beginPath(),u.moveTo(t,0),u.lineTo(t+e*l,l),u.stroke()}else{u.save(),u.translate(l/2,l/2),u.rotate(d);const e=2*l;for(let t=-e;e>=t;t+=i)u.beginPath(),u.moveTo(-e,t),u.lineTo(e,t),u.stroke();u.restore()}return(t||u).createPattern(c,"repeat")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),s=pn(i)?null:i;return gn.set(r,s),s}(t,e);return r||t.background&&gt(e,t.background)||n}return"string"!=typeof t?t:gt(e,t)||n}function dr(e,t){if(null==t)return;const n=ur(e,t,"");return""===n?void 0:n}function hr(e,t,n){const r=t.color??n,o=gt(e,r)||r;if(null==t.opacity)return o;const i=Math.max(0,Math.min(1,t.opacity)),[s,a,l]=function(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const o=e.fillStyle;if(e.fillStyle=n,"string"!=typeof o)return[78,121,167];if(o.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(o.startsWith("#"))return[parseInt(o.slice(1,3),16),parseInt(o.slice(3,5),16),parseInt(o.slice(5,7),16)];const i=o.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}(e,o);return`rgba(${s},${a},${l},${i})`}function fr(e,t,n,r,o,i,s){const a=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(2>a.length)return null;const l=e.createLinearGradient(r,o,i,s);for(const t of a)l.addColorStop(Math.max(0,Math.min(1,t.offset)),hr(e,t,n));return l}function pr(e,t,n){let r=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(r=n.color):e>n.value&&(r=n.color);return r}function mr(e,t,n,r){if(2>e.length||t.length!==e.length||0===n.length)return[];const o=[],i=(e,t,n)=>{const r=o[o.length-1];r?.color===e?r.path.push(n):o.push({color:e,path:[t,n]})};for(let o=1;e.length>o;o++){const[s,a]=e[o-1],[l,c]=e[o],u=t[o-1],d=t[o]-u,h=[0,...0===d?[]:n.map(({value:e})=>(e-u)/d).filter(e=>e>0&&1>e&&Number.isFinite(e)).sort((e,t)=>e-t).filter((e,t,n)=>0===t||e!==n[t-1]),1];for(let e=1;h.length>e;e++){const t=h[e-1],o=h[e];i(pr(u+d*((t+o)/2),n,r),[s+(l-s)*t,a+(c-a)*t],[s+(l-s)*o,a+(c-a)*o])}}return o}var yr=require("react/jsx-runtime");function gr(e,t="#4e79a7"){return pn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}var br=l(require("react")),vr=require("react/jsx-runtime");require("react/jsx-runtime");var xr="undefined"==typeof window||"undefined"==typeof document,wr=require("react"),kr="undefined"!=typeof window?wr.useLayoutEffect:wr.useEffect,jr=()=>()=>{},Sr=()=>!1,Mr=()=>!0,Cr=require("react"),Ar=require("react/jsx-runtime");function Rr({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?(0,Ar.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:(0,Ar.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}var Lr=require("react");function Pr(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function Ir(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 Dr(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}var Tr=l(require("react")),zr=l(require("react")),Nr=(require("react/jsx-runtime"),zr.createContext(null)),Or=require("react/jsx-runtime"),Er={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Br({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,Or.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Er,children:t})}function Hr(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function Wr(e){return e&&"object"==typeof e?e:{}}function _r(e){return Wr(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Fr=require("react/jsx-runtime");function $r(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),r=i.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of s)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}var qr=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Gr="semiotic-accessible-data-table",Vr=Gr+" semiotic-accessible-data-table-hidden",Ur=Gr+" semiotic-accessible-data-table-visible",Yr={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"},Zr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Xr={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)"},Qr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Kr={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))"},Jr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},eo={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},to={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 no({scene:e,chartType:t,tableId:n,chartTitle:r}){const[o,i]=Tr.useState(!1),[s,a]=Tr.useState(5),l=zr.useContext(Nr),c=l?.visible??!1,u=o||c,d=Tr.useRef(null),h=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;Tr.useEffect(()=>{u||a(5)},[u]);const f=Tr.useCallback(e=>{e.target===e.currentTarget&&(o||c||i(!0))},[o,c]),p=Tr.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Fr.jsx)("span",{id:n,tabIndex:-1,style:Er}):null;if(!u)return(0,Fr.jsx)("div",{id:n,className:Vr,tabIndex:-1,onFocus:f,style:Er,role:"region","aria-label":h,children:(0,Fr.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:Hr(_r(r))});break;case"line":case"area":{const e=_r(r),n=Array.isArray(e)?e:[],o="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:o,values:Hr(e)});break}case"rect":{const e=_r(r),n=null!=e&&"object"==typeof e?e:{},o=n.category??r.group??"",i=n.value??n.__aggregateValue??n.total,s=Hr(n);null==s.category&&""!==o&&(s.category=o+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Hr(_r(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=_r(r),n=Hr(e);if(null==n.category){const t=Wr(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:Hr(_r(r))});break;case"arc":t.push({label:"Arc",values:Hr(_r(r))});break;case"candlestick":t.push({label:"Candlestick",values:Hr(_r(r))});break;case"geoarea":{const e=Wr(_r(r)),n=Hr(e);if(null==n.name){const t=Wr(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),y=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 r of t){const t=[],o=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&o.add(e+""))}if(t.length>0){let e=t[0],o=t[0],i=0;for(const n of t)e>n&&(e=n),n>o&&(o=n),i+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:o,mean:i/t.length})}else if(o.size>0){const e=Array.from(o);n.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${qr(e.min)} to ${qr(e.max)}, mean ${qr(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(m.length,y),b=Math.min(s,m.length),v=m.slice(0,b),x=m.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,Fr.jsxs)("div",{ref:d,id:n,className:Ur,tabIndex:-1,onBlur:p,style:Yr,role:"region","aria-label":h,children:[(0,Fr.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Xr,children:"×"}),(0,Fr.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Zr,children:g}),(0,Fr.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Qr,children:[(0,Fr.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:eo,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),(0,Fr.jsx)("thead",{children:(0,Fr.jsxs)("tr",{children:[(0,Fr.jsx)("th",{style:Kr,children:"type"}),k.map(e=>(0,Fr.jsx)("th",{style:Kr,children:e},e))]})}),(0,Fr.jsx)("tbody",{children:v.map((e,t)=>(0,Fr.jsxs)("tr",{children:[(0,Fr.jsx)("td",{style:Jr,children:e.label}),k.map(t=>{return(0,Fr.jsx)("td",{style:Jr,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":qr(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,Fr.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:to,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function ro({summary:e}){return e?(0,Fr.jsx)("div",{role:"note",style:Er,children:e}):null}function oo({tableId:e}){return(0,Fr.jsx)("a",{href:"#"+e,style:Er,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Er)},children:"Skip to data table"})}var io=require("react");var so=Object.freeze([]);function ao(e){if(!e)return so;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var lo=require("react/jsx-runtime"),co="var(--semiotic-focus, #005fcc)";function uo({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==o&&"path"!==o||!a)if("rect"===o&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,lo.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:co,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,lo.jsx)("circle","wedge"===o?{cx:l,cy:c,r:12,fill:"none",stroke:co,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:co,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,lo.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,lo.jsx)("path",{d:a,fill:"none",stroke:co,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,lo.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var ho=l(require("react"));function fo(e,t){return"touch"===t?Math.max(e,24):e}var po=["name","label","title"],mo=["type","kind","category","group","class","status","role","shape"],yo=["value","amount","total","count","weight","score"],go=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function bo(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function vo(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,o=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&go.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&o.push({key:t,lower:t.toLowerCase(),value:n})}if(0===o.length)return{entries:[]};let i=o.findIndex(e=>po.includes(e.lower));const s=i>=0;0>i&&(i=o.findIndex(e=>"id"===e.lower)),0>i&&(i=o.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:o[i];let l=o.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=bo(l,mo),u=bo(l,yo),d=new Set(mo),h=new Set(yo),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}var xo=require("react/jsx-runtime"),wo={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 ko(e,t){return"function"==typeof t?t(e):e[t]}function jo(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 So(e={}){const{fields:t,title:n,format:r,style:o={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=ko(e,n);s=jo(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const s=ko(e,o);a.push({label:n,value:jo(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=jo(e[n],r);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=jo(e[t[0]],r))}}const l={...wo,...o};return(0,xo.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,xo.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,xo.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,xo.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Mo(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Array.isArray(r=!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e)?r[0]:r;var r;if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,xo.jsx)("div",{className:"semiotic-tooltip",style:wo,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?So(e):"multi"===e?("undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip — prefer charts that set tooltipMode (LineChart, AreaChart, StackedAreaChart, DifferenceChart). Rendering MultiLineTooltip content as a fallback.'),function(e={}){const{fields:t=[],title:n,format:r,style:o={},className:i="",showLabels:s=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=ko(e,n);l.push({value:jo(t,r)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const a=jo(ko(e,o),i);l.push({label:s?n:void 0,value:a})});else{const t=vo(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:jo(t.title,r),bold:!0}),t.entries.forEach(e=>{l.push({label:s?e.key:void 0,value:jo(e.value,r)})})}const c={...wo,...o};return Array.isArray(l)&&0!==l.length?(0,xo.jsx)("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>(0,xo.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,xo.jsxs)("strong",{children:[e.label,a]}),e.value]},t))}):null}}()):So())}}var Co=require("react/jsx-runtime");function Ao({x:e,y:t,containerWidth:n,containerHeight:r,margin:o,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=ho.useRef(null),[u,d]=ho.useState(null);ho.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,r,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!ho.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(i),p=f?null:wo;return l?(0,Co.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:o.left+e,top:o.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var Ro=require("d3-zoom"),Lo=require("d3-selection");function Po(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Io(e,t,n=.6){if(!Po(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,o=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(o,i,r,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 Do(e,t,n,r=.35){Po(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var To=require("d3-shape");function zo(e,t,n,r,o,i){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],r=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+r*r))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=r,e.lineCap=i;for(let n=0;t.length-1>n;n++){const r=(s[n]+s[n+1])/2;let i=o;l>r&&(i*=r/l),l>a-r&&(i*=(a-r)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function No(e,t,n,r,o){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=He(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=ur(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,r),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=o*a*(t.style.fillOpacity??1);const u=qe(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ve(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ve(e,i,c,t.accent,void 0,l),e.restore()}function Oo(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),s=Math.round(t[1]*r),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),o.setTransform(a,0,0,l,0,0),o.translate(n.left,n.top),o}function Eo(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}function Bo([e,t,n]){const r=1<<n;return[e-Math.floor(e/r)*r,t,n]}function Ho(e,t,n,r,o){return"function"==typeof e?e(t,n,r,o):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",r+"").replace("{r}",o>1?"@2x":"")}var Wo=class{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,r]of this.cache)t>r.lastUsed&&(t=r.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()}};var _o=class{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,t=Math.random){for(let n=0;this.capacity>n;n++){const r=this.particles[n];if(!r.active)return r.active=!0,r.t=0,r.offset=.6*(t()-.5),r.lineIndex=e,r.x=0,r.y=0,r}return null}step(e,t,n,r){for(let o=0;this.capacity>o;o++){const i=this.particles[o];if(!i.active)continue;const s=n[i.lineIndex];if(!s||2>s.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const a=Fo(s),l=$o(s,i.t*a),c=(r[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}};function Fo(e){let t=0;for(let n=1;e.length>n;n++){const r=e[n][0]-e[n-1][0],o=e[n][1]-e[n-1][1];t+=Math.sqrt(r*r+o*o)}return t}function $o(e,t){let n=0;for(let r=1;e.length>r;r++){const o=e[r][0]-e[r-1][0],i=e[r][1]-e[r-1][1],s=Math.sqrt(o*o+i*i);if(n+s>=t||r===e.length-1){const a=s>0?(t-n)/s:0,l=s>.001?s:1;return{x:e[r-1][0]+o*a,y:e[r-1][1]+i*a,nx:-i/l,ny:o/l}}n+=s}const r=e[e.length-1];return{x:r[0],y:r[1],nx:0,ny:0}}var qo=l(require("react"));function Go(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:qo.createElement(qo.Fragment,null,...t)}var Vo=l(require("react")),Uo=require("react/jsx-runtime"),Yo=Vo.createContext(null);function Zo({value:e,children:t}){return(0,Uo.jsx)(Yo.Provider,{value:e,children:t})}function Xo(e,t){return null!=e?(0,Uo.jsx)(Zo,{value:t,children:e}):e}var Qo=new Set;function Ko(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function Jo(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;Qo.has(n)||(Qo.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function ei(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("glyph"===n.type){const e=n,r=Ge(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+r.centerDx,y:e.y+r.centerDy,r:r.radius})}return t}require("react/jsx-runtime");var ti=require("react/jsx-runtime");function ni({data:e}){if(!e)return null;if(e.properties)return(0,ti.jsx)("div",{className:"semiotic-tooltip",style:wo,children:(0,ti.jsx)("div",{style:{fontWeight:600},children:e.properties.name||e.properties.NAME||e.properties.id||"Feature"})});const t=null!=e.data?e.data:e;if(!t||"object"!=typeof t)return null;const n=vo(t),r=null!=n.title?n.title+"":null;return null==r&&0===n.entries.length?null:(0,ti.jsxs)("div",{className:"semiotic-tooltip",style:wo,children:[null!=r&&(0,ti.jsx)("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:r}),n.entries.map(e=>{return(0,ti.jsxs)("div",{children:[(0,ti.jsxs)("span",{style:{opacity:.7},children:[e.key,": "]}),(0,ti.jsx)("span",{style:{fontWeight:600},children:(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")})]},e.key);var t})]})}ni.ownsChrome=!0;var ri={top:10,right:10,bottom:10,left:10},oi=null;function ii(){if(null!==oi)return oi;if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&4>=navigator.hardwareConcurrency,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return oi=e||t||n}function si(){return ii()?12:30}var ai={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 li(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function ci(e){return e?e.getContext("2d"):null}function ui(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function di(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}var hi=require("react"),fi=require("react");function pi(e){const t=e.datum;return{...t||{},...t?.properties||{},data:t,properties:t?.properties,x:e.x,y:e.y,__semioticHoverData:!0}}var mi=require("react/jsx-runtime"),yi=(0,u.memo)((0,u.forwardRef)(function(e,t){const{projection:n,projectionExtent:r,fitPadding:o,projectionTransform:i,areas:s,points:a,lines:l,customLayout:c,layoutConfig:d,layoutSelection:h,onLayoutError:f,xAccessor:p,yAccessor:m,lineDataAccessor:y,pointIdAccessor:g,lineIdAccessor:b,lineType:v="geo",flowStyle:x="basic",graticule:w,zoomable:k,zoomExtent:j,onZoom:S,dragRotate:M,showParticles:C,particleStyle:A,tileURL:R,tileAttribution:L,tileCacheSize:P,size:I,width:D,height:T,responsiveWidth:z,responsiveHeight:N,margin:O,className:E,background:B,windowSize:H=500,renderMode:W,areaStyle:_,pointStyle:F,lineStyle:$,colorScheme:q,enableHover:G=!0,hoverAnnotation:V,tooltipContent:U,allowTooltipOverflow:Y=!1,customClickBehavior:Z,customHoverBehavior:X,onObservation:Q,annotationObservationCallback:K,chartId:J,annotations:ee,onAnnotationActivate:te,autoPlaceAnnotations:ne,svgAnnotationRules:re,decay:oe,pulse:ie,transition:se,animate:ae,staleness:le,frameScheduler:ce,clock:ue,random:de,seed:he,paused:fe=!1,suspendWhenHidden:pe=!0,backgroundGraphics:me,foregroundGraphics:ye,title:ge,legend:be,legendPosition:ve,legendLayout:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:je,legendIsolatedCategories:Se,legendCategoryAccessor:Me,onCategoriesChange:Ce,showAxes:Le,accessibleTable:Pe=!0,description:Ie,summary:De}=e,{customHoverBehavior:Te,customClickBehavior:Oe,hasClickBehavior:Ee}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r,chartType:o}){return{customHoverBehavior:(0,hi.useCallback)((t,i)=>{e?.(t,i),ui({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:o,chartId:r,context:i})},[r,o,e,n]),customClickBehavior:(0,hi.useCallback)((e,i)=>{t?.(e,i),di({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:o,chartId:r,context:i})},[r,o,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:X,customClickBehavior:Z,onObservation:Q,chartId:J,chartType:"StreamGeoFrame"}),Be=I||[D||600,T||400],We=(0,u.useRef)(!0),Fe=St({sizeProp:Be,responsiveWidth:z,responsiveHeight:N,userMargin:O,marginDefault:ri,title:ge,legend:be,legendPosition:ve,foregroundGraphics:ye,backgroundGraphics:me,animate:ae,transitionProp:se,frameScheduler:ce,clock:ue,random:de,seed:he,paused:fe,suspendWhenHidden:pe,themeDirtyRef:We}),{reducedMotionRef:$e,responsiveRef:Ve,size:Ye,margin:Ze,adjustedWidth:Xe,adjustedHeight:Qe,resolvedForeground:Ke,resolvedBackground:Je,transition:et,introEnabled:nt,tableId:rt,frameRuntime:ot,rafRef:it,renderFnRef:st,scheduleRender:at,currentTheme:lt}=Fe,ct=function(){const[e,t]=(0,wr.useState)(!1);return kr(()=>{t(!0)},[]),e}(),ut=function(){const e=(0,wr.useSyncExternalStore)(jr,Sr,Mr);return(0,wr.useRef)(e).current}(),dt=(0,u.useMemo)(()=>Array.isArray(s)?ao(s):s,[s]),ht=(0,u.useMemo)(()=>ao(a),[a]),ft=(0,u.useMemo)(()=>ao(l),[l]),pt=(0,u.useMemo)(()=>null!=M?M:"orthographic"===li(n),[M,n]),mt=function(e){const t=(0,Lr.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Ir(e,t);if(!Dr(e)||!Dr(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const n=e[r],o=t[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!Ir(n,o))return!1}else{if(!Dr(n)||!Dr(o))return!1;if(!Pr(n,o))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,u.useMemo)(()=>({projection:n,projectionExtent:r,fitPadding:o,xAccessor:p,yAccessor:m,lineDataAccessor:y,lineType:v,flowStyle:x,areaStyle:_,pointStyle:F,lineStyle:$,colorScheme:q,themeSemantic:tt(lt),themeSequential:lt?.colors?.sequential,themeDiverging:lt?.colors?.diverging,themeCategorical:lt?.colors?.categorical,graticule:w,projectionTransform:i,windowSize:H,clock:ot.now,decay:oe,pulse:ie,transition:et,introAnimation:nt,annotations:ee,pointIdAccessor:g,lineIdAccessor:b,customLayout:c,layoutConfig:d,onLayoutError:f,layoutMargin:Ze}),[n,r,o,p,m,y,v,x,_,F,$,q,lt,w,i,H,ot.now,oe,ie,et,nt,ee,g,b,c,d,f,Ze])),yt=(0,u.useRef)(null);yt.current||(yt.current=new Ae(mt));const bt=(0,u.useRef)(null),vt=(0,u.useRef)(null),xt=(0,u.useRef)(null);R&&!xt.current&&(xt.current=new Wo(P||256));const wt=(0,u.useRef)(ee),kt=(0,u.useRef)(null),jt=(0,u.useRef)(Ro.zoomIdentity),Lt=(0,u.useRef)(!1),It=(0,u.useRef)(null),Dt=(0,u.useCallback)(e=>{It.current=e,Ve&&"object"==typeof Ve&&(Ve.current=e)},[Ve]),Tt=(0,u.useRef)(null),zt=(0,u.useRef)(null),Nt=(0,u.useRef)(null),Ot=(0,u.useRef)(0);if(C&&!Nt.current){const e=A?.maxPerLine??si();Nt.current=new _o(50*e)}const Et=(0,u.useRef)(null),Bt=(0,u.useRef)(null),Ht=(0,u.useRef)(!1),Wt=(0,u.useRef)(!1),_t=(0,Re.useRef)(new ze("StreamGeoFrame")),Ft=(0,u.useRef)(void 0),[$t,qt]=(0,u.useState)(null),[,Gt]=(0,u.useState)(0),Vt=(0,u.useRef)(0),[Ut,Yt]=(0,u.useState)(!1),Zt=function(e,t,n,r){const o=(0,io.useRef)({accessor:t,onChange:n,readData:r}),i=(0,io.useRef)([]);return o.current={accessor:t,onChange:n,readData:r},(0,io.useCallback)(()=>{const{accessor:t,onChange:n,readData:r}=o.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,r=[];for(const o of e){if(!o||"object"!=typeof o)continue;const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),r.push(i))}return r}(e.current?r(e.current):[],t);(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})(s,i.current)||(i.current=s,n(s))},[e])}(yt,Me,Ce,e=>e.getPoints());!function(e,t,n,r){(0,Mt.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}(yt,mt,We,at),function(e,t,n,r){const o=(0,Mt.useRef)(null);(0,Mt.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;o.current!==s&&(o.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,r())},[t,r,e,n])}(yt,h,We,at),(0,u.useEffect)(()=>{const e=yt.current;e&&(dt&&e.setAreas(dt),a&&e.setPoints(ht),l&&e.setLines(ft),We.current=!0,at())},[dt,a,ht,l,ft,at]);const Xt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(yt.current?.pushPoint(e),We.current=!0,at())},[at]),Qt=(0,u.useCallback)(e=>{const t=ao(e);0!==t.length&&(yt.current?.pushMany(t),We.current=!0,at())},[at]),Kt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(yt.current?.pushLine(e),We.current=!0,at())},[at]),Jt=(0,u.useCallback)(e=>{const t=ao(e);0!==t.length&&(yt.current?.pushManyLines(t),We.current=!0,at())},[at]),en=(0,u.useCallback)(()=>{yt.current?.clear(),We.current=!0,at()},[at]);(0,u.useImperativeHandle)(t,()=>({push:Xt,pushMany:Qt,removePoint:e=>{const t=yt.current?.removePoint(e)??[];return t.length>0&&(We.current=!0,at()),t},pushLine:Kt,pushManyLines:Jt,removeLine:e=>{const t=yt.current?.removeLine(e)??[];return t.length>0&&(We.current=!0,at()),t},getLines:()=>yt.current?.getLines()??[],clear:en,getProjection:()=>yt.current?.scales?.projection??null,getGeoPath:()=>yt.current?.scales?.geoPath??null,getCartogramLayout:()=>yt.current?.cartogramLayout??null,getCustomLayout:()=>yt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>yt.current?.lastCustomLayoutFailure??null,getZoom:()=>jt.current.k,resetZoom:()=>{const e=It.current;e&&kt.current&&(0,Lo.select)(e).call(kt.current.transform,Ro.zoomIdentity)},getData:()=>yt.current?.getPoints()??[]}),[Xt,Qt,Kt,Jt,en,at]);const{hoverHandlerRef:tn,onPointerMove:nn,onPointerLeave:rn}=Fe,{canvasRef:on,interactionCanvasRef:sn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,s=(0,Cr.useRef)(null),a=(0,Cr.useRef)(null),l=(0,Cr.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:s,cleanup:a}=e;kr(()=>{const e=r.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():o.current=!0,s?.(),i.current()},[t,n]);const l=(0,wr.useRef)(a);l.current=a,(0,wr.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,Cr.useEffect)(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),(0,Cr.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(Fe,{hydrated:ct,wasHydratingFromSSR:ut,storeRef:yt,dirtyRef:We,cleanup:()=>xt.current?.clear(),canvasPaintDependencies:[Xe,Qe,B,me,W,at]});(0,u.useEffect)(()=>{tn.current=e=>{if(!G)return;const t=yt.current;if(!t||!t.scene.length)return;const n=on.current;if(!n)return;const r=n.getBoundingClientRect(),o=e.clientX-r.left-Ze.left,i=e.clientY-r.top-Ze.top;if(0>o||o>Xe||0>i||i>Qe)return Et.current=null,Bt.current=null,qt(null),Te?.(null),void at();vt.current||(vt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=ci(vt.current);if(!s)return;const a=fo(30,e.pointerType),l=fo(6,e.pointerType),c=Ue(t.scene,o,i,a,s,t.quadtree,t.maxPointRadius,l);if(c){const e=c.node,t=e.datum,n=Array.isArray(t)?null:t?.properties?t:t?.data||t;let r,s;"point"===e.type?(r=e.x,s=e.y):"geoarea"===e.type?(r=e.centroid[0],s=e.centroid[1]):(r=o,s=i);const a={...n,...n?.properties||{},data:n,properties:n?.properties,__semioticHoverData:!0,x:r,y:s};Et.current=a,Bt.current=e,qt(a),Te?.(a),at()}else Et.current&&(Et.current=null,Bt.current=null,qt(null),Te?.(null),at())}},[G,Xe,Qe,Ze,Te,at,tn,on]),Fe.hoverLeaveRef.current=()=>{Et.current=null,Bt.current=null,qt(null),Te?.(null),at()};const an=(0,u.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Oe)return;const n=yt.current;if(!n||!n.scene.length)return void Oe(null);const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left-Ze.left,i=e.clientY-r.top-Ze.top;if(0>o||o>Xe||0>i||i>Qe)return void Oe(null);vt.current||(vt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=ci(vt.current);if(!s)return void Oe(null);const a=fo(30,Ft.current),l=fo(6,Ft.current),c=Ue(n.scene,o,i,a,s,n.quadtree,n.maxPointRadius,l);if(c){const e=c.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,n=t?.properties?{...t,...t.properties}:t;return void Oe({...n,data:t,properties:t?.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i},{type:"activate",inputType:(u=Ft.current,"touch"===u?"touch":"pointer")})}var u;Oe(null)},[Qe,Xe,Oe,Ze]),{kbFocusIndexRef:ln,focusedNavPointRef:cn,onKeyDown:un}=function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:o,customClickBehavior:i,scheduleRender:s}){const a=(0,fi.useRef)(-1),l=(0,fi.useRef)(null),c=(0,fi.useCallback)(c=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(c))return;const u=e.current;if(!u)return;const d=()=>{a.current=-1,l.current=null,t.current=null,n&&(n.current=null),r(null),o(null),s()};if(0===u.scene.length)return void(0>a.current||d());const h=function(e){const t=[];for(const n of e)if("point"===n.type&&null!=n.x)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=Ge(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight})}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(u.scene);if(0===h.length)return void(0>a.current||d());let f=a.current;if(h.length>f||(d(),f=-1),("Enter"===c.key||" "===c.key)&&f>=0)return c.preventDefault(),void i(pi(h[f]),{type:"activate",inputType:"keyboard"});const p=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}}(c.key,0>f?-1:f,h.length);if(null===p)return;if(c.preventDefault(),0>p)return void d();const m=0>f?0:p;a.current=m;const y=h[m];l.current=y;const g=pi(y);t.current=g,r(g),o(g,{type:"focus",inputType:"keyboard"}),s()},[i,o,t,n,s,r,e]);return{kbFocusIndexRef:a,focusedNavPointRef:l,onKeyDown:c}}({storeRef:yt,hoverRef:Et,hoveredNodeRef:Bt,setHoverPoint:qt,customHoverBehavior:Te,customClickBehavior:Oe,scheduleRender:at}),dn=(0,u.useCallback)(e=>{Ft.current=e.pointerType,ln.current=-1,cn.current=null,nn(e)},[cn,ln,nn]),hn=(0,u.useCallback)(e=>{Ft.current=e.pointerType},[]);st.current=()=>{if(it.current=null,!ot.isActive)return;const e=on.current,t=yt.current;if(!e||!t)return;const n=ot.now();let r=!1;const o=zt.current;let i=!1;o&&(zt.current=null,t.applyRotation(o,{width:Xe,height:Qe}),i=!0);const s=t.advanceTransition($e.current?n+1e6:n),a=!$e.current&&s,l=_t.current.beforeCompute(t.getLastUpdateResult(),a);let c=!1;if(We.current&&!s){const n={width:Xe,height:Qe},r=t.hasProjection(),o=pt&&r?t.getRotation():null;t.computeScene(n);const i=jt.current,s=1!==i.k||0!==i.x||0!==i.y;pt&&o?s?(t.setRotation(o),t.applyZoomScale(i.k,n)):t.applyRotation(o,n):s&&t.applyZoomTransform(i,n),We.current=!1,c=!0,e.setAttribute("aria-label",$r(t.scene,"Geographic chart")),Zt()}_t.current.afterCompute(l,c,!1);const u=Eo(),d=C&&!$e.current&&!!Nt.current,h=t.consumeStylePaintPending(),f=function(e,t,n,r){const o=r.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!o)&&e.refreshPulse(t);return r.current=s,{changed:a,pending:s}}(t,n,c,Wt),p=!!((m={dirtyOrRebuilt:c,transitioning:a,continuous:d,liveEncoding:f.changed,forced:i||h}).dirtyOrRebuilt||m.transitioning||m.animationTicked||m.continuous||m.liveEncoding||m.forced);var m;if(R&&xt.current){const e=bt.current;if(e&&t.scales?.projection){const n=Oo(e,Ye,Ze,u);if(n){n.clearRect(-Ze.left,-Ze.top,Ye[0],Ye[1]),n.save(),n.beginPath(),n.rect(0,0,Xe,Qe),n.clip();const e=function(e,t){const{tileURL:n,projection:r,width:o,height:i,tileCache:s,onTileLoad:a}=t,l=r.scale(),c=r.translate(),u=function(e){const{size:t,scale:n,translate:r,clampX:o=!0,clampY:i=!0}=e,s=Math.max(Math.log(n)/Math.LN2-8,0),a=Math.round(s),l=1<<a,c=Math.pow(2,s-a+8),u=r[0]-n/2,d=r[1]-n/2,h=Math.max(o?0:-1/0,Math.floor((0-u)/c)),f=Math.min(o?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(i?0:-1/0,Math.floor((0-d)/c)),m=Math.min(i?l:1/0,Math.ceil((t[1]-d)/c)),y=[];for(let e=p;m>e;++e)for(let t=h;f>t;++t)y.push([t,e,a]);return{tiles:y,translate:[u/c,d/c],scale:c}}({size:[o,i],scale:2*l*Math.PI,translate:c}),d=Eo();let h=!0;for(const t of u.tiles){const[r,o,i]=Bo(t),l=`${i}/${r}/${o}`;let c=s.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};s.set(l,t),e.onload=()=>{t.loaded=!0,a?.()},e.onerror=()=>{t.loaded=!0},e.src=Ho(n,i,r,o,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}(n,{tileURL:R,projection:t.scales.projection,width:Xe,height:Qe,tileCache:xt.current,onTileLoad:()=>at()});n.restore(),e||(r=!0)}}}if(p){const o=Oo(e,Ye,Ze,u);if(!o)return;o.clearRect(-Ze.left,-Ze.top,Ye[0],Ye[1]),R||function(e,t){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:o="",x:i=0,y:s=0,width:a,height:l}=t,c=function(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:r=""}=e;return"transparent"===t||n?null:t||(r&&"transparent"!==r?r:"")||null}({background:n,hasBackgroundGraphics:r,themeBackground:o});if(!c)return!1;const u=gt(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(o,{background:B,hasBackgroundGraphics:!!me,width:Xe,height:Qe}),o.save(),o.beginPath(),o.rect(0,0,Xe,Qe),o.clip();const i=t.scene,s={width:Xe,height:Qe};if(function(e){const{context:t,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:i}=e;if(!r||"sketchy"===r)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=Ko(r,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:o})}finally{t.restore()}l||(Jo(n.id,e.type??"unknown"),i([e]))}a()}({context:o,nodes:i,renderMode:W,pixelRatio:u,paintBuiltIn:e=>{!function(e,t){const n=t.filter(e=>"geoarea"===e.type);for(const t of n){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const n=t._cachedPath2D,r=dr(e,t.style.fill)||"#e0e0e0";if("none"!==r&&(e.fillStyle=r,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=gt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=t._decayOpacity??1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(n)}Do(e,t,n),e.globalAlpha=1,e.setLineDash([])}}(o,e),((e,t,n,r)=>{const o=t.filter(e=>"line"===e.type);for(const t of o){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,r.width*n,r.height),e.clip());const o=t.style.stroke||"#007bff",i=gt(e,o)||o,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){zo(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=cr(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let r=0;t.path.length-1>r;r++)e.globalAlpha=.5*(d[r]+d[r+1])*n,e.beginPath(),e.moveTo(t.path[r][0],t.path[r][1]),e.lineTo(t.path[r+1][0],t.path[r+1][1]),e.stroke()}else if(u){const n=mr(t.path,l,a,i);for(const t of n){e.beginPath(),e.strokeStyle=gt(e,t.color)||t.color,e.moveTo(t.path[0][0],t.path[0][1]);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1]);e.stroke()}}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?fr(e,t.strokeGradient,i,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,To.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=ur(e,t.style.fill,t.style.fill),c&&!u)(0,To.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],r.height),e.lineTo(n,r.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(o,e,0,s),((e,t)=>{const n=t.filter(e=>"point"===e.type);if(0!==n.length){e.save();try{const t=e.globalAlpha;for(const r of n)e.beginPath(),e.arc(r.x,r.y,r.r,0,2*Math.PI),e.globalAlpha=t*(r.style.opacity??r.style.fillOpacity??1),e.fillStyle=ur(e,r.style.fill,"#4e79a7"),e.fill(),r.style.stroke&&"none"!==r.style.stroke&&(e.strokeStyle=ur(e,r.style.stroke,r.style.stroke),e.lineWidth=r.style.strokeWidth||1,e.stroke()),Io(e,r)}finally{e.restore()}}})(o,e),((e,t)=>{const n=e.globalAlpha;for(const r of t)"glyph"===r.type&&No(e,r,r.x,r.y,n);e.globalAlpha=n})(o,e)}}),d&&Nt.current){const e=Nt.current,t=i.filter(e=>"line"===e.type);if(t.length>0){const i=A||{},s=.3*(i.speedMultiplier??1),a=i.maxPerLine??si(),l=i.spawnRate??(ii()?.06:.15),c=i.radius??2,u=i.opacity??.7,d=n/1e3,h=Ot.current>0?Math.min(d-Ot.current,.1):.016;Ot.current=d;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth||2);for(let n=0;t.length>n;n++)ot.random()<l&&e.countForLine(n)<a&&e.spawn(n,ot.random);e.step(h,s,f,p),o.globalAlpha=u;for(let n=0;e.particles.length>n;n++){const r=e.particles[n];if(!r.active)continue;const s=t[r.lineIndex],a="function"==typeof i.color?i.color(s?.datum??{}):"source"!==i.color&&i.color?i.color:s?.style.stroke||"#fff";o.beginPath(),o.arc(r.x,r.y,c,0,2*Math.PI),o.fillStyle=a,o.fill()}o.globalAlpha=1,r=!0}}o.restore()}const y=Bt.current,g=!(!y||"geoarea"!==y.type&&"point"!==y.type),b=g||Ht.current;const v=sn.current;if(v&&b){const e=Oo(v,Ye,Ze,u);if(e){if(e.clearRect(-Ze.left,-Ze.top,Ye[0],Ye[1]),y&&"geoarea"===y.type){const t=new Path2D(y.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(t),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(t)}if(y&&"point"===y.type){const t=y,n="object"==typeof V?V:void 0,r=n?.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}(y);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}Ht.current=g}const x=ee!==wt.current;x&&(wt.current=ee),(c||x||a&&ee&&ee.length>0)&&(c||x||n-Vt.current>=33)&&(Gt(e=>e+1),Vt.current=n),(a||null!=t.activeTransition||f.pending||r)&&at()},function(e,t,n,r,o,i){const s=(0,Ct.useRef)("fresh");(0,Ct.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return Rt;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},o=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...At,...e.opacities??{}}[o],band:o,isStale:"fresh"!==o}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Rt}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===o||(s.current=c.band,c.isStale!==o&&i(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(a)},[e,o,r,t,i,n])}(le,yt,We,at,Ut,Yt),(0,u.useEffect)(()=>{if("production"!==process.env.NODE_ENV&&R){const e=li(n);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.`)}},[R,n]),(0,u.useEffect)(()=>{const e=It.current;if(!k||!e)return kt.current&&e&&((0,Lo.select)(e).on(".zoom",null),kt.current=null),void(e&&(0,Lo.select)(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=j||[1,8],r={width:Xe,height:Qe};if(pt){let o=jt.current.k;const i=e=>{o=Math.max(t,Math.min(n,e)),jt.current=Ro.zoomIdentity.scale(o);const i=yt.current;i&&(i.applyZoomScale(o,r),We.current=!1,at(),i.scales?.projection&&S?.({projection:i.scales.projection,zoom:i.currentZoom}))};kt.current={scaleBy:(e,t)=>i(o*t),transform:(e,t)=>i(t?.k??1)};const s=e=>{e.preventDefault(),i(o*(0>e.deltaY?1.1:1/1.1))},a=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*o))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",a);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const r=yt.current;if(!r)return;const o=r.getRotation();Tt.current={x:t.clientX,y:t.clientY,rotation:[...o]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=Tt.current;t&&(zt.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],at())},d=t=>{if(!Tt.current)return;Tt.current=null,e.releasePointerCapture(t.pointerId);const n=zt.current;if(n){zt.current=null;const e=yt.current;e&&(e.applyRotation(n,r),at())}const o=yt.current;o?.scales?.projection&&S?.({projection:o.scales.projection,zoom:o.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",a),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),kt.current=null}}const o=(0,Ro.zoom)().scaleExtent([t,n]).extent([[0,0],[Ye[0],Ye[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;jt.current=t,Lt.current=!0;const n=yt.current;n&&(n.applyZoomTransform(t,r),We.current=!1,at())}).on("end",e=>{jt.current=e.transform,Lt.current=!1;const t=yt.current;t?.scales?.projection&&S?.({projection:t.scales.projection,zoom:t.currentZoom})});return kt.current=o,(0,Lo.select)(e).call(o),()=>{(0,Lo.select)(e).on(".zoom",null)}},[k,j,pt,Ye,Xe,Qe,Ze,S,at]);const fn=G&&!1!==V,mn=fn&&$t?U?U($t):(0,mi.jsx)(ni,{data:$t}):null,yn=mn?(0,mi.jsx)(Ao,{x:$t.x,y:$t.y,containerWidth:Xe,containerHeight:Qe,margin:Ze,className:"stream-frame-tooltip",zIndex:10,children:mn}):null;if(xr||!ct&&ut){const e=yt.current;e&&(dt||a||l)&&(dt&&e.setAreas(dt),a&&e.setPoints(ht),l&&e.setLines(ft),e.computeScene({width:Xe,height:Qe}));const t=e?.scene??[];return(0,mi.jsxs)("div",{ref:Dt,className:"stream-geo-frame"+(E?" "+E:""),role:"img","aria-label":Ie||("string"==typeof ge?ge:"Geographic chart"),style:{position:"relative",width:z?"100%":Ye[0],height:N?"100%":Ye[1]},children:[(0,mi.jsx)(ro,{summary:De}),(0,mi.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ye[0],height:Ye[1],style:{position:"absolute",left:0,top:0},children:[(0,mi.jsx)("g",{transform:`translate(${Ze.left},${Ze.top})`,children:Je}),(0,mi.jsxs)("g",{transform:`translate(${Ze.left},${Ze.top})`,children:[B&&(0,mi.jsx)("rect",{x:0,y:0,width:Xe,height:Qe,fill:B}),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:r,fallback:o}=e,i=Ko(r,t);if(!i)return o();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(Jo(i.id,t.type??"unknown"),o())}({node:e,index:t,renderMode:W,fallback:()=>function(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=pn(n.style.fill)?bn(n.style.fill,`geoarea-${t}-hatch`):void 0;return(0,vr.jsxs)(br.Fragment,{children:[r&&(0,vr.jsx)("defs",{children:r}),(0,vr.jsx)("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:gr(n.style.fill,"#e0e0e0"),fillOpacity:n.style.fillOpacity??1,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth||.5,strokeDasharray:n.style.strokeDasharray,opacity:n._decayOpacity??1})]},"geoarea-"+t)}case"point":{const n=e,r=pn(n.style.fill)?bn(n.style.fill,`geopoint-${t}-hatch`):void 0;return(0,vr.jsxs)(br.Fragment,{children:[r&&(0,vr.jsx)("defs",{children:r}),(0,vr.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:gr(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},"point-"+t)}case"line":{const n=e;if(2>n.path.length)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return(0,vr.jsx)("path",{d:r,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity??1},"line-"+t)}case"glyph":return function(e,t,n,r){const o=e.glyph;if(!o?.parts?.length||0>=e.size)return null;const i=He(o,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=qe(o,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>o.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:_e(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:_e(n.stroke??"none",a,e.accent);return o||i?(0,yr.jsx)("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return(0,yr.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,yr.jsx)("clipPath",{id:c,children:(0,yr.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,yr.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,yr.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}(e,t)}))]})]}),(0,mi.jsx)(ar,{width:Xe,height:Qe,totalWidth:Ye[0],totalHeight:Ye[1],margin:Ze,showAxes:!1,title:ge,legend:be,legendPosition:ve,legendLayout:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:je,legendIsolatedCategories:Se,foregroundGraphics:Go(Ke,Xo(yt.current?.customLayoutOverlays,h??null)),annotations:ee,onAnnotationActivate:te,onObservation:K??Q,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,svgAnnotationRules:re,pointNodes:ei(t),geoProjection:yt.current?.scales?.projectedPoint})]})}return(0,mi.jsxs)("div",{ref:Dt,className:"stream-geo-frame"+(E?" "+E:""),role:"group","aria-label":Ie||("string"==typeof ge?ge:"Geographic chart"),tabIndex:0,style:{position:"relative",width:z?"100%":Ye[0],height:N?"100%":Ye[1],overflow:Y?"visible":"hidden",...k?{touchAction:"none"}:{}},onKeyDown:un,children:["production"!==process.env.NODE_ENV&&yt.current&&(0,mi.jsx)(Ne,{store:yt.current,diagnostics:_t.current}),Pe&&(0,mi.jsx)(oo,{tableId:rt}),Pe&&(0,mi.jsx)(no,{scene:yt.current?.scene??[],chartType:"Geographic chart",tableId:rt,chartTitle:"string"==typeof ge?ge:void 0}),(0,mi.jsx)(ro,{summary:De}),(0,mi.jsx)(Br,{hoverPoint:$t}),(0,mi.jsxs)("div",{role:"img","aria-label":Ie||("string"==typeof ge?ge:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:fn?dn:void 0,onPointerLeave:fn?rn:void 0,onPointerDown:fn||Ee?hn:void 0,onClick:Ee?an:void 0,children:[(0,mi.jsx)(Rr,{size:Ye,margin:Ze,children:Je}),R&&(0,mi.jsx)("canvas",{ref:bt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,mi.jsx)("canvas",{ref:on,"aria-label":$r(yt.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),(0,mi.jsx)("canvas",{ref:sn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,mi.jsx)(ar,{width:Xe,height:Qe,totalWidth:Ye[0],totalHeight:Ye[1],margin:Ze,showAxes:Le,title:ge,legend:be,legendPosition:ve,legendLayout:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:je,legendIsolatedCategories:Se,foregroundGraphics:Go(Ke,Xo(yt.current?.customLayoutOverlays,h??null)),annotations:ee,onAnnotationActivate:te,onObservation:K??Q,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,svgAnnotationRules:re,pointNodes:ei(yt.current?.scene),geoProjection:yt.current?.scales?.projectedPoint}),le?.showBadge&&(0,mi.jsx)(Pt,{isStale:Ut,position:le.badgePosition}),k&&(0,mi.jsxs)("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Ze.bottom+8,left:Ze.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[(0,mi.jsx)("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=It.current,n=kt.current;t&&n?.scaleBy&&n.scaleBy((0,Lo.select)(t),1.5)},style:ai,children:"+"}),(0,mi.jsx)("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=It.current,n=kt.current;t&&n?.scaleBy&&n.scaleBy((0,Lo.select)(t),1/1.5)},style:ai,children:"−"})]}),L&&(0,mi.jsx)("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Ze.bottom+2,right:Ze.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:L}),(0,mi.jsx)(uo,{active:ln.current>=0,hoverPoint:$t,margin:Ze,size:Ye,shape:cn.current?.shape,width:cn.current?.w,height:cn.current?.h,pathData:cn.current?.pathData}),yn]})]})}));yi.displayName="StreamGeoFrame";var gi=yi,bi=require("react");function vi(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}var xi=require("react"),wi=require("react"),ki=(require("react/jsx-runtime"),(0,wi.createContext)(null));function ji(){return(0,wi.useContext)(ki)}function Si(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}var Mi=.5;function Ci(e,t,n){return t?(r,...o)=>{const i={...e(r,...o)};if(t.isActive)if(t.predicate(r))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??Mi;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var Ai=require("react");function Ri(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function Li(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Pi(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Ii,Di]=Je(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,r]of n){const n=t.fields[e];if(!n||!Pi(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),s=Li(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=Li(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}})),Ti=(require("react"),{positions:new Map}),zi=new Set;function Ni(){for(const e of zi)e()}function Oi(e,t){const n=Ti.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(Ti.positions);r.delete(e),Ti={positions:r},Ni()}function Ei(e,t){const n=Ti.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(Ti.positions);r.delete(e),Ti={positions:r},Ni()}function Bi(e){const t=(0,Ai.useId)(),n=e.clientId||t,{name:r}=e,o=Di(e=>e.selections.get(r)),i=Di(e=>e.setClause),s=Di(e=>e.clearClause),a=(0,Ai.useMemo)(()=>!!o&&o.clauses.size>0,[o]);return{predicate:(0,Ai.useMemo)(()=>o&&0!==o.clauses.size?function(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(Ri(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(o,n):()=>!0,[o,n]),isActive:a,selectPoints:(0,Ai.useCallback)(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:(0,Ai.useCallback)(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:(0,Ai.useCallback)(()=>{s(r,n)},[s,r,n]),clientId:n}}function Hi(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:s}=Bi({name:t,fields:n});return{onHover:(0,Ai.useCallback)(e=>{if(!e)return void s();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(t)&&i(t)},[n,i,s]),predicate:r,isActive:o}}var Wi=l(require("react"));function _i(){return ct(e=>e.theme)}function Fi(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function $i(e,t){const{when:n}=e,r=t.width,o=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function qi(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>$i(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])Fi(e[r])&&Fi(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}require("react/jsx-runtime"),Wi.createContext(void 0);var Gi=44,Vi={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Gi,snap:"nearestDatum",brushHandleSize:Gi,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Ui(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!o&&!i)return Vi;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??r??Gi,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Gi,standardControls:a.standardControls??!1}}var Yi={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}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}},Zi={top:10,bottom:10,left:10,right:10};function Xi(e){return e.compactMode?e.marginDefaults:Zi}function Qi(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function Ki(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function Ji(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?{...t,xValue:e.xValue}:t||{}}function es(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var ts=require("react"),ns=require("react"),rs=(require("react/jsx-runtime"),(0,ns.createContext)(!1));(0,ns.createContext)(!1);var os=(0,ns.createContext)(null),is="undefined"==typeof window?ns.useEffect:ns.useLayoutEffect;function ss({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a,additionalLegend:l,chartWidth:c,legendLayout:u,hasTitle:d=!1}){const h=(0,ns.useContext)(rs),f=null!==(0,ns.useContext)(os),p=void 0!==r?r:!h&&!!t,m=!!t&&(p||f),y=(0,ts.useMemo)(()=>{if(!m)return[];if(void 0!==a)return a;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,m]);!function(e){const t=(0,ns.useContext)(os),n=(0,ns.useId)(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),o=(0,ns.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})(o.current,r)||(o.current=r);const i=o.current;is(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),is(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(f&&t?y:[]);const g=(0,ts.useMemo)(()=>{if(!p||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const s=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),a=s?r(s,t,n):n?n(o):W[i%W.length];return{label:o+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:F,categories:y});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[p,t,e,n,y]),b=(0,ts.useMemo)(()=>function(...e){let t;for(const n of e)n&&(t=Fn(t)&&Fn(n)?{legendGroups:[...t.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??t.legendDistance}:n);return t}(g,l),[g,l]),v=(0,ts.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];if(b){const e=function(e,t){return Gn(e,t)+Vn(e)+Un(t)}(b,u),t=Yn(b,Math.max(1,(c??600)-n.left-n.right),u)+Vn(b)+("top"===o&&d?24:0);"right"===o&&!r("right")&&e>n.right?n.right=e:"left"===o&&!r("left")&&e>n.left?n.left=e:"top"!==o||r("top")?"bottom"!==o||r("bottom")||(n.bottom=Math.max(n.bottom,80,t)):n.top=Math.max(n.top,50,t)}return n},[s,i,b,o,c,u,d]);return{legend:b,margin:v,legendPosition:o}}var as=[];function ls(){const e=_i(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function cs({selection:e,linkedHover:t,fallbackFields:n=as,unwrapData:r=!1,onObservation:o,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,xi.useId)(),h=(0,xi.useMemo)(()=>Si(t,n),[t,n]),f=(0,xi.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),p=Bi({name:e?.name||"__unused__",fields:f}),m=Hi({name:h?.name||"hover",fields:f}),y=Tt(e=>e.pushObservation),g=(0,xi.useCallback)(e=>{o?.(e),y?.(e)},[o,y]),b=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,x]=(0,xi.useState)(null),w=(0,xi.useRef)(!1),k=c||n[0],j=(0,xi.useMemo)(()=>{if(!l||null==v||!k)return null;const e=v,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,k]),S=(0,xi.useCallback)((e,n)=>{const r=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=Ki(e,t,h.xField);null!=n&&function(e,t,n){const r=Ti.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(Ti={positions:new Map(Ti.positions).set(e,{xValue:t,sourceId:n})},Ni())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||r||Oi(h.name||"hover",d),"x-position"===h?.mode||r||m.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else r||x(null);(o||y)&&ui({onObservation:g,datum:e?Ji(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,m,h,d,o,i,s,y,g,l,k,u]),M=(0,xi.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&x(null),"x-position"===h?.mode&&(Ei(h.name||"hover",d),Oi(h.name||"hover",d))},[t,h,m,e,u,p,l,d]),C=(0,xi.useCallback)((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Ki(n,e,h.xField);null!=t&&function(e,t,n){const r=Ti.positions.get(e);if(r?.locked){const t=new Map(Ti.positions);return t.delete(e),Ti={positions:t},Ni(),!1}Ti={positions:new Map(Ti.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Ni()}(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const r=Ji(n);if(t&&"x-position"!==h?.mode&&m.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}es(e)&&p.selectPoints(e)}if(l&&k){const e=r?.[k];x(null!=e?e+"":null)}}else b&&M();if(n||b){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(o||y)&&di({onObservation:g,datum:n?Ji(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:r})}},[a,o,y,g,i,s,h,d,u,t,m,e,p,f,l,k,M]);return(0,xi.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,xi.useEffect)(()=>()=>{w.current&&M(!1)},[M]),(0,xi.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Ei(e,d),Oi(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:j,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:d}}function us(e,t,n){return function(e,t,n){const r=Yi[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,s=qi({...t,mode:e},{width:t.width??o,height:t.height??i}).props,a=s.mode||e||"primary",l=Yi[a],c="context"===a||"sparkline"===a,u="primary"===a&&n?.width?n.width:l.width;return{mode:a,width:s.width??u,height:s.height??("primary"===a&&n?.height?n.height:l.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Qi(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Ui(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}(e,t,n)}function ds(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return 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)=>({...e(...t)||{},...n}):(...e)=>({...n})}function hs(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>ps(t(e))}function fs(e,t){const n=hs(t??"value"),r=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=r?r(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function ps(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function ms(e,t,n){const r=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&r!==e.eq)return!1;if(void 0!==e.ne&&r===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(r))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const o=ps(r);if(void 0===o)return!1;if(void 0!==e.gt&&e.gt>=o)return!1;if(void 0!==e.gte&&e.gte>o)return!1;if(void 0!==e.lt&&o>=e.lt)return!1;if(void 0!==e.lte&&o>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>o||o>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(o>=t&&n>=o)return!1}return!0}function ys(e,t,n){const r=e.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(t,n):ms(r,t,n))}function gs(e,t,n){if(!t||0===t.length)return{};let r={};for(const o of t){if(!ys(o,e,n))continue;const t="function"==typeof o.style?o.style(e,n):o.style;t&&(r={...r,...t})}return r}function bs(e,t,n,r=e=>e){const o=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=r(e),a={...o(e,i)};return Object.assign(a,gs(s,t,n(s,i))),a}:o}var vs=require("react/jsx-runtime");function xs({componentName:e,message:t,diagnosticHint:n,width:r,height:o}){return(0,vs.jsx)("div",{role:"alert",style:{width:r,height:Math.max(o,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:(0,vs.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,vs.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,vs.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,vs.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:n})]})})}var ws=l(require("react")),ks=require("react/jsx-runtime"),js=class extends ws.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,ks.jsx)(xs,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},Ss=require("react/jsx-runtime"),Ms="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Cs({componentName:e,width:t,height:n,children:r}){return(0,Ss.jsx)(js,{fallback:r=>(0,Ss.jsx)(xs,{componentName:e,message:r.message,width:t,height:n}),children:r})}var As={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"},Rs={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Ls(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,Ss.jsx)("div",{style:{...As,width:t,height:n},children:r||"No data available"}):null}function Ps(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return(0,Ss.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),s=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(i+s)-s))/2);return(0,Ss.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(e,n)=>(0,Ss.jsx)("div",{className:"semiotic-loading-bar",style:{...Rs,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function Is(e,t,n,r){if(!Ms)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const o=t[0];if(!o||"object"!=typeof o)return;if(r in o)return;const i=Object.keys(o).join(", ");console.warn(`[semiotic] ${e}: ${n} "${r}" not found in data. Available keys: ${i}`)}var Ds=require("react");function Ts(e){const t=ct(e=>e.theme.colors.selectionOpacity);return(0,Ds.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}var zs=require("d3-scale"),Ns=require("react"),Os=require("topojson-client"),Es=new Map;function Bs(e){return"default"in e?e.default:e}var Hs="Install the optional peer dependency `world-atlas` (`npm install world-atlas`) to use built-in reference geographies, or pass GeoJSON Feature[] to `areas`.";async function Ws(e){const t=Es.get(e);if(t)return t;const{topology:n,objectName:r}=await async function(e){try{switch(e){case"world-110m":return{topology:Bs(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Bs(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Bs(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Bs(await import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): ${Hs}`,{cause:t});throw t}}(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 o=(0,Os.feature)(n,n.objects[r]),i="features"in o?o.features:[o];return Es.set(e,i),i}function _s(e){const t=(0,Ns.useMemo)(()=>Array.isArray(e)?e:void 0,[e]),[n,r]=(0,Ns.useState)(null);return(0,Ns.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 r(null),Ws(e).then(e=>{t||r(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".`),r(null)}else r(null)},[e]),void 0!==t?t:n}function Fs(e){const{title:t,description:n,summary:r,accessibleTable:o,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),r&&(c.summary=r),void 0!==o&&(c.accessibleTable=o),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function $s(e){const{linkedHover:t,selection:n,onObservation:r,onClick:o,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};r&&(f.annotationObservationCallback=r);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||r||o||s)&&(f.customHoverBehavior=u),d&&(l||(h?r||o||t:r||o)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=d),null!=p&&(f.hoverRadius=p),f}var qs=require("react/jsx-runtime");function Gs(e){const t=us(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=function(){const e=_i();return e?.colors?.sequential||void 0}(),{areas:r,valueAccessor:o,styleRules:i,colorScheme:s,projection:a="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:h,dragRotate:f,tileURL:p,tileAttribution:m,tileCacheSize:y,tooltip:g,areaOpacity:b=1,annotations:v,margin:x,className:w,selection:k,linkedHover:j,onObservation:S,onClick:M,chartId:C,loading:A,loadingContent:R,emptyContent:L,frameProps:P={},stroke:I,strokeWidth:D,opacity:T}=e,z=u??!!p,N=_s(r),E=(0,bi.useMemo)(()=>N?ao(N):N,[N]),B=(0,bi.useMemo)(()=>"function"==typeof o?o:e=>e?.properties?.[o]??e?.[o],[o]),H=s??n??"blues",W=(0,bi.useMemo)(()=>{if(!E)return(0,zs.scaleSequential)(O(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of E){const r=B(n);null!=r&&isFinite(r)&&(e>r&&(e=r),r>t&&(t=r))}const n=O(H);return(0,zs.scaleSequential)(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[E,B,H]),{activeSelectionHook:_,customHoverBehavior:F,customClickBehavior:$}=cs({selection:k,linkedHover:j,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:C,mobileInteraction:t.mobileInteraction}),q=Ts(k),G=(0,bi.useMemo)(()=>{const e=ds(bs(e=>{const t=B(e);return{fill:null!=t&&isFinite(t)?W(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:b}},i,e=>({value:B(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),{stroke:I,strokeWidth:D,opacity:T});return _?Ci(e,_,q):e},[B,W,_,q,b,I,D,T,i]),V=(0,bi.useMemo)(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=B(e);return(0,qs.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,qs.jsx)("div",{style:{fontWeight:600},children:t}),null!=n&&(0,qs.jsx)("div",{style:{opacity:.7},children:(r=n,"number"==typeof r&&isFinite(r)?Number.isInteger(r)?r.toLocaleString():r.toLocaleString(void 0,{maximumFractionDigits:2}):(r??"")+"")})]});var r},[B]),U=Xi(t),Y=(0,bi.useMemo)(()=>({...U,...vi(x)}),[U,x]),Z=Ps(A,t.width,t.height,R)||(E?null:Ps(!0,t.width,t.height,R)),X=Z?null:Ls(E,t.width,t.height,L);if(Array.isArray(E)&&E.length>0){const e=E[0];if(!e||"object"!=typeof e||!e.geometry)return(0,qs.jsx)(xs,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const Q={projection:a,areas:E,areaStyle:G,size:[t.width,t.height],margin:Y,enableHover:t.enableHover,tooltipContent:!1===g?()=>null:!0===g?V:Mo(g)||V,...null!=l&&{graticule:l},...null!=c&&{fitPadding:c},...z&&{zoomable:!0},...d&&{zoomExtent:d},...h&&{onZoom:h},...null!=f&&{dragRotate:f},...p&&{tileURL:p},...m&&{tileAttribution:m},...y&&{tileCacheSize:y},...$s({linkedHover:j,selection:k,onObservation:S,onClick:M,mobileInteraction:t.mobileInteraction,customHoverBehavior:F,customClickBehavior:$,linkedHoverInClickPredicate:!1}),...v&&v.length>0&&{annotations:v},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...t.title&&{title:t.title},...t.description&&{description:t.description},...t.summary&&{summary:t.summary},...void 0!==t.accessibleTable&&{accessibleTable:t.accessibleTable},...w&&{className:w},...null!=e.animate&&{animate:e.animate},...P};return Z||X||(0,qs.jsx)(Cs,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:(0,qs.jsx)(gi,{...Q})})}Gs.displayName="ChoroplethMap";var Vs=require("react"),Us=require("react");function Ys(e){const{data:t,rawData:n,colorBy:r,colorScheme:o,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:p,legend:m,legendLayout:y,userMargin:g,marginDefaults:b,onClick:v,hoverHighlight:x,mobileInteraction:w,mobileSemantics:k,loading:j,loadingContent:S,emptyContent:M,width:C,height:A,hasTitle:R}=e,L=void 0===n,P=(0,Us.useMemo)(()=>ao(t),[t]),[I,D]=(0,Us.useState)([]),T=(0,Us.useCallback)(e=>{D(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),z="string"==typeof e.colorBy?e.colorBy:void 0,N=(0,Us.useMemo)(()=>Ui(w,{width:C,mobileSemantics:k}),[w,C,k]),{activeSelectionHook:O,hoverSelectionHook:E,customHoverBehavior:B,customClickBehavior:H,crosshairSourceId:_}=cs({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:v,hoverHighlight:x,colorByField:z,mobileInteraction:N}),F=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,_),$=function(e,t,n){const r=ji(),o=ls();return(0,xi.useMemo)(()=>{if(!t)return;const i=r??void 0,s=n??(o&&o.length>0?o:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&es(i)){const e=q(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return q(n.map(e=>({_cat:e})),"_cat",s)}if(i&&es(i)){const n=q(e,t,s);return e=>i[e]||n(e)}return q(e,t,s)}if(i&&es(i)){const e=q([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,r,o])}(P,r,o),G=(0,Us.useMemo)(()=>{if(!r)return[];const e=new Set;for(const t of P){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[P,r]),V=(0,Us.useMemo)(()=>L&&I.length>0?I:G,[L,I,G]),U=function(e,t,n){const[r,o]=(0,ts.useState)(null),[i,s]=(0,ts.useState)(new Set),a=(0,ts.useMemo)(()=>new Set,[]),l=(0,ts.useCallback)(t=>{"highlight"===e&&o(t?t.label:null)},[e]),c=(0,ts.useCallback)(t=>{"isolate"===e&&s(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),u=(0,ts.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=n?e[n]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,r,V),Y=(0,Us.useMemo)(()=>E||(U.legendSelectionHook?U.legendSelectionHook:O),[E,U.legendSelectionHook,O]),Z=Ts(a),X=ls(),Q=ji(),K=(0,Us.useMemo)(()=>{if($)return $;if(!r||0===V.length)return;const e=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:X&&X.length>0?X:W,t="__streamCat",n=q(V.map(e=>({[t]:e})),t,e);return e=>Q?.[e]||n(e)||"#999"},[$,r,V,o,X,Q]),{legend:J,margin:ee,legendPosition:te}=ss({data:P,colorBy:r,colorScale:K,showLegend:p,legendPosition:s,userMargin:g,defaults:b,categories:V,additionalLegend:m,chartWidth:C,legendLayout:y,hasTitle:R}),ne=(0,Us.useMemo)(()=>{const e={};return J&&(e.legend=J,e.legendPosition=te,y&&(e.legendLayout=y)),i&&"none"!==i&&(e.legendHoverBehavior=U.onLegendHover,e.legendClickBehavior=U.onLegendClick,e.legendHighlightedCategory=U.highlightedCategory,e.legendIsolatedCategories=U.isolatedCategories),L&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=T),e},[J,te,y,i,U.onLegendHover,U.onLegendClick,U.highlightedCategory,U.isolatedCategories,L,r,T]),re=Array.isArray(n)?ao(n):n,oe=Ps(j,C,A,S),ie=oe?null:Ls(re,C,A,M);return{data:P,colorScale:$,allCategories:V,legendState:U,effectiveSelectionHook:Y,activeSelectionHook:O,customHoverBehavior:B,customClickBehavior:H,mobileInteraction:N,legend:J,margin:ee,legendPosition:te,earlyReturn:oe||ie||null,legendBehaviorProps:ne,crosshairProps:F,resolvedSelection:Z}}var Zs=require("react");function Xs(e,t){const{variant:n,frameRef:r,overrides:o}=t,i=(0,Zs.useRef)(o);i.current=o,(0,Zs.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],r=e.current?.getTopology()?.nodes??[],o=[];for(const t of n){const n=r.find(e=>e.id===t);n&&o.push({...n.data??{},id:t}),e.current?.removeNode(t)}return o},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const r=e.current?.updateNode(t,n);return r?[{...r,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const r=e.current?.removePoint(t)??[];for(const t of r)e.current?.push(n(t));return r},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const r=n.current?.removeLine(e)??[];for(const e of r)n.current?.pushLine(t(e));return r},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,r);return new Proxy(e,{get(e,t,n){if("string"==typeof t){const e=i.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,n)},has:(e,t)=>!("string"!=typeof t||!i.current||!(t in i.current))||Reflect.has(e,t)})},[])}var Qs={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},Ks=require("react/jsx-runtime"),Js=[3,30],ea=[1,4],ta=(0,Vs.forwardRef)(function(e,t){const n=(0,Vs.useRef)(null);Xs(t,{variant:"geo-points",frameRef:n});const r=us(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:o,xAccessor:i="lon",yAccessor:s="lat",sizeBy:a,sizeRange:l,colorBy:c,styleRules:u,colorScheme:d,projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,areas:k,areaStyle:j=Qs,tooltip:S,annotations:M,margin:C,className:A,selection:R,linkedHover:L,onObservation:P,onClick:I,chartId:D,loading:T,loadingContent:z,emptyContent:N,legendInteraction:O,legendPosition:E,frameProps:B={},stroke:W,strokeWidth:_,opacity:$}=e,q=l??("sparkline"===r.mode?ea:Js),V="sparkline"===r.mode?1.5:6,U=m??!!v,Y=_s(k),Z=Ys({data:o??so,rawData:o,colorBy:c,colorScheme:d,legendInteraction:O,legendPosition:E,selection:R,linkedHover:L,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:P,onClick:I,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:D,showLegend:r.showLegend,userMargin:C,marginDefaults:Xi(r),loading:T,loadingContent:z,emptyContent:N,width:r.width,height:r.height,hasTitle:!!r.title}),X=Z.data,Q=(0,Vs.useMemo)(()=>{if(!a)return;const e="function"==typeof a?a:e=>e?.[a],t=X.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?ie(t):void 0},[X,a]),K=(0,Vs.useMemo)(()=>{const e=ds(bs(e=>({fill:c?F(e,c,Z.colorScale):H,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:a?G(e,a,q,Q):V}),u,fs(c,a)),{stroke:W,strokeWidth:_,opacity:$});return Z.effectiveSelectionHook?Ci(e,Z.effectiveSelectionHook,Z.resolvedSelection):e},[c,Z.colorScale,Z.effectiveSelectionHook,Z.resolvedSelection,a,q,Q,V,W,_,$,u]),J=(0,Vs.useMemo)(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof a?a:null,r=("function"==typeof a?a:e=>e[a])(e),o=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",i="string"==typeof c?c:null,s=i?e?.[i]:null;return(0,Ks.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&(0,Ks.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=r&&(0,Ks.jsxs)("div",{children:[(0,Ks.jsxs)("span",{style:{opacity:.7},children:[n,": "]}),o(r)]}),i&&null!=s&&(0,Ks.jsxs)("div",{children:[(0,Ks.jsxs)("span",{style:{opacity:.7},children:[i,": "]}),s+""]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>(0,Ks.jsxs)("div",{children:[(0,Ks.jsxs)("span",{style:{opacity:.7},children:[e,": "]}),o(t)]},e))]})},[a,c]);if(Z.earlyReturn)return Z.earlyReturn;Is("ProportionalSymbolMap",X,"xAccessor",i),Is("ProportionalSymbolMap",X,"yAccessor",s);const ee={projection:h,...null!=o&&{points:X},xAccessor:i,yAccessor:s,pointStyle:K,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Y&&{areas:Y,areaStyle:j},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...U&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[r.width,r.height],margin:Z.margin,enableHover:r.enableHover,tooltipContent:!1===S?()=>null:Mo(S)||J,...Z.legendBehaviorProps,...$s({linkedHover:L,selection:R,onObservation:P,onClick:I,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior,linkedHoverInClickPredicate:!1}),...M&&M.length>0&&{annotations:M},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...r.title&&{title:r.title},...r.description&&{description:r.description},...r.summary&&{summary:r.summary},...void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable},...A&&{className:A},...null!=e.animate&&{animate:e.animate},...B};return(0,Ks.jsx)(Cs,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:(0,Ks.jsx)(gi,{ref:n,...ee})})});ta.displayName="ProportionalSymbolMap";var na=require("react"),ra=require("d3-scale"),oa=require("react/jsx-runtime"),ia="__semiotic_x",sa="__semiotic_y",aa=(0,na.forwardRef)(function(e,t){const n=us(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:r,nodes:o,nodeIdAccessor:i="id",xAccessor:s="lon",yAccessor:a="lat",valueAccessor:l="value",projection:c="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:f,onZoom:p,dragRotate:m,tileURL:y,tileAttribution:g,tileCacheSize:b,lineType:v="geo",flowStyle:x="basic",areas:w,areaStyle:k=Qs,edgeColorBy:j,edgeOpacity:S=.6,edgeWidthRange:M=[1,8],pointRadius:C,edgeLinecap:A="round",colorScheme:R,showParticles:L,particleStyle:P,tooltip:I,annotations:D,margin:T,className:z,selection:N,linkedHover:O,onObservation:E,onClick:B,chartId:W,loading:_,loadingContent:$,emptyContent:q,frameProps:G={},legendInteraction:V,legendPosition:U,stroke:Y,strokeWidth:Z,opacity:X,lineIdAccessor:Q}=e,K=h??!!y,J=_s(w),ee=(0,na.useMemo)(()=>ao(o),[o]),te=Ys({data:r??so,rawData:r,colorBy:j,colorScheme:R,legendInteraction:V,legendPosition:U,selection:N,linkedHover:O,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:E,onClick:B,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:W,showLegend:n.showLegend,userMargin:T,marginDefaults:Xi(n),loading:_,loadingContent:$,emptyContent:q,width:n.width,height:n.height,hasTitle:!!n.title}),ne=te.data,re=Si(O),oe=Hi({name:re?.name||"hover",fields:re?.fields||[]}),se=Tt(e=>e.pushObservation),ae=(0,na.useMemo)(()=>{const e=new Map;for(const t of ee)e.set(t[i]+"",t);return e},[ee,i]),le=(0,na.useRef)(null),ce=(0,na.useRef)(ae);ce.current=ae;const ue=(0,na.useRef)(s);ue.current=s;const de=(0,na.useRef)(a);de.current=a;const he=(0,na.useCallback)(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ce.current,n=t.get(e.source+""),r=t.get(e.target+"");if(!n||!r)return null;const o="function"==typeof ue.current?ue.current:e=>e[ue.current],i="function"==typeof de.current?de.current:e=>e[de.current];return{...e,coordinates:[{[ia]:o(n),[sa]:i(n)},{[ia]:o(r),[sa]:i(r)}]}},[]);Xs(t,{variant:"geo-lines",frameRef:le,overrides:{push:e=>{const t=he(e);t&&le.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=he(n);e&&t.push(e)}t.length>0&&le.current?.pushManyLines(t)}}});const fe=(0,na.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]),pe=(0,na.useCallback)(e=>{if(O)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=fe.get(t[i]+"");e&&oe.onHover(e)}else oe.onHover(t)}else oe.onHover(null);if(E||se){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:W};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const r={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};E&&E(r),se&&se(r)}else{const e={...t,type:"hover-end"};E&&E(e),se&&se(e)}}},[O,oe,i,fe,E,W,se]),me=te.customClickBehavior,ye=(0,na.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof a?a:e=>e[a];return ne.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const r=ae.get(n.source+""),o=ae.get(n.target+"");return r&&o?{...n,coordinates:[{[ia]:e(r),[sa]:t(r)},{[ia]:e(o),[sa]:t(o)}]}:null}).filter(Boolean)},[ne,ae,s,a]),ge=(0,na.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&ia in t?t[ia]:e(t)},[s]),be=(0,na.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&sa in t?t[sa]:e(t)},[a]),ve=(0,na.useMemo)(()=>{const e=ne.filter(e=>e&&"object"==typeof e).map(e=>e[l]??0).filter(e=>isFinite(e));return 0===e.length?()=>M[0]:(0,ra.scaleLinear)().domain(ie(e)).range(M)},[ne,l,M]),xe=(0,na.useMemo)(()=>e=>({stroke:j?F(e,j,te.colorScale):H,strokeWidth:ve(e[l]??0),strokeLinecap:A,opacity:S}),[j,te.colorScale,ve,l,S,A]),we=(0,na.useMemo)(()=>{const e=ds(xe,{stroke:Y,strokeWidth:Z,opacity:X});if(!te.effectiveSelectionHook)return e;const t={...te.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return Ci(e,te.effectiveSelectionHook,{...te.resolvedSelection||{},unselectedStyle:t})},[xe,te.effectiveSelectionHook,te.resolvedSelection,Y,Z,X]),ke=C??("sparkline"===n.mode?1.5:5),je=(0,na.useMemo)(()=>ds(()=>({fill:"#333",r:ke,fillOpacity:.8}),{stroke:Y,strokeWidth:Z,opacity:X}),[ke,Y,Z,X]),Se=(0,na.useMemo)(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return(0,oa.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,oa.jsx)("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];return(0,oa.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,oa.jsxs)("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&(0,oa.jsx)("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[i];return null!=t?(0,oa.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,oa.jsx)("div",{style:{fontWeight:600},children:t})}):null},[l,i]);if(te.earlyReturn)return te.earlyReturn;const Me={projection:c,...null!=r&&{lines:ye},points:ee,xAccessor:ge,yAccessor:be,lineDataAccessor:"coordinates",...null!=Q&&{lineIdAccessor:Q},lineType:v,flowStyle:x,lineStyle:we,pointStyle:je,...J&&{areas:J,areaStyle:k},...null!=u&&{graticule:u},...null!=d&&{fitPadding:d},...K&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...L&&{showParticles:L},...P&&{particleStyle:P},...y&&{tileURL:y},...g&&{tileAttribution:g},...b&&{tileCacheSize:b},size:[n.width,n.height],margin:te.margin,enableHover:n.enableHover,tooltipContent:!1===I?()=>null:Mo(I)||Se,...te.legendBehaviorProps,...$s({linkedHover:O,selection:N,onObservation:E,onClick:B,mobileInteraction:te.mobileInteraction,customHoverBehavior:pe,customClickBehavior:me,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...z&&{className:z},...null!=e.animate&&{animate:e.animate},...G};return(0,oa.jsx)(Cs,{componentName:"FlowMap",width:n.width,height:n.height,children:(0,oa.jsx)(gi,{ref:le,...Me})})});aa.displayName="FlowMap";var la=require("react"),ca=require("react/jsx-runtime"),ua=(0,la.forwardRef)(function(e,t){const n=us(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:r,lines:o,xAccessor:i="lon",yAccessor:s="lat",nodeIdAccessor:a="id",center:l,costAccessor:c,strength:u=1,lineMode:d="straight",projection:h="mercator",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,transition:k,colorBy:j,styleRules:S,colorScheme:M,pointRadius:C,tooltip:A,showRings:R,showRingLabels:L,ringStyle:P,showNorth:I,costLabel:D,cartogramLayout:T,annotations:z,margin:N,className:O,selection:E,linkedHover:B,onObservation:W,onClick:_,chartId:$,loading:q,loadingContent:G,emptyContent:V,legendPosition:U,frameProps:Y={},stroke:Z,strokeWidth:X,opacity:Q}=e,K="sparkline"===n.mode,J=T??(K?"strip":"radial"),ee=C??(K?1.5:5),te=R??!0,ne=L??("strip"!==J&&!n.compactMode),re=I??("strip"!==J&&!K),oe=m??!!v,ie=(0,la.useMemo)(()=>ao(r),[r]),se=Ys({data:ie,rawData:r,colorBy:j,colorScheme:M,legendInteraction:void 0,legendPosition:U,selection:E,linkedHover:B,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:W,onClick:_,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:$,showLegend:n.showLegend,userMargin:N,marginDefaults:Xi(n),loading:q,loadingContent:G,emptyContent:V,width:n.width,height:n.height,hasTitle:!!n.title}),ae=(0,la.useMemo)(()=>{const e=ds(bs(e=>{const t=e?.[a],n=null!=t&&t+""==l+"";return{fill:j?F(e,j,se.colorScale):H,fillOpacity:n?1:.8,stroke:n?"var(--semiotic-text, #222)":"#fff",strokeWidth:n?1.25:1,r:n?1.35*ee:ee}},S,fs(j)),{stroke:Z,strokeWidth:X,opacity:Q});return se.effectiveSelectionHook?Ci(e,se.effectiveSelectionHook,se.resolvedSelection):e},[j,se.colorScale,se.effectiveSelectionHook,se.resolvedSelection,ee,Z,X,Q,S,l,a]),le=(0,la.useMemo)(()=>({center:l,centerAccessor:a,costAccessor:c,strength:u,lineMode:d,layout:J}),[l,a,c,u,d,J]),ce=(0,la.useMemo)(()=>{if(!o)return;const e="function"==typeof i?i:e=>e[i],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of ie)n.set(e[a]+"",e);return o.map(r=>{if(r.coordinates)return r;const o=n.get(r.source+""),a=n.get(r.target+"");return o&&a?{...r,coordinates:[{[i]:e(o),[s]:t(o)},{[i]:e(a),[s]:t(a)}]}:null}).filter(Boolean)},[o,ie,i,s,a]),ue=(0,la.useMemo)(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e);return(0,ca.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,ca.jsx)("div",{style:{fontWeight:600},children:e[a]||e.name||e.id||"Point"}),null!=t&&(0,ca.jsxs)("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,a]),de=(0,la.useRef)(null);Xs(t,{variant:"geo-points",frameRef:de});const[he,fe]=(0,la.useState)(null),pe=(0,la.useCallback)(()=>{const e=de.current?.getCartogramLayout?.();e&&fe(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius&&t.layout===(e.layout??"radial")?t:{cx:e.cx,cy:e.cy,maxCost:e.maxCost,availableRadius:e.availableRadius,layout:e.layout??"radial"})},[]);(0,la.useEffect)(()=>{const e=requestAnimationFrame(pe);return()=>cancelAnimationFrame(e)},[pe,u,l,n.width,n.height,ie,J]);const me=(0,la.useMemo)(()=>{if(!te||!he)return[];const{maxCost:e}=he;if(0>=e)return[];if(Array.isArray(te))return te.filter(t=>t>0&&e>=t);const t="number"==typeof te?te:Math.min("strip"===he.layout?3:5,Math.max(2,Math.ceil(e/5))),n=e/t,r=[];for(let e=1;t>=e;e++)r.push(Math.round(n*e*10)/10);return r},[te,he]),ye=(0,la.useMemo)(()=>{if(!he)return Y.foregroundGraphics||null;const{cx:e,cy:t,maxCost:n,availableRadius:r,layout:o}=he,i="strip"===o,s={stroke:i?"var(--semiotic-border, #999)":"#999",strokeWidth:i?1:.8,strokeDasharray:i?"none":"4,3",labelColor:"var(--semiotic-text-secondary, #777)",labelSize:i?8:10,...P},a=se.margin.left??10,l=se.margin.top??10,c=e+a,u=t+l;return(0,ca.jsxs)("g",{children:[(0,ca.jsxs)(ca.Fragment,i?{children:[(0,ca.jsx)("line",{x1:c,y1:u,x2:c+r,y2:u,stroke:s.stroke,strokeWidth:s.strokeWidth,strokeLinecap:"round",opacity:.85}),(0,ca.jsx)("line",{x1:c,y1:u-3.5,x2:c,y2:u+3.5,stroke:s.stroke,strokeWidth:s.strokeWidth,opacity:.9}),te&&me.map(e=>{const t=c+(n>0?e/n*r:0);return(0,ca.jsxs)("g",{children:[(0,ca.jsx)("line",{x1:t,y1:u-2.5,x2:t,y2:u+2.5,stroke:s.stroke,strokeWidth:.9,opacity:.65}),ne&&(0,ca.jsxs)("text",{x:t,y:u+Math.min(10,(se.margin.bottom??2)+8),textAnchor:"middle",fontSize:s.labelSize,fill:s.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[e,D?" "+D:""]})]},e)})]}:{children:[me.map(e=>{const t=e/n*r;return(0,ca.jsxs)("g",{children:[(0,ca.jsx)("circle",{cx:c,cy:u,r:t,fill:"none",stroke:s.stroke,strokeWidth:s.strokeWidth,strokeDasharray:s.strokeDasharray,opacity:.5}),ne&&(0,ca.jsxs)("text",{x:c+t+3,y:u-2,fontSize:s.labelSize,fill:s.labelColor,fontFamily:"system-ui, sans-serif",children:[e,D?" "+D:""]})]},e)}),re&&(0,ca.jsxs)("g",{transform:`translate(${a+24}, ${l+24})`,children:[(0,ca.jsx)("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),(0,ca.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"}),(0,ca.jsx)("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),(0,ca.jsx)("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,ca.jsx)("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,ca.jsx)("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]}),Y.foregroundGraphics]})},[he,me,te,ne,re,D,P,se.margin,Y.foregroundGraphics]);if(se.earlyReturn)return se.earlyReturn;Is("DistanceCartogram",ie,"xAccessor",i),Is("DistanceCartogram",ie,"yAccessor",s);const ge={projection:h,...null!=r&&{points:ie},...ce&&{lines:ce,lineDataAccessor:"coordinates"},xAccessor:i,yAccessor:s,pointIdAccessor:a,pointStyle:ae,projectionTransform:le,...k&&{transition:{duration:k}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...oe&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[n.width,n.height],margin:se.margin,enableHover:n.enableHover,tooltipContent:!1===A?()=>null:Mo(A)||ue,...se.legendBehaviorProps,...$s({linkedHover:B,selection:E,onObservation:W,onClick:_,mobileInteraction:se.mobileInteraction,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior,linkedHoverInClickPredicate:!1}),...z&&z.length>0&&{annotations:z},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...O&&{className:O},...null!=e.animate&&{animate:e.animate},...Y,foregroundGraphics:ye};return(0,ca.jsx)(Cs,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:(0,ca.jsx)(gi,{ref:de,...ge})})});ua.displayName="DistanceCartogram";var da=require("react"),ha=require("react");var fa=require("react/jsx-runtime"),pa=(0,da.forwardRef)(function(e,t){const{points:n,areas:r,lines:o,layout:i,layoutConfig:s,onLayoutError:a,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:d,colorBy:h,colorScheme:f,tooltip:p,annotations:m,margin:y,selection:g,linkedHover:b,onObservation:v,onClick:x,chartId:w,loading:k,loadingContent:j,emptyContent:S,className:M,frameProps:C={}}=e,{frameRef:A,resolved:R,normalizedMargin:L}=function(e){const t=(0,ha.useRef)(null);return Xs(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:us(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,ha.useMemo)(()=>vi(e.margin),[e.margin])}}({imperativeRef:t,imperativeVariant:"geo-points",margin:y,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),P=(0,da.useMemo)(()=>ao(n),[n]),I=(0,da.useMemo)(()=>ao(r),[r]),D=(0,da.useMemo)(()=>ao(o),[o]),T=(0,da.useMemo)(()=>[...P,...D,...I],[P,D,I]),z=Ys({data:T,rawData:void 0!==n||void 0!==o||void 0!==r?T:void 0,colorBy:h,colorScheme:f,legendInteraction:void 0,selection:g,linkedHover:b,fallbackFields:"string"==typeof h?[h]:[],unwrapData:!1,onObservation:v,onClick:x,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"GeoCustomChart",chartId:w,showLegend:!1,userMargin:L,marginDefaults:R.marginDefaults,loading:k,loadingContent:j,emptyContent:S,width:R.width,height:R.height,hasTitle:!!R.title}),N=z.effectiveSelectionHook,O=(0,da.useMemo)(()=>N?.isActive?{isActive:!0,predicate:N.predicate}:null,[N?.isActive,N?.predicate]);if(z.earlyReturn)return z.earlyReturn;const{width:E,height:B,enableHover:H,title:W,description:_,summary:F,accessibleTable:$}=R,q=Mo(p),G={projection:l,...null!=n&&{points:P},...null!=r&&{areas:I},...null!=o&&{lines:D},xAccessor:c,yAccessor:u,...null!=d&&{lineDataAccessor:d},customLayout:i,layoutConfig:s,onLayoutError:a,layoutSelection:O,colorBy:h,colorScheme:f,size:[E,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:z.margin,enableHover:H,...Fs({title:W,description:_,summary:F,accessibleTable:$,className:M,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:q?{tooltipContent:q}:{},...$s({linkedHover:b,selection:g,onObservation:v,onClick:x,hoverHighlight:!1,mobileInteraction:z.mobileInteraction,customHoverBehavior:z.customHoverBehavior,customClickBehavior:z.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...C};return(0,fa.jsx)(Cs,{componentName:"GeoCustomChart",width:E,height:B,children:(0,fa.jsx)(gi,{ref:A,...G})})});pa.displayName="GeoCustomChart";var ma={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},ya=8;function ga(e){const t=function(e){return null==e?void 0:e+""}(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??ya,style:{...ma},datum:e.datum,pointId:t,_transitionKey:t}}function ba(e){return ga(e)}function va(e){const[[t,n],[r,o]]=e.bounds;return{type:"geoarea",pathData:e.pathData,centroid:e.centroid,bounds:e.bounds,screenArea:e.screenArea??Math.abs((r-t)*(o-n)),style:{...ma},datum:e.datum,group:e.group,interactive:!0}}function xa(e,t,n){const{featureKey:r,dataKey:o}=n,i=new Map;for(const e of t)i.set(e[o]+"",e);return e.map(e=>{const t=(e=>{const t=r.split(".");let n=e;for(const e of t)n=null!==n&&"object"==typeof n?n[e]:void 0;return(n??"")+""})(e),n=i.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}