semiotic 3.8.3 → 3.8.5

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 (215) hide show
  1. package/CLAUDE.md +13 -10
  2. package/README.md +52 -45
  3. package/ai/componentMetadata.cjs +1 -1
  4. package/ai/dist/mcp-server.js +4 -2
  5. package/ai/examples.md +168 -1
  6. package/ai/schema.json +3756 -327
  7. package/ai/surface-manifest.json +6 -4
  8. package/ai/system-prompt.md +1 -1
  9. package/dist/chunk-chartContainerDataAudit-74TLKIP6.module.min.js +2 -0
  10. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
  11. package/dist/chunk-chunk-4AANPFOX.module.min.js +2 -0
  12. package/dist/{chunk-chunk-JNCHKRIR.module.min.js → chunk-chunk-5I3UZV4Q.module.min.js} +1 -1
  13. package/dist/chunk-chunk-74CCPVXB.module.min.js +1 -0
  14. package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
  15. package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
  16. package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
  17. package/dist/{chunk-chunk-XQYVEKEJ.module.min.js → chunk-chunk-BANTPINB.module.min.js} +1 -1
  18. package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
  19. package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
  20. package/dist/chunk-chunk-CKMD5NV3.module.min.js +2 -0
  21. package/dist/chunk-chunk-CO5KQMGH.module.min.js +1 -0
  22. package/dist/chunk-chunk-CWQ5YIHX.module.min.js +2 -0
  23. package/dist/chunk-chunk-E6TXX6MI.module.min.js +1 -0
  24. package/dist/{chunk-chunk-7FW6EGLP.module.min.js → chunk-chunk-I36PJ4OC.module.min.js} +1 -1
  25. package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
  26. package/dist/chunk-chunk-K3DMEW22.module.min.js +1 -0
  27. package/dist/chunk-chunk-KT2VAZMZ.module.min.js +1 -0
  28. package/dist/{chunk-chunk-AZJUDQRM.module.min.js → chunk-chunk-L6EA5V3G.module.min.js} +1 -1
  29. package/dist/{chunk-chunk-SANERMIZ.module.min.js → chunk-chunk-LJLS6DY7.module.min.js} +1 -1
  30. package/dist/chunk-chunk-LJPCLYSC.module.min.js +2 -0
  31. package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
  32. package/dist/chunk-chunk-N5DDKCCF.module.min.js +1 -0
  33. package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
  34. package/dist/chunk-chunk-NLO44TOS.module.min.js +2 -0
  35. package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
  36. package/dist/chunk-chunk-PZJ2SBLL.module.min.js +2 -0
  37. package/dist/chunk-chunk-QUJ6TTLY.module.min.js +1 -0
  38. package/dist/chunk-chunk-RBIDBUT4.module.min.js +2 -0
  39. package/dist/chunk-chunk-RFLAG356.module.min.js +1 -0
  40. package/dist/chunk-chunk-RPU4IZAV.module.min.js +2 -0
  41. package/dist/chunk-chunk-SKMBCFIL.module.min.js +2 -0
  42. package/dist/chunk-chunk-TAE7W424.module.min.js +2 -0
  43. package/dist/{chunk-chunk-OQTLSTGI.module.min.js → chunk-chunk-TMWIZL3K.module.min.js} +1 -1
  44. package/dist/chunk-chunk-TUBMTZMU.module.min.js +2 -0
  45. package/dist/chunk-chunk-UFFEXJQY.module.min.js +1 -0
  46. package/dist/chunk-chunk-XSCHTS4D.module.min.js +2 -0
  47. package/dist/chunk-chunk-XXWSHGPL.module.min.js +2 -0
  48. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
  49. package/dist/chunk-chunk-ZXIXAPRE.module.min.js +2 -0
  50. package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
  51. package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
  52. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
  53. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
  54. package/dist/components/ChartContainer.d.ts +12 -2
  55. package/dist/components/ai/chartCapabilities.d.ts +2 -1
  56. package/dist/components/ai/chartCapabilityTypes.d.ts +19 -0
  57. package/dist/components/chartContainerDataAudit.d.ts +10 -0
  58. package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
  59. package/dist/components/charts/geo/DistanceCartogram.d.ts +35 -5
  60. package/dist/components/charts/geo/FlowMap.d.ts +4 -0
  61. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
  62. package/dist/components/charts/index.d.ts +1 -0
  63. package/dist/components/charts/network/ForceDirectedGraph.d.ts +36 -1
  64. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
  65. package/dist/components/charts/physics/CrucibleChart.capability.d.ts +8 -0
  66. package/dist/components/charts/physics/CrucibleChart.d.ts +63 -0
  67. package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
  68. package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +27 -0
  69. package/dist/components/charts/physics/crucibleChartProps.d.ts +90 -0
  70. package/dist/components/charts/physics/crucibleChrome.d.ts +47 -0
  71. package/dist/components/charts/physics/crucibleController.d.ts +59 -0
  72. package/dist/components/charts/physics/crucibleEffects.d.ts +30 -0
  73. package/dist/components/charts/physics/cruciblePhysics.d.ts +54 -0
  74. package/dist/components/charts/physics/crucibleProgram.d.ts +38 -0
  75. package/dist/components/charts/physics/crucibleTypes.d.ts +415 -0
  76. package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
  77. package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
  78. package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
  79. package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
  80. package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
  81. package/dist/components/charts/shared/chartMode.d.ts +8 -0
  82. package/dist/components/charts/shared/chartSpecCore.d.ts +10 -2
  83. package/dist/components/charts/shared/crucibleWireSchema.d.ts +5 -0
  84. package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
  85. package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
  86. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  87. package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
  88. package/dist/components/charts/shared/types.d.ts +2 -2
  89. package/dist/components/charts/shared/validateProps.d.ts +1 -1
  90. package/dist/components/charts/xy/AreaChart.d.ts +10 -0
  91. package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
  92. package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
  93. package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
  94. package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
  95. package/dist/components/data/auditData.d.ts +51 -0
  96. package/dist/components/data/dataAuditPresentation.d.ts +18 -0
  97. package/dist/components/data/dataAuditSources.d.ts +9 -0
  98. package/dist/components/data/numericContracts.d.ts +59 -0
  99. package/dist/components/data/numericFieldProfiler.d.ts +23 -0
  100. package/dist/components/realtime/types.d.ts +5 -0
  101. package/dist/components/recipes/gridObservatory.d.ts +176 -0
  102. package/dist/components/recipes/netEnsembleLayout.d.ts +167 -0
  103. package/dist/components/recipes/netEnsembleOverlays.d.ts +20 -0
  104. package/dist/components/recipes/recipeChrome.d.ts +24 -0
  105. package/dist/components/recipes/sequenceLayout.d.ts +139 -0
  106. package/dist/components/recipes/wordTrails.d.ts +156 -0
  107. package/dist/components/recipes/wordTrailsProgressiveReveal.d.ts +42 -0
  108. package/dist/components/semiotic-ai-core.d.ts +3 -0
  109. package/dist/components/semiotic-ai-data-audit.d.ts +4 -0
  110. package/dist/components/semiotic-ai.d.ts +7 -5
  111. package/dist/components/semiotic-physics.d.ts +1 -0
  112. package/dist/components/semiotic-recipes-core.d.ts +10 -2
  113. package/dist/components/semiotic-utils-core.d.ts +3 -0
  114. package/dist/components/semiotic.d.ts +1 -1
  115. package/dist/components/server/renderEvidence.d.ts +27 -0
  116. package/dist/components/server/serverChartConfigs.d.ts +1 -0
  117. package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
  118. package/dist/components/server/staticAnnotations.d.ts +15 -1
  119. package/dist/components/stream/GeoPipelineStore.d.ts +1 -0
  120. package/dist/components/stream/GeoSVGOverlay.d.ts +7 -0
  121. package/dist/components/stream/SceneToSVG.d.ts +6 -6
  122. package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
  123. package/dist/components/stream/geoCartogram.d.ts +7 -0
  124. package/dist/components/stream/geoTypes.d.ts +17 -2
  125. package/dist/components/stream/networkFrameHandleTypes.d.ts +4 -0
  126. package/dist/components/stream/networkFramePaint.d.ts +2 -0
  127. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
  128. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +8 -0
  129. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
  130. package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
  131. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
  132. package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
  133. package/dist/components/stream/sceneToSVGShared.d.ts +30 -1
  134. package/dist/components/stream/types.d.ts +4 -0
  135. package/dist/components/stream/useHydration.d.ts +7 -1
  136. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
  137. package/dist/components/useChartContainerDataAudit.d.ts +7 -0
  138. package/dist/forceLayoutWorker.js +1 -1
  139. package/dist/geo.min.js +1 -1
  140. package/dist/geo.module.min.js +1 -1
  141. package/dist/network.min.js +1 -1
  142. package/dist/network.module.min.js +1 -1
  143. package/dist/ordinal.min.js +1 -1
  144. package/dist/ordinal.module.min.js +1 -1
  145. package/dist/physics.min.js +1 -1
  146. package/dist/physics.module.min.js +1 -1
  147. package/dist/physicsWorker.js +1 -1
  148. package/dist/realtime.min.js +1 -1
  149. package/dist/realtime.module.min.js +1 -1
  150. package/dist/rough.min.js +1 -1
  151. package/dist/rough.module.min.js +1 -1
  152. package/dist/semiotic-ai-core.d.ts +3 -0
  153. package/dist/semiotic-ai-core.min.js +1 -1
  154. package/dist/semiotic-ai-core.module.min.js +1 -1
  155. package/dist/semiotic-ai.d.ts +7 -5
  156. package/dist/semiotic-ai.min.js +1 -1
  157. package/dist/semiotic-ai.module.min.js +1 -1
  158. package/dist/semiotic-experimental.min.js +1 -1
  159. package/dist/semiotic-experimental.module.min.js +1 -1
  160. package/dist/semiotic-physics.d.ts +1 -0
  161. package/dist/semiotic-realtime-core.min.js +1 -1
  162. package/dist/semiotic-realtime-core.module.min.js +1 -1
  163. package/dist/semiotic-recipes-core.d.ts +10 -2
  164. package/dist/semiotic-recipes-core.min.js +1 -1
  165. package/dist/semiotic-recipes-core.module.min.js +1 -1
  166. package/dist/semiotic-recipes.min.js +1 -1
  167. package/dist/semiotic-recipes.module.min.js +1 -1
  168. package/dist/semiotic-server-edge.min.js +1 -1
  169. package/dist/semiotic-server-edge.module.min.js +1 -1
  170. package/dist/semiotic-server-node.min.js +1 -1
  171. package/dist/semiotic-server-node.module.min.js +1 -1
  172. package/dist/semiotic-utils-core.d.ts +3 -0
  173. package/dist/semiotic-utils-core.min.js +1 -1
  174. package/dist/semiotic-utils-core.module.min.js +1 -1
  175. package/dist/semiotic-utils.min.js +1 -1
  176. package/dist/semiotic-utils.module.min.js +1 -1
  177. package/dist/semiotic-value.module.min.js +1 -1
  178. package/dist/semiotic.d.ts +1 -1
  179. package/dist/semiotic.min.js +1 -1
  180. package/dist/semiotic.module.min.js +1 -1
  181. package/dist/server.min.js +1 -1
  182. package/dist/server.module.min.js +1 -1
  183. package/dist/xy.min.js +1 -1
  184. package/dist/xy.module.min.js +1 -1
  185. package/package.json +4 -3
  186. package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
  187. package/dist/chunk-chunk-2CCFBTQC.module.min.js +0 -2
  188. package/dist/chunk-chunk-2RXP3FS3.module.min.js +0 -1
  189. package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
  190. package/dist/chunk-chunk-4TMZXLCR.module.min.js +0 -1
  191. package/dist/chunk-chunk-5APBQXZA.module.min.js +0 -1
  192. package/dist/chunk-chunk-6HSGDMTA.module.min.js +0 -2
  193. package/dist/chunk-chunk-7OEOSCBP.module.min.js +0 -1
  194. package/dist/chunk-chunk-A63CTACR.module.min.js +0 -2
  195. package/dist/chunk-chunk-B6V35LMY.module.min.js +0 -2
  196. package/dist/chunk-chunk-BOSVL645.module.min.js +0 -2
  197. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
  198. package/dist/chunk-chunk-F25UA5HT.module.min.js +0 -1
  199. package/dist/chunk-chunk-FRIO6MCV.module.min.js +0 -1
  200. package/dist/chunk-chunk-GWSWSPXN.module.min.js +0 -1
  201. package/dist/chunk-chunk-I6C3KR5H.module.min.js +0 -2
  202. package/dist/chunk-chunk-IP2UE74X.module.min.js +0 -1
  203. package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
  204. package/dist/chunk-chunk-J5RL6GXU.module.min.js +0 -2
  205. package/dist/chunk-chunk-L3H6DQCR.module.min.js +0 -2
  206. package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
  207. package/dist/chunk-chunk-M7VYYHCE.module.min.js +0 -2
  208. package/dist/chunk-chunk-MC35ILYP.module.min.js +0 -2
  209. package/dist/chunk-chunk-N72SWNBV.module.min.js +0 -1
  210. package/dist/chunk-chunk-OBQRFTIL.module.min.js +0 -2
  211. package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
  212. package/dist/chunk-chunk-SA3D43RA.module.min.js +0 -2
  213. package/dist/chunk-chunk-UHSZEB74.module.min.js +0 -1
  214. package/dist/chunk-chunk-Y6AXCRVO.module.min.js +0 -1
  215. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
@@ -1,2 +0,0 @@
1
- "use client";
2
- import{buildRegressionAnnotation as e}from"./chunk-chunk-YCQYG6J5.module.min.js";import{validateArrayData as t}from"./chunk-chunk-JCG72SGW.module.min.js";import{mergeShapeStyle as o,useChartSetup as i,useCustomChartSetup as r,useFrameImperativeHandle as n}from"./chunk-chunk-I6C3KR5H.module.min.js";import{DataSourceAdapter as s,IncrementalExtent as a,accessorsEquivalent as l,barCanvasRenderer as c,buildEnrichAnnotationData as h,buildRectNode as u,resolveAccessor as d,resolveAnnotationAccessor as g,resolveFrameGraphics as m,resolveStringAccessor as p,symbolCanvasRenderer as f,ticksForMode as y,toIdSet as v}from"./chunk-chunk-AZJUDQRM.module.min.js";import{RingBuffer as b,compactTimestampBufferForRemoval as x,computePulseIntensity as w,createTimestampBufferForData as A,ensureRingBufferCapacity as k,hasActivePulses as S,pointCanvasRenderer as _,pushWithTimestamp as C,refreshIdlePulse as P,setPulseState as R,useLegendCategoryEmission as M,useOrdinalKeyboardNavigation as L,useSemanticFrameInteractions as I}from"./chunk-chunk-M7VYYHCE.module.min.js";import{StalenessBadge as T,attachUpdateResultStore as H,buildBaseMetadataProps as B,buildCustomBehaviorProps as O,buildDatumIndexMap as F,buildOrdinalTooltip as E,buildTooltipProps as N,composeOverlays as D,computeDecayOpacity as W,createCustomLayoutFailureDiagnostic as j,findHitPointInQuadtree as z,getHitRadius as G,glyphCanvasRenderer as V,hitTestRect as $,normalizeAngle as q,paintSceneWithBackend as X,renderPathPulse as Y,renderSceneWithBackend as Q,useConfigSync as K,useLayoutSelectionSync as Z,useStableShallow as U,useStalenessCheck as J,warnCustomLayoutDiagnostics as ee}from"./chunk-chunk-A63CTACR.module.min.js";import{wrapWithCustomLayoutSelection as te}from"./chunk-chunk-5UKL5W76.module.min.js";import{makeRuleValueResolver as oe,resolveStyleRules as ie}from"./chunk-chunk-EMO5NUGE.module.min.js";import{buildResolveColor as re,resolveCustomLayoutPalette as ne}from"./chunk-chunk-SANERMIZ.module.min.js";import{AccessibleDataTable as se,AriaLiveTooltip as ae,CanvasFrameBackground as le,FlippingTooltip as ce,FocusRing as he,STREAMING_PALETTE as ue,SYMBOL_SEQUENCE as de,SceneRevisionDiagnosticsObserver as ge,ScreenReaderSummary as me,SkipToTableLink as pe,TITLE_BASELINE as fe,UpdateResultTracker as ye,annotationLayout as ve,annularSectorPath as be,buildGaugeGradientGeometry as xe,buildHoverData as we,coerceCanvasFill as Ae,computeCanvasAriaLabel as ke,computeEasing as Se,computeRawProgress as _e,createColorScale as Ce,createDefaultAnnotationRules as Pe,createHatchPattern as Re,createLegend as Me,defaultTooltipStyle as Le,filterSparseArray as Ie,getColor as Te,getDevicePixelRatio as He,getSize as Be,interpolateBrBG as Oe,interpolatePRGn as Fe,interpolatePiYG as Ee,interpolateRdBu as Ne,interpolateRdYlBu as De,interpolateRdYlGn as We,interpolateSpectral as je,isAnnotationActivationTarget as ze,isServerEnvironment as Ge,lerp as Ve,normalizeLinkedBrush as $e,normalizeTooltip as qe,now as Xe,observationInputType as Ye,ordinalSceneNodeToSVG as Qe,parseCanvasColor as Ke,renderAnnotationPass as Ze,renderLegendFromConfig as Ue,resolveCSSColor as Je,resolveCanvasFill as et,resolveDefaultFill as tt,smartTooltipEntries as ot,symbolRadius as it,useAnnotationActivationOptions as rt,useBrushSelection as nt,useCategoryColors as st,useChartMode as at,useFrame as lt,useFrameCanvasHost as ct,useLinkedChartCategories as ht,useSceneRevisionDiagnostics as ut,useSortedData as dt,useThemeCategorical as gt,useThemeDiverging as mt,wrapStyleWithSelection as pt}from"./chunk-chunk-6HSGDMTA.module.min.js";import{getMax as ft,getMinMax as yt}from"./chunk-chunk-JJ2OOIET.module.min.js";import{resolveThemeSemanticColors as vt}from"./chunk-chunk-WCX6U47H.module.min.js";import{glyphHitGeometry as bt}from"./chunk-chunk-KTWEBFMX.module.min.js";import{ChartError as xt,SafeRender as wt,useHydration as At,useWasHydratingFromSSR as kt,warnMissingField as St}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{useRef as _t,useState as Ct,useEffect as Pt,useMemo as Rt,useCallback as Mt,useImperativeHandle as Lt,forwardRef as It,memo as Tt}from"react";import{scaleBand as Ht,scaleLinear as Bt}from"d3-scale";var Ot=class{constructor(){this.colorSchemeMap=new Map,this.colorSchemeIndex=0}resetColors(){this.colorSchemeMap.clear(),this.colorSchemeIndex=0}resolvePieceStyle(e,t,o){if(t&&"function"==typeof e.pieceStyle){const i=e.pieceStyle(t,o);return i&&!i.fill&&o?{...i,fill:this.getColorFromScheme(e,o)}:i}return e.pieceStyle&&"object"==typeof e.pieceStyle?e.pieceStyle:e.barColors&&o?{fill:e.barColors[o]||"#007bff"}:{fill:o?this.getColorFromScheme(e,o):"#007bff"}}resolveSummaryStyle(e,t,o){return t&&"function"==typeof e.summaryStyle?e.summaryStyle(t,o):e.summaryStyle&&"object"==typeof e.summaryStyle?e.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}getColorFromScheme(e,t){const o=this.colorSchemeMap.get(t);if(o)return o;const i=Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical||ue,r=i[this.colorSchemeIndex%i.length];return this.colorSchemeIndex++,this.colorSchemeMap.set(t,r),r}};function Ft(e){const t=e.getSymbol;if(!t)return null;const o=e.config.symbolMap,i=new Map;let r=0;return e=>{const n=t(e)+"",s=o?.[n];if(s)return s;let a=i.get(n);return a||(a=de[r%de.length],r++,i.set(n,a)),a}}function Et(e,t,o,i,r,n,s){e.push(t?{type:"symbol",x:i,y:r,size:Math.PI*n*n,symbolType:t(o),style:s,datum:o}:{type:"point",x:i,y:r,r:n,style:s,datum:o})}function Nt(e,t){const{columns:o,config:i,resolvePieceStyle:r}=e,n=[],s=Math.min(t.width,t.height)/2-4,a="donut"===i.chartType?i.innerRadius||60:0,l=-Math.PI/2+(i.startAngle||0)*Math.PI/180,c=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,h=null!=i.sweepAngle&&360>i.sweepAngle,u=Object.values(o),d=u.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),g=h&&!d&&u.length>1&&(i.cornerRadius??0)>0;for(let e=0;u.length>e;e++){const t=u[e],o=t.pieceData[0],h="number"==typeof o?._pctStart?o._pctStart:t.pctStart,d=l+h*c,m=l+(h+("number"==typeof o?._pct?o._pct:t.pct))*c,p=r(t.pieceData[0],t.name),f=0===e,y=e===u.length-1,v={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:d,endAngle:m,...i.cornerRadius&&{cornerRadius:i.cornerRadius},style:p,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?v.roundedEnds=o._roundedEnds:g&&(v.roundedEnds={start:f,end:y}),o?._gradientBand&&(v._gradientBand=o._gradientBand),n.push(v)}return n}import{quantile as Dt}from"d3-array";function Wt(e){const t=e.length,o=e[0],i=e[t-1];return{n:t,min:o,q1:Dt(e,.25)??o,median:Dt(e,.5)??(o+i)/2,q3:Dt(e,.75)??i,max:i,mean:e.reduce((e,t)=>e+t,0)/t}}import{scaleLinear as jt}from"d3-scale";var zt={bar:function(e,t){const{scales:o,columns:i,config:r,getR:n,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,h=[],d="vertical"===c,g="horizontal"===c,m=r.normalize,p=[];if(s){const e=new Set;for(const t of Object.values(i))for(const o of t.pieceData){const t=s(o);e.has(t)||(e.add(t),p.push(t))}}else p.push("_default");for(const e of Object.values(i)){const t=new Map;for(const o of e.pieceData){const e=s?s(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e);i.total+=n(o),i.pieces.push(o)}let o=0;if(m)for(const e of t.values())o+=Math.abs(e.total);let i=0,r=0;for(const n of p){const c=t.get(n);if(!c)continue;let p=c.total;m&&o>0&&(p/=o);const f=a(c.pieces[0],s?n:e.name),y={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>p?r:i+p),o=0>p?l(r+p)-l(r):l(i)-l(i+p);h.push(u(e.x,t,e.width,Math.abs(o),f,y,n)),0>p?r+=p:i+=p}else if(g){const t=l(0>p?r+p:i),o=0>p?l(r)-l(r+p):l(i+p)-l(i);h.push(u(t,e.x,Math.abs(o),e.width,f,y,n)),0>p?r+=p:i+=p}}}const f="vertical"===c,y=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of h){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=f?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(y>0){const e=new Map;for(const t of h){if("rect"!==t.type)continue;const o=t.datum?.category||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),o=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(f?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=y),o.length>0&&(o.reduce(f?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=y)}}return h},clusterbar:function(e,t){const{scales:o,columns:i,config:r,getR:n,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,h=[],d="vertical"===c,g=[],m=new Set;for(const e of Object.values(i))for(const t of e.pieceData){const e=s?s(t):"_default";m.has(e)||(m.add(e),g.push(e))}const p=g.length||1;for(const e of Object.values(i)){const t=e.width/p,o=.2*t,i=t-o,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;g.length>s;s++){const c=r.get(g[s])||[];for(const r of c){const c=n(r),m=a(r,g[s]);if(d){const n=e.x+s*t+o/2,a=l(0),d=l(c);h.push(u(n,Math.min(a,d),i,Math.abs(a-d),m,r,g[s]))}else{const n=e.x+s*t+o/2,a=l(0),d=l(c);h.push(u(Math.min(a,d),n,Math.abs(d-a),i,m,r,g[s]))}}}}const f=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of h){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=n(e.datum);f>0&&(e.roundedTop=f),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return h},point:function(e,t){const{scales:o,columns:i,getR:r,multiScales:n,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],h="vertical"===l,u="radial"===l,d=n.length>0,g=Ft(e),m=2*Math.PI,p=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const o=t.__rIndex??0,i=t.__rValue??r(t),l=d&&n[o]||a,f=s(t,e.name),y=f.r||5;let v,b;if(u){const t=p+(e.pctStart+e.pct/2)*m,o=l(i);v=Math.cos(t)*o,b=Math.sin(t)*o}else h?(v=e.middle,b=l(i)):(v=l(i),b=e.middle);Et(c,g,t,v,b,y,f)}return c},swarm:function(e,t){const{scales:o,columns:i,getR:r,resolvePieceStyle:n}=e,{r:s,projection:a}=o,l=[],c="vertical"===a,h=Ft(e);for(const e of Object.values(i)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const i=e.pieceData[o],a=r(i),u=n(i,e.name),d=u.r||4,g=(7919*o%100/100-.5)*t*.8;Et(l,h,i,c?e.middle+g:s(a),c?s(a):e.middle+g,d,u)}}return l},pie:Nt,donut:Nt,boxplot:function(e,t){const{scales:o,columns:i,config:r,getR:n,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],h="vertical"===l,u=!1!==r.showOutliers;for(const t of Object.values(i)){const o=t.pieceData.map(e=>n(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===o.length)continue;const i=o[0],r=o[o.length-1],l=Dt(o,.25)??i,d=Dt(o,.5)??(i+r)/2,g=Dt(o,.75)??r,m=g-l,p=l-1.5*m,f=g+1.5*m,y=o.find(e=>e>=p)??i,v=[...o].reverse().find(e=>f>=e)??r,b=s(t.pieceData[0],t.name),x=[];if(u)for(const e of t.pieceData){const o=n(e);if(p>o||o>f){const i=h?t.middle:a(o),r=h?a(o):t.middle;x.push({px:i,py:r,value:o,datum:e})}}if(c.push({type:"boxplot",x:h?t.middle:0,y:h?0:t.middle,projection:h?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(y),q1Pos:a(l),medianPos:a(d),q3Pos:a(g),maxPos:a(v),stats:{n:o.length,min:y,q1:l,median:d,q3:g,max:v,mean:o.reduce((e,t)=>e+t,0)/o.length},style:b,datum:t.pieceData,category:t.name,outliers:x}),u)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:b.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:o,columns:i,config:r,getR:n,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],h="vertical"===l,u=r.bins||20,d=!1!==r.showIQR;for(const e of Object.values(i)){const t=e.pieceData.map(e=>n(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/u||1,l=Array(u).fill(0);for(const e of t)l[Math.min(Math.floor((e-o)/r),u-1)]++;const g=ft(l,1),m=e.width/2*.9;let p;if(h){p=`M ${e.middle} ${a(o)}`;for(let t=0;u>t;t++){const i=a(o+(t+.5)*r);p+=` L ${e.middle+l[t]/g*m} ${i}`}p+=` L ${e.middle} ${a(i)}`;for(let t=u-1;t>=0;t--){const i=a(o+(t+.5)*r);p+=` L ${e.middle-l[t]/g*m} ${i}`}p+=" Z"}else{p=`M ${a(o)} ${e.middle}`;for(let t=0;u>t;t++)p+=` L ${a(o+(t+.5)*r)} ${e.middle-l[t]/g*m}`;p+=` L ${a(i)} ${e.middle}`;for(let t=u-1;t>=0;t--)p+=` L ${a(o+(t+.5)*r)} ${e.middle+l[t]/g*m}`;p+=" Z"}const f=s(e.pieceData[0],e.name);let y;if(d&&t.length>=4){const r=Dt(t,.25)??o,n=Dt(t,.5)??(o+i)/2,s=Dt(t,.75)??i;y={q1Pos:a(r),medianPos:a(n),q3Pos:a(s),centerPos:e.middle,isVertical:h}}const v=h?{x:e.x,y:Math.min(a(i),a(o)),width:e.width,height:Math.abs(a(i)-a(o))}:{x:Math.min(a(o),a(i)),y:e.x,width:Math.abs(a(i)-a(o)),height:e.width};c.push({type:"violin",pathString:p,translateX:0,translateY:0,bounds:v,iqrLine:y,stats:Wt(t),style:f,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:o,columns:i,config:r,getR:n,resolveSummaryStyle:s}=e,{r:a}=o,l=[],c=r.bins||25,h=r.normalize,d=a.domain?.(),g=d?+d[0]:void 0,m=d?+d[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>n(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[o,i]=yt(t),r=null!=g&&isFinite(g)?g:o,d=null!=m&&isFinite(m)?m:i,p=(d-r)/c||1,f=Array(c).fill(0);for(const e of t)r>e||e>d||f[Math.min(Math.floor((e-r)/p),c-1)]++;const y=t.length,v=ft(f,1),b=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===f[t])continue;const o=(h?f[t]/y:f[t]/v)*e.width*.9,i=a(r+t*p),n=a(r+(t+1)*p);l.push(u(Math.min(i,n),e.x+e.width-o,Math.abs(n-i),o,b,{bin:t,count:f[t],range:[r+t*p,r+(t+1)*p],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:o,columns:i,config:r,getR:n,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],h=r.bins||20,u="horizontal"===l,d=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>n(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/h||1,l=Array(h).fill(0);for(const e of t)o>e||e>i||l[Math.min(Math.floor((e-o)/r),h-1)]++;const g=ft(l,1),m=s(e.pieceData[0],e.name),p=e.width*d;let f;if(u){const t=e.x+e.width;f=`M ${a(o)} ${t}`;for(let e=0;h>e;e++)f+=` L ${a(o+(e+.5)*r)} ${t-l[e]/g*p}`;f+=` L ${a(i)} ${t} Z`}else{const t=e.x;f=`M ${t} ${a(o)}`;for(let e=0;h>e;e++){const i=a(o+(e+.5)*r);f+=` L ${t+l[e]/g*p} ${i}`}f+=` L ${t} ${a(i)} Z`}const y=u?{x:Math.min(a(o),a(i)),y:e.x,width:Math.abs(a(i)-a(o)),height:e.width}:{x:e.x,y:Math.min(a(i),a(o)),width:e.width,height:Math.abs(a(i)-a(o))};c.push({type:"violin",pathString:f,translateX:0,translateY:0,bounds:y,stats:Wt(t),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:o,columns:i,getRawRange:r,resolvePieceStyle:n}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(i))for(const t of e.pieceData){const o=r(t);if(!o)continue;const[i,a]=o,h=n(t,e.name);if(c){const o=s(Math.min(i,a)),r=s(Math.max(i,a));l.push(u(o,e.x,r-o,e.width,h,t,e.name))}else{const o=s(Math.max(i,a)),r=s(Math.min(i,a));l.push(u(e.x,o,e.width,r-o,h,t,e.name))}}return l},funnel:function(e,t){const{columns:o,getR:i,getStack:r,resolvePieceStyle:n}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return s;const h=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),h.push(e))}const g=h.length>1&&"_default"!==h[0],m=[];let p=0;for(const e of c){const t=new Map;let o=0;for(const n of e.pieceData){const e=r?r(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=i(n);s.total+=a,s.pieces.push(n),o+=a}m.push({col:e,groups:t,stepTotal:o}),g||o>p&&(p=o)}if(g)for(const e of m){let t=0,o=0;for(let i=0;h.length>i;i++){const r=e.groups.get(h[i]);r&&(i%2==0?t+=r.total:o+=r.total)}const i=Math.max(t,o);i>p&&(p=i)}if(0===p)return s;const f=new Map;for(const e of h){const t=m[0].groups.get(e);f.set(e,t?.total??0)}const y=m[0].stepTotal,v=g?.95*a:.9*t.width,b=jt().domain([0,p]).range([0,v]),x=e.config.connectorOpacity??.3;let w=new Map;for(let t=0;m.length>t;t++){const o=m[t],i=o.col,r=0===t,c=i.width,d=.55*c,p=i.x+(c-d)/2,v=new Map;if(g){let e=0;for(const t of h){const i=o.groups.get(t);i&&(e+=b(i.total))}let t=a,c=a;for(let g=0;h.length>g;g++){const m=h[g],y=o.groups.get(m);if(!y)continue;const x=b(y.total),w=g%2==0,A=w?t:c-x;w?t+=x:c-=x;const k=n(y.pieces[0],m),S=f.get(m)??y.total,_={...y.pieces[0],__funnelValue:y.total,__funnelPercent:S>0?y.total/S*100:0,__funnelStep:i.name,__funnelIsFirstStep:r,__aggregateValue:y.total,__pieceCount:y.pieces.length,category:m};l&&(0===g&&(_.__funnelStepLabel=i.name,_.__funnelStepLabelX=a,_.__funnelStepLabelY=p,_.__funnelRowWidth=e),_.__funnelValueLabelX=A+x/2,_.__funnelValueLabelY=p,_.__funnelBarW=x),s.push(u(A,p,x,d,k,_,m)),v.set(m,{x:A,y:p,w:x,h:d})}}else{const e=o.stepTotal,t=b(e),c=a-t/2,g=h[0],m="_default"!==g,f=o.groups.get(g)?.pieces[0]??i.pieceData[0],x=m?g:i.name,w=n(f,x),A=y>0?e/y*100:0,k={...f,__funnelValue:e,__funnelPercent:A,__funnelStep:i.name,__funnelIsFirstStep:r,category:m?g:i.name};l&&(k.__funnelStepLabel=i.name,k.__funnelStepLabelX=a,k.__funnelStepLabelY=p,k.__funnelRowWidth=t,k.__funnelValueLabelX=a,k.__funnelValueLabelY=p,k.__funnelBarW=t),s.push(u(c,p,t,d,w,k,x)),v.set(g,{x:c,y:p,w:t,h:d})}if(t>0&&w.size>0){const t=g?h:[h[0]];for(const r of t){const t=w.get(r),a=v.get(r);if(!t||!a)continue;const l=(()=>{const e=o.groups.get(r);return n(e?e.pieces[0]:i.pieceData[0],"_default"===r?i.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:x},datum:o.groups.get(r)?.pieces[0]??i.pieceData[0],category:"_default"===r?i.name:r};s.push(c)}}w=v}return s},"bar-funnel":function(e,t){const{columns:o,getR:i,getStack:r,resolvePieceStyle:n,scales:s}=e,a=[],l=s.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return a;const c=[],h=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";h.has(e)||(h.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],g=[];for(const e of l){const t=new Map;let o=0;for(const n of e.pieceData){const e=r?r(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=i(n);s.total+=a,s.pieces.push(n),o+=a}g.push({col:e,groups:t,stepTotal:o})}const m=new Map;for(const e of c){const t=g[0]?.groups.get(e);m.set(e,t?.total??0)}const p=s.r,f=d?c.length:1,y=d?.15:0;for(let e=0;g.length>e;e++){const t=g[e],o=t.col,i=0===e,r=e>0?g[e-1]:null,s=o.width/f,l=s*y,h=s-l;for(let e=0;c.length>e;e++){const g=c[e],f=t.groups.get(g);if(!f)continue;const y=f.total,v=m.get(g)??y,b=v>0?y/v*100:0,x=r?.groups.get(g),w=i?0:Math.max(0,(x?.total??y)-y),A=o.x+e*s+l/2,k=p(y),S=p(0)-k,_=n(f.pieces[0],d?g:o.name),C={...f.pieces[0],__barFunnelValue:y,__barFunnelPercent:b,__barFunnelIsFirstStep:i,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:w,__barFunnelCategory:"_default"===g?void 0:g,category:d?g:o.name,__barFunnelLabelX:A+h/2,__barFunnelLabelY:p(y+w)};if(a.push(u(A,k,h,S,_,C,d?g:o.name)),w>0){const e=p(y+w),t=k-e,i={..._},r={...f.pieces[0],__barFunnelValue:w,__barFunnelPercent:v>0?w/v*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===g?void 0:g,category:d?g:o.name};a.push(u(A,e,h,t,i,r,d?g:o.name))}}}return a},swimlane:function(e,t){const{scales:o,columns:i,getR:r,getStack:n,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],h="horizontal"===l,d=e.config.gradientFill,g=h?"left":"bottom",m=e.config.trackFill;if(m){const e="string"==typeof m?m:m.color,t="string"==typeof m?1:m.opacity??1,[o,r]=a.range(),n=Math.min(o,r),s=Math.abs(r-o);for(const o of Object.values(i)){const i={fill:e,opacity:t},r=h?u(n,o.x,s,o.width,i,null,"__track__"):u(o.x,n,o.width,s,i,null,"__track__");c.push(r)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const o=c.length;for(const o of e.pieceData){const i=Math.abs(r(o));if(0===i)continue;const l=n?n(o):e.name,m=s(o,l);let p;if(h){const r=a(t),n=a(t+i);p=u(r,e.x,n-r,e.width,m,o,l)}else{const r=a(t+i),n=a(t);p=u(e.x,r,e.width,n-r,m,o,l)}d&&(p.fillGradient=d,p.roundedEdge=g),c.push(p),t+=i}if(p>0&&c.length>o){const e=c.slice(o),t=e[0],i=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:h?(t.cornerRadii={tl:p,bl:p},i.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},i.cornerRadii={tl:p,tr:p})}}return c}},Gt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Vt=["scene-style","data-paint","accessibility","evidence"],$t=(e,t)=>({retainedData:e,invalidations:t}),qt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Xt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Yt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Qt=["scene-geometry","data-paint","accessibility","evidence"],Kt=["scene-style","data-paint","accessibility","evidence"],Zt=[],Ut={chartType:$t("rebuild",qt),runtimeMode:$t("rebuild",qt),categoryAccessor:$t("rebuild",qt),valueAccessor:$t("rebuild",qt),oAccessor:$t("rebuild",qt),rAccessor:$t("rebuild",qt),stackBy:$t("rebuild",qt),groupBy:$t("rebuild",qt),timeAccessor:$t("rebuild",qt),accessorRevision:$t("rebuild",qt),colorAccessor:$t("rebuild",Kt),symbolAccessor:$t("rebuild",Qt),connectorAccessor:$t("rebuild",Qt),dataIdAccessor:$t("rebuild",Qt),projection:$t("preserve",Xt),extentPadding:$t("preserve",Xt),axisExtent:$t("preserve",Xt),rExtent:$t("preserve",Xt),oExtent:$t("preserve",Xt),multiAxis:$t("preserve",Xt),normalize:$t("preserve",Xt),bins:$t("preserve",Xt),oSort:$t("preserve",Yt),barPadding:$t("preserve",Yt),roundedTop:$t("preserve",Yt),baselinePadding:$t("preserve",Yt),innerRadius:$t("preserve",Yt),cornerRadius:$t("preserve",Yt),startAngle:$t("preserve",Yt),sweepAngle:$t("preserve",Yt),trackFill:$t("preserve",Yt),showOutliers:$t("preserve",Yt),showIQR:$t("preserve",Yt),amplitude:$t("preserve",Yt),connectorOpacity:$t("preserve",Yt),showLabels:$t("preserve",Yt),dynamicColumnWidth:$t("rebuild",Yt),customLayout:$t("preserve",Yt),layoutConfig:$t("preserve",Yt),layoutMargin:$t("preserve",Yt),symbolMap:$t("preserve",Qt),pieceStyle:$t("preserve",Kt),summaryStyle:$t("preserve",Kt),connectorStyle:$t("preserve",Kt),gradientFill:$t("preserve",Kt),colorScheme:$t("preserve",Kt),themeCategorical:$t("preserve",Kt),themeSemantic:$t("preserve",Kt),themeSequential:$t("preserve",Kt),themeDiverging:$t("preserve",Kt),barColors:$t("preserve",Kt),decay:$t("preserve",Kt),pulse:$t("preserve",Kt),staleness:$t("preserve",Kt),layoutSelection:$t("preserve",Kt),windowSize:$t("preserve",Zt),windowMode:$t("preserve",Zt),clock:$t("preserve",Zt),transition:$t("preserve",Zt),introAnimation:$t("preserve",Zt),onLayoutError:$t("preserve",Zt)},Jt=$t("preserve",Yt),eo=class{constructor(){this.tracker=new ye}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Gt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Vt):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const i of e){const e=Ut[i]??Jt;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}};import{quadtree as to}from"d3-quadtree";var oo=class{constructor(e){this.rExtent=new a,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new eo,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this.styleResolver=new Ot,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new b(e.windowSize),this.getO=p(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>d(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new a)):(this.getR=d(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=p(e.stackBy),this.getGroup=p(e.groupBy),this.getColor=p(e.colorAccessor),this.getSymbol=p(e.symbolAccessor),this.getConnector=p(e.connectorAccessor),this.getDataId=p(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new b(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,i;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,i=this.currentTime(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:A(t,i):null)}currentTime(){return this.config.clock?.()??Xe()}ingest(e){const t=this.currentTime();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),k(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)C(this.buffer,o,this.timestampBuffer,t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=C(this.buffer,o,this.timestampBuffer,t);this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this,i=this.scales,r=this.multiScales,n=this.columns;if(0===o.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),h="horizontal"===a,u="radial"===a,d=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let g,m;if(u){g=Ht().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,i=t.innerRadius||0;m=Bt().domain(c).range([i,o])}else h?(g=Ht().domain(l).range([0,e.height]).padding(d),m=Bt().domain(c).range([0,e.width])):(g=Ht().domain(l).range([0,e.width]).padding(d),m=Bt().domain(c).range([e.height,0]));this.scales={o:g,r:m,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((i,r)=>{const n=this.rExtents[r];n.dirty&&n.recalculate(o,i);let[s,a]=n.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),h?Bt().domain([s,a]).range([0,e.width]):Bt().domain([s,a]).range([e.height,0])}):[];let p=s;this.rAccessors.length>1&&(p=s.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(p,l,g,a,e),this._customLayoutFailedThisBuild=!1;const f=this.buildSceneNodes(p,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=i,this.multiScales=r,this.columns=n):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=f,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,i="auto"===t?void 0:t;let r=null;if(o){r=new Set;for(const t of e)r.add(this.getO(t))}const n=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(o&&void 0===i){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return n}if(!1===i)return n;if("function"==typeof i)return n.sort(i);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return n.sort("asc"===i?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:i,normalize:r,rExtent:n,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:h,getStack:u,rawRExtent:d}=e,g=s;if("radial"===i&&("pie"===o||"donut"===o))return[0,1];let m=0,p=0;if("bar"===o&&u&&r)m=0,p=1;else if("bar"===o&&u){const e=new Map,o=new Map;for(const i of t){const t=c(i),r=h(i);0>r?o.set(t,(o.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>p&&(p=t);for(const e of o.values())m>e&&(m=e)}else if("bar"===o){const e=new Map;for(const o of t){const t=c(o),i=h(o);e.set(t,(e.get(t)||0)+i)}for(const t of e.values())t>p&&(p=t),m>t&&(m=t)}else if("swimlane"===o){const e=new Map;for(const o of t){const t=c(o),i=Math.abs(h(o));e.set(t,(e.get(t)||0)+i)}for(const t of e.values())t>p&&(p=t)}else if("clusterbar"===o||"bar-funnel"===o)for(const e of t){const t=h(e);t>p&&(p=t),m>t&&(m=t)}else{const e=d[0],t=d[1];e!==1/0&&(m=e),t!==-1/0&&(p=t)}n&&(null!=n[0]&&(m=n[0]),null!=n[1]&&(p=n[1]));const f="bar"===o||"clusterbar"===o||"bar-funnel"===o||"swimlane"===o;if(f&&null==n?.[0]&&null==n?.[1]&&(m>0&&(m=0),0>p&&(p=0)),"bar-funnel"!==o&&"exact"!==l){const e=p-m,t=e>0?e*g:1,i=f&&!a&&0===m,r=f&&!a&&0===p||"swimlane"===o;null!=n?.[0]||i||(m-=t),null!=n?.[1]||r||(p+=t)}return[m,p]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,o,i,r){return function(e){const{data:t,oExtent:o,oScale:i,projection:r,layout:n,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},h=new Map;for(const e of t){const t=a(e);h.has(t)||h.set(t,[]),h.get(t).push(e)}let u=0;if("radial"===r)for(const e of t)u+=Math.abs(l(e));let d=null;if(s&&"radial"!==r){d=new Map;let e=0;for(const t of o){const o=h.get(t)||[];let i;i="string"==typeof s?o.reduce((e,t)=>e+(Number(t[s])||0),0):s(o),d.set(t,i),e+=i}const t=("horizontal"===r?n.height:n.width)-i.padding()*i.step()*o.length;if(e>0)for(const[o,i]of d)d.set(o,i/e*t)}let g=0,m=0;for(const e of o){const t=h.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=u>0?o/u:0;let n,s;d?(n=m,s=d.get(e)||i.bandwidth(),m+=s+i.padding()*i.step()):(n=i(e)??0,s=i.bandwidth()),c[e]={name:e,x:n,y:0,width:s,middle:n+s/2,padding:i.padding()*i.step(),pieceData:t,pct:r,pctStart:g},g+=r}return c}({data:e,oExtent:t,oScale:o,projection:i,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.styleResolver.resolvePieceStyle(this.config,e,t),resolveSummaryStyle:(e,t)=>this.styleResolver.resolveSummaryStyle(this.config,e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const o=this.buildLayoutContext(e,t);let i;try{i=this.config.customLayout(o)}catch(e){const t=null!==this.lastCustomLayoutResult,o=j("ordinal",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const r=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of r)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(r,this.config.layoutSelection??null)}return ee({label:"ordinal customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const o=this.getSceneContext(),i=zt[this.config.chartType];let r=i?i(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:i,getConnector:r,getO:n}=e;if(!r||!o)return[];const s=[],{projection:a}=o,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=r(t);if(!o)continue;let i,s;"point"===e.type?(i=e.x,s=e.y):(i=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:i,y:s,datum:t,category:n(t)})}const c=o.o.domain(),h=i.connectorStyle;for(const[t,o]of l)if(o.length>=2){o.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let i=0;o.length-1>i;i++){const r=o[i],n=o[i+1],a="function"==typeof h?h(r.datum):h||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:r.x,y1:r.y,x2:n.x,y2:n.y,style:a,datum:r.datum,group:t})}}return s}(o,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const o=this.config,i=o.layoutMargin??{top:0,right:0,bottom:0,left:0},r=ne(o.colorScheme,o.themeCategorical,ue),n=this.scales;return{data:e,scales:{o:n.o,r:n.r,projection:n.projection},dimensions:{width:t.width,height:t.height,margin:i,plot:"radial"===n.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:o.themeSemantic??{},categorical:[...r]},resolveColor:re(r,o.colorScheme),config:o.layoutConfig??{},selection:o.layoutSelection??null}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?W(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=F(e);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=function(e,t){const o="function"==typeof t,i=o?null:t||"category",r=new Map;for(let n=0;e.length>n;n++){const s=e[n],a=o?t(s):s[i],l=r.get(a);l?l.push(n):r.set(a,[n])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,o=0;for(const i of e)"point"===i.type&&(t++,i.r>o&&(o=i.r));if(500>=t)return{quadtree:null,maxRadius:o};const i=Array(t);let r=0;for(const t of e)"point"===t.type&&(i[r++]=t);return{maxRadius:o,quadtree:to().x(e=>e.x).y(e=>e.y).addAll(i)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const o=t.length;if(1>=o)return;const i=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;if(!t.datum)continue;const e=i.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,o);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,o=this.currentTime()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,i,r,n){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let i=0;for(const s of r(t)??[]){const t=o.get(s);null!=t&&(i=Math.max(i,w(e,t,n)))}l=R(c,i,s)||l;continue}if(null==c.datum)continue;const t=i.get(c.datum);if(null==t)continue;const h=o.get(t),u=null==h?0:w(e,h,n);l=R(c,u,s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),o)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&S(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,o="horizontal"!==this.scales?.projection;let i;for(let r=0;this.scene.length>r;r++){const n=this.scene[r],s=this.getNodeKey(n,e);s&&("rect"===n.type?this.prevPositionMap.set(s,o?{x:n.x,y:t,w:n.w,h:0,opacity:n.style.opacity??1}:{x:t,y:n.y,w:0,h:n.h,opacity:n.style.opacity??1}):"point"===n.type?this.prevPositionMap.set(s,{x:n.x,y:n.y,r:0,opacity:0}):"wedge"===n.type&&(void 0===i&&(i=n.startAngle),this.prevPositionMap.set(s,{x:n.cx,y:n.cy,startAngle:i,endAngle:i,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,i=t.get(o)||0;return t.set(o,i+1),`${o}:${i}`}return"rect"===e.type?`r:${e.group||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],i=this.getNodeKey(o,e);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:o.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const o=new Set,i=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],n=this.getNodeKey(r,i);if(!n)continue;r._transitionKey=n;const s=this.prevPositionMap.get(n);if("point"===r.type)s?(o.add(n),r._targetOpacity=r.style.opacity??1,(s.x!==r.x||s.y!==r.y||void 0!==s.r&&s.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=s.x,r.y=s.y,void 0!==s.r&&(r.r=s.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)s?(o.add(n),r._targetOpacity=r.style.opacity??1,s.x===r.x&&s.y===r.y&&s.w===r.w&&s.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=s.x,r.y=s.y,r.w=s.w??r.w,r.h=s.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(s)o.add(n),r._targetOpacity=r.style.opacity??1,s.startAngle===r.startAngle&&s.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=s.startAngle,r.endAngle=s.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(n,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,i]of this.prevPositionMap)if(!o.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:i.x,y:i.y,r:i.r??3,style:{opacity:i.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:i.x,y:i.y,w:i.w??0,h:i.h??0,style:{opacity:i.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((i.startAngle??0)+(i.endAngle??0))/2,o={type:"wedge",cx:i.x,cy:i.y,innerRadius:i.innerRadius??0,outerRadius:i.outerRadius??100,startAngle:i.startAngle??0,endAngle:i.endAngle??0,style:{opacity:i.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:this.currentTime(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=_e(e,this.activeTransition),o=Se(t,"linear"===this.config.transition?.easing?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const i=this.prevPositionMap.get(t);e.style.opacity=Ve(i?i.opacity??1:0,e._targetOpacity,o)}const i=this.prevPositionMap.get(t);void 0!==e._targetX&&i&&(e.x=Ve(i.x,e._targetX,o),e.y=Ve(i.y,e._targetY,o)),void 0!==e._targetR&&void 0!==i?.r&&(e.r=Ve(i.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const i=this.prevPositionMap.get(t);e.style.opacity=Ve(i?i.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;const i=this.prevPositionMap.get(t);if(!i)continue;e.x=Ve(i.x,e._targetX,o),e.y=Ve(i.y,e._targetY,o),void 0!==i.w&&(e.w=Ve(i.w,e._targetW,o),e.h=Ve(i.h,e._targetH,o))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const i=this.prevPositionMap.get(t);e.style={...e.style,opacity:Ve(i?i.opacity??1:0,e._targetOpacity,o)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const i=this.prevPositionMap.get(t);i&&void 0!==i.startAngle&&(e.startAngle=Ve(i.startAngle,e._targetStartAngle,o),e.endAngle=Ve(i.endAngle,e._targetEndAngle,o))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...e.style||{},opacity:0===e._targetOpacity?0:e._targetOpacity},e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=v(e),o=this.getDataId,i=e=>t.has(o(e));x(this.buffer,this.timestampBuffer,i);const r=this.buffer.remove(i);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=v(e),i=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{o.has(i(e))&&r.add(t)});const n=this.buffer.update(e=>o.has(i(e)),t);if(0===n.length)return this.updateResults.recordNoop("update"),n;for(const e of n)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",n.length),n}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this.styleResolver.resetColors(),this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const i of e){const e=this._baseStyles.get(i)??i.style??{},r=o(i,t);i.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!l(e.colorAccessor,t.colorAccessor))&&this.styleResolver.resetColors(),("categoryAccessor"in e&&!l(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!l(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let i=!1;("categoryAccessor"in e||"oAccessor"in e)&&(l(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=p(this.config.categoryAccessor||this.config.oAccessor,"category"),i=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(e)?e:[e],n=Array.isArray(o)?o:[o];if(r=i.length!==n.length||i.some((e,t)=>!l(e,n[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>d(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new a)):(this.getR=d(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!l(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?p(this.config.stackBy):void 0),"groupBy"in e&&!l(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?p(this.config.groupBy):void 0),"colorAccessor"in e&&!l(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?p(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!l(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?p(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!l(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?p(this.config.connectorAccessor):void 0),(i||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};function io(e,t,o,i=30,r,n=0){let s=null;if(r){const e=z(r,t,o,i,n);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const n of e){let e=null;switch(n.type){case"rect":if(null==n.datum)break;e=ro(n,t,o);break;case"point":if(r)break;e=no(n,t,o,i);break;case"symbol":e=so(n,t,o,i);break;case"glyph":e=ao(n,t,o,i);break;case"wedge":if(null===n.datum)break;e=lo(n,t,o);break;case"boxplot":e=co(n,t,o);break;case"violin":e=ho(n,t,o)}e&&i>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function ro(e,t,o){const i=$(t,o,e);return i.hit?{datum:e.datum,x:i.cx,y:e.y,distance:0,category:e.group}:null}function no(e,t,o,i=30){const r=t-e.x,n=o-e.y,s=Math.sqrt(r*r+n*n);return s>G(e.r,i)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function so(e,t,o,i=30){const r=t-e.x,n=o-e.y,s=Math.sqrt(r*r+n*n);return s>G(it(e.size),i)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function ao(e,t,o,i=30){if(null==e.datum)return null;const r=bt(e.glyph,e.size),n=e.x+r.centerDx,s=e.y+r.centerDy,a=t-n,l=o-s,c=Math.sqrt(a*a+l*l);return c>G(r.radius,i)?null:{datum:e.datum,x:n,y:s,distance:c}}function lo(e,t,o){const i=t-e.cx,r=o-e.cy,n=Math.sqrt(i*i+r*r);if(e.innerRadius>n||n>e.outerRadius)return null;const s=q(Math.atan2(r,i)),a=q(e.startAngle),l=q(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,h=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*h,y:e.cy+Math.sin(c)*h,distance:0,category:e.category}}function co(e,t,o){const i=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-i>t||t>e.x+i||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-i,n=e.y+i;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>o||o>n))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ho(e,t,o){if(!e.bounds)return null;const{x:i,y:r,width:n,height:s}=e.bounds;return i>t||t>i+n||r>o||o>r+s?null:{datum:e.datum,x:i+n/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}H(oo);import{useMemo as uo,useRef as go}from"react";import{Fragment as mo,jsx as po,jsxs as fo}from"react/jsx-runtime";function yo(e){const{width:t,height:o,totalWidth:i,totalHeight:r,margin:n,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:h,axisExtent:u}=e,d="radial"===s?.projection,g="horizontal"===s?.projection,m=uo(()=>!s||d?[]:(h||y(s.r,5,u)).map(e=>({value:e,pixel:s.r(e),label:(c||vo)(e)})),[s,c,d,h,u]),p=l&&s&&!d,f=a&&s&&!d;return p||f?po("svg",{width:i,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:fo("g",{transform:`translate(${n.left},${n.top})`,children:[p&&po("g",{className:"ordinal-grid",children:m.map((e,i)=>po("line",{x1:g?e.pixel:0,y1:g?0:e.pixel,x2:g?e.pixel:t,y2:g?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+i))}),f&&po(mo,{children:fo(mo,g?{children:[po("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),po("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[po("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),po("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function vo(e){return Math.round(100*e)/100+""}function bo(e){const{width:t,height:o,totalWidth:i,totalHeight:r,margin:n,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:h,oFormat:u,rFormat:d,showGrid:g,title:m,legend:p,legendHoverBehavior:f,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:x,legendPosition:w="right",legendLayout:A,foregroundGraphics:k,annotations:S,onAnnotationActivate:_,onObservation:C,chartId:P,chartType:R,autoPlaceAnnotations:M,svgAnnotationRules:L,xAccessor:I,yAccessor:T,annotationData:H,underlayRendered:B,canvasObscuresUnderlay:O=!0,children:F}=e,E=rt({onAnnotationActivate:_,onObservation:C,chartId:P,chartType:R}),N="radial"===s?.projection,D="horizontal"===s?.projection,W=!1!==l,j=!B||O,z=uo(()=>{if(!a||!W||!s||N)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,o)=>({value:t,pixel:(s.o(t)??0)+e/2,label:u?u(t,o):t}));if(2>=t.length)return t;const o=Math.abs(t[1].pixel-t[0].pixel)||e,i=t.map(e=>{return t=e.label,D?"string"==typeof t||"number"==typeof t?16:24:"string"==typeof t||"number"==typeof t?6.5*(t+"").length:60;var t}),r=D?0:6;if(i.every((e,t)=>0===t||o>=(i[t-1]+e)/2+r))return t;const n=Math.max(...i)+r,l=Math.max(1,Math.ceil(n/o));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,W,s,u,N,D]),G=e.rTickValues,V=e.tickLabelEdgeAlign,$=e.axisExtent,q=uo(()=>a&&s&&!N?(G||y(s.r,5,$)).map(e=>({value:e,pixel:s.r(e),label:(d||vo)(e)})):[],[a,s,d,N,G,$]),X=go(new Map),Y=go(S?.length??0),Q=S?.length??0;Y.current!==Q&&(Y.current=Q,X.current=new Map);const K=uo(()=>{if(!S||0===S.length)return null;const e=Pe("ordinal",E),i="horizontal"===s?.projection,r=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,n={scales:s?{x:i?s.r:r||s.r,y:i&&r||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:I,yAccessor:T,width:t,height:o,data:H,frameType:"ordinal",projection:i?"horizontal":"vertical",stickyPositionCache:X.current},a=M?ve({annotations:S,context:n,..."object"==typeof M?M:{}}):S;return Ze(a,e,L,n)},[S,M,L,t,o,s,I,T,H,E]);return a||m||p||k||K&&K.length>0||g||F?fo("svg",{role:"img",width:i,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[po("title",{children:"string"==typeof m?m:"Ordinal Chart"}),po("desc",{children:"string"==typeof m?m+" (ordinal data visualization)":"Ordinal data visualization"}),fo("g",{transform:`translate(${n.left},${n.top})`,children:[g&&s&&!N&&j&&po("g",{className:"ordinal-grid",children:q.map((e,i)=>po("line",{x1:D?e.pixel:0,y1:D?0:e.pixel,x2:D?e.pixel:t,y2:D?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+i))}),a&&s&&!N&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},i={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return po("g",{className:"ordinal-axes",children:fo(mo,D?{children:[fo("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[j&&po("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((t,o)=>fo("g",{transform:`translate(0,${t.pixel})`,children:[po("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?po("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):po("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:po("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&po("text",{x:15-n.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-n.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...i},children:c})]}),fo("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[j&&po("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),j&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?po("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),q.map((t,i)=>{const r=V?0===i?"start":i===q.length-1?"end":"middle":"middle";return fo("g",{transform:`translate(${t.pixel},${o})`,children:[po("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),po("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+i)}),h&&po("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...i},children:h})]})]}:{children:[fo("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[j&&(()=>{const e=s?.r?s.r(0):o,i=0>e||e>o?o:e;return po("line",{x1:0,y1:i,x2:t,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),z.map((t,i)=>fo("g",{transform:`translate(${t.pixel},${o})`,children:[po("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?po("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):po("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:po("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+i)),c&&po("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...i},children:c})]}),fo("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[j&&po("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),q.map((t,o)=>fo("g",{transform:`translate(0,${t.pixel})`,children:[po("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),po("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)),h&&po("text",{x:15-n.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-n.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...i},children:h})]})]})})})(),K,k,F]}),m&&"string"==typeof m?po("text",{x:i/2,y:fe,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?po("foreignObject",{x:0,y:0,width:i,height:n.top,children:m}):null,Ue({legend:p,totalWidth:i,totalHeight:r,margin:n,legendPosition:w,title:m,legendLayout:A,legendHoverBehavior:f,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:x})]}):null}import*as xo from"react";import{jsx as wo}from"react/jsx-runtime";var Ao=null,ko=null;function So(e){const[t,o]=xo.useState(()=>Ao);return xo.useEffect(()=>{if(t)return;let e=!1;return(Ao?Promise.resolve(Ao):(ko||(ko=import("./chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js").then(e=>Ao=e.OrdinalBrushOverlay)),ko)).then(t=>{e||o(()=>t)}),()=>{e=!0}},[t]),t?wo(t,{...e}):null}import{arc as _o}from"d3-shape";function Co(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:i,slices:r}=xe({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:o}),n=new Path2D(i);e.save(),e.translate(t.cx,t.cy),e.clip(n);for(const t of r)e.fillStyle=Je(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n),e.restore())}function Po(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Ro(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},i=_o().cornerRadius(t.cornerRadius)(o);if(!i)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(i);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var Mo=(e,t,o,i)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)Co(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Po(e,t),Y(e,t)),e.globalAlpha=1;else{if(e.fillStyle=et(e,t.style.fill,"#007bff"),t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=be({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Ro(e,t)):(Po(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Po(e,t),Y(e,t)),e.globalAlpha=1}},Lo=(e,t,o,i)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const o=t.columnWidth/2,i="vertical"===t.projection,r=Je(e,"var(--semiotic-primary, #007bff)"),n=Je(e,"var(--semiotic-text, #333)"),s=et(e,t.style.fill,r),a=t.style.stroke,l="string"==typeof a?Je(e,a)||a:n,c=t.style.strokeWidth||1,h=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=l,e.lineWidth=c,e.beginPath(),i?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),i?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=h,e.fillStyle=s,i){const i=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,i,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-o,i,t.columnWidth,r)}else{const i=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(i,t.y-o,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(i,t.y-o,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),i?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},Io=(e,t,o,i)=>{const r=t.filter(e=>"violin"===e.type);for(const t of r){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=et(e,t.style.fill,"#007bff"),e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,i=!1!==t.iqrLine.isVertical;e.beginPath(),i?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),i?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},To=(e,t,o,i)=>{const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const n=new Map;for(const e of r){const t=e.group||"_default";n.has(t)||n.set(t,[]),n.get(t).push(e)}for(const[,t]of n){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=o.fillOpacity??o.opacity??.3,e.fillStyle=Ae(e,o.fill)??"#999",e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=Je(e,o.style.stroke)||et(e,o.style.fill,"")||Je(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Ho=(e,t,o,i)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const o=t.points;if(o.length>=4){e.globalAlpha=t.style?.opacity??1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=Ae(e,t.style?.fill)||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Bo(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 Oo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Fo=new Map;function Eo(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,i=Fo.get(o);if(void 0!==i)return i;const r=Re({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Fo.set(o,r),r}function No(e,t,o,i,r,n){e.moveTo(t+n,o),e.lineTo(t+i-n,o),e.quadraticCurveTo(t+i,o,t+i,o+n),e.lineTo(t+i,o+r-n),e.quadraticCurveTo(t+i,o+r,t+i-n,o+r),e.lineTo(t+n,o+r),e.quadraticCurveTo(t,o+r,t,o+r-n),e.lineTo(t,o+n),e.quadraticCurveTo(t,o,t+n,o),e.closePath()}function Do(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Wo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}function jo(e){return"rect"===e.type||"point"===e.type||"symbol"===e.type||"glyph"===e.type}function zo(e){return(t,o,i,r)=>{e(t,o.filter(jo),{x:i.r,y:i.r},r)}}var Go=zo(c),Vo=zo(_),$o=zo(f),qo=zo(V),Xo=e=>[To,...e],Yo={bar:Xo([Go]),clusterbar:Xo([Go]),point:Xo([Vo,$o]),swarm:Xo([Vo,$o]),pie:[Mo],donut:[Mo],boxplot:Xo([Lo,Vo]),violin:Xo([Io]),histogram:Xo([Go]),ridgeline:Xo([Io]),timeline:Xo([Go]),funnel:[Go,Ho,(e,t,o,i)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const i=o.__funnelStepLabel;if(e.measureText(i).width+16>(o.__funnelRowWidth??o.__funnelBarW??0))continue;const r=o.__funnelStepLabelX,n=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(i,r,n),e.fillStyle="#fff",e.fillText(i,r,n)}e.font="bold 13px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const i=o.__funnelBarW??0;if(60>i)continue;const r=o.__funnelValue;if(null==r||0===r)continue;const n=o.__funnelPercent,s=!0===o.__funnelIsFirstStep;let a;if(a=s?Bo(r):null!=n?`${Bo(r)} (${Oo(n)})`:Bo(r),e.measureText(a).width+16>i){if(s||null==n)continue;if(a=Bo(r),e.measureText(a).width+16>i)continue}const l=o.__funnelValueLabelX,c=(o.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Go,(e,t,o,i)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const o=("string"==typeof t.style.fill?t.style.fill:null)||Je(e,"var(--semiotic-border, #999)"),i=Eo(o,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),i?e.fillStyle=i:(e.fillStyle=o,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,o,i)=>{const r=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===r.length)return;const n=function(e,t){const[o,i,r]=Ke(e,t);return(.2126*o+.7152*i+.0722*r)/255>.6}(e,Je(e,"var(--semiotic-text, #333)")),s=n?"#1f2937":"#ffffff",a=n?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=n?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const o=t.datum;if(!o)continue;const i=o.__barFunnelValue;if(null==i)continue;if(25>t.w)continue;const r=o.__barFunnelPercent,n=!(!0===o.__barFunnelIsFirstStep)&&null!=r,h=n?Wo(r):"",u=Do(i);e.font="bold 13px sans-serif";const d=n?e.measureText(h).width:0;e.font="11px sans-serif";const g=e.measureText(u).width,m=Math.max(d,g)+12,p=n?32:17,f=o.__barFunnelLabelX,y=f-m/2,v=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),No(e,y,v,m,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),No(e,y,v,m,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",n?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(h,f,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(u,f,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(u,f,v+3))}e.lineWidth=1}],swimlane:Xo([Go]),custom:Xo([Go,Vo,$o,qo,Mo,Lo,Io,Ho])};import{jsx as Qo,jsxs as Ko}from"react/jsx-runtime";function Zo(e){const t=ot(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:Ko("div",{className:"semiotic-tooltip",style:Le,children:[null!=t.title&&Qo("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>Ko("div",{children:[Ko("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function Uo({hover:e}){const t=e.data||{},o=e.stats,i=e.category;if(Array.isArray(t)){const e=i||t[0]?.category||"";if(o)return Ko("div",{className:"semiotic-tooltip",style:Le,children:[e&&Qo("div",{style:{fontWeight:"bold"},children:e+""}),Ko("div",{children:["n = ",o.n]}),Ko("div",{children:["Min: ",o.min.toLocaleString()]}),Ko("div",{children:["Q1: ",o.q1.toLocaleString()]}),Ko("div",{children:["Median: ",o.median.toLocaleString()]}),Ko("div",{children:["Q3: ",o.q3.toLocaleString()]}),Ko("div",{children:["Max: ",o.max.toLocaleString()]}),Ko("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return Ko("div",{className:"semiotic-tooltip",style:Le,children:[e&&Qo("div",{style:{fontWeight:"bold"},children:e+""}),Ko("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return Ko("div",{className:"semiotic-tooltip",style:Le,children:[t.category&&Qo("div",{style:{fontWeight:"bold"},children:t.category+""}),Ko("div",{children:["Count: ",t.count]}),2===e.length&&Ko("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,n=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return Zo(t);const a=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(n&&null!=t[n]?t[n]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?Ko("div",{className:"semiotic-tooltip",style:Le,children:[a&&Qo("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&Qo("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):Zo(t)}Uo.ownsChrome=!0;import{jsx as Jo,jsxs as ei}from"react/jsx-runtime";var ti={top:50,right:40,bottom:60,left:70},oi=Tt(It(function(e,t){const{chartType:o,runtimeMode:i,data:r,oAccessor:n="category",rAccessor:a="value",colorAccessor:l,symbolAccessor:c,symbolMap:u,stackBy:d,groupBy:p,multiAxis:f,timeAccessor:y,valueAccessor:v,categoryAccessor:b,accessorRevision:x,projection:w="vertical",size:A=[600,400],responsiveWidth:k,responsiveHeight:S,margin:_,barPadding:C,roundedTop:R,gradientFill:H,trackFill:B,baselinePadding:O,innerRadius:F,cornerRadius:E,normalize:N,startAngle:W,sweepAngle:j,dynamicColumnWidth:z,bins:G,showOutliers:V,showIQR:$,amplitude:q,connectorOpacity:Y,showLabels:ee,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,rExtent:ne,oExtent:ue,extentPadding:de=.05,oSort:fe,windowMode:ye="sliding",windowSize:ve=200,pieceStyle:be,summaryStyle:xe,renderMode:Ae,colorScheme:Se,barColors:_e,showAxes:Ce=!0,showCategoryTicks:Pe,categoryLabel:Re,valueLabel:Me,categoryFormat:Le,valueFormat:Te,oLabel:Be,rLabel:Oe,oFormat:Fe,rFormat:Ee,rTickValues:Ne,tickLabelEdgeAlign:De,axisExtent:We,enableHover:je=!0,hoverAnnotation:Ve,tooltipContent:$e,customHoverBehavior:qe,customClickBehavior:Xe,onObservation:Ke,annotationObservationCallback:Ze,chartId:Ue,annotations:Je,onAnnotationActivate:et,autoPlaceAnnotations:tt,svgAnnotationRules:ot,showGrid:it=!1,legend:rt,legendHoverBehavior:nt,legendClickBehavior:st,legendHighlightedCategory:at,legendIsolatedCategories:ht,legendPosition:dt,legendLayout:gt,legendCategoryAccessor:mt,onCategoriesChange:pt,backgroundGraphics:ft,foregroundGraphics:yt,title:bt,className:xt,background:wt,centerContent:St,decay:It,pulse:Tt,transition:Ht,animate:Bt,staleness:Ot,frameScheduler:Ft,clock:Et,random:Nt,seed:Dt,paused:Wt=!1,suspendWhenHidden:jt=!0,brush:zt,onBrush:Gt,accessibleTable:Vt=!0,description:$t,summary:qt,customLayout:Xt,onLayoutError:Yt,layoutConfig:Qt,layoutSelection:Kt}=e,{customHoverBehavior:Zt,customClickBehavior:Ut,hasClickBehavior:Jt}=I({customHoverBehavior:qe,customClickBehavior:Xe,onObservation:Ke,chartId:Ue,chartType:"StreamOrdinalFrame"}),eo=b??n,to=v??a,ro=_t(!0),no=lt({sizeProp:A,responsiveWidth:k,responsiveHeight:S,userMargin:_,marginDefault:ti,title:bt,legend:rt,legendPosition:dt,animate:Bt,transitionProp:Ht,frameScheduler:Ft,clock:Et,random:Nt,seed:Dt,paused:Wt,suspendWhenHidden:jt,themeDirtyRef:ro}),{reducedMotionRef:so,responsiveRef:ao,size:lo,margin:co,adjustedWidth:ho,adjustedHeight:uo,currentTheme:go,transition:mo,introEnabled:po,tableId:fo,rafRef:vo,renderFnRef:xo,scheduleRender:wo,frameRuntime:Ao}=no,ko=At(),_o=kt(),Co=Rt(()=>Ie(r),[r]),Po=Re??Be,Ro=Me??Oe,Mo=Le??Fe,Lo=Te??Ee,Io=_t(null),[To,Ho]=Ct(null),[Bo,Oo]=Ct(null),Fo=m(yt,lo,co,Bo),Eo=m(ft,lo,co,Bo),No=ft||"transparent"===wt?null:Jo("rect",{className:"semiotic-canvas-background","data-semiotic-layer":"canvas-background",x:-co.left,y:-co.top,width:lo[0],height:lo[1],fill:wt||"var(--semiotic-bg, transparent)"}),[Do,Wo]=Ct(0),jo=_t(0),[zo,Go]=Ct(!1),Vo=_t({w:-1,h:-1}),$o=_t(!1),qo=ut("StreamOrdinalFrame"),Xo=je||Ve,Qo="streaming"===i,Ko=Rt(()=>({chartType:o,runtimeMode:Qo?"streaming":"bounded",windowSize:ve,windowMode:ye,extentPadding:de,projection:w,oAccessor:Qo?void 0:eo,rAccessor:Qo?void 0:to,accessorRevision:x,colorAccessor:l,symbolAccessor:c,symbolMap:u,stackBy:d,groupBy:p,multiAxis:f,timeAccessor:Qo?y:void 0,valueAccessor:Qo?v||("string"==typeof to||"function"==typeof to?to:void 0):void 0,categoryAccessor:Qo?eo:void 0,rExtent:ne,oExtent:ue,axisExtent:We,barPadding:C,roundedTop:R,gradientFill:H,trackFill:B,baselinePadding:O,innerRadius:F,cornerRadius:E,normalize:N,startAngle:W,sweepAngle:j,dynamicColumnWidth:z,bins:G,showOutliers:V,showIQR:$,amplitude:q,connectorOpacity:Y,showLabels:ee,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,oSort:fe,pieceStyle:be,summaryStyle:xe,colorScheme:Se,themeCategorical:go?.colors?.categorical,themeSemantic:vt(go),themeSequential:go?.colors?.sequential,themeDiverging:go?.colors?.diverging,barColors:_e,decay:It,pulse:Tt,transition:mo,introAnimation:po,staleness:Ot,clock:Ao.now,customLayout:Xt,onLayoutError:Yt,layoutConfig:Qt,layoutMargin:co}),[o,Qo,ve,ye,de,w,eo,to,x,l,c,u,d,p,f,y,v,ne,ue,We,C,R,H,B,O,F,E,N,W,j,z,G,V,$,q,Y,ee,oe,ie,re,fe,be,xe,Se,go,_e,It,Tt,mo,po,Ot,Ao.now,Xt,Yt,Qt,co]),Zo=U(Ko),oi=_t(null);oi.current||(oi.current=new oo(Zo));const ii=M(oi,mt,pt,e=>e.getData());K(oi,Zo,ro,wo),Z(oi,Kt,ro,wo);const ri=_t(null);ri.current||(ri.current=new s(e=>{const t=oi.current;t&&t.ingest(e)&&(ro.current=!0,wo())}));const ni=Mt(e=>{ri.current?.push(e)},[]),si=Mt(e=>{ri.current?.pushMany(e)},[]),ai=Mt(()=>{ri.current?.clear(),oi.current?.clear(),ro.current=!0,wo()},[wo]),li=Mt(e=>{ri.current?.clearLastData(),ri.current?.setReplacementData(e)},[]);Lt(t,()=>({push:ni,pushMany:si,replace:li,remove:e=>{ri.current?.flush();const t=oi.current?.remove(e)??[];if(t.length>0){const e=Io.current?.data;!!Io.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Io.current=null,Ho(null)),ro.current=!0,wo()}return t},update:(e,t)=>{ri.current?.flush();const o=oi.current?.update(e,t)??[];return o.length>0&&(ro.current=!0,wo()),o},clear:ai,getData:()=>(ri.current?.flush(),oi.current?.getData()??[]),getScales:()=>oi.current?.scales??null,getCustomLayout:()=>oi.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>oi.current?.lastCustomLayoutFailure??null}),[ni,si,li,ai,wo]),Pt(()=>{r&&ri.current?.setBoundedData(Co)},[r,Co]);const{canvasRef:ci}=ct(no,{storeRef:oi,dirtyRef:ro,hydrated:ko,wasHydratingFromSSR:_o,cleanup:()=>ri.current?.clear(),canvasPaintDependencies:[o,ho,uo,Ce,wt,ft,Ae,wo]}),{hoverHandlerRef:hi,hoverLeaveRef:ui,onPointerMove:di,onPointerLeave:gi}=no;hi.current=e=>{if(!Xo)return;const t=ci.current;if(!t)return;const i=t.getBoundingClientRect(),r=e.clientX-i.left-co.left,n=e.clientY-i.top-co.top;if(0>r||r>ho||0>n||n>uo)return void(Io.current&&(Io.current=null,Ho(null),Zt&&Zt(null),wo()));const s=oi.current;if(!s||0===s.scene.length)return;const a="radial"===w,l=io(s.scene,a?r-ho/2:r,a?n-uo/2:n,30,s.pointQuadtree,s.maxPointRadius);if(!l)return void(Io.current&&(Io.current=null,Ho(null),Zt&&Zt(null),wo()));const c=we(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof eo?eo:void 0,__rAccessor:"string"==typeof to?to:void 0,__chartType:o});Io.current=c,Ho(c),Zt&&(Zt(c),ro.current=!0),wo()},ui.current=()=>{Io.current&&(Io.current=null,Ho(null),Zt&&(Zt(null),ro.current=!0),wo())};const mi=Mt(e=>{if(ze(e.target))return;if(!Ut)return;const t=ci.current;if(!t)return Ut(null),ro.current=!0,void wo();const i=t.getBoundingClientRect(),r=e.clientX-i.left-co.left,n=e.clientY-i.top-co.top;if(0>r||r>ho||0>n||n>uo)return Ut(null),ro.current=!0,void wo();const s=oi.current;if(!s||0===s.scene.length)return Ut(null),ro.current=!0,void wo();const a="radial"===w,l=io(s.scene,a?r-ho/2:r,a?n-uo/2:n,30,s.pointQuadtree,s.maxPointRadius);if(!l)return Ut(null),ro.current=!0,void wo();Ut(we(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof eo?eo:void 0,__rAccessor:"string"==typeof to?to:void 0,__chartType:o}),{type:"activate",inputType:Ye(e.nativeEvent.pointerType)}),ro.current=!0,wo()},[Ut,ci,co.left,co.top,ho,uo,w,eo,to,o,wo]),{kbFocusIndexRef:pi,focusedNavPointRef:fi,onKeyDown:yi}=L({storeRef:oi,hoverRef:Io,setHoverPoint:Ho,customHoverBehavior:Zt,customClickBehavior:Ut,scheduleRender:wo,chartType:o,oAccessor:eo,rAccessor:to}),vi=Mt(e=>{pi.current=-1,fi.current=null,di(e)},[fi,pi,di]);xo.current=()=>{if(vo.current=null,!Ao.isActive)return;const e=ci.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const i=oi.current;if(!i)return;const r=Ao.now(),n=i.advanceTransition(so.current?r+1e6:r),s=!so.current&&n,a=Vo.current.w!==ho||Vo.current.h!==uo,l=ro.current;let c=!1;const h=qo.current.beforeCompute(i.getLastUpdateResult(),s);!l&&!a||s&&!a||(i.computeScene({width:ho,height:uo}),Vo.current={w:ho,h:uo},c=!0,ii()),qo.current.afterCompute(h,c,a),ro.current=l&&s&&!c;const u=P(i,r,c,$o);(c||s)&&e.setAttribute("aria-label",ke(i.scene,o+" chart"));const d=He(),g=lo[0]*d,m=lo[1]*d;e.width===g&&e.height===m||(e.width=g,e.height=m,e.style.width=lo[0]+"px",e.style.height=lo[1]+"px"),t.setTransform(d,0,0,d,0,0),t.clearRect(0,0,lo[0],lo[1]);const p=Ot&&i.lastIngestTime>0&&r-i.lastIngestTime>(Ot?.threshold??5e3);p&&(t.globalAlpha=Ot?.dimOpacity??.5);const f="radial"===w;t.save(),t.beginPath(),t.rect(co.left,co.top,ho,uo),t.clip(),f?(t.save(),t.translate(co.left+ho/2,co.top+uo/2)):t.translate(co.left,co.top);const y=Xt?Yo.custom:Yo[o]||[],v={width:ho,height:uo},b=i.scales;b&&X({context:t,nodes:i.scene,renderMode:Ae,pixelRatio:d,paintBuiltIn:e=>{for(const o of y)o(t,e,b,v)}}),f&&t.restore(),t.restore(),p&&(t.globalAlpha=1),c&&i.scales?(Oo(i.scales),Wo(e=>e+1),jo.current=r):s&&i.scales&&r-jo.current>=33&&(Wo(e=>e+1),jo.current=r),Ot?.showBadge&&Go(!!p),(s||null!=i.activeTransition||u.pending)&&wo()},J(Ot,oi,ro,wo,zo,Go);const bi=Xo&&To?$e?$e(To):Jo(Uo,{hover:To}):null,xi="radial"===w,wi=bi?Jo(ce,{x:To?xi?To.x+ho/2:To.x:0,y:To?xi?To.y+uo/2:To.y:0,containerWidth:ho,containerHeight:uo,margin:co,className:"stream-ordinal-tooltip",children:bi}):null,Ai="horizontal"===w?eo:to,ki=g("horizontal"===w?to:eo,void 0,"__semiotic_resolvedO",""),Si=g(Ai,void 0,"__semiotic_resolvedR",""),_i=ki.key,Ci=Si.key,Pi=h(ki,Si,Je&&Je.length>0||!1);if(Ge||!ko&&_o){const e=oi.current;e&&r&&(e.ingest({inserts:Co,bounded:!0}),e.computeScene({width:ho,height:uo}));const t=e?.scene??[],o=e?.scales??null,i=m(yt,lo,co,o),n=m(ft,lo,co,o),s="radial"===w,a=s?co.left+ho/2:co.left,l=s?co.top+uo/2:co.top;return ei("div",{ref:ao,className:"stream-ordinal-frame"+(xt?" "+xt:""),role:"img","aria-label":$t||("string"==typeof bt?bt:"Ordinal chart"),style:{position:"relative",width:k?"100%":lo[0],height:S?"100%":lo[1]},children:[Jo(me,{summary:qt}),ei("svg",{xmlns:"http://www.w3.org/2000/svg",width:lo[0],height:lo[1],style:{position:"absolute",left:0,top:0},children:[n&&Jo("g",{transform:`translate(${co.left},${co.top})`,children:n}),ei("g",{transform:`translate(${a},${l})`,children:[wt&&Jo("rect",{x:0,y:0,width:ho,height:uo,fill:wt}),t.map((e,t)=>Q({node:e,index:t,renderMode:Ae,fallback:()=>Qe(e,t,fo)})).filter(Boolean)]})]}),Jo(bo,{width:ho,height:uo,totalWidth:lo[0],totalHeight:lo[1],margin:co,scales:o,showAxes:Ce,showCategoryTicks:Pe,oLabel:Po,rLabel:Ro,oFormat:Mo,rFormat:Lo,rTickValues:Ne,tickLabelEdgeAlign:De,axisExtent:We,showGrid:it,title:bt,legend:rt,legendHoverBehavior:nt,legendClickBehavior:st,legendHighlightedCategory:at,legendIsolatedCategories:ht,legendPosition:dt,legendLayout:gt,foregroundGraphics:D(i,te(oi.current?.customLayoutOverlays,Kt??null)),annotations:Je,onAnnotationActivate:et,onObservation:Ze??Ke,chartId:Ue,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:tt,svgAnnotationRules:ot,annotationFrame:0,xAccessor:_i,yAccessor:Ci,annotationData:Pi(e?.getData())}),St&&"radial"===w&&Jo("div",{style:{position:"absolute",left:co.left+ho/2,top:co.top+uo/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:St})]})}return ei("div",{ref:ao,className:"stream-ordinal-frame"+(xt?" "+xt:""),role:"group","aria-label":$t||("string"==typeof bt?bt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:k?"100%":lo[0],height:S?"100%":lo[1],overflow:"visible"},onKeyDown:yi,children:["production"!==process.env.NODE_ENV&&oi.current&&Jo(ge,{store:oi.current,diagnostics:qo.current}),Vt&&Jo(pe,{tableId:fo}),Vt&&Jo(se,{scene:oi.current?.scene??[],chartType:o+" chart",tableId:fo,chartTitle:"string"==typeof bt?bt:void 0}),Jo(me,{summary:qt}),Jo(ae,{hoverPoint:To}),ei("div",{role:"img","aria-label":$t||("string"==typeof bt?bt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Xo?vi:void 0,onMouseLeave:Xo?gi:void 0,onClick:Jt?mi:void 0,children:[ei(le,{size:lo,margin:co,children:[No,Eo]}),Jo(yo,{width:ho,height:uo,totalWidth:lo[0],totalHeight:lo[1],margin:co,scales:Bo,showAxes:Ce,showGrid:it,rFormat:Lo,rTickValues:Ne,axisExtent:We}),Jo("canvas",{ref:ci,"aria-label":ke(oi.current?.scene??[],o+" chart"),style:{position:"absolute",top:0,left:0,width:lo[0],height:lo[1]}}),Jo(bo,{width:ho,height:uo,totalWidth:lo[0],totalHeight:lo[1],margin:co,scales:Bo,showAxes:Ce,showCategoryTicks:Pe,oLabel:Po,rLabel:Ro,oFormat:Mo,rFormat:Lo,rTickValues:Ne,axisExtent:We,showGrid:it,title:bt,legend:rt,legendHoverBehavior:nt,legendClickBehavior:st,legendHighlightedCategory:at,legendIsolatedCategories:ht,legendPosition:dt,legendLayout:gt,foregroundGraphics:D(Fo,te(oi.current?.customLayoutOverlays,Kt??null)),annotations:Je,onAnnotationActivate:et,onObservation:Ze??Ke,chartId:Ue,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:tt,svgAnnotationRules:ot,annotationFrame:Do,xAccessor:_i,yAccessor:Ci,annotationData:Pi(oi.current?.getData()),underlayRendered:!0,canvasObscuresUnderlay:!1}),(zt||Gt)&&"radial"!==w&&Jo(So,{width:ho,height:uo,totalWidth:lo[0],totalHeight:lo[1],margin:co,scales:Bo,onBrush:Gt||(()=>{})}),St&&"radial"===w&&Jo("div",{style:{position:"absolute",left:co.left+ho/2,top:co.top+uo/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:St}),Ot?.showBadge&&Jo(T,{isStale:zo,position:Ot.badgePosition}),Jo(he,{active:pi.current>=0,hoverPoint:To,margin:co,size:lo,shape:fi.current?.shape,width:fi.current?.w,height:fi.current?.h}),wi]})]})}));oi.displayName="StreamOrdinalFrame";var ii=oi;import{forwardRef as ri,useMemo as ni}from"react";import{jsx as si}from"react/jsx-runtime";var ai=ri(function(e,t){const{data:o,layout:i,layoutConfig:n,onLayoutError:s,categoryAccessor:a="category",valueAccessor:l="value",oExtent:c,rExtent:h,projection:u="vertical",margin:d,className:g,colorBy:m,colorScheme:p,showAxes:f=!1,annotations:y,onObservation:v,onClick:b,selection:x,linkedHover:w,chartId:A,loading:k,loadingContent:S,emptyContent:_,frameProps:C={}}=e,{frameRef:P,resolved:R,safeData:M,setup:L,earlyReturn:I}=r({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorBy:m,colorScheme:p,selection:x,linkedHover:w,onObservation:v,onClick:b,chartId:A,loading:k,loadingContent:S,emptyContent:_,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),T=L.effectiveSelectionHook,H=ni(()=>T?.isActive?{isActive:!0,predicate:T.predicate}:null,[T?.isActive,T?.predicate]);if(I)return I;const{width:F,height:E,enableHover:N,showGrid:D,title:W,description:j,summary:z,accessibleTable:G}=R,V={chartType:"custom",...null!=o&&{data:M},customLayout:i,layoutConfig:n,onLayoutError:s,...H&&{layoutSelection:H},oAccessor:a,rAccessor:l,oExtent:c,rExtent:h,projection:u,colorAccessor:m,colorScheme:p,size:[F,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:L.margin,enableHover:N,showAxes:f,showGrid:D,annotations:y,...B({title:W,description:j,summary:z,accessibleTable:G,className:g,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...O({linkedHover:w,selection:x,onObservation:v,onClick:b,hoverHighlight:!1,mobileInteraction:L.mobileInteraction,customHoverBehavior:L.customHoverBehavior,customClickBehavior:L.customClickBehavior}),...C};return si(wt,{componentName:"OrdinalCustomChart",width:F,height:E,children:si(ii,{ref:P,...V})})});ai.displayName="OrdinalCustomChart";import{useMemo as li,forwardRef as ci,useRef as hi}from"react";import{useImperativeHandle as ui}from"react";function di({ref:e,frameRef:t,setup:o}){return ui(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,o)=>t.current?.update(e,o)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}import{useMemo as gi}from"react";function mi(e){const{colorBy:t,colorScale:i,color:r,themeCategorical:n,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:h,opacity:u,effectiveSelectionHook:d,resolvedSelection:g,cycleByCategory:m=!1,baseStyleExtras:p,linkStrokeToFill:f=!1,styleRules:y,resolveRuleValue:v}=e,b=gi(()=>(e,o)=>{const l="function"==typeof p?p(e,o):p,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!i)return c;c.fill=Te(e,t,i)}else c.fill=tt(r,n,s,m?o:void 0,a);if(y&&y.length>0){const t=ie(e,y,{value:v?v(e):void 0,category:o});Object.assign(c,t)}return f&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,i,r,n,s,a,m,p,f,y,v]),x=gi(()=>o(l?"function"==typeof l?(e,t)=>({...b(e,t),...l(e,t)||{}}):(e,t)=>({...b(e,t),...l}):b,{stroke:c,strokeWidth:h,opacity:u}),[b,l,c,h,u]);return gi(()=>pt(x,d??null,g),[x,d,g])}import{jsx as pi}from"react/jsx-runtime";var fi=ci(function(o,r){const n=at(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),s=hi(null),{data:a,margin:l,className:c,categoryAccessor:h="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:m,colorScheme:p,sort:f=!1,barPadding:y=40,roundedTop:v,gradientFill:b=!1,styleRules:x,baselinePadding:w=!1,tooltip:A,annotations:k,regression:S,valueExtent:_,frameProps:C={},selection:P,linkedHover:R,onObservation:M,onClick:L,hoverHighlight:I,chartId:T,loading:H,loadingContent:F,emptyContent:D,legendInteraction:W,legendPosition:j,color:z,stroke:G,strokeWidth:V,opacity:$,showCategoryTicks:q,categoryFormat:X,dataIdAccessor:Y}=o,{width:Q,height:K,enableHover:Z,showGrid:U,showLegend:J,title:ee,description:te,summary:ie,accessibleTable:re,categoryLabel:ne,valueLabel:se}=n,ae=li(()=>Ie(a),[a]),le=i({data:ae,rawData:a,colorBy:m,colorScheme:p,legendInteraction:W,legendPosition:j,selection:P,linkedHover:R,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:M,onClick:L,hoverHighlight:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BarChart",chartId:T,showLegend:J,userMargin:l,marginDefaults:n.marginDefaults,loading:H,loadingContent:F,emptyContent:D,width:Q,height:K}),{effectiveLegendProps:ce,effectiveMargin:he}=di({ref:r,frameRef:s,setup:le});St("BarChart",ae,"categoryAccessor",h),St("BarChart",ae,"valueAccessor",u);const ue=dt(ae,f,u),de=gt(),ge=li(()=>new Map,[]),me=li(()=>oe(u),[u]),pe=mi({colorBy:m,colorScale:le.colorScale,color:z,themeCategorical:de,colorScheme:p,categoryIndexMap:ge,userPieceStyle:C?.pieceStyle,stroke:G,strokeWidth:V,opacity:$,styleRules:x,resolveRuleValue:me,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection}),fe=li(()=>E({categoryAccessor:h,valueAccessor:u,groupAccessor:m&&m!==h?m:void 0,groupLabel:"string"==typeof m?m:"group",valueFormat:g}),[h,u,m,g]);if(le.earlyReturn)return le.earlyReturn;const ye=t({componentName:"BarChart",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(ye)return pi(xt,{componentName:"BarChart",message:ye,width:Q,height:K});const ve=e(S),be=ve?[ve,...k||[]]:k,xe={chartType:"bar",...null!=a&&{data:ue},oAccessor:h,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:pe,size:[Q,K],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:he,barPadding:y,...null!=v&&{roundedTop:v},...b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b},...Y&&{dataIdAccessor:Y},baselinePadding:w,enableHover:Z,showAxes:n.showAxes,oLabel:ne,rLabel:se,rFormat:g,...X&&{oFormat:X},showGrid:U,showCategoryTicks:q,oSort:f,...ce,...B({title:ee,description:te,summary:ie,accessibleTable:re,className:c,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...N({tooltip:A,defaultTooltipContent:fe}),...O({linkedHover:R,selection:P,onObservation:M,onClick:L,hoverHighlight:I,mobileInteraction:le.mobileInteraction,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior}),...be&&be.length>0&&{annotations:be},..._&&{rExtent:_},...Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e))};return pi(wt,{componentName:"BarChart",width:Q,height:K,children:pi(ii,{ref:s,...xe})})});fi.displayName="BarChart";import{useMemo as yi,forwardRef as vi,useRef as bi}from"react";import{jsx as xi}from"react/jsx-runtime";var wi=vi(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=bi(null),{data:s,margin:a,className:l,categoryAccessor:c="category",stackBy:h,valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:m,colorScheme:p,normalize:f=!1,sort:y=!1,barPadding:v=40,roundedTop:b,styleRules:x,baselinePadding:w=!1,tooltip:A,annotations:k,valueExtent:S,frameProps:_={},selection:C,linkedHover:P,onObservation:R,onClick:M,hoverHighlight:L,chartId:I,loading:T,loadingContent:H,emptyContent:F,legendInteraction:D,legendPosition:W,color:j,stroke:z,strokeWidth:G,opacity:V,categoryFormat:$}=e,{width:q,height:X,enableHover:Y,showGrid:Q,showLegend:K,title:Z,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:ie}=r,re=yi(()=>Ie(s),[s]),ne=m||h,se=i({data:re,rawData:s,colorBy:ne,colorScheme:p,legendInteraction:D,legendPosition:W,selection:C,linkedHover:P,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!0,onObservation:R,onClick:M,hoverHighlight:L,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"StackedBarChart",chartId:I,showLegend:K,userMargin:a,marginDefaults:r.marginDefaults,loading:T,loadingContent:H,emptyContent:F,width:q,height:X}),ae=gt(),le=yi(()=>new Map,[]),ce=yi(()=>oe(u),[u]),he=mi({colorBy:ne,colorScale:se.colorScale,color:j,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:_?.pieceStyle,stroke:z,strokeWidth:G,opacity:V,styleRules:x,resolveRuleValue:ce,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),ue=yi(()=>E({categoryAccessor:h,valueAccessor:u,groupAccessor:c,valueFormat:g}),[h,c,u,g]),de=t({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u},requiredProps:{stackBy:h}}),{effectiveLegendProps:ge,effectiveMargin:me}=di({ref:o,frameRef:n,setup:se});if(se.earlyReturn)return se.earlyReturn;const pe={chartType:"bar",...null!=s&&{data:re},oAccessor:c,rAccessor:u,stackBy:h,normalize:f,oSort:y,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:he,size:[q,X],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:me,barPadding:v,...null!=b&&{roundedTop:b},baselinePadding:w,enableHover:Y,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:te,rLabel:ie,rFormat:g,...$&&{oFormat:$},showGrid:Q,...ge,...B({title:Z,description:U,summary:J,accessibleTable:ee,className:l,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:A,defaultTooltipContent:ue}),...O({linkedHover:P,selection:C,onObservation:R,onClick:M,hoverHighlight:L,mobileInteraction:se.mobileInteraction,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior}),...k&&k.length>0&&{annotations:k},...S&&{rExtent:S},...Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e))};return de?xi(xt,{componentName:"StackedBarChart",message:de,width:q,height:X}):xi(wt,{componentName:"StackedBarChart",width:q,height:X,children:xi(ii,{ref:n,...pe})})});wi.displayName="StackedBarChart";import*as Ai from"react";import{useMemo as ki,useCallback as Si,forwardRef as _i,useRef as Ci,useImperativeHandle as Pi}from"react";import{useRef as Ri,useState as Mi,useCallback as Li,useMemo as Ii}from"react";import{useMemo as Ti,useCallback as Hi,useRef as Bi}from"react";var Oi={RdBu:Ne,PiYG:Ee,PRGn:Fe,BrBG:Oe,RdYlBu:De,RdYlGn:We,Spectral:je},Fi="__likert_neutral_neg",Ei="__likert_neutral_pos";function Ni(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Di(e,t,o,i,r,n){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(i){const e=i(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const r=t[o];c.set(r,(c.get(r)||0)+1)}else if(r&&n){const e=r(l),t=n(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let i=0;for(const e of t)i+=o.get(e)||0;if(0!==i)for(let r=0;t.length>r;r++){const n=t[r],s=o.get(n)||0;l.push({__likertCategory:e,__likertLevel:n,__likertLevelLabel:n,__likertCount:s,__likertPct:s/i*100,__likertLevelIndex:r})}}return l}function Wi(e,t){const o=t.length,i=o%2!=0,r=Math.floor(o/2),n=[];for(const t of e){const e=t.__likertLevelIndex;if(i&&e===r){const e=t.__likertPct/2;n.push({...t,__likertLevel:Fi,__likertPct:-e}),n.push({...t,__likertLevel:Ei,__likertPct:e})}else n.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return n}function ji(e,t){const o=t.length,i=o%2!=0,r=Math.floor(o/2),n=new Map;for(const t of e){const e=n.get(t.__likertCategory)||[];e.push(t),n.set(t.__likertCategory,e)}const s=[];for(const[,e]of n){const t=new Map;let n,a;for(const o of e)o.__likertLevel===Fi?n=o:o.__likertLevel===Ei?a=o:t.set(o.__likertLevelIndex,o);i&&n&&s.push(n);for(let e=r-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}i&&a&&s.push(a);for(let e=i?r+1:r;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}var zi=["Very Low","Low","Neutral","High","Very High"];import{jsx as Gi}from"react/jsx-runtime";var Vi=new Map,$i=_i(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Ci(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:h,levelAccessor:u,countAccessor:d="count",levels:g=zi,orientation:m="horizontal",colorScheme:p,barPadding:f=20,tooltip:y,annotations:v,valueExtent:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:S,hoverHighlight:_,chartId:C,valueFormat:P,loading:R,loadingContent:M,emptyContent:L,legendInteraction:I,legendPosition:T,categoryFormat:H,stroke:B,strokeWidth:F,opacity:E}=e,{width:N,height:D,enableHover:W,showGrid:j,showLegend:z,title:G,description:V,summary:$,accessibleTable:q,categoryLabel:X,valueLabel:Y}=r,Q="horizontal"===m,K=void 0===s,Z=!u,U=mt(),J=ki(()=>p&&Array.isArray(p)&&p.length>=g.length?p:function(e,t){if(0>=e)return[];if(t){const o=Oi[t];if(o){if(1===e)return[o(.5)];const t=[];for(let i=0;e>i;i++)t.push(o(i/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],i=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const n=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);n&&a.push(r);for(let e=0;s>e;e++)a.push(i[Math.min(Math.floor(e*i.length/s),i.length-1)]);return a}(g.length,U),[p,g.length,U]),ee=ki(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],J[t]||"#888");return e},[g,J]),{processedData:te,reAggregate:oe,accumulatorRef:ie}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:i,levelAccessor:r,countAccessor:n,isDiverging:s,frameRef:a}){const l=!r,c=Ti(()=>Ni(o,"question"),[o]),h=Ti(()=>l?Ni(i,"score"):null,[l,i]),u=Ti(()=>l?null:Ni(r,"level"),[l,r]),d=Ti(()=>l?null:Ni(n,"count"),[l,n]),g=Bi([]);return{processedData:Ti(()=>{const o=e||[];if(0===o.length)return[];let i=Di(o,t,c,h,u,d);return s&&(i=Wi(i,t),i=ji(i,t)),i},[e,t,c,h,u,d,s]),reAggregate:Hi(e=>{let o=Di(e,t,c,h,u,d);s&&(o=Wi(o,t),o=ji(o,t)),a.current?.replace(o)},[t,c,h,u,d,s,a]),accumulatorRef:g}}({data:s,levels:g,categoryAccessor:c,valueAccessor:h,levelAccessor:u,countAccessor:d,isDiverging:Q,frameRef:n}),re="__likertLevelLabel",ne=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:i,legendPosition:r="right"}){const n=Ri(new Set),s=Ri([]),[a,l]=Mi(0),c=st(),h=gt(),u=Li(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),d=Li(o=>{if(!e||!t)return;let i=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=u(e);null==t||n.current.has(t)||(n.current.add(t),s.current.push(t),i=!0)}i&&l(e=>e+1)},[e,t,u]),g=Li(o=>{if(!e||!t)return;const i=Array.from(new Set(o.map(String))),r=s.current;r.length===i.length&&r.every((e,t)=>e===i[t])||(n.current=new Set(i),s.current=i,l(e=>e+1))},[e,t]),m=Li(e=>t=>{d([t]),e(t)},[d]),p=Li(e=>t=>{d(t),e(t)},[d]),f=Li(()=>{n.current=new Set,s.current=[],l(e=>e+1)},[]);ht(e&&t?s.current:[]);const y=Ii(()=>{if(!e||!t||!1===i)return;const r=s.current;if(0===r.length)return;const n=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:h&&h.length>0?h:ue,a="string"==typeof t?t:"__streamCat",l=r.map(e=>({[a]:e})),u=Ce(l,a,n);return Me({data:l,colorBy:a,colorScale:e=>c?.[e]||u(e)||"#999",getColor:Te})},[e,t,i,o,c,h,a]),v=Ii(()=>{if(y)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[y,r]);return{wrapPush:m,wrapPushMany:p,resetCategories:f,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:g}:{},streamingLegend:y,streamingMarginAdjust:v}}({isPushMode:K,colorBy:re,colorScheme:J,showLegend:z,legendPosition:T}),{wrapPush:se,wrapPushMany:ae}=ne,le=Si(e=>se(e=>{ie.current.push(e),oe(ie.current)})(e),[se,oe,ie]),ce=Si(e=>ae(e=>{ie.current.push(...e),oe(ie.current)})(e),[ae,oe,ie]);Pi(o,()=>({push:le,pushMany:ce,remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>{ie.current=[],ne.resetCategories(),n.current?.clear()},getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}),[le,ce,ie,ne]);const he=i({data:te,rawData:s,colorBy:re,colorScheme:J,legendInteraction:I,legendPosition:T,selection:w,linkedHover:A,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:_,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"LikertChart",chartId:C,showLegend:z,userMargin:a,marginDefaults:r.marginDefaults,loading:R,loadingContent:M,emptyContent:L,width:N,height:D}),de=ki(()=>{const e=g.length;return e%2!=0&&ee.get(g[Math.floor(e/2)])||"#888"},[g,ee]),ge=mi({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Vi,userPieceStyle:x?.pieceStyle,stroke:B,strokeWidth:F,opacity:E,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===Fi||o===Ei)return{fill:de};const i=t||o;return i&&ee.has(i)?{fill:ee.get(i)}:{fill:"#888"}}}),me=ki(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),pe=ki(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",i=o===Fi||o===Ei?me:o,r=t.__likertCategory||"",n=Math.abs(t.__likertPct||0),s=o===Fi||o===Ei?2*n:n,a=t.__likertCount||0;return Ai.createElement("div",{className:"semiotic-tooltip",style:Le},Ai.createElement("div",{style:{fontWeight:"bold"}},r),Ai.createElement("div",{style:{marginTop:4}},`${i}: ${s.toFixed(1)}% (n=${a})`))},[me]),fe=ki(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(h&&u)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(u&&!d)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:c};return Z?h&&(e.valueAccessor=h):(u&&(e.levelAccessor=u),d&&(e.countAccessor=d)),t({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:g}})},[s,c,h,u,d,g,Z]),ye=ki(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,ee]),ve=ki(()=>!1!==z?{...he.legendBehaviorProps,legend:{legendGroups:ye},legendPosition:T||he.legendPosition||"bottom"}:he.legendBehaviorProps,[he.legendBehaviorProps,he.legendPosition,T,z,ye]),be=ki(()=>{const e={...he.margin};if(K&&!1!==z){const t=T||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ne.streamingMarginAdjust)for(const[t,o]of Object.entries(ne.streamingMarginAdjust))o>e[t]&&(e[t]=o);return Q&&100>e.left&&(e.left=100),e},[he.margin,ne.streamingMarginAdjust,Q,K,z,T]),xe=ki(()=>P||(Q?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Q,P]);if(he.earlyReturn)return he.earlyReturn;const we={chartType:"bar",...null!=s&&{data:te},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:Q?"horizontal":"vertical",pieceStyle:ge,size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:be,barPadding:f,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:X,rLabel:Y||(Q?void 0:"Percentage"),rFormat:xe,...H&&{oFormat:H},showGrid:j,...ve,...G&&{title:G},...V&&{description:V},...$&&{summary:$},...void 0!==q&&{accessibleTable:q},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===y?()=>null:!0===y?pe:qe(y)||pe,...O({linkedHover:A,selection:w,onObservation:k,onClick:S,hoverHighlight:_,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...v&&v.length>0&&{annotations:v},...b&&{rExtent:b},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return fe?Gi(xt,{componentName:"LikertChart",message:fe,width:N,height:D}):Gi(wt,{componentName:"LikertChart",width:N,height:D,children:Gi(ii,{ref:n,...we})})});$i.displayName="LikertChart";import{useMemo as qi,forwardRef as Xi,useRef as Yi}from"react";import{useCallback as Qi,useRef as Ki}from"react";function Zi({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:i}){const r=$e("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),n="string"==typeof i?i:"value",s=nt({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||n}),a=Ki(s.brushInteraction);a.current=s.brushInteraction;const l=Qi(e=>{if(r){a.current.end(e?e.r:null)}t?.(e)},[t,r]),c=!!(e||o||t);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}import{jsx as Ui}from"react/jsx-runtime";var Ji=Xi(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=Yi(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:h="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:m,colorScheme:p,sizeBy:f,sizeRange:y=[3,8],symbolBy:v,symbolMap:b,pointRadius:x=4,pointOpacity:w=.7,categoryPadding:A=20,tooltip:k,annotations:S,valueExtent:_,brush:C,onBrush:P,linkedBrush:R,frameProps:M={},selection:L,linkedHover:I,onObservation:T,onClick:H,hoverHighlight:F,chartId:D,loading:W,loadingContent:j,emptyContent:z,legendInteraction:G,legendPosition:V,color:$,stroke:q,strokeWidth:X,opacity:Y,showCategoryTicks:Q,categoryFormat:K}=e,{width:Z,height:U,enableHover:J,showGrid:ee,showLegend:te,title:oe,description:ie,summary:re,accessibleTable:ne,categoryLabel:se,valueLabel:ae}=r,le=qi(()=>Ie(a),[a]),ce=i({data:le,rawData:a,colorBy:m,colorScheme:p,legendInteraction:G,legendPosition:V,selection:L,linkedHover:I,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:T,onClick:H,hoverHighlight:F,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"SwarmPlot",chartId:D,showLegend:te,userMargin:l,marginDefaults:r.marginDefaults,loading:W,loadingContent:j,emptyContent:z,width:Z,height:U}),he=Zi({brushProp:C,onBrushProp:P,linkedBrush:R,valueAccessor:u}),ue=qi(()=>{if(!f)return;const e=le.map(e=>"function"==typeof f?f(e):e[f]);return yt(e)},[le,f]),de=gt(),ge=qi(()=>new Map,[]),me=mi({colorBy:m,colorScale:ce.colorScale,color:$,themeCategorical:de,colorScheme:p,categoryIndexMap:ge,userPieceStyle:M?.pieceStyle,stroke:q,strokeWidth:X,opacity:Y,effectiveSelectionHook:ce.effectiveSelectionHook,resolvedSelection:ce.resolvedSelection,baseStyleExtras:e=>({fillOpacity:w,r:f?Be(e,f,y,ue):x})}),pe=qi(()=>E({categoryAccessor:h,valueAccessor:u,groupAccessor:m||void 0,valueFormat:g}),[h,u,m,g]);if(ce.earlyReturn)return ce.earlyReturn;const fe=t({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(fe)return Ui(xt,{componentName:"SwarmPlot",message:fe,width:Z,height:U});const ye={chartType:"swarm",...null!=a&&{data:le},oAccessor:h,rAccessor:u,...v&&{symbolAccessor:v},...b&&{symbolMap:b},projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:me,size:[Z,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce.margin,barPadding:A,enableHover:J,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:se,rLabel:ae,rFormat:g,...K&&{oFormat:K},showGrid:ee,showCategoryTicks:Q,...ce.legendBehaviorProps,...B({title:oe,description:ie,summary:re,accessibleTable:ne,className:c,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:k,defaultTooltipContent:pe}),...O({linkedHover:I,selection:L,onObservation:T,onClick:H,hoverHighlight:F,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior}),...S&&S.length>0&&{annotations:S},..._&&{rExtent:_},...he.brushStreamProps,...Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e))};return Ui(wt,{componentName:"SwarmPlot",width:Z,height:U,children:Ui(ii,{ref:s,...ye})})});Ji.displayName="SwarmPlot";import{useMemo as er,forwardRef as tr,useRef as or}from"react";import{jsx as ir,jsxs as rr}from"react/jsx-runtime";function nr(e){return t=>{const o=t.category||t.data&&t.data[0]?.category||"",i=t.stats||(t.data||t).stats;if(i&&null!=i.median)return rr("div",{className:"semiotic-tooltip",style:Le,children:[o&&ir("div",{style:{fontWeight:"bold"},children:o+""}),null!=i.n&&rr("div",{children:["n = ",i.n]}),null!=i.min&&rr("div",{children:["Min: ",i.min.toLocaleString()]}),null!=i.q1&&rr("div",{children:["Q1: ",i.q1.toLocaleString()]}),rr("div",{children:["Median: ",i.median.toLocaleString()]}),null!=i.q3&&rr("div",{children:["Q3: ",i.q3.toLocaleString()]}),null!=i.max&&rr("div",{children:["Max: ",i.max.toLocaleString()]}),null!=i.mean&&rr("div",{style:{opacity:.8},children:["Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const i=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),n=r.length,s=n>0?n%2!=0?r[Math.floor(n/2)]:(r[n/2-1]+r[n/2])/2:null;return rr("div",{className:"semiotic-tooltip",style:Le,children:[o&&ir("div",{style:{fontWeight:"bold"},children:o+""}),n>0&&rr("div",{children:["n = ",n]}),null!=s&&rr("div",{children:["Median: ",s.toLocaleString()]})]})}return ir("div",{className:"semiotic-tooltip",style:Le,children:ir("div",{style:{fontWeight:"bold"},children:o+""})})}}import{jsx as sr}from"react/jsx-runtime";var ar=tr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=or(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:h="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:m,colorScheme:p,showOutliers:f=!0,outlierRadius:y=3,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,frameProps:A={},selection:k,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:P,chartId:R,loading:M,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:H,color:F,stroke:E,strokeWidth:D,opacity:W,showCategoryTicks:j,categoryFormat:z}=e,{width:G,height:V,enableHover:$,showGrid:q,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=r,ee=er(()=>Ie(a),[a]),te=i({data:ee,rawData:a,colorBy:m,colorScheme:p,legendInteraction:T,legendPosition:H,selection:k,linkedHover:S,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"BoxPlot",chartId:R,showLegend:X,userMargin:l,marginDefaults:r.marginDefaults,loading:M,loadingContent:L,emptyContent:I,width:G,height:V}),oe=gt(),ie=er(()=>new Map,[]),re=mi({colorBy:m,colorScale:te.colorScale,color:F,themeCategorical:oe,colorScheme:p,categoryIndexMap:ie,userPieceStyle:void 0,stroke:E,strokeWidth:D,opacity:W,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ne=er(()=>nr(),[]);if(te.earlyReturn)return te.earlyReturn;const se=t({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(se)return sr(xt,{componentName:"BoxPlot",message:se,width:G,height:V});const ae={chartType:"boxplot",...null!=a&&{data:ee},oAccessor:h,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,showOutliers:f,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,barPadding:v,enableHover:$,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:U,rLabel:J,rFormat:g,...z&&{oFormat:z},showGrid:q,showCategoryTicks:j,...te.legendBehaviorProps,...B({title:Y,description:Q,summary:K,accessibleTable:Z,className:c,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:b,defaultTooltipContent:ne}),...O({linkedHover:S,selection:k,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...x&&x.length>0&&{annotations:x},...w&&{rExtent:w},...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return sr(wt,{componentName:"BoxPlot",width:G,height:V,children:sr(ii,{ref:s,...ae})})});ar.displayName="BoxPlot";import{useMemo as lr,forwardRef as cr,useRef as hr}from"react";import{jsx as ur,jsxs as dr}from"react/jsx-runtime";var gr=e=>{const t=e?.category;return null==t?"All":t+""},mr=cr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=hr(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:h=gr,valueAccessor:u="value",bins:d=25,relative:g=!1,valueFormat:m,colorBy:p,colorScheme:f,categoryPadding:y=20,tooltip:v,annotations:b,valueExtent:x,brush:w,onBrush:A,linkedBrush:k,frameProps:S={},selection:_,linkedHover:C,onObservation:P,onClick:R,hoverHighlight:M,chartId:L,loading:I,loadingContent:T,emptyContent:H,legendInteraction:F,legendPosition:E,color:D,stroke:W,strokeWidth:j,opacity:z,showCategoryTicks:G,categoryFormat:V}=e,{width:$,height:q,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=r,oe=lr(()=>Ie(a),[a]),ie=i({data:oe,rawData:a,colorBy:p,colorScheme:f,legendInteraction:F,legendPosition:E,selection:_,linkedHover:C,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"Histogram",chartId:L,showLegend:Q,userMargin:l,marginDefaults:r.marginDefaults,loading:I,loadingContent:T,emptyContent:H,width:$,height:q}),re=Zi({brushProp:w,onBrushProp:A,linkedBrush:k,valueAccessor:u}),ne=lr(()=>{if(0===oe.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,o=-1/0;for(const i of oe){const r=e(i);null!=r&&isFinite(r)&&(t>r&&(t=r),r>o&&(o=r))}return t>o?void 0:[t,o]},[oe,u]),se=gt(),ae=lr(()=>new Map,[]),le=mi({colorBy:p,colorScale:ie.colorScale,color:D,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:void 0,stroke:W,strokeWidth:j,opacity:z,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ce=lr(()=>e=>{const t=e.data||e,o=t.category||e.category||"",i=t.count,r=t.range;return dr("div",{className:"semiotic-tooltip",style:Le,children:[o&&ur("div",{style:{fontWeight:"bold"},children:o+""}),null!=i&&dr("div",{children:["Count: ",i]}),r&&2===r.length&&dr("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(ie.earlyReturn)return ie.earlyReturn;const he=t({componentName:"Histogram",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(he)return ur(xt,{componentName:"Histogram",message:he,width:$,height:q});const ue={chartType:"histogram",...null!=a&&{data:oe},oAccessor:h,rAccessor:u,projection:"horizontal",summaryStyle:le,bins:d,normalize:g,...x?{rExtent:x}:ne&&{rExtent:ne},size:[$,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie.margin,barPadding:y,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:ee,rLabel:te,rFormat:m,...V&&{oFormat:V},showGrid:Y,showCategoryTicks:G,...ie.legendBehaviorProps,...B({title:K,description:Z,summary:U,accessibleTable:J,className:c,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:v,defaultTooltipContent:ce}),...O({linkedHover:C,selection:_,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...b&&b.length>0&&{annotations:b},...re.brushStreamProps,...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return ur(wt,{componentName:"Histogram",width:$,height:q,children:ur(ii,{ref:s,...ue})})});mr.displayName="Histogram";import{useMemo as pr,forwardRef as fr,useRef as yr}from"react";import{jsx as vr}from"react/jsx-runtime";var br=fr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=yr(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:h="category",valueAccessor:u="value",orientation:d="vertical",bins:g=25,curve:m="catmullRom",showIQR:p=!0,valueFormat:f,colorBy:y,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,valueExtent:A,brush:k,onBrush:S,linkedBrush:_,frameProps:C={},selection:P,linkedHover:R,onObservation:M,onClick:L,hoverHighlight:I,chartId:T,loading:H,loadingContent:F,emptyContent:E,legendInteraction:D,legendPosition:W,color:j,stroke:z,strokeWidth:G,opacity:V,showCategoryTicks:$,categoryFormat:q}=e,{width:X,height:Y,enableHover:Q,showGrid:K,showLegend:Z,title:U,description:J,summary:ee,accessibleTable:te,categoryLabel:oe,valueLabel:ie}=r,re=pr(()=>Ie(a),[a]),ne=i({data:re,rawData:a,colorBy:y,colorScheme:v,legendInteraction:D,legendPosition:W,selection:P,linkedHover:R,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:M,onClick:L,hoverHighlight:I,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ViolinPlot",chartId:T,showLegend:Z,userMargin:l,marginDefaults:r.marginDefaults,loading:H,loadingContent:F,emptyContent:E,width:X,height:Y}),se=Zi({brushProp:k,onBrushProp:S,linkedBrush:_,valueAccessor:u}),ae=gt(),le=pr(()=>new Map,[]),ce=mi({colorBy:y,colorScale:ne.colorScale,color:j,themeCategorical:ae,colorScheme:v,categoryIndexMap:le,userPieceStyle:void 0,stroke:z,strokeWidth:G,opacity:V,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),he=pr(()=>nr({valueAccessor:u}),[u]);if(ne.earlyReturn)return ne.earlyReturn;const ue=t({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(ue)return vr(xt,{componentName:"ViolinPlot",message:ue,width:X,height:Y});const de={chartType:"violin",...null!=a&&{data:re},oAccessor:h,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ce,bins:g,showIQR:p,size:[X,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,barPadding:b,enableHover:Q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:oe,rLabel:ie,rFormat:f,...q&&{oFormat:q},showGrid:K,showCategoryTicks:$,...ne.legendBehaviorProps,...B({title:U,description:J,summary:ee,accessibleTable:te,className:c,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:x,defaultTooltipContent:he}),...O({linkedHover:R,selection:P,onObservation:M,onClick:L,hoverHighlight:I,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...w&&w.length>0&&{annotations:w},...A&&{rExtent:A},...se.brushStreamProps,...Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e))};return vr(wt,{componentName:"ViolinPlot",width:X,height:Y,children:vr(ii,{ref:s,...de})})});br.displayName="ViolinPlot";import{useMemo as xr,forwardRef as wr,useRef as Ar}from"react";import{jsx as kr}from"react/jsx-runtime";var Sr=wr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=Ar(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:h="category",valueAccessor:u="value",orientation:d="horizontal",bins:g=20,amplitude:m=1.5,valueFormat:p,colorBy:f,colorScheme:y,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:w,frameProps:A={},selection:k,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:P,chartId:R,loading:M,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:H,color:F,stroke:E,strokeWidth:D,opacity:W,showCategoryTicks:j,categoryFormat:z}=e,{width:G,height:V,enableHover:$,showGrid:q,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=r,ee=xr(()=>Ie(a),[a]),te=i({data:ee,rawData:a,colorBy:f,colorScheme:y,legendInteraction:T,legendPosition:H,selection:k,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"RidgelinePlot",chartId:R,showLegend:X,userMargin:l,marginDefaults:r.marginDefaults,loading:M,loadingContent:L,emptyContent:I,width:G,height:V}),oe=gt(),ie=xr(()=>new Map,[]),re=mi({colorBy:f,colorScale:te.colorScale,color:F,themeCategorical:oe,colorScheme:y,categoryIndexMap:ie,userPieceStyle:void 0,stroke:E,strokeWidth:D,opacity:W,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=xr(()=>nr(),[]);if(te.earlyReturn)return te.earlyReturn;const se=t({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(se)return kr(xt,{componentName:"RidgelinePlot",message:se,width:G,height:V});const ae={chartType:"ridgeline",...null!=a&&{data:ee},oAccessor:h,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:g,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,barPadding:v,enableHover:$,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:U,rLabel:J,rFormat:p,...z&&{oFormat:z},showGrid:q,showCategoryTicks:j,oSort:!1,amplitude:m,...te.legendBehaviorProps,...B({title:Y,description:Q,summary:K,accessibleTable:Z,className:c,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:b,defaultTooltipContent:ne}),...O({linkedHover:S,selection:k,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...x&&x.length>0&&{annotations:x},...w&&{rExtent:w},...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return kr(wt,{componentName:"RidgelinePlot",width:G,height:V,children:kr(ii,{ref:s,...ae})})});Sr.displayName="RidgelinePlot";import{useMemo as _r,forwardRef as Cr,useRef as Pr}from"react";import{jsx as Rr,jsxs as Mr}from"react/jsx-runtime";var Lr=Cr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=Pr(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,stepAccessor:h="step",valueAccessor:u="value",categoryAccessor:d,colorBy:g,colorScheme:m,orientation:p="horizontal",connectorOpacity:f=.3,showLabels:y=!0,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:S,hoverHighlight:_,chartId:C,loading:P,loadingContent:R,emptyContent:M,legendInteraction:L,legendPosition:I,color:T,stroke:H,strokeWidth:B,opacity:F,categoryFormat:E}=e,N="vertical"===p,{width:D,height:W,enableHover:j,showLegend:z,title:G,description:V,summary:$,accessibleTable:q}=r,X=N?{top:G?60:40,right:20,bottom:60,left:60}:{top:G?40:10,right:10,bottom:10,left:10},Y=_r(()=>Ie(a),[a]),Q=g||d,K=!Q,Z=i({data:Y,rawData:a,colorBy:Q,colorScheme:m,legendInteraction:L,legendPosition:I,selection:w,linkedHover:A,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:_,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"FunnelChart",chartId:C,showLegend:z,userMargin:l,marginDefaults:X,loading:P,loadingContent:R,emptyContent:M,width:D,height:W});St("FunnelChart",Y,"stepAccessor",h),St("FunnelChart",Y,"valueAccessor",u);const U=gt(),J=_r(()=>new Map,[]),ee=_r(()=>{if(K)return T||(U?.[0]?U[0]:Array.isArray(m)&&m[0]?m[0]:"#4e79a7")},[K,T,U,m]),te=mi({colorBy:ee?void 0:Q,colorScale:Z.colorScale,color:ee??T,themeCategorical:U,colorScheme:m,categoryIndexMap:J,userPieceStyle:x?.pieceStyle,stroke:H,strokeWidth:B,opacity:F,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection}),oe=_r(()=>e=>{const t=e?.data||e,o=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",i=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,n=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==r||n?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return Mr("div",{className:"semiotic-tooltip",style:Le,children:[o&&Rr("div",{style:{fontWeight:"bold"},children:o+""}),a&&a!==o&&Rr("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&Rr("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),Mr("div",{style:{marginTop:4},children:[i+"",l]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ie=t({componentName:"FunnelChart",data:a,accessors:{stepAccessor:h,valueAccessor:u}});if(ie)return Rr(xt,{componentName:"FunnelChart",message:ie,width:D,height:W});const re={chartType:N?"bar-funnel":"funnel",...null!=a&&{data:Y},oAccessor:h,rAccessor:u,...d&&{stackBy:d},projection:N?"vertical":"horizontal",barPadding:N?40:0,pieceStyle:te,size:[D,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,enableHover:j,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:N,showCategoryTicks:N,...E&&{oFormat:E},showGrid:N,...!N&&{connectorOpacity:f},showLabels:y,...Z.legendBehaviorProps,...G&&{title:G},...V&&{description:V},...$&&{summary:$},...void 0!==q&&{accessibleTable:q},...c&&{className:c},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===v?()=>null:!0===v||null==v?oe:qe(v)||oe,...O({linkedHover:A,selection:w,onObservation:k,onClick:S,hoverHighlight:_,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...b&&b.length>0&&{annotations:b},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return Rr(wt,{componentName:"FunnelChart",width:D,height:W,children:Rr(ii,{ref:s,...re})})});Lr.displayName="FunnelChart";import{useMemo as Ir,forwardRef as Tr,useRef as Hr}from"react";import{jsx as Br}from"react/jsx-runtime";var Or=Tr(function(o,r){const s=at(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid??!0,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),a=Hr(null);n(r,{variant:"xy",frameRef:a});const{data:l,margin:c,className:h,categoryAccessor:u="category",valueAccessor:d="value",orientation:g="horizontal",valueFormat:m,colorBy:p,colorScheme:f,sort:y="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,regression:A,valueExtent:k,frameProps:S={},selection:_,linkedHover:C,onObservation:P,onClick:R,hoverHighlight:M,chartId:L,loading:I,loadingContent:T,emptyContent:H,legendInteraction:F,legendPosition:D,color:W,stroke:j,strokeWidth:z,opacity:G,categoryFormat:V}=o,{width:$,height:q,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=s,oe=Ir(()=>Ie(l),[l]),ie=i({data:oe,rawData:l,colorBy:p,colorScheme:f,legendInteraction:F,legendPosition:D,selection:_,linkedHover:C,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"DotPlot",chartId:L,showLegend:Q,userMargin:c,marginDefaults:s.marginDefaults,loading:I,loadingContent:T,emptyContent:H,width:$,height:q}),re=dt(oe,y,d),ne=gt(),se=Ir(()=>new Map,[]),ae=mi({colorBy:p,colorScale:ie.colorScale,color:W,themeCategorical:ne,colorScheme:f,categoryIndexMap:se,userPieceStyle:S?.pieceStyle,stroke:j,strokeWidth:z,opacity:G,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),le=Ir(()=>E({categoryAccessor:u,valueAccessor:d,valueFormat:m}),[u,d,m]);if(ie.earlyReturn)return ie.earlyReturn;const ce=t({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:d}});if(ce)return Br(xt,{componentName:"DotPlot",message:ce,width:$,height:q});const he=e(A),ue=he?[he,...w||[]]:w,de={chartType:"point",...null!=l&&{data:re},oAccessor:u,rAccessor:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ae,size:[$,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie.margin,barPadding:b,enableHover:X,...o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor},showAxes:s.showAxes,oLabel:ee,rLabel:te,rFormat:m,...V&&{oFormat:V},showGrid:Y,oSort:y,...ie.legendBehaviorProps,...B({title:K,description:Z,summary:U,accessibleTable:J,className:h,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...N({tooltip:x,defaultTooltipContent:le}),...O({linkedHover:C,selection:_,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...ue&&ue.length>0&&{annotations:ue},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return Br(wt,{componentName:"DotPlot",width:$,height:q,children:Br(ii,{ref:a,...de})})});Or.displayName="DotPlot";import{useMemo as Fr,forwardRef as Er,useRef as Nr}from"react";import{jsx as Dr}from"react/jsx-runtime";var Wr=Er(function(e,o){const r=at(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Nr(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:h="value",colorBy:u,colorScheme:d,startAngle:g=0,cornerRadius:m,tooltip:p,annotations:f,frameProps:y={},selection:v,linkedHover:b,onObservation:x,onClick:w,hoverHighlight:A,chartId:k,loading:S,loadingContent:_,emptyContent:C,legendInteraction:P,legendPosition:R,color:M,stroke:L,strokeWidth:I,opacity:T}=e,{width:H,height:F,enableHover:D,showLegend:W,title:j,description:z,summary:G,accessibleTable:V}=r,$=Fr(()=>Ie(s),[s]),q=u||c,X=i({data:$,rawData:s,colorBy:q,colorScheme:d,legendInteraction:P,legendPosition:R,selection:v,linkedHover:b,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:x,onClick:w,hoverHighlight:A,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:W,userMargin:a,marginDefaults:r.marginDefaults,loading:S,loadingContent:_,emptyContent:C,width:H,height:F}),Y=gt(),Q=Fr(()=>new Map,[]),K=mi({colorBy:q,colorScale:X.colorScale,color:M,themeCategorical:Y,colorScheme:d,categoryIndexMap:Q,userPieceStyle:y?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection,cycleByCategory:!0}),Z=Fr(()=>E({categoryAccessor:c,valueAccessor:h,groupAccessor:u&&u!==c?u:void 0,groupLabel:"string"==typeof u?u:"group",pieData:!0}),[c,h,u]),U=t({componentName:"PieChart",data:s,accessors:{categoryAccessor:c,valueAccessor:h}}),{effectiveLegendProps:J,effectiveMargin:ee}=di({ref:o,frameRef:n,setup:X});if(X.earlyReturn)return X.earlyReturn;const te={chartType:"pie",...null!=s&&{data:$},oAccessor:c,rAccessor:h,projection:"radial",pieceStyle:K,startAngle:g,...null!=m&&{cornerRadius:m},size:[H,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...J,...B({title:j,description:z,summary:G,accessibleTable:V,className:l,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:p,defaultTooltipContent:Z}),...O({linkedHover:b,selection:v,onObservation:x,onClick:w,hoverHighlight:A,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior}),...f&&f.length>0&&{annotations:f},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return U?Dr(xt,{componentName:"PieChart",message:U,width:H,height:F}):Dr(wt,{componentName:"PieChart",width:H,height:F,children:Dr(ii,{ref:n,...te})})});Wr.displayName="PieChart";import{useMemo as jr,forwardRef as zr,useRef as Gr}from"react";import{jsx as Vr}from"react/jsx-runtime";var $r=zr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),n=Gr(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:h="value",innerRadius:u,centerContent:d,colorBy:g,colorScheme:m,startAngle:p=0,cornerRadius:f,tooltip:y,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:A,onClick:k,hoverHighlight:S,chartId:_,loading:C,loadingContent:P,emptyContent:R,legendInteraction:M,legendPosition:L,color:I,stroke:T,strokeWidth:H,opacity:F}=e,{width:D,height:W,enableHover:j,showLegend:z,title:G,description:V,summary:$,accessibleTable:q}=r,X=jr(()=>Ie(s),[s]),Y=g||c,Q=i({data:X,rawData:s,colorBy:Y,colorScheme:m,legendInteraction:M,legendPosition:L,selection:x,linkedHover:w,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:k,hoverHighlight:S,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"DonutChart",chartId:_,showLegend:z,userMargin:a,marginDefaults:r.marginDefaults,loading:C,loadingContent:P,emptyContent:R,width:D,height:W}),K=u??Math.max(2,.15*Math.min(D,W)),Z=gt(),U=jr(()=>new Map,[]),J=mi({colorBy:Y,colorScale:Q.colorScale,color:I,themeCategorical:Z,colorScheme:m,categoryIndexMap:U,userPieceStyle:b?.pieceStyle,stroke:T,strokeWidth:H,opacity:F,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,cycleByCategory:!0}),ee=jr(()=>E({categoryAccessor:c,valueAccessor:h,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,h,g]),te=t({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:h}}),{effectiveLegendProps:oe,effectiveMargin:ie}=di({ref:o,frameRef:n,setup:Q});if(Q.earlyReturn)return Q.earlyReturn;const re={chartType:"donut",...null!=s&&{data:X},oAccessor:c,rAccessor:h,projection:"radial",pieceStyle:J,innerRadius:K,startAngle:p,...null!=f&&{cornerRadius:f},centerContent:d,size:[D,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,enableHover:j,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...oe,...B({title:G,description:V,summary:$,accessibleTable:q,className:l,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:y,defaultTooltipContent:ee}),...O({linkedHover:w,selection:x,onObservation:A,onClick:k,hoverHighlight:S,mobileInteraction:Q.mobileInteraction,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior}),...v&&v.length>0&&{annotations:v},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return te?Vr(xt,{componentName:"DonutChart",message:te,width:D,height:W}):Vr(wt,{componentName:"DonutChart",width:D,height:W,children:Vr(ii,{ref:n,...re})})});$r.displayName="DonutChart";import{useMemo as qr,forwardRef as Xr,useRef as Yr}from"react";function Qr(e=240){const t=360-e,o=180+t/2,i=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:i,offsetRad:-Math.PI/2+i}}function Kr(e){return Math.max(0,Math.min(1,e))}function Zr(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function Ur(e,t,o){const i=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${i(e)}${i(t)}${i(o)}`}function Jr(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Kr(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const i=Kr(t);if(o[0].offset>=i)return o[0].color;if(i>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],r=o[e+1];if(t.offset>i||i>r.offset)continue;const n=r.offset-t.offset,s=n>0?(i-t.offset)/n:0,a=Zr(t.color),l=Zr(r.color);if(!a||!l)return.5>s?t.color:r.color;const[c,h,u]=a,[d,g,m]=l;return Ur(c+(d-c)*s,h+(g-h)*s,u+(m-u)*s)}return o[o.length-1].color}function en(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}import{jsx as tn,jsxs as on}from"react/jsx-runtime";var rn=Xr(function(e,t){const i=at(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),r=Yr(null),n="context"===e.mode,{compactMode:s}=i,{value:a,min:l=0,max:c=100,thresholds:h,gradientFill:u,color:d,backgroundColor:g="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:p,showNeedle:f=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:v,valueFormat:b,showScaleLabels:x=!s,sweep:w=240,fillZones:A=!0,tooltip:k,annotations:S,frameProps:_={},className:C,stroke:P,strokeWidth:R,opacity:M}=e,{width:L,height:I,title:T,description:H,summary:B,accessibleTable:O}=i,F=u&&"object"==typeof u?u:void 0,E=Math.max(l,Math.min(c,a)),N=c-l||1,D=(E-l)/N,{gaugeData:W,pieceStyle:j,gaugeAnnotations:z}=qr(()=>function(e){const{min:t,max:o,value:i,thresholds:r,fillColor:n,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:h=240}=e,u=o-t||1,d=(Math.max(t,Math.min(o,i))-t)/u;let g=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:o,color:n||"#007bff"}];g=g.map(e=>({...e,value:Math.max(t,Math.min(o,e.value))})),o>g[g.length-1].value&&g.push({value:o,color:g[g.length-1].color});const m=!!c&&c.colorStops.length>=2,p=[],f=new Map,y=[];if(m){const e=a?d:1,t=en("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),f.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(h)),o=Math.max(1,Math.min(t,Math.round(e*t))),i=[];for(let t=0;o>t;t++)i.push(Jr(c.colorStops,e*(t+.5)/o));const r=en("fill",0);p.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:i}}),f.set(r,{fill:i[0]||s})}}else{let e=t;for(let o=0;g.length>o;o++){const i=g[o],r=(i.value-e)/u,n=(e-t)/u,l=(i.value-t)/u,c=Math.max(0,(a?Math.min(d,l):l)-n),h=a?Math.max(0,r-c):0;if(c>0){const e=en("fill",o);p.push({category:e,value:c,_zone:i.label||"Zone "+(o+1),_isFill:!0}),f.set(e,{fill:i.color})}if(h>0){const e=en("bg",o);p.push({category:e,value:h,_zone:i.label||"Zone "+(o+1),_isFill:!1}),f.set(e,{fill:s,opacity:.4})}e=i.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&o>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:p,pieceStyle:(e,t)=>f.get(t||e.category)||{fill:s},gaugeAnnotations:y}}({min:l,max:c,value:a,thresholds:h,fillColor:d,backgroundColor:g,fillZones:A,showScaleLabels:x,gradientFill:F}),[a,l,c,h,d,g,x,A,F]),G=qr(()=>o(j,{stroke:P,strokeWidth:R,opacity:M}),[j,P,R,M]),{sweepRad:V,startAngleDeg:$}=Qr(w),q=function(e=240){const{sweepRad:t,offsetRad:o}=Qr(e),i=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||i.push([Math.cos(e),Math.sin(e)]);const r=i.map(e=>e[0]),n=i.map(e=>e[1]),[s,a]=yt(r),[l,c]=yt(n);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(w),X=Math.min(10,Math.max(1,Math.min(L,I)/12)),Y=q.cx,Q=q.cy,K=Math.max(4,Math.min((L-2*X)/q.width,(I-2*X)/q.height)-2),Z=Math.max(0,Math.min(K-1.5,K*(1-m))),U=L/2-Y*K,J=I/2-Q*K,ee=2*(K+4),te=qr(()=>{if(s&&null==v)return null;if(null!=v)return"function"==typeof v?v(E,l,c):v;const e=b?b(E):Math.round(E)+"";return on("div",{style:{textAlign:"center",lineHeight:1.2},children:[tn("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),x&&on("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[l," – ",c]})]})},[v,E,l,c,b,x,K,s]),oe=qr(()=>n&&null==v?{type:"gauge-value",text:b?b(E):Math.round(E)+""}:null,[n,v,E,b]),ie=qr(()=>{if(!f)return null;const e=-Math.PI/2+$*Math.PI/180+D*V,t=Z>20?Z-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[f,$,D,V,Z,K,y]),re=qr(()=>(e,t,o)=>{if("gauge-needle"===e.type){const i=(o.width||L)/2,r=(o.height||I)/2,n=Math.max(1,K-Z),s=Math.max(1,Math.min(2.5,.4*n)),a=Math.max(1,Math.min(5,.6*n));return on("g",{transform:`translate(${i},${r})`,children:[tn("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),tn("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const i=-Math.PI/2+$*Math.PI/180+(e.value-l)/N*V,r=(o.width||L)/2,n=(o.height||I)/2,s=Z-1,a=K+1,c=Math.cos(i)*s,h=Math.sin(i)*s,u=Math.cos(i)*a,d=Math.sin(i)*a,g=K+10,m=Math.cos(i)*g,p=Math.sin(i)*g,f=((i+Math.PI/2)/(2*Math.PI)*12+12)%12;let y,v;return f>=11||1>f?(y="middle",v="auto"):f>=1&&5>f?(y="start",v="middle"):f>=5&&7>f?(y="middle",v="hanging"):(y="end",v="middle"),on("g",{transform:`translate(${r},${n})`,children:[tn("line",{x1:c,y1:h,x2:u,y2:d,stroke:"var(--semiotic-border, #ccc)",strokeWidth:2,strokeLinecap:"round"}),tn("text",{x:m,y:p,textAnchor:y,dominantBaseline:v,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?tn("text",{x:(o.width||L)/2,y:(o.height||I)/2-.2*Z,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[L,I,l,N,$,V,Z,K]),ne=qr(()=>{const e=[...z,...S||[]];return ie&&e.push(ie),oe&&e.push(oe),e},[z,S,ie,oe]),se=qr(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",i=t?._isFill;return on("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[tn("div",{style:{fontWeight:600},children:o}),tn("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(E):"Remaining"})]})},[E]);if(0===W.length)return tn(xt,{componentName:"GaugeChart",message:"No data to display",width:L,height:I});const ae={chartType:"donut",data:W,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:G,innerRadius:Z,startAngle:$,sweepAngle:w,...null!=p&&{cornerRadius:p},centerContent:te,size:[L,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:J-ee/2,bottom:I-J-ee/2,left:U-ee/2,right:L-U-ee/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:qe(k)||se,svgAnnotationRules:re,...ne.length>0&&{annotations:ne},...T&&{title:T},...H&&{description:H},...B&&{summary:B},...void 0!==O&&{accessibleTable:O},...C&&{className:C},...null!=e.animate&&{animate:e.animate},..._};return tn(wt,{componentName:"GaugeChart",width:L,height:I,children:tn(ii,{ref:r,...ae})})});rn.displayName="GaugeChart";import{useMemo as nn,forwardRef as sn,useRef as an}from"react";import{jsx as ln}from"react/jsx-runtime";var cn=sn(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=an(null),{data:s,margin:a,className:l,categoryAccessor:c="category",groupBy:h,valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:m,colorScheme:p,sort:f=!1,barPadding:y=60,roundedTop:v,styleRules:b,baselinePadding:x=!1,tooltip:w,annotations:A,valueExtent:k,frameProps:S={},selection:_,linkedHover:C,onObservation:P,onClick:R,hoverHighlight:M,chartId:L,loading:I,loadingContent:T,emptyContent:H,legendInteraction:F,legendPosition:D,color:W,stroke:j,strokeWidth:z,opacity:G,categoryFormat:V}=e,{width:$,height:q,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=r,ie=nn(()=>Ie(s),[s]),re=m||h,ne=i({data:ie,rawData:s,colorBy:re,colorScheme:p,legendInteraction:F,legendPosition:D,selection:_,linkedHover:C,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"GroupedBarChart",chartId:L,showLegend:Q,userMargin:a,marginDefaults:r.marginDefaults,loading:I,loadingContent:T,emptyContent:H,width:$,height:q}),se=gt(),ae=nn(()=>new Map,[]),le=nn(()=>oe(u),[u]),ce=mi({colorBy:re,colorScale:ne.colorScale,color:W,themeCategorical:se,colorScheme:p,categoryIndexMap:ae,userPieceStyle:S.pieceStyle,stroke:j,strokeWidth:z,opacity:G,styleRules:b,resolveRuleValue:le,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),he=nn(()=>E({categoryAccessor:h,valueAccessor:u,groupAccessor:c,valueFormat:g}),[h,c,u,g]),ue=t({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u},requiredProps:{groupBy:h}}),{effectiveLegendProps:de,effectiveMargin:ge}=di({ref:o,frameRef:n,setup:ne});if(ne.earlyReturn)return ne.earlyReturn;const me={chartType:"clusterbar",...null!=s&&{data:ie},oAccessor:c,rAccessor:u,groupBy:h,oSort:f,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ce,size:[$,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ge,barPadding:y,...null!=v&&{roundedTop:v},baselinePadding:x,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:ee,rLabel:te,rFormat:g,...V&&{oFormat:V},showGrid:Y,...de,...B({title:K,description:Z,summary:U,accessibleTable:J,className:l,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:w,defaultTooltipContent:he}),...O({linkedHover:C,selection:_,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...A&&A.length>0&&{annotations:A},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return ue?ln(xt,{componentName:"GroupedBarChart",message:ue,width:$,height:q}):ln(wt,{componentName:"GroupedBarChart",width:$,height:q,children:ln(ii,{ref:n,...me})})});cn.displayName="GroupedBarChart";import{useMemo as hn,forwardRef as un,useRef as dn}from"react";import{jsx as gn}from"react/jsx-runtime";var mn=un(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=dn(null),{data:s,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:h,valueAccessor:u="value",orientation:d="horizontal",valueFormat:g,colorBy:m,colorScheme:p,barPadding:f,tooltip:y,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:A={},selection:k,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:P,chartId:R,loading:M,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:H,color:F,stroke:D,strokeWidth:W,opacity:j,categoryFormat:z,rTickValues:G,tickLabelEdgeAlign:V,showCategoryTicks:$,gradientFill:q,trackFill:X,roundedTop:Y,valueExtent:Q}=e,{width:K,height:Z,enableHover:U,showGrid:J,showLegend:ee,title:te,description:oe,summary:ie,accessibleTable:re,categoryLabel:ne,valueLabel:se}=r,ae=hn(()=>Ie(s),[s]),le=m||h,ce=hn(()=>{if(null!=f)return f;if("sparkline"!==e.mode)return 40;const t=new Set(ae.map(e=>"function"==typeof c?c(e):e[c])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===d?Z:K)-2*o)/(o-1))):1},[f,e.mode,ae,c,d,K,Z]),he=i({data:ae,rawData:s,colorBy:le,colorScheme:p,legendInteraction:T,legendPosition:H,selection:k,linkedHover:S,fallbackFields:le?["string"==typeof le?le:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"SwimlaneChart",chartId:R,showLegend:ee,userMargin:a,marginDefaults:r.marginDefaults,loading:M,loadingContent:L,emptyContent:I,width:K,height:Z}),ue=Zi({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:u}),de=gt(),ge=hn(()=>new Map,[]),me=mi({colorBy:le,colorScale:he.colorScale,color:F,themeCategorical:de,colorScheme:p,categoryIndexMap:ge,userPieceStyle:A?.pieceStyle,stroke:D,strokeWidth:W,opacity:j,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,cycleByCategory:!0}),pe=hn(()=>E({categoryAccessor:h,valueAccessor:u,groupAccessor:c,valueFormat:g}),[h,c,u,g]),fe=t({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u,subcategoryAccessor:h},requiredProps:{subcategoryAccessor:h}}),{effectiveLegendProps:ye,effectiveMargin:ve}=di({ref:o,frameRef:n,setup:he});if(he.earlyReturn)return he.earlyReturn;const be={chartType:"swimlane",...null!=s&&{data:ae},oAccessor:c,rAccessor:u,stackBy:h,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:me,size:[K,Z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve,barPadding:ce,enableHover:U,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:!1===$?void 0:ne,rLabel:se,rFormat:g,...G&&{rTickValues:G},...null!=V&&{tickLabelEdgeAlign:V},...z&&{oFormat:z},...void 0!==$&&{showCategoryTicks:$},showGrid:J,...ye,...B({title:te,description:oe,summary:ie,accessibleTable:re,className:l,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:y,defaultTooltipContent:pe}),...O({linkedHover:S,selection:k,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...v&&v.length>0&&{annotations:v},...q&&{gradientFill:!0===q?{topOpacity:.8,bottomOpacity:.05}:q},...null!=X&&{trackFill:X},...null!=Y&&{roundedTop:Y},...Q&&{rExtent:Q},...ue.brushStreamProps,...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return fe?gn(xt,{componentName:"SwimlaneChart",message:fe,width:K,height:Z}):gn(wt,{componentName:"SwimlaneChart",width:K,height:Z,children:gn(ii,{ref:n,...be})})});mn.displayName="SwimlaneChart";export{ii as StreamOrdinalFrame_default,ai as OrdinalCustomChart,fi as BarChart,wi as StackedBarChart,$i as LikertChart,Ji as SwarmPlot,ar as BoxPlot,mr as Histogram,br as ViolinPlot,Sr as RidgelinePlot,Lr as FunnelChart,Or as DotPlot,Wr as PieChart,$r as DonutChart,rn as GaugeChart,cn as GroupedBarChart,mn as SwimlaneChart};
@@ -1,2 +0,0 @@
1
- "use client";
2
- import{validateNetworkData as e,validateObjectData as t}from"./chunk-chunk-JCG72SGW.module.min.js";import{mergeShapeStyle as o,useCustomChartScaffold as n,useFrameImperativeHandle as i,useResolvedSelection as r}from"./chunk-chunk-I6C3KR5H.module.min.js";import{StreamNetworkFrame_default as s,buildRibbonGeometry as a}from"./chunk-chunk-SA3D43RA.module.min.js";import{buildBaseMetadataProps as l,buildCustomBehaviorProps as c}from"./chunk-chunk-A63CTACR.module.min.js";import{mulberry32 as d}from"./chunk-chunk-SIRIJ3DY.module.min.js";import{composeStyleRules as m,makeNodeRuleContext as h}from"./chunk-chunk-EMO5NUGE.module.min.js";import{COLOR_SCHEMES as g,DEFAULT_COLORS as u,DEFAULT_SELECTION_OPACITY as p,DEPTH_PALETTE_COLORS as f,filterSparseArray as b,getColor as y,normalizeTooltip as v,resolveCategoricalPalette as k,resolveDefaultFill as S,resolveMobileInteraction as w,useChartLegendAndMargin as C,useChartMode as T,useChartSelection as A,useColorScale as I,useLegendInteraction as M,useThemeCategorical as H}from"./chunk-chunk-6HSGDMTA.module.min.js";import{getMin as x}from"./chunk-chunk-JJ2OOIET.module.min.js";import{ChartError as B,SafeRender as N,renderEmptyState as D,renderLoadingState as O}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{forwardRef as P,useMemo as L}from"react";import{jsx as E}from"react/jsx-runtime";var W=P(function(e,t){const{nodes:o,edges:i,layout:r,layoutConfig:a,onLayoutError:d,nodeIDAccessor:m="id",sourceAccessor:h="source",targetAccessor:g="target",margin:u,className:p,colorBy:f,colorScheme:y,selection:v,linkedHover:k,onObservation:S,onClick:C,chartId:T,annotations:I,autoPlaceAnnotations:M,frameProps:H={}}=e,{frameRef:x,resolved:B,normalizedMargin:P}=n({imperativeRef:t,imperativeVariant:"network",margin:u,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),W=L(()=>b(o),[o]),R=L(()=>b(i),[i]),z=L(()=>void 0===o&&void 0===i?void 0:[...W,...R],[i,o,R,W]),F=w(e.mobileInteraction,{mode:e.mode,width:B.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:j,customClickBehavior:$,activeSelectionHook:_}=A({selection:v,linkedHover:k,fallbackFields:"string"==typeof f?[f]:[],onObservation:S,onClick:C,chartType:"NetworkCustomChart",chartId:T,colorByField:"string"==typeof f?f:void 0,mobileInteraction:F}),G=L(()=>_?.isActive?{isActive:!0,predicate:_.predicate}:null,[_?.isActive,_?.predicate]),{width:q,height:J,enableHover:X,title:Z,description:K,summary:Y,accessibleTable:U}=B,Q=O(e.loading,q,J,e.loadingContent),V=Q?null:D(z,q,J,e.emptyContent);if(Q||V)return Q||V;const ee={chartType:"force",...null!=o&&{nodes:W},...null!=i&&{edges:R},customNetworkLayout:r,layoutConfig:a,onLayoutError:d,nodeIDAccessor:m,sourceAccessor:h,targetAccessor:g,colorBy:f,colorScheme:y,size:[q,J],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:P,enableHover:X,...l({title:Z,description:K,summary:Y,accessibleTable:U,className:p,animate:e.animate,autoPlaceAnnotations:M}),...c({linkedHover:k,selection:v,onObservation:S,onClick:C,mobileInteraction:F,customHoverBehavior:j,customClickBehavior:$,linkedHoverInClickPredicate:!1}),layoutSelection:G,...null!=I&&{annotations:I},...H};return E(N,{componentName:"NetworkCustomChart",width:q,height:J,children:E(s,{ref:x,...ee})})});W.displayName="NetworkCustomChart";import{useMemo as R,forwardRef as z,useRef as F}from"react";import{useMemo as j}from"react";function $(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(n)};return n(e),o}function _(e,t,o,n){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],r="function"==typeof n?n(e):e[n];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function G(e){return"function"==typeof e?e:t=>t[e]||1}function q({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:i,baseStyle:r={}}){return s=>{const a={fillOpacity:i,...r};if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=y(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=y(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}function J(e){const{nodes:t,edges:o,inferNodes:n=!0,sourceAccessor:i="source",targetAccessor:r="target",colorBy:s,colorScheme:a,showLegend:l,legendPosition:c,legendInteraction:d,selection:m,linkedHover:h,onObservation:g,onClick:p,mobileInteraction:f,mobileSemantics:y,chartType:v,chartId:S,marginDefaults:T,userMargin:x,width:B,height:N,loading:P,loadingContent:L,emptyContent:E,emptyDataKey:W="edges"}=e,R=j(()=>b(o),[o]),z=j(()=>b(t),[t]),F=O(P,B,N,L),$=F?null:D("nodes"===W?void 0===t?void 0:z:void 0===o?void 0:R,B,N,E),G=j(()=>n?_(z,R,i,r):z,[n,z,R,i,r]),q=I(G,s,a),J=H(),X=j(()=>Array.isArray(a)&&a.length>0?a:[...k(a,J,u)],[a,J]),Z=j(()=>{if(!s)return[];const e=new Set;for(const t of G){const o="function"==typeof s?s(t):t[s];null!=o&&e.add(o+"")}return Array.from(e)},[G,s]),K=M(d,s,Z),{legend:Y,margin:U,legendPosition:Q}=C({data:G,colorBy:s,colorScale:q,showLegend:l,legendPosition:c,userMargin:x,defaults:T,categories:Z}),V=j(()=>w(f,{width:B,mobileSemantics:y}),[f,B,y]),ee=A({selection:m,linkedHover:h,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:g,onClick:p,mobileInteraction:V,chartType:v,chartId:S}),{customHoverBehavior:te,customClickBehavior:oe,activeSelectionHook:ne,hoverSelectionHook:ie,crosshairSourceId:re}=ee;return{safeNodes:G,safeEdges:R,colorScale:q,effectivePalette:X,themeCategorical:J,allCategories:Z,legendState:K,legend:Y,margin:U,legendPosition:Q,mobileInteraction:V,customHoverBehavior:te,customClickBehavior:oe,activeSelectionHook:ne,hoverSelectionHook:ie,crosshairSourceId:re,loadingEl:F,emptyEl:$}}import{jsx as X}from"react/jsx-runtime";var Z=z(function(t,n){const r=F(null);i(n,{variant:"network",frameRef:r});const a=T(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:600,height:600}),{nodes:l,edges:d,margin:g,className:u,nodeIdAccessor:p,nodeIDAccessor:f,sourceAccessor:b="source",targetAccessor:k="target",nodeLabel:w,colorBy:C,colorScheme:A,styleRules:I,nodeSize:M=8,nodeSizeRange:H=[5,20],edgeWidth:x=1,edgeColor:D="#999",edgeOpacity:O=.6,iterations:P=300,forceStrength:L=.1,layoutExecution:E="auto",layoutLoadingContent:W,onLayoutStateChange:z,tooltip:j,frameProps:$={},onObservation:_,onClick:G,chartId:q,selection:Z,linkedHover:K,loading:Y,loadingContent:U,emptyContent:Q,legendInteraction:V,legendPosition:ee,stroke:te,strokeWidth:oe,opacity:ne}=t,ie=p??f??"id",{width:re,height:se,enableHover:ae,showLegend:le,showLabels:ce=!1,title:de,description:me,summary:he,accessibleTable:ge}=a,ue=J({nodes:l,edges:d,inferNodes:!1,nodeIdAccessor:ie,sourceAccessor:b,targetAccessor:k,colorBy:C,colorScheme:A,showLegend:le,legendPosition:ee,legendInteraction:V,selection:Z,linkedHover:K,onObservation:_,onClick:G,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ForceDirectedGraph",chartId:q,marginDefaults:a.marginDefaults,userMargin:g,width:re,height:se,loading:Y,loadingContent:U,emptyContent:Q,emptyDataKey:"nodes"}),pe=R(()=>new Map,[]),fe=R(()=>e=>{const t={};return t.fill=C?y(e.data||e,C,ue.colorScale):S(void 0,ue.themeCategorical,A,void 0,pe),"number"==typeof M&&(t.r=M),t},[C,ue.colorScale,M,ue.themeCategorical,A,pe]),be=R(()=>h(C,"number"==typeof M?void 0:M),[C,M]),ye=R(()=>o(m(fe,I,be,e=>e.data||e),{stroke:te,strokeWidth:oe,opacity:ne}),[fe,I,be,te,oe,ne]),ve=R(()=>e=>{const t=e.data||e;let o;if("number"==typeof x)o=x;else if("function"==typeof x)o=x(t);else{const e=t[x],n="number"==typeof e?e:Number(e);o=Number.isFinite(n)&&n>0?n:1}return{stroke:D,strokeWidth:o,opacity:O}},[x,D,O]),ke=R(()=>o(ve,{stroke:te,strokeWidth:oe,opacity:ne}),[ve,te,oe,ne]),Se=R(()=>{if(ce&&w)return"function"==typeof w?w:e=>e.data?.[w]??e[w]??e.id},[ce,w]),we=e({componentName:"ForceDirectedGraph",nodes:l,edges:d,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:ie}});return we?X(B,{componentName:"ForceDirectedGraph",message:we,width:re,height:se}):ue.loadingEl?ue.loadingEl:ue.emptyEl?ue.emptyEl:X(N,{componentName:"ForceDirectedGraph",width:re,height:se,children:X(s,{ref:r,chartType:"force",...null!=l&&{nodes:ue.safeNodes},...null!=d&&{edges:ue.safeEdges},size:[re,se],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue.margin,nodeIDAccessor:ie,sourceAccessor:b,targetAccessor:k,iterations:P,forceStrength:L,layoutExecution:E,layoutLoadingContent:W,onLayoutStateChange:z,nodeStyle:ye,edgeStyle:ke,colorBy:C,colorScheme:ue.effectivePalette,nodeSize:M,nodeSizeRange:H,nodeLabel:Se,showLabels:ce,enableHover:ae,tooltipContent:!1===j?()=>null:v(j)||void 0,...c({linkedHover:K,selection:Z,onObservation:_,onClick:G,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:ue.legend,legendPosition:ue.legendPosition,...V&&"none"!==V&&{legendHoverBehavior:ue.legendState.onLegendHover,legendClickBehavior:ue.legendState.onLegendClick,legendHighlightedCategory:ue.legendState.highlightedCategory,legendIsolatedCategories:ue.legendState.isolatedCategories},className:u,title:de,description:me,summary:he,accessibleTable:ge,...null!=t.animate&&{animate:t.animate},...$})})});Z.displayName="ForceDirectedGraph";import{useMemo as K,forwardRef as Y,useRef as U}from"react";import{jsx as Q}from"react/jsx-runtime";var V=Y(function(t,n){const r=U(null);i(n,{variant:"network",frameRef:r,overrides:{getData:()=>r.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const a=T(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:600,height:600}),{nodes:l,edges:d,margin:p,className:f,sourceAccessor:b="source",targetAccessor:k="target",valueAccessor:w="value",nodeIdAccessor:C="id",colorBy:A,colorScheme:I,styleRules:M,edgeColorBy:H="source",padAngle:x=.01,groupWidth:D=20,sortGroups:O,nodeLabel:P,edgeOpacity:L=.5,tooltip:E,frameProps:W={},onObservation:R,onClick:z,chartId:F,selection:j,linkedHover:$,loading:_,loadingContent:G,emptyContent:X,legendInteraction:Z,stroke:Y,strokeWidth:V,opacity:ee}=t,{width:te,height:oe,enableHover:ne,showLabels:ie=!0,title:re,description:se,summary:ae,accessibleTable:le}=a,ce=J({nodes:l,edges:d,inferNodes:!0,nodeIdAccessor:C,sourceAccessor:b,targetAccessor:k,colorBy:A,colorScheme:I,showLegend:!1,legendInteraction:Z,selection:j,linkedHover:$,onObservation:R,onClick:z,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ChordDiagram",chartId:F,marginDefaults:a.marginDefaults,userMargin:p,width:te,height:oe,loading:_,loadingContent:G,emptyContent:X}),de=K(()=>new Map,[]),me=K(()=>new Map,[]),he=ce.safeNodes.length>0,ge=K(()=>{if(he)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(A)o.fill=y(e.data||e,A,ce.colorScale);else{const n=Array.isArray(I)?I:g[I]||u,i=Array.isArray(n)?n:u,r=(e.id??e.data?.[C]??"")+"";me.has(r)||me.set(r,me.size);const s=e.index??t??me.get(r);o.fill=i[s%i.length]}return o}},[he,A,ce.colorScale,I,C,me]),ue=K(()=>h(A),[A]),pe=K(()=>{if(ge||M&&M.length>0)return o(m(ge,M,ue,e=>e.data||e),{stroke:Y,strokeWidth:V,opacity:ee})},[ge,M,ue,Y,V,ee]),fe=K(()=>{if(he)return q({edgeColorBy:H,colorBy:A,colorScale:ce.colorScale,nodeStyleFn:pe||(e=>({fill:S(void 0,ce.themeCategorical,I,void 0,de)})),edgeOpacity:L,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:L}})},[he,H,A,ce.colorScale,pe,L,ce.themeCategorical,I,de]),be=K(()=>fe?o(fe,{stroke:Y,strokeWidth:V,opacity:ee}):void 0,[fe,Y,V,ee]),ye=K(()=>{if(!ie)return;const e=P||C;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[ie,P,C]),ve=e({componentName:"ChordDiagram",edges:d,edgesRequired:!0});return ve?Q(B,{componentName:"ChordDiagram",message:ve,width:te,height:oe}):ce.loadingEl?ce.loadingEl:ce.emptyEl?ce.emptyEl:Q(N,{componentName:"ChordDiagram",width:te,height:oe,children:Q(s,{ref:r,chartType:"chord",...ce.safeNodes.length>0&&{nodes:ce.safeNodes},...null!=d&&{edges:ce.safeEdges},size:[te,oe],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce.margin,nodeIDAccessor:C,sourceAccessor:b,targetAccessor:k,valueAccessor:w,padAngle:x,groupWidth:D,sortGroups:O,nodeStyle:pe,edgeStyle:be,colorBy:A,colorScheme:ce.effectivePalette,edgeColorBy:H,edgeOpacity:L,nodeLabel:ye,showLabels:ie,enableHover:ne,tooltipContent:!1===E?()=>null:v(E)||void 0,...c({linkedHover:$,selection:j,onObservation:R,onClick:z,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior,linkedHoverInClickPredicate:!1}),...Z&&"none"!==Z&&{legendHoverBehavior:ce.legendState.onLegendHover,legendClickBehavior:ce.legendState.onLegendClick,legendHighlightedCategory:ce.legendState.highlightedCategory,legendIsolatedCategories:ce.legendState.isolatedCategories},className:f,title:re,description:se,summary:ae,accessibleTable:le,...null!=t.animate&&{animate:t.animate},...W})})});V.displayName="ChordDiagram";import{useMemo as ee,forwardRef as te,useRef as oe}from"react";import{jsx as ne}from"react/jsx-runtime";var ie=te(function(t,n){const r=oe(null);i(n,{variant:"network",frameRef:r,overrides:{getData:()=>r.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const a=T(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:800,height:600}),{nodes:l,edges:d,margin:g,className:u,sourceAccessor:p="source",targetAccessor:f="target",valueAccessor:b="value",nodeIdAccessor:k="id",colorBy:w,colorScheme:C,styleRules:A,edgeColorBy:I="source",orientation:M="horizontal",nodeAlign:H="justify",nodePaddingRatio:x=.05,nodeWidth:D=15,nodeLabel:O,edgeOpacity:P=.5,edgeSort:L,tooltip:E,frameProps:W={},onObservation:R,onClick:z,chartId:F,selection:j,linkedHover:$,loading:_,loadingContent:G,emptyContent:X,showLegend:Z,legendPosition:K,legendInteraction:Y,stroke:U,strokeWidth:Q,opacity:V}=t,{width:te,height:ie,enableHover:re,showLabels:se=!0,title:ae,description:le,summary:ce,accessibleTable:de}=a,me=J({nodes:l,edges:d,inferNodes:!0,nodeIdAccessor:k,sourceAccessor:p,targetAccessor:f,colorBy:w,colorScheme:C,showLegend:Z,legendPosition:K,legendInteraction:Y,selection:j,linkedHover:$,onObservation:R,onClick:z,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"SankeyDiagram",chartId:F,marginDefaults:a.marginDefaults,userMargin:g,width:te,height:ie,loading:_,loadingContent:G,emptyContent:X}),he=ee(()=>new Map,[]),ge=ee(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=w?y(e.data||e,w,me.colorScale):S(void 0,me.themeCategorical,C,void 0,he),t},[w,me.colorScale,me.themeCategorical,C,he]),ue=ee(()=>h(w,b),[w,b]),pe=ee(()=>o(m(ge,A,ue,e=>e.data||e),{stroke:U,strokeWidth:Q,opacity:V}),[ge,A,ue,U,Q,V]),fe=ee(()=>q({edgeColorBy:I,colorBy:w,colorScale:me.colorScale,nodeStyleFn:pe,edgeOpacity:P,baseStyle:{stroke:"none",strokeWidth:0}}),[I,w,me.colorScale,pe,P]),be=ee(()=>o(fe,{stroke:U,strokeWidth:Q,opacity:V}),[fe,U,Q,V]),ye=ee(()=>{if(!se)return;const e=O||k;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[se,O,k]),ve=e({componentName:"SankeyDiagram",edges:d,edgesRequired:!0});return ve?ne(B,{componentName:"SankeyDiagram",message:ve,width:te,height:ie}):me.loadingEl?me.loadingEl:me.emptyEl?me.emptyEl:ne(N,{componentName:"SankeyDiagram",width:te,height:ie,children:ne(s,{ref:r,chartType:"sankey",...me.safeNodes.length>0&&{nodes:me.safeNodes},...null!=d&&{edges:me.safeEdges},size:[te,ie],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:me.margin,nodeIDAccessor:k,sourceAccessor:p,targetAccessor:f,valueAccessor:b,orientation:M,nodeAlign:H,nodePaddingRatio:x,nodeWidth:D,nodeStyle:pe,edgeStyle:be,colorBy:w,colorScheme:me.effectivePalette,edgeColorBy:I,edgeOpacity:P,edgeSort:L,nodeLabel:ye,showLabels:se,enableHover:re,tooltipContent:!1===E?()=>null:v(E)||void 0,...c({linkedHover:$,selection:j,onObservation:R,onClick:z,mobileInteraction:me.mobileInteraction,customHoverBehavior:me.customHoverBehavior,customClickBehavior:me.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:me.legend,legendPosition:me.legendPosition,...Y&&"none"!==Y&&{legendHoverBehavior:me.legendState.onLegendHover,legendClickBehavior:me.legendState.onLegendClick,legendHighlightedCategory:me.legendState.highlightedCategory,legendIsolatedCategories:me.legendState.isolatedCategories},className:u,title:ae,description:le,summary:ce,accessibleTable:de,...null!=t.animate&&{animate:t.animate},...W})})});function re(e,t,o){const n=[],i=new Set(e.map(e=>e.id)),r=Array.isArray(o)&&2===o.length,s=r&&Number.isFinite(o[0])&&Number.isFinite(o[1]);r&&s&&s&&o[1]>=o[0]||n.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||n.push({kind:"invalid-node-time",id:t.id}));for(const e of t)i.has(e.source)||n.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),i.has(e.target)||n.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||n.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||n.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):n.push({kind:"invalid-edge-time",id:e.id});return n}function se(e){return"invalid-node-time"===e.kind?`node ${e.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===e.kind?`edge ${e.id} has an invalid startTime or endTime`:"invalid-domain"===e.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===e.kind?`edge ${e.id} must have a positive finite value`:"missing-node"===e.kind?`edge ${e.id} references missing ${e.endpoint} node "${e.nodeId}"`:"backward-edge"===e.kind?`edge ${e.id} (${e.source}->${e.target}) ends before it starts`:e.kind}function ae(e,t,o){const n=t.incoming[e.id],i=t.outgoing[e.id],r=[];for(const e of n)r.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:o.get(e.id).targetSide});for(const e of i)r.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:o.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},a=()=>{r.sort((e,t)=>e.time-t.time||(s[e.kind]??99)-(s[t.kind]??99))},l=r.length?x(r.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,d=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,m=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;m.length>e;e++)h.set(m[e],m[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=d?d:e};a();const u=[];let p=0,f=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?p:f);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?p:f);if(n>0){const i=g(e.time);u.push({time:i,delta:-n,kind:"transfer-out",side:t}),u.push({time:i,delta:+n,kind:"transfer-in",side:e.side}),"top"===t?p-=n:f-=n,"top"===e.side?p+=n:f+=n,o-=n}o>0&&null!==d&&(u.push({time:d,delta:+o,kind:"create",side:e.side}),"top"===e.side?p+=o:f+=o)}"top"===e.side?p-=t:f-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?p+=t:f+=t}r.push(...u),a();let b=0,y=0,v=0,k=0,S=0;const w=[],C=new Map;for(const e of r){if(w.push({t:e.time,topMass:b,botMass:y}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?b:y;C.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?b+=e.delta:y+=e.delta,b+y>v&&(v=b+y),b>k&&(k=b),y>S&&(S=y),w.push({t:e.time,topMass:b,botMass:y})}const T=[];let A=0;for(;w.length>A;){let e=A;for(;w.length>e+1&&w[e+1].t===w[A].t;)e++;T.push(w[A]);for(let t=A+1;e>=t;t++){const e=T[T.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||T.push(w[t])}A=e+1}const I=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let M=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===M||M>e.systemInTime)&&(M=e.systemInTime);let H=null;for(const e of n)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===H||e.systemOutTime>H)&&(H=e.systemOutTime);if(T.length>0){const e=T[T.length-1],t=Math.max(null!=I?I:-1/0,null!=H?H:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&T.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=T[0],n=Math.min(null!=c?c:1/0,null!=M?M:1/0);Number.isFinite(n)&&o.t>n&&o.topMass+o.botMass>0&&T.unshift({t:n,topMass:o.topMass,botMass:o.botMass})}return{samples:T,peak:v,topPeak:k,botPeak:S,localAttachments:C}}function le(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function ce(e,t){return e.map(e=>({t:le(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function de(e,t,o){const n=e.value*o;if("out"===e.kind){const i=e.sideMassBefore*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}const i=e.sideMassAfter*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}function me(e,t){let o=0;for(let n=0;t.length>n;n++)for(let i=n+1;t.length>i;i++){const r=t[n],s=t[i];r.source!==s.source&&r.target!==s.target&&r.source!==s.target&&r.target!==s.source&&(Math.min(r.endTime,s.endTime)>Math.max(r.startTime,s.startTime)&&e[s.source]>e[r.source]!=e[s.target]>e[r.target]&&o++)}return o}function he(e,t){let o=0;for(const n of t)o+=Math.abs(e[n.source]-e[n.target])*(n.value||1);return o}function ge(e,t){return 1e3*me(e,t)+he(e,t)}function ue(e,t){return{slots:e.map(e=>({peak:{...e.peak},occupants:e.occupants.slice()})),map:{...t}}}function pe(e,t,o){e.length>8||o.length>40?(function(e,t,o,n=6){const i=e.length;if(1>=i)return;let r=ue(e,t),s=ge(t,o);for(let a=0;n>a;a++){const n=Array(i).fill(0),a=Array(i).fill(0);for(const e of o){const o=t[e.source],i=t[e.target];n[o]+=i*(e.value||1),a[o]+=e.value||1,n[i]+=o*(e.value||1),a[i]+=e.value||1}const l=Array.from({length:i},(e,t)=>t).sort((e,t)=>(a[e]>0?n[e]/a[e]:e)-(a[t]>0?n[t]/a[t]:t)),c=l.map(t=>e[t]),d=new Map;l.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t);const m=ge(t,o);if(s>m)s=m,r=ue(e,t);else if(m===s)break}!function(e,t,o){e.length=0;for(const t of o.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(o.map))t[e]=o.map[e]}(e,t,r)}(e,t,o,6),function(e,t,o,n=6){const i=e.length;if(1>=i)return;let r=ge(t,o);for(let s=0;n>s;s++){let n=!1;for(let s=0;i-1>s;s++){const i=e[s];e[s]=e[s+1],e[s+1]=i;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s);const a=ge(t,o);if(r>a)r=a,n=!0;else{const o=e[s];e[s]=e[s+1],e[s+1]=o;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s)}}if(!n)break}}(e,t,o,6)):function(e,t,o){const n=e.length;if(1>=n)return;const i={...t},r=Object.keys(i),s=Array.from({length:n},(e,t)=>t),a=s.slice(),l={...i};let c=s.slice(),d=1/0;const m=()=>{for(const e of r)l[e]=a[i[e]];const e=ge(l,o);d>e&&(d=e,c=s.slice())},h=(e,t)=>{const o=s[e],n=s[t];s[e]=n,s[t]=o,a[o]=t,a[n]=e};m();const g=Array(n).fill(0);let u=0;for(;n>u;)u>g[u]?(h(u%2==0?0:g[u],u),m(),g[u]++,u=0):(g[u]=0,u++);const p=c.map(t=>e[t]),f=new Map;c.forEach((e,t)=>f.set(e,t));for(const e of Object.keys(t))t[e]=f.get(t[e]);e.length=0;for(const t of p)e.push(t)}(e,t,o)}function fe(e,t,o,n,i){const{plotH:r,padding:s,valueScale:a,packing:l,laneOrder:c,lifetimeMode:d="full"}=i,m={},h={};for(const t of e)m[t.id]=o[t.id].topPeak||0,h[t.id]=o[t.id].botPeak||0;const g="half"===d,u={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,o=Array.isArray(t.xExtent)?t.xExtent[1]:null;let i=null!=e&&Number.isFinite(e)?e:1/0,r=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of n.outgoing[t.id]){i>e.startTime&&(i=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&i>e.systemInTime&&(i=e.systemInTime);const t=g?(e.startTime+e.endTime)/2:e.endTime;t>r&&(r=t)}for(const e of n.incoming[t.id]){const t=g?(e.startTime+e.endTime)/2:e.startTime;i>t&&(i=t),e.endTime>r&&(r=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>r&&(r=e.systemOutTime)}u[t.id]={start:Number.isFinite(i)?i:null,end:Number.isFinite(r)?r:null}}const p={},f=[];if("reuse"===l){const o=new Map;for(const t of e)o.set(t.id,0);const i=new Map;for(const t of e)i.set(t.id,0);for(const e of t)i.set(e.target,(i.get(e.target)??0)+1);const r=[];for(const t of e)0===(i.get(t.id)??0)&&r.push(t.id);for(;r.length;){const e=r.shift();for(const t of n.outgoing[e]??[]){const n=(o.get(e)??0)+1;n>(o.get(t.target)??0)&&o.set(t.target,n),i.set(t.target,i.get(t.target)-1),0===i.get(t.target)&&r.push(t.target)}}const s=[...e].filter(e=>null!==u[e.id].start).sort((e,t)=>{const n=o.get(e.id)??0,i=o.get(t.id)??0;return n!==i?n-i:u[e.id].start-u[t.id].start}),a=e.filter(e=>null===u[e.id].start);for(const e of[...s,...a]){const t=u[e.id];let o=-1;for(let e=0;f.length>e;e++){const n=f[e].occupants[f[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.end){o=e;break}}-1===o&&(f.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=f.length-1),f[o].occupants.push({id:e.id,end:t?.end??-1/0}),f[o].peak.topPeak=Math.max(f[o].peak.topPeak,m[e.id]),f[o].peak.botPeak=Math.max(f[o].peak.botPeak,h[e.id]),p[e.id]=o}}else e.forEach((e,t)=>{f.push({occupants:[{id:e.id,end:u[e.id]?.end??-1/0}],peak:{topPeak:m[e.id],botPeak:h[e.id]}}),p[e.id]=t});let b=null,y=null,v=null,k=null;const S=()=>{b=me(p,t),v=he(p,t)},w=()=>{y=me(p,t),k=he(p,t)};"crossing-min"===c?(S(),pe(f,p,t),w()):"inside-out"===c?(S(),function(e,t){const o=e.length;if(1>=o)return;const n=e=>e.peak.topPeak+e.peak.botPeak,i=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>n(t.slot)-n(e.slot)),r=Array(o),s=Math.floor((o-1)/2);r[s]=i[0].idx;let a=s-1,l=s+1;for(let e=1;i.length>e;e++)e%2==1&&o>l||0>a?r[l++]=i[e].idx:r[a--]=i[e].idx;const c=r.map(t=>e[t]),d=new Map;r.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t)}(f,p),w()):"crossing-min+inside-out"===c&&(S(),pe(f,p,t),function(e,t,o){const n=e.length;if(1>=n)return;const i=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),r=Math.floor((n-1)/2);let s=ge(t,o);for(const{slot:a}of i){const i=e.indexOf(a);if(0>i)continue;const l=r;if(i===l)continue;const c=e[i];e.splice(i,1),e.splice(l,0,c);const d=new Map;for(let e=0;n>e;e++)d.set(e,e);if(l>i){for(let e=i+1;l>=e;e++)d.set(e,e-1);d.set(i,l)}else{for(let e=l;i>e;e++)d.set(e,e+1);d.set(i,l)}for(const e of Object.keys(t))t[e]=d.get(t[e]);const m=ge(t,o);if(m>s){const o=e[l];e.splice(l,1),e.splice(i,0,o);const r=new Map;for(let e=0;n>e;e++)r.set(e,e);if(i>l){for(let e=l+1;i>=e;e++)r.set(e,e-1);r.set(l,i)}else{for(let e=i;l>e;e++)r.set(e,e+1);r.set(l,i)}for(const e of Object.keys(t))t[e]=r.get(t[e])}else s=m}}(f,p,t),w());const C=f.map(e=>{const t=new Map;for(const n of e.occupants){const e=o[n.id];if(e)for(const o of e.samples){const e=t.get(o.t)||{top:0,bot:0};t.set(o.t,{top:Math.max(e.top,o.topMass),bot:Math.max(e.bot,o.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),T=(e,t)=>{let o={top:0,bot:0};for(const[n,i]of e){if(n>t)break;o=i}return o},A=[];for(let e=0;f.length-1>e;e++){const t=C[e],o=C[e+1],n=new Set([...t.map(e=>e[0]),...o.map(e=>e[0])]);let i=0;for(const e of n){const n=T(t,e),r=T(o,e);n.bot+r.top>i&&(i=n.bot+r.top)}A.push(i)}const I=[];let M=s+(f[0]?.peak.topPeak??0)*a;f.length>0&&I.push(M);for(let e=1;f.length>e;e++)M+=A[e-1]*a+s,I.push(M);if(f.length>0&&(M+=f[f.length-1].peak.botPeak*a+s),M>r){const e=r/M;for(let t=0;I.length>t;t++)I[t]*=e}const H=0===f.length?0:f[0].peak.topPeak+A.reduce((e,t)=>e+t,0)+f[f.length-1].peak.botPeak,x={};for(const t of e)x[t.id]=I[p[t.id]];return{effectiveSlotsHeight:H,centerlines:x,laneLifetime:u,slots:f,slotByNode:p,slotCenter:I,crossingsBefore:b,crossingsAfter:y,lengthBefore:v,lengthAfter:k}}ie.displayName="SankeyDiagram";import{useMemo as be,useState as ye,useRef as ve,useCallback as ke}from"react";import{scaleTime as Se}from"d3-scale";import{forwardRef as we}from"react";var Ce=e=>{const{bands:t=[],ribbons:o=[],showLabels:n=!0}=e.config,i=[];for(const e of o)i.push({type:"bezier",pathD:e.pathD,...e.bezier&&{bezierCache:e.bezier},style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}});for(const e of t)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const o=e.gradientStubs[t];i.push({type:"bezier",pathD:o.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:o.x0,x1:o.x1,from:o.from,to:o.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of t)i.push({type:"bezier",pathD:e.pathD,style:{...e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86},stroke:e.stroke??e.fill,strokeWidth:e.strokeWidth??.5},datum:{__kind:"band",data:e.rawDatum,id:e.id}});const r=n?t.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:t.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:i,labels:r}};function Te(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}import{Fragment as Ae,jsx as Ie,jsxs as Me}from"react/jsx-runtime";function He(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function xe(e,t){return"function"==typeof e?e(t):t[e]}var Be=we(function(e,t){const{nodes:o,edges:n,domain:r,axisTicks:l=[],nodeIdAccessor:c="id",sourceAccessor:d="source",targetAccessor:m="target",valueAccessor:h="value",startTimeAccessor:g="startTime",endTimeAccessor:u="endTime",systemInTimeAccessor:p,systemOutTimeAccessor:f,xExtentAccessor:k="xExtent",edgeIdAccessor:S="id",colorBy:w,colorScheme:C,showLegend:T,legendPosition:A="right",pairing:I="temporal",packing:M="reuse",laneOrder:H="crossing-min",ribbonLane:x="both",lifetimeMode:B="half",showLaneRails:N=!1,showQualityReadout:D=!1,showLabels:O=!0,width:P=600,height:L=400,margin:E,title:W,description:R,summary:z,accessibleTable:F,responsiveWidth:j,responsiveHeight:$,loading:G,loadingContent:q,emptyContent:X,edgeOpacity:Z=.35,timeFormat:K,valueFormat:Y,tooltip:U,enableHover:Q=!0,onObservation:V,onClick:ee,showParticles:te=!1,particleStyle:oe,chartId:ne,frameProps:ie={}}=e,[me,he]=ye([]),[ge,ue]=ye([]),pe=ve(me),we=ve(ge);pe.current=me,we.current=ge;const Be=ke(e=>{pe.current=e,he(e)},[]),Ne=ke(e=>{we.current=e,ue(e)},[]),De=void 0!==n,Oe=b(De?n:me),Pe=be(()=>{const e=b(o??[]),t=ge;if(0===e.length&&0===t.length)return _([],Oe,d,m);const n=new Set,i=[];for(const t of e){const e=xe(c,t)+"";n.has(e)||(n.add(e),i.push(t))}for(const e of t){const t=xe(c,e)+"";n.has(t)||(n.add(t),i.push(e))}const r=_([],Oe,d,m);for(const e of r)n.has(e.id)||(n.add(e.id),i.push(e));return i},[o,ge,Oe,c,d,m]),Le=ve(null),Ee=ke((e,t)=>{const o=xe(S,e);return null!=o?o+"":`${xe(d,e)}-${xe(m,e)}-${t}`},[S,d,m]),We=ke(e=>{if(null==e)return!1;const t=e;return null!=xe(d,t)&&null!=xe(m,t)},[d,m]);i(t,{variant:"network",frameRef:Le,overrides:{push(e){if(We(e)){if(De)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");Be([...pe.current,e])}else Ne([...we.current,e])},pushMany(e){const t=[],o=[];for(const n of e)We(n)?t.push(n):o.push(n);t.length>0&&(De?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):Be([...pe.current,...t])),o.length>0&&Ne([...we.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!De){const e=pe.current,n=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(Ee(r,i))?o.push(r):n.push(r)}n.length!==e.length&&Be(n)}const n=we.current,i=[];for(const e of n){const n=xe(c,e)+"";t.has(n)?o.push(e):i.push(e)}return i.length!==n.length&&Ne(i),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),n=[];if(!De){let e=!1;const i=pe.current.map((i,r)=>o.has(Ee(i,r))?(n.push(i),e=!0,t(i)):i);e&&Be(i)}let i=!1;const r=we.current.map(e=>{const r=xe(c,e)+"";return o.has(r)?(n.push(e),i=!0,t(e)):e});return i&&Ne(r),n},clear(){De||Be([]),Ne([]),Le.current?.clear()},getData:()=>Oe??[],getScales:()=>null}});const Re=Ee,ze=ke(e=>xe(c,e)+"",[c]),{nodes:Fe,edges:je,domain:$e,rawNodeById:_e,rawEdgeById:Ge}=be(()=>{const e=(Pe??[]).map(e=>{const t={id:ze(e),__raw:e},o=k?xe(k,e):null;if(Array.isArray(o)&&2===o.length){const e=He(o[0]),n=He(o[1]);Number.isFinite(e)&&Number.isFinite(n)&&(t.xExtent=[e,n])}return t}),t=(Oe??[]).map((e,t)=>{const o={id:Re(e,t),source:xe(d,e)+"",target:xe(m,e)+"",value:Number(xe(h,e)),startTime:He(xe(g,e)),endTime:He(xe(u,e)),__raw:e};if(p){const t=He(xe(p,e));Number.isFinite(t)&&(o.systemInTime=t)}if(f){const t=He(xe(f,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[He(r[0]),He(r[1])],n=new Map;for(const t of e)null!=t.__raw&&n.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:o,rawNodeById:n,rawEdgeById:i}},[Pe,Oe,r,ze,Re,k,d,m,h,g,u,p,f]),qe=J({nodes:Pe,edges:Oe,inferNodes:!1,nodeIdAccessor:c,sourceAccessor:d,targetAccessor:m,colorBy:w,colorScheme:C,showLegend:!1,legendPosition:A,selection:void 0,linkedHover:void 0,onObservation:V,onClick:ee,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"ProcessSankey",chartId:ne,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:E,width:P,height:L,loading:G,loadingContent:q,emptyContent:X}),Je=(T??!!w)&&!!w,Xe=ke(e=>null!=E&&("number"==typeof E||null!=E[e]),[E]),Ze=be(()=>{const e={...qe.margin};return Je&&("right"===A&&!Xe("right")&&140>e.right?e.right=140:"bottom"===A&&!Xe("bottom")&&80>e.bottom&&(e.bottom=80)),e},[qe.margin,Je,A,Xe]),Ke=P-Ze.left-Ze.right,Ye=L-Ze.top-Ze.bottom,Ue=be(()=>re(Fe,je,$e),[Fe,je,$e]),Qe=be(()=>Ue.length>0?null:function(e,t,o){const{plotH:n,pairing:i="temporal",packing:r="reuse",laneOrder:s="crossing-min",lifetimeMode:a="half"}=o,l=function(e,t){const o={},n={};for(const t of e)o[t.id]=[],n[t.id]=[];for(const e of t)n[e.source]&&n[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:n}}(e,t),c=function(e,t,o,n="value"){const i="temporal"===n?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,r="temporal"===n?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const o=new Map;for(const n of e){const e=n[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const i=o.get(e);i.edges.push(n),i.total+=n.value,i.earliestStart=Math.min(i.earliestStart,n.startTime),i.latestEnd=Math.max(i.latestEnd,n.endTime)}const s=[...o.values()];s.sort("temporal"===n?(e,o)=>"target"===t?e.earliestStart-o.earliestStart:e.latestEnd-o.latestEnd:(e,t)=>t.total-e.total);for(const e of s)e.edges.sort("target"===t?r:i);return s};for(const t of e){const e=o.outgoing[t.id],n=o.incoming[t.id];if(0===n.length)a(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=o});else if(0===e.length)a(n,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=o});else{const t=a(n,"source"),o=a(e,"target"),i=Math.max(t.length,o.length);for(let e=0;i>e;e++){const n=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)s.get(o.id).targetSide=n;if(o[e])for(const t of o[e].edges)s.get(t.id).sourceSide=n}}}return s}(e,t,l,i);let d={};for(const t of e)d[t.id]=ae(t,l,c);const m=fe(e,t,d,l,{plotH:n,padding:12,valueScale:1,packing:r,laneOrder:s,lifetimeMode:a}),h=new Set;for(const e of t){const t=m.slotByNode[e.source],o=m.slotByNode[e.target];if(void 0===t||void 0===o)continue;const n=c.get(e.id);t!==o?t>o?(n.sourceSide="top",n.targetSide="bot"):(n.sourceSide="bot",n.targetSide="top"):(h.add(e.id),n.sourceSide="bot",n.targetSide="bot")}for(const t of e){const e=l.outgoing[t.id],o=l.incoming[t.id],n=new Set(e.map(e=>c.get(e.id).sourceSide)),i=new Set(o.map(e=>c.get(e.id).targetSide));if(1===n.size&&o.length>0){const e=[...n][0];for(const t of o)m.slotByNode[t.source]===m.slotByNode[t.target]&&(c.get(t.id).targetSide=e)}if(1===i.size&&e.length>0){const t=[...i][0];for(const o of e)m.slotByNode[o.source]===m.slotByNode[o.target]&&(c.get(o.id).sourceSide=t)}}for(const t of e){const e=l.incoming[t.id],o=l.outgoing[t.id];if(0===e.length||0===o.length)continue;const n=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const o of e)"top"===c.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(const e of o)"top"===c.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},i=(e,t)=>{const i=n(),r="top"===e?i.outTop-i.inTop:i.outBot-i.inBot,s="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=s)return!1;const a=Math.min(r,s),l=o.filter(t=>!h.has(t.id)&&c.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(c.get(l[0].id).sourceSide=t,!0)};let r=o.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}d={};for(const t of e)d[t.id]=ae(t,l,c);const g=fe(e,t,d,l,{plotH:n,padding:12,valueScale:1,packing:r,laneOrder:s,lifetimeMode:a}),u=g.effectiveSlotsHeight??g.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),p=Math.min(12,.35*n/Math.max(g.slots.length+1,1)),f=u>0?Math.max(0,(n-p*(g.slots.length+1))/u):1,b=fe(e,t,d,l,{plotH:n,padding:p,valueScale:f,packing:r,laneOrder:s,lifetimeMode:a});return{nodeData:d,sides:c,valueScale:f,padding:p,compressedPadding:12>p,centerlines:b.centerlines,laneLifetime:b.laneLifetime,slots:b.slots,slotByNode:b.slotByNode,crossingsBefore:b.crossingsBefore,crossingsAfter:b.crossingsAfter,lengthBefore:b.lengthBefore,lengthAfter:b.lengthAfter}}(Fe,je,{plotH:Ye,pairing:I,packing:M,laneOrder:H,lifetimeMode:B}),[Ue,Fe,je,Ye,I,M,H,B]),Ve=be(()=>Se().domain($e).range([0,Ke]),[$e,Ke]),et=ke((e,t)=>{if(w&&Pe){const t=_e.get(e);if(t)return y(t,w,qe.colorScale)}return qe.effectivePalette[t%qe.effectivePalette.length]||"#475569"},[w,Pe,_e,qe.colorScale,qe.effectivePalette]),tt=be(()=>{const e=new Map;return Fe.forEach((t,o)=>e.set(t.id,o)),e},[Fe]),ot=be(()=>{if(!Qe)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Qe,n=[],i=[];return Fe.forEach((i,r)=>{const s=t[i.id];if(!s||0===s.samples.length)return;const a=function(e,t,o,n,i){if(0===e.length)return null;const r=ce(e,i),s=e=>t-r[e].topMass*o,a=e=>t+r[e].botMass*o;let l=`M${n(r[0].t)},${s(0)}`;for(let e=1;r.length>e;e++)l+=` L${n(r[e].t)},${s(e)}`;l+=` L${n(r[r.length-1].t)},${a(r.length-1)}`;for(let e=r.length-2;e>=0;e--)l+=` L${n(r[e].t)},${a(e)}`;return l+" Z"}(s.samples,e[i.id],o,Ve,$e);if(!a)return;const l=ce(s.samples,$e),c=l.find(e=>e.topMass+e.botMass>0)||l[0],d=e[i.id]+(c.botMass-c.topMass)*o/2,m=et(i.id,r),h=_e.get(i.id)??i,g=function(e,t,o,n,i){const r=o.nodeData[e];if(!r||0===r.samples.length)return[];const s=o.valueScale,a=o.centerlines[e],l=ce(r.samples,i),c=l.find(e=>e.topMass+e.botMass>0)||l[0],d=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],m=n(c.t),h=n(d.t),g=e=>n(le(e,i)),u=[],p=(e,t,o,n)=>`M${e},${t} L${o},${t} L${o},${n} L${e},${n} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=r.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=g(o.systemInTime),n=g(o.startTime),i=t-20,r=Math.max(m,i);if(n>r){const[o,l]=de(e,a,s);u.push({pathD:p(r,o,n,l),x0:i,x1:t,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=r.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=g(o.systemOutTime),n=g(o.endTime),i=t+20,r=Math.min(h,i);if(r>n){const[o,l]=de(e,a,s);u.push({pathD:p(n,o,r,l),x0:t,x1:i,from:1,to:0})}}}}return u}(i.id,je,Qe,Ve,$e);n.push({id:i.id,pathD:a,fill:m,stroke:m,strokeWidth:.5,...g.length>0&&{gradientStubs:g},rawDatum:h,labelX:Ve(c.t)-4,labelY:d,labelText:i.id})}),je.forEach(n=>{const r=t[n.source]?.localAttachments.get(n.id),s=t[n.target]?.localAttachments.get(n.id);if(!r||!s)return;const l=tt.get(n.source)??0,c=et(n.source,l),d=function(e,t,o,n,i,r,s,a){const l=i,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,d=r(c(e.time)),m=r(c(o.time)),h=e.value*l,g=o.value*l,u=e.sideMassBefore*l,p=o.sideMassAfter*l;let f,b,y,v;"top"===e.side?(f=t-u,b=f+h):(b=t+u,f=b-h),"top"===o.side?(y=n-p,v=y+g):(v=n+p,y=v-g);const k="source"===s?d+.85*(m-d):"target"===s?d+.15*(m-d):(d+m)/2;return{sx:d,sTop:f,sBot:b,tx:m,tTop:y,tBot:v,cp1X:k,cp2X:k}}(r,e[n.source],s,e[n.target],o,Ve,x,$e),{pathD:m,bezier:h}=a(d),g=Ge.get(n.id)??n;i.push({id:n.id,pathD:m,fill:c,opacity:Z,rawDatum:g,bezier:h})}),{bands:n,ribbons:i}},[Qe,Fe,je,Ve,$e,et,_e,Ge,x,Z,tt]),nt=be(()=>({bands:ot.bands,ribbons:ot.ribbons,showLabels:O}),[ot,O]),it=be(()=>{if(!Je||!w)return;const e=new Map;(Pe??[]).forEach((t,o)=>{const n=xe(w,t),i=null==n?"":n+"";i&&!e.has(i)&&e.set(i,{label:i,color:et(ze(t),o)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[Je,w,Pe,et,ze]),rt=be(()=>!1!==U&&Q?void 0===U||!0===U?null:v(U)||null:null,[U,Q]),st=ke(e=>K?K(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[K]),at=ke(e=>Y?Y(e):e+"",[Y]),lt=ke(e=>{if(!e||!e.data)return null;const t=e.data;if(!Te(t))return null;const o=t.data;if(rt)return rt(o);if("band"===t.__kind){const e=t.id,o=Qe?function(e){if(!e)return[];const t=new Set,o=[];for(const n of e.samples){const e=n.topMass+n.botMass,i=`${n.t}:${e}`;t.has(i)||(t.add(i),o.push({t:n.t,total:e}))}return o}(Qe.nodeData[e]):[],n=5,i=o.length>n?o.length:null,r=function(e,t=5){if(t>=e.length)return e.slice();const o=[...e].sort((e,t)=>e.total-t.total),n=o.length-1,i=[{...o[0],mark:"min"},{...o[Math.floor(.25*n)],mark:"q25"},{...o[Math.floor(.5*n)],mark:"median"},{...o[Math.floor(.75*n)],mark:"q75"},{...o[n],mark:"max"}],r=new Set,s=[];for(const e of i)r.has(e.t)||(r.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(o,n);return Me("div",{style:{minWidth:160},children:[Ie("div",{style:{fontWeight:600,marginBottom:4},children:e}),r.length>0&&Me("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[Ie("thead",{children:Me("tr",{style:{opacity:.6},children:[Ie("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),Ie("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=i&&Ie("th",{})]})}),Ie("tbody",{children:r.map((e,t)=>Me("tr",{children:[Ie("td",{style:{paddingRight:8},children:st(e.t)}),Ie("td",{style:{textAlign:"right"},children:at(e.total)}),null!=i&&Ie("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=i&&Me("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",r.length," of ",i," samples"]})]})}const n=o,i=xe(d,n),r=xe(m,n),s=xe(h,n),a=xe(g,n),l=xe(u,n);return Me("div",{style:{minWidth:160},children:[Me("div",{style:{fontWeight:600,marginBottom:4},children:[i+""," → ",r+""]}),Me("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=s&&Me(Ae,{children:[Ie("span",{style:{opacity:.6},children:"value"}),Ie("span",{style:{textAlign:"right"},children:at(Number(s))})]}),null!=a&&Me(Ae,{children:[Ie("span",{style:{opacity:.6},children:"start"}),Ie("span",{style:{textAlign:"right"},children:st(He(a))})]}),null!=l&&Me(Ae,{children:[Ie("span",{style:{opacity:.6},children:"end"}),Ie("span",{style:{textAlign:"right"},children:st(He(l))})]})]})]})},[Qe,rt,st,at,d,m,h,g,u]),ct=be(()=>{if(!Qe)return null;const{centerlines:e,laneLifetime:t,nodeData:o,valueScale:n,compressedPadding:i,crossingsBefore:r,crossingsAfter:s,lengthBefore:a,lengthAfter:c}=Qe;let d=null,m=null;for(const e of Fe){const o=t[e.id];if(!o||null===o.start||null===o.end)continue;const n=Ve(o.start),i=Ve(o.end);(null===d||d>n)&&(d=n),(null===m||i>m)&&(m=i)}const h=e=>Math.max(0,Math.min(Ke,e)),g=h(d??0),u=Math.max(g,h(m??Ke));return Me("g",{children:[D&&null!==(s??null)&&Me("text",{x:Ke,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",r," → ",s," ","edge length: ",Math.round(a)," → ",Math.round(c)]}),i&&Ie("text",{x:Ke,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),l.map((e,t)=>{const o=Ve(He(e.date));return g-.5>o||o>u+.5?null:Ie("line",{x1:o,y1:0,x2:o,y2:Ye,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+t)}),N&&Fe.map((i,r)=>{const s=t[i.id];if(!s||null===s.start)return null;const a=o[i.id],l=a?{topPeak:a.topPeak,botPeak:a.botPeak}:{topPeak:0,botPeak:0},c=e[i.id]+(l.botPeak-l.topPeak)*n/2,d=Ve(s.start),m=Ve(s.end),h=et(i.id,r);return Me("g",{children:[Ie("line",{x1:d,y1:c,x2:m,y2:c,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),Ie("line",{x1:d,y1:c-4,x2:d,y2:c+4,stroke:h,strokeOpacity:.5}),Ie("line",{x1:m,y1:c-4,x2:m,y2:c+4,stroke:h,strokeOpacity:.5})]},"lane-"+i.id)}),Ie("line",{x1:g,y1:Ye+4,x2:u,y2:Ye+4,stroke:"#94a3b8"}),l.map((e,t)=>{const o=He(e.date),n=Ve(o);if(g-.5>n||n>u+.5)return null;const i=null!=e.label?e.label:K?K(new Date(o)):"";return Me("g",{transform:`translate(${n},${Ye+4})`,children:[Ie("line",{y2:6,stroke:"#94a3b8"}),Ie("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:i})]},t)})]})},[Qe,l,Ve,Ke,Ye,N,Fe,et,D,K]),dt=be(()=>(Pe??[]).map(e=>({id:ze(e),data:e})),[Pe,ze]),mt=be(()=>{const e=new Map;for(const t of ot.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[ot]),ht=be(()=>(Oe??[]).map((e,t)=>{const o=Re(e,t),n=Number(xe(h,e));return{id:o,source:xe(d,e)+"",target:xe(m,e)+"",value:Number.isFinite(n)?n:0,bezier:mt.get(o),data:e}}),[Oe,Re,d,m,h,mt]),gt=qe.loadingEl,ut=qe.emptyEl;return Ue.length>0?Me("svg",{width:P,height:L,role:"img","aria-label":W??"Process Sankey validation failed",children:[Ie("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ue.map((e,t)=>Ie("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+se(e)},t))]}):gt||ut||Ie(s,{ref:Le,chartType:"force",nodes:dt,edges:ht,customNetworkLayout:Ce,layoutConfig:nt,size:[P,L],responsiveWidth:j,responsiveHeight:$,margin:Ze,title:W,description:R??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:z,accessibleTable:F,enableHover:Q,tooltipContent:!1===U?()=>null:lt,backgroundGraphics:ct,showParticles:te,particleStyle:oe,legend:it,legendPosition:A,onObservation:V,...ee&&{customClickBehavior:e=>{if(!e||!e.data||!ee)return;const t=e.data;Te(t)&&ee(t.data,{x:e.x,y:e.y})}},chartId:ne,colorScheme:Array.isArray(C)?C:void 0,...ie})});Be.displayName="ProcessSankey";import{useMemo as Ne}from"react";import{jsx as De}from"react/jsx-runtime";function Oe(e){const n=T(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:r,className:a,layout:l="tree",orientation:d="vertical",childrenAccessor:m="children",valueAccessor:h="value",nodeIdAccessor:g="name",colorBy:u,colorScheme:p,colorByDepth:b=!1,edgeStyle:k="curve",nodeLabel:w,nodeSize:C=5,tooltip:A,frameProps:I={},onObservation:M,onClick:H,chartId:x,selection:D,linkedHover:O,loading:P,loadingContent:L,legendInteraction:E,stroke:W,strokeWidth:R,opacity:z}=e,{width:F,height:j,enableHover:_,showLabels:q=!0,title:X,description:Z,summary:K,accessibleTable:Y}=n,U=J({nodes:Ne(()=>$(i??null,m),[i,m]),edges:void 0,inferNodes:!1,colorBy:b?void 0:u,colorScheme:p,showLegend:!1,legendInteraction:E,selection:D,linkedHover:O,onObservation:M,onClick:H,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:n.marginDefaults,userMargin:r,width:F,height:j,loading:P,loadingContent:L}),Q=Ne(()=>new Map,[]),V=Ne(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=b?f[(e.depth||0)%f.length]:u?y(e.data||e,u,U.colorScale):S(void 0,U.themeCategorical,p,void 0,Q),t},[u,b,U.colorScale,U.themeCategorical,p,Q]),ee=Ne(()=>o(V,{stroke:W,strokeWidth:R,opacity:z}),[V,W,R,z]),te=Ne(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),oe=Ne(()=>o(te,{stroke:W,strokeWidth:R,opacity:z}),[te,W,R,z]),ne=Ne(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return G(h)},[l,h]),ie=t({componentName:"TreeDiagram",data:i});return ie?De(B,{componentName:"TreeDiagram",message:ie,width:F,height:j}):U.loadingEl?U.loadingEl:De(N,{componentName:"TreeDiagram",width:F,height:j,children:De(s,{chartType:l,...null!=i&&{data:i},size:[F,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,nodeIDAccessor:g,childrenAccessor:m,hierarchySum:ne,treeOrientation:d,edgeType:k,nodeStyle:ee,edgeStyle:oe,colorBy:u,colorScheme:U.effectivePalette,colorByDepth:b,nodeSize:C,nodeLabel:q?w||g:void 0,showLabels:q,enableHover:_,tooltipContent:!1===A?()=>null:v(A)||void 0,...c({linkedHover:O,selection:D,onObservation:M,onClick:H,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior,linkedHoverInClickPredicate:!1}),...E&&"none"!==E&&{legendHoverBehavior:U.legendState.onLegendHover,legendClickBehavior:U.legendState.onLegendClick,legendHighlightedCategory:U.legendState.highlightedCategory,legendIsolatedCategories:U.legendState.isolatedCategories},className:a,title:X,description:Z,summary:K,accessibleTable:Y,...null!=e.animate&&{animate:e.animate},...I})})}Oe.displayName="TreeDiagram";import{useMemo as Pe,useCallback as Le}from"react";import{jsx as Ee}from"react/jsx-runtime";function We(e){const n=T(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:a,className:l,childrenAccessor:d="children",valueAccessor:m="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:u,colorByDepth:b=!1,labelMode:k="leaf",nodeLabel:w,padding:C=4,paddingTop:A,nodeStyle:I,tooltip:M,frameProps:H={},selection:x,linkedHover:D,onObservation:O,onClick:P,chartId:L,loading:E,loadingContent:W,legendInteraction:R,stroke:z,strokeWidth:F,opacity:j}=e,{nodeStyle:_,...q}=H,{width:X,height:Z,enableHover:K,showLabels:Y=!0,title:U,description:Q,summary:V,accessibleTable:ee}=n,te=J({nodes:Pe(()=>$(i??null,d),[i,d]),edges:void 0,inferNodes:!1,colorBy:b?void 0:g,colorScheme:u,showLegend:!1,legendInteraction:R,selection:x,linkedHover:D,onObservation:O,onClick:P,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Treemap",chartId:L,marginDefaults:n.marginDefaults,userMargin:a,width:X,height:Z,loading:E,loadingContent:W}),oe=r(x),ne=te.customHoverBehavior,ie=Le(e=>{if(!e)return ne(null);const t=e.data||e;ne({data:t?.data||t})},[ne]),re=Pe(()=>new Map,[]),se=Pe(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=b?f[(e.depth||0)%f.length]:g?y(e.data||e,g,te.colorScale):S(void 0,te.themeCategorical,u,void 0,re),t},[g,b,te.colorScale,te.themeCategorical,u,re]),ae=Pe(()=>I||_?e=>({...se(e),..._?_(e)??{}:{},...I?I(e)??{}:{}}):se,[se,I,_]),le=Pe(()=>o(ae,{stroke:z,strokeWidth:F,opacity:j}),[ae,z,F,j]),ce=Pe(()=>te.activeSelectionHook?e=>{const t={...le(e)};if(te.activeSelectionHook.isActive)if(te.activeSelectionHook.predicate(e.data||e))oe?.selectedStyle&&Object.assign(t,oe.selectedStyle);else{const e=oe?.unselectedOpacity??p;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,oe?.unselectedStyle&&Object.assign(t,oe.unselectedStyle)}return t}:le,[le,te.activeSelectionHook,oe]),de=Pe(()=>G(m),[m]),me=void 0!==A?A:!Y||"parent"!==k&&"all"!==k?void 0:18,he=t({componentName:"Treemap",data:i});return he?Ee(B,{componentName:"Treemap",message:he,width:X,height:Z}):te.loadingEl?te.loadingEl:Ee(N,{componentName:"Treemap",width:X,height:Z,children:Ee(s,{chartType:"treemap",...null!=i&&{data:i},size:[X,Z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,nodeIDAccessor:h,childrenAccessor:d,hierarchySum:de,padding:C,paddingTop:me,nodeStyle:ce,colorBy:g,colorScheme:te.effectivePalette,colorByDepth:b,nodeLabel:Y?w||h:void 0,showLabels:Y,labelMode:k,enableHover:K,tooltipContent:!1===M?()=>null:v(M)||void 0,...c({linkedHover:D,selection:x,onObservation:O,onClick:P,mobileInteraction:te.mobileInteraction,customHoverBehavior:ie,customClickBehavior:te.customClickBehavior,linkedHoverInClickPredicate:!1}),...R&&"none"!==R&&{legendHoverBehavior:te.legendState.onLegendHover,legendClickBehavior:te.legendState.onLegendClick,legendHighlightedCategory:te.legendState.highlightedCategory,legendIsolatedCategories:te.legendState.isolatedCategories},className:l,title:U,description:Q,summary:V,accessibleTable:ee,...null!=e.animate&&{animate:e.animate},...q})})}We.displayName="Treemap";import{useMemo as Re}from"react";import{jsx as ze}from"react/jsx-runtime";function Fe(e){const n=T(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:r,className:a,childrenAccessor:l="children",valueAccessor:d="value",nodeIdAccessor:m="name",colorBy:h,colorScheme:g,colorByDepth:u=!1,nodeLabel:p,circleOpacity:b=.7,padding:k=4,tooltip:w,frameProps:C={},onObservation:A,onClick:I,chartId:M,selection:H,linkedHover:x,loading:D,loadingContent:O,legendInteraction:P,stroke:L,strokeWidth:E,opacity:W}=e,{width:R,height:z,enableHover:F,showLabels:j=!0,title:_,description:q,summary:X,accessibleTable:Z}=n,K=J({nodes:Re(()=>$(i??null,l),[i,l]),edges:void 0,inferNodes:!1,colorBy:u?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:P,selection:H,linkedHover:x,onObservation:A,onClick:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"CirclePack",chartId:M,marginDefaults:n.marginDefaults,userMargin:r,width:R,height:z,loading:D,loadingContent:O}),Y=Re(()=>new Map,[]),U=Re(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:b};return t.fill=u?f[(e.depth||0)%f.length]:h?y(e.data||e,h,K.colorScale):S(void 0,K.themeCategorical,g,void 0,Y),t},[h,u,K.colorScale,b,K.themeCategorical,g,Y]),Q=Re(()=>o(U,{stroke:L,strokeWidth:E,opacity:W}),[U,L,E,W]),V=Re(()=>G(d),[d]),ee=t({componentName:"CirclePack",data:i});return ee?ze(B,{componentName:"CirclePack",message:ee,width:R,height:z}):K.loadingEl?K.loadingEl:ze(N,{componentName:"CirclePack",width:R,height:z,children:ze(s,{chartType:"circlepack",...null!=i&&{data:i},size:[R,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,nodeIDAccessor:m,childrenAccessor:l,hierarchySum:V,padding:k,nodeStyle:Q,colorBy:h,colorScheme:K.effectivePalette,colorByDepth:u,nodeLabel:j?p||m:void 0,showLabels:j,enableHover:F,tooltipContent:!1===w?()=>null:v(w)||void 0,...c({linkedHover:x,selection:H,onObservation:A,onClick:I,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior,linkedHoverInClickPredicate:!1}),...P&&"none"!==P&&{legendHoverBehavior:K.legendState.onLegendHover,legendClickBehavior:K.legendState.onLegendClick,legendHighlightedCategory:K.legendState.highlightedCategory,legendIsolatedCategories:K.legendState.isolatedCategories},className:a,title:_,description:q,summary:X,accessibleTable:Z,...null!=e.animate&&{animate:e.animate},...C})})}Fe.displayName="CirclePack";import{useMemo as je}from"react";import{jsx as $e}from"react/jsx-runtime";var _e=f;function Ge(e){const n=T(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:r,className:a,childrenAccessor:l="children",nodeIdAccessor:d="name",colorBy:m,colorScheme:h,colorByDepth:p=!1,orbitMode:f="flat",orbitSize:b=2.95,speed:k=.25,revolution:w,revolutionStyle:C,eccentricity:A=1,showRings:I=!0,nodeRadius:M=6,showLabels:H=!1,animated:x=!0,tooltip:D,foregroundGraphics:O,annotations:P,frameProps:L={},onObservation:E,onClick:W,chartId:R,selection:z,linkedHover:F,loading:j,loadingContent:_,stroke:G,strokeWidth:q,opacity:X}=e,{width:Z,height:K,enableHover:Y,title:U,description:Q,summary:V,accessibleTable:ee}=n,te=J({nodes:je(()=>$(i,l),[i,l]),edges:void 0,inferNodes:!1,colorBy:p?void 0:m,colorScheme:h,showLegend:!1,legendInteraction:void 0,selection:z,linkedHover:F,onObservation:E,onClick:W,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"OrbitDiagram",chartId:R,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:r,width:Z,height:K,loading:j,loadingContent:_}),oe=je(()=>new Map,[]),{colorScale:ne,customClickBehavior:ie,customHoverBehavior:re,themeCategorical:se}=te,ae=je(()=>{if(Array.isArray(h))return h;const e=g[h];return Array.isArray(e)?e:u},[h]),le=je(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=p?o?ae[0]:_e[(e.depth||0)%_e.length]:m?y(e.data||e,m,ne):S(void 0,se,h,void 0,oe),t.opacity=o?1:.85,t},[m,p,ne,ae,se,h,oe]),ce=je(()=>o(le,{stroke:G,strokeWidth:q,opacity:X}),[le,G,q,X]),de=je(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),me=je(()=>e=>{re(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[re]),he=je(()=>e=>{ie(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[ie]),ge=t({componentName:"OrbitDiagram",data:i});return ge?$e(B,{componentName:"OrbitDiagram",message:ge,width:Z,height:K}):te.loadingEl?te.loadingEl:$e(N,{componentName:"OrbitDiagram",width:Z,height:K,children:$e(s,{chartType:"orbit",...null!=i&&{data:i},size:[Z,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,nodeIDAccessor:d,childrenAccessor:l,nodeStyle:ce,edgeStyle:de,colorBy:m,colorScheme:te.effectivePalette,colorByDepth:p,nodeSize:M,nodeLabel:H?d:void 0,showLabels:H,enableHover:!x&&Y,tooltipContent:x?void 0:!1===D?()=>null:v(D)||void 0,...c({linkedHover:F,selection:z,onObservation:E,onClick:W,mobileInteraction:te.mobileInteraction,customHoverBehavior:me,customClickBehavior:he,linkedHoverInClickPredicate:!1}),foregroundGraphics:O,annotations:P,className:a,title:U,description:Q,summary:V,orbitMode:f,orbitSize:b,orbitSpeed:k,orbitRevolution:w,orbitRevolutionStyle:C,orbitEccentricity:A,orbitShowRings:I,orbitAnimated:x,accessibleTable:ee,...null!=e.animate&&{animate:e.animate},...L})})}Ge.displayName="OrbitDiagram";import{forceCenter as qe,forceCollide as Je,forceLink as Xe,forceManyBody as Ze,forceSimulation as Ke,forceX as Ye,forceY as Ue}from"d3-force";function Qe(e,t,o={}){const n=o.iterations??260,i=o.repulsion??5200,r=o.linkDistance??165,s=o.linkStrength??.045,a=o.centerStrength??.018,l=o.damping??.84,c=o.nodeRadius??12,m=o.nodePadding??3,h=o.inset??.06,g=d(o.seed??1),u=new Map;for(const t of e)u.set(t.id,0);for(const e of t)u.set(e.source,(u.get(e.source)??0)+1),u.set(e.target,(u.get(e.target)??0)+1);const p=500,f=e.map(e=>({id:e.id,data:e,x:200+600*g(),y:200+600*g()})),b=new Set(e.map(e=>e.id)),y=t.filter(e=>b.has(e.source)&&b.has(e.target)).map(e=>({source:e.source,target:e.target}));if(n>0){const e=Ke(f).randomSource(g).alphaDecay(1-Math.pow(.001,1/n)).velocityDecay(Math.max(0,Math.min(1,1-l))).force("charge",Ze().strength(e=>{const t=u.get(e.id)??0;return 2.5*-Math.sqrt(i)*Math.sqrt(t+1)})).force("collide",Je(e=>(e=>"function"==typeof c?c(e.data):c)(e)+m).strength(.9).iterations(2)).force("center",qe(p,p).strength(.8)).force("x",Ye(p).strength(a)).force("y",Ue(p).strength(a));y.length>0&&e.force("link",Xe(y).id(e=>e.id).distance(r).strength(e=>{const t="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(u.get("string"==typeof e.source?e.source:e.source.id)??1,u.get(t)??1));return s/.045/o})),e.stop();for(let t=0;n>t;t+=1)e.tick()}let v=1/0,k=1/0,S=-1/0,w=-1/0;for(const e of f){const t=e.x??p,o=e.y??p;v>t&&(v=t),k>o&&(k=o),t>S&&(S=t),o>w&&(w=o)}const C=S-v,T=w-k,A={};for(const e of f)A[e.id]={x:0===C?.5:h+((e.x??p)-v)/C*(1-2*h),y:0===T?.5:h+((e.y??p)-k)/T*(1-2*h)};return A}export{W as NetworkCustomChart,Z as ForceDirectedGraph,V as ChordDiagram,ie as SankeyDiagram,re as validateProcessSankey,se as formatProcessSankeyIssue,Be as ProcessSankey,Oe as TreeDiagram,We as Treemap,Fe as CirclePack,Ge as OrbitDiagram,Qe as forceLayout};
@@ -1 +0,0 @@
1
- function t(t,n,e){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:e.x+e.w/2,cy:e.y+e.h/2}}function n(t,n=30){return Math.max((t??4)+5,12,n)}function e(t){return t instanceof Date?t:"number"==typeof t&&t>1e9?new Date(t):null}function r(t,n){const r=e(t);if(!r)return!1;const u=e(n);return!u||r.getFullYear()!==u.getFullYear()||r.getMonth()!==u.getMonth()}function u(t){let n=t%(2*Math.PI);return 0>n&&(n+=2*Math.PI),n}export{t as hitTestRect,n as getHitRadius,r as isTimeLandmark,u as normalizeAngle};