semiotic 3.8.3 → 3.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/CLAUDE.md +9 -9
  2. package/README.md +40 -39
  3. package/ai/examples.md +1 -1
  4. package/ai/schema.json +2726 -300
  5. package/ai/surface-manifest.json +1 -1
  6. package/ai/system-prompt.md +1 -1
  7. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
  8. package/dist/chunk-chunk-3ILKBVVQ.module.min.js +1 -0
  9. package/dist/{chunk-chunk-XQYVEKEJ.module.min.js → chunk-chunk-6TPGFL7M.module.min.js} +1 -1
  10. package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
  11. package/dist/chunk-chunk-7KZJUTKP.module.min.js +2 -0
  12. package/dist/chunk-chunk-7RYBCTK5.module.min.js +1 -0
  13. package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
  14. package/dist/{chunk-chunk-AZJUDQRM.module.min.js → chunk-chunk-AQPQN2HH.module.min.js} +1 -1
  15. package/dist/chunk-chunk-ASKSE5F5.module.min.js +1 -0
  16. package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
  17. package/dist/chunk-chunk-B3DRZPBK.module.min.js +2 -0
  18. package/dist/chunk-chunk-BFHUYEOS.module.min.js +2 -0
  19. package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
  20. package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
  21. package/dist/chunk-chunk-F5V4UIE6.module.min.js +2 -0
  22. package/dist/chunk-chunk-F7WFPD4O.module.min.js +2 -0
  23. package/dist/{chunk-chunk-SANERMIZ.module.min.js → chunk-chunk-FBGHXL72.module.min.js} +1 -1
  24. package/dist/chunk-chunk-FP44FHFO.module.min.js +2 -0
  25. package/dist/chunk-chunk-HKXUAEPJ.module.min.js +2 -0
  26. package/dist/chunk-chunk-ICEXPNDC.module.min.js +2 -0
  27. package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
  28. package/dist/{chunk-chunk-7FW6EGLP.module.min.js → chunk-chunk-JDXT6ORT.module.min.js} +1 -1
  29. package/dist/chunk-chunk-JMVEIZXP.module.min.js +1 -0
  30. package/dist/chunk-chunk-KHCOJMGK.module.min.js +1 -0
  31. package/dist/{chunk-chunk-OQTLSTGI.module.min.js → chunk-chunk-KQ546MKE.module.min.js} +1 -1
  32. package/dist/chunk-chunk-LQBSXO7K.module.min.js +2 -0
  33. package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
  34. package/dist/chunk-chunk-MFHF4J2Z.module.min.js +1 -0
  35. package/dist/{chunk-chunk-JNCHKRIR.module.min.js → chunk-chunk-N6VKKF3A.module.min.js} +1 -1
  36. package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
  37. package/dist/chunk-chunk-NKZ75IM5.module.min.js +2 -0
  38. package/dist/chunk-chunk-PLIDPQNG.module.min.js +2 -0
  39. package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
  40. package/dist/chunk-chunk-QGZGZI4X.module.min.js +1 -0
  41. package/dist/chunk-chunk-RP7WTID5.module.min.js +1 -0
  42. package/dist/chunk-chunk-S7KLNUO6.module.min.js +1 -0
  43. package/dist/chunk-chunk-SR4ZXOWR.module.min.js +2 -0
  44. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
  45. package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
  46. package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
  47. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
  48. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
  49. package/dist/components/ChartContainer.d.ts +2 -2
  50. package/dist/components/ai/chartCapabilityTypes.d.ts +5 -0
  51. package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
  52. package/dist/components/charts/geo/DistanceCartogram.d.ts +7 -3
  53. package/dist/components/charts/geo/FlowMap.d.ts +4 -0
  54. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
  55. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
  56. package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
  57. package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
  58. package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
  59. package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
  60. package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
  61. package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
  62. package/dist/components/charts/shared/chartMode.d.ts +8 -0
  63. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
  64. package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
  65. package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
  66. package/dist/components/charts/shared/types.d.ts +2 -2
  67. package/dist/components/charts/shared/validateProps.d.ts +1 -1
  68. package/dist/components/charts/xy/AreaChart.d.ts +10 -0
  69. package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
  70. package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
  71. package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
  72. package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
  73. package/dist/components/realtime/types.d.ts +5 -0
  74. package/dist/components/recipes/gridObservatory.d.ts +176 -0
  75. package/dist/components/recipes/recipeChrome.d.ts +24 -0
  76. package/dist/components/recipes/sequenceLayout.d.ts +139 -0
  77. package/dist/components/semiotic-recipes-core.d.ts +6 -2
  78. package/dist/components/server/staticAnnotations.d.ts +3 -1
  79. package/dist/components/stream/SceneToSVG.d.ts +6 -6
  80. package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
  81. package/dist/components/stream/networkFramePaint.d.ts +2 -0
  82. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
  83. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
  84. package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
  85. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
  86. package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
  87. package/dist/components/stream/sceneToSVGShared.d.ts +30 -1
  88. package/dist/components/stream/types.d.ts +4 -0
  89. package/dist/components/stream/useHydration.d.ts +7 -1
  90. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
  91. package/dist/forceLayoutWorker.js +1 -1
  92. package/dist/geo.min.js +1 -1
  93. package/dist/geo.module.min.js +1 -1
  94. package/dist/network.min.js +1 -1
  95. package/dist/network.module.min.js +1 -1
  96. package/dist/ordinal.min.js +1 -1
  97. package/dist/ordinal.module.min.js +1 -1
  98. package/dist/physics.min.js +1 -1
  99. package/dist/physics.module.min.js +1 -1
  100. package/dist/physicsWorker.js +1 -1
  101. package/dist/realtime.min.js +1 -1
  102. package/dist/realtime.module.min.js +1 -1
  103. package/dist/rough.min.js +1 -1
  104. package/dist/rough.module.min.js +1 -1
  105. package/dist/semiotic-ai-core.min.js +1 -1
  106. package/dist/semiotic-ai-core.module.min.js +1 -1
  107. package/dist/semiotic-ai.min.js +1 -1
  108. package/dist/semiotic-ai.module.min.js +1 -1
  109. package/dist/semiotic-experimental.min.js +1 -1
  110. package/dist/semiotic-experimental.module.min.js +1 -1
  111. package/dist/semiotic-realtime-core.min.js +1 -1
  112. package/dist/semiotic-realtime-core.module.min.js +1 -1
  113. package/dist/semiotic-recipes-core.d.ts +6 -2
  114. package/dist/semiotic-recipes-core.min.js +1 -1
  115. package/dist/semiotic-recipes-core.module.min.js +1 -1
  116. package/dist/semiotic-recipes.min.js +1 -1
  117. package/dist/semiotic-recipes.module.min.js +1 -1
  118. package/dist/semiotic-server-edge.min.js +1 -1
  119. package/dist/semiotic-server-edge.module.min.js +1 -1
  120. package/dist/semiotic-server-node.min.js +1 -1
  121. package/dist/semiotic-server-node.module.min.js +1 -1
  122. package/dist/semiotic-utils-core.min.js +1 -1
  123. package/dist/semiotic-utils-core.module.min.js +1 -1
  124. package/dist/semiotic-utils.min.js +1 -1
  125. package/dist/semiotic-utils.module.min.js +1 -1
  126. package/dist/semiotic-value.module.min.js +1 -1
  127. package/dist/semiotic.min.js +1 -1
  128. package/dist/semiotic.module.min.js +1 -1
  129. package/dist/server.min.js +1 -1
  130. package/dist/server.module.min.js +1 -1
  131. package/dist/xy.min.js +1 -1
  132. package/dist/xy.module.min.js +1 -1
  133. package/package.json +3 -2
  134. package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
  135. package/dist/chunk-chunk-2CCFBTQC.module.min.js +0 -2
  136. package/dist/chunk-chunk-2RXP3FS3.module.min.js +0 -1
  137. package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
  138. package/dist/chunk-chunk-4TMZXLCR.module.min.js +0 -1
  139. package/dist/chunk-chunk-5APBQXZA.module.min.js +0 -1
  140. package/dist/chunk-chunk-6HSGDMTA.module.min.js +0 -2
  141. package/dist/chunk-chunk-7OEOSCBP.module.min.js +0 -1
  142. package/dist/chunk-chunk-A63CTACR.module.min.js +0 -2
  143. package/dist/chunk-chunk-B6V35LMY.module.min.js +0 -2
  144. package/dist/chunk-chunk-BOSVL645.module.min.js +0 -2
  145. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
  146. package/dist/chunk-chunk-F25UA5HT.module.min.js +0 -1
  147. package/dist/chunk-chunk-FRIO6MCV.module.min.js +0 -1
  148. package/dist/chunk-chunk-GWSWSPXN.module.min.js +0 -1
  149. package/dist/chunk-chunk-I6C3KR5H.module.min.js +0 -2
  150. package/dist/chunk-chunk-IP2UE74X.module.min.js +0 -1
  151. package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
  152. package/dist/chunk-chunk-J5RL6GXU.module.min.js +0 -2
  153. package/dist/chunk-chunk-L3H6DQCR.module.min.js +0 -2
  154. package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
  155. package/dist/chunk-chunk-M7VYYHCE.module.min.js +0 -2
  156. package/dist/chunk-chunk-MC35ILYP.module.min.js +0 -2
  157. package/dist/chunk-chunk-N72SWNBV.module.min.js +0 -1
  158. package/dist/chunk-chunk-OBQRFTIL.module.min.js +0 -2
  159. package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
  160. package/dist/chunk-chunk-SA3D43RA.module.min.js +0 -2
  161. package/dist/chunk-chunk-UHSZEB74.module.min.js +0 -1
  162. package/dist/chunk-chunk-Y6AXCRVO.module.min.js +0 -1
  163. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{useChartSetup as t,useCustomChartScaffold as e}from"./chunk-chunk-PLIDPQNG.module.min.js";import{lineCanvasRenderer as n,resolveNodeColor as i}from"./chunk-chunk-6TPGFL7M.module.min.js";import{RingBuffer as o,compactTimestampBufferForRemoval as r,computePulseIntensity as s,hasActivePulses as a,pointCanvasRenderer as c,pushWithTimestamp as l,refreshIdlePulse as u,setPulseState as h,useGeoKeyboardNavigation as d,useLegendCategoryEmission as p,useSemanticFrameInteractions as f}from"./chunk-chunk-F5V4UIE6.module.min.js";import{needsDataCanvasPaint as m,needsInteractionCanvasPaint as g,paintCanvasBackground as y}from"./chunk-chunk-KQ546MKE.module.min.js";import{StalenessBadge as v,attachUpdateResultStore as b,buildBaseMetadataProps as w,buildCustomBehaviorProps as P,composeOverlays as L,computeDecayOpacity as x,createCustomLayoutFailureDiagnostic as S,filterAnnotationsByStatus as R,findHitPointInQuadtree as k,formatVal as A,getHitRadius as C,glyphCanvasRenderer as D,paintSceneWithBackend as j,renderPathPulse as T,renderSceneWithBackend as M,useConfigSync as B,useLayoutSelectionSync as _,useStableShallow as I,useStalenessCheck as E,warnCustomLayoutDiagnostics as N}from"./chunk-chunk-F7WFPD4O.module.min.js";import{wrapWithCustomLayoutSelection as F}from"./chunk-chunk-5UKL5W76.module.min.js";import{buildResolveColor as O,resolveCustomLayoutPalette as W}from"./chunk-chunk-FBGHXL72.module.min.js";import{AccessibleDataTable as H,AriaLiveTooltip as z,CanvasFrameBackground as G,FlippingTooltip as q,FocusRing as Z,STREAMING_PALETTE as X,SceneRevisionDiagnosticsObserver as U,ScreenReaderSummary as Y,SkipToTableLink as Q,TITLE_BASELINE as $,UpdateResultTracker as V,annotationLayout as K,coerceCanvasFill as J,computeCanvasAriaLabel as tt,computeEasing as et,computeRawProgress as nt,createDefaultAnnotationRules as it,defaultTooltipStyle as ot,filterSparseArray as rt,geoSceneNodeToSVG as st,getDevicePixelRatio as at,getPointerHitRadius as ct,isAnnotationActivationTarget as lt,isServerEnvironment as ut,lerp as ht,normalizeTooltip as dt,now as pt,observationInputType as ft,prepareCanvas as mt,renderAnnotationPass as gt,renderLegendFromConfig as yt,resolveCSSColor as vt,smartTooltipEntries as bt,useAnnotationActivationOptions as wt,useFrame as Pt,useFrameCanvasHost as Lt,useSceneRevisionDiagnostics as xt}from"./chunk-chunk-BFHUYEOS.module.min.js";import{getMax as St}from"./chunk-chunk-JJ2OOIET.module.min.js";import{resolveThemeSemanticColors as Rt}from"./chunk-chunk-WCX6U47H.module.min.js";import{glyphHitGeometry as kt}from"./chunk-chunk-KTWEBFMX.module.min.js";import{SafeRender as At,useHydration as Ct,useWasHydratingFromSSR as Dt}from"./chunk-chunk-ACLDBMRH.module.min.js";import{useRef as jt,useState as Tt,useEffect as Mt,useMemo as Bt,useCallback as _t,useImperativeHandle as It,forwardRef as Et,memo as Nt}from"react";import{geoPath as Ft}from"d3-geo";import{quadtree as Ot}from"d3-quadtree";import{geoMercator as Wt,geoEqualEarth as Ht,geoAlbersUsa as zt,geoOrthographic as Gt,geoNaturalEarth1 as qt,geoEquirectangular as Zt}from"d3-geo";var Xt={mercator:Wt,equalEarth:Ht,albersUsa:zt,orthographic:Gt,naturalEarth:qt,equirectangular:Zt};function Ut(t,e){return t?"function"==typeof t?t:e=>e[t]:t=>t[e]}function Yt(t){return t?"function"==typeof t?t:e=>e[t]:t=>t.coordinates||t.data||[]}function Qt(t,e,n){return t?"function"==typeof t?{...n,...t(e)}:{...n,...t}:{...n}}function $t(t,e){if(2>t.length)return[t];const n=.4*e,i=[];let o=[t[0]];for(let e=1;t.length>e;e++){const r=t[e];Math.abs(r[0]-t[e-1][0])>n?(2>o.length||i.push(o),o=[r]):o.push(r)}return 2>o.length||i.push(o),i}function Vt(t,e,n=24){const i=e[0]-t[0],o=e[1]-t[1],r=Math.sqrt(i*i+o*o);if(0===r)return[t,e];const s=-o/r,a=i/r,c=Math.min(.3*r,80),l=(t[0]+e[0])/2+s*c,u=(t[1]+e[1])/2+a*c,h=[];for(let i=0;n>=i;i++){const o=i/n,r=1-o;h.push([r*r*t[0]+2*r*o*l+o*o*e[0],r*r*t[1]+2*r*o*u+o*o*e[1]])}return h}function Kt(t,e){if(2>t.length)return t;const n=e/2+1,i=[];for(let e=0;t.length>e;e++){const o=t[e];let r,s;0===e?(r=t[1][0]-o[0],s=t[1][1]-o[1]):e===t.length-1?(r=o[0]-t[e-1][0],s=o[1]-t[e-1][1]):(r=t[e+1][0]-t[e-1][0],s=t[e+1][1]-t[e-1][1]);const a=Math.sqrt(r*r+s*s)||1;i.push([o[0]+s/a*n,o[1]+-r/a*n])}return i}function Jt(t,e,n,i,o){const r=e[0]-t[0],s=e[1]-t[1],a=Math.sqrt(r*r+s*s);if(0===a)return[t,e];const c=s/a,l=-r/a,u=o/2+1;return[[t[0]+c*u,t[1]+l*u],[e[0]+c*u,e[1]+l*u]]}import{scaleLinear as te}from"d3-scale";var ee=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ne=["scene-style","data-paint","accessibility","evidence"],ie=(t,e)=>({retainedData:t,invalidations:e}),oe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],re=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],se=["scene-geometry","data-paint","accessibility","evidence"],ae=["scene-style","data-paint","accessibility","evidence"],ce=["overlay","accessibility","evidence"],le=[],ue={xAccessor:ie("rebuild",oe),yAccessor:ie("rebuild",oe),lineDataAccessor:ie("rebuild",oe),pointIdAccessor:ie("rebuild",se),lineIdAccessor:ie("rebuild",se),windowSize:ie("rebuild",oe),projection:ie("preserve",re),projectionExtent:ie("preserve",re),fitPadding:ie("preserve",re),lineType:ie("preserve",re),flowStyle:ie("preserve",re),graticule:ie("preserve",re),projectionTransform:ie("preserve",re),customLayout:ie("preserve",re),layoutConfig:ie("preserve",re),layoutMargin:ie("preserve",re),areaStyle:ie("preserve",ae),pointStyle:ie("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:ie("preserve",ae),colorScheme:ie("preserve",ae),themeCategorical:ie("preserve",ae),themeDiverging:ie("preserve",ae),themeSemantic:ie("preserve",ae),themeSequential:ie("preserve",ae),decay:ie("preserve",ae),pulse:ie("preserve",ae),layoutSelection:ie("preserve",ae),annotations:ie("preserve",ce),autoPlaceAnnotations:ie("preserve",ce),clock:ie("preserve",le),transition:ie("preserve",le),introAnimation:ie("preserve",le),onLayoutError:ie("preserve",le)},he=ie("preserve",re),de=class{constructor(){this.tracker=new V}get last(){return this.tracker.last}subscribe(t){return this.tracker.subscribe(t)}recordData(t,e){return this.tracker.record({kind:t,...void 0===e?{}:{count:e}},ee)}recordNoop(t){return this.tracker.record({kind:t,..."restyle"===t?{}:{count:0}},[])}recordRestyle(t){return t?this.tracker.record({kind:"restyle"},ne):this.recordNoop("restyle")}recordConfig(t,e={}){const n=function(t){let e="preserve";const n=new Set;for(const i of t){const t=ue[i]??he;"rebuild"===t.retainedData&&(e="rebuild");for(const e of t.invalidations)n.add(e)}return{retainedData:e,invalidations:n}}(t),i=new Set(n.invalidations);return e.retainedDataChanged&&i.add("data"),this.tracker.record({kind:"config",keys:t},i)}};import{geoDistance as pe,geoGraticule as fe,geoInterpolate as me}from"d3-geo";function ge(t){if(null==t)return 0;if("number"==typeof t&&Number.isFinite(t)&&t>=0&&.5>t)return t;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${t+""}.`)}var ye=class t{constructor(t){this.updateResults=new de,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(t){return{...t,fitPadding:ge(t.fitPadding)}}(t)}currentTime(){return this.config.clock?.()??pt()}getConfiguredWindowSize(){const t=this.config.windowSize??500;if(!Number.isInteger(t)||1>t)throw Error("GeoPipelineStore windowSize must be a positive integer");return t}retainNewestLines(t=this.getConfiguredWindowSize()){this.lineData.length>t&&(this.lineData=this.lineData.slice(-t))}resizeStreamingWindow(t){if(this.pointBuffer){const e=this.pointBuffer.toArray(),n=this.timestampBuffer?.toArray()??[],i=e.slice(-t),r=n.slice(-i.length),s=this.currentTime();this.pointBuffer=new o(t),this.timestampBuffer=new o(t),i.forEach((t,e)=>{this.pointBuffer.push(t),this.timestampBuffer.push(r[e]??s)})}this.retainNewestLines(t)}updateConfig(t){const e=function(t){return"fitPadding"in t?{...t,fitPadding:ge(t.fitPadding)}:t}(t),n=this.config,i=this.getConfiguredWindowSize(),o=Object.keys(e).filter(t=>e[t]!==n[t]);this.config={...this.config,...e};const r=this.getConfiguredWindowSize(),s=this.streaming&&r!==i;s&&(this.resizeStreamingWindow(r),this.version++),"customLayout"in e&&!e.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(o,{retainedDataChanged:s})}updateConfigWithResult(t){return this.updateConfig(t),this.updateResults.last}setAreas(t){this.areas=t,this.updateResults.recordData("replace",t.length)}setAreasWithResult(t){return this.setAreas(t),this.updateResults.last}setPoints(t){this.pointData=t.slice(),this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.updateResults.recordData("replace",t.length)}setPointsWithResult(t){return this.setPoints(t),this.updateResults.last}setLines(t){this.lineData=t.slice(),this.streaming&&this.retainNewestLines(),this.updateResults.recordData("replace",t.length)}setLinesWithResult(t){return this.setLines(t),this.updateResults.last}initStreaming(t){void 0!==t&&t!==this.config.windowSize&&(this.config={...this.config,windowSize:t});const e=this.getConfiguredWindowSize(),n=this.pointBuffer?this.pointBuffer.toArray():this.pointData,i=this.timestampBuffer?.toArray()??[],r=n.slice(-e),s=i.slice(-r.length),a=this.currentTime();this.pointBuffer=new o(e),this.timestampBuffer=new o(e),r.forEach((t,e)=>{this.pointBuffer.push(t),this.timestampBuffer.push(s[e]??a)}),this.pointData=[],this.retainNewestLines(e),this.streaming=!0}pushPoint(t){this.pointBuffer||this.initStreaming();const e=this.currentTime();l(this.pointBuffer,t,this.timestampBuffer,e),this.lastIngestTime=e,this.updateResults.recordData("ingest",1)}pushPointWithResult(t){return this.pushPoint(t),this.updateResults.last}pushMany(t){this.pointBuffer||this.initStreaming();const e=this.currentTime();for(const n of t)l(this.pointBuffer,n,this.timestampBuffer,e);this.lastIngestTime=e,this.updateResults.recordData("ingest",t.length)}pushManyWithResult(t){return this.pushMany(t),this.updateResults.last}pushLine(t){null!=t&&"object"==typeof t?(this.streaming||this.initStreaming(),this.lineData.push(t),this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",1)):this.updateResults.recordNoop("ingest")}pushManyLines(t){if(!Array.isArray(t)||0===t.length)return void this.updateResults.recordNoop("ingest");const e=t.filter(t=>null!=t&&"object"==typeof t);if(0!==e.length){this.streaming||this.initStreaming();for(const t of e)this.lineData.push(t);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",e.length)}else this.updateResults.recordNoop("ingest")}removeLine(t){const{lineIdAccessor:e}=this.config;if(!e)throw Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof e?e:t=>t[e],i=new Set(Array.isArray(t)?t:[t]),o=[];return this.lineData=this.lineData.filter(t=>!i.has(n(t)+"")||(o.push(t),!1)),o.length>0?(this.version++,this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),o}getLines(){return this.lineData.slice()}removePoint(t){const{pointIdAccessor:e}=this.config;if(!e)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof e?e:t=>t[e],i=new Set(Array.isArray(t)?t:[t]);if(this.streaming&&this.pointBuffer){const t=t=>i.has(n(t)+"");r(this.pointBuffer,this.timestampBuffer,t);const e=this.pointBuffer.remove(t);return e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}{const t=[];return this.pointData=this.pointData.filter(e=>!i.has(n(e)+"")||(t.push(e),!1)),t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}}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(t){const e=this._customRestyle;if(e){for(const n of this.scene){const i=this._baseStyles.get(n)??n.style,o=e(n,t);n.style=o?{...i,...o}:i}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(t){const{config:e}=this,n=this.projection,i=this.geoPath,o=this.scales,r=this.baseScale,s=[...this.baseTranslate],a=[...this.baseRotation],c=this.scene;this.projection=function(t){if(!t)return Ht();if("string"==typeof t){const e=Xt[t];return e?e():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${t}", falling back to equalEarth`),Ht())}if("object"==typeof t&&"type"in t){const e=Xt[t.type],n=e?e():Ht();return t.rotate&&"rotate"in n&&n.rotate(t.rotate),t.center&&"center"in n&&n.center(t.center),n}return t}(e.projection),this.geoPath=Ft(this.projection),this.fitProjection(t),this.geoPath=Ft(this.projection);const l=this.projection;this.scales={projection:l,geoPath:this.geoPath,projectedPoint:(t,e)=>l([t,e]),invertedPoint:(t,e)=>l.invert?l.invert([t,e]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(t);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=i,this.scales=o,this.baseScale=r,this.baseTranslate=s,this.baseRotation=a):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,this.rebuildQuadtree(),e.projectionTransform&&this.applyCartogramTransform(e.projectionTransform,t),e.decay&&this.streaming&&this.applyDecay(),e.pulse&&this.streaming&&this.applyPulse(),e.transition&&!this._hasRenderedOnce&&this.scene.length>0&&e.introAnimation){const e=t.width/2,n=t.height/2,i=this.scene.filter(t=>"point"===t.type).map(t=>({...t,x:e,y:n}));i.length>0&&this.startTransition(i)}this._hasRenderedOnce=!0,e.transition&&c.length>0&&this.startTransition(c),this.version++}}fitProjection(t){const e=this.projection,n=this.config,i=[...this.areas],o=Ut(n.xAccessor,"lon"),r=Ut(n.yAccessor,"lat"),s=this.getPoints();if(s.length>0){const t=s.map(t=>[o(t),r(t)]);i.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:t}})}const a=Yt(n.lineDataAccessor);for(const t of this.lineData){const e=a(t);if(e&&e.length>0){const t=e.map(t=>[o(t),r(t)]);i.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:t}})}}if(0!==i.length){if(n.projectionExtent){const[[i,o],[r,s]]=n.projectionExtent;e.fitExtent([[0,0],[t.width,t.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[i,o],[i,s],[r,s],[r,o],[i,o]]]}})}else if(e.clipAngle&&(e.clipAngle()??0)>0){const i=n.fitPadding??0,o=Math.min(t.width,t.height);e.scale(o/2-o*i),e.translate([t.width/2,t.height/2])}else{const o=n.fitPadding??0,r=t.width*o,s=t.height*o;e.fitExtent([[r,s],[t.width-r,t.height-s]],{type:"FeatureCollection",features:i})}this.baseScale=e.scale(),this.baseTranslate=e.translate(),this.baseRotation=e.rotate?.()??[0,0,0]}}applyZoomTransform(t,e){const n=this.projection;if(!n)return;const i=this.geoPath,o=this.scales,r=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*t.k),n.translate([this.baseTranslate[0]*t.k+t.x,this.baseTranslate[1]*t.k+t.y]),this.currentZoom=t.k,this.geoPath=Ft(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(t,e)=>n([t,e]),invertedPoint:(t,e)=>n.invert?n.invert([t,e]):null},this._customLayoutFailedThisBuild=!1;const c=this.buildSceneNodes(e);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(r),n.translate(s),this.currentZoom=a,this.geoPath=i,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=c,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,e),this.version++)}applyZoomScale(t,e){const n=this.projection;if(!n)return;const i=this.geoPath,o=this.scales,r=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*t),n.translate(this.baseTranslate),this.currentZoom=t,this.geoPath=Ft(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(t,e)=>n([t,e]),invertedPoint:(t,e)=>n.invert?n.invert([t,e]):null},this._customLayoutFailedThisBuild=!1;const c=this.buildSceneNodes(e);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(r),n.translate(s),this.currentZoom=a,this.geoPath=i,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=c,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,e),this.version++)}applyRotation(t,e){const n=this.projection;if(!n||!n.rotate)return;const i=this.geoPath,o=this.scales,r=[...n.rotate()];n.rotate(t),this.geoPath=Ft(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(t,e)=>n([t,e]),invertedPoint:(t,e)=>n.invert?n.invert([t,e]):null},this._customLayoutFailedThisBuild=!1;const s=this.buildSceneNodes(e);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(r),this.geoPath=i,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=s,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,e),this.version++)}setRotation(t){const e=this.projection;e&&e.rotate&&e.rotate(t)}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 e=0,n=0;for(const t of this.scene)"point"===t.type&&(n++,t.r>e&&(e=t.r));if(this._maxPointRadius=e,t.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const i=Array(n);let o=0;for(const t of this.scene)"point"===t.type&&(i[o++]=t);this._quadtree=Ot().x(t=>t.x).y(t=>t.y).addAll(i)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(t){this._customLayoutFailedThisBuild=!1;const{config:e}=this,n=this.projection,i=this.geoPath;if(e.customLayout&&this.scales){const n=e.layoutMargin??{top:0,right:0,bottom:0,left:0},i=W(e.colorScheme,e.themeCategorical,X),o={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:t.width,height:t.height,margin:n,plot:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:e.themeSemantic??{},categorical:[...i]},resolveColor:O(i,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};let r;try{r=e.customLayout(o)}catch(t){const n=null!==this.lastCustomLayoutResult,i=S("geo",t,n,this.version);this.lastCustomLayoutFailure=i,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",t);try{e.onLayoutError?.(i)}catch(t){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",t)}return n?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}const s=r.nodes??[];if(this.customLayoutOverlays=r.overlays??null,this.lastCustomLayoutResult=r,this.lastCustomLayoutFailure=null,this._customRestyle=r.restyle,this.hasCustomRestyle=!!r.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const t of s)this._baseStyles.set(t,t.style);this.restyleScene(e.layoutSelection??null)}return N({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:t,projection:e,path:n,areas:i,points:o,lines:r,layout:s}){const a=Ut(t.xAccessor,"lon"),c=Ut(t.yAccessor,"lat"),l=[],u=function(t){return{fill:t.themeSemantic?.surface||"#e0e0e0",stroke:t.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(t),h=function(t){return{stroke:t.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(t),d=function(t){return{fill:t.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(t);if(t.graticule){const e=!0===t.graticule?{}:t.graticule,i=fe();e.step&&i.step(e.step);const o=n(i())||"";o&&l.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:e.stroke||"#e0e0e0",strokeWidth:e.strokeWidth||.5,strokeDasharray:e.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of i){const i=n(e);if(!i)continue;const o=n.centroid(e),r=n.bounds(e),s=n.area(e);l.push({type:"geoarea",pathData:i,centroid:o,bounds:r,screenArea:s,style:Qt(t.areaStyle,e,u),datum:e,interactive:!0})}const p=Yt(t.lineDataAccessor);for(const n of r){const i=p(n);if(!i||2>i.length)continue;let o=[];if("geo"===t.lineType){const t=Array(i.length);for(let e=0;i.length>e;e++)t[e]=[a(i[e]),c(i[e])];for(let n=0;t.length-1>n;n++){const i=t[n],r=t[n+1],s=pe(i,r)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),c=me(i,r);for(let t=0;a>=t;t++){if(n>0&&0===t)continue;const i=e(c(t/a));null!=i&&o.push(i)}}}else for(let t=0;i.length>t;t++){const n=i[t],r=e([a(n),c(n)]);null!=r&&o.push(r)}if(2>o.length)continue;const r=Qt(t.lineStyle,n,h),u="number"==typeof r.strokeWidth?r.strokeWidth:1;2!==i.length||2>o.length||"arc"!==t.flowStyle?2!==i.length||2>o.length||"offset"!==t.flowStyle||(o="geo"===t.lineType?Kt(o,u):Jt(o[0],o[o.length-1],0,0,u)):o=Vt(o[0],o[o.length-1]);const d=$t(o,s.width);if(d.length>1)for(const t of d)2>t.length||l.push({type:"line",path:t,style:{...r,_edgeFade:!0},datum:n});else l.push({type:"line",path:2>o.length&&d[0]||o,style:r,datum:n})}const f=t.pointIdAccessor?"function"==typeof t.pointIdAccessor?t.pointIdAccessor:e=>e[t.pointIdAccessor]:null,m=e.clipAngle?e.clipAngle()??0:0,g=m>0?m*Math.PI/180:null,y=e.rotate?e.rotate():[0,0,0],v="function"==typeof e.center?e.center():[0,0],b=[(v[0]??0)-y[0],(v[1]??0)-y[1]];for(const n of o){const i=a(n),o=c(n);if(null!=g&&pe([i,o],b)>g)continue;const r=e([i,o]);if(!r)continue;const s=t.pointStyle?t.pointStyle(n):{...d},u={type:"point",x:r[0],y:r[1],r:s.r||4,style:s,datum:n,pointId:f?f(n)+"":void 0};l.push(u)}return l}({config:e,projection:n,path:i,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:t})}applyCartogramTransform(t,e){const n=function(t,e,n,i){const o=t.filter(t=>"point"===t.type);if(2>o.length)return null;const r=e.strength??1;if(0===r)return null;const s=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:t=>t.id,a="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=o.find(t=>t.datum&&s(t.datum)+""==e.center+"");if(!c)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`),null;const l=c.x,u=c.y,h=o.map(t=>t.datum?a(t.datum):NaN).filter(t=>isFinite(t)&&t>=0),d=St(h,1),p=Math.min(n.width,n.height)/2,f=te().domain([0,d]).range([0,p]);i>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 e=t.length-1;e>=0;e--){const n=t[e];"geoarea"===n.type&&n.interactive&&t.splice(e,1)}for(const t of o){if(t===c)continue;if(!t.datum)continue;const e=Math.atan2(t.y-u,t.x-l),n=Math.sqrt((t.x-l)**2+(t.y-u)**2),i=a(t.datum),o=n+((isFinite(i)?f(i):n)-n)*r;t.x=l+Math.cos(e)*o,t.y=u+Math.sin(e)*o}const m=n.width/2,g=n.height/2,y=m-c.x,v=g-c.y;if(Math.abs(y)>.5||Math.abs(v)>.5)for(const t of o)t.x+=y,t.y+=v;const b={cx:m,cy:g,maxCost:d,availableRadius:p},w=t.filter(t=>"line"===t.type);if(w.length>0&&"fractional"!==e.lineMode){const t=new Map;for(const e of o)e.pointId&&t.set(e.pointId,[e.x,e.y]);for(const e of w){const n=e.datum?.source,i=e.datum?.target;if(n&&i){const o=t.get(n+""),r=t.get(i+"");o&&r&&(e.path=[o,r])}}}return b}(this.scene,t,e,this.areas.length);n&&(this.cartogramLayout=n)}applyDecay(){const t=this.config.decay;if(!t||!this.pointBuffer)return;const e=this.pointBuffer.size;if(0===e)return;const n=this.scene.filter(t=>"point"===t.type);for(let i=0;n.length>i;i++){const o=x(t,i,e);n[i]._decayOpacity=o,n[i].style={...n[i].style,opacity:o}}}applyPulse(t=this.currentTime()){const e=this.config.pulse;if(!e||!this.timestampBuffer)return!1;const n=this.scene.filter(t=>"point"===t.type),i=this.timestampBuffer.toArray(),o=e.color||"rgba(255,255,255,0.6)",r=e.glowRadius??4;let a=!1;for(let c=0;n.length>c&&i.length>c;c++){const l=s(e,i[c],t);a=h(n[c],l,o,r)||a}return a}refreshPulse(t){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(t)}hasActivePulsesAt(t){return!!this.config.pulse&&a(this.config.pulse,this.timestampBuffer,t)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(t){const e=this.config.transition?.duration??300;if(0>=e)return;const n=new Map;for(const e of t)"point"===e.type&&e.pointId&&n.set(e.pointId,[e.x,e.y]);const i=this.scene.filter(t=>"point"===t.type);let o=!1;for(const t of i)if(t.pointId){const e=n.get(t.pointId);e&&(t._targetX=t.x,t._targetY=t.y,t.x=e[0],t.y=e[1],(Math.abs(e[0]-t._targetX)>.5||Math.abs(e[1]-t._targetY)>.5)&&(o=!0))}for(const t of i)t.pointId&&!n.has(t.pointId)&&(t._targetOpacity=t.style?.opacity??1,t.style={...t.style,opacity:0},o=!0);o&&(this.activeTransition={startTime:this.currentTime(),duration:e})}cancelIntroAnimation(){this.activeTransition=null}advanceTransition(t){if(!this.activeTransition)return!1;const e=nt(t,this.activeTransition),n=et(e),i=this.scene.filter(t=>"point"===t.type);for(const t of i){if(null!=t._targetX&&null!=t._targetY){const e=t.y;t.x=ht(t.x,t._targetX,n),t.y=ht(e,t._targetY,n)}null!=t._targetOpacity&&(t.style={...t.style,opacity:t._targetOpacity*n})}if(e>=1){for(const t of i)null!=t._targetX&&(t.x=t._targetX,t.y=t._targetY,t._targetX=void 0,t._targetY=void 0),null!=t._targetOpacity&&(t.style={...t.style,opacity:t._targetOpacity},t._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}};ye.QUADTREE_THRESHOLD=500;var ve=ye;function be(t,e,n,i,o,r,s=0,a=i){if(r){const t=k(r,e,n,i,s);if(t)return t}else{let o=null,r=i;for(const s of t){if("point"!==s.type)continue;const t=s.x-e,a=s.y-n,c=Math.sqrt(t*t+a*a);C(s.r,i)>=c&&r>c&&(o=s,r=c)}if(o)return{node:o,distance:r}}let c=null,l=i;for(const o of t){if("glyph"!==o.type)continue;if(null==o.datum)continue;const t=kt(o.glyph,o.size),r=o.x+t.centerDx-e,s=o.y+t.centerDy-n,a=Math.sqrt(r*r+s*s);C(t.radius,i)>=a&&l>a&&(c=o,l=a)}if(c)return{node:c,distance:l};for(let i=t.length-1;i>=0;i--){const r=t[i];if("geoarea"!==r.type)continue;const s=r;if(!1===s.interactive)continue;const[[a,c],[l,u]]=s.bounds;if(!(a>e||e>l||c>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),o.isPointInPath(s._cachedPath2D,e,n)))return{node:s,distance:0}}let u=null,h=a;for(const i of t){if("line"!==i.type)continue;const t=i,{path:o}=t,r=Math.max((t.style.strokeWidth||2)+4,5,a);for(let i=0;o.length-1>i;i++){const[s,a]=o[i],[c,l]=o[i+1],d=we(e,n,s,a,c,l);r>=d&&h>d&&(u=t,h=d)}}return u?{node:u,distance:h}:null}function we(t,e,n,i,o,r){const s=o-n,a=r-i,c=s*s+a*a;if(0===c)return Math.sqrt((t-n)**2+(e-i)**2);let l=((t-n)*s+(e-i)*a)/c;return l=Math.max(0,Math.min(1,l)),Math.sqrt((t-(n+l*s))**2+(e-(i+l*a))**2)}b(ve);import{useMemo as Pe,useRef as Le}from"react";import{jsx as xe,jsxs as Se}from"react/jsx-runtime";function Re(t){const{width:e,height:n,totalWidth:i,totalHeight:o,margin:r,showAxes:s,title:a,legend:c,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:d,legendPosition:p,legendLayout:f,foregroundGraphics:m,annotations:g,onAnnotationActivate:y,onObservation:v,chartId:b,chartType:w,autoPlaceAnnotations:P,pointNodes:L,geoProjection:x}=t,S=wt({onAnnotationActivate:y,onObservation:v,chartId:b,chartType:w}),k=Le([g?.length??0,new Map]),A=g?.length??0;k.current[0]!==A&&(k.current=[A,new Map]);const C=Pe(()=>{if(!g||0===g.length)return null;const t=R(g),i=x?t.map(t=>{if(!Array.isArray(t.coordinates)||2>t.coordinates.length)return t;const e=x(Number(t.coordinates[0]),Number(t.coordinates[1]));return e?{...t,x:e[0],y:e[1]}:t}):t,o={scales:{x:t=>Number(t),y:t=>Number(t)},timeAxis:"x",width:e,height:n,frameType:"xy",pointNodes:L,stickyPositionCache:k.current[1]},r=P?K({annotations:i,context:o,..."object"==typeof P?P:{}}):i;return gt(r,it("xy",S),void 0,o)},[g,P,e,n,L,S,x]);return s||a||c||m||C&&C.length>0?Se("svg",{role:"img",width:i,height:o,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[xe("title",{children:"string"==typeof a?a:"XY Chart"}),xe("desc",{children:"string"==typeof a?a+" (XY data visualization)":"XY data visualization"}),Se("g",{transform:"translate("+r.left+","+r.top+")",children:[C,m]}),a&&"string"==typeof a?xe("text",{x:i/2,y:$,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?xe("foreignObject",{x:0,y:0,width:i,height:r.top,children:a}):null,yt({legend:c,totalWidth:i,totalHeight:o,margin:r,legendPosition:p,title:a,legendLayout:f,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:d})]}):null}import{zoom as ke,zoomIdentity as Ae}from"d3-zoom";import{select as Ce}from"d3-selection";function De([t,e,n]){const i=1<<n;return[t-Math.floor(t/i)*i,e,n]}function je(t,e,n,i,o){return"function"==typeof t?t(e,n,i,o):t.replace("{z}",e+"").replace("{x}",n+"").replace("{y}",i+"").replace("{r}",o>1?"@2x":"")}var Te=class{constructor(t=256){this.cache=new Map,this.limit=t}get(t){const e=this.cache.get(t);return e&&(e.lastUsed=performance.now()),e}set(t,e){this.cache.set(t,e),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let t,e=1/0;for(const[n,i]of this.cache)e>i.lastUsed&&(e=i.lastUsed,t=n);if(!t)break;{const e=this.cache.get(t);e&&(e.img.onload=null,e.img.onerror=null,e.img.src=""),this.cache.delete(t)}}}clear(){for(const t of this.cache.values())t.img.onload=null,t.img.onerror=null,t.img.src="";this.cache.clear()}};var Me=class{constructor(t){this.capacity=t,this.particles=Array(t);for(let e=0;t>e;e++)this.particles[e]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(t,e=Math.random){for(let n=0;this.capacity>n;n++){const i=this.particles[n];if(!i.active)return i.active=!0,i.t=0,i.offset=.6*(e()-.5),i.lineIndex=t,i.x=0,i.y=0,i}return null}step(t,e,n,i){for(let o=0;this.capacity>o;o++){const r=this.particles[o];if(!r.active)continue;const s=n[r.lineIndex];if(!s||2>s.length){r.active=!1;continue}if(r.t+=t*e,r.t>=1){r.active=!1;continue}const a=Be(s),c=_e(s,r.t*a),l=(i[r.lineIndex]||2)/2;r.x=c.x+c.nx*r.offset*l*2,r.y=c.y+c.ny*r.offset*l*2}}countForLine(t){let e=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===t&&e++;return e}clear(){for(let t=0;this.capacity>t;t++)this.particles[t].active=!1}};function Be(t){let e=0;for(let n=1;t.length>n;n++){const i=t[n][0]-t[n-1][0],o=t[n][1]-t[n-1][1];e+=Math.sqrt(i*i+o*o)}return e}function _e(t,e){let n=0;for(let i=1;t.length>i;i++){const o=t[i][0]-t[i-1][0],r=t[i][1]-t[i-1][1],s=Math.sqrt(o*o+r*r);if(n+s>=e||i===t.length-1){const a=s>0?(e-n)/s:0,c=s>.001?s:1;return{x:t[i-1][0]+o*a,y:t[i-1][1]+r*a,nx:-r/c,ny:o/c}}n+=s}const i=t[t.length-1];return{x:i[0],y:i[1],nx:0,ny:0}}function Ie(t){if(!t)return;const e=[];for(const n of t)if("point"===n.type)e.push(n);else if("glyph"===n.type){const t=n,i=kt(t.glyph,t.size);e.push({pointId:t.pointId,x:t.x+i.centerDx,y:t.y+i.centerDy,r:i.radius})}return e}import{jsx as Ee,jsxs as Ne}from"react/jsx-runtime";function Fe({data:t}){if(!t)return null;if(t.properties)return Ee("div",{className:"semiotic-tooltip",style:ot,children:Ee("div",{style:{fontWeight:600},children:t.properties.name||t.properties.NAME||t.properties.id||"Feature"})});const e=null!=t.data?t.data:t;if(!e||"object"!=typeof e)return null;const n=bt(e),i=null!=n.title?n.title+"":null;return null==i&&0===n.entries.length?null:Ne("div",{className:"semiotic-tooltip",style:ot,children:[null!=i&&Ee("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:i}),n.entries.map(t=>Ne("div",{children:[Ne("span",{style:{opacity:.7},children:[t.key,": "]}),Ee("span",{style:{fontWeight:600},children:A(t.value)})]},t.key))]})}Fe.ownsChrome=!0;var Oe={top:10,right:10,bottom:10,left:10},We=null;function He(){if(null!==We)return We;if("undefined"==typeof window)return!1;const t="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,e="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&4>=navigator.hardwareConcurrency,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return We=t||e||n}function ze(){return He()?12:30}var Ge={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 qe(t){return"string"==typeof t?t:"object"==typeof t&&t&&"type"in t?t.type:null}function Ze(t){return t?t.getContext("2d"):null}import{jsx as Xe,jsxs as Ue}from"react/jsx-runtime";var Ye=Nt(Et(function(t,e){const{projection:o,projectionExtent:r,fitPadding:s,projectionTransform:a,areas:l,points:h,lines:b,customLayout:w,layoutConfig:P,layoutSelection:x,onLayoutError:S,xAccessor:R,yAccessor:k,lineDataAccessor:A,pointIdAccessor:C,lineIdAccessor:N,lineType:O="geo",flowStyle:W="basic",graticule:X,zoomable:$,zoomExtent:V,onZoom:K,dragRotate:et,showParticles:nt,particleStyle:it,tileURL:ot,tileAttribution:ht,tileCacheSize:dt,size:pt,width:gt,height:yt,responsiveWidth:bt,responsiveHeight:wt,margin:St,className:kt,background:At,windowSize:Et=500,renderMode:Nt,areaStyle:Ft,pointStyle:Ot,lineStyle:Wt,colorScheme:Ht,enableHover:zt=!0,hoverAnnotation:Gt,tooltipContent:qt,allowTooltipOverflow:Zt=!1,customClickBehavior:Xt,customHoverBehavior:Ut,onObservation:Yt,annotationObservationCallback:Qt,chartId:$t,annotations:Vt,onAnnotationActivate:Kt,autoPlaceAnnotations:Jt,decay:te,pulse:ee,transition:ne,animate:ie,staleness:oe,frameScheduler:re,clock:se,random:ae,seed:ce,paused:le=!1,suspendWhenHidden:ue=!0,backgroundGraphics:he,foregroundGraphics:de,title:pe,legend:fe,legendPosition:me,legendLayout:ge,legendHoverBehavior:ye,legendClickBehavior:we,legendHighlightedCategory:Pe,legendIsolatedCategories:Le,legendCategoryAccessor:xe,onCategoriesChange:Se,showAxes:Be,accessibleTable:_e=!0,description:Ee,summary:Ne}=t,{customHoverBehavior:We,customClickBehavior:Ye,hasClickBehavior:Qe}=f({customHoverBehavior:Ut,customClickBehavior:Xt,onObservation:Yt,chartId:$t,chartType:"StreamGeoFrame"}),$e=pt||[gt||600,yt||400],Ve=jt(!0),Ke=Pt({sizeProp:$e,responsiveWidth:bt,responsiveHeight:wt,userMargin:St,marginDefault:Oe,title:pe,legend:fe,legendPosition:me,foregroundGraphics:de,backgroundGraphics:he,animate:ie,transitionProp:ne,frameScheduler:re,clock:se,random:ae,seed:ce,paused:le,suspendWhenHidden:ue,themeDirtyRef:Ve}),{reducedMotionRef:Je,responsiveRef:tn,size:en,margin:nn,adjustedWidth:on,adjustedHeight:rn,resolvedForeground:sn,resolvedBackground:an,transition:cn,introEnabled:ln,tableId:un,frameRuntime:hn,rafRef:dn,renderFnRef:pn,scheduleRender:fn,currentTheme:mn}=Ke,gn=Ct(),yn=Dt(),vn=Bt(()=>Array.isArray(l)?rt(l):l,[l]),bn=Bt(()=>rt(h),[h]),wn=Bt(()=>rt(b),[b]),Pn=Bt(()=>null!=et?et:"orthographic"===qe(o),[et,o]),Ln=Bt(()=>({projection:o,projectionExtent:r,fitPadding:s,xAccessor:R,yAccessor:k,lineDataAccessor:A,lineType:O,flowStyle:W,areaStyle:Ft,pointStyle:Ot,lineStyle:Wt,colorScheme:Ht,themeSemantic:Rt(mn),themeSequential:mn?.colors?.sequential,themeDiverging:mn?.colors?.diverging,themeCategorical:mn?.colors?.categorical,graticule:X,projectionTransform:a,windowSize:Et,clock:hn.now,decay:te,pulse:ee,transition:cn,introAnimation:ln,annotations:Vt,pointIdAccessor:C,lineIdAccessor:N,customLayout:w,layoutConfig:P,onLayoutError:S,layoutMargin:nn}),[o,r,s,R,k,A,O,W,Ft,Ot,Wt,Ht,mn,X,a,Et,hn.now,te,ee,cn,ln,Vt,C,N,w,P,S,nn]),xn=I(Ln),Sn=jt(null);Sn.current||(Sn.current=new ve(xn));const Rn=jt(null),kn=jt(null),An=jt(null);ot&&!An.current&&(An.current=new Te(dt||256));const Cn=jt(Vt),Dn=jt(null),jn=jt(Ae),Tn=jt(!1),Mn=jt(null),Bn=_t(t=>{Mn.current=t,tn&&"object"==typeof tn&&(tn.current=t)},[tn]),_n=jt(null),In=jt(null),En=jt(null),Nn=jt(0);if(nt&&!En.current){const t=it?.maxPerLine??ze();En.current=new Me(50*t)}const Fn=jt(null),On=jt(null),Wn=jt(!1),Hn=jt(!1),zn=xt("StreamGeoFrame"),Gn=jt(void 0),[qn,Zn]=Tt(null),[,Xn]=Tt(0),Un=jt(0),[Yn,Qn]=Tt(!1),$n=p(Sn,xe,Se,t=>t.getPoints());B(Sn,xn,Ve,fn),_(Sn,x,Ve,fn),Mt(()=>{const t=Sn.current;t&&(vn&&t.setAreas(vn),h&&t.setPoints(bn),b&&t.setLines(wn),Ve.current=!0,fn())},[vn,h,bn,b,wn,fn]);const Vn=_t(t=>{null!=t&&"object"==typeof t&&(Sn.current?.pushPoint(t),Ve.current=!0,fn())},[fn]),Kn=_t(t=>{const e=rt(t);0!==e.length&&(Sn.current?.pushMany(e),Ve.current=!0,fn())},[fn]),Jn=_t(t=>{null!=t&&"object"==typeof t&&(Sn.current?.pushLine(t),Ve.current=!0,fn())},[fn]),ti=_t(t=>{const e=rt(t);0!==e.length&&(Sn.current?.pushManyLines(e),Ve.current=!0,fn())},[fn]),ei=_t(()=>{Sn.current?.clear(),Ve.current=!0,fn()},[fn]);It(e,()=>({push:Vn,pushMany:Kn,removePoint:t=>{const e=Sn.current?.removePoint(t)??[];return e.length>0&&(Ve.current=!0,fn()),e},pushLine:Jn,pushManyLines:ti,removeLine:t=>{const e=Sn.current?.removeLine(t)??[];return e.length>0&&(Ve.current=!0,fn()),e},getLines:()=>Sn.current?.getLines()??[],clear:ei,getProjection:()=>Sn.current?.scales?.projection??null,getGeoPath:()=>Sn.current?.scales?.geoPath??null,getCartogramLayout:()=>Sn.current?.cartogramLayout??null,getCustomLayout:()=>Sn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Sn.current?.lastCustomLayoutFailure??null,getZoom:()=>jn.current.k,resetZoom:()=>{const t=Mn.current;t&&Dn.current&&Ce(t).call(Dn.current.transform,Ae)},getData:()=>Sn.current?.getPoints()??[]}),[Vn,Kn,Jn,ti,ei,fn]);const{hoverHandlerRef:ni,onPointerMove:ii,onPointerLeave:oi}=Ke,{canvasRef:ri,interactionCanvasRef:si}=Lt(Ke,{hydrated:gn,wasHydratingFromSSR:yn,storeRef:Sn,dirtyRef:Ve,cleanup:()=>An.current?.clear(),canvasPaintDependencies:[on,rn,At,he,Nt,fn]});Mt(()=>{ni.current=t=>{if(!zt)return;const e=Sn.current;if(!e||!e.scene.length)return;const n=ri.current;if(!n)return;const i=n.getBoundingClientRect(),o=t.clientX-i.left-nn.left,r=t.clientY-i.top-nn.top;if(0>o||o>on||0>r||r>rn)return Fn.current=null,On.current=null,Zn(null),We?.(null),void fn();kn.current||(kn.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=Ze(kn.current);if(!s)return;const a=ct(30,t.pointerType),c=ct(6,t.pointerType),l=be(e.scene,o,r,a,s,e.quadtree,e.maxPointRadius,c);if(l){const t=l.node,e=t.datum,n=Array.isArray(e)?null:e?.properties?e:e?.data||e;let i,s;"point"===t.type?(i=t.x,s=t.y):"geoarea"===t.type?(i=t.centroid[0],s=t.centroid[1]):(i=o,s=r);const a={...n,...n?.properties||{},data:n,properties:n?.properties,__semioticHoverData:!0,x:i,y:s};Fn.current=a,On.current=t,Zn(a),We?.(a),fn()}else Fn.current&&(Fn.current=null,On.current=null,Zn(null),We?.(null),fn())}},[zt,on,rn,nn,We,fn,ni,ri]),Ke.hoverLeaveRef.current=()=>{Fn.current=null,On.current=null,Zn(null),We?.(null),fn()};const ai=_t(t=>{if(lt(t.target))return;if(!Ye)return;const e=Sn.current;if(!e||!e.scene.length)return void Ye(null);const n=t.currentTarget.getBoundingClientRect(),i=t.clientX-n.left-nn.left,o=t.clientY-n.top-nn.top;if(0>i||i>on||0>o||o>rn)return void Ye(null);kn.current||(kn.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=Ze(kn.current);if(!r)return void Ye(null);const s=ct(30,Gn.current),a=ct(6,Gn.current),c=be(e.scene,i,o,s,r,e.quadtree,e.maxPointRadius,a);if(c){const t=c.node.datum,e=Array.isArray(t)?null:t?.properties?t:t?.data||t,n=e?.properties?{...e,...e.properties}:e;return void Ye({...n,data:e,properties:e?.properties,__semioticHoverData:!0,x:i,y:o,time:i,value:o},{type:"activate",inputType:ft(Gn.current)})}Ye(null)},[rn,on,Ye,nn]),{kbFocusIndexRef:ci,focusedNavPointRef:li,onKeyDown:ui}=d({storeRef:Sn,hoverRef:Fn,hoveredNodeRef:On,setHoverPoint:Zn,customHoverBehavior:We,customClickBehavior:Ye,scheduleRender:fn}),hi=_t(t=>{Gn.current=t.pointerType,ci.current=-1,li.current=null,ii(t)},[li,ci,ii]),di=_t(t=>{Gn.current=t.pointerType},[]);pn.current=()=>{if(dn.current=null,!hn.isActive)return;const t=ri.current,e=Sn.current;if(!t||!e)return;const o=hn.now();let r=!1;const s=In.current;let a=!1;s&&(In.current=null,e.applyRotation(s,{width:on,height:rn}),a=!0);const l=e.advanceTransition(Je.current?o+1e6:o),h=!Je.current&&l,d=zn.current.beforeCompute(e.getLastUpdateResult(),h);let p=!1;if(Ve.current&&!l){const n={width:on,height:rn},i=e.hasProjection(),o=Pn&&i?e.getRotation():null;e.computeScene(n);const r=jn.current,s=1!==r.k||0!==r.x||0!==r.y;Pn&&o?s?(e.setRotation(o),e.applyZoomScale(r.k,n)):e.applyRotation(o,n):s&&e.applyZoomTransform(r,n),Ve.current=!1,p=!0,t.setAttribute("aria-label",tt(e.scene,"Geographic chart")),$n()}zn.current.afterCompute(d,p,!1);const f=at(),v=nt&&!Je.current&&!!En.current,b=e.consumeStylePaintPending(),w=u(e,o,p,Hn),P=m({dirtyOrRebuilt:p,transitioning:h,continuous:v,liveEncoding:w.changed,forced:a||b});if(ot&&An.current){const t=Rn.current;if(t&&e.scales?.projection){const n=mt(t,en,nn,f);if(n){n.clearRect(-nn.left,-nn.top,en[0],en[1]),n.save(),n.beginPath(),n.rect(0,0,on,rn),n.clip();const t=function(t,e){const{tileURL:n,projection:i,width:o,height:r,tileCache:s,onTileLoad:a}=e,c=i.scale(),l=i.translate(),u=function(t){const{size:e,scale:n,translate:i,clampX:o=!0,clampY:r=!0}=t,s=Math.max(Math.log(n)/Math.LN2-8,0),a=Math.round(s),c=1<<a,l=Math.pow(2,s-a+8),u=i[0]-n/2,h=i[1]-n/2,d=Math.max(o?0:-1/0,Math.floor((0-u)/l)),p=Math.min(o?c:1/0,Math.ceil((e[0]-u)/l)),f=Math.max(r?0:-1/0,Math.floor((0-h)/l)),m=Math.min(r?c:1/0,Math.ceil((e[1]-h)/l)),g=[];for(let t=f;m>t;++t)for(let e=d;p>e;++e)g.push([e,t,a]);return{tiles:g,translate:[u/l,h/l],scale:l}}({size:[o,r],scale:2*c*Math.PI,translate:l}),h=at();let d=!0;for(const e of u.tiles){const[i,o,r]=De(e),c=`${r}/${i}/${o}`;let l=s.get(c);if(!l){const t=new Image;t.crossOrigin="anonymous";const e={img:t,loaded:!1,key:c,lastUsed:performance.now()};s.set(c,e),t.onload=()=>{e.loaded=!0,a?.()},t.onerror=()=>{e.loaded=!0},t.src=je(n,r,i,o,h),l=e}if(!l.loaded){d=!1;continue}const p=u.scale;t.drawImage(l.img,(e[0]+u.translate[0])*p-.5,(e[1]+u.translate[1])*p-.5,p+1,p+1)}return d}(n,{tileURL:ot,projection:e.scales.projection,width:on,height:rn,tileCache:An.current,onTileLoad:()=>fn()});n.restore(),t||(r=!0)}}}if(P){const i=mt(t,en,nn,f);if(!i)return;i.clearRect(-nn.left,-nn.top,en[0],en[1]),ot||y(i,{background:At,hasBackgroundGraphics:!!he,width:on,height:rn}),i.save(),i.beginPath(),i.rect(0,0,on,rn),i.clip();const s=e.scene,a=e.scales,l={width:on,height:rn};if(j({context:i,nodes:s,renderMode:Nt,pixelRatio:f,paintBuiltIn:t=>{!function(t,e){const n=e.filter(t=>"geoarea"===t.type);for(const e of n){if(!e.pathData)continue;e._cachedPath2D||(e._cachedPath2D=new Path2D(e.pathData));const n=e._cachedPath2D,i=J(t,e.style.fill)||"#e0e0e0";if("none"!==i&&(t.fillStyle=i,t.globalAlpha=(e._decayOpacity??1)*(e.style.fillOpacity??1),t.fill(n)),e.style.stroke&&"none"!==e.style.stroke){if(t.strokeStyle=vt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||.5,t.globalAlpha=e._decayOpacity??1,e.style.strokeDasharray){const n=e.style.strokeDasharray.split(",").map(Number);t.setLineDash(n)}else t.setLineDash([]);t.stroke(n)}T(t,e,n),t.globalAlpha=1,t.setLineDash([])}}(i,t),n(i,t,a,l),c(i,t,a,l),D(i,t,a,l)}}),v&&En.current){const t=En.current,e=s.filter(t=>"line"===t.type);if(e.length>0){const n=it||{},s=.3*(n.speedMultiplier??1),a=n.maxPerLine??ze(),c=n.spawnRate??(He()?.06:.15),l=n.radius??2,u=n.opacity??.7,h=o/1e3,d=Nn.current>0?Math.min(h-Nn.current,.1):.016;Nn.current=h;const p=e.map(t=>t.path),f=e.map(t=>t.style.strokeWidth||2);for(let n=0;e.length>n;n++)hn.random()<c&&t.countForLine(n)<a&&t.spawn(n,hn.random);t.step(d,s,p,f),i.globalAlpha=u;for(let o=0;t.particles.length>o;o++){const r=t.particles[o];if(!r.active)continue;const s=e[r.lineIndex],a="function"==typeof n.color?n.color(s?.datum??{}):"source"!==n.color&&n.color?n.color:s?.style.stroke||"#fff";i.beginPath(),i.arc(r.x,r.y,l,0,2*Math.PI),i.fillStyle=a,i.fill()}i.globalAlpha=1,r=!0}}i.restore()}const L=On.current,x=!(!L||"geoarea"!==L.type&&"point"!==L.type),S=g(x,Wn.current),R=si.current;if(R&&S){const t=mt(R,en,nn,f);if(t){if(t.clearRect(-nn.left,-nn.top,en[0],en[1]),L&&"geoarea"===L.type){const e=new Path2D(L.pathData);t.fillStyle="rgba(255, 255, 255, 0.3)",t.fill(e),t.strokeStyle="rgba(0, 0, 0, 0.5)",t.lineWidth=2,t.stroke(e)}if(L&&"point"===L.type){const e=L,n="object"==typeof Gt?Gt:void 0,o=n?.pointColor||i(L);t.beginPath(),t.arc(e.x,e.y,e.r+3,0,2*Math.PI),o?(t.save(),t.globalAlpha=.4,t.fillStyle=o,t.fill(),t.restore()):(t.fillStyle="rgba(255, 255, 255, 0.4)",t.fill()),t.strokeStyle=o||"rgba(0, 0, 0, 0.5)",t.lineWidth=2,t.stroke()}}Wn.current=x}const k=Vt!==Cn.current;k&&(Cn.current=Vt),(p||k||h&&Vt&&Vt.length>0)&&(p||k||o-Un.current>=33)&&(Xn(t=>t+1),Un.current=o),(h||null!=e.activeTransition||w.pending||r)&&fn()},E(oe,Sn,Ve,fn,Yn,Qn),Mt(()=>{if("production"!==process.env.NODE_ENV&&ot){const t=qe(o);t&&"mercator"!==t&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${t}". Raster tiles use Web Mercator and will not align with other projections.`)}},[ot,o]),Mt(()=>{const t=Mn.current;if(!$||!t)return Dn.current&&t&&(Ce(t).on(".zoom",null),Dn.current=null),void(t&&Ce(t).on("mousedown.rotate",null).on("touchstart.rotate",null));const[e,n]=V||[1,8],i={width:on,height:rn};if(Pn){let o=jn.current.k;const r=t=>{o=Math.max(e,Math.min(n,t)),jn.current=Ae.scale(o);const r=Sn.current;r&&(r.applyZoomScale(o,i),Ve.current=!1,fn(),r.scales?.projection&&K?.({projection:r.scales.projection,zoom:r.currentZoom}))};Dn.current={scaleBy:(t,e)=>r(o*e),transform:(t,e)=>r(e?.k??1)};const s=t=>{t.preventDefault(),r(o*(0>t.deltaY?1.1:1/1.1))},a=t=>{const e=t.target;e&&(e.closest("button")||e.closest(".stream-geo-zoom-controls"))||(t.preventDefault(),r(1.5*o))};t.addEventListener("wheel",s,{passive:!1}),t.addEventListener("dblclick",a);const c=.4,l=e=>{if(0!==e.button)return;const n=e.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const i=Sn.current;if(!i)return;const o=i.getRotation();_n.current={x:e.clientX,y:e.clientY,rotation:[...o]},t.setPointerCapture(e.pointerId),e.preventDefault()},u=t=>{const e=_n.current;e&&(In.current=[e.rotation[0]+(t.clientX-e.x)*c,Math.max(-90,Math.min(90,e.rotation[1]-(t.clientY-e.y)*c)),e.rotation[2]],fn())},h=e=>{if(!_n.current)return;_n.current=null,t.releasePointerCapture(e.pointerId);const n=In.current;if(n){In.current=null;const t=Sn.current;t&&(t.applyRotation(n,i),fn())}const o=Sn.current;o?.scales?.projection&&K?.({projection:o.scales.projection,zoom:o.currentZoom})};return t.addEventListener("pointerdown",l),t.addEventListener("pointermove",u),t.addEventListener("pointerup",h),t.addEventListener("pointercancel",h),()=>{t.removeEventListener("wheel",s),t.removeEventListener("dblclick",a),t.removeEventListener("pointerdown",l),t.removeEventListener("pointermove",u),t.removeEventListener("pointerup",h),t.removeEventListener("pointercancel",h),Dn.current=null}}const o=ke().scaleExtent([e,n]).extent([[0,0],[en[0],en[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",t=>{const e=t.transform;jn.current=e,Tn.current=!0;const n=Sn.current;n&&(n.applyZoomTransform(e,i),Ve.current=!1,fn())}).on("end",t=>{jn.current=t.transform,Tn.current=!1;const e=Sn.current;e?.scales?.projection&&K?.({projection:e.scales.projection,zoom:e.currentZoom})});return Dn.current=o,Ce(t).call(o),()=>{Ce(t).on(".zoom",null)}},[$,V,Pn,en,on,rn,nn,K,fn]);const pi=zt&&!1!==Gt,fi=pi&&qn?qt?qt(qn):Xe(Fe,{data:qn}):null,mi=fi?Xe(q,{x:qn.x,y:qn.y,containerWidth:on,containerHeight:rn,margin:nn,className:"stream-frame-tooltip",zIndex:10,children:fi}):null;if(ut||!gn&&yn){const t=Sn.current;t&&(vn||h||b)&&(vn&&t.setAreas(vn),h&&t.setPoints(bn),b&&t.setLines(wn),t.computeScene({width:on,height:rn}));const e=t?.scene??[];return Ue("div",{ref:Bn,className:"stream-geo-frame"+(kt?" "+kt:""),role:"img","aria-label":Ee||("string"==typeof pe?pe:"Geographic chart"),style:{position:"relative",width:bt?"100%":en[0],height:wt?"100%":en[1]},children:[Xe(Y,{summary:Ne}),Ue("svg",{xmlns:"http://www.w3.org/2000/svg",width:en[0],height:en[1],style:{position:"absolute",left:0,top:0},children:[Xe("g",{transform:`translate(${nn.left},${nn.top})`,children:an}),Ue("g",{transform:`translate(${nn.left},${nn.top})`,children:[At&&Xe("rect",{x:0,y:0,width:on,height:rn,fill:At}),e.map((t,e)=>M({node:t,index:e,renderMode:Nt,fallback:()=>st(t,e)}))]})]}),Xe(Re,{width:on,height:rn,totalWidth:en[0],totalHeight:en[1],margin:nn,showAxes:!1,title:pe,legend:fe,legendPosition:me,legendLayout:ge,legendHoverBehavior:ye,legendClickBehavior:we,legendHighlightedCategory:Pe,legendIsolatedCategories:Le,foregroundGraphics:L(sn,F(Sn.current?.customLayoutOverlays,x??null)),annotations:Vt,onAnnotationActivate:Kt,onObservation:Qt??Yt,chartId:$t,chartType:"StreamGeoFrame",autoPlaceAnnotations:Jt,pointNodes:Ie(e),geoProjection:Sn.current?.scales?.projectedPoint})]})}return Ue("div",{ref:Bn,className:"stream-geo-frame"+(kt?" "+kt:""),role:"group","aria-label":Ee||("string"==typeof pe?pe:"Geographic chart"),tabIndex:0,style:{position:"relative",width:bt?"100%":en[0],height:wt?"100%":en[1],overflow:Zt?"visible":"hidden",...$?{touchAction:"none"}:{}},onKeyDown:ui,children:["production"!==process.env.NODE_ENV&&Sn.current&&Xe(U,{store:Sn.current,diagnostics:zn.current}),_e&&Xe(Q,{tableId:un}),_e&&Xe(H,{scene:Sn.current?.scene??[],chartType:"Geographic chart",tableId:un,chartTitle:"string"==typeof pe?pe:void 0}),Xe(Y,{summary:Ne}),Xe(z,{hoverPoint:qn}),Ue("div",{role:"img","aria-label":Ee||("string"==typeof pe?pe:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:pi?hi:void 0,onPointerLeave:pi?oi:void 0,onPointerDown:pi||Qe?di:void 0,onClick:Qe?ai:void 0,children:[Xe(G,{size:en,margin:nn,children:an}),ot&&Xe("canvas",{ref:Rn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Xe("canvas",{ref:ri,"aria-label":tt(Sn.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),Xe("canvas",{ref:si,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Xe(Re,{width:on,height:rn,totalWidth:en[0],totalHeight:en[1],margin:nn,showAxes:Be,title:pe,legend:fe,legendPosition:me,legendLayout:ge,legendHoverBehavior:ye,legendClickBehavior:we,legendHighlightedCategory:Pe,legendIsolatedCategories:Le,foregroundGraphics:L(sn,F(Sn.current?.customLayoutOverlays,x??null)),annotations:Vt,onAnnotationActivate:Kt,onObservation:Qt??Yt,chartId:$t,chartType:"StreamGeoFrame",autoPlaceAnnotations:Jt,pointNodes:Ie(Sn.current?.scene),geoProjection:Sn.current?.scales?.projectedPoint}),oe?.showBadge&&Xe(v,{isStale:Yn,position:oe.badgePosition}),$&&Ue("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:nn.bottom+8,left:nn.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[Xe("button",{type:"button","aria-label":"Zoom in",onClick:t=>{t.stopPropagation();const e=Mn.current,n=Dn.current;e&&n?.scaleBy&&n.scaleBy(Ce(e),1.5)},style:Ge,children:"+"}),Xe("button",{type:"button","aria-label":"Zoom out",onClick:t=>{t.stopPropagation();const e=Mn.current,n=Dn.current;e&&n?.scaleBy&&n.scaleBy(Ce(e),1/1.5)},style:Ge,children:"−"})]}),ht&&Xe("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:nn.bottom+2,right:nn.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:ht}),Xe(Z,{active:ci.current>=0,hoverPoint:qn,margin:nn,size:en,shape:li.current?.shape,width:li.current?.w,height:li.current?.h,pathData:li.current?.pathData}),mi]})]})}));Ye.displayName="StreamGeoFrame";var Qe=Ye;import{forwardRef as $e,useMemo as Ve}from"react";import{jsx as Ke}from"react/jsx-runtime";var Je=$e(function(n,i){const{points:o,areas:r,lines:s,layout:a,layoutConfig:c,onLayoutError:l,projection:u="equirectangular",xAccessor:h="lon",yAccessor:d="lat",lineDataAccessor:p,colorBy:f,colorScheme:m,tooltip:g,annotations:y,margin:v,selection:b,linkedHover:L,onObservation:x,onClick:S,chartId:R,loading:k,loadingContent:A,emptyContent:C,className:D,frameProps:j={}}=n,{frameRef:T,resolved:M,normalizedMargin:B}=e({imperativeRef:i,imperativeVariant:"geo-points",margin:v,width:n.width,height:n.height,enableHover:n.enableHover,title:n.title,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable,mode:n.mode,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),_=Ve(()=>rt(o),[o]),I=Ve(()=>rt(r),[r]),E=Ve(()=>rt(s),[s]),N=Ve(()=>[..._,...E,...I],[_,E,I]),F=t({data:N,rawData:void 0!==o||void 0!==s||void 0!==r?N:void 0,colorBy:f,colorScheme:m,legendInteraction:void 0,selection:b,linkedHover:L,fallbackFields:"string"==typeof f?[f]:[],unwrapData:!1,onObservation:x,onClick:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"GeoCustomChart",chartId:R,showLegend:!1,userMargin:B,marginDefaults:M.marginDefaults,loading:k,loadingContent:A,emptyContent:C,width:M.width,height:M.height}),O=F.effectiveSelectionHook,W=Ve(()=>O?.isActive?{isActive:!0,predicate:O.predicate}:null,[O?.isActive,O?.predicate]);if(F.earlyReturn)return F.earlyReturn;const{width:H,height:z,enableHover:G,title:q,description:Z,summary:X,accessibleTable:U}=M,Y=dt(g),Q={projection:u,...null!=o&&{points:_},...null!=r&&{areas:I},...null!=s&&{lines:E},xAccessor:h,yAccessor:d,...null!=p&&{lineDataAccessor:p},customLayout:a,layoutConfig:c,onLayoutError:l,layoutSelection:W,colorBy:f,colorScheme:m,size:[H,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:F.margin,enableHover:G,...w({title:q,description:Z,summary:X,accessibleTable:U,className:D,animate:n.animate,autoPlaceAnnotations:n.autoPlaceAnnotations}),...!1===g?{tooltipContent:()=>null}:Y?{tooltipContent:Y}:{},...P({linkedHover:L,selection:b,onObservation:x,onClick:S,hoverHighlight:!1,mobileInteraction:F.mobileInteraction,customHoverBehavior:F.customHoverBehavior,customClickBehavior:F.customClickBehavior,linkedHoverInClickPredicate:!1}),...y&&y.length>0&&{annotations:y},...j};return Ke(At,{componentName:"GeoCustomChart",width:H,height:z,children:Ke(Qe,{ref:T,...Q})})});Je.displayName="GeoCustomChart";export{Qe as StreamGeoFrame_default,Je as GeoCustomChart};