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
@@ -0,0 +1 @@
1
+ import{useReducedMotion as e,useTheme as t}from"./chunk-chunk-XEVJDUTH.module.min.js";import{annotationActivationProps as n,defaultTooltipStyle as r,extractAllRows as o,hatchPatternDef as i,isHatchFill as a,resolveHatchCanvasPattern as l,resolveResponsiveRules as s,resolveSvgFill as c,useObservationSelector as d}from"./chunk-chunk-CO5KQMGH.module.min.js";import{FrameRuntime as u,SEQUENTIAL_INTERPOLATORS as h,glyphFractionClipRect as f,glyphPlacement as y,isInBounds as m,resolveAnchoredPosition as p,resolveGlyphPaint as g,resolveX as b,resolveY as x,schemeCategory10 as v,schemeSet3 as k,schemeTableau10 as w,symbolPathString as $}from"./chunk-chunk-5RKXZQ2P.module.min.js";import{getMinMax as M}from"./chunk-chunk-JJ2OOIET.module.min.js";import{clearCSSColorCache as A,resolveCSSColor as S}from"./chunk-chunk-IY7RYD4S.module.min.js";import{createStore as W,useThemeSelector as C}from"./chunk-chunk-DSNGDNJY.module.min.js";var j=Object.freeze([]);function R(e){if(!e)return j;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}import{memo as L,useEffect as I,useRef as z}from"react";var N={sceneGeometry:0,layout:0,domain:0};function F(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function D(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 O="production"!==process.env.NODE_ENV,P={revisions:N,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},T=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=N,this.lastObserved=N,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){O&&(this.lastObserved=D(this.lastObserved,F(e)))}beforeCompute(e,t){if(!O)return P;const n=D(F(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;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(O){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="")}}};function B(e){return z(new T(e))}function E(e,t,n,r=!1,o=!1){const i=e.beforeCompute(t.getLastUpdateResult(),r);n(),e.afterCompute(i,!0,o)}var G=L(function({store:e,diagnostics:t}){return I(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),H=22;function q(e){return"string"==typeof e&&e.length>0}function _(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}function Y(e,t){return _(e,q(t))}import*as V from"react";import{arc as U}from"d3-shape";function Z(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function X(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,r=e=>Math.max(0,Math.min(e??0,n));return{tl:r(t.tl),tr:r(t.tr),br:r(t.br),bl:r(t.bl)}}var K=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function J(e){const{innerRadius:t,outerRadius:n,startAngle:r,endAngle:o}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=K(n,r),t=K(n,o);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${o-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=K(n,r),a=K(n,o),l=K(t,o),s=K(t,r),c=o-r>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${a.x},${a.y} L${l.x},${l.y} A${t},${t} 0 ${c} 0 ${s.x},${s.y} Z`}const a=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===a)return J({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const l=Math.asin(Math.min(1,a/Math.max(1e-9,n-a))),s=i?0:Math.asin(Math.min(1,a/Math.max(1e-9,t+a))),c=o-r,d=e.roundStart&&e.roundEnd?c/2:c,u=!!e.roundStart&&d>l,h=!!e.roundEnd&&d>l;if(!u&&!h)return J({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=r+(u?l:0),y=o-(h?l:0),m=r+(u?s:0),p=o-(h?s:0),g=K(n,f),b=K(n,y),x=(n-a)*Math.cos(l),v=K(x,r),k=K(x,o),w=i?null:K(t,p),$=i?null:K(t,m),M=i?0:(t+a)*Math.cos(s),A=i?null:K(M,r),S=i?null:K(M,o),W=y-f>Math.PI?1:0,C=i?0:p-m>Math.PI?1:0;let j="";if(u)j+=`M${v.x},${v.y}`,j+=` A${a},${a} 0 0 1 ${g.x},${g.y}`;else{const e=K(n,r);j+=`M${e.x},${e.y}`}if(h)j+=` A${n},${n} 0 ${W} 1 ${b.x},${b.y}`,j+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const e=K(n,o);j+=` A${n},${n} 0 ${W} 1 ${e.x},${e.y}`}if(i)j+=" L0,0";else{if(h)j+=` L${S.x},${S.y}`,j+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const e=K(t,o);j+=` L${e.x},${e.y}`}if(u)j+=` A${t},${t} 0 ${C} 0 ${$.x},${$.y}`,j+=` A${a},${a} 0 0 1 ${A.x},${A.y}`;else{const e=K(t,r);j+=` A${t},${t} 0 ${C} 0 ${e.x},${e.y}`}}return j+=" Z",j}import{jsx as Q,jsxs as ee}from"react/jsx-runtime";var te={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ne(e,t="#4e79a7"){return a(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function re(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function oe(e,t,n,r){const o=e.glyph;if(!o?.parts?.length||0>=e.size)return null;const i=y(o,e.size);if(0>=i.scale)return null;const a=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,l=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),s=f(o,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=s?re(r+"-clip"):void 0,d=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),u=t=>o.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:g(n.fill,l,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:g(n.stroke??"none",l,e.accent);return o||i?Q("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 ee("g",{transform:a,opacity:1===d?void 0:d,children:[s&&c&&Q("clipPath",{id:c,children:Q("rect",{x:s.x,y:s.y,width:s.width,height:s.height})}),s&&e.ghostColor?Q("g",{children:u(e.ghostColor)}):null,s&&c?Q("g",{clipPath:`url(#${c})`,children:u()}):u()]},r)}function ie(e,t){const n=e.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity))).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color??t,opacity:null==e.opacity?void 0:Math.max(0,Math.min(1,e.opacity))}));return 2>n.length?null:n.map((e,t)=>Q("stop",{offset:e.offset,stopColor:e.color,stopOpacity:e.opacity},t))}function ae(e,t,n){const r=$(e.symbolType,e.size,e.path);return Q("path",{d:r,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?ne(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}import{jsx as le,jsxs as se}from"react/jsx-runtime";function ce(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function de(e,t){const n=e.datum;if(!n)return null;const r=[],o=n.__funnelStepLabel,i=Number(n.__funnelStepLabelX),a=Number(n.__funnelStepLabelY),l=Number(n.__funnelRowWidth);"string"!=typeof o||!Number.isFinite(i)||!Number.isFinite(a)||Number.isFinite(l)&&8.4*o.length+16>l||r.push(le("text",{x:i,y:a+3,textAnchor:"middle",dominantBaseline:"hanging",fontSize:14,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.6)",strokeWidth:3,paintOrder:"stroke",children:o},t+"-funnel-step"));const s=Number(n.__funnelValue),c=Number(n.__funnelValueLabelX),d=Number(n.__funnelValueLabelY),u=Number(n.__funnelBarW);if(Number.isFinite(s)&&0!==s&&Number.isFinite(c)&&Number.isFinite(d)&&u>=60){const e=Number(n.__funnelPercent);let o=!0!==n.__funnelIsFirstStep&&Number.isFinite(e)?`${ce(s)} (${.05>Math.abs(e-Math.round(e))?Math.round(e):e.toFixed(1)}%)`:ce(s);7.8*o.length+16>u&&(o=ce(s)),7.8*o.length+16>u||r.push(le("text",{x:c,y:d+22,textAnchor:"middle",dominantBaseline:"hanging",fontSize:13,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.5)",strokeWidth:3,paintOrder:"stroke",children:o},t+"-funnel-value"))}return r.length?le("g",{children:r},t+"-funnel-labels"):null}function ue(e,t,n){const r=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",o=n=>`ord-${e.type}-${r}-${t}-${n}`,l=`ord-${e.type}-${r}-${t}`;switch(e.type){case"rect":{const t=e,n=re(l)+"-grad",r=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=e.x,o=e.y,i=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(o=e.y+e.h,a=e.y):"right"===e.roundedEdge?(r=e.x+e.w,o=e.y,i=e.x,a=e.y):"left"===e.roundedEdge&&(r=e.x,o=e.y,i=e.x+e.w,a=e.y);const l=ie(n.stops,ne(e.style.fill));return l?Q("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:a,children:l}):null}(t,n);let o,s;if(r)s=`url(#${n})`;else if(a(t.style.fill)){const e=re(l)+"-hatch";o=i(t.style.fill,e),s=`url(#${e})`}else s=ne(t.style.fill);const c=r||o?se("defs",{children:[r,o]}):null;if(t.cornerRadii&&Z(t.cornerRadii)){const e=function(e){const{x:t,y:n,w:r,h:o}=e,{tl:i,tr:a,br:l,bl:s}=X(e);let c=`M${t+i},${n}`;return c+=` L${t+r-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+r},${n+a}`),c+=` L${t+r},${n+o-l}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t+r-l},${n+o}`),c+=` L${t+s},${n+o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t},${n+o-s}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(t);return se(V.Fragment,{children:[c,le("path",{d:e,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},l)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:n,y:r,w:o,h:i}=t;let a;switch(t.roundedEdge){case"right":a=`M${n},${r} L${n+o-e},${r} A${e},${e} 0 0 1 ${n+o},${r+e} L${n+o},${r+i-e} A${e},${e} 0 0 1 ${n+o-e},${r+i} L${n},${r+i} Z`;break;case"left":a=`M${n+o},${r} L${n+e},${r} A${e},${e} 0 0 0 ${n},${r+e} L${n},${r+i-e} A${e},${e} 0 0 0 ${n+e},${r+i} L${n+o},${r+i} Z`;break;case"bottom":a=`M${n},${r} L${n+o},${r} L${n+o},${r+i-e} A${e},${e} 0 0 1 ${n+o-e},${r+i} L${n+e},${r+i} A${e},${e} 0 0 1 ${n},${r+i-e} Z`;break;default:a=`M${n},${r+i} L${n},${r+e} A${e},${e} 0 0 1 ${n+e},${r} L${n+o-e},${r} A${e},${e} 0 0 1 ${n+o},${r+e} L${n+o},${r+i} Z`}return se(V.Fragment,{children:[c,le("path",{d:a,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},l)}return se(V.Fragment,{children:[c,le("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth}),de(t,l)]},l)}case"point":{const t=e;return le("circle",{cx:t.x,cy:t.y,r:t.r,fill:ne(t.style.fill),opacity:t.style.opacity??t.style.fillOpacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},l)}case"symbol":return ae(e,t,n);case"glyph":return oe(e,e.x,e.y,`${n??""}ord-glyph-${e.pointId??t}`);case"wedge":{const r=e;if(r._gradientBand&&r._gradientBand.colors.length>0){const e=re(`${n?n+"-":""}gauge-grad-${r.category||l}-${t}`),{clipPath:o,slices:i}=function(e){const t=J({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],r=e.colors;if(r.length>0){const t=(e.endAngle-e.startAngle)/r.length;for(let o=0;r.length>o;o++)n.push({d:J({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+o*t,endAngle:e.endAngle}),color:r[o]})}return{clipPath:t,slices:n}}({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds?.start??!0,roundEnd:r.roundedEnds?.end??!0,colors:r._gradientBand.colors});return se("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[le("defs",{children:le("clipPath",{id:e,children:le("path",{d:o})})}),le("g",{clipPath:`url(#${e})`,children:i.map((e,t)=>le("path",{d:e.d,fill:ne(e.color)},t))}),r.style.stroke&&"none"!==r.style.stroke&&le("path",{d:o,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},l)}let o;if(r.roundedEnds)o=J({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds.start,roundEnd:r.roundedEnds.end});else{const e=U().innerRadius(r.innerRadius).outerRadius(r.outerRadius).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2);r.cornerRadius&&e.cornerRadius(r.cornerRadius),o=e(te)||""}return le("path",{d:o,transform:`translate(${r.cx},${r.cy})`,fill:ne(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,opacity:r.style.opacity},l)}case"boxplot":{const t=e,n=t.columnWidth/2;return se("g","vertical"===t.projection?{children:[le("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),le("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:ne(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),le("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),le("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),le("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[le("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),le("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:ne(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),le("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),le("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),le("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1})]},l)}case"violin":{const t=e,n=[le("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:ne(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},o("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,r=e.x+e.width/2,i=e.y+e.height/2;t.iqrLine.isVertical?n.push(le("line",{x1:r,y1:t.iqrLine.q1Pos,x2:r,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},o("iqr")),le("circle",{cx:r,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},o("med"))):n.push(le("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},o("iqr")),le("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},o("med")))}return le("g",{children:n},l)}case"connector":return le("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},l);case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return le("polygon",{points:n,fill:ne(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},l)}default:return null}}import*as he from"react";import{area as fe,line as ye}from"d3-shape";import{curveMonotoneX as me,curveMonotoneY as pe,curveCardinal as ge,curveCatmullRom as be,curveStep as xe,curveStepBefore as ve,curveStepAfter as ke,curveBasis as we,curveNatural as $e}from"d3-shape";function Me(e){switch(e){case"monotoneX":return me;case"monotoneY":return pe;case"cardinal":return ge;case"catmullRom":return be;case"step":return xe;case"stepBefore":return ve;case"stepAfter":return ke;case"basis":return we;case"natural":return $e;default:return null}}function Ae(e,t,n){if(null==t)return n;if(a(t)){return l(t,e)||t.background&&S(e,t.background)||n}return"string"!=typeof t?t:S(e,t)||n}function Se(e,t){if(null==t)return;const n=Ae(e,t,"");return""===n?void 0:n}function We(e,t,n,r,o,i,a){const l=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(2>l.length)return null;const s=e.createLinearGradient(r,o,i,a);for(const t of l)s.addColorStop(Math.max(0,Math.min(1,t.offset)),Ce(e,t,n));return s}function Ce(e,t,n){const r=t.color??n,o=S(e,r)||r;if(null==t.opacity)return o;const i=Math.max(0,Math.min(1,t.opacity)),[a,l,s]=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(${a},${l},${s},${i})`}function je(e,t,n,r,o,i,a){const l=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(2>l.length)return null;const s=e.createLinearGradient(r,o,i,a);for(const t of l)s.addColorStop(Math.max(0,Math.min(1,t.offset)),Ce(e,t,n));return s}function Re(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 Le(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[a,l]=e[o-1],[s,c]=e[o],d=t[o-1],u=t[o]-d,h=[0,...0===u?[]:n.map(({value:e})=>(e-d)/u).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(Re(d+u*((t+o)/2),n,r),[a+(s-a)*t,l+(c-l)*t],[a+(s-a)*o,l+(c-l)*o])}}return o}import*as Ie from"react";import{arc as ze}from"d3-shape";import{jsx as Ne,jsxs as Fe}from"react/jsx-runtime";function De(e,t){switch(e.type){case"circle":{const n=e,r=a(n.style.fill)?i(n.style.fill,`net-circle-${t}-hatch`):void 0;return Fe(Ie.Fragment,{children:[r&&Ne("defs",{children:r}),Ne("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:r?`url(#net-circle-${t}-hatch)`:ne(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-circle-"+t)}case"rect":{const n=e,r=a(n.style.fill)?i(n.style.fill,`net-rect-${t}-hatch`):void 0;return Fe(Ie.Fragment,{children:[r&&Ne("defs",{children:r}),Ne("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r?`url(#net-rect-${t}-hatch)`:ne(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-rect-"+t)}case"arc":{const n=e,r=ze().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(te)||"",o=a(n.style.fill)?i(n.style.fill,`net-arc-${t}-hatch`):void 0;return Fe(Ie.Fragment,{children:[o&&Ne("defs",{children:o}),Ne("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:o?`url(#net-arc-${t}-hatch)`:ne(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-arc-"+t)}case"symbol":{const n=e,r=$(n.symbolType,n.size,n.path);return Ne("path",{d:r,transform:n.rotation?`translate(${n.cx},${n.cy}) rotate(${180*n.rotation/Math.PI})`:`translate(${n.cx},${n.cy})`,fill:n.style.fill?ne(n.style.fill):"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-symbol-"+t)}case"glyph":return oe(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}function Oe(e,t){switch(e.type){case"line":return Ne("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const n=e;return Ne("path",{d:n.pathD,fill:ne(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"ribbon":{const n=e;return Ne("path",{d:n.pathD,fill:ne(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"curved":{const n=e;return Ne("path",{d:n.pathD,fill:ne(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+t)}default:return null}}function Pe(e,t){return Ne("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}import*as Te from"react";import{jsx as Be,jsxs as Ee}from"react/jsx-runtime";function Ge(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=a(n.style.fill)?i(n.style.fill,`geoarea-${t}-hatch`):void 0;return Ee(Te.Fragment,{children:[r&&Be("defs",{children:r}),Be("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:ne(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=a(n.style.fill)?i(n.style.fill,`geopoint-${t}-hatch`):void 0;return Ee(Te.Fragment,{children:[r&&Be("defs",{children:r}),Be("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:ne(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 Be("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 oe(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}import{jsx as He,jsxs as qe}from"react/jsx-runtime";function _e(e,t,n,r){if(!e||2>t.length)return null;const o=ie(e.stops,r);return o?He("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:o}):null}function Ye(e,t,n){switch(e.type){case"line":{const r=e;if(0===r.path.length)return null;const o=Me(r.curve),i=o?ye().x(([e])=>e).y(([,e])=>e).curve(o)(r.path)??"":"M"+r.path.map(([e,t])=>`${e},${t}`).join("L"),a=re(`${n?n+"-":""}line-${t}-stroke-gradient`),l=_e(r.strokeGradient,r.path,a,r.style.stroke||"#4e79a7");return qe(he.Fragment,{children:[l&&He("defs",{children:l}),He("path",{d:i,fill:"none",stroke:l?`url(#${a})`:r.style.stroke||"#4e79a7",strokeWidth:r.style.strokeWidth||2,strokeDasharray:r.style.strokeDasharray,opacity:r.style.opacity})]},"line-"+t)}case"area":{const r=e;if(0===r.topPath.length)return null;const o=Me(r.curve),l=!o||2>r.topPath.length||2>r.bottomPath.length?`M${r.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...r.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:fe().x(([e])=>e).y0((e,t)=>r.bottomPath[t][1]).y1(([,e])=>e).curve(o)(r.topPath)??"",s=`${n?n+"-":""}area-${t}-hatch`,c=a(r.style.fill)?i(r.style.fill,s):void 0,d=re(`${n?n+"-":""}area-${t}-gradient`),u=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=1/0;for(const[,t]of e.topPath)r=Math.min(r,t);let o=-1/0;for(const[,t]of e.bottomPath)o=Math.max(o,t);if(!Number.isFinite(r)||!Number.isFinite(o))return null;const i=ie(n.stops,ne(e.style.fill));return i?He("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:r,x2:0,y2:o,children:i}):null}(r,d),h=u?`url(#${d})`:c?`url(#${s})`:ne(r.style.fill),f=u?void 0:r.style.fillOpacity??r.style.opacity??.7,y=o?ye().x(([e])=>e).y(([,e])=>e).curve(o)(r.topPath)??"":"M"+r.topPath.map(([e,t])=>`${e},${t}`).join("L"),m=re(`${n?n+"-":""}area-${t}-stroke-gradient`),p=!(!r.colorThresholds?.length||!r.rawValues||r.rawValues.length!==r.topPath.length),g=!!r.strokeColorBands?.length,b=p||g?null:_e(r.strokeGradient,r.topPath,m,r.style.stroke||"#4e79a7"),x=r.style.strokeWidth||2;let v=1/0,k=-1/0;for(const[e]of r.topPath)v>e&&(v=e),e>k&&(k=e);const w=g?r.strokeColorBands.map((e,r)=>re(`${n?n+"-":""}area-${t}-stroke-band-${r}`)):[],$=g?r.strokeColorBands.map((e,t)=>He("clipPath",{id:w[t],children:He("rect",{x:v-x,y:e.y,width:k-v+2*x,height:e.height})},w[t])):null,M=r.style.stroke&&"none"!==r.style.stroke?g?r.strokeColorBands.map((e,n)=>He("path",{d:y,fill:"none",stroke:e.color??ne(r.style.stroke),strokeWidth:x,opacity:r.style.opacity,clipPath:`url(#${w[n]})`},`area-${t}-stroke-band-${n}`)):p?Le(r.topPath,r.rawValues,r.colorThresholds,ne(r.style.stroke)).map((e,n)=>He("path",{d:"M"+e.path.map(([e,t])=>`${e},${t}`).join("L"),fill:"none",stroke:e.color,strokeWidth:x,opacity:r.style.opacity},`area-${t}-threshold-${n}`)):He("path",{d:y,fill:"none",stroke:b?`url(#${m})`:ne(r.style.stroke),strokeWidth:x,opacity:r.style.opacity}):null;if(r.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return qe("g",{children:[qe("defs",{children:[u,!u&&c,b,$,He("clipPath",{id:e,children:He("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})]}),qe("g",{clipPath:`url(#${e})`,children:[He("path",{d:l,fill:h,fillOpacity:f,opacity:u?r.style.opacity:void 0,stroke:"none"}),M]})]},"area-"+t)}return qe(he.Fragment,{children:[(u||c||b||$)&&qe("defs",{children:[u,!u&&c,b,$]}),He("path",{d:l,fill:h,fillOpacity:f,opacity:u?r.style.opacity:void 0,stroke:"none"}),M]},"area-"+t)}case"point":{const r=e,o=`${n?n+"-":""}point-${t}-hatch`,l=a(r.style.fill)?i(r.style.fill,o):void 0;return qe(he.Fragment,{children:[l&&He("defs",{children:l}),He("circle",{cx:r.x,cy:r.y,r:r.r,fill:l?`url(#${o})`:ne(r.style.fill),opacity:r.style.opacity??r.style.fillOpacity??.8,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"point-"+t)}case"symbol":return ae(e,t);case"glyph":return oe(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const r=e,o=`${n?n+"-":""}xyrect-${t}-hatch`,l=a(r.style.fill)?i(r.style.fill,o):void 0;return qe(he.Fragment,{children:[l&&He("defs",{children:l}),He("rect",{x:r.x,y:r.y,width:r.w,height:r.h,fill:l?`url(#${o})`:ne(r.style.fill),opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[r,o,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),a=.299*r+.587*o+.114*i>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return qe("g",{children:[He("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth}),He("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:e})]},"heatcell-"+t)}return He("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth},"heatcell-"+t)}case"candlestick":{const n=e;if(n.isRange){const e=n.dotRadius??Math.max(2,n.bodyWidth/2);return qe("g",{children:[He("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),He("circle",{cx:n.x,cy:n.highY,r:e,fill:n.wickColor}),He("circle",{cx:n.x,cy:n.lowY,r:e,fill:n.wickColor})]},"candle-"+t)}const r=Math.min(n.openY,n.closeY),o=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return qe("g",{children:[He("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),He("rect",{x:n.x-n.bodyWidth/2,y:r,width:n.bodyWidth,height:o,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}var Ve="undefined"==typeof window||"undefined"==typeof document;import{useEffect as Ue,useLayoutEffect as Ze,useRef as Xe,useState as Ke,useSyncExternalStore as Je}from"react";var Qe="undefined"!=typeof window?Ze:Ue;function et(){const[e,t]=Ke(!1);return Qe(()=>{t(!0)},[]),e}var tt=()=>()=>{},nt=()=>!1,rt=()=>!0;function ot(){const e=Je(tt,nt,rt);return Xe(e).current}import{jsx as it}from"react/jsx-runtime";var at={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function lt({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 it("div",{"aria-live":"polite","aria-atomic":"true",style:at,children:t})}import*as st from"react";import*as ct from"react";import{jsx as dt}from"react/jsx-runtime";var ut=ct.createContext(null);function ht(){return ct.useContext(ut)}import{jsx as ft,jsxs as yt}from"react/jsx-runtime";function mt(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"],a=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 a)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}function pt(e,t,n){const r=[];return e>0&&r.push(e+" nodes"),t>0&&r.push(t+" edges"),0===r.length?n+", empty":`${n}, ${r.join(", ")}`}var gt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},bt="semiotic-accessible-data-table",xt=bt+" semiotic-accessible-data-table-hidden",vt=bt+" semiotic-accessible-data-table-visible",kt=vt+" semiotic-accessible-data-table-network",wt={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"},$t={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Mt={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)"},At={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},St={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))"},Wt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Ct={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},jt={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 Rt({scene:e,chartType:t,tableId:n,chartTitle:r}){const[i,a]=st.useState(!1),[l,s]=st.useState(5),c=ht(),d=c?.visible??!1,u=i||d,h=st.useRef(null),f=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;st.useEffect(()=>{u||s(5)},[u]);const y=st.useCallback(e=>{e.target===e.currentTarget&&(i||d||a(!0))},[i,d]),m=st.useCallback(e=>{d||h.current?.contains(e.relatedTarget)||a(!1)},[d]);if(!e||0===e.length)return n?ft("span",{id:n,tabIndex:-1,style:at}):null;if(!u)return ft("div",{id:n,className:xt,tabIndex:-1,onFocus:y,style:at,role:"region","aria-label":f,children:yt("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," elements)"]})});const p=o(e),g=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}(p),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${gt(e.min)} to ${gt(e.max)}, mean ${gt(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(" ")}(p.length,g),x=Math.min(l,p.length),v=p.slice(0,x),k=p.length-x,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const $=Array.from(w);return yt("div",{ref:h,id:n,className:vt,tabIndex:-1,onBlur:m,style:wt,role:"region","aria-label":f,children:[ft("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Mt,children:"×"}),ft("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:$t,children:b}),yt("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:At,children:[ft("caption",{className:"semiotic-accessible-data-table-caption",style:Ct,children:k>0?`First ${x} of ${p.length} data points`:`All ${p.length} data points`}),ft("thead",{children:yt("tr",{children:[ft("th",{style:St,children:"type"}),$.map(e=>ft("th",{style:St,children:e},e))]})}),ft("tbody",{children:v.map((e,t)=>yt("tr",{children:[ft("td",{style:Wt,children:e.label}),$.map(t=>{return ft("td",{style:Wt,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":gt(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),k>0&&yt("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:jt,children:["Show ",Math.min(25,k)," more"," ",1===k?"row":"rows"," (",k," remaining)"]})]})}function Lt({nodes:e,edges:t,chartType:n,tableId:r,chartTitle:o}){const[i,a]=st.useState(!1),[l,s]=st.useState(5),c=ht(),d=c?.visible??!1,u=i||d,h=o?"Data summary for "+o:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=st.useRef(null);st.useEffect(()=>{u||s(5)},[u]);const y=st.useCallback(e=>{e.target===e.currentTarget&&(i||d||a(!0))},[i,d]),m=st.useCallback(e=>{d||f.current?.contains(e.relatedTarget)||a(!1)},[d]);if(!e||0===e.length)return r?ft("span",{id:r,tabIndex:-1,style:at}):null;if(!u)return ft("div",{id:r,className:xt,tabIndex:-1,onFocus:y,style:at,role:"region","aria-label":h,children:yt("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const p=Array.isArray(e)?e:[],g=Array.isArray(t)?t:[],b=new Map,x=new Map,v=new Map,k=new Map;for(const e of g){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},n="object"==typeof t.source?t.source?.id:t.source,r="object"==typeof t.target?t.target?.id:t.target,o="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";x.set(e,(x.get(e)??0)+1),k.set(e,(k.get(e)??0)+o)}if(null!=r&&""!==r){const e=r+"";b.set(e,(b.get(e)??0)+1),v.set(e,(v.get(e)??0)+o)}}const w=[];for(let e=0;p.length>e;e++){const t=p[e];if(!t||"object"!=typeof t)continue;const n=t.datum?.id??t.id,r=null!=n?n+"":"node-"+e,o=b.get(r)??0,i=x.get(r)??0,a=v.get(r)??0,l=k.get(r)??0;w.push({id:r,degree:o+i,inDeg:o,outDeg:i,wDegree:a+l,wInDeg:a,wOutDeg:l})}w.sort((e,t)=>t.degree-e.degree);let $=0,M=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>M&&(M=t.degree);$=e/w.length}const A=g.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),S=[`${w.length} nodes, ${g.length} edges.`];w.length>0&&S.push(`Mean degree: ${gt($)}, max degree: ${M}.`);const W=Math.min(l,w.length),C=w.slice(0,W),j=w.length-W;return yt("div",{ref:f,id:r,className:kt,tabIndex:-1,onBlur:m,style:wt,role:"region","aria-label":h,children:[ft("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Mt,children:"×"}),ft("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:$t,children:S.join(" ")}),yt("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:At,children:[ft("caption",{className:"semiotic-accessible-data-table-caption",style:Ct,children:j>0?`Top ${W} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),ft("thead",{children:yt("tr",{children:[ft("th",{style:St,children:"id"}),ft("th",{style:St,children:"degree"}),ft("th",{style:St,children:"in"}),ft("th",{style:St,children:"out"}),A&&ft("th",{style:St,children:"w. degree"}),A&&ft("th",{style:St,children:"w. in"}),A&&ft("th",{style:St,children:"w. out"})]})}),ft("tbody",{children:C.map((e,t)=>yt("tr",{children:[ft("td",{style:Wt,children:e.id}),ft("td",{style:Wt,children:e.degree}),ft("td",{style:Wt,children:e.inDeg}),ft("td",{style:Wt,children:e.outDeg}),A&&ft("td",{style:Wt,children:gt(e.wDegree)}),A&&ft("td",{style:Wt,children:gt(e.wInDeg)}),A&&ft("td",{style:Wt,children:gt(e.wOutDeg)})]},t))})]}),j>0&&yt("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:jt,children:["Show ",Math.min(25,j)," more"," ",1===j?"node":"nodes"," (",j," remaining)"]})]})}function It({summary:e}){return e?ft("div",{role:"note",style:at,children:e}):null}function zt({tableId:e}){return ft("a",{href:"#"+e,style:at,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,at)},children:"Skip to data table"})}import{jsx as Nt}from"react/jsx-runtime";var Ft="var(--semiotic-focus, #005fcc)";function Dt({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:a,pathData:l}){if(!e||!t)return null;const s=t.x+n.left,c=t.y+n.top;let d;if("geoarea"!==o&&"path"!==o||!l)if("rect"===o&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);d=Nt("rect",{x:s-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ft,strokeWidth:2,strokeDasharray:"4,2"})}else d=Nt("circle","wedge"===o?{cx:s,cy:c,r:12,fill:"none",stroke:Ft,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:c,r:8,fill:"none",stroke:Ft,strokeWidth:2,strokeDasharray:"4,2"});else d=Nt("g",{transform:`translate(${n.left},${n.top})`,children:Nt("path",{d:l,fill:"none",stroke:Ft,strokeWidth:2.5,strokeDasharray:"6,3"})});return Nt("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}import*as Ot from"react";import{jsx as Pt}from"react/jsx-runtime";function Tt({x:e,y:t,containerWidth:n,containerHeight:o,margin:i,children:a,className:l="stream-frame-tooltip",zIndex:s=1}){const c=Number.isFinite(e)&&Number.isFinite(t),d=Ot.useRef(null),[u,h]=Ot.useState(null);Ot.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(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()},[l,n,o,c]);let f;f=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const y=function(e){if(!Ot.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}(a),m=y?null:r;return c?Pt("div",{ref:d,className:y?l:(l+" semiotic-tooltip").trim(),style:{...m||{},position:"absolute",left:i.left+e,top:i.top+t,transform:f,pointerEvents:"none",zIndex:s,width:"max-content"},children:a}):null}import*as Bt from"react";import{useCallback as Et,useEffect as Gt,useLayoutEffect as Ht,useMemo as qt,useRef as _t}from"react";import{useRef as Yt,useState as Vt,useEffect as Ut}from"react";function Zt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Xt(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Kt(e,t,n){return e+(t-e)*n}function Jt(){return"undefined"!=typeof performance?performance.now():Date.now()}var Qt="undefined"==typeof window?Gt:Ht,en={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function tn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function nn(t){const n=e(),r=_t(n);r.current=n;const[o,i]=function(e,t,n){const r=Yt(null),[o,i]=Vt(null);return Ut(()=>{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]]]}(t.sizeProp,t.responsiveWidth,t.responsiveHeight),a=!!t.title,l=!!t.legend&&"top"===t.legendPosition,s=qt(()=>_({...t.marginDefault,...t.userMargin},a,l),[t.marginDefault,t.userMargin,a,l]),c=i[0]-s.left-s.right,d=i[1]-s.top-s.bottom,h=tn(t.foregroundGraphics,i,s),f=tn(t.backgroundGraphics,i,s),y=C(e=>e.theme),{transition:m,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)}}(t.animate,t.transitionProp),g="semiotic-table-"+Bt.useId(),b=_t(null);if(!b.current){const e=!t.suspendWhenHidden||"undefined"==typeof document||!document.hidden;b.current=new u({clock:t.clock,random:t.random,seed:t.seed,paused:t.paused,visible:e})}const x=b.current;x.configure({clock:t.clock,random:t.random,seed:t.seed});const v=_t(null),k=_t(t.frameScheduler??en);k.current=t.frameScheduler??en;const w=_t(null),$=_t(!1),M=_t(()=>{}),S=Et(()=>{if(null!==v.current||$.current)return;const e=k.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&($.current=!0),v.current=null,w.current=null;try{M.current()}finally{e&&($.current=!1)}});n=!0,t||(v.current=r,w.current=e)},[]),W=Et(()=>{null!==v.current&&((w.current??k.current).cancelAnimationFrame(v.current),v.current=null,w.current=null)},[]);Qt(()=>{x.setPaused(!0===t.paused)},[x,t.paused]),Gt(()=>{if(!t.suspendWhenHidden||"undefined"==typeof document)return void x.setVisible(!0);const e=()=>x.setVisible(!document.hidden);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[x,t.suspendWhenHidden]),Gt(()=>()=>{W()},[W]);const j=_t(()=>{}),R=_t(()=>{}),L=_t(null),I=_t(null),z=_t(null),N=Et(()=>{const e=L.current;L.current=null,e&&j.current(e)},[]),F=Et(e=>{if(L.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===I.current){const e=k.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,I.current=null,z.current=null,N()});t||(I.current=n,z.current=e)}},[N]),D=Et(()=>{L.current=null,null!==I.current&&((z.current??k.current).cancelAnimationFrame(I.current),I.current=null,z.current=null),R.current()},[]);Gt(()=>()=>{L.current=null,null!==I.current&&((z.current??k.current).cancelAnimationFrame(I.current),I.current=null,z.current=null)},[]);const O=t.themeDirtyRef;return Qt(()=>{O&&(A(),O.current=!0,S())},[y,S,O]),{reducedMotion:n,reducedMotionRef:r,responsiveRef:o,size:i,margin:s,adjustedWidth:c,adjustedHeight:d,resolvedForeground:h,resolvedBackground:f,currentTheme:y,transition:m,introEnabled:p,tableId:g,frameRuntime:x,rafRef:v,renderFnRef:M,scheduleRender:S,cancelRender:W,hoverHandlerRef:j,hoverLeaveRef:R,onPointerMove:F,onPointerLeave:D}}import{useEffect as rn,useRef as on}from"react";import{jsx as an}from"react/jsx-runtime";function ln(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,a=on(null),l=on(null),s=on(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:a,cleanup:l}=e;Qe(()=>{const e=r.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():o.current=!0,a?.(),i.current()},[t,n]);const s=Xe(l);s.current=l,Ue(()=>()=>s.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),rn(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),rn(()=>{!s.current&&(s.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:l}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function sn({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?an("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:an("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function cn(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),a=Math.round(t[1]*r),l=i/t[0],s=a/t[1],c=t[0]+"px",d=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==d&&(e.style.height=d),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(l,0,0,s,0,0),o.translate(n.left,n.top),o}function dn(){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 un(e){return"touch"===e?"touch":"pointer"}function hn(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']")}function fn(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:l,timestamp:s=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:s,chartType:i,chartId:a}),"focus"===l?.type&&t({type:"focus",datum:n,inputType:"touch"===l.inputType?"pointer":l.inputType,timestamp:s,chartType:i,chartId:a})):t({type:"hover-end",timestamp:s,chartType:i,chartId:a}))}function yn(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:l,timestamp:s=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:s,chartType:i,chartId:a}),"activate"===l?.type&&t({type:"activate",datum:n,inputType:l.inputType,timestamp:s,chartType:i,chartId:a})):t({type:"click-end",timestamp:s,chartType:i,chartId:a}))}import*as mn from"react";import{jsx as pn,jsxs as gn}from"react/jsx-runtime";function bn({componentName:e,message:t,diagnosticHint:n,width:r,height:o}){return pn("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:gn("div",{style:{textAlign:"center",maxWidth:400},children:[pn("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),pn("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&pn("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})]})})}import{jsx as xn}from"react/jsx-runtime";var vn=class extends mn.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:xn(bn,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as kn}from"react/jsx-runtime";function wn({componentName:e,width:t,height:n,children:r}){return kn(vn,{fallback:r=>kn(bn,{componentName:e,message:r.message,width:t,height:n}),children:r})}"undefined"!=typeof process&&process;var $n={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"},Mn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function An(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?kn("div",{style:{...$n,width:t,height:n},children:r||"No data available"}):null}function Sn(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return kn("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))),a=Math.max(6,Math.floor(n/(2.5*o))),l=Math.floor((n-(o*(i+a)-a))/2);return kn("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)=>kn("div",{className:"semiotic-loading-bar",style:{...Mn,position:"absolute",top:l+n*(i+a),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function Wn(e){return e?"string"==typeof e?{name:e}:e:null}import{useId as Cn,useMemo as jn,useCallback as Rn}from"react";function Ln(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 In(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function zn(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[Nn,Fn]=W(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||!zn(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),a=In(i,t),l=new Map(a.clauses);return l.set(n.clientId,n),i.set(t,{...a,clauses:l}),{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=In(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}})}}));import{useSyncExternalStore as Dn}from"react";var On={positions:new Map},Pn=new Set;function Tn(){for(const e of Pn)e()}function Bn(e,t){const n=On.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(On.positions);r.delete(e),On={positions:r},Tn()}function En(e,t){const n=On.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(On.positions);r.delete(e),On={positions:r},Tn()}function Gn(){return On}function Hn(e){return Pn.add(e),()=>Pn.delete(e)}var qn={positions:new Map};function _n(){return()=>{}}function Yn(){return qn}function Vn(e){const t=Dn(e?Hn:_n,e?Gn:Yn,e?Gn:Yn);return e?t.positions.get(e)??null:null}function Un(e){const t=Cn(),n=e.clientId||t,{name:r}=e,o=Fn(e=>e.selections.get(r)),i=Fn(e=>e.setClause),a=Fn(e=>e.clearClause),l=jn(()=>!!o&&o.clauses.size>0,[o]);return{predicate:jn(()=>o&&0!==o.clauses.size?function(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(Ln(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:l,selectPoints:Rn(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:Rn(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:Rn(()=>{a(r,n)},[a,r,n]),clientId:n}}function Zn(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Xn(e){const{name:t,xField:n,yField:r}=e,{predicate:o,isActive:i,selectInterval:a,clear:l}=Un({name:t,fields:[n,r].filter(Boolean)}),s=n&&r?"xyBrush":n?"xBrush":"yBrush",c=Rn(e=>{if(!e)return void l();const t={};"xyBrush"===s&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===s&&Zn(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===s&&Zn(e)&&r&&(t[r]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Kn(t)&&a(t)},[s,n,r,a,l]);return{brushInteraction:jn(()=>({brush:s,during:c,end:c}),[s,c]),predicate:o,isActive:i,clear:l}}function Kn(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Jn={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Qn(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,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!o&&!i)return Jn;const l=a??{};return{enabled:!0,tapToSelect:l.tapToSelect??!0,tapToLockTooltip:l.tapToLockTooltip??!0,clearSelection:l.clearSelection??"backgroundTap",targetSize:l.targetSize??r??44,snap:l.snap??"nearestDatum",brushHandleSize:l.brushHandleSize??44,standardControls:l.standardControls??!1}}var er={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}}};function tr(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(er,e)}function nr(e,t,n){const r=er[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,a={...t,mode:e},l=s(a,{width:t.width??o,height:t.height??i}).props,c=l.mode||e||"primary",d=er[c],u="context"===c||"sparkline"===c,h="primary"===c&&n?.width?n.width:d.width;return{mode:c,width:l.width??h,height:l.height??("primary"===c&&n?.height?n.height:d.height),showAxes:l.showAxes??d.showAxes,showGrid:l.showGrid??d.showGrid,enableHover:l.enableHover??(!!l.linkedHover||d.enableHover),showLegend:l.showLegend??d.showLegend,showLabels:l.showLabels??d.showLabels,title:u?void 0:l.title,description:l.description,summary:l.summary,accessibleTable:l.accessibleTable,xLabel:u?void 0:l.xLabel,yLabel:u?void 0:l.yLabel,categoryLabel:u?void 0:l.categoryLabel,valueLabel:u?void 0:l.valueLabel,marginDefaults:rr(d.marginDefaults,l.showCategoryTicks,l.orientation),compactMode:u,mobileInteraction:Qn(l.mobileInteraction,{mode:c,width:l.width??h,mobileSemantics:l.mobileSemantics}),mobileSemantics:l.mobileSemantics}}function rr(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}import{useMemo as or,useCallback as ir,useState as ar}from"react";import{createContext as lr,useContext as sr,useEffect as cr,useId as dr,useLayoutEffect as ur,useMemo as hr,useRef as fr,useState as yr,useCallback as mr}from"react";import{createContext as pr,useContext as gr,useMemo as br}from"react";import{scaleOrdinal as xr}from"d3-scale";var vr={category10:v,tableau10:w,set3:k,...h},kr=v,wr="#007bff";function $r(e,t,n=kr){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=vr[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}var Mr=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ar=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Sr=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 Wr(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")||Sr.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):kr[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))%kr.length]}function Cr(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 jr(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Cr(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 xr().domain(r).range(n).unknown("#999");const i=vr[n]||vr.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:kr;return xr().domain(r).range(e).unknown("#999")}}function Rr(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,a]=r,[l,s]=n;if(a===i)return(l+s)/2;let c=(o-i)/(a-i);return 0>c?c=0:c>1&&(c=1),l+c*(s-l)}import{jsx as Lr}from"react/jsx-runtime";var Ir=pr(null);function zr(){return gr(Ir)}import*as Nr from"react";function Fr(...e){let t;for(const n of e)n&&(t=Dr(t)&&Dr(n)?{legendGroups:[...t.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??t.legendDistance}:n);return t}function Dr(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function Or(e){return"object"==typeof e&&null!==e&&"gradient"in e}var Pr=22;function Tr(e){return Math.ceil(7*e.length)}function Br(e,t){if(Dr(e)){const n=_r(t),r=e.legendGroups.flatMap(e=>[e.label?Tr(e.label):0,...e.items.map(e=>n.swatchSize+n.labelGap+Tr(e.label))]);return Math.max(100,...r)}if(Or(e)){const{gradient:t}=e,n=t.format||(e=>Math.round(100*e)/100+""),r=Math.max(Tr(n(t.domain[0])),Tr(n(t.domain[1]))),o=t.label?Tr(t.label):0;return Math.max(100,19+r,o)}return 100}function Er(e){return(Dr(e)||Or(e))&&Number.isFinite(e.legendDistance)?Math.max(0,e.legendDistance):10}function Gr(e){return Math.max(0,e?.sideGutter??0)}function Hr(e,t,n){if(Or(e))return e.gradient.label?34:26;if(!Dr(e))return 20;const r=_r(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+Tr(i.label),a=0===n?t:n+r.itemGap+t;n>0&&a>o?(e+=1,n=t):n=a}t.items.length>0&&(e+=1),i=Math.max(i,e*r.rowHeight,t.label?Tr(t.label):0)}return i+(e.legendGroups.length>1?16:0)}function qr(e,t){return Br(e,t)+Er(e)+Gr(t)}function _r(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}}function Yr(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 a=n;return n+=r*t+8,{lineY:o,labelY:i,itemsY:a,endY:n}})}import{jsx as Vr,jsxs as Ur}from"react/jsx-runtime";var Zr={fill:(e,t)=>Vr("rect",{style:e,width:t,height:t}),line:(e,t)=>Vr("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Xr(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,Zr[n])(r(e,t),o),i}function Kr({swatchSize:e}){return Vr("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 Jr(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Qr=(e,t,n,r,o,i,a,l,s,c,d)=>{const{type:u="fill",styleFn:h,items:f}=e,y=[];let m=0;const p=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:b,labelGap:x,rowHeight:v}=d;return f.forEach((e,c)=>{const d=Xr(e,c,u,h,b),k=Jr(e,r,o),w=o&&o.size>0&&o.has(e.label);y.push(Ur("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:p?l===i&&c===a?0:-1:void 0,role:p?"option":void 0,"aria-selected":p&&g?w||!1:void 0,"aria-current":p&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:p?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;s(l,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:p?t=>{s(l,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:p?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:p?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[p&&Vr("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,w&&Vr(Kr,{swatchSize:b}),Vr("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=v}),y};function eo({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:a}=e,l=a||(e=>Math.round(100*e)/100+""),s="grad-legend-"+Nr.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Vr("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return Ur("g",{"aria-label":i||"Gradient legend",children:[Vr("defs",{children:Vr("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&Vr("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Vr("rect",{x:a,y:0,width:t,height:e,fill:`url(#${s})`,rx:2}),Vr("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[0])}),Vr("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Vr("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return Ur("g",{"aria-label":i||"Gradient legend",children:[i&&Vr("text",{x:0,y:-6,textAnchor:"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Vr("defs",{children:Vr("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),Vr("rect",{x:0,y:0,width:14,height:100,fill:`url(#${s})`,rx:2}),Vr("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[1])}),Vr("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[0])})]})}function to(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:a,title:l="Legend",width:s=100,height:c=20,orientation:d="vertical",legendLayout:u}=e,h=_r(u),[f,y]=Nr.useState(0),[m,p]=Nr.useState(0),g=Nr.useCallback((e,t)=>{y(e),p(t)},[]),b="vertical"===d?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:s,legendInteraction:c,metrics:d})=>{const u=[],h=Yr(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),d.rowHeight);return e.forEach((e,f)=>{const y=h[f];u.push(Vr("line",{stroke:"gray",x1:0,y1:y.lineY,x2:t,y2:y.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=y.labelY&&u.push(Vr("text",{y:y.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),u.push(Vr("g",{className:"legend-item",transform:`translate(0,${y.itemsY})`,children:Qr(e,n,r,o,i,a,l,f,s,c,d)},"legend-group-"+f))}),u})({legendGroups:t||[],width:s,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:s,onFocusedIndexChange:c,legendInteraction:d,metrics:u})=>{let h=0;const f=[];e.forEach((e,t)=>{let y=0;e.label&&(y+=16);const m=((e,t,n,r,o,i,a,l,s,c,d,u)=>{const{type:h="fill",styleFn:f,items:y}=e,m=[],{swatchSize:p,labelGap:g,itemGap:b,rowHeight:x,align:v}=d,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=o,$=y.map(e=>p+g+7*e.label.length),M=[];let A=0,S=0;$.forEach((e,t)=>{const n=0===S?e:S+b+e;u&&u>0&&S>0&&n>u?(M.push({start:A,end:t,width:S}),A=t,S=e):S=n}),y.length>0&&M.push({start:A,end:y.length,width:S}),M.forEach((e,c)=>{let d="center"===v?Math.max(0,((u??e.width)-e.width)/2):"end"===v?Math.max(0,(u??e.width)-e.width):0;for(let u=e.start;e.end>u;u++){const e=y[u],v=Xr(e,u,h,f,p),M=Jr(e,r,o),A=o&&o.size>0&&o.has(e.label);m.push(Ur("g",{transform:`translate(${d},${c*x})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?l===i&&u===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?A||!1:void 0,"aria-current":k&&!w&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(u+("ArrowRight"===n.key?1:-1)+y.length)%y.length;s(l,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{s(l,u),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&Vr("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:p+g+2+7*e.label.length,height:p+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,A&&Vr(Kr,{swatchSize:p}),Vr("text",{y:p/2,x:p+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+u)),d+=$[u]+b}});const W=Math.max(0,...M.map(e=>e.width)),C=M.length;return{items:m,offset:W,totalRows:C,totalHeight:C*x}})(e,r,o,i,a,l,s,t,c,d,u,u.maxWidth??n);y+=m.offset+5,f.push({label:e.label,...m,offset:y,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=y+12});const y=u.maxWidth??n;let m=h>y?0:"center"===u.align?Math.max(0,(y-h)/2):"end"===u.align?Math.max(0,y-h):0;const p=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(p.push(Vr("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),p.push(Vr("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+r)),m+=n.offset+5,e[r+1]&&p.push(Vr("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),Vr("g",{children:p})})({legendGroups:t||[],title:l,height:c,width:s,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:a,metrics:h}),x=!(!n&&!r);return Ur("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&Vr("text",{className:"legend-title",y:16,x:s/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),b]})}import{jsx as no,jsxs as ro}from"react/jsx-runtime";var oo=lr(!1);lr(!1);var io=lr(null),ao="undefined"==typeof window?cr:ur;function lo({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:l,additionalLegend:s,chartWidth:c,legendLayout:d,hasTitle:u=!1}){const h=sr(oo),f=null!==sr(io),y=void 0!==r?r:!h&&!!t,m=!!t&&(y||f),p=or(()=>{if(!m)return[];if(void 0!==l)return l;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)},[l,t,e,m]);!function(e){const t=sr(io),n=dr(),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=fr([]);(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;ao(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),ao(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(f&&t?p:[]);const g=or(()=>{if(!y||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:a}){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:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const a=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),l=a?r(a,t,n):n?n(o):Mr[i%Mr.length];return{label:o+"",color:l}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Wr,categories:p});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[y,t,e,n,p]),b=or(()=>Fr(g,s),[g,s]),x=or(()=>{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:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];if(b){const e=qr(b,d),t=Hr(b,Math.max(1,(c??600)-n.left-n.right),d)+Er(b)+("top"===o&&u?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},[a,i,b,o,c,d,u]);return{legend:b,margin:x,legendPosition:o}}function so(e,t,n){const[r,o]=ar(null),[i,a]=ar(new Set),l=or(()=>new Set,[]),s=ir(t=>{"highlight"===e&&o(t?t.label:null)},[e]),c=ir(t=>{"isolate"===e&&a(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]),d=or(()=>{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:l,onLegendHover:s,onLegendClick:c,legendSelectionHook:d}}import{useMemo as co,useCallback as uo,useState as ho,useId as fo,useEffect as yo,useRef as mo}from"react";function po(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 go(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 bo(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var xo=[];function vo(){const e=t(),n=e?.colors?.categorical;return n&&n.length>0?n:void 0}function ko(e,t,n,r,o){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=Cr(n,r);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=vr[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=r?(o.has(r)||o.set(r,o.size),i[o.get(r)%i.length]):i[0]:wr}function wo(e,t,n){const r=zr(),o=vo();return co(()=>{if(!t)return;const i=r??void 0,a=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&&bo(i)){const e=jr(n.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return jr(n.map(e=>({_cat:e})),"_cat",a)}if(i&&bo(i)){const n=jr(e,t,a);return e=>i[e]||n(e)}return jr(e,t,a)}if(i&&bo(i)){const e=jr([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,n,r,o])}function $o({selection:e,linkedHover:t,fallbackFields:n=xo,unwrapData:r=!1,onObservation:o,chartType:i,chartId:a,onClick:l,hoverHighlight:s,colorByField:c,mobileInteraction:u}){const h=fo(),f=co(()=>function(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}(t,n),[t,n]),y=co(()=>"series"===f?.mode?[f.seriesField||c||n[0]].filter(e=>!!e):f?.fields||n,[f,c,n]),m=Un({name:e?.name||"__unused__",fields:y}),p=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:a}=Un({name:t,fields:n});return{onHover:Rn(e=>{if(!e)return void a();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}Kn(t)&&i(t)},[n,i,a]),predicate:r,isActive:o}}({name:f?.name||"hover",fields:y}),g=d(e=>e.pushObservation),b=uo(e=>{o?.(e),g?.(e)},[o,g]),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[v,k]=ho(null),w=mo(!1),$=c||n[0],M=co(()=>{if(!s||null==v||!$)return null;const e=v,t=$;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[s,v,$]),A=uo((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"===f?.mode&&f.xField){const n=po(e,t,f.xField);null!=n&&function(e,t,n){const r=On.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(On={positions:new Map(On.positions).set(e,{xValue:t,sourceId:n})},Tn())}(f.name||"hover",n,h)}"x-position"!==f?.mode&&p.onHover(t)}else"x-position"!==f?.mode||r||Bn(f.name||"hover",h),"x-position"===f?.mode||r||p.onHover(null);if(s&&$)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[$];k(null!=n?n+"":null)}else r||k(null);(o||g)&&fn({onObservation:b,datum:e?go(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:a,context:n})},[t,p,f,h,o,i,a,g,b,s,$,u]),S=uo((n=!0)=>{w.current=!1,t&&"x-position"!==f?.mode&&p.onHover(null),e&&u?.tapToSelect&&m.clear(),n&&s&&k(null),"x-position"===f?.mode&&(En(f.name||"hover",h),Bn(f.name||"hover",h))},[t,f,p,e,u,m,s,h]),W=uo((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),d=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===f?.mode&&f.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=po(n,e,f.xField);null!=t&&function(e,t,n){const r=On.positions.get(e);if(r?.locked){const t=new Map(On.positions);return t.delete(e),On={positions:t},Tn(),!1}On={positions:new Map(On.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Tn()}(f.name||"hover",t,h)}if(c)if(n){w.current=!0;const r=go(n);if(t&&"x-position"!==f?.mode&&p.onHover(r),e&&u?.tapToSelect&&y.length>0){const e={};for(const t of y){const n=r[t];void 0!==n&&(e[t]=[n])}bo(e)&&m.selectPoints(e)}if(s&&$){const e=r?.[$];k(null!=e?e+"":null)}}else d&&S();if(n||d){if(n&&l){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),l(e,{x:n.x??0,y:n.y??0})}(o||g)&&yn({onObservation:b,datum:n?go(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:a,context:r})}},[l,o,g,b,i,a,f,h,u,t,p,e,m,y,s,$,S]);return yo(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&S()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,S]),yo(()=>()=>{w.current&&S(!1)},[S]),yo(()=>{if("x-position"!==f?.mode)return;const e=f.name||"hover";return()=>{En(e,h),Bn(e,h)}},[f?.mode,f?.name,h]),{activeSelectionHook:x,hoverSelectionHook:M,customHoverBehavior:A,customClickBehavior:W,crosshairSourceId:h}}function Mo(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Ao(e,t,n){return nr(e,t,n)}import{jsx as So}from"react/jsx-runtime";function Wo(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:a,legendHoverBehavior:l,legendClickBehavior:s,legendHighlightedCategory:c,legendIsolatedCategories:d,legendInteraction:u}=e;if(!t)return null;const h="top"===i||"bottom"===i,f=Math.max(0,n-o.left-o.right),y=Math.max(1,h?a?.maxWidth??f:Br(t,a)),m=Er(t),p=Gr(a),g=Hr(t,f,a);let b,x;return"left"===i?(b=o.left-p-y-m,x=o.top):"top"===i?(b=o.left,x=o.top-m-g):"bottom"===i?(b=o.left,x=r-o.bottom+m):(b=n-o.right+p+m,x=o.top),So("g",{transform:`translate(${b}, ${x})`,children:Or(t)?So(eo,{config:t.gradient,orientation:h?"horizontal":"vertical",width:y}):Dr(t)?So(to,{legendGroups:t.legendGroups,title:"",width:y,orientation:h?"horizontal":"vertical",legendLayout:a,customHoverBehavior:l,customClickBehavior:s,highlightedCategory:c,isolatedCategories:d,legendInteraction:u}):t})}import{jsx as Co}from"react/jsx-runtime";var jo={secondary:0,primary:3},Ro=".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}}";function Lo(e){return!0===e?._annotationDeferred}function Io(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function zo(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function No(e){return Math.max(.72,.95-.06*e)}import*as Fo from"react";import{jsx as Do,jsxs as Oo}from"react/jsx-runtime";function Po(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let a="";for(const e of o)a&&a.length+1+e.length>r?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function To(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 Bo(e,t,n,r){if(!e)return Do("g",{className:"annotation-note"});const{label:o,title:i,orientation:a,align:l,wrap:s=120,noWrap:c}=e;if(!o&&!i)return Do("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let u=l;u&&"dynamic"!==u||(u="topBottom"===d?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===d?"right"===u?h="end":"middle"===u&&(h="middle"):h=0>t?"end":"start";const f=16,y=i?c?[i]:Po(i,s):[],m=o?c?[o]:Po(o,s):[],p="leftRight"===d?"end"===h?-4:4:0;let g=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push(Do("foreignObject",{className:"annotation-note-html",x:"end"===h?p-s:"middle"===h?p-s/2:p,y:-16,width:s,height:Math.max(f,(y.length+m.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:Oo("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:x,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Do("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&Do("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(y.length>0&&(b.push(Do("text",{className:"annotation-note-title",fill:x,textAnchor:h,fontWeight:"bold",children:y.map((e,t)=>Do("tspan",{x:p,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=y.length*f),m.length>0&&b.push(Do("text",{className:"annotation-note-label",fill:x,textAnchor:h,y:g,children:m.map((e,t)=>Do("tspan",{x:p,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===d){const e=Math.min(s,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=Do("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===u?(t=-e,n=0):"middle"===u&&(t=-e/2,n=e/2),v=Do("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+m.length-1)*f;let w=0;return"topBottom"===d?w=0>n?-(k+2):18:"leftRight"===d&&(w="middle"===u?-(k+f+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===u||0>n?-(k+2):18),Oo("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[Do("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),v]})}function Eo(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(Do("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(Do("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,a=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push(Do("line",{x1:r,y1:(t.y1||0)-a,x2:r,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-a;i.push(Do("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(Do("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(Do("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,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(Do("path",{d:To(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Do("g",{className:"annotation-subject",children:i})}function Go(e,t,n,r,o,i){const a=[];let l=0,s=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,a=e-o,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),d=n/2,u=r/2,h=e*u>t*d?d/e:u/t;l=o+a*h,s=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(l=e/2,s=n):void 0!==t&&(l=n,s=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);l=Math.cos(r)*n,s=Math.sin(r)*n}}const c=Math.sqrt((e-l)**2+(t-s)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let d=Math.atan2(t-s,e-l);if(i){const r=(l+e)/2,i=(s+t)/2,u=-(t-s)/c,h=(e-l)/c,f=(n?.curve??.25)*c,y=r+u*f,m=i+h*f;a.push(Do("path",{className:"connector-curve",d:`M${l},${s}Q${y},${m} ${e},${t}`,fill:"none",stroke:o},"connector-line")),d=Math.atan2(m-s,y-l)}else a.push(Do("line",{x1:l,y1:s,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;a.push(Do("path",{d:`M${l},${s}L${l+e*Math.cos(d+t)},${s+e*Math.sin(d+t)}L${l+e*Math.cos(d-t)},${s+e*Math.sin(d-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return Do("g",{className:"annotation-connector",children:a})}function Ho(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:a,note:l,connector:s,subject:c,type:d,color:u,className:h,disable:f,opacity:y,strokeDasharray:m,events:p={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,x=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=r||0,w=o||0;null!=i&&(k=i-b),null!=a&&(w=a-x);const $="string"==typeof d?d:"label";if("bracket"===$&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return Oo("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${x})`,"data-testid":g,...null!=y&&{opacity:y},...m&&{strokeDasharray:m},...p,children:[!v.has("connector")&&Go(k,w,s,u,$,c),!v.has("subject")&&Eo($,c,u,b,x),!v.has("note")&&Bo(l,k,w,u)]})}function qo(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 a=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return Do(Ho,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+i)});return Do("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return Do(Ho,{"data-testid":"semiotic-annotation",events:o,...t,type:r},a)}import{packEnclose as _o}from"d3-hierarchy";import{area as Yo,curveLinear as Vo,curveMonotoneX as Uo,curveMonotoneY as Zo,curveStep as Xo,curveStepAfter as Ko,curveStepBefore as Jo,curveBasis as Qo,curveCardinal as ei,curveCatmullRom as ti}from"d3-shape";function ni(e){return Math.round(100*e)/100}function ri(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 a=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));a.push(r)}r.push(a)}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(ni);return{points:e.map(([e])=>[ni(e),ni(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}import{jsx as oi,jsxs as ii}from"react/jsx-runtime";var ai="var(--semiotic-bg, #ffffff)";function li(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:a,fontFamily:l,textAnchor:s="start",dominantBaseline:c,background:d,className:u}=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}}(d),f=e=>oi("text",{x:t,y:n,textAnchor:s,dominantBaseline:c,fill:o,fontSize:i,fontWeight:a,fontFamily:l,className:u,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??ai,strokeWidth:h.haloWidth??3});const y=h.padding??{x:6,y:3},m="number"==typeof y?y:y.x,p="number"==typeof y?y:y.y,g=function(e,t){return(e+"").length*t*.6}(r,i),b=i+2*p;let x,v;return x="middle"===s?t-g/2-m:"end"===s?t-g-m:t-m,v="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-p:n-.8*i-p,ii("g",{className:u,children:[oi("rect",{x:x,y:v,width:g+2*m,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??ai,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}import{jsx as si,jsxs as ci}from"react/jsx-runtime";var di={linear:Vo,monotoneX:Uo,monotoneY:Zo,step:Xo,stepAfter:Ko,stepBefore:Jo,basis:Qo,cardinal:ei,catmullRom:ti};function ui(e,t,n,r){const o=[];return e.forEach((e,i)=>{let a;if(n){const o=n(e,i,r);a=null!=o?o:t(e,i,r)}else a=t(e,i,r);a&&o.push({node:a,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:zo(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>Lo(e.annotation)),o=e.some(e=>null!=Io(e.annotation)),i=e.some(e=>"layer"===Io(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=jo[e.emphasis]);const l=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=Lo(t.annotation);let a=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;a=Co("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:No(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const l=Io(t.annotation);return l&&(a=Co("g",{className:"annotation-cohesion--"+l,children:a},"annotation-cohesion-"+n)),i&&(a=Co("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return r&&l.unshift(Co("style",{children:Ro},"annotation-disclosure-style")),i&&l.unshift(Co("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")),l}(o)}function hi(e,t={}){return function(e,r,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=p(e,r,o);if(!t)return null;const{x:n,y:i}=t;if(!m(n,i,o))return null;const a="callout"===e.type?"callout-circle":e.type,l="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return si(qo,{noteData:{x:n,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:a,...l?{subject:l}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+r)}case"x-threshold":{const t=b(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const n=e.color||"#f97316",i=e.labelPosition||"top";let a;a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const l=t>.6*(o.width||0),s=l?t-4:t+4,c=l?"end":"start";return ci("g",{opacity:e.opacity,children:[si("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&si(li,{x:s,y:a,text:e.label,textAnchor:c,fill:n,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+r)}case"y-threshold":{const t=x(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const n=e.color||"#f97316",i=e.labelPosition||"right";let a,s;"left"===i?(a=4,s="start"):"center"===i?(a=(o.width||0)/2,s="middle"):(a=(o.width||0)-4,s="end");const c=20>(l=t)?Math.min((o.height||0)-4,l+16):l-4;return ci("g",{opacity:e.opacity,children:[si("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&si(li,{x:a,y:c,text:e.label,textAnchor:s,fill:n,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+r)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:b({...e,type:"point"},o),y:x({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const n=_o(t),i=e.padding||10;return ci("g",{children:[si("circle",{cx:n.x,cy:n.y,r:n.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&&si(li,{x:n.x,y:n.y-n.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+r)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:b({...e,type:"point"},o),y:x({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const n=e.padding||10,i=t.map(e=>e.x),a=t.map(e=>e.y),[l,s]=M(i),[c,d]=M(a),u=l-n,h=s+n,f=c-n;return ci("g",{children:[si("rect",{x:u,y:f,width:h-u,height:d+n-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&&si(li,{x:(u+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-"+r)}case"highlight":{const t=o.data||[],n="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 si("g",{children:n.map((t,n)=>{const r=b(t,o),a=x(t,o);if(null==r||null==a)return null;const l="function"==typeof e.r?e.r(t):e.r||6,s="function"==typeof e.style?e.style(t):e.style||i;return si("circle",{cx:r,cy:a,r:l,...s},"hl-"+n)})},"ann-"+r)}case"bracket":{const t=b(e,o),n=x(e,o);return si(qo,{noteData:{x:t??0,y:n??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-"+r)}case"trend":{const t=o.data||[];if(2>t.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",a="ordinal"===o.frameType,l="horizontal"===o.projection,s=a?n:null,c=a?i:null;let d;const u=[],h=new Map;if(a&&s&&c){for(const e of t){const t=e[s];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,u.length),u.push(n))}d=t.map(e=>{const t=e[s],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 d=t.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>d.length)return null;const f=o.scales?.x??o.scales?.time,y=o.scales?.y??o.scales?.value;if(!f||!y)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(u.length-1,n+1),o=t-n,i=e(u[n]);return i+(e(u[r])-i)*o},p=f,g=y;let b;if(a)if(l){const e=m(g);b=(t,n)=>[p(n),e(t)]}else{const e=m(p);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[p(e),g(t)];const x=e.method||"linear";let v;if("loess"===x)v=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]),a=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),s=r.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===s?0:r[e]/s;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,f=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(d+=t,u+=t*o[e],h+=t*i[e],f+=t*o[e]*o[e],y+=t*o[e]*i[e])}if(0===d){l.push([t,i[e]]);continue}const m=d*f-u*u;if(1e-12>Math.abs(m))l.push([t,h/d]);else{const e=(d*y-u*h)/m;l.push([t,(h-e*u)/d+e*t])}}return l}(d,e.bandwidth??.3);else{const t="polynomial"===x?ri(d,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:ni((n*t[3]-t[0]*t[1])/r),i=ni(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[ni(e),ni(o*e+i)]),equation:[o,i]}}(d);v=t.points}const k=v.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),w=e.color||"#6366f1",$=v[v.length-1],[M,A]=b($[0],$[1]);return ci("g",{children:[si("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&si("text",{x:M+4,y:A-4,fill:w,fontSize:11,children:e.label})]},"ann-"+r)}case"band":{const t=o.scales?.y??o.scales?.value,n=t?.domain?.(),l=e.y0??n?.[0],s=e.y1??n?.[1],d=null!=l&&t?t(l):0,u=null!=s&&t?t(s):o.height||0,h=c(e.fill,"ann-"+r,"var(--semiotic-primary, #6366f1)");return ci("g",{opacity:e.opacity,children:[h.def&&si("defs",{children:h.def}),si("rect",{x:0,y:Math.min(d,u),width:o.width||0,height:Math.abs(u-d),fill:h.fill,fillOpacity:e.fillOpacity||.1}),e.label&&si(li,{x:(o.width||0)-4,y:(i=d,a=u,Math.max(Math.min(i,a),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+r)}case"x-band":{const t=o.scales?.x??o.scales?.time,n=t?.domain?.(),i=e.x0??n?.[0],a=e.x1??n?.[1],l=null!=i&&t?t(i):null,s=null!=a&&t?t(a):null;if(null==l||null==s)return null;const d=c(e.fill||e.color,"ann-"+r,"var(--semiotic-primary, #6366f1)");return ci("g",{opacity:e.opacity,children:[d.def&&si("defs",{children:d.def}),si("rect",{x:Math.min(l,s),y:0,width:Math.abs(s-l),height:o.height||0,fill:d.fill,fillOpacity:e.fillOpacity??.1}),e.label&&si(li,{x:Math.min(l,s)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+r)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const n=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const l=e.upperAccessor||"upperBounds",s=e.lowerAccessor||"lowerBounds",c=e.filter,d=t.filter(e=>null!=e[l]&&null!=e[s]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>d.length)return null;const u=di[o.curve||"linear"]||Vo,h=Yo().x(e=>i(e[n])).y0(e=>a(e[s])).y1(e=>a(e[l])).curve(u)(d);if(!h)return null;const f=e.fill||"#6366f1";return ci("g",{children:[si("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&d.length>0&&si("text",{x:i(d[d.length-1][n])+4,y:a(d[d.length-1][l])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+r)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const n=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const l=t.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const s=l.reduce((e,t)=>e+t,0)/l.length,c=l.reduce((e,t)=>e+(t-s)**2,0)/l.length,d=Math.sqrt(c),u=e.threshold??2,h=s-u*d,f=!1!==e.showBand,y=e.fill||"#6366f1",m=e.fillOpacity??.1,p=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,v=a(s+u*d),k=a(h),w=t.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-s)>u*d});return ci("g",{children:[f&&si("rect",{x:0,y:Math.min(v,k),width:o.width||0,height:Math.abs(k-v),fill:y,fillOpacity:m}),w.map((e,t)=>{const n=b(e,o),r=x(e,o);return null==n||null==r?null:si("circle",{cx:n,cy:r,r:g,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5},"anomaly-"+t)}),e.label&&si("text",{x:(o.width||0)-4,y:Math.min(v,k)-4,textAnchor:"end",fill:y,fontSize:11,children:e.label})]},"ann-"+r)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",a=o.scales?.x??o.scales?.time,l=o.scales?.y??o.scales?.value;if(!a||!l)return null;const s=t.map(e=>[e[n],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>s.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=ri(s,e.order||2).equation;c=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=s.length;let t=0,n=0,r=0,o=0;for(const[e,i]of s)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 a=(e*o-t*n)/i,l=(n-a*t)/e;c=e=>l+a*e}const d=s.length,u=s.map(([e,t])=>t-c(e)),h=u.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),y=s.reduce((e,t)=>e+t[0],0)/d,m=s.reduce((e,t)=>e+(t[0]-y)**2,0),p=e.confidence??.95,g=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,b=e.steps??5,x=s[d-1][0],v=(x-s[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/d+(m>0?(e-y)**2/m:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const $=`M${w.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,M=w.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),A=`${a(x)},${l(c(x))}`,S=e.strokeColor||"#6366f1";return ci("g",{children:[si("path",{d:$,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),si("polyline",{points:`${A} ${M}`,fill:"none",stroke:S,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&si("text",{x:a(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:S,fontSize:11,children:e.label})]},"ann-"+r)}case"widget":{let i,a;if(null!=e.px&&null!=e.py)i=e.px,a=e.py;else{const t=p(e,r,o);if(!t)return null;i=t.x,a=t.y}if(!m(i,a,o))return null;const l=e.dx??0,s=e.dy??0,c=e.width??32,d=e.height??32,u=e.content??si("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return si("foreignObject",{x:i+l-c/2,y:a+s-d/2,width:c,height:d,style:{overflow:"visible",pointerEvents:"auto"},children:si("div",{...n(e,t),style:{width:c,height:d,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+r)}case"text":{const t=p(e,r,o);if(!t)return null;const{x:n,y:i}=t,a=n+(e.dx||0),l=i+(e.dy||0),s=e.color||"var(--semiotic-text, #333)",c=si("text",{x:a,y:l,fill:s,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Fo.cloneElement(c,{key:"ann-text-"+r}):ci("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[si("line",{x1:n,y1:i,x2:a,y2:l,stroke:s,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Fo.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+r)}case"category-highlight":{const t=e.category;if(null==t)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,a=o.scales?.x,l=o.scales?.y,s=n(i)?i:n(a)?a:n(l)?l:null;if(!s)return null;const c=s(t+"");if(null==c)return null;const d=s.bandwidth(),u=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return ci("g",(o.projection?"vertical"===o.projection:s===a)?{children:[si("rect",{x:c,y:0,width:d,height:o.height||0,fill:u,fillOpacity:h}),f&&si(li,{x:c+d/2,y:16,textAnchor:"middle",fill:u,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[si("rect",{x:0,y:c,width:o.width||0,height:d,fill:u,fillOpacity:h}),f&&si(li,{x:12,y:c+d/2,dominantBaseline:"middle",fill:u,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+r)}default:return null}var i,a,l}}function fi(e,t,n){return $r(e,t,n)}function yi(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&Cr(n,e)||"#4e79a7":t=>{if(n){const e=Cr(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"}}export{R as filterSparseArray,kr as DEFAULT_COLORS,wr as DEFAULT_COLOR,$r as resolveCategoricalPalette,Mr as STREAMING_PALETTE,Ar as DEPTH_PALETTE_COLORS,Wr as getColor,Cr as resolveExplicitColor,jr as createColorScale,Rr as getSize,Zt as computeEasing,Xt as computeRawProgress,Kt as lerp,Jt as now,B as useSceneRevisionDiagnostics,E as runSceneBuild,G as SceneRevisionDiagnosticsObserver,Me as resolveCurveFactory,Ae as resolveCanvasFill,Se as coerceCanvasFill,We as buildLinearFillGradient,je as buildColorStopGradient,Fr as composeLegendConfigs,Dr as isLegendConfig,Or as isGradientLegendConfig,Pr as DEFAULT_LEGEND_ROW_HEIGHT,Br as resolveSideLegendWidth,Er as resolveLegendDistance,Gr as resolveLegendSideGutter,qr as resolveSideLegendMargin,_r as resolveLegendMetrics,Yr as layoutVerticalLegendGroups,Wo as renderLegendFromConfig,qo as SemioticAnnotation,Ro as ANNOTATION_DISCLOSURE_REVEAL_CSS,li as AnnotationLabel,ui as renderAnnotationPass,hi as createDefaultAnnotationRules,En as unlockCrosshair,Vn as useCrosshairPosition,H as TITLE_BASELINE,q as hasTextTitle,Y as reserveTitleMargin,Le as buildThresholdLineSegments,Z as hasAnyCornerRadius,X as clampCornerRadii,De as networkSceneNodeToSVG,Oe as networkSceneEdgeToSVG,Pe as networkLabelToSVG,Ge as geoSceneNodeToSVG,ue as ordinalSceneNodeToSVG,Ye as xySceneNodeToSVG,Ve as isServerEnvironment,et as useHydration,ot as useWasHydratingFromSSR,ht as useDataSummary,lt as AriaLiveTooltip,mt as computeCanvasAriaLabel,pt as computeNetworkAriaLabel,Rt as AccessibleDataTable,Lt as NetworkAccessibleDataTable,It as ScreenReaderSummary,zt as SkipToTableLink,Dt as FocusRing,Tt as FlippingTooltip,nn as useFrame,ln as useFrameCanvasHost,sn as CanvasFrameBackground,cn as prepareCanvas,dn as getDevicePixelRatio,un as observationInputType,hn as isInteractiveKeyboardTarget,fn as emitHoverObservations,yn as emitClickObservations,fi as resolveCustomLayoutPalette,yi as buildResolveColor,wn as SafeRender,An as renderEmptyState,Sn as renderLoadingState,zr as useCategoryColors,Wn as normalizeLinkedBrush,Xn as useBrushSelection,Qn as resolveMobileInteraction,tr as isChartMode,nr as resolveChartMode,lo as useChartLegendAndMargin,so as useLegendInteraction,vo as useThemeCategorical,ko as resolveDefaultFill,wo as useColorScale,$o as useChartSelection,Mo as getCrosshairProps,Ao as useChartMode};