semiotic 3.8.5 → 3.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +37 -10
- package/README.md +83 -56
- package/ai/behaviorContracts.cjs +88 -3
- package/ai/componentMetadata.cjs +5 -10
- package/ai/dist/mcp-server.js +99 -10
- package/ai/examples.md +198 -9
- package/ai/schema.json +2002 -165
- package/ai/surface-manifest.json +14 -10
- package/ai/system-prompt.md +9 -3
- package/dist/{chunk-chartContainerDataAudit-74TLKIP6.module.min.js → chunk-chartContainerDataAudit-JDSVSKGM.module.min.js} +1 -1
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
- package/dist/chunk-chunk-2YAZHXL4.module.min.js +2 -0
- package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
- package/dist/{chunk-chunk-G7WFWHAD.module.min.js → chunk-chunk-4ITOQRXM.module.min.js} +1 -1
- package/dist/chunk-chunk-5SD6BHVW.module.min.js +2 -0
- package/dist/chunk-chunk-6V5VQVCT.module.min.js +2 -0
- package/dist/chunk-chunk-7TTBHSAG.module.min.js +2 -0
- package/dist/chunk-chunk-7ZDJSYKI.module.min.js +2 -0
- package/dist/chunk-chunk-BGHPD3RA.module.min.js +1 -0
- package/dist/chunk-chunk-BMRZ2SPU.module.min.js +2 -0
- package/dist/chunk-chunk-BNGBEY7N.module.min.js +2 -0
- package/dist/chunk-chunk-C7APLVQD.module.min.js +2 -0
- package/dist/chunk-chunk-DGWFBOGB.module.min.js +1 -0
- package/dist/chunk-chunk-DIVE2DRA.module.min.js +2 -0
- package/dist/chunk-chunk-FBUNUIPV.module.min.js +2 -0
- package/dist/chunk-chunk-FQPKOAIH.module.min.js +2 -0
- package/dist/chunk-chunk-FRO4TRXK.module.min.js +2 -0
- package/dist/chunk-chunk-G7QVPZUD.module.min.js +2 -0
- package/dist/chunk-chunk-GBPYV4FP.module.min.js +2 -0
- package/dist/chunk-chunk-GU2EJIDJ.module.min.js +2 -0
- package/dist/chunk-chunk-J5QD4RAM.module.min.js +2 -0
- package/dist/{chunk-chunk-LJLS6DY7.module.min.js → chunk-chunk-JWXLNZSM.module.min.js} +1 -1
- package/dist/chunk-chunk-KXAFCCDB.module.min.js +2 -0
- package/dist/chunk-chunk-LG7YKJAK.module.min.js +2 -0
- package/dist/{chunk-chunk-I36PJ4OC.module.min.js → chunk-chunk-LVHDZAT3.module.min.js} +1 -1
- package/dist/chunk-chunk-LWITSR2O.module.min.js +2 -0
- package/dist/chunk-chunk-MX35T6RX.module.min.js +2 -0
- package/dist/chunk-chunk-NH4MEAKP.module.min.js +2 -0
- package/dist/chunk-chunk-NJETWX42.module.min.js +2 -0
- package/dist/chunk-chunk-NW25WGLS.module.min.js +2 -0
- package/dist/{chunk-chunk-TMWIZL3K.module.min.js → chunk-chunk-OI7R7EJB.module.min.js} +1 -1
- package/dist/chunk-chunk-ONMLEXHR.module.min.js +2 -0
- package/dist/chunk-chunk-OY66GCE6.module.min.js +1 -0
- package/dist/chunk-chunk-PZFT457G.module.min.js +1 -0
- package/dist/chunk-chunk-Q3WW6JGR.module.min.js +1 -0
- package/dist/chunk-chunk-Q6XKQTOQ.module.min.js +1 -0
- package/dist/chunk-chunk-RJRM2E6P.module.min.js +1 -0
- package/dist/chunk-chunk-RPL7WYXI.module.min.js +1 -0
- package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
- package/dist/chunk-chunk-TSCFL235.module.min.js +1 -0
- package/dist/chunk-chunk-UOQRPGPK.module.min.js +2 -0
- package/dist/chunk-chunk-V3OAKG32.module.min.js +1 -0
- package/dist/chunk-chunk-WLOIUMWG.module.min.js +2 -0
- package/dist/chunk-chunk-XEGXX4F7.module.min.js +1 -0
- package/dist/chunk-chunk-XFRBLXYM.module.min.js +1 -0
- package/dist/chunk-chunk-Z2AJERX5.module.min.js +2 -0
- package/dist/chunk-chunk-ZXYDYAB7.module.min.js +2 -0
- package/dist/components/ai/SemioticVACPBridge.d.ts +22 -0
- package/dist/components/ai/chartCapabilities.d.ts +5 -3
- package/dist/components/ai/conversationArc.d.ts +2 -176
- package/dist/components/ai/conversationArcTypes.d.ts +202 -0
- package/dist/components/ai/readerGrounding.d.ts +12 -0
- package/dist/components/ai/vacpAdapter.d.ts +13 -0
- package/dist/components/ai/vacpAdapterActions.d.ts +2 -0
- package/dist/components/ai/vacpAdapterModel.d.ts +7 -0
- package/dist/components/ai/vacpAdapterRuntime.d.ts +26 -0
- package/dist/components/ai/vacpAdapterState.d.ts +3 -0
- package/dist/components/ai/vacpAdapterTypes.d.ts +169 -0
- package/dist/components/ai/vacpTypes.d.ts +160 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
- package/dist/components/charts/index.d.ts +7 -4
- package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
- package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
- package/dist/components/charts/physics/ChainReactionChart.capability.d.ts +9 -0
- package/dist/components/charts/physics/ChainReactionChart.d.ts +29 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +1 -1
- package/dist/components/charts/physics/EventDropChart.d.ts +7 -2
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +1 -1
- package/dist/components/charts/physics/{PhysicsPileChart.capability.d.ts → PacketFlowChart.capability.d.ts} +1 -1
- package/dist/components/charts/physics/{PhysicalFlowChart.d.ts → PacketFlowChart.d.ts} +22 -6
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +1 -1
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +7 -4
- package/dist/components/charts/physics/{PhysicalFlowChart.capability.d.ts → UnitPileChart.capability.d.ts} +1 -1
- package/dist/components/charts/physics/{PhysicsPileChart.d.ts → UnitPileChart.d.ts} +19 -6
- package/dist/components/charts/physics/crucibleChartProps.d.ts +1 -1
- package/dist/components/charts/physics/crucibleChartUtils.d.ts +9 -0
- package/dist/components/charts/physics/gauntletChartProps.d.ts +6 -1
- package/dist/components/charts/physics/gauntletTerminal.d.ts +61 -0
- package/dist/components/charts/physics/packetFlowSemantics.d.ts +6 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +45 -2
- package/dist/components/charts/shared/auditAccessibilityStyles.d.ts +9 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +2 -4
- package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
- package/dist/components/charts/shared/gradient.d.ts +35 -0
- package/dist/components/charts/shared/hatchFill.d.ts +3 -10
- package/dist/components/charts/shared/hooks.d.ts +2 -50
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
- package/dist/components/charts/shared/useChartLegend.d.ts +65 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +12 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.d.ts +25 -42
- package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
- package/dist/components/charts/xy/BumpChart.d.ts +161 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
- package/dist/components/charts/xy/Heatmap.d.ts +3 -0
- package/dist/components/charts/xy/LineChart.d.ts +6 -8
- package/dist/components/data/portability/capabilityBinding.d.ts +41 -0
- package/dist/components/data/portability/index.d.ts +2 -0
- package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
- package/dist/components/legendLayout.d.ts +75 -1
- package/dist/components/recipes/geographicDotGrid.d.ts +82 -0
- package/dist/components/recipes/geographicGrid.d.ts +100 -0
- package/dist/components/recipes/physics.d.ts +2 -0
- package/dist/components/recipes/physicsStageGeography.d.ts +137 -0
- package/dist/components/semiotic-ai.d.ts +6 -4
- package/dist/components/semiotic-experimental-vacp.d.ts +11 -0
- package/dist/components/semiotic-experimental.d.ts +6 -3
- package/dist/components/semiotic-geo.d.ts +5 -0
- package/dist/components/semiotic-network.d.ts +1 -0
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-physics.d.ts +10 -6
- package/dist/components/semiotic-realtime-core.d.ts +1 -0
- package/dist/components/semiotic-recipes-core.d.ts +6 -1
- package/dist/components/semiotic-server-edge.d.ts +1 -1
- package/dist/components/semiotic-server.d.ts +1 -1
- package/dist/components/semiotic-xy.d.ts +4 -0
- package/dist/components/semiotic.d.ts +4 -4
- package/dist/components/server/renderEvidence.d.ts +1 -1
- package/dist/components/server/renderToStaticSVG.d.ts +2 -1
- package/dist/components/server/serverChartConfigHeatmap.d.ts +6 -0
- package/dist/components/server/serverChartConfigNetworkStyles.d.ts +12 -0
- package/dist/components/server/serverChartConfigShared.d.ts +16 -0
- package/dist/components/server/serverChartConfigs.d.ts +3 -2
- package/dist/components/server/serverChartConfigsPhysics.d.ts +2 -2
- package/dist/components/server/serverChartConfigsXY.d.ts +1 -1
- package/dist/components/server/staticLegend.d.ts +10 -2
- package/dist/components/server/staticSVGChrome.d.ts +14 -6
- package/dist/components/server/staticValue.d.ts +8 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +4 -10
- package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
- package/dist/components/stream/SVGOverlay.d.ts +2 -6
- package/dist/components/stream/StalenessBadge.d.ts +2 -6
- package/dist/components/stream/geoPipelineConfig.d.ts +10 -0
- package/dist/components/stream/geoTypes.d.ts +3 -6
- package/dist/components/stream/legendRenderer.d.ts +10 -6
- package/dist/components/stream/ordinalTypes.d.ts +7 -31
- package/dist/components/stream/physics/PhysicsEvidence.d.ts +37 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +9 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +5 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
- package/dist/components/stream/physics/physicsFramePipelineConfig.d.ts +19 -0
- package/dist/components/stream/physics/physicsPipelineSettle.d.ts +52 -0
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +23 -0
- package/dist/components/stream/pipelineConfig.d.ts +7 -15
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
- package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
- package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
- package/dist/components/stream/types.d.ts +34 -56
- package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
- package/dist/components/types/legendTypes.d.ts +31 -6
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +6 -4
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental-vacp.d.ts +11 -0
- package/dist/semiotic-experimental-vacp.min.js +1 -0
- package/dist/semiotic-experimental-vacp.module.min.js +1 -0
- package/dist/semiotic-experimental.d.ts +6 -3
- package/dist/semiotic-experimental.min.js +2 -1
- package/dist/semiotic-experimental.module.min.js +2 -1
- package/dist/semiotic-geo.d.ts +5 -0
- package/dist/semiotic-network.d.ts +1 -0
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-physics.d.ts +10 -6
- package/dist/semiotic-realtime-core.d.ts +1 -0
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +6 -1
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.d.ts +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-server.d.ts +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +4 -0
- package/dist/semiotic.d.ts +4 -4
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +18 -2
- package/spec/README.md +94 -2
- package/spec/bindings/README.md +14 -3
- package/spec/v0.1/examples/annotation-provenance-reviewed-revision.json +27 -0
- package/spec/v0.1/examples/annotation-provenance-watcher-threshold.json +21 -0
- package/spec/v0.1/examples/audience-profile-executive-review.json +24 -0
- package/spec/v0.1/examples/audience-profile-incident-operators.json +42 -0
- package/spec/v0.1/examples/chart-capability-bar-comparison.json +48 -0
- package/spec/v0.1/examples/chart-capability-service-flow.json +54 -0
- package/dist/chunk-chunk-4AANPFOX.module.min.js +0 -2
- package/dist/chunk-chunk-5I3UZV4Q.module.min.js +0 -2
- package/dist/chunk-chunk-5RKXZQ2P.module.min.js +0 -1
- package/dist/chunk-chunk-74CCPVXB.module.min.js +0 -1
- package/dist/chunk-chunk-7ALTGHK6.module.min.js +0 -1
- package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
- package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
- package/dist/chunk-chunk-BANTPINB.module.min.js +0 -2
- package/dist/chunk-chunk-C4YA6TDR.module.min.js +0 -1
- package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
- package/dist/chunk-chunk-CKMD5NV3.module.min.js +0 -2
- package/dist/chunk-chunk-CO5KQMGH.module.min.js +0 -1
- package/dist/chunk-chunk-CWQ5YIHX.module.min.js +0 -2
- package/dist/chunk-chunk-E6TXX6MI.module.min.js +0 -1
- package/dist/chunk-chunk-GMQ5AYTD.module.min.js +0 -1
- package/dist/chunk-chunk-JCG72SGW.module.min.js +0 -2
- package/dist/chunk-chunk-K3DMEW22.module.min.js +0 -1
- package/dist/chunk-chunk-KT2VAZMZ.module.min.js +0 -1
- package/dist/chunk-chunk-L6EA5V3G.module.min.js +0 -2
- package/dist/chunk-chunk-LJPCLYSC.module.min.js +0 -2
- package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
- package/dist/chunk-chunk-N5DDKCCF.module.min.js +0 -1
- package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
- package/dist/chunk-chunk-NLO44TOS.module.min.js +0 -2
- package/dist/chunk-chunk-PZJ2SBLL.module.min.js +0 -2
- package/dist/chunk-chunk-QSQVBIJA.module.min.js +0 -1
- package/dist/chunk-chunk-QUJ6TTLY.module.min.js +0 -1
- package/dist/chunk-chunk-RBIDBUT4.module.min.js +0 -2
- package/dist/chunk-chunk-RCF52Z42.module.min.js +0 -2
- package/dist/chunk-chunk-RFLAG356.module.min.js +0 -1
- package/dist/chunk-chunk-RPU4IZAV.module.min.js +0 -2
- package/dist/chunk-chunk-SKMBCFIL.module.min.js +0 -2
- package/dist/chunk-chunk-TAE7W424.module.min.js +0 -2
- package/dist/chunk-chunk-TUBMTZMU.module.min.js +0 -2
- package/dist/chunk-chunk-UFFEXJQY.module.min.js +0 -1
- package/dist/chunk-chunk-XSCHTS4D.module.min.js +0 -2
- package/dist/chunk-chunk-XXWSHGPL.module.min.js +0 -2
- package/dist/chunk-chunk-ZOAQDIJO.module.min.js +0 -1
- package/dist/chunk-chunk-ZXIXAPRE.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
- package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{lineCanvasRenderer as t,resolveNodeColor as e}from"./chunk-chunk-MX35T6RX.module.min.js";import{coerceDateLikeValue as i,parseDateLikeString as o}from"./chunk-chunk-6V5VQVCT.module.min.js";import{DataSourceAdapter as s,IncrementalExtent as n,barCanvasRenderer as r,buildAreaNode as a,buildEnrichAnnotationData as l,buildHeatcellNode as c,buildLineNode as h,buildPointNode as u,buildRectNode as g,buildStackedAreaNodes as d,buildSymbolNode as f,computeDivergingStackExtent as p,computeStackOffsets as y,normalizeColorGradient as m,normalizeGradient as x,resolveAnnotationAccessor as v,resolveFrameGraphics as b,symbolCanvasRenderer as k,ticksForMode as w,toIdSet as A}from"./chunk-chunk-2YAZHXL4.module.min.js";import{RingBuffer as C,applyPulse as _,buildAggregateRibbons as M,buildPerSeriesRibbons as S,compactTimestampBufferForRemoval as P,createTimestampBufferForData as Y,enrichDatumWithBand as R,ensureRingBufferCapacity as T,hasActivePulses as N,partitionRibbons as W,pointCanvasRenderer as O,pushWithTimestamp as E,refreshIdlePulse as D,useLegendCategoryEmission as L,useSemanticFrameInteractions as B,useXYKeyboardNavigation as z}from"./chunk-chunk-ONMLEXHR.module.min.js";import{accessorsEquivalent as F,resolveAccessor as I,resolveRawAccessor as X,resolveStringAccessor as $}from"./chunk-chunk-NJETWX42.module.min.js";import{needsInteractionCanvasPaint as V,paintCanvasBackground as G,resolveCanvasBackground as H}from"./chunk-chunk-OI7R7EJB.module.min.js";import{StalenessBadge as j,applyDecay as q,attachUpdateResultStore as U,buildDatumIndexMap as K,composeOverlays as J,computeDecayOpacity as Z,createCustomLayoutFailureDiagnostic as Q,findHitPointInQuadtree as tt,getHitRadius as et,glyphCanvasRenderer as it,hitTestRect as ot,isTimeLandmark as st,paintSceneWithBackend as nt,renderPathPulse as rt,renderRectPulse as at,renderSceneWithBackend as lt,resolveStaleness as ct,useConfigSync as ht,useLayoutSelectionSync as ut,useStableShallow as gt,useStalenessCheck as dt,warnCustomLayoutDiagnostics as ft}from"./chunk-chunk-NH4MEAKP.module.min.js";import{wrapWithCustomLayoutSelection as pt}from"./chunk-chunk-5UKL5W76.module.min.js";import{filterAnnotationsByStatus as yt}from"./chunk-chunk-BNGBEY7N.module.min.js";import{AccessibleDataTable as mt,AriaLiveTooltip as xt,CanvasFrameBackground as vt,FlippingTooltip as bt,FocusRing as kt,SEQUENTIAL_INTERPOLATORS as wt,STREAMING_PALETTE as At,SYMBOL_SEQUENCE as Ct,SceneRevisionDiagnosticsObserver as _t,ScreenReaderSummary as Mt,SkipToTableLink as St,TITLE_BASELINE as Pt,UpdateResultTracker as Yt,annotationLayout as Rt,buildColorStopGradient as Tt,buildHoverData as Nt,buildLinearFillGradient as Wt,buildThresholdLineSegments as Ot,computeCanvasAriaLabel as Et,computeEasing as Dt,computeRawProgress as Lt,createDefaultAnnotationRules as Bt,defaultTooltipStyle as zt,filterSparseArray as Ft,getCSSColorCacheVersion as It,getDevicePixelRatio as Xt,getPointerHitRadius as $t,getSequentialInterpolator as Vt,isAnnotationActivationTarget as Gt,isServerEnvironment as Ht,lerp as jt,now as qt,observationInputType as Ut,prepareCanvas as Kt,renderAnnotationPass as Jt,renderLegendFromConfig as Zt,resolveCSSColor as Qt,resolveCanvasFill as te,resolveCurveFactory as ee,resolveLegendSideGutter as ie,smartTooltipEntries as oe,symbolRadius as se,unlockCrosshair as ne,useAnnotationActivationOptions as re,useCrosshairPosition as ae,useFrame as le,useFrameCanvasHost as ce,useSceneRevisionDiagnostics as he,xySceneNodeToSVG as ue}from"./chunk-chunk-7ZDJSYKI.module.min.js";import{getMax as ge}from"./chunk-chunk-JJ2OOIET.module.min.js";import{resolveThemeSemanticColors as de}from"./chunk-chunk-WCX6U47H.module.min.js";import{glyphHitGeometry as fe}from"./chunk-chunk-KTWEBFMX.module.min.js";import{useHydration as pe,useWasHydratingFromSSR as ye}from"./chunk-chunk-ACLDBMRH.module.min.js";import*as me from"react";import{useRef as xe,useState as ve,useEffect as be,useMemo as ke,useCallback as we,useImperativeHandle as Ae,useId as Ce,forwardRef as _e,memo as Me}from"react";import*as Se from"react";import{jsx as Pe}from"react/jsx-runtime";var Ye=null,Re=null;function Te(t){const[e,i]=Se.useState(()=>Ye);return Se.useEffect(()=>{if(e)return;let t=!1;return(Ye?Promise.resolve(Ye):(Re||(Re=import("./chunk-XYBrushOverlay-EP2SV3UI.module.min.js").then(t=>Ye=t.XYBrushOverlay).catch(t=>{throw Re=null,t})),Re)).then(e=>{t||i(()=>e)}),()=>{t=!0}},[e]),e?Pe(e,{...t}):null}function Ne(t,e,i){if(e._transitionKey)return e._transitionKey;switch(e.type){case"point":if(e.pointId)return"p:"+e.pointId;if("streaming"===t.runtimeMode&&e.datum){const i=t.getX(e.datum),o=t.getY(e.datum);if(t.getCategory)return`p:${t.getCategory(e.datum)}:${i}:${o}`;if(null!=i&&null!=o)return`p:${i}:${o}`}return"p:"+i;case"glyph":return e.pointId?"g:"+e.pointId:"g:"+i;case"rect":return`r:${e.group||""}:${e.datum?.binStart??e.datum?.category??i}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+i:"c:"+t.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}function We(t,e,i,o){if(!t.config.pointStyle)return;const s=o??t.getY;for(const o of e){const e=t.resolveGroupColor(o.key);for(const n of o.data){let o=t.config.pointStyle(n);!o.fill&&e&&(o={...o,fill:e});const r=o.r??3,a=t.getPointId?t.getPointId(n)+"":void 0,l=u(n,t.scales,t.getX,s,r,o,a);l&&i.push(l)}}}function Oe(t){return"threshold"===t.type&&"string"==typeof t.color&&"number"==typeof t.value}function Ee(t){return x(t)}var De=new Map;function Le(t,e,i){const o=i.config.areaStyle?.(e);return o&&(t.style=o),t}function Be(t,e,i,o,s){const n=new Map;for(const r of t){const t=e(r),a=i(r);if(null==t||null==a||Number.isNaN(t)||Number.isNaN(a))continue;const l=Math.floor(t/o)*o;let c=n.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},n.set(l,c)),c.total+=a,s){const t=s(r);c.categories.set(t,(c.categories.get(t)||0)+a)}}return n}function ze(t,e){const i="function"==typeof t?t:i=>i[t||e];return t=>{const e=i(t);return null==e?NaN:+e}}function Fe(t){const e=[],i=["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode,o=ze(i&&t.valueAccessor||t.yAccessor,i?"value":"y");if(t.boundsAccessor){const i=I(t.boundsAccessor,"bounds");e.push({kind:"bounds",getTop:t=>{const e=o(t);if(!Number.isFinite(e))return NaN;const s=i(t);return Number.isFinite(s)&&0!==s?e+s:e},getBottom:t=>{const e=o(t);if(!Number.isFinite(e))return NaN;const s=i(t);return Number.isFinite(s)&&0!==s?e-s:e},style:t.boundsStyle,perSeries:!0,interactive:!1})}if(t.band){const i=Array.isArray(t.band)?t.band:[t.band];for(const t of i)e.push({kind:"band",getTop:ze(t.y1Accessor,"y1"),getBottom:ze(t.y0Accessor,"y0"),style:t.style,perSeries:!1!==t.perSeries,interactive:!0===t.interactive})}return e}import{scaleLinear as Ie,scaleLog as Xe,scaleSymlog as $e,scaleTime as Ve}from"d3-scale";function Ge(t,e){return e?[e[0]??t[0],e[1]??t[1]]:t}function He(t,e,i){if("log"===t){const t=[Math.max(e[0],1e-6),Math.max(e[1],1e-6)];return Xe().domain(t).range(i).clamp(!0)}return"symlog"===t?$e().domain(e).range(i):"time"===t?Ve().domain([new Date(e[0]),new Date(e[1])]).range(i):Ie().domain(e).range(i)}var je=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],qe=["scene-style","data-paint","accessibility","evidence"],Ue=(t,e)=>({retainedData:t,invalidations:e}),Ke=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Je=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ze=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Qe=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ti=["scene-geometry","data-paint","accessibility","evidence"],ei=["scene-style","data-paint","accessibility","evidence"],ii=[],oi={chartType:Ue("rebuild",Ke),runtimeMode:Ue("rebuild",Ke),xAccessor:Ue("rebuild",Ke),yAccessor:Ue("rebuild",Ke),timeAccessor:Ue("rebuild",Ke),valueAccessor:Ue("rebuild",Ke),y0Accessor:Ue("rebuild",Ke),boundsAccessor:Ue("rebuild",Ke),band:Ue("rebuild",Ke),openAccessor:Ue("rebuild",Ke),highAccessor:Ue("rebuild",Ke),lowAccessor:Ue("rebuild",Ke),closeAccessor:Ue("rebuild",Ke),candlestickRangeMode:Ue("rebuild",Ke),accessorRevision:Ue("rebuild",Ke),groupAccessor:Ue("rebuild",Je),categoryAccessor:Ue("rebuild",Je),lineDataAccessor:Ue("rebuild",Je),colorAccessor:Ue("rebuild",ei),sizeAccessor:Ue("rebuild",ti),symbolAccessor:Ue("rebuild",ti),pointIdAccessor:Ue("rebuild",ti),xScaleType:Ue("preserve",Ze),yScaleType:Ue("preserve",Ze),xExtent:Ue("preserve",Ze),yExtent:Ue("preserve",Ze),extentPadding:Ue("preserve",Ze),scalePadding:Ue("preserve",Ze),axisExtent:Ue("preserve",Ze),binSize:Ue("preserve",Ze),normalize:Ue("preserve",Ze),heatmapAggregation:Ue("preserve",Ze),heatmapXBins:Ue("preserve",Ze),heatmapYBins:Ue("preserve",Ze),arrowOfTime:Ue("preserve",Qe),baseline:Ue("preserve",Qe),stackOrder:Ue("preserve",Qe),sizeRange:Ue("preserve",Qe),curve:Ue("preserve",Qe),areaGroups:Ue("preserve",Qe),customLayout:Ue("preserve",Qe),layoutConfig:Ue("preserve",Qe),layoutMargin:Ue("preserve",Qe),symbolMap:Ue("preserve",ti),showValues:Ue("preserve",ti),heatmapValueFormat:Ue("preserve",ti),lineStyle:Ue("preserve",ei),pointStyle:Ue("preserve",ei),areaStyle:Ue("preserve",ei),barStyle:Ue("preserve",ei),swarmStyle:Ue("preserve",ei),waterfallStyle:Ue("preserve",ei),candlestickStyle:Ue("preserve",ei),boundsStyle:Ue("preserve",ei),gradientFill:Ue("preserve",ei),lineGradient:Ue("preserve",ei),semanticLineStops:Ue("preserve",ei),colorScheme:Ue("preserve",ei),themeCategorical:Ue("preserve",ei),themeSemantic:Ue("preserve",ei),themeSequential:Ue("preserve",ei),themeDiverging:Ue("preserve",ei),barColors:Ue("preserve",ei),decay:Ue("preserve",ei),pulse:Ue("preserve",ei),staleness:Ue("preserve",ei),layoutSelection:Ue("preserve",ei),annotations:Ue("preserve",["overlay","accessibility","evidence"]),windowSize:Ue("preserve",ii),windowMode:Ue("preserve",ii),maxCapacity:Ue("preserve",ii),clock:Ue("preserve",ii),transition:Ue("preserve",ii),introAnimation:Ue("preserve",ii),onLayoutError:Ue("preserve",ii)},si=Ue("preserve",Qe),ni=class{constructor(){this.tracker=new Yt}get last(){return this.tracker.last}subscribe(t){return this.tracker.subscribe(t)}recordData(t,e){return this.tracker.record({kind:t,...void 0===e?{}:{count:e}},je)}recordNoop(t){return this.tracker.record({kind:t,..."restyle"===t?{}:{count:0}},[])}recordRestyle(t){return t?this.tracker.record({kind:"restyle"},qe):this.recordNoop("restyle")}recordConfig(t){const e=function(t){let e="preserve";const i=new Set;for(const o of t){const t=oi[o]??si;"rebuild"===t.retainedData&&(e="rebuild");for(const e of t.invalidations)i.add(e)}return{retainedData:e,invalidations:i}}(t);return this.tracker.record({kind:"config",keys:t},e.invalidations)}};import{quadtree as ri}from"d3-quadtree";var ai=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(t,e){if("scatter"!==t&&"bubble"!==t&&"custom"!==t)return void this.clear();let i=0,o=0;for(const t of e)"point"===t.type&&(i++,t.r>o&&(o=t.r));if(this.maxRadius=o,500>=i)return void(this.tree=null);const s=Array(i);let n=0;for(const t of e)"point"===t.type&&(s[n++]=t);this.tree=ri().x(t=>t.x).y(t=>t.y).addAll(s)}},li=class t{constructor(t){if(this.xExtent=new n,this.yExtent=new n,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new ni,this.scales=null,this.scene=[],this.version=0,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.xIsDate=!1,this.spatialIndex=new ai,this._lastBoundedInsertsRef=null,this.applyPulse=(t,e,i)=>!(!this.config.pulse||!this.timestampBuffer)&&_(this.config.pulse,t,e,this.timestampBuffer,this.getDatumIndexMap(e),i),this.config=t,this.buffer=new C(t.windowSize),this.growingCap=t.windowSize,["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode?(this.getX=I(t.timeAccessor||t.xAccessor,"time"),this.getY=I(t.valueAccessor||t.yAccessor,"value")):(this.getX=I(t.xAccessor,"x"),this.getY=I(t.yAccessor,"y")),this.getGroup=$(t.groupAccessor),this.getCategory=$(t.categoryAccessor),this.getSize=t.sizeAccessor?I(t.sizeAccessor,"size"):void 0,this.getColor=$(t.colorAccessor),this.getSymbol=$(t.symbolAccessor),this.getY0=t.y0Accessor?I(t.y0Accessor,"y0"):void 0,this.resolvedRibbons=Fe(t),this.getPointId=$(t.pointIdAccessor),"candlestick"===t.chartType){const e=null!=t.openAccessor,i=null!=t.closeAccessor;this.getOpen=e?I(t.openAccessor,"open"):void 0,this.getHigh=I(t.highAccessor,"high"),this.getLow=I(t.lowAccessor,"low"),this.getClose=i?I(t.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!i}t.pulse&&(this.timestampBuffer=new C(t.windowSize))}currentTime(){return this.config.clock?.()??qt()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=Y(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(t){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(t)),void this.yExtent.push(this.getLow(t));this.yExtent.push(this.getY(t)),this.getY0&&this.yExtent.push(this.getY0(t));for(const e of this.resolvedRibbons){const i=e.getTop(t),o=e.getBottom(t);Number.isFinite(i)&&this.yExtent.push(i),Number.isFinite(o)&&this.yExtent.push(o)}}evictDatumYExtent(t){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(t)),void this.yExtent.evict(this.getLow(t));this.yExtent.evict(this.getY(t)),this.getY0&&this.yExtent.evict(this.getY0(t));for(const e of this.resolvedRibbons){const i=e.getTop(t),o=e.getBottom(t);Number.isFinite(i)&&this.yExtent.evict(i),Number.isFinite(o)&&this.yExtent.evict(o)}}rebuildYExtent(){this.yExtent.clear();for(const t of this.buffer)this.pushDatumYExtent(t)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const t of this.buffer)this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t)}ingest(t){if(t.bounded&&this._lastBoundedInsertsRef===t.inserts)return this.updateResults.recordNoop("replace"),!1;const e=this.currentTime();if(this.lastIngestTime=e,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,t.bounded){this._lastBoundedInsertsRef=t.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const s=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=s?I(this.config.timeAccessor||this.config.xAccessor,"time"):I(this.config.xAccessor,"x"),this.xIsDate=!1,t.inserts.length>0){const e=t.inserts[0],s=this.config.xAccessor,n="function"==typeof s?s(e):e[s||"x"],r=n instanceof Date,a="string"==typeof n&&Number.isFinite(o(n));if(this.xIsDate=r||a,a){const t="string"==typeof s?s:void 0;this.getX=t?e=>i(e[t]):t=>i(s(t))}}T(this.buffer,t.totalSize||t.inserts.length,this.timestampBuffer);for(const i of t.inserts)E(this.buffer,i,this.timestampBuffer,e),this.xExtent.push(this.getX(i)),this.pushDatumYExtent(i)}else for(const i of t.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const t=this.config.maxCapacity??1e5;t>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,t),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${t}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const t=E(this.buffer,i,this.timestampBuffer,e);this.xExtent.push(this.getX(i)),this.pushDatumYExtent(i),null!=t&&(this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t))}return this.updateResults.recordData(t.bounded?"replace":"ingest",t.inserts.length),!0}ingestWithResult(t){return this.ingest(t),this.updateResults.last}computeScene(t){const{config:e,buffer:i}=this,o=this.scales,s=this.lastLayout;if(!this.needsFullRebuild&&!e.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==t.width||this.lastLayout.height!==t.height))return void this.remapScene(t);this.xExtent.dirty&&this.xExtent.recalculate(i,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const n=this.getBufferArray(),r=this.yExtent.extent;let a=Ge(this.xExtent.extent,e.xExtent),l=Ge(r,e.yExtent);const c=!(!(h=e.yExtent)||null==h[0]||null==h[1]);var h;const u="exact"===e.axisExtent;if("stackedarea"===e.chartType&&!c&&i.size>0){const t=function(t){const{config:e,groups:i,getX:o,getY:s}=t,n="exact"===e.axisExtent;if(e.normalize){const i=[0,n?1:1+e.extentPadding];return{yDomain:i,stackExtentCache:{key:`${t.bufferSize}:${t.ingestVersion}:norm`,yDomain:i}}}const r=`${t.bufferSize}:${t.ingestVersion}:${e.baseline??"zero"}:${e.stackOrder??"key"}`;if(t.stackExtentCache&&t.stackExtentCache.key===r)return{yDomain:t.stackExtentCache.yDomain,stackExtentCache:t.stackExtentCache};const a=new Map,l=new Set;let c=0;const h=new Map,u=new Map;for(const t of i){const e=new Map;let i=0;for(const n of t.data){const t=o(n),r=s(n);if(!Number.isFinite(t)||!Number.isFinite(r))continue;e.set(t,(e.get(t)||0)+r),l.add(t),i+=r;const a=(h.get(t)||0)+r;h.set(t,a),a>c&&(c=a)}a.set(t.key,e),u.set(t.key,i)}const g=e.stackOrder??"key",d=(t,e)=>e>t?-1:t>e?1:0;let f,m;if("input"===g)f=i.map(t=>t.key);else if("insideOut"===g){const t=[...i].map(t=>t.key).sort((t,e)=>{const i=(u.get(e)??0)-(u.get(t)??0);return 0!==i?i:d(t,e)}),e=[],o=[];let s=0,n=0;for(const i of t)n>s?(e.push(i),s+=u.get(i)??0):(o.push(i),n+=u.get(i)??0);f=[...o.reverse(),...e]}else f="asc"===g?i.map(t=>t.key).sort((t,e)=>{const i=(u.get(t)??0)-(u.get(e)??0);return 0!==i?i:d(t,e)}):"desc"===g?i.map(t=>t.key).sort((t,e)=>{const i=(u.get(e)??0)-(u.get(t)??0);return 0!==i?i:d(t,e)}):i.map(t=>t.key).sort(d);if("wiggle"===e.baseline||"silhouette"===e.baseline){const t=Array.from(l).sort((t,e)=>t-e),i=y(t,f,(t,e)=>a.get(t)?.get(e)||0,e.baseline);let o=1/0,s=-1/0;for(const e of t){const t=i.get(e)??0,n=h.get(e)??0;o>t&&(o=t),t+n>s&&(s=t+n)}Number.isFinite(o)&&Number.isFinite(s)||(o=0,s=0);const r=s-o,c=n?0:r>0?r*e.extentPadding:1;m=[o-c,s+c]}else if("diverging"===e.baseline){const t=Array.from(l).sort((t,e)=>t-e),[i,o]=p(t,f,(t,e)=>a.get(t)?.get(e)||0),s=o-i,r=n?0:s>0?s*e.extentPadding:1;m=[i-r,o+r]}else m=[0,c+(n?0:c>0?c*e.extentPadding:1)];return{yDomain:m,stackExtentCache:{key:r,yDomain:m}}}({config:e,groups:this.groupData(n),getX:this.getX,getY:this.getY,bufferSize:i.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=t.yDomain,this._stackExtentCache=t.stackExtentCache}else"bar"===e.chartType&&e.binSize&&!c&&i.size>0?l=function(t,e,i,o,s,n,r){const[,a]=function(t,e,i,o,s){const n=Be(t,e,i,o,s);if(0===n.size)return[0,0];let r=0;for(const t of n.values())t.total>r&&(r=t.total);return[0,r]}(t,e,i,o,s);return[0,r?a:a+a*n]}(i,this.getX,this.getY,e.binSize,this.getCategory,e.extentPadding,u):"waterfall"===e.chartType&&!c&&i.size>0?l=function(t,e,i,o){const[s,n]=function(t,e){let i=0,o=0,s=0;for(const n of t){const t=e(n);null==t||Number.isNaN(t)||(s+=t,i>s&&(i=s),s>o&&(o=s))}return[i,o]}(t,e),r=n-s,a=o?0:r>0?r*i:1;return[Math.min(0,s-Math.abs(a)),Math.max(0,n+Math.abs(a))]}(i,this.getY,e.extentPadding,u):c||l[0]===1/0||(l=function(t,e,i){if(!i.length)return t;let[o,s]=t;for(const t of e)for(const e of i){const i=e.getTop(t),n=e.getBottom(t);Number.isFinite(i)&&(o>i&&(o=i),i>s&&(s=i)),Number.isFinite(n)&&(o>n&&(o=n),n>s&&(s=n))}return[o,s]}(l,n,this.resolvedRibbons),l=function(t,e){const i=t[1]-t[0],o=e.exactMode?0:i>0?i*e.extentPadding:1,s=[null!=e.userMin?t[0]:t[0]-o,null!=e.userMax?t[1]:t[1]+o];return"log"!==e.yScaleType||s[0]>0||0>=e.dataYDomain[0]||e.exactMode||null==e.userMin&&(s[0]=e.dataYDomain[0]/(1+e.extentPadding)),s}(l,{exactMode:u,extentPadding:e.extentPadding,userMin:e.yExtent?.[0],userMax:e.yExtent?.[1],yScaleType:e.yScaleType,dataYDomain:r}));l=function(t,e,i){if(!e||i)return t;const o=e[0],s=e[1];return null==o&&null==s?t:[null!=o?o:t[0],null!=s?s:t[1]]}(l,e.yExtent,!!c),({xDomain:a,yDomain:l}=function(t,e,i){let o=t,s=e;if(o[0]===1/0||o[1]===-1/0)if("time"===i){const t=Date.now();o=[t-864e5,t]}else o=[0,1];return s[0]!==1/0&&s[1]!==-1/0||(s=[0,1]),{xDomain:o,yDomain:s}}(a,l,e.xScaleType)),this.scales=function(t){const{config:e,layout:i,xDomain:o,yDomain:s}=t,n="streaming"===e.runtimeMode,r=Math.max(0,Math.min(e.scalePadding||0,Math.min(i.width,i.height)/2-1));if(n){if("x"==("up"===(a=e.arrowOfTime)||"down"===a?"y":"x")){const t="right"===e.arrowOfTime?[r,i.width-r]:[i.width-r,r];return{x:Ie().domain(o).range(t),y:He(e.yScaleType,s,[i.height-r,r])}}const t="down"===e.arrowOfTime?[r,i.height-r]:[i.height-r,r];return{x:He(e.yScaleType,s,[r,i.width-r]),y:Ie().domain(o).range(t)}}var a;return{x:He(e.xScaleType,o,[r,i.width-r]),y:He(e.yScaleType,s,[i.height-r,r])}}({config:e,layout:t,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const g=this.buildSceneNodes(t,n);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.lastLayout=s):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=g,this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n,this.currentTime()),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.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:t.width,height:t.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(t){const e=t.width/this.lastLayout.width,i=t.height/this.lastLayout.height;for(const t of this.scene)switch(t.type){case"line":for(const o of t.path)o[0]*=e,o[1]*=i;break;case"area":for(const o of t.topPath)o[0]*=e,o[1]*=i;for(const o of t.bottomPath)o[0]*=e,o[1]*=i;t.clipRect&&(t.clipRect={x:t.clipRect.x*e,y:t.clipRect.y*i,width:t.clipRect.width*e,height:t.clipRect.height*i}),t.strokeColorBands&&(t.strokeColorBands=t.strokeColorBands.map(t=>({...t,y:t.y*i,height:t.height*i})));break;case"point":case"glyph":t.x*=e,t.y*=i;break;case"rect":case"heatcell":t.x*=e,t.y*=i,t.w*=e,t.h*=i;break;case"candlestick":t.x*=e,t.openY*=i,t.closeY*=i,t.highY*=i,t.lowY*=i}const o=this.scales.x.domain(),s=this.scales.y.domain(),n=this.scales.x.range(),r=this.scales.y.range(),a=He,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(t.width,t.height)/2-1)),c=r[1]>r[0];this.scales={x:a(this.config.xScaleType,o,n[0]>n[1]?[t.width-l,l]:[l,t.width-l]),y:a(this.config.yScaleType,s,c?[l,t.height-l]:[t.height-l,l])},this.lastLayout={width:t.width,height:t.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(t,e){const{config:i,scales:o}=this;if(!o)return[];if(i.customLayout){const s={data:e,scales:o,dimensions:{width:t.width,height:t.height,margin:i.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:i.themeSemantic??{},categorical:i.themeCategorical??At},resolveColor:(t,e)=>{const o=this.resolveGroupColor(t);if(o)return o;const s=this.resolveLineStyle(t,e);return s.stroke?s.stroke:"string"==typeof s.fill?s.fill:i.themeSemantic?.primary??"#4e79a7"},config:i.layoutConfig??{},selection:i.layoutSelection??null};let n;try{n=i.customLayout(s)}catch(t){const e=null!==this.lastCustomLayoutResult,o=Q("xy",t,e,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",t);try{i.onLayoutError?.(o)}catch(t){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",t)}return e?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=n.overlays??null,this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null;const r=n.nodes??[];if(this._customRestyle=n.restyle,this.hasCustomRestyle=!!n.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const t of r)t.style&&this._baseStyles.set(t,t.style);this.applyCustomRestyle(r,i.layoutSelection??null)}return ft({label:"customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===e.length)return[];const s={scales:o,config:i,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(t,e)=>this.resolveLineStyle(t,e),resolveAreaStyle:(t,e)=>this.resolveAreaStyle(t,e),resolveBoundsStyle:(t,e)=>this.resolveBoundsStyle(t,e),resolveColorMap:t=>this.resolveColorMap(t),resolveGroupColor:t=>this.resolveGroupColor(t),groupData:t=>this.groupData(t),barCategoryCache:this._barCategoryCache};switch(i.chartType){case"line":return function(t,e){const i=t.groupData(e),o=[],s=t.config.annotations?.filter(Oe).map(t=>({value:t.value,color:t.color,thresholdType:t.thresholdType||"greater"}));if(t.ribbons&&t.ribbons.length>0){const{perSeries:s,aggregate:n}=W(t.ribbons);if(n.length>0&&o.push(...M(t,e,n)),s.length>0)for(const e of i)o.push(...S(t,e.data,e.key,s))}for(const e of i){const i=t.resolveLineStyle(e.key,e.data[0]),n=h(e.data,t.scales,t.getX,t.getY,i,e.key);s&&s.length>0&&(n.colorThresholds=s),t.config.curve&&"linear"!==t.config.curve&&(n.curve=t.config.curve),t.config.lineGradient&&(n.strokeGradient=t.config.lineGradient),o.push(n)}return We(t,i,o),o}(s,e);case"area":return function(t,e){const i=t.groupData(e),o=[];if(t.ribbons&&t.ribbons.length>0){const{perSeries:s,aggregate:n}=W(t.ribbons);if(n.length>0&&o.push(...M(t,e,n)),s.length>0)for(const e of i)o.push(...S(t,e.data,e.key,s))}const s=t.scales.y.domain(),n=s[0],r=t.config.semanticLineStops?.filter(t=>Number.isFinite(t.offset)).map(t=>({value:s[0]+Math.max(0,Math.min(1,t.offset))*(s[1]-s[0]),color:t.color,thresholdType:"greater"})).sort((t,e)=>t.value-e.value),l=r&&r.length>0?(()=>{const e=r.reduce((t,e)=>(t.at(-1)?.value===e.value?t[t.length-1]=e:t.push(e),t),[]),i=[{from:s[0],to:e[0].value}];for(let t=0;e.length>t;t++)i.push({from:e[t].value,to:e[t+1]?.value??s[1],color:e[t].color});return i.map(({from:e,to:i,color:o})=>{const s=t.scales.y(e),n=t.scales.y(i);return{y:Math.min(s,n),height:Math.abs(n-s),color:o}}).filter(t=>t.height>0)})():void 0,c=t.getY0?e=>{const i=t.getY0(e);return null==i?n:i}:void 0;for(const e of i){const i=t.resolveAreaStyle(e.key,e.data[0]),s=a(e.data,t.scales,t.getX,t.getY,n,i,e.key,c),h=Ee(t.config.gradientFill);h&&(s.fillGradient=h),t.config.curve&&"linear"!==t.config.curve&&(s.curve=t.config.curve),t.config.lineGradient&&(s.strokeGradient=t.config.lineGradient),r&&r.length>0&&(s.colorThresholds=r,s.strokeColorBands=l),o.push(s)}return We(t,i,o),o}(s,e);case"mixed":return function(t,e){const i=t.groupData(e),o=[],s=t.config.areaGroups||new Set;if(t.ribbons&&t.ribbons.length>0){const{perSeries:s,aggregate:n}=W(t.ribbons);if(n.length>0&&o.push(...M(t,e,n)),s.length>0)for(const e of i)o.push(...S(t,e.data,e.key,s))}const n=t.scales.y.domain()[0],r=t.getY0?e=>{const i=t.getY0(e);return null==i?n:i}:void 0;for(const e of i)if(s.has(e.key)){const i=t.resolveAreaStyle(e.key,e.data[0]),s=a(e.data,t.scales,t.getX,t.getY,n,i,e.key,r),l=Ee(t.config.gradientFill);l&&(s.fillGradient=l),t.config.curve&&"linear"!==t.config.curve&&(s.curve=t.config.curve),t.config.lineGradient&&(s.strokeGradient=t.config.lineGradient),o.push(s)}else{const i=t.resolveLineStyle(e.key,e.data[0]),s=h(e.data,t.scales,t.getX,t.getY,i,e.key);t.config.curve&&"linear"!==t.config.curve&&(s.curve=t.config.curve),t.config.lineGradient&&(s.strokeGradient=t.config.lineGradient),o.push(s)}return We(t,i,o),o}(s,e);case"stackedarea":return function(t,e){const i=t.groupData(e),o=t.config.stackOrder??"key",s=()=>i.sort((t,e)=>e.key>t.key?-1:t.key>e.key?1:0);if("input"===o);else if("key"===o)s();else if("asc"===o||"desc"===o||"insideOut"===o){const e=new Map;for(const o of i){let i=0;for(const e of o.data){const o=t.getX(e),s=t.getY(e);Number.isFinite(o)&&Number.isFinite(s)&&(i+=s)}e.set(o.key,i)}const s=(t,e)=>e>t?-1:t>e?1:0;if("asc"===o)i.sort((t,i)=>{const o=(e.get(t.key)??0)-(e.get(i.key)??0);return 0!==o?o:s(t.key,i.key)});else if("desc"===o)i.sort((t,i)=>{const o=(e.get(i.key)??0)-(e.get(t.key)??0);return 0!==o?o:s(t.key,i.key)});else{const t=[...i].sort((t,i)=>{const o=(e.get(i.key)??0)-(e.get(t.key)??0);return 0!==o?o:s(t.key,i.key)}),o=[],n=[];let r=0,a=0;for(const i of t)a>r?(o.push(i),r+=e.get(i.key)??0):(n.push(i),a+=e.get(i.key)??0);i.length=0,i.push(...n.reverse(),...o)}}else s();const n=t.config.curve&&"linear"!==t.config.curve?t.config.curve:void 0,r=t.config.normalize?"zero":t.config.baseline??"zero",{nodes:a,stackedTops:l}=d(i,t.scales,t.getX,t.getY,(e,i)=>t.resolveAreaStyle(e,i),t.config.normalize,n,r),c=a;if(t.config.pointStyle){const e=new WeakMap;for(const o of i){const i=l.get(o.key);if(i)for(const s of o.data){const o=t.getX(s),n=t.getY(s);null==o||Number.isNaN(o)||null==n||Number.isNaN(n)||!i.has(o)||e.set(s,i.get(o))}}const o=i=>e.get(i)??t.getY(i);We(t,i,c,o)}return c}(s,e);case"scatter":case"bubble":return function(t,e){const i=[],o="bubble"===t.config.chartType?10:5,s=t.config.sizeRange||[3,15];let n=null;if(t.getSize&&!t.config.pointStyle){const i=e.map(e=>t.getSize(e)).filter(t=>null!=t&&!Number.isNaN(t));if(i.length>0){let t=1/0,e=-1/0;for(const o of i)t>o&&(t=o),o>e&&(e=o);n=i=>t===e?(s[0]+s[1])/2:s[0]+(i-t)/(e-t)*(s[1]-s[0])}}const r=t.getColor?t.resolveColorMap(e):null,a=t.config.themeSemantic?.primary||"#4e79a7",l=t.getSymbol,c=t.config.symbolMap,h=new Map;let g=0;const d=t=>{const e=c?.[t];if(e)return e;let i=h.get(t);return i||(i=Ct[g%Ct.length],g++,h.set(t,i)),i};for(const s of e){let e=t.config.pointStyle?t.config.pointStyle(s):{fill:a,opacity:.8},c=e.r||o;if(n&&t.getSize){const e=t.getSize(s);null==e||Number.isNaN(e)||(c=n(e))}if(r&&t.getColor&&!e.fill){const i=t.getColor(s);i&&r.has(i)&&(e={...e,fill:r.get(i)})}const h=t.getPointId?t.getPointId(s)+"":void 0;if(l){const o=d(l(s)+""),n=f(s,t.scales,t.getX,t.getY,Math.PI*c*c,o,e,h);n&&i.push(n)}else{const o=u(s,t.scales,t.getX,t.getY,c,e,h);o&&i.push(o)}}return i}(s,e);case"heatmap":return function(t,e,i){if(t.config.heatmapAggregation)return function(t,e,i){const o=Math.max(1,Math.floor(t.config.heatmapXBins??20)),s=Math.max(1,Math.floor(t.config.heatmapYBins??20)),n=t.config.heatmapAggregation??"count",r=I(t.config.valueAccessor,"value");if(!t.scales||0===e.length)return[];const[a,l]=t.scales.x.domain(),[h,u]=t.scales.y.domain(),g=(l-a||1)/o,d=(u-h||1)/s,f=o*s;if(f>1e6)return[];const p=new Int32Array(f),y=new Float64Array(f);for(let i=0;e.length>i;i++){const n=e[i],l=t.getX(n),c=t.getY(n);if(!isFinite(l)||!isFinite(c))continue;const u=Math.min(Math.floor((l-a)/g),o-1),f=Math.min(Math.floor((c-h)/d),s-1);if(0>u||0>f)continue;const m=f*o+u;p[m]++;const x=r(n);y[m]+=isFinite(x)?x:0}let m=1/0,x=-1/0;for(let t=0;f>t;t++){if(0===p[t])continue;let e;switch(n){case"sum":e=y[t];break;case"mean":e=y[t]/p[t];break;default:e=p[t]}m>e&&(m=e),e>x&&(x=e)}if(!isFinite(m))return[];const v=x-m||1,b=i.width/o,k=i.height/s,w=t.config.showValues,A=t.config.heatmapValueFormat,C=[];for(let e=0;s>e;e++){const i=e*o;for(let r=0;o>r;r++){const o=i+r;if(0===p[o])continue;let l;switch(n){case"sum":l=y[o];break;case"mean":l=y[o]/p[o];break;default:l=p[o]}const u=(l-m)/v,f={xi:r,yi:e,value:l,count:p[o],sum:y[o],xCenter:a+(r+.5)*g,yCenter:h+(e+.5)*d,agg:n};C.push(Le(c(r*b,(s-1-e)*k,b,k,`rgb(${220-(180*u+.5)|0},${220-(100*u+.5)|0},${255-(50*u+.5)|0})`,f,w?{value:l,showValues:!0,valueFormat:A}:void 0),f,t))}}return C}(t,e,i);if(0===e.length)return[];const o=I(t.config.valueAccessor,"value"),s=X(t.config.xAccessor,"x"),n=X(t.config.yAccessor,"y"),r=new Map,a=new Map,l=Array(e.length),h=Array(e.length);for(let t=0;e.length>t;t++){const i=e[t],o=s(i),c=n(i);l[t]=o,h[t]=c,r.has(o)||r.set(o,r.size),a.has(c)||a.set(c,a.size)}const u=r.size,g=a.size;if(0===u||0===g)return[];const d=Array.from(r.keys()),f=Array.from(a.keys()),p=d.every(t=>"number"==typeof t&&!isNaN(t)),y=f.every(t=>"number"==typeof t&&!isNaN(t));if(p){d.sort((t,e)=>Number(t)-Number(e)),r.clear();for(let t=0;d.length>t;t++)r.set(d[t],t)}if(y){f.sort((t,e)=>Number(t)-Number(e)),a.clear();for(let t=0;f.length>t;t++)a.set(f[t],t)}const m=new Float64Array(e.length),x=new Float64Array(e.length),v=Array(e.length),b=new Map;let k=0;for(let t=0;e.length>t;t++){const i=e[t],s=r.get(l[t]),n=a.get(h[t]);if(void 0===s||void 0===n)continue;const c=o(i),g=n*u+s,d=b.get(g);let f;void 0!==d?f=d:(f=k++,b.set(g,f)),m[f]=g,x[f]=c,v[f]=i}let w=1/0,A=-1/0;for(let t=0;k>t;t++){const e=x[t];isFinite(e)&&(w>e&&(w=e),e>A&&(A=e))}if(!isFinite(w)||!isFinite(A))return[];const C=function(t){const e=t in wt?t:"blues";let i=De.get(e);if(i)return i;i=Array(256);const o=Vt(e);for(let t=0;256>t;t++)i[t]=o(t/255);return De.set(e,i),i}("string"==typeof t.config.colorScheme?t.config.colorScheme:t.config.themeSequential||"blues"),_=255/(A-w||1),M=i.width/u,S=i.height/g,P=t.config.showValues,Y=t.config.heatmapValueFormat,R=[];for(let e=0;k>e;e++){const i=x[e];if(!isFinite(i))continue;const o=m[e],s=o%u,n=v[e];R.push(Le(c(s*M,(g-1-(o-s)/u)*S,M,S,C[Math.min((i-w)*_+.5|0,255)],n,P?{value:i,showValues:!0,valueFormat:Y}:void 0),n,t))}return R}(s,e,t);case"bar":{const t=function(t,e){if(!t.config.binSize)return{nodes:[],binBoundaries:[]};const i=Be(e,t.getX,t.getY,t.config.binSize,t.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let o=null;if(t.getCategory){const e=new Set;for(const t of i.values())for(const i of t.categories.keys())e.add(i);const s=t.config.barColors?Object.keys(t.config.barColors):[],n=new Set(s),r=Array.from(e).filter(t=>!n.has(t)).sort(),a=s.filter(t=>e.has(t)),l=a.join("\0")+""+r.join("\0");t.barCategoryCache&&t.barCategoryCache.key===l?o=t.barCategoryCache.order:(o=[...a,...r],t.barCategoryCache={key:l,order:o})}const s=[],n=t.scales,[r,a]=n.x.domain(),l=t.config.barStyle,c=t.config.themeSemantic?.primary,h=l?.gap,u="number"!=typeof h||0>h?1:h,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const e of i.values()){const i=Math.max(e.start,r),h=Math.min(e.end,a);if(i>=h)continue;const f=n.x(i),p=n.x(h),y=Math.abs(p-f),m=y>u+1?u:0,x=Math.min(f,p)+m/2,v=Math.max(y-m,1);if(v>0)if(o&&e.categories.size>0){let i=0;for(const r of o){const o=e.categories.get(r)||0;if(0===o)continue;const a=n.y(i),h=n.y(i+o);s.push(g(x,Math.min(a,h),v,Math.abs(a-h),{fill:t.config.barColors?.[r]||l?.fill||c||"#4e79a7",...d},{binStart:e.start,binEnd:e.end,total:e.total,category:r,categoryValue:o},r)),i+=o}}else{const t=n.y(0),i=n.y(e.total);s.push(g(x,Math.min(t,i),v,Math.abs(t-i),{fill:l?.fill||c||"#007bff",...d},{binStart:e.start,binEnd:e.end,total:e.total}))}}const f=new Set;for(const t of i.values())f.add(t.start),f.add(t.end);return{nodes:s,binBoundaries:Array.from(f).sort((t,e)=>t-e)}}(s,e);return this._barCategoryCache=s.barCategoryCache??null,this._binBoundaries=t.binBoundaries,t.nodes}case"swarm":return function(t,e){const i=[],o=t.config.swarmStyle||{},s=o.radius??3,n=o.fill??t.config.themeSemantic?.primary??"#007bff",r=o.opacity??.7,a=o.stroke,l=o.strokeWidth;for(const o of e){const e=t.getX(o),c=t.getY(o);if(null==c||Number.isNaN(c))continue;const h=t.scales.x(e),u=t.scales.y(c);let g=n;if(t.getCategory){const e=t.getCategory(o);g=t.config.barColors?.[e]||g}const{r:d,...f}=t.config.pointStyle?.(o)??{},p={type:"point",x:h,y:u,r:d??s,style:{fill:g,opacity:r,stroke:a,strokeWidth:l,...f},datum:o};t.getPointId&&(p.pointId=t.getPointId(o)+""),i.push(p)}return i}(s,e);case"waterfall":return function(t,e,i){const o=[],s=t.scales,n=t.config.waterfallStyle,r=e.filter(e=>{const i=t.getY(e),o=t.getX(e);return null!=i&&!Number.isNaN(i)&&null!=o&&isFinite(o)});if(0===r.length)return o;const a=n?.positiveColor??t.config.themeSemantic?.success??"#28a745",l=n?.negativeColor??t.config.themeSemantic?.danger??"#dc3545",c=n?.gap??1,h=n?.stroke,u=n?.strokeWidth,d=n?.opacity;let f=0;for(let e=0;r.length>e;e++){const p=r[e],y=t.getX(p),m=t.getY(p),x=f+m;let v;v=r.length-1>e?t.getX(r[e+1])-y:e>0?y-t.getX(r[e-1]):0;const b=s.x(y),k=0!==v?s.x(y+v):b+i.width/10,w=Math.min(b,k)+c/2,A=Math.max(b,k)-c/2-w;if(0>=A){f=x;continue}const C=s.y(f),_=s.y(x),M=Math.min(C,_),S=Math.abs(C-_),P={fill:0>m?l:a,stroke:h,strokeWidth:u};null!=d&&(P.opacity=d),o.push(g(w,M,A,S,P,{...p,baseline:f,cumEnd:x,delta:m,_connectorStroke:n?.connectorStroke,_connectorWidth:n?.connectorWidth})),f=x}return o}(s,e,t);case"candlestick":return function(t,e,i){if(!t.getHigh||!t.getLow||!t.scales)return[];const o=t.config.candlestickRangeMode??!1;if(!(o||t.getOpen&&t.getClose))return[];const s=[],n=t.config.candlestickStyle||{},r=n.rangeColor||"#6366f1",a=o?r:n.upColor||"#28a745",l=o?r:n.downColor||"#dc3545",c=o?r:n.wickColor||"#333",h=n.wickWidth||(o?2:1),u=e.map(e=>t.getX(e)).filter(t=>null!=t&&!Number.isNaN(t)).sort((t,e)=>t-e);let g=n.bodyWidth??0;if(null==n.bodyWidth)if(u.length>1){let e=1/0;for(let i=1;u.length>i;i++){const o=Math.abs(t.scales.x(u[i])-t.scales.x(u[i-1]));o>0&&e>o&&(e=o)}g=e!==1/0?Math.max(2,Math.min(.6*e,20)):6}else g=6;for(const n of e){const e=t.getX(n);if(null==e||Number.isNaN(e))continue;const r=t.getHigh(n),u=t.getLow(n);if(null==r||Number.isNaN(r)||null==u||Number.isNaN(u))continue;const d=o?r:t.getOpen(n),f=o?u:t.getClose(n);if(!o&&[d,f].some(t=>null==t||Number.isNaN(t)))continue;const p=f>=d,y={type:"candlestick",x:t.scales.x(e),openY:t.scales.y(d),closeY:t.scales.y(f),highY:t.scales.y(r),lowY:t.scales.y(u),bodyWidth:g,upColor:a,downColor:l,wickColor:c,wickWidth:h,isUp:p,datum:n};o&&(y.isRange=!0,y.dotRadius=Math.max(2,Math.min(g/2,.12*i.height))),s.push(y)}return s}(s,e,t);default:return[]}}resolveBoundsStyle(t,e){return function(t,e,i,o){const s=t.boundsStyle;return"function"==typeof s?s(i||{},e):s&&"object"==typeof s?s:{fill:o(e,i).stroke||t.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,t,e,(t,e)=>this.resolveLineStyle(t,e))}computeDecayOpacity(t,e){const i=this.config.decay;return i&&e>1?Z(i,t,e):1}getDatumIndexMap(t){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const e=K(t);return this._datumIndexCache={version:this._ingestVersion,map:e},e}applyDecay(t,e){this.config.decay&&q(this.config.decay,t,e,this.getDatumIndexMap(e))}refreshPulse(t){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),t)}hasActivePulsesAt(t){return!!this.config.pulse&&N(this.config.pulse,this.timestampBuffer,t)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(t,e,i,o){i.clear(),o.clear();for(let s=0;e.length>s;s++){const n=e[s],r=Ne(t,n,s);r&&("point"===n.type?i.set(r,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"glyph"===n.type?i.set(r,{x:n.x,y:n.y,r:n.size,opacity:n.style.opacity,glyph:n.glyph}):"rect"===n.type?i.set(r,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"heatcell"===n.type?i.set(r,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style?.opacity}):"candlestick"===n.type?i.set(r,{x:n.x,y:n.openY,w:n.bodyWidth,openY:n.openY,closeY:n.closeY,highY:n.highY,lowY:n.lowY,opacity:n.style?.opacity}):"line"===n.type?o.set(r,{path:n.path.map(t=>[t[0],t[1]]),opacity:n.style?.opacity}):"area"===n.type&&o.set(r,{topPath:n.topPath.map(t=>[t[0],t[1]]),bottomPath:n.bottomPath.map(t=>[t[0],t[1]]),opacity:n.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const t=this.scales?.y(0)??0;for(let e=0;this.scene.length>e;e++){const i=this.scene[e],o=Ne(this.transitionContext,i,e);o&&("point"===i.type?this.prevPositionMap.set(o,{x:i.x,y:i.y,r:0,opacity:0}):"rect"===i.type?this.prevPositionMap.set(o,{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}):"heatcell"===i.type?this.prevPositionMap.set(o,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:0}):"line"===i.type?(i._introClipFraction=0,this.prevPathMap.set(o,{path:i.path.map(t=>[t[0],t[1]]),opacity:i.style.opacity})):"area"===i.type&&(i._introClipFraction=0,this.prevPathMap.set(o,{topPath:i.topPath.map(t=>[t[0],t[1]]),bottomPath:i.bottomPath.map(t=>[t[0],t[1]]),opacity:i.style.opacity})))}}startTransition(){if(!this.config.transition)return;const t=function(t,e,i,o,s,n=qt()){if(0===o.size&&0===s.size)return i;const r=e.duration??300;if(i.exitNodes.length>0){const t=new Set(i.exitNodes);i.scene=i.scene.filter(e=>!t.has(e)),i.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let e=0;i.scene.length>e;e++){const n=i.scene[e],r=Ne(t,n,e);if(!r)continue;if(n._transitionKey=r,"line"===n.type||"area"===n.type){const t=s.get(r);if(t){if(c.add(r),"line"===n.type&&t.path&&t.path.length===n.path.length){n._targetPath=n.path.map(t=>[t[0],t[1]]),n._prevPath=t.path;for(let e=0;n.path.length>e;e++)n.path[e]=[t.path[e][0],t.path[e][1]];a=!0}else if("area"===n.type&&t.topPath&&t.bottomPath&&t.topPath.length===n.topPath.length&&t.bottomPath.length===n.bottomPath.length){n._targetTopPath=n.topPath.map(t=>[t[0],t[1]]),n._targetBottomPath=n.bottomPath.map(t=>[t[0],t[1]]),n._prevTopPath=t.topPath,n._prevBottomPath=t.bottomPath;for(let e=0;n.topPath.length>e;e++)n.topPath[e]=[t.topPath[e][0],t.topPath[e][1]];for(let e=0;n.bottomPath.length>e;e++)n.bottomPath[e]=[t.bottomPath[e][0],t.bottomPath[e][1]];a=!0}n._targetOpacity=n.style.opacity??1,n._startOpacity=t.opacity??n.style.opacity??1}else n._targetOpacity=n.style.opacity??1,n._startOpacity=0,n.style={...n.style,opacity:0},a=!0;continue}const h=o.get(r);if("point"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,r:n.r};n._targetOpacity=n.style.opacity??1,h.x===t.x&&h.y===t.y&&h.r===t.r||(n._targetX=t.x,n._targetY=t.y,n._targetR=t.r,n.x=h.x,n.y=h.y,n.r=h.r??n.r,a=!0)}else n._targetOpacity=n.style.opacity??1,n.style={...n.style,opacity:0},a=!0;else if("glyph"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,size:n.size};n._targetOpacity=n.style.opacity??1,h.x===t.x&&h.y===t.y&&h.r===t.size||(n._targetX=t.x,n._targetY=t.y,n._targetR=t.size,n.x=h.x,n.y=h.y,n.size=h.r??n.size,a=!0)}else n._targetOpacity=n.style.opacity??1,n.style={...n.style,opacity:0},a=!0;else if("rect"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,w:n.w,h:n.h};n._targetOpacity=n.style.opacity??1,h.x===t.x&&h.y===t.y&&h.w===t.w&&h.h===t.h||(n._targetX=t.x,n._targetY=t.y,n._targetW=t.w,n._targetH=t.h,n.x=h.x,n.y=h.y,n.w=h.w??n.w,n.h=h.h??n.h,a=!0)}else n._targetOpacity=n.style.opacity??1,n.style={...n.style,opacity:0},a=!0;else if("heatcell"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,w:n.w,h:n.h};n._targetOpacity=n.style?.opacity??1,h.x===t.x&&h.y===t.y&&h.w===t.w&&h.h===t.h||(n._targetX=t.x,n._targetY=t.y,n._targetW=t.w,n._targetH=t.h,n.x=h.x,n.y=h.y,n.w=h.w??n.w,n.h=h.h??n.h,a=!0)}else n._targetOpacity=n.style?.opacity??1,n.style={...n.style||{},opacity:0},a=!0;else if("candlestick"===n.type)if(h&&null!=h.openY){l.add(r);const t={x:n.x,openY:n.openY,closeY:n.closeY,highY:n.highY,lowY:n.lowY};n._targetOpacity=n.style?.opacity??1,(h.x!==t.x||h.openY!==t.openY||h.closeY!==t.closeY||h.highY!==t.highY||h.lowY!==t.lowY)&&(n._targetX=t.x,n._targetOpenY=t.openY,n._targetCloseY=t.closeY,n._targetHighY=t.highY,n._targetLowY=t.lowY,n.x=h.x,n.openY=h.openY,n.closeY=h.closeY??n.closeY,n.highY=h.highY??n.highY,n.lowY=h.lowY??n.lowY,a=!0)}else n._targetOpacity=n.style?.opacity??1,n.style={...n.style||{},opacity:0},a=!0}for(const[t,e]of s)if(!c.has(t))if(t.startsWith("l:")&&e.path){const o={type:"line",path:e.path.map(t=>[t[0],t[1]]),group:t.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t,datum:null};i.exitNodes.push(o),a=!0}else if(t.startsWith("a:")&&e.topPath&&e.bottomPath){const o={type:"area",topPath:e.topPath.map(t=>[t[0],t[1]]),bottomPath:e.bottomPath.map(t=>[t[0],t[1]]),group:t.slice(2),style:{fill:"#999",opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t,datum:null};i.exitNodes.push(o),a=!0}for(const[t,e]of o)if(!l.has(t)){if(t.startsWith("p:"))i.exitNodes.push({type:"point",x:e.x,y:e.y,r:e.r??3,style:{opacity:e.opacity??1},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("g:")&&e.glyph)i.exitNodes.push({type:"glyph",x:e.x,y:e.y,size:e.r??12,glyph:e.glyph,color:"#999",accent:"#999",style:{opacity:e.opacity??1},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("r:"))i.exitNodes.push({type:"rect",x:e.x,y:e.y,w:e.w??0,h:e.h??0,style:{opacity:e.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("h:"))i.exitNodes.push({type:"heatcell",x:e.x,y:e.y,w:e.w??0,h:e.h??0,fill:"#999",datum:null,style:{opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t});else if(t.startsWith("c:")){const o=e.openY??e.y;i.exitNodes.push({type:"candlestick",x:e.x,openY:o,closeY:e.closeY??o,highY:e.highY??o,lowY:e.lowY??o,bodyWidth:e.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t})}a=!0}return i.exitNodes.length>0&&(i.scene=[...i.scene,...i.exitNodes]),a&&(i.activeTransition={startTime:n,duration:r}),i}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition}advanceTransition(t){if(!this.activeTransition||!this.config.transition)return!1;const e={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},i=function(t,e,i,o){if(!i.activeTransition)return!1;const s=Lt(t,i.activeTransition),n=Dt(s,"linear"===e.easing?"linear":"ease-out-cubic");for(const t of i.scene){const e=t._transitionKey;if("point"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style.opacity=jt(i?i.opacity??1:0,t._targetOpacity,n)}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=jt(i.x,t._targetX,n),t.y=jt(i.y,t._targetY,n),void 0!==t._targetR&&void 0!==i.r&&(t.r=jt(i.r,t._targetR,n))}else if("glyph"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style.opacity=jt(i?i.opacity??1:0,t._targetOpacity,n)}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=jt(i.x,t._targetX,n),t.y=jt(i.y,t._targetY,n),void 0!==t._targetR&&void 0!==i.r&&(t.size=jt(i.r,t._targetR,n))}else if("rect"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style.opacity=jt(i?i.opacity??1:0,t._targetOpacity,n)}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=jt(i.x,t._targetX,n),t.y=jt(i.y,t._targetY,n),void 0!==i.w&&(t.w=jt(i.w,t._targetW,n)),void 0!==i.h&&(t.h=jt(i.h,t._targetH,n))}else if("heatcell"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style={...t.style||{},opacity:jt(i?i.opacity??1:0,t._targetOpacity,n)}}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=jt(i.x,t._targetX,n),t.y=jt(i.y,t._targetY,n),void 0!==i.w&&(t.w=jt(i.w,t._targetW,n)),void 0!==i.h&&(t.h=jt(i.h,t._targetH,n))}else if("candlestick"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style={...t.style||{},opacity:jt(i?i.opacity??1:0,t._targetOpacity,n)}}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=jt(i.x,t._targetX,n),void 0!==i.openY&&(t.openY=jt(i.openY,t._targetOpenY,n)),void 0!==i.closeY&&(t.closeY=jt(i.closeY,t._targetCloseY,n)),void 0!==i.highY&&(t.highY=jt(i.highY,t._targetHighY,n)),void 0!==i.lowY&&(t.lowY=jt(i.lowY,t._targetLowY,n))}else if("line"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:jt(t._startOpacity??0,t._targetOpacity,n)}),void 0!==t._introClipFraction&&(t._introClipFraction=n);const e=t._prevPath,i=t._targetPath;if(e&&i&&e.length===t.path.length)for(let o=0;t.path.length>o;o++)t.path[o][0]=jt(e[o][0],i[o][0],n),t.path[o][1]=jt(e[o][1],i[o][1],n)}else if("area"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:jt(t._startOpacity??0,t._targetOpacity,n)}),void 0!==t._introClipFraction&&(t._introClipFraction=n);const e=t._prevTopPath,i=t._prevBottomPath,o=t._targetTopPath,s=t._targetBottomPath;if(e&&o&&e.length===t.topPath.length)for(let i=0;t.topPath.length>i;i++)t.topPath[i][0]=jt(e[i][0],o[i][0],n),t.topPath[i][1]=jt(e[i][1],o[i][1],n);if(i&&s&&i.length===t.bottomPath.length)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e][0]=jt(i[e][0],s[e][0],n),t.bottomPath[e][1]=jt(i[e][1],s[e][1],n)}}if(s>=1){for(const t of i.scene){if(void 0!==t._targetOpacity){const e=t._targetOpacity;t.style="line"===t.type||"area"===t.type?{...t.style,opacity:0===e?0:e}:{...t.style||{},opacity:0===e?0:e},t._targetOpacity=void 0}if("point"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.r=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0}else if("glyph"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.size=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0}else if("rect"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("heatcell"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("candlestick"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,void 0!==t._targetOpenY&&(t.openY=t._targetOpenY),void 0!==t._targetCloseY&&(t.closeY=t._targetCloseY),void 0!==t._targetHighY&&(t.highY=t._targetHighY),void 0!==t._targetLowY&&(t.lowY=t._targetLowY),t._targetX=void 0,t._targetOpenY=void 0,t._targetCloseY=void 0,t._targetHighY=void 0,t._targetLowY=void 0}else if("line"===t.type){const e=t._targetPath;if(e)for(let i=0;t.path.length>i;i++)t.path[i]=e[i];t._prevPath=void 0,t._targetPath=void 0,t._introClipFraction=void 0}else if("area"===t.type){const e=t._targetTopPath,i=t._targetBottomPath;if(e)for(let i=0;t.topPath.length>i;i++)t.topPath[i]=e[i];if(i)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e]=i[e];t._prevTopPath=void 0,t._prevBottomPath=void 0,t._targetTopPath=void 0,t._targetBottomPath=void 0,t._introClipFraction=void 0}}if(i.exitNodes.length>0){const t=new Set(i.exitNodes);i.scene=i.scene.filter(e=>!t.has(e)),i.exitNodes=[]}return i.activeTransition=null,!1}return!0}(t,this.config.transition,e,this.prevPositionMap);return this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition,i}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const t of this.scene)"line"!==t.type&&"area"!==t.type||(t._introClipFraction=void 0)}groupData(t){const{result:e,cache:i}=function(t,e,i,o){if(o&&o.version===i&&o.group===e&&o.data===t)return{result:o.result,cache:o};let s;if(e){const i=new Map;for(const o of t){const t=e(o);i.has(t)||i.set(t,[]),i.get(t).push(o)}s=Array.from(i.entries()).map(([t,e])=>({key:t,data:e}))}else s=[{key:"_default",data:t}];return{result:s,cache:{version:i,group:e,data:t,result:s}}}(t,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=i,e}resolveColorMap(t){const{map:e,cache:i}=function(t,e,i,o,s){if(s&&s.version===o)return{map:s.map,cache:s};const n=new Set;if(e)for(const i of t){const t=e(i);t&&n.add(t)}const r=Array.from(n).sort(),a=r.join("\0");if(s&&s.key===a){const t={...s,version:o};return{map:t.map,cache:t}}const l=Array.isArray(i.colorScheme)?i.colorScheme:i.themeCategorical||At,c=new Map;for(let t=0;r.length>t;t++)c.set(r[t],l[t%l.length]);return{map:c,cache:{key:a,map:c,version:o}}}(t,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=i,e}resolveLineStyle(t,e){return function(t,e,i,o){const s=t.lineStyle;if("function"==typeof s){const t=s(i||{},e);if(t&&!t.stroke&&e){const i=o(e);if(i)return{...t,stroke:i}}return t}const n=t.themeSemantic?.primary;return s&&"object"==typeof s?{stroke:s.stroke||n||"#007bff",strokeWidth:s.strokeWidth||2,strokeDasharray:s.strokeDasharray,fill:s.fill,fillOpacity:s.fillOpacity,opacity:s.opacity}:{stroke:o(e)||n||"#007bff",strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveAreaStyle(t,e){return function(t,e,i,o){if(t.areaStyle){const s=t.areaStyle(i||{});if(s&&!s.fill&&e){const t=o(e);if(t)return{...s,fill:t,stroke:s.stroke||t}}return s}const s=t.lineStyle;if("function"==typeof s){const t=s(i||{},e);if(t&&!t.fill&&e){const i=o(e);if(i)return{...t,fill:i,stroke:t.stroke||i}}return t}const n=t.themeSemantic?.primary;if(s&&"object"==typeof s)return{fill:s.fill||s.stroke||n||"#4e79a7",fillOpacity:s.fillOpacity??.7,stroke:s.stroke||n||"#4e79a7",strokeWidth:s.strokeWidth||2};const r=o(e)||n||"#4e79a7";return{fill:r,fillOpacity:.7,stroke:r,strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveGroupColor(e){const{color:i,groupColorCounter:o}=function(t){const{group:e,colorMapCache:i,groupColorMap:o,groupColorMapCap:s,config:n}=t;let{groupColorCounter:r}=t;if(i){const t=i.map.get(e);if(t)return{color:t,groupColorCounter:r}}const a=o.get(e);if(a)return{color:a,groupColorCounter:r};const l=(Array.isArray(n.colorScheme)&&n.colorScheme.length>0?n.colorScheme:null)||(Array.isArray(n.themeCategorical)&&n.themeCategorical.length>0?n.themeCategorical:null)||At;if(0===l.length)return{color:null,groupColorCounter:r};const c=l[r%l.length];if(r++,o.set(e,c),o.size>s){const t=o.keys().next().value;void 0!==t&&o.delete(t)}return{color:c,groupColorCounter:r}}({group:e,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:t.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=o,i}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(t){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const e=A(t),i=this.getPointId,o=t=>e.has(i(t));P(this.buffer,this.timestampBuffer,o);const s=this.buffer.remove(o);if(0===s.length)return this.updateResults.recordNoop("remove"),s;for(const t of s)this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",s.length),s}update(t,e){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const i=A(t),o=this.getPointId,s=new Set;this.buffer.forEach((t,e)=>{i.has(o(t))&&s.add(e)});const n=this.buffer.update(t=>i.has(o(t)),e);if(0===n.length)return this.updateResults.recordNoop("update"),n;for(const t of n)this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t);return this.buffer.forEach((t,e)=>{s.has(e)&&(this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",n.length),n}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(t,e){const i=this._customRestyle;if(i)for(const o of t){const t=this._baseStyles.get(o)??o.style??{},s=i(o,e);o.style=s?{...t,...s}:t}}restyleScene(t){this._customRestyle?(this.applyCustomRestyle(this.scene,t),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(t){const e={...this.config},i=Object.keys(t).filter(i=>t[i]!==e[i]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in t&&t.windowSize!==e.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${e.windowSize} → ${t.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 t||"themeCategorical"in t||"colorAccessor"in t)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in t||"colorScheme"in t)&&(this._barCategoryCache=null),("normalize"in t||"extentPadding"in t||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t||"boundsAccessor"in t||"band"in t||"y0Accessor"in t||"openAccessor"in t||"highAccessor"in t||"lowAccessor"in t||"closeAccessor"in t||"groupAccessor"in t||"categoryAccessor"in t||"chartType"in t||"runtimeMode"in t)&&(this._stackExtentCache=null);let o=!1,s=!1;Object.assign(this.config,t),"pulse"in t&&this.syncPulseTimestampBuffer();const n="chartType"in t&&t.chartType!==e.chartType||"runtimeMode"in t&&t.runtimeMode!==e.runtimeMode;if(n||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t){const t=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,i=t&&this.config.valueAccessor||this.config.yAccessor,r=t&&e.valueAccessor||e.yAccessor,a=n||!F(t&&this.config.timeAccessor||this.config.xAccessor,t&&e.timeAccessor||e.xAccessor),l=n||!F(i,r);(a||l)&&(t?(this.getX=I(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=I(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=I(this.config.xAccessor,"x"),this.getY=I(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(t=>"bounds"===t.kind)&&(this.resolvedRibbons=Fe(this.config)),o=!0,s=!0)}if("groupAccessor"in t&&!F(t.groupAccessor,e.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?$(this.config.groupAccessor):void 0,o=!0),"categoryAccessor"in t&&!F(t.categoryAccessor,e.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?$(this.config.categoryAccessor):void 0,o=!0),"sizeAccessor"in t&&!F(t.sizeAccessor,e.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?I(this.config.sizeAccessor,"size"):void 0,o=!0),"symbolAccessor"in t&&!F(t.symbolAccessor,e.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?$(this.config.symbolAccessor):void 0,o=!0),"colorAccessor"in t&&!F(t.colorAccessor,e.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?$(this.config.colorAccessor):void 0,o=!0),"y0Accessor"in t&&!F(t.y0Accessor,e.y0Accessor)&&(this.getY0=this.config.y0Accessor?I(this.config.y0Accessor,"y0"):void 0,o=!0,s=!0),("boundsAccessor"in t&&!F(t.boundsAccessor,e.boundsAccessor)||"band"in t&&t.band!==e.band||"boundsStyle"in t&&t.boundsStyle!==e.boundsStyle)&&(this.resolvedRibbons=Fe(this.config),o=!0,s=!0),"pointIdAccessor"in t&&!F(t.pointIdAccessor,e.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?$(this.config.pointIdAccessor):void 0,o=!0),"candlestick"===this.config.chartType&&(n||"openAccessor"in t&&!F(t.openAccessor,e.openAccessor)||"closeAccessor"in t&&!F(t.closeAccessor,e.closeAccessor)||"highAccessor"in t&&!F(t.highAccessor,e.highAccessor)||"lowAccessor"in t&&!F(t.lowAccessor,e.lowAccessor))){const t=null!=this.config.openAccessor,e=null!=this.config.closeAccessor;this.getOpen=t?I(this.config.openAccessor,"open"):void 0,this.getHigh=I(this.config.highAccessor,"high"),this.getLow=I(this.config.lowAccessor,"low"),this.getClose=e?I(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!e,o=!0,s=!0}if("accessorRevision"in t&&t.accessorRevision!==e.accessorRevision&&(o=!0,s=!0),!o){const i=Object.keys(t).filter(t=>!t.endsWith("Accessor")&&"timeAccessor"!==t&&"valueAccessor"!==t);for(const s of i)if(t[s]!==e[s]){o=!0;break}}o&&(s&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(i)}updateConfigWithResult(t){return this.updateConfig(t),this.updateResults.last}};li.GROUP_COLOR_MAP_CAP=1e3;var ci=li;U(ci);import{line as hi}from"d3-shape";var ui=new WeakMap;function gi(t,e){const i=ee(e);if(!i)return t;const o=ui.get(t);if(o)return o;const s=function(t,e,i=8){if(!e||2>t.length)return t.map(([t,e])=>[t,e]);const o=[];let s=null;const n={moveTo(t,e){s=[t,e],o.push([t,e])},lineTo(t,e){s=[t,e],o.push([t,e])},bezierCurveTo(t,e,n,r,a,l){if(!s)return s=[a,l],void o.push([a,l]);const[c,h]=s;for(let s=1;i>=s;s++){const u=s/i,g=1-u;o.push([g*g*g*c+3*g*g*u*t+3*g*u*u*n+u*u*u*a,g*g*g*h+3*g*g*u*e+3*g*u*u*r+u*u*u*l])}s=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(t,e,i,n){s=[i,n],o.push([i,n])}};return hi().x(t=>t[0]).y(t=>t[1]).curve(e).context(n)(t),o}(t,i);return ui.set(t,s),s}function di(t,e,i,o=30,s,n=0){let r=null;if(s){const t=tt(s,e,i,o,n);t&&(r={node:t.node,datum:t.node.datum,x:t.node.x,y:t.node.y,distance:t.distance})}for(const n of t){let t=null;switch(n.type){case"point":if(s)break;t=pi(n,e,i,o);break;case"symbol":t=yi(n,e,i,o);break;case"glyph":t=mi(n,e,i,o);break;case"line":t=xi(n,e,i,o);break;case"rect":if(null==n.datum)break;t=bi(n,e,i);break;case"heatcell":t=ki(n,e,i);break;case"area":if(!1===n.interactive)break;t=Ai(n,e,i);break;case"candlestick":t=wi(n,e,i)}t&&o>t.distance&&(r&&t.distance>=r.distance||(r=t))}return r}function fi(t,e,i){if(0===t.length)return null;if(t[0][0]>e||e>t[t.length-1][0])return null;const o=Ci(t,e);if(0>o)return null;if(Math.abs(t[o][0]-e)>i)return null;let s=o,n=o;o>0&&t[o][0]>=e?(s=o-1,n=o):t.length-1>o&&(s=o,n=o+1);const[r,a]=t[s],[l,c]=t[n];return l===r?a:a+Math.max(0,Math.min(1,(e-r)/(l-r)))*(c-a)}function pi(t,e,i,o=30){const s=e-t.x,n=i-t.y,r=Math.sqrt(s*s+n*n);return r>et(t.r,o)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:r}}function yi(t,e,i,o=30){const s=e-t.x,n=i-t.y,r=Math.sqrt(s*s+n*n);return r>et(se(t.size),o)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:r}}function mi(t,e,i,o=30){if(null==t.datum)return null;const s=fe(t.glyph,t.size),n=t.x+s.centerDx,r=t.y+s.centerDy,a=e-n,l=i-r,c=Math.sqrt(a*a+l*l);return c>et(s.radius,o)?null:{node:t,datum:t.datum,x:n,y:r,distance:c}}function xi(t,e,i,o=30){if(0===t.path.length)return null;const s=Ci(t.path,e);if(0>s)return null;const[n,r]=t.path[s];let a;if(t.path.length>1){let o=1/0;const n=Math.max(0,s-1),r=Math.min(t.path.length-2,s);for(let s=n;r>=s;s++){const[n,r]=t.path[s],[a,l]=t.path[s+1],c=vi(e,i,n,r,a,l);o>c&&(o=c)}a=o}else{const t=e-n,o=i-r;a=Math.sqrt(t*t+o*o)}const l=t.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:t,datum:Array.isArray(t.datum)&&t.datum[s]?t.datum[s]:t.datum,x:n,y:r,distance:a}}function vi(t,e,i,o,s,n){const r=s-i,a=n-o,l=r*r+a*a;if(0===l)return Math.sqrt((t-i)**2+(e-o)**2);let c=((t-i)*r+(e-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((t-(i+c*r))**2+(e-(o+c*a))**2)}function bi(t,e,i){const o=ot(e,i,t);return o.hit?{node:t,datum:t.datum,x:o.cx,y:o.cy,distance:0}:null}function ki(t,e,i){const o=ot(e,i,t);return o.hit?{node:t,datum:t.datum,x:o.cx,y:o.cy,distance:0}:null}function wi(t,e,i){const o=t.bodyWidth/2,s=Math.min(t.openY,t.closeY);if(!(t.x-o-3>e||e>t.x+o+3||t.highY-3>i||i>t.lowY+3)){const o=s+Math.max(Math.max(t.openY,t.closeY)-s,1)/2,n=e-t.x,r=i-o;return{node:t,datum:t.datum,x:t.x,y:o,distance:Math.sqrt(n*n+r*r)}}return null}function Ai(t,e,i){if(0===t.topPath.length)return null;const o=Ci(t.topPath,e);if(0>o)return null;const[s,n]=t.topPath[o],r=e-s,a=i-n,l=Math.sqrt(r*r+a*a);return{node:t,datum:Array.isArray(t.datum)&&t.datum[o]?t.datum[o]:t.datum,x:s,y:n,distance:l}}function Ci(t,e){if(0===t.length)return-1;let i=0,o=t.length-1;for(;o>i;){const s=i+o>>1;e>t[s][0]?i=s+1:o=s}return i>0&&Math.abs(t[i][0]-e)>=Math.abs(t[i-1][0]-e)?i-1:i}import{useMemo as _i,useRef as Mi,useEffect as Si}from"react";import{useMemo as Pi}from"react";import{bin as Yi}from"d3-array";import{jsx as Ri,jsxs as Ti}from"react/jsx-runtime";function Ni(t){return"string"==typeof t?{type:t}:t}function Wi({orient:t,config:e,values:i,scale:o,size:s,length:n}){const r=function(t){return{type:t.type,bins:t.bins??20,fill:t.fill??"#4e79a7",fillOpacity:t.fillOpacity??.5,stroke:t.stroke??"none",strokeWidth:t.strokeWidth??1}}(e),a="top"===t||"bottom"===t,l=Pi(()=>{if(0===i.length)return null;const e=o.domain(),l=s-8;if("boxplot"===r.type){const e=function(t){const e=[...t].sort((t,e)=>t-e),i=e.length;if(0===i)return null;const o=e[Math.floor(.25*i)],s=e[Math.floor(.5*i)],n=e[Math.floor(.75*i)],r=n-o;return{q1:o,median:s,q3:n,whiskerLow:Math.max(e[0],o-1.5*r),whiskerHigh:Math.min(e[i-1],n+1.5*r)}}(i);if(!e)return null;const{q1:s,median:n,q3:c,whiskerLow:h,whiskerHigh:u}=e,g=Math.min(.5*l,20),d=(l-g)/2+4;if(a){const e=o(s),i=o(c),a=o(n),l=o(h),f=o(u),p="top"===t?-1:1,y=0;return Ti("g",{"data-testid":"marginal-boxplot-"+t,children:[Ri("line",{x1:l,y1:y+p*(d+g/2),x2:f,y2:y+p*(d+g/2),stroke:r.fill,strokeWidth:r.strokeWidth}),Ri("line",{x1:l,y1:y+p*d,x2:l,y2:y+p*(d+g),stroke:r.fill,strokeWidth:r.strokeWidth}),Ri("line",{x1:f,y1:y+p*d,x2:f,y2:y+p*(d+g),stroke:r.fill,strokeWidth:r.strokeWidth}),Ri("rect",{x:Math.min(e,i),y:"top"===t?y-d-g:y+d,width:Math.abs(i-e),height:g,fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth}),Ri("line",{x1:a,y1:"top"===t?y-d-g:y+d,x2:a,y2:"top"===t?y-d:y+d+g,stroke:r.fill,strokeWidth:2})]})}{const e=o(s),i=o(c),a=o(n),l=o(h),f=o(u),p="left"===t?-1:1,y=0;return Ti("g",{"data-testid":"marginal-boxplot-"+t,children:[Ri("line",{x1:y+p*(d+g/2),y1:l,x2:y+p*(d+g/2),y2:f,stroke:r.fill,strokeWidth:r.strokeWidth}),Ri("line",{x1:y+p*d,y1:l,x2:y+p*(d+g),y2:l,stroke:r.fill,strokeWidth:r.strokeWidth}),Ri("line",{x1:y+p*d,y1:f,x2:y+p*(d+g),y2:f,stroke:r.fill,strokeWidth:r.strokeWidth}),Ri("rect",{x:"left"===t?y-d-g:y+d,y:Math.min(e,i),width:g,height:Math.abs(i-e),fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth}),Ri("line",{x1:"left"===t?y-d-g:y+d,y1:a,x2:"left"===t?y-d:y+d+g,y2:a,stroke:r.fill,strokeWidth:2})]})}}const c=Yi().domain(e).thresholds(r.bins)(i);if(0===c.length)return null;const h=ge(c.map(t=>t.length));if(0===h)return null;if("histogram"===r.type)return Ri("g",{"data-testid":"marginal-histogram-"+t,children:c.map((e,i)=>{if(null==e.x0||null==e.x1)return null;const s=e.length/h*l;if(a){const n=o(e.x0),a=o(e.x1)-o(e.x0);return Ri("rect",{x:n,y:"top"===t?-4-s:4,width:Math.max(a,.5),height:s,fill:r.fill,fillOpacity:r.fillOpacity,stroke:r.stroke,strokeWidth:r.strokeWidth},i)}{const n=o(e.x0),a=o(e.x1)-o(e.x0);return Ri("rect",{x:"left"===t?-4-s:4,y:Math.min(n,n+a),width:s,height:Math.abs(a),fill:r.fill,fillOpacity:r.fillOpacity,stroke:r.stroke,strokeWidth:r.strokeWidth},i)}})});if("violin"===r.type){const e=l/2+4,i=[];for(const s of c){if(null==s.x0||null==s.x1)continue;const n=s.length/h*(l/2),r=o((s.x0+s.x1)/2);i.push(a?`${r},${"top"===t?-(e-n):e-n}`:`${"left"===t?-(e-n):e-n},${r}`)}for(let s=c.length-1;s>=0;s--){const n=c[s];if(null==n.x0||null==n.x1)continue;const r=n.length/h*(l/2),u=o((n.x0+n.x1)/2);i.push(a?`${u},${"top"===t?-(e+r):e+r}`:`${"left"===t?-(e+r):e+r},${u}`)}return Ri("g",{"data-testid":"marginal-violin-"+t,children:Ri("polygon",{points:i.join(" "),fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth})})}if("ridgeline"===r.type){const e=[];if(a){const i=0,s=null!=c[0].x0?o(c[0].x0):0;e.push(`M${s},${i}`);for(const i of c){if(null==i.x0||null==i.x1)continue;const s=i.length/h*l,n=o((i.x0+i.x1)/2);e.push(`L${n},${"top"===t?-s-4:s+4}`)}const r=null!=c[c.length-1].x1?o(c[c.length-1].x1):n;e.push(`L${r},${i}`),e.push("Z")}else{const i=0,s=null!=c[0].x0?o(c[0].x0):0;e.push(`M${i},${s}`);for(const i of c){if(null==i.x0||null==i.x1)continue;const s=i.length/h*l,n=o((i.x0+i.x1)/2);e.push(`L${"left"===t?-s-4:s+4},${n}`)}const r=null!=c[c.length-1].x1?o(c[c.length-1].x1):n;e.push(`L${i},${r}`),e.push("Z")}return Ri("g",{"data-testid":"marginal-ridgeline-"+t,children:Ri("path",{d:e.join(" "),fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth})})}return null},[i,o,r,s,n,t,a,4]);return l?Ri("g",{className:"marginal-"+t,"data-testid":"marginal-"+t,children:l}):null}function Oi(t,e,i){if("edges"===t){if(e)return"start";if(i)return"end"}return"middle"}function Ei(t,e,i){if("edges"===t){if(e)return"hanging";if(i)return"auto"}return"middle"}function Di(t){if(0===t.length)return{min:null,max:null};let e=1/0,i=-1/0;for(const o of t)e>o.pixel&&(e=o.pixel),o.pixel>i&&(i=o.pixel);return{min:e,max:i}}function Li(t){if(t)return"dashed"===t?"6,4":"dotted"===t?"2,4":t}function Bi(t,e,i){if("left"===t||"right"===t){const o="left"===t?i:0,s="left"===t?-1:1,n=Math.ceil(e/8);let r="M0,"+o;for(let t=0;n>t;t++){const i=8*(t+1);r+=`L${Math.min(8*t+4,e)},${o+4*s}`,r+=`L${Math.min(i,e)},${o}`}return r}const o="bottom"===t?0:e,s="bottom"===t?1:-1,n=Math.ceil(i/8);let r=`M${o},0`;for(let t=0;n>t;t++){const e=8*(t+1);r+=`L${o+4*s},${Math.min(8*t+4,i)}`,r+=`L${o},${Math.min(e,i)}`}return r}import{Fragment as zi,jsx as Fi,jsxs as Ii}from"react/jsx-runtime";function Xi(t){const{width:e,height:i,totalWidth:o,totalHeight:s,margin:n,scales:r,showAxes:a,axes:l,showGrid:c,xFormat:h,yFormat:u,axisExtent:g}=t,d=_i(()=>{if(!r)return[];const t=l?.find(t=>"bottom"===t.orient),i=t?.tickFormat||h||$i,o=Math.max(2,Math.floor(e/70)),s=t?.ticks??5,n="exact"===g?Math.max(2,s):Math.min(s,o),a=t?.tickValues??w(r.x,n,g),c=a.map(t=>t.valueOf()),u=a.map((t,e)=>({value:t,pixel:r.x(t),label:i(t,e,c)})),d=u.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0);return Vi(u,Math.max(55,d+8))},[r,l,h,e,g]),f=_i(()=>{if(!r)return[];const t=l?.find(t=>"left"===t.orient),e=t?.tickFormat||u||$i,o=Math.max(2,Math.floor(i/30)),s=t?.ticks??5,n="exact"===g?Math.max(2,s):Math.min(s,o);return Vi((t?.tickValues??w(r.y,n,g)).map(t=>({value:t,pixel:r.y(t),label:e(t)})),22)},[r,l,u,i,g]),p=c&&r,y=a&&r;if(!p&&!y)return null;const m=l?.find(t=>"bottom"===t.orient),x=l?.find(t=>"left"===t.orient),v=y&&(!m||!1!==m.baseline),b=y&&(!x||!1!==x.baseline),k=m?.jaggedBase||!1,A=x?.jaggedBase||!1,C="var(--semiotic-border, #ccc)";return Fi("svg",{width:o,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:Ii("g",{transform:`translate(${n.left},${n.top})`,children:[p&&(()=>{const t=Li(l?.find(t=>"bottom"===t.orient)?.gridStyle),o=Li(l?.find(t=>"left"===t.orient)?.gridStyle);return Ii("g",{className:"stream-grid",children:[d.map((e,o)=>Fi("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:t},"xgrid-"+o)),f.map((t,i)=>Fi("line",{x1:0,y1:t.pixel,x2:e,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+i))]})})(),v&&!k&&Fi("line",{x1:0,y1:i,x2:e,y2:i,stroke:C,strokeWidth:1}),k&&Fi("path",{d:Bi("bottom",e,i),fill:"none",stroke:C,strokeWidth:1}),b&&!A&&Fi("line",{x1:0,y1:0,x2:0,y2:i,stroke:C,strokeWidth:1}),A&&Fi("path",{d:Bi("left",e,i),fill:"none",stroke:C,strokeWidth:1})]})})}function $i(t,e,i){return t instanceof Date?`${t.toLocaleString("en",{month:"short"})} ${t.getDate()}`:"number"==typeof t?Math.round(100*t)/100+"":t+""}function Vi(t,e){if(2>=t.length)return t;const i=[t[0]];for(let o=1;t.length-1>o;o++)e>Math.abs(t[o].pixel-i[i.length-1].pixel)||i.push(t[o]);const o=t[t.length-1];return e>Math.abs(o.pixel-i[i.length-1].pixel)?i[i.length-1]=o:i.push(o),i}function Gi(t){const{width:e,height:i,totalWidth:o,totalHeight:s,margin:n,scales:r,showAxes:a,axes:l,xLabel:c,yLabel:h,yLabelRight:u,xFormat:g,yFormat:d,axisExtent:f,showGrid:p,title:y,legend:m,legendHoverBehavior:x,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:k,legendPosition:A="right",legendLayout:C,foregroundGraphics:_,marginalGraphics:M,xValues:S,yValues:P,annotations:Y,onAnnotationActivate:R,onObservation:T,chartId:N,chartType:W,autoPlaceAnnotations:O,svgAnnotationRules:E,xAccessor:D,yAccessor:L,annotationData:B,pointNodes:z,curve:F,underlayRendered:I,canvasObscuresUnderlay:X=!0,linkedCrosshairName:$,linkedCrosshairSourceId:V,children:G}=t,H=re({onAnnotationActivate:R,onObservation:T,chartId:N,chartType:W}),j=ie(C),q=m&&"left"===A&&j>0?j:n.left,U=m&&"right"===A&&j>0?j:n.right,K=_i(()=>{if(!a||!r)return[];const t=l?.find(t=>"bottom"===t.orient),i=t?.tickFormat||g||$i,o=Math.max(2,Math.floor(e/70)),s=t?.ticks??5,n="exact"===f?Math.max(2,s):Math.min(s,o),c=t?.tickValues??w(r.x,n,f),h=c.map(t=>t.valueOf()),u=c.map((t,e)=>({value:t,pixel:r.x(t),label:i(t,e,h)})),d=u.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0),p=t?.autoRotate?Math.max(20,Math.min(d+8,55)):Math.max(55,d+8);let y=Vi(u,p);if(y.length>1&&(y=y.filter((t,e)=>0===e||t.label+""!=y[e-1].label+"")),t?.includeMax&&y.length>0&&"exact"!==f&&!t?.tickValues){const t=r.x.domain()[1],e=r.x(t),o=y[y.length-1].pixel;if(Math.abs(e-o)>1){const s=i(t,y.length,h);p>e-o&&y.length>1&&(y=y.slice(0,-1)),y.push({value:t,pixel:e,label:s})}}return y},[a,r,l,g,e,f]),J=_i(()=>{const t=l?.find(t=>"bottom"===t.orient);if(!t?.autoRotate||1>=K.length)return!1;const i=e/Math.max(K.length-1,1);return K.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:60),0)+8>i},[l,K,e]),Z=_i(()=>{if(!a||!r)return[];const t=l?.find(t=>"left"===t.orient),e=t?.tickFormat||d||$i,o=Math.max(2,Math.floor(i/30)),s=t?.ticks??5,n="exact"===f?Math.max(2,s):Math.min(s,o);let c=Vi((t?.tickValues??w(r.y,n,f)).map(t=>({value:t,pixel:r.y(t),label:e(t)})),22);if(c.length>1&&(c=c.filter((t,e)=>0===e||t.label+""!=c[e-1].label+"")),t?.includeMax&&c.length>0&&"exact"!==f&&!t?.tickValues){const t=r.y.domain()[1],i=r.y(t),o=c[c.length-1].pixel;if(Math.abs(i-o)>1){const s=e(t);22>Math.abs(i-o)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:t,pixel:i,label:s})}}return c},[a,r,l,d,i,f]),Q=_i(()=>{if(!a||!r)return[];const t=l?.find(t=>"right"===t.orient);if(!t)return[];const e=t.tickFormat||d||$i,o=Math.max(2,Math.floor(i/30)),s=t.ticks??5;return Vi((t.tickValues??w(r.y,"exact"===f?Math.max(2,s):Math.min(s,o),f)).map(t=>({value:t,pixel:r.y(t),label:e(t)})),22)},[a,r,l,d,i,f]),tt=Mi(new Map),et=Mi(Y?.length??0),it=Y?.length??0;et.current!==it&&(et.current=it,tt.current=new Map);const ot=_i(()=>{if(!Y||0===Y.length)return null;const t=yt(Y),o=Bt("xy",H),s={scales:r?{x:r.x,y:r.y,time:r.x,value:r.y}:null,timeAxis:"x",xAccessor:D,yAccessor:L,width:e,height:i,data:B,frameType:"xy",pointNodes:z,curve:F,stickyPositionCache:tt.current},n=O?Rt({annotations:t,context:s,..."object"==typeof O?O:{}}):t;return Jt(n,o,E,s)},[Y,O,E,e,i,D,L,B,r,z,F,H]),nt=ae($);return Si(()=>{if(!nt?.locked||!$)return;const t=t=>{"Escape"===t.key&&ne($)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[nt?.locked,$]),a||y||m||_||M||ot&&ot.length>0||p||G||nt?Ii("svg",{role:"img",width:o,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Fi("title",{children:"string"==typeof y?y:"XY Chart"}),Fi("desc",{children:"string"==typeof y?y+" (XY data visualization)":"XY data visualization"}),Ii("g",{transform:`translate(${n.left},${n.top})`,children:[p&&r&&(!I||X)&&(()=>{const t=Li(l?.find(t=>"bottom"===t.orient)?.gridStyle),o=Li(l?.find(t=>"left"===t.orient)?.gridStyle);return Ii("g",{className:"stream-grid",children:[K.map((e,o)=>Fi("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:t},"xgrid-"+o)),Z.map((t,i)=>Fi("line",{x1:0,y1:t.pixel,x2:e,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+i))]})})(),a&&r&&(()=>{const t=l?.find(t=>"left"===t.orient),o=l?.find(t=>"bottom"===t.orient),s=!t||!1!==t.baseline,n=!o||!1!==o.baseline,r=t?.jaggedBase||!1,a=o?.jaggedBase||!1,g=o?.landmarkTicks,d=t?.landmarkTicks,f="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",m=J,x=m?12:18,v=i+(m?58:40),b={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},w={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},A=o?.tickAnchor,C=t?.tickAnchor,_=Di(K),M=Di(Z);return Ii("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[Ii("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!I||X)&&n&&!a&&Fi("line",{x1:0,y1:i,x2:e,y2:i,stroke:f,strokeWidth:1}),(!I||X)&&a&&Fi("path",{d:Bi("bottom",e,i),fill:"none",stroke:f,strokeWidth:1}),K.map((t,e)=>{const o=!!g&&("function"==typeof g?g(t.value,e):st(t.value,e>0?K[e-1].value:void 0));return Ii("g",{transform:`translate(${t.pixel},${i})`,children:[Fi("line",{y2:5,stroke:f,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Fi("text",{y:x,textAnchor:m?"end":Oi(A,t.pixel===_.min,t.pixel===_.max),fontWeight:o?600:400,fill:p,className:"semiotic-axis-tick",style:{userSelect:"none",...o?k:b},transform:m?"rotate(-45)":void 0,children:t.label}):Fi("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:Fi("div",{style:{textAlign:"center",userSelect:"none",...b},children:t.label})})]},"xtick-"+e)}),c&&Fi("text",{x:e/2,y:v,textAnchor:"middle",fill:y,className:"semiotic-axis-label",style:{userSelect:"none",...w},children:c})]}),Ii("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!I||X)&&s&&!r&&Fi("line",{x1:0,y1:0,x2:0,y2:i,stroke:f,strokeWidth:1}),(!I||X)&&r&&Fi("path",{d:Bi("left",e,i),fill:"none",stroke:f,strokeWidth:1}),Z.map((t,e)=>{const i=!!d&&("function"==typeof d?d(t.value,e):st(t.value,e>0?Z[e-1].value:void 0));return Ii("g",{transform:`translate(0,${t.pixel})`,children:[Fi("line",{x2:-5,stroke:f,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Fi("text",{x:-8,textAnchor:"end",dominantBaseline:Ei(C,t.pixel===M.min,t.pixel===M.max),fontWeight:i?600:400,fill:p,className:"semiotic-axis-tick",style:{userSelect:"none",...i?k:b},children:t.label}):Fi("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:Fi("div",{style:{textAlign:"right",userSelect:"none",...b},children:t.label})})]},"ytick-"+e)}),(()=>{const e=t?.label||h;return e?Fi("text",{x:15-q,y:i/2,textAnchor:"middle",fill:y,transform:`rotate(-90, ${15-q}, ${i/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...w},children:e}):null})()]}),(()=>{const t=l?.find(t=>"right"===t.orient);if(!t||0===Q.length)return null;const o=!1!==t.baseline,s=t.landmarkTicks,n=t.label||u,r=t.tickAnchor,a=Di(Q);return Ii("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&Fi("line",{x1:e,y1:0,x2:e,y2:i,stroke:f,strokeWidth:1}),Q.map((t,i)=>{const o=!!s&&("function"==typeof s?s(t.value,i):st(t.value,i>0?Q[i-1].value:void 0));return Ii("g",{transform:`translate(${e},${t.pixel})`,children:[Fi("line",{x2:5,stroke:f,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Fi("text",{x:8,textAnchor:"start",dominantBaseline:Ei(r,t.pixel===a.min,t.pixel===a.max),fontWeight:o?600:400,fill:p,className:"semiotic-axis-tick",style:{userSelect:"none",...o?k:b},children:t.label}):Fi("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:Fi("div",{style:{textAlign:"left",userSelect:"none",...b},children:t.label})})]},"ytick-r-"+i)}),n&&Fi("text",{x:e+U-15,y:i/2,textAnchor:"middle",fill:y,transform:`rotate(90, ${e+U-15}, ${i/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...w},children:n})]})})()]})})(),ot,M&&r&&S&&P&&Ii(zi,{children:[M.top&&Fi("g",{transform:"translate(0, 0)",children:Fi(Wi,{orient:"top",config:Ni(M.top),values:S,scale:r.x,size:n.top,length:e})}),M.bottom&&Fi("g",{transform:`translate(0, ${i})`,children:Fi(Wi,{orient:"bottom",config:Ni(M.bottom),values:S,scale:r.x,size:n.bottom,length:e})}),M.left&&Fi("g",{transform:"translate(0, 0)",children:Fi(Wi,{orient:"left",config:Ni(M.left),values:P,scale:r.y,size:n.left,length:i})}),M.right&&Fi("g",{transform:`translate(${e}, 0)`,children:Fi(Wi,{orient:"right",config:Ni(M.right),values:P,scale:r.y,size:n.right,length:i})})]}),_,nt&&nt.sourceId!==V&&r?.x&&(()=>{const t=r.x(nt.xValue);if(null==t||0>t||t>e)return null;const o=nt.locked;return Fi("line",{x1:t,y1:0,x2:t,y2:i,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),G]}),y&&"string"==typeof y?Fi("text",{x:o/2,y:Pt,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:y}):y?Fi("foreignObject",{x:0,y:0,width:o,height:n.top,children:y}):null,Zt({legend:m,totalWidth:o,totalHeight:s,margin:n,legendPosition:A,title:y,legendLayout:C,axisChrome:{hasAxis:!!a,hasAxisLabel:!!c,rotatedTicks:J},legendHoverBehavior:x,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:k})]}):null}var Hi={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function ji(t,e){const i=t.trim();if(/^#[0-9a-f]{3}$/i.test(i)){const t=i[1],o=i[2],s=i[3];return`#${t}${t}${o}${o}${s}${s}${e}`}if(/^#[0-9a-f]{6}$/i.test(i))return`${i}${e}`;const o=i.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(e,16)/255).toFixed(3)})`:i}var qi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ui=3156e7;function Ki(t){const e=t[1]-t[0];return 864e5>e?t=>{const e=new Date(t);return`${(e.getUTCHours()+"").padStart(2,"0")}:${(e.getUTCMinutes()+"").padStart(2,"0")}`}:Ui>e?t=>{const e=new Date(t);return`${qi[e.getUTCMonth()]} ${e.getUTCDate()}`}:5*Ui>e?t=>{const e=new Date(t);return`${qi[e.getUTCMonth()]} ${e.getUTCFullYear()}`}:t=>new Date(t).getUTCFullYear()+""}function Ji(t){if(!t)return;const e=[];for(const i of t)if("point"===i.type)e.push(i);else if("symbol"===i.type)e.push({pointId:i.pointId,x:i.x,y:i.y,r:se(i.size)});else if("glyph"===i.type){const t=fe(i.glyph,i.size);e.push({pointId:i.pointId,x:i.x+t.centerDx,y:i.y+t.centerDy,r:t.radius})}return e}import{area as Zi,line as Qi}from"d3-shape";function to(t,e){const i=ee(e.curve);if(!i||2>e.topPath.length||2>e.bottomPath.length){t.beginPath(),t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let i=1;e.topPath.length>i;i++)t.lineTo(e.topPath[i][0],e.topPath[i][1]);for(let i=e.bottomPath.length-1;i>=0;i--)t.lineTo(e.bottomPath[i][0],e.bottomPath[i][1]);t.closePath()}else{const o=Zi().x(t=>t[0]).y0((t,i)=>e.bottomPath[i][1]).y1(t=>t[1]).curve(i).context(t);t.beginPath(),o(e.topPath)}}function eo(t,e){const i=ee(e.curve);if(t.beginPath(),i)Qi().x(t=>t[0]).y(t=>t[1]).curve(i).context(t)(e.topPath);else{t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let i=1;e.topPath.length>i;i++)t.lineTo(e.topPath[i][0],e.topPath[i][1])}}var io=(t,e,i,o)=>{const s=e.filter(t=>"area"===t.type);for(const e of s){if(2>e.topPath.length)continue;let i=!1;e.clipRect&&(t.save(),t.beginPath(),t.rect(e.clipRect.x,e.clipRect.y,e.clipRect.width,e.clipRect.height),t.clip(),i=!0);const s=e._introClipFraction;void 0!==s&&1>s&&(t.save(),t.beginPath(),t.rect(0,0,o.width*s,o.height),t.clip());const n=te(t,e.style.fill,"#4e79a7"),r=e._decayOpacities,a=!(!e.colorThresholds?.length||!e.rawValues||e.rawValues.length!==e.topPath.length),l=!!e.strokeColorBands?.length;if(r&&r.length===e.topPath.length&&!a&&!l){const i=e.style.fillOpacity??.7;t.fillStyle=n;for(let o=0;e.topPath.length-1>o;o++)t.globalAlpha=.5*(r[o]+r[o+1])*i,t.beginPath(),t.moveTo(e.topPath[o][0],e.topPath[o][1]),t.lineTo(e.topPath[o+1][0],e.topPath[o+1][1]),t.lineTo(e.bottomPath[o+1][0],e.bottomPath[o+1][1]),t.lineTo(e.bottomPath[o][0],e.bottomPath[o][1]),t.closePath(),t.fill();if(e.style.stroke&&"none"!==e.style.stroke){t.strokeStyle=Qt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]);for(let i=0;e.topPath.length-1>i;i++)t.globalAlpha=.5*(r[i]+r[i+1]),t.beginPath(),t.moveTo(e.topPath[i][0],e.topPath[i][1]),t.lineTo(e.topPath[i+1][0],e.topPath[i+1][1]),t.stroke()}t.globalAlpha=1;continue}const c=e.style.opacity??1;if(to(t,e),e.fillGradient&&e.fillGradient.stops.length>=2&&e.fillGradient){let i=1/0;for(const t of e.topPath)i>t[1]&&(i=t[1]);let o=-1/0;for(const t of e.bottomPath)t[1]>o&&(o=t[1]);const s=Wt(t,e.fillGradient,"string"==typeof n?n:"#4e79a7",0,i,0,o);t.fillStyle=s||n,t.globalAlpha=c}else t.globalAlpha=(e.style.fillOpacity??.7)*c,t.fillStyle=n;if(t.fill(),e._pulseIntensity&&e._pulseIntensity>0&&(to(t,e),rt(t,e)),e.style.stroke&&"none"!==e.style.stroke){t.globalAlpha=c;const i=Qt(t,e.style.stroke)||e.style.stroke,o=a||l||!e.strokeGradient||2>e.topPath.length?null:Tt(t,e.strokeGradient,i,e.topPath[0][0],0,e.topPath[e.topPath.length-1][0],0);if(t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]),l){let o=1/0,s=-1/0;for(const[t]of e.topPath)o=Math.min(o,t),s=Math.max(s,t);const n=t.lineWidth;for(const r of e.strokeColorBands){t.save(),t.beginPath(),t.rect(o-n,r.y,s-o+2*n,r.height),t.clip();const a=r.color??i;t.strokeStyle=Qt(t,a)||a,eo(t,e),t.stroke(),t.restore()}}else if(a){const o=Ot(e.topPath,e.rawValues,e.colorThresholds,i);for(const e of o){t.beginPath(),t.strokeStyle=Qt(t,e.color)||e.color,t.moveTo(e.path[0][0],e.path[0][1]);for(let i=1;e.path.length>i;i++)t.lineTo(e.path[i][0],e.path[i][1]);t.stroke()}}else t.strokeStyle=o||i,eo(t,e),t.stroke()}void 0!==s&&1>s&&t.restore(),i&&t.restore(),t.globalAlpha=1}};function oo(t){const[e,i,o]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*i+.114*o>128?"#000":"#fff"}function so(t){return Number.isInteger(t)?t+"":100>Math.abs(t)?1>Math.abs(t)?t.toPrecision(3):t.toFixed(1):t.toFixed(0)}var no=(t,e,i,o)=>{const s=e.filter(t=>"heatcell"===t.type);t.save();try{for(const e of s){const i=e.style;null!=i?.opacity&&(t.globalAlpha=i.opacity),t.fillStyle=e.fill,t.fillRect(e.x,e.y,e.w,e.h);const o=Math.max(0,i?.strokeWidth??1);if(o>0&&(t.strokeStyle=Qt(t,i?.stroke??"var(--semiotic-surface, #fff)"),t.lineWidth=o,t.strokeRect(e.x,e.y,e.w,e.h)),at(t,e),t.globalAlpha=1,e.showValues&&null!=e.value){if(20>e.w||20>e.h)continue;const i=e.valueFormat?e.valueFormat(e.value):so(e.value),o=Math.max(10,Math.min(16,.3*Math.min(e.w,e.h))),s=e.x+e.w/2,n=e.y+e.h/2;t.fillStyle=oo(e.fill),t.font=o+"px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(i,s,n)}}}finally{t.restore()}},ro=(t,e,i,o)=>{for(const i of e){if("candlestick"!==i.type)continue;const e=i;t.save();const s=(e._decayOpacity??1)*(e.style?.opacity??1);1!==s&&(t.globalAlpha=s);const n=Qt(t,e.wickColor)||e.wickColor,r=60>o.height,a=r?Math.max(e.wickWidth,2):e.wickWidth,l=()=>{t.beginPath(),t.moveTo(e.x,e.highY),t.lineTo(e.x,e.lowY),t.strokeStyle=n,t.lineWidth=a,t.stroke()};if(r||l(),e.isRange){const i=e.dotRadius??Math.max(2,Math.min(e.bodyWidth/2,.12*o.height));t.fillStyle=n,t.beginPath(),t.arc(e.x,e.highY,i,0,2*Math.PI),t.fill(),t.beginPath(),t.arc(e.x,e.lowY,i,0,2*Math.PI),t.fill()}else if(e.bodyWidth>0){const i=Math.min(e.openY,e.closeY),o=Math.abs(e.openY-e.closeY),s=e.isUp?e.upColor:e.downColor,n=Qt(t,s)||s;t.fillStyle=n,t.fillRect(e.x-e.bodyWidth/2,i,e.bodyWidth,Math.max(o,1)),t.strokeStyle=n,t.lineWidth=1,t.strokeRect(e.x-e.bodyWidth/2,i,e.bodyWidth,Math.max(o,1))}r&&l(),t.restore()}},ao={line:[io,t,O],area:[io,O],stackedarea:[io,O],scatter:[O,k],bubble:[O,k],heatmap:[no],bar:[r],swarm:[O],waterfall:[(t,e,i,o)=>{r(t,e,i,o);const s=e.filter(t=>"rect"===t.type);if(2>s.length)return;const n=s[0].datum,a=n?._connectorStroke;if(a){t.save(),t.strokeStyle=Qt(t,a)||a,t.lineWidth=n?._connectorWidth??1,t.setLineDash([]);for(let e=0;s.length-1>e;e++){const o=s[e],n=s[e+1],r=o.datum,a=n.datum;if(null==r?.cumEnd||null==a?.baseline)continue;const l=i.y(r.cumEnd),c=o.x+o.w,h=n.x;t.beginPath(),t.moveTo(c,l),t.lineTo(h,l),t.stroke()}t.restore()}}],candlestick:[ro],mixed:[io,t,O],custom:[io,r,no,t,O,k,it,ro]};import{jsx as lo,jsxs as co}from"react/jsx-runtime";function ho(t){return null==t?"":"number"==typeof t?Number.isInteger(t)?t+"":t.toFixed(2):t instanceof Date?t.toLocaleString():t+""}function uo({hover:t}){const e=t.data??{},i=e.y??e.value,o=e.x??e.time;if(void 0===i&&void 0===o){const t=oe(e);if(null!=t.title||t.entries.length>0)return co("div",{className:"semiotic-tooltip",style:zt,children:[null!=t.title&&lo("div",{style:{fontWeight:600,marginBottom:t.entries.length?2:0},children:t.title+""}),t.entries.map(t=>co("div",{style:{opacity:.7,fontSize:11},children:[t.key,":"," ",lo("span",{style:{fontWeight:600},children:ho(t.value)})]},t.key))]})}return co("div",{className:"semiotic-tooltip",style:zt,children:[lo("div",{style:{fontWeight:600,marginBottom:2},children:ho(i)}),lo("div",{style:{opacity:.7,fontSize:11},children:ho(o)})]})}uo.ownsChrome=!0;import{jsx as go,jsxs as fo}from"react/jsx-runtime";var po={top:20,right:20,bottom:30,left:40},yo=Hi;function mo(t){if(t)return"x"===t.dimension?"pan-y":"y"===t.dimension?"pan-x":"none"}var xo=Me(_e(function(t,i){const{chartType:o,runtimeMode:n,data:r,chunkThreshold:a,chunkSize:c,xAccessor:h,yAccessor:u,accessorRevision:g,colorAccessor:d,sizeAccessor:f,symbolAccessor:p,symbolMap:y,groupAccessor:k,lineDataAccessor:w,curve:A,normalize:C,baseline:_,stackOrder:M,binSize:S,valueAccessor:P,arrowOfTime:Y="right",windowMode:T="sliding",windowSize:N=200,timeAccessor:W,xExtent:O,yExtent:E,extentPadding:F=.1,scalePadding:I,sizeRange:X,size:$=[500,300],responsiveWidth:q,responsiveHeight:U,margin:K,className:Z,background:Q,renderMode:tt,lineStyle:et,pointStyle:it,areaStyle:ot,barStyle:st,waterfallStyle:rt,swarmStyle:at,barColors:ft,colorScheme:yt,boundsAccessor:wt,boundsStyle:At,y0Accessor:Ct,band:Pt,gradientFill:Yt,lineGradient:Rt,semanticLineStops:Tt,areaGroups:Wt,openAccessor:Ot,highAccessor:Dt,lowAccessor:Lt,closeAccessor:Bt,candlestickStyle:zt,showAxes:Vt=!0,axes:jt,xLabel:qt,yLabel:Jt,yLabelRight:Zt,xFormat:Qt,yFormat:te,axisExtent:ee,tickFormatTime:ie,tickFormatValue:oe,hoverAnnotation:se,tooltipContent:ne,customHoverBehavior:re,customClickBehavior:ae,onObservation:ge,annotationObservationCallback:fe,chartId:_e,enableHover:Me,hoverRadius:Se=30,tooltipMode:Pe,annotations:Ye,onAnnotationActivate:Re,autoPlaceAnnotations:Ne,svgAnnotationRules:We,showGrid:Oe,legend:Ee,legendHoverBehavior:De,legendClickBehavior:Le,legendHighlightedCategory:Be,legendIsolatedCategories:ze,legendPosition:Fe,legendLayout:Ie,legendCategoryAccessor:Xe,onCategoriesChange:$e,backgroundGraphics:Ve,foregroundGraphics:Ge,canvasPreRenderers:He,svgPreRenderers:je,title:qe,categoryAccessor:Ue,brush:Ke,onBrush:Je,decay:Ze,pulse:Qe,transition:ti,animate:ei,staleness:ii,frameScheduler:oi,clock:si,random:ni,seed:ri,paused:ai=!1,suspendWhenHidden:li=!0,heatmapAggregation:hi,heatmapXBins:ui,heatmapYBins:pi,showValues:yi,heatmapValueFormat:mi,marginalGraphics:xi,pointIdAccessor:vi,xScaleType:bi,yScaleType:ki,accessibleTable:wi=!0,description:Ai,summary:_i,linkedCrosshairName:Mi,linkedCrosshairSourceId:Si,customLayout:Pi,onLayoutError:Yi,layoutConfig:Ri,layoutSelection:Ti}=t,{customHoverBehavior:Ni,customClickBehavior:Wi,hasClickBehavior:Oi}=B({customHoverBehavior:re,customClickBehavior:ae,onObservation:ge,chartId:_e,chartType:"StreamXYFrame"}),Ei=Ce().replace(/:/g,""),Di=xe(!1),Li=xe({w:-1,h:-1}),Bi=xe(!1),zi=le({sizeProp:$,responsiveWidth:q,responsiveHeight:U,userMargin:K,marginDefault:po,title:qe,legend:Ee,legendPosition:Fe,animate:ei,transitionProp:ti,frameScheduler:oi,clock:si,random:ni,seed:ri,paused:ai,suspendWhenHidden:li,themeDirtyRef:Di}),Fi=pe(),Ii=ye(),{reducedMotionRef:$i,responsiveRef:Vi,size:qi,currentTheme:Ui,transition:Zi,introEnabled:Qi,tableId:to,rafRef:eo,renderFnRef:io,scheduleRender:oo,frameRuntime:so}=zi;let no=zi.margin;if(xi){const t=60,e={...zi.margin};xi.top&&t>e.top&&(e.top=t),xi.bottom&&t>e.bottom&&(e.bottom=t),xi.left&&t>e.left&&(e.left=t),xi.right&&t>e.right&&(e.right=t),no=e}const ro=qi[0]-no.left-no.right,lo=qi[1]-no.top-no.bottom,co=ke(()=>Ft(r),[r]),ho=se??Me,[xo,vo]=ve(0),bo=xe(0),[ko,wo]=ve(null),Ao=b(Ge,qi,no,ko),Co=b(Ve,qi,no,ko),_o=xe(null),Mo=xe(null),So=xe(void 0),[Po,Yo]=ve(null),Ro=xe(yo.primary),To=xe(function(){let t=-1,e=Hi;return{resolve(i){if(!i)return Hi;const o=It();return o===t||(e=function(t){if(!t)return Hi;const e=getComputedStyle(t),i=e.getPropertyValue("--semiotic-border").trim(),o=e.getPropertyValue("--semiotic-text-secondary").trim(),s=e.getPropertyValue("--semiotic-bg").trim(),n=e.getPropertyValue("--semiotic-primary").trim(),r=o||e.getPropertyValue("--text-secondary").trim(),a=e.getPropertyValue("--text-primary").trim(),l=i||e.getPropertyValue("--surface-3").trim(),c=s||e.getPropertyValue("--surface-0").trim();return r||a||i||n?{axisStroke:l||Hi.axisStroke,tickText:r||Hi.tickText,crosshair:r?ji(r,"66"):Hi.crosshair,hoverFill:c?ji(c,"4D"):Hi.hoverFill,hoverStroke:r?ji(r,"99"):Hi.hoverStroke,pointRing:c||Hi.pointRing,primary:n||Hi.primary,background:c||Hi.background}:Hi}(i),t=o),e},invalidate(){t=-1}}}()),No=xe(!1),Wo=he("StreamXYFrame"),[Oo,Eo]=ve(!1),[Do,Lo]=ve([]),[Bo,zo]=ve([]),Fo="streaming"===n||["bar","swarm","waterfall"].includes(o),Io=ke(()=>({chartType:o,runtimeMode:Fo?"streaming":"bounded",windowSize:N,windowMode:T,arrowOfTime:Fo?Y:"right",extentPadding:F,scalePadding:I,axisExtent:ee,xAccessor:h,yAccessor:u,accessorRevision:g,timeAccessor:Fo?W:void 0,valueAccessor:P,colorAccessor:d,sizeAccessor:f,symbolAccessor:p,symbolMap:y,groupAccessor:k||(w?"_lineGroup":void 0),categoryAccessor:Ue,lineDataAccessor:w,xScaleType:bi,yScaleType:ki,xExtent:O,yExtent:E,sizeRange:X,binSize:S,normalize:C,baseline:_,stackOrder:M,boundsAccessor:wt,boundsStyle:At,y0Accessor:Ct,band:Pt,gradientFill:x(Yt),areaGroups:Wt?new Set(Wt):void 0,lineGradient:m(Rt),semanticLineStops:Tt,openAccessor:Ot,highAccessor:Dt,lowAccessor:Lt,closeAccessor:Bt,candlestickStyle:zt,lineStyle:et,pointStyle:it,areaStyle:ot,swarmStyle:at,waterfallStyle:rt,colorScheme:yt,barColors:ft,barStyle:st,annotations:Ye,decay:Ze,pulse:Qe,transition:Zi,introAnimation:Qi,staleness:ii,clock:so.now,heatmapAggregation:hi,heatmapXBins:ui,heatmapYBins:pi,showValues:yi,heatmapValueFormat:mi,pointIdAccessor:vi,curve:A,themeCategorical:Ui?.colors?.categorical,themeSemantic:de(Ui),themeSequential:Ui?.colors?.sequential,themeDiverging:Ui?.colors?.diverging,customLayout:Pi,onLayoutError:Yi,layoutConfig:Ri,layoutMargin:no}),[o,Fo,N,T,Y,F,I,ee,h,u,g,W,P,d,f,p,y,k,w,Ue,bi,ki,O,E,X,S,C,_,M,wt,At,Ct,Pt,Yt,Wt,Rt,Tt,Ot,Dt,Lt,Bt,zt,et,it,ot,at,rt,yt,ft,st,Ye,Ze,Qe,Zi,Qi,ii,so.now,hi,ui,pi,yi,mi,vi,A,Ui,Pi,Yi,Ri,no]),Xo=gt(Io),$o=xe(null);$o.current||($o.current=new ci(Xo));const Vo=L($o,Xe,$e,t=>t.getData());ht($o,Xo,Di,oo),ut($o,Ti,Di,oo);const Go=xe(null);Go.current||(Go.current=new s(t=>{const e=$o.current;e&&e.ingest(t)&&(Di.current=!0,oo())},{chunkThreshold:a,chunkSize:c})),be(()=>{Go.current?.updateChunkOptions({chunkThreshold:a,chunkSize:c})},[a,c]);const Ho=we(t=>{Go.current?.push(t)},[]),jo=we(t=>{Go.current?.pushMany(t)},[]),qo=we(()=>{Go.current?.clear(),$o.current?.clear(),Di.current=!0,oo()},[oo]);Ae(i,()=>({push:Ho,pushMany:jo,remove:t=>{Go.current?.flush();const e=$o.current?.remove(t)??[];return e.length>0&&(_o.current&&e.some(t=>t===_o.current?.data)&&(_o.current=null,Yo(null)),Di.current=!0,oo()),e},update:(t,e)=>{Go.current?.flush();const i=$o.current?.update(t,e)??[];return i.length>0&&(Di.current=!0,oo()),i},clear:qo,getData:()=>(Go.current?.flush(),$o.current?.getData()??[]),getScales:()=>$o.current?.scales??null,getExtents:()=>$o.current?.getExtents()??null,getCustomLayout:()=>$o.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>$o.current?.lastCustomLayoutFailure??null}),[Ho,jo,qo,oo]),be(()=>{if(r){if(w&&co.length>0&&"object"==typeof co[0]&&null!==co[0]){const t="string"==typeof w?w:"coordinates";if(Array.isArray(co[0][t])){const e=[];for(const i of co){const o=i[t];if(Array.isArray(o)){const t=i.label||i.id||i.key;if(null!=t)for(const i of o)e.push({...i,_lineGroup:t});else for(const t of o)e.push(t)}}return void Go.current?.setBoundedData(e)}}Go.current?.setBoundedData(co)}},[r,co,w]);const{canvasRef:Uo,interactionCanvasRef:Ko}=ce(zi,{storeRef:$o,dirtyRef:Di,hydrated:Fi,wasHydratingFromSSR:Ii,cleanup:()=>Go.current?.clear(),canvasPaintDependencies:[o,ro,lo,Vt,Q,Ve,et,tt,He,oo]}),{hoverHandlerRef:Jo,hoverLeaveRef:Zo,onPointerMove:Qo,onPointerLeave:ts}=zi;Jo.current=t=>{if(!ho)return;const e=Uo.current;if(!e)return;const i=e.getBoundingClientRect(),s=t.clientX-i.left-no.left,n=t.clientY-i.top-no.top;if(0>s||s>ro||0>n||n>lo)return void(_o.current&&(_o.current=null,Mo.current=null,Yo(null),Ni&&(Ni(null),Di.current=!0),oo()));const r=$o.current;if(!r||0===r.scene.length)return;const a=$t(Se,t.pointerType),l=di(r.scene,s,n,a,r.quadtree,r.maxPointRadius),c="multi"===Pe,u=()=>{_o.current&&(_o.current=null,Mo.current=null,Yo(null),Ni&&Ni(null),oo())};if(!l&&!c)return void u();const g=c||!l?s:l.x,d=c||!l?n:l.y,f=l?.datum?R(l.datum,r.resolvedRibbons):{},p=r.scales?.x?.invert,y="function"==typeof p?p(g):void 0;let m=Nt(f,g,d,null!=y?{xValue:y,xPx:g}:void 0);if(c&&r.scene.length>0&&r.scales){const t=function(t,e,i=30){const o=[];for(const s of t)if("line"===s.type){const t=s;if(2>t.path.length)continue;const n=fi(gi(t.path,t.curve),e,i);if(null===n)continue;const r=Ci(t.path,e);o.push({node:s,datum:Array.isArray(t.datum)&&t.datum[r]?t.datum[r]:t.datum,x:t.path[r][0],y:n,group:t.group,color:t.style.stroke})}else if("area"===s.type){const t=s;if(!1===t.interactive)continue;if(2>t.topPath.length)continue;const n=gi(t.topPath,t.curve),r=gi(t.bottomPath,t.curve),a=fi(n,e,i);if(null===a)continue;const l=fi(r,e,i),c=Ci(t.topPath,e);o.push({node:s,datum:Array.isArray(t.datum)&&t.datum[c]?t.datum[c]:t.datum,x:t.topPath[c][0],y:a,y0:l??void 0,group:t.group,color:"string"==typeof t.style.stroke?t.style.stroke:"string"==typeof t.style.fill?t.style.fill:void 0})}return o}(r.scene,g,Math.max(a,ro));if(t.length>0){const e=r.scales.y.invert,i=Ro.current,s=p?p(g):g;if(l)m.xValue=s,m.xPx=g;else{const t={xValue:s};"string"==typeof h&&(t[h]=s),m=Nt(t,g,d,{xValue:s,xPx:g})}m.allSeries=t.map(t=>{const s=e?e(t.y):t.y,n=null!=t.y0?e?e(t.y0):t.y0:void 0;return{group:t.group||"",value:"stackedarea"===o&&null!=n?s-n:s,valuePx:t.y,color:t.color||i,datum:R(t.datum,r.resolvedRibbons)}})}}l||m.allSeries?.length?(_o.current=m,Mo.current=l?.node??null,Yo(m),Ni&&(Ni(m),Di.current=!0),oo()):u()},Zo.current=()=>{_o.current&&(_o.current=null,Mo.current=null,Yo(null),Ni&&(Ni(null),Di.current=!0),oo())};const es=xe(()=>{});es.current=t=>{if(Gt(t.target))return;if(!Wi)return;const e=Uo.current;if(!e)return;const i=e.getBoundingClientRect(),o=t.clientX-i.left-no.left,s=t.clientY-i.top-no.top;if(0>o||o>ro||0>s||s>lo)return void Wi(null);const n=$o.current;if(!n||0===n.scene.length)return void Wi(null);const r=$t(Se,So.current),a=di(n.scene,o,s,r,n.quadtree,n.maxPointRadius);if(!a)return void Wi(null);const l=a.datum||{},c=n.scales?.x?.invert,h="function"==typeof c?c(a.x):void 0;Wi(Nt(l,a.x,a.y,null!=h?{xValue:h,xPx:a.x}:void 0),{type:"activate",inputType:Ut(So.current)})};const is=we(t=>es.current(t),[]),{kbFocusIndexRef:os,focusedNavPointRef:ss,onKeyDown:ns}=z({storeRef:$o,hoverRef:_o,hoveredNodeRef:Mo,setHoverPoint:Yo,customHoverBehavior:Ni,customClickBehavior:Wi,scheduleRender:oo}),rs=we(t=>{So.current=t.pointerType,os.current=-1,ss.current=null,Qo(t)},[ss,os,Qo]),as=we(t=>{So.current="mouse",os.current=-1,ss.current=null,Qo({clientX:t.clientX,clientY:t.clientY,pointerType:"mouse"})},[ss,os,Qo]),ls=we(t=>{So.current=t.pointerType},[]);io.current=()=>{if(eo.current=null,!so.isActive)return;const t=Uo.current,i=Ko.current;if(!t||!i)return;const s=$o.current;if(!s)return;const n=so.now(),r=s.advanceTransition($i.current?n+1e6:n),a=!$i.current&&r,l=Li.current.w!==ro||Li.current.h!==lo,c=Di.current||r||l,g=s.consumeStylePaintPending();let d=!1;const f=s.getLastUpdateResult(),p=Wo.current.beforeCompute(f,a);!c||a&&!l||(s.computeScene({width:ro,height:lo}),Li.current={w:ro,h:lo},d=!0,Vo()),Wo.current.afterCompute(p,d,l);const y=D(s,n,d,Bi),m=Xt(),x=To.current.resolve(t);Ro.current=x.primary;const v=ct(ii,s.lastIngestTime>0?n-s.lastIngestTime:0),b=ii&&v.isStale;if(c||g||y.changed){const e=Kt(t,qi,no,m);if(e){if(e.clearRect(-no.left,-no.top,qi[0],qi[1]),ii&&1>v.alpha&&(e.globalAlpha=v.alpha),G(e,{background:Q,hasBackgroundGraphics:!!Ve,themeBackground:x.background,x:-no.left,y:-no.top,width:qi[0],height:qi[1]}),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,ro,lo),e.clip()),He&&s.scales)for(const t of He)e.save(),t(e,s.scene,s.scales,{width:ro,height:lo}),e.restore();const t=Pi?ao.custom:ao[o];nt({context:e,nodes:s.scene,renderMode:tt,pixelRatio:m,paintBuiltIn:i=>{if(t&&s.scales)for(const o of t)o(e,i,s.scales,{width:ro,height:lo})}}),e.restore(),ii&&1>v.alpha&&(e.globalAlpha=1)}}const k=!!(ho&&_o.current&&s.scales),w=!!(Mo.current&&Array.isArray(se)&&se.some(t=>t&&"object"==typeof t&&"highlight"===t.type)),A=k||w;if(V(A,No.current)){const t=Kt(i,qi,no,m);if(t&&(t.clearRect(-no.left,-no.top,qi[0],qi[1]),k&&_o.current&&function(t,i,o,s,n,r,a){if(!1===n.crosshair)return;const l=i.allSeries,c=l&&l.length>0,h=i.xPx??i.x;t.save();const u="object"==typeof n.crosshair?n.crosshair:{};if(t.strokeStyle=u.stroke||a.crosshair,t.lineWidth=u.strokeWidth||1,t.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),t.beginPath(),t.moveTo(c?h:i.x,0),t.lineTo(c?h:i.x,s),t.stroke(),c||(t.beginPath(),t.moveTo(0,i.y),t.lineTo(o,i.y),t.stroke()),t.restore(),c){t.lineWidth=2,t.strokeStyle=a.pointRing;for(const e of l)null!=e.valuePx&&(t.beginPath(),t.arc(h,e.valuePx,4,0,2*Math.PI),t.fillStyle=e.color||a.primary,t.fill(),t.stroke())}else{const o=n.pointColor||e(r)||a.primary;t.beginPath(),t.arc(i.x,i.y,4,0,2*Math.PI),t.fillStyle=o,t.fill(),t.strokeStyle=a.pointRing,t.lineWidth=2,t.stroke()}}(t,_o.current,ro,lo,"object"==typeof ho?ho:{},Mo.current,x),w&&Mo.current&&Array.isArray(se))){const e=se.find(t=>t&&"object"==typeof t&&"highlight"===t.type);e&&function(t,e,i,o,s){if(!i)return;const n="group"in i?i.group:void 0;if(void 0!==n)for(const i of e){if("line"!==i.type)continue;if(i.group!==n)continue;if(2>i.path.length)continue;const e="function"==typeof o.style?i.datum?o.style(i.datum):{}:o.style||{};t.save(),t.beginPath(),t.moveTo(i.path[0][0],i.path[0][1]);for(let e=1;i.path.length>e;e++)t.lineTo(i.path[e][0],i.path[e][1]);t.strokeStyle=e.stroke||i.style.stroke||s.primary,t.lineWidth=e.strokeWidth||(i.style.strokeWidth||2)+2,t.globalAlpha=e.opacity??1,t.stroke(),t.restore()}}(t,s.scene,Mo.current,e,x)}No.current=A}c&&t&&t.setAttribute("aria-label",Et(s.scene,o+" chart"));const C=Di.current;if(Di.current=C&&a&&!d,C&&s.scales){const t=t=>"object"==typeof t&&null!==t&&"function"==typeof t.valueOf?t.valueOf():t;if((!ko||t(ko.x.domain()[0])!==t(s.scales.x.domain()[0])||t(ko.x.domain()[1])!==t(s.scales.x.domain()[1])||t(ko.y.domain()[0])!==t(s.scales.y.domain()[0])||t(ko.y.domain()[1])!==t(s.scales.y.domain()[1])||ko.x.range()[0]!==s.scales.x.range()[0]||ko.x.range()[1]!==s.scales.x.range()[1]||ko.y.range()[0]!==s.scales.y.range()[0]||ko.y.range()[1]!==s.scales.y.range()[1])&&wo(s.scales),xi){const t=s.getData(),e="function"==typeof h?h:t=>t[h||"x"],i="function"==typeof u?u:t=>t[u||"y"];Lo(t.map(t=>e(t)).filter(t=>"number"==typeof t&&isFinite(t))),zo(t.map(t=>i(t)).filter(t=>"number"==typeof t&&isFinite(t)))}}!((Ye&&Ye.length>0||Pi)&&(d||a))||!d&&33>n-bo.current||(vo(t=>t+1),bo.current=n),ii?.showBadge&&Eo(!!b),(a||null!=s.activeTransition||y.pending)&&oo()},dt(ii,$o,Di,oo,Oo,Eo);const cs=ke(()=>{if(Qt||ie)return;const t=$o.current;return t?.xIsDate&&ko?Ki(ko.x.domain()):void 0},[Qt,ie,ko]),hs=Qt||ie||cs,us=ho&&Po?ne?ne(Po):go(uo,{hover:Po}):null,gs=us?go(bt,{x:Po.x,y:Po.y,containerWidth:ro,containerHeight:lo,margin:no,className:"stream-frame-tooltip",children:us}):null,ds=ss.current,fs=go(kt,{active:os.current>=0,hoverPoint:Po,margin:no,size:qi,shape:ds?.shape,width:ds?.w,height:ds?.h}),ps=v(h,W,"__semiotic_resolvedX","__semiotic_resolvedTime"),ys=v(u,P,"__semiotic_resolvedY","__semiotic_resolvedValue"),ms=ps.key,xs=ys.key,vs=l(ps,ys,Ye&&Ye.length>0||!1);if(Ht||!Fi&&Ii){const t=$o.current;t&&r&&(t.ingest({inserts:co,bounded:!0}),t.computeScene({width:ro,height:lo}));const e=t?.scene??[],i=t?.scales??null,o=b(Ge,qi,no,i),s=b(Ve,qi,no,i),n=hs||(()=>{if(t?.xIsDate&&i)return Ki(i.x.domain())})();return fo("div",{ref:Vi,className:"stream-xy-frame"+(Z?" "+Z:""),role:"img","aria-label":Ai||("string"==typeof qe?qe:"XY chart"),style:{position:"relative",width:q?"100%":qi[0],height:U?"100%":qi[1]},children:[go(Mt,{summary:_i}),fo("svg",{xmlns:"http://www.w3.org/2000/svg",width:qi[0],height:qi[1],style:{position:"absolute",left:0,top:0},children:[go("g",{transform:`translate(${no.left},${no.top})`,children:s}),fo("g",{transform:`translate(${no.left},${no.top})`,children:[Q&&go("rect",{x:0,y:0,width:ro,height:lo,fill:Q}),je&&i&&je.map((t,o)=>go(me.Fragment,{children:t(e,i,{width:ro,height:lo})},"svgpre-"+o)),e.map((t,e)=>lt({node:t,index:e,renderMode:tt,fallback:()=>ue(t,e,Ei)})).filter(Boolean)]})]}),go(Gi,{width:ro,height:lo,totalWidth:qi[0],totalHeight:qi[1],margin:no,scales:i,showAxes:Vt,axes:jt,xLabel:qt,yLabel:Jt,yLabelRight:Zt,xFormat:n,yFormat:te||oe,axisExtent:ee,showGrid:Oe,title:qe,legend:Ee,legendHoverBehavior:De,legendClickBehavior:Le,legendHighlightedCategory:Be,legendIsolatedCategories:ze,legendPosition:Fe,legendLayout:Ie,foregroundGraphics:J(o,pt($o.current?.customLayoutOverlays,Ti??null)),marginalGraphics:xi,xValues:[],yValues:[],annotations:Ye,onAnnotationActivate:Re,onObservation:fe??ge,chartId:_e,chartType:"StreamXYFrame",autoPlaceAnnotations:Ne,svgAnnotationRules:We,annotationFrame:0,xAccessor:ms,yAccessor:xs,annotationData:vs($o.current?.getData()),pointNodes:Ji($o.current?.scene),curve:"string"==typeof A?A:void 0,linkedCrosshairName:Mi,linkedCrosshairSourceId:Si})]})}return fo("div",{ref:Vi,className:"stream-xy-frame"+(Z?" "+Z:""),role:"group","aria-label":Ai||("string"==typeof qe?qe:"XY chart"),tabIndex:0,style:{position:"relative",width:q?"100%":qi[0],height:U?"100%":qi[1],overflow:"visible",touchAction:mo(Ke)},onKeyDown:ns,children:["production"!==process.env.NODE_ENV&&$o.current&&go(_t,{store:$o.current,diagnostics:Wo.current}),wi&&go(St,{tableId:to}),wi&&go(mt,{scene:$o.current?.scene??[],chartType:o+" chart",tableId:to,chartTitle:"string"==typeof qe?qe:void 0}),go(Mt,{summary:_i}),go(xt,{hoverPoint:Po}),fo("div",{role:"img","aria-label":Ai||("string"==typeof qe?qe:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:ho?rs:void 0,onMouseMove:ho?as:void 0,onPointerLeave:ho?ts:void 0,onMouseLeave:ho?ts:void 0,onPointerDown:ho||Oi?ls:void 0,onClick:Oi?is:void 0,children:[go(vt,{size:qi,margin:no,children:Co}),go(Xi,{width:ro,height:lo,totalWidth:qi[0],totalHeight:qi[1],margin:no,scales:ko,showAxes:Vt,axes:jt,showGrid:Oe,xFormat:hs,yFormat:te||oe,axisExtent:ee}),go("canvas",{ref:Uo,"aria-label":Et($o.current?.scene??[],o+" chart"),style:{position:"absolute",left:0,top:0}}),go("canvas",{ref:Ko,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),go(Gi,{width:ro,height:lo,totalWidth:qi[0],totalHeight:qi[1],margin:no,scales:ko,showAxes:Vt,axes:jt,xLabel:qt,yLabel:Jt,yLabelRight:Zt,xFormat:hs,yFormat:te||oe,axisExtent:ee,showGrid:Oe,title:qe,legend:Ee,legendHoverBehavior:De,legendClickBehavior:Le,legendHighlightedCategory:Be,legendIsolatedCategories:ze,legendPosition:Fe,legendLayout:Ie,foregroundGraphics:J(Ao,pt($o.current?.customLayoutOverlays,Ti??null)),marginalGraphics:xi,xValues:Do,yValues:Bo,annotations:Ye,onAnnotationActivate:Re,onObservation:fe??ge,chartId:_e,chartType:"StreamXYFrame",autoPlaceAnnotations:Ne,svgAnnotationRules:We,annotationFrame:xo,xAccessor:ms,yAccessor:xs,annotationData:vs($o.current?.getData()),pointNodes:Ji($o.current?.scene),curve:"string"==typeof A?A:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!H({background:Q,hasBackgroundGraphics:!!Ve,themeBackground:Ui?.colors.background}),linkedCrosshairName:Mi,linkedCrosshairSourceId:Si}),(Ke||Je)&&go(Te,{width:ro,height:lo,totalWidth:qi[0],totalHeight:qi[1],margin:no,dimension:Ke?.dimension??"xy",scales:ko,onBrush:Je??(()=>{}),binSize:S,snap:Ke?.snap,binBoundaries:Ke?.binBoundaries??("bar"===o?$o.current?.getBinBoundaries():void 0),snapDuring:Ke?.snapDuring,streaming:"streaming"===n}),ii?.showBadge&&go(j,{isStale:Oo,position:ii.badgePosition}),fs,gs]})]})}));xo.displayName="StreamXYFrame";var vo=xo;export{vo as StreamXYFrame_default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{StreamXYFrame_default as e}from"./chunk-chunk-KXAFCCDB.module.min.js";import{buildCustomBehaviorProps as t}from"./chunk-chunk-NH4MEAKP.module.min.js";import{normalizeLinkedBrush as n,useBrushSelection as i,useChartLegendAndMargin as s,useChartMode as o,useChartSelection as r}from"./chunk-chunk-7ZDJSYKI.module.min.js";import{renderEmptyState as a,renderLoadingState as l}from"./chunk-chunk-ACLDBMRH.module.min.js";var c=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},u=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const n=this.hop,i=Math.floor(e/n);for(let s=Math.floor((e-this.size)/n)+1;i>=s;s++)this.bump(s*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new c,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,i=new c;i.push(t);let s=e,o=e;const r=[],a={start:s,end:o,stats:i};for(const t of this.sessions)e-n>t.end||t.start>e+n?r.push(t):(a.stats.merge(t.stats),s>t.start&&(s=t.start),t.end>o&&(o=t.end));a.start=s,a.end=o,r.push(a),r.sort((e,t)=>e.start-t.start),this.sessions=r}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const i=t+this.size;e.push(this.row(t,i,n,i>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,n,i){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:i}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function m(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}function h(e,t,n,i=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const s=m(e,n),o=e.stddev*i;return[s-o,s+o]}var d={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},p=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function g(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;p.lastIndex=0;let n,i=0,s=0;for(;null!==(n=p.exec(t));){const e=parseFloat(n[1]),t=d[n[2]];if(null==t||!Number.isFinite(e))return null;i+=e*t,s+=n[0].length}return s!==t.length?null:i>0?i:null}var v=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const i of this.held)this.getTime(i)>e?n.push(i):t.push(i);return this.held=n,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}};import{useRef as f,useImperativeHandle as w,forwardRef as y,useCallback as b,useState as x,useEffect as A}from"react";import{jsx as _,jsxs as k}from"react/jsx-runtime";var H={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},S={opacity:.7,marginRight:4};function z(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function C(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function I(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=z(o,t,"time"),a=z(o,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),C(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),C(a)]})]})}}function T(e,t){return null!=e?e:Math.max(t?.length??0,200)}var R="time",P="value",F="__aggLower",M="__aggUpper",N="__aggPartial",D="count",E="__aggStart",B="__aggEnd";function O(e,t){const n=t.stat??"mean",i=t.band??"none",s=t.sigma??1;return e.emit().map(e=>{const t={[R]:(e.start+e.end)/2,[P]:m(e,n),[D]:e.count,[N]:e.partial,[E]:e.start,[B]:e.end},o=h(e,i,n,s);return o&&(t[F]=o[0],t[M]=o[1]),t})}import{jsx as j}from"react/jsx-runtime";function L(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();const s=Number(i);return Number.isFinite(s)?s:null}var W=y(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:m,className:h,arrowOfTime:d="right",windowMode:p="sliding",windowSize:y,data:_,timeAccessor:k,valueAccessor:H,timeExtent:S,valueExtent:z,extentPadding:C,stroke:N="#007bff",strokeWidth:D=2,strokeDasharray:E,opacity:B,background:W,tooltipContent:V,tooltip:$,onHover:K,annotations:X,autoPlaceAnnotations:Y,svgAnnotationRules:q,tickFormatTime:J,tickFormatValue:U,decay:Z,pulse:G,staleness:Q,transition:ee,linkedHover:te,selection:ne,onObservation:ie,chartId:se,loading:oe,loadingContent:re,emptyContent:ae,emphasis:le,legendPosition:ce,aggregate:ue,eventTime:me}=n,he=s.showAxes,de=s.enableHover,pe=m??s.marginDefaults,ge=c??[s.width,s.height],ve=V??$??I({timeAccessor:k,valueAccessor:H}),fe=f(null),{customHoverBehavior:we}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ie,chartType:"RealtimeLineChart",chartId:se}),ye=b(e=>{K&&K(e),we(e)},[K,we]),be=null!=ue,[xe,Ae]=x([]),_e=f(null),ke=f(ue);ke.current=ue;const He=f(be);He.current=be;const Se=f(xe);Se.current=xe;const ze=f({timeAccessor:k,valueAccessor:H});ze.current={timeAccessor:k,valueAccessor:H},A(()=>{if(!be)return void(_e.current=null);const e=ke.current,t=function(e){const t=e.window??"tumbling",n=g("session"===t?e.gap??e.size:e.size);if(null==n)return null;const i=null!=e.hop?g(e.hop):void 0,s=null!=e.gap?g(e.gap):void 0;return new u({window:t,size:n,hop:i??void 0,gap:s??void 0,retain:e.retain})}(e);if(_e.current=t,t&&_){const{timeAccessor:e,valueAccessor:n}=ze.current;for(const i of _){const s=L(i,e,"time"),o=L(i,n,"value");null!=s&&null!=o&&t.push(s,o)}}Ae(t?O(t,e):[])},[be?[ue.window??"tumbling",ue.size,ue.hop??"",ue.gap??"",ue.retain??""].join("|"):"",be,_]),A(()=>{be&&_e.current&&Ae(O(_e.current,ke.current))},[ue?.stat,ue?.band,ue?.sigma]);const Ce=b(e=>{const t=_e.current,n=ke.current;if(!t||!n)return;const{timeAccessor:i,valueAccessor:s}=ze.current;for(const n of e){const e=L(n,i,"time"),o=L(n,s,"value");null!=e&&null!=o&&t.push(e,o)}Ae(O(t,n))},[]),Ie=null!=me,Te=f(null),Re=f(me);Re.current=me;const Pe=f(Ie);Pe.current=Ie;const Fe=f(ie);Fe.current=ie;const Me=f(se);Me.current=se,A(()=>{Te.current=Ie?function(e){const t=g(e.lateness);return null==t?null:new v({lateness:t,getTime:e=>L(e,ze.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(Re.current):null},[Ie?`${me.lateness}|${me.latePolicy??"drop"}`:"",Ie]);const Ne=b(e=>{0!==e.length&&(He.current?Ce(e):fe.current?.pushMany(e))},[Ce]),De=b(e=>{const t=Te.current;if(!Pe.current||!t)return void Ne(e);const n=[];for(const i of e){const e=t.push(i);if(e.released.length&&n.push(...e.released),e.late.length){const n=Fe.current;if(n){const{timeAccessor:i}=ze.current,s=Re.current?.latePolicy??"drop";for(const o of e.late)n({type:"late-data",datum:o,eventTime:L(o,i,"time")??NaN,watermark:t.watermark,policy:s,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:Me.current})}}}Ne(n)},[Ne]);w(i,()=>({push:e=>De([e]),pushMany:e=>De(e),remove:e=>He.current?[]:fe.current?.remove(e)??[],update:(e,t)=>He.current?[]:fe.current?.update(e,t)??[],clear:()=>{Te.current?.clear(),He.current?(_e.current?.clear(),Ae([])):fe.current?.clear()},getData:()=>He.current?Se.current:fe.current?.getData()??[],getScales:()=>fe.current?.getScales()??null}),[De]);const Ee=l(oe,ge[0],ge[1],re),Be=Ee?null:a(be?void 0:_,ge[0],ge[1],ae),Oe={stroke:N,strokeWidth:D,strokeDasharray:E};null!=B&&(Oe.opacity=B);const je=T(y,_),Le=be?xe:_,We=be?R:k,Ve=be?P:H,$e=be&&ue&&"none"!==(ue.band??"none")?{y0Accessor:F,y1Accessor:M,perSeries:!1}:void 0;return Ee||Be||j(e,{ref:fe,chartType:"line",runtimeMode:"streaming",size:ge,margin:pe,className:le?`${h||""} semiotic-emphasis-${le}`.trim():h,arrowOfTime:d,windowMode:be?"growing":p,windowSize:be?Math.max(1,ue?.retain??Math.max(xe.length,600)):je,data:Le,timeAccessor:We,valueAccessor:Ve,xExtent:S,yExtent:z,extentPadding:C,band:$e,lineStyle:Oe,showAxes:he,background:W,hoverAnnotation:de,tooltipContent:ve,...t({linkedHover:te,selection:ne,onObservation:ie,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ye}),annotations:X,autoPlaceAnnotations:Y,svgAnnotationRules:q,tickFormatTime:J,tickFormatValue:U,decay:Z,pulse:G,staleness:Q,transition:ee,pointIdAccessor:n.pointIdAccessor,legendPosition:ce})});W.displayName="RealtimeLineChart";import{useRef as V,useImperativeHandle as $,forwardRef as K,useCallback as X,useMemo as Y}from"react";function q(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();if("string"==typeof i&&""===i.trim())return null;const s=Number(i);return Number.isFinite(s)?s:null}import{jsx as J}from"react/jsx-runtime";var U=K(function(c,u){const m=o(c.mode,{width:c.size?.[0]??c.width,height:c.size?.[1]??c.height,showAxes:c.showAxes,showLegend:c.showLegend,enableHover:null!=c.enableHover?!!c.enableHover:void 0,linkedHover:c.linkedHover,mobileInteraction:c.mobileInteraction,mobileSemantics:c.mobileSemantics,responsiveRules:c.responsiveRules}),{binSize:h,size:d,margin:p,className:g,arrowOfTime:v="right",windowMode:f="sliding",windowSize:w,data:y,timeAccessor:b,valueAccessor:x,direction:A="up",timeExtent:I,valueExtent:R,extentPadding:P,categoryAccessor:F,colors:M,fill:N,stroke:D,strokeWidth:E,opacity:B,gap:O,background:j,tooltipContent:L,tooltip:W,onHover:K,annotations:U,autoPlaceAnnotations:Z,svgAnnotationRules:G,tickFormatTime:Q,tickFormatValue:ee,linkedHover:te,selection:ne,decay:ie,pulse:se,staleness:oe,transition:re,onObservation:ae,chartId:le,loading:ce,loadingContent:ue,emptyContent:me,emphasis:he,legendPosition:de,legend:pe,brush:ge,onBrush:ve,linkedBrush:fe}=c,we=m.showAxes,ye=m.enableHover,be=d??[m.width,m.height],xe=Y(()=>M?e=>M[e]??N??"#999":void 0,[M,N]),{legend:Ae,margin:_e,legendPosition:ke}=s({data:y??[],colorBy:F,colorScale:xe,showLegend:m.showLegend,legendPosition:de,userMargin:p,defaults:m.marginDefaults,additionalLegend:pe,chartWidth:be[0],axisChrome:{hasAxis:!1!==m.showAxes}}),He=L??W??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null;if(null==i?.binStart||null==i?.binEnd){const e=z(i,t,"time"),s=z(i,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),C(e)]}),k("div",{children:[_("span",{style:S,children:"y:"}),C(s)]})]})}return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"range:"}),C(i.binStart),"–",C(i.binEnd)]}),null!=i.total&&k("div",{children:[_("span",{style:S,children:"count:"}),C(i.total)]}),null!=i.category&&k("div",{children:[_("span",{style:S,children:"category:"}),C(i.category)]})]})}}({timeAccessor:b,valueAccessor:x}),Se=V(null),{customHoverBehavior:ze}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ae,chartType:"RealtimeHistogram",chartId:le}),Ce=X(e=>{K&&K(e),ze(e)},[K,ze]),Ie=!0===ge?{dimension:"x",snap:"bin"}:"x"===ge?{dimension:"x"}:"object"==typeof ge?ge:void 0,Te=n(fe),Re="string"==typeof b?b:"time",Pe=i({name:Te?.name||"__unused_hist_brush__",xField:Te?.xField||Re,...Te?.yField?{yField:Te.yField}:{}}),Fe=V(Pe.brushInteraction);Fe.current=Pe.brushInteraction;const Me=X(e=>{if(ve&&ve(e),ae&&ae(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}),Te){const t=Fe.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[ve,ae,le,Te]);$(u,()=>({push:e=>Se.current?.push(e),pushMany:e=>Se.current?.pushMany(e),remove:e=>Se.current?.remove(e)??[],update:(e,t)=>Se.current?.update(e,t)??[],clear:()=>Se.current?.clear(),getData:()=>Se.current?.getData()??[],getScales:()=>Se.current?.getScales()??null}),[]);const Ne=l(ce,be[0],be[1],ue),De=Ne?null:a(y,be[0],be[1],me),Ee={};null!=N&&(Ee.fill=N),null!=D&&(Ee.stroke=D),null!=E&&(Ee.strokeWidth=E),null!=B&&(Ee.opacity=B),null!=O&&(Ee.gap=O);const Be=he?`${g||""} semiotic-emphasis-${he}`.trim():g,Oe=T(w,y),je=Y(()=>"down"!==A?R:function({data:e,valueAccessor:t,timeAccessor:n,binSize:i,valueExtent:s,extentPadding:o}){if(s)return[s[1],s[0]];if(!e||0===e.length)return;const r=new Map;for(const s of e){const e=q(s,n,"time"),o=q(s,t,"value");if(null==e||null==o)continue;const a=Math.floor(e/i)*i;r.set(a,(r.get(a)??0)+o)}let a=0;for(const e of r.values())a=Math.max(a,e);return[a>0?a+a*(o??.1):1,0]}({data:y,valueAccessor:x,timeAccessor:b,binSize:h,valueExtent:R,extentPadding:P}),[A,y,x,b,h,R,P]);return Ne||De||J(e,{ref:Se,chartType:"bar",runtimeMode:"streaming",size:be,margin:_e,className:Be,arrowOfTime:v,windowMode:f,windowSize:Oe,data:y,timeAccessor:b,valueAccessor:x,xExtent:I,yExtent:je,extentPadding:P,binSize:h,categoryAccessor:F,barColors:M,barStyle:Ee,showAxes:we,background:j,hoverAnnotation:ye,tooltipContent:He,...t({linkedHover:te,selection:ne,onObservation:ae,forceHoverBehavior:!0,mobileInteraction:m.mobileInteraction,customHoverBehavior:Ce}),annotations:U,autoPlaceAnnotations:Z,svgAnnotationRules:G,tickFormatTime:Q,tickFormatValue:ee,decay:ie,pulse:se,staleness:oe,transition:re,pointIdAccessor:c.pointIdAccessor,legend:Ae,legendPosition:ke,brush:Ie||(fe?{dimension:"x"}:void 0),onBrush:Ie||fe?Me:void 0})});function Z(e){return J(U,{...e,windowMode:"growing"})}U.displayName="RealtimeHistogram",Z.displayName="TemporalHistogram";var G=U;import{useRef as Q,useImperativeHandle as ee,forwardRef as te,useCallback as ne}from"react";import{jsx as ie}from"react/jsx-runtime";var se=te(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,timeExtent:w,valueExtent:y,yScaleType:b,extentPadding:x,categoryAccessor:A,colors:_,radius:k,fill:H,opacity:S,stroke:z,strokeWidth:C,pointStyle:R,background:P,tooltipContent:F,tooltip:M,onHover:N,annotations:D,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,linkedHover:L,selection:W,onObservation:V,chartId:$,loading:K,loadingContent:X,emptyContent:Y,emphasis:q,legendPosition:J}=n,U=s.showAxes,Z=s.enableHover,G=u??s.marginDefaults,te=c??[s.width,s.height],se=F??M??I({timeAccessor:v,valueAccessor:f}),oe=Q(null),{customHoverBehavior:re}=r({selection:W,linkedHover:L,unwrapData:!0,onObservation:V,chartType:"RealtimeSwarmChart",chartId:$}),ae=ne(e=>{N&&N(e),re(e)},[N,re]);ee(i,()=>({push:e=>oe.current?.push(e),pushMany:e=>oe.current?.pushMany(e),remove:e=>oe.current?.remove(e)??[],update:(e,t)=>oe.current?.update(e,t)??[],clear:()=>oe.current?.clear(),getData:()=>oe.current?.getData()??[],getScales:()=>oe.current?.getScales()??null}),[]);const le=l(K,te[0],te[1],X),ce=le?null:a(g,te[0],te[1],Y),ue={};null!=k&&(ue.radius=k),null!=H&&(ue.fill=H),null!=S&&(ue.opacity=S),null!=z&&(ue.stroke=z),null!=C&&(ue.strokeWidth=C);const me=R,he=q?`${m||""} semiotic-emphasis-${q}`.trim():m,de=T(p,g);return le||ce||ie(e,{ref:oe,chartType:"swarm",runtimeMode:"streaming",size:te,margin:G,className:he,arrowOfTime:h,windowMode:d,windowSize:de,data:g,timeAccessor:v,valueAccessor:f,xExtent:w,yExtent:y,yScaleType:b,extentPadding:x,categoryAccessor:A,barColors:_,swarmStyle:ue,pointStyle:me,showAxes:U,background:P,hoverAnnotation:Z,tooltipContent:se,...t({linkedHover:L,selection:W,onObservation:V,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ae}),annotations:D,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,legendPosition:J,pointIdAccessor:n.pointIdAccessor})});se.displayName="RealtimeSwarmChart";import{useRef as oe,useImperativeHandle as re,forwardRef as ae,useCallback as le}from"react";import{jsx as ce}from"react/jsx-runtime";var ue=ae(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,timeExtent:w,valueExtent:y,extentPadding:b,positiveColor:x,negativeColor:A,connectorStroke:I,connectorWidth:R,gap:P,stroke:F,strokeWidth:M,opacity:N,background:D,tooltipContent:E,tooltip:B,onHover:O,annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,linkedHover:K,selection:X,onObservation:Y,chartId:q,loading:J,loadingContent:U,emptyContent:Z,emphasis:G,legendPosition:Q}=n,ee=s.showAxes,te=s.enableHover,ne=u??s.marginDefaults,ie=c??[s.width,s.height],se=E??B??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null,s=z(i,t,"time"),o=i?.delta??z(i,n,"value"),r=i?.cumEnd,a="number"==typeof o?0>o?C(o):"+"+C(o):C(o);return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),C(s)]}),k("div",{children:[_("span",{style:S,children:"Δ:"}),a]}),null!=r&&k("div",{children:[_("span",{style:S,children:"total:"}),C(r)]})]})}}({timeAccessor:v,valueAccessor:f}),ae=oe(null),{customHoverBehavior:ue}=r({selection:X,linkedHover:K,unwrapData:!0,onObservation:Y,chartType:"RealtimeWaterfallChart",chartId:q}),me=le(e=>{O&&O(e),ue(e)},[O,ue]);re(i,()=>({push:e=>ae.current?.push(e),pushMany:e=>ae.current?.pushMany(e),remove:e=>ae.current?.remove(e)??[],update:(e,t)=>ae.current?.update(e,t)??[],clear:()=>ae.current?.clear(),getData:()=>ae.current?.getData()??[],getScales:()=>ae.current?.getScales()??null}),[]);const he=l(J,ie[0],ie[1],U),de=he?null:a(g,ie[0],ie[1],Z),pe={};null!=x&&(pe.positiveColor=x),null!=A&&(pe.negativeColor=A),null!=I&&(pe.connectorStroke=I),null!=R&&(pe.connectorWidth=R),null!=P&&(pe.gap=P),null!=F&&(pe.stroke=F),null!=M&&(pe.strokeWidth=M),null!=N&&(pe.opacity=N);const ge=G?`${m||""} semiotic-emphasis-${G}`.trim():m,ve=T(p,g);return he||de||ce(e,{ref:ae,chartType:"waterfall",runtimeMode:"streaming",size:ie,margin:ne,className:ge,arrowOfTime:h,windowMode:d,windowSize:ve,data:g,timeAccessor:v,valueAccessor:f,xExtent:w,yExtent:y,extentPadding:b,waterfallStyle:pe,showAxes:ee,background:D,hoverAnnotation:te,tooltipContent:se,...t({linkedHover:K,selection:X,onObservation:Y,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:me}),annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,legendPosition:Q,pointIdAccessor:n.pointIdAccessor})});ue.displayName="RealtimeWaterfallChart";import{useRef as me,useImperativeHandle as he,forwardRef as de,useCallback as pe}from"react";import{jsx as ge}from"react/jsx-runtime";var ve=de(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,categoryAccessor:w,timeExtent:y,valueExtent:b,extentPadding:x,heatmapXBins:A=20,heatmapYBins:I=20,aggregation:R="count",background:P,tooltipContent:F,tooltip:M,onHover:N,annotations:D,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,linkedHover:$,selection:K,onObservation:X,chartId:Y,loading:q,loadingContent:J,emptyContent:U,emphasis:Z,legendPosition:G}=n,Q=s.showAxes,ee=s.enableHover,te=u??s.marginDefaults,ne=c??[s.width,s.height],ie=F??M??function(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=o?.xCenter??z(o,t,"time"),a=o?.yCenter??z(o,n,"value"),l=o?.count,c=o?.sum,u=o?.value,m=o?.agg??"count";return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),C(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),C(a)]}),null!=l&&k("div",{children:[_("span",{style:S,children:"count:"}),C(l)]}),"sum"===m&&null!=c&&k("div",{children:[_("span",{style:S,children:"sum:"}),C(c)]}),"mean"===m&&null!=u&&k("div",{children:[_("span",{style:S,children:"mean:"}),C(u)]})]})}}({timeAccessor:v,valueAccessor:f}),se=me(null),{customHoverBehavior:oe}=r({selection:K,linkedHover:$,unwrapData:!0,onObservation:X,chartType:"RealtimeHeatmap",chartId:Y}),re=pe(e=>{N&&N(e),oe(e)},[N,oe]);he(i,()=>({push:e=>se.current?.push(e),pushMany:e=>se.current?.pushMany(e),remove:e=>se.current?.remove(e)??[],update:(e,t)=>se.current?.update(e,t)??[],clear:()=>se.current?.clear(),getData:()=>se.current?.getData()??[],getScales:()=>se.current?.getScales()??null}),[]);const ae=l(q,ne[0],ne[1],J),le=ae?null:a(g,ne[0],ne[1],U),ce=Z?`${m||""} semiotic-emphasis-${Z}`.trim():m,ue=T(p,g);return ae||le||ge(e,{ref:se,chartType:"heatmap",runtimeMode:"streaming",size:ne,margin:te,className:ce,arrowOfTime:h,windowMode:d,windowSize:ue,data:g,timeAccessor:v,valueAccessor:f,categoryAccessor:w,xExtent:y,yExtent:b,extentPadding:x,heatmapXBins:A,heatmapYBins:I,heatmapAggregation:R,showAxes:Q,background:P,hoverAnnotation:ee,tooltipContent:ie,...t({linkedHover:$,selection:K,onObservation:X,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:re}),annotations:D,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,legendPosition:G,pointIdAccessor:n.pointIdAccessor})});ve.displayName="RealtimeHeatmap";export{c as RunningStats,u as WindowAccumulator,m as statValue,h as bandBounds,g as parseWindowDuration,v as ReorderBuffer,W as RealtimeLineChart,U as RealtimeHistogram,Z as TemporalHistogram,G as RealtimeTemporalHistogram,se as RealtimeSwarmChart,ue as RealtimeWaterfallChart,ve as RealtimeHeatmap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{forceLayout as n}from"./chunk-chunk-
|
|
2
|
+
import{forceLayout as n}from"./chunk-chunk-G7QVPZUD.module.min.js";import{canUseForceWorker as t,runForceLayoutWorker as e,shouldUseForceWorker as o}from"./chunk-chunk-WLOIUMWG.module.min.js";import{useWasHydratingFromSSR as r}from"./chunk-chunk-ACLDBMRH.module.min.js";import{useEffect as i,useMemo as s,useRef as u,useState as a}from"react";var d=new WeakMap;function l(n){const t=[];for(const e of Object.keys(n).sort()){const o=n[e];if(void 0!==o){if("function"==typeof o)return null;t.push(`${e}:${o+""}`)}}return t.join("|")}function c(n,t,e){return null==e?null:d.get(n)?.get(t)?.get(e)??null}function p(n,t,e,o){if(null==e)return;let r=d.get(n);r||(r=new WeakMap,d.set(n,r));let i=r.get(t);if(i||(i=new Map,r.set(t,i)),!i.has(e)&&i.size>=16){const n=i.keys().next().value;void 0!==n&&i.delete(n)}i.set(e,o)}function f(d,f,m={}){const h=r(),{seed:g,iterations:k,repulsion:y,linkDistance:w,linkStrength:b,centerStrength:j,damping:v,nodeRadius:R,nodePadding:x,inset:M,execution:A,workerThreshold:D}=m,E=s(()=>({seed:g,iterations:k,repulsion:y,linkDistance:w,linkStrength:b,centerStrength:j,damping:v,nodeRadius:R,nodePadding:x,inset:M,execution:A,workerThreshold:D}),[g,k,y,w,b,j,v,R,x,M,A,D]),O=u(h),[S,W]=a(()=>{if("undefined"==typeof window||h){const t=n(d,f,E);return p(d,f,l(E),t),{positions:t,status:"ready",error:null}}const t=c(d,f,l(E));return t?{positions:t,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return i(()=>{if(O.current)return void(O.current=!1);const r=l(E),i=c(d,f,r);if(i)return void W(n=>"ready"===n.status&&n.positions===i?n:{positions:i,status:"ready",error:null});const s=new AbortController;return W(n=>({positions:n.positions,status:"pending",error:null})),async function(r,i,s={}){const{execution:u="auto",signal:a,workerThreshold:d,nodeRadius:l,...c}=s,p=c.iterations??260;if(!t()||!o(u,r.length,i.length,p,d))return n(r,i,{...c,nodeRadius:l});const f={kind:"normalized",nodes:r.map(n=>({...n})),edges:i.map(n=>({...n})),options:c,nodeRadii:"function"==typeof l?Object.fromEntries(r.map(n=>[n.id,l(n)])):null==l?void 0:Object.fromEntries(r.map(n=>[n.id,l]))};try{return(await e(f,a)).positions}catch(t){if("AbortError"===t?.name)throw t;return n(r,i,{...c,nodeRadius:l})}}(d,f,{...E,signal:s.signal}).then(n=>{p(d,f,r,n),W({positions:n,status:"ready",error:null})}).catch(n=>{"AbortError"!==n.name&&W(t=>({positions:t.positions,status:"error",error:n}))}),()=>s.abort()},[d,f,E]),S}export{f as useForceLayout};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{mergeShapeStyle as e,useCustomChartScaffold as t,useFrameImperativeHandle as o,useResolvedSelection as n}from"./chunk-chunk-FBUNUIPV.module.min.js";import{validateNetworkData as i,validateObjectData as r}from"./chunk-chunk-J5QD4RAM.module.min.js";import{StreamNetworkFrame_default as s,buildRibbonGeometry as a}from"./chunk-chunk-WLOIUMWG.module.min.js";import{buildBaseMetadataProps as l,buildCustomBehaviorProps as c}from"./chunk-chunk-NH4MEAKP.module.min.js";import{composeStyleRules as d,makeNodeRuleContext as m}from"./chunk-chunk-EMO5NUGE.module.min.js";import{COLOR_SCHEMES as h,DEFAULT_COLORS as g,DEFAULT_SELECTION_OPACITY as u,DEPTH_PALETTE_COLORS as p,filterSparseArray as f,getColor as b,normalizeTooltip as y,resolveAxisFreeMarginDefaults as v,resolveCategoricalPalette as k,resolveDefaultFill as S,resolveMobileInteraction as w,useChartLegendAndMargin as C,useChartMode as T,useChartSelection as I,useColorScale as A,useLegendInteraction as M,useThemeCategorical as H}from"./chunk-chunk-7ZDJSYKI.module.min.js";import{getMin as x}from"./chunk-chunk-JJ2OOIET.module.min.js";import{ChartError as B,SafeRender as N,renderEmptyState as O,renderLoadingState as D}from"./chunk-chunk-ACLDBMRH.module.min.js";import{forwardRef as L,useMemo as P}from"react";import{jsx as E}from"react/jsx-runtime";var W=L(function(e,o){const{nodes:n,edges:i,layout:r,layoutConfig:a,onLayoutError:d,nodeIDAccessor:m="id",sourceAccessor:h="source",targetAccessor:g="target",margin:u,className:p,colorBy:b,colorScheme:y,selection:v,linkedHover:k,onObservation:S,onClick:C,chartId:T,annotations:A,autoPlaceAnnotations:M,frameProps:H={}}=e,{frameRef:x,resolved:B,normalizedMargin:L}=t({imperativeRef:o,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=P(()=>f(n),[n]),R=P(()=>f(i),[i]),z=P(()=>void 0===n&&void 0===i?void 0:[...W,...R],[i,n,R,W]),F=w(e.mobileInteraction,{mode:e.mode,width:B.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:j,customClickBehavior:$,activeSelectionHook:_}=I({selection:v,linkedHover:k,fallbackFields:"string"==typeof b?[b]:[],onObservation:S,onClick:C,chartType:"NetworkCustomChart",chartId:T,colorByField:"string"==typeof b?b:void 0,mobileInteraction:F}),G=P(()=>_?.isActive?{isActive:!0,predicate:_.predicate}:null,[_?.isActive,_?.predicate]),{width:q,height:J,enableHover:K,title:U,description:X,summary:Y,accessibleTable:Z}=B,Q=D(e.loading,q,J,e.loadingContent),V=Q?null:O(z,q,J,e.emptyContent);if(Q||V)return Q||V;const ee={chartType:"force",...null!=n&&{nodes:W},...null!=i&&{edges:R},customNetworkLayout:r,layoutConfig:a,onLayoutError:d,nodeIDAccessor:m,sourceAccessor:h,targetAccessor:g,colorBy:b,colorScheme:y,size:[q,J],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:L,enableHover:K,...l({title:U,description:X,summary:Y,accessibleTable:Z,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!=A&&{annotations:A},...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=b(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=b(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:u,onClick:p,mobileInteraction:b,mobileSemantics:y,chartType:v,chartId:S,marginDefaults:T,userMargin:x,width:B,height:N,hasTitle:L,loading:P,loadingContent:E,emptyContent:W,emptyDataKey:R="edges"}=e,z=j(()=>f(o),[o]),F=j(()=>f(t),[t]),$=D(P,B,N,E),G=$?null:O("nodes"===R?void 0===t?void 0:F:void 0===o?void 0:z,B,N,W),q=j(()=>n?_(F,z,i,r):F,[n,F,z,i,r]),J=A(q,s,a),K=H(),U=j(()=>Array.isArray(a)&&a.length>0?a:[...k(a,K,g)],[a,K]),X=j(()=>{if(!s)return[];const e=new Set;for(const t of q){const o="function"==typeof s?s(t):t[s];null!=o&&e.add(o+"")}return Array.from(e)},[q,s]),Y=M(d,s,X),{legend:Z,margin:Q,legendPosition:V}=C({data:q,colorBy:s,colorScale:J,showLegend:l,legendPosition:c,userMargin:x,defaults:T,categories:X,chartWidth:B,hasTitle:L}),ee=j(()=>w(b,{width:B,mobileSemantics:y}),[b,B,y]),te=I({selection:m,linkedHover:h,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:u,onClick:p,mobileInteraction:ee,chartType:v,chartId:S}),{customHoverBehavior:oe,customClickBehavior:ne,activeSelectionHook:ie,hoverSelectionHook:re,crosshairSourceId:se}=te;return{safeNodes:q,safeEdges:z,colorScale:J,effectivePalette:U,themeCategorical:K,allCategories:X,legendState:Y,legend:Z,margin:Q,legendPosition:V,mobileInteraction:ee,customHoverBehavior:oe,customClickBehavior:ne,activeSelectionHook:ie,hoverSelectionHook:re,crosshairSourceId:se,loadingEl:$,emptyEl:G}}import{jsx as K}from"react/jsx-runtime";var U=z(function(t,n){const r=F(null);o(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:h,margin:g,className:u,nodeIdAccessor:p,nodeIDAccessor:f,sourceAccessor:v="source",targetAccessor:k="target",nodeLabel:w,colorBy:C,colorScheme:I,styleRules:A,nodeSize:M=8,nodeSizeRange:H=[5,20],nodeStroke:x,nodeStrokeWidth:O,edgeWidth:D,edgeColor:L,edgeOpacity:P,iterations:E=300,forceStrength:W=.1,layoutExecution:z="auto",layoutLoadingContent:j,onLayoutStateChange:$,tooltip:_,frameProps:G={},onObservation:q,onClick:U,chartId:X,selection:Y,linkedHover:Z,loading:Q,loadingContent:V,emptyContent:ee,legendInteraction:te,legendPosition:oe,stroke:ne,strokeWidth:ie,opacity:re}=t,se=p??f??"id",{width:ae,height:le,enableHover:ce,showLegend:de,showLabels:me=!1,title:he,description:ge,summary:ue,accessibleTable:pe}=a,fe=J({nodes:l,edges:h,inferNodes:!1,nodeIdAccessor:se,sourceAccessor:v,targetAccessor:k,colorBy:C,colorScheme:I,showLegend:de,legendPosition:oe,legendInteraction:te,selection:Y,linkedHover:Z,onObservation:q,onClick:U,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ForceDirectedGraph",chartId:X,marginDefaults:a.marginDefaults,userMargin:g,width:ae,height:le,hasTitle:!!he,loading:Q,loadingContent:V,emptyContent:ee,emptyDataKey:"nodes"}),be=R(()=>new Map,[]),ye=R(()=>e=>{const t={};return t.fill=C?b(e.data||e,C,fe.colorScale):S(void 0,fe.themeCategorical,I,void 0,be),"number"==typeof M&&(t.r=M),t},[C,fe.colorScale,M,fe.themeCategorical,I,be]),ve=R(()=>m(C,"number"==typeof M?void 0:M),[C,M]),ke=R(()=>e(d(ye,A,ve,e=>e.data||e),{stroke:x??ne,strokeWidth:O??ie,opacity:re}),[ye,A,ve,x,ne,O,ie,re]),Se=L??ne??"#999",we=P??re??.6,Ce=ie??1,Te=R(()=>e=>{const t=e.data||e;let o;if(void 0===D)o=Ce;else if("number"==typeof D)o=D;else if("function"==typeof D)o=D(t);else{const e=t[D],n="number"==typeof e?e:Number(e);o=Number.isFinite(n)&&n>0?n:Ce}return{stroke:Se,strokeWidth:o,opacity:we}},[D,Se,we,Ce]),Ie=R(()=>{if(me&&w)return"function"==typeof w?w:e=>e.data?.[w]??e[w]??e.id},[me,w]),Ae=i({componentName:"ForceDirectedGraph",nodes:l,edges:h,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:se}});return Ae?K(B,{componentName:"ForceDirectedGraph",message:Ae,width:ae,height:le}):fe.loadingEl?fe.loadingEl:fe.emptyEl?fe.emptyEl:K(N,{componentName:"ForceDirectedGraph",width:ae,height:le,children:K(s,{ref:r,chartType:"force",...null!=l&&{nodes:fe.safeNodes},...null!=h&&{edges:fe.safeEdges},size:[ae,le],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:fe.margin,nodeIDAccessor:se,sourceAccessor:v,targetAccessor:k,iterations:E,forceStrength:W,layoutExecution:z,layoutLoadingContent:j,onLayoutStateChange:$,nodeStyle:ke,edgeStyle:Te,colorBy:C,colorScheme:fe.effectivePalette,nodeSize:M,nodeSizeRange:H,nodeLabel:Ie,showLabels:me,enableHover:ce,tooltipContent:!1===_?()=>null:y(_)||void 0,...c({linkedHover:Z,selection:Y,onObservation:q,onClick:U,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:fe.legend,legendPosition:fe.legendPosition,...te&&"none"!==te&&{legendHoverBehavior:fe.legendState.onLegendHover,legendClickBehavior:fe.legendState.onLegendClick,legendHighlightedCategory:fe.legendState.highlightedCategory,legendIsolatedCategories:fe.legendState.isolatedCategories},className:u,title:he,description:ge,summary:ue,accessibleTable:pe,...null!=t.animate&&{animate:t.animate},...G})})});U.displayName="ForceDirectedGraph";import{useMemo as X,forwardRef as Y,useRef as Z}from"react";import{jsx as Q}from"react/jsx-runtime";var V=Y(function(t,n){const r=Z(null);o(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:u,margin:p,className:f,sourceAccessor:v="source",targetAccessor:k="target",valueAccessor:w="value",nodeIdAccessor:C="id",colorBy:I,colorScheme:A,styleRules:M,edgeColorBy:H="source",padAngle:x=.01,groupWidth:O=20,sortGroups:D,nodeLabel:L,edgeOpacity:P=.5,tooltip:E,frameProps:W={},onObservation:R,onClick:z,chartId:F,selection:j,linkedHover:$,loading:_,loadingContent:G,emptyContent:K,legendInteraction:U,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:u,inferNodes:!0,nodeIdAccessor:C,sourceAccessor:v,targetAccessor:k,colorBy:I,colorScheme:A,showLegend:!1,legendInteraction:U,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,hasTitle:!!re,loading:_,loadingContent:G,emptyContent:K}),de=X(()=>new Map,[]),me=X(()=>new Map,[]),he=ce.safeNodes.length>0,ge=X(()=>{if(he)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(I)o.fill=b(e.data||e,I,ce.colorScale);else{const n=Array.isArray(A)?A:h[A]||g,i=Array.isArray(n)?n:g,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,I,ce.colorScale,A,C,me]),ue=X(()=>m(I),[I]),pe=X(()=>{if(ge||M&&M.length>0)return e(d(ge,M,ue,e=>e.data||e),{stroke:Y,strokeWidth:V,opacity:ee})},[ge,M,ue,Y,V,ee]),fe=X(()=>{if(he)return q({edgeColorBy:H,colorBy:I,colorScale:ce.colorScale,nodeStyleFn:pe||(e=>({fill:S(void 0,ce.themeCategorical,A,void 0,de)})),edgeOpacity:P,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:P}})},[he,H,I,ce.colorScale,pe,P,ce.themeCategorical,A,de]),be=X(()=>fe?e(fe,{stroke:Y,strokeWidth:V,opacity:ee}):void 0,[fe,Y,V,ee]),ye=X(()=>{if(!ie)return;const e=L||C;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[ie,L,C]),ve=i({componentName:"ChordDiagram",edges:u,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!=u&&{edges:ce.safeEdges},size:[te,oe],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce.margin,nodeIDAccessor:C,sourceAccessor:v,targetAccessor:k,valueAccessor:w,padAngle:x,groupWidth:O,sortGroups:D,nodeStyle:pe,edgeStyle:be,colorBy:I,colorScheme:ce.effectivePalette,edgeColorBy:H,edgeOpacity:P,nodeLabel:ye,showLabels:ie,enableHover:ne,tooltipContent:!1===E?()=>null:y(E)||void 0,...c({linkedHover:$,selection:j,onObservation:R,onClick:z,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior,linkedHoverInClickPredicate:!1}),...U&&"none"!==U&&{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);o(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:h,margin:g,className:u,sourceAccessor:p="source",targetAccessor:f="target",valueAccessor:v="value",nodeIdAccessor:k="id",colorBy:w,colorScheme:C,styleRules:I,edgeColorBy:A="source",orientation:M="horizontal",nodeAlign:H="justify",nodePaddingRatio:x=.05,nodeWidth:O=15,nodeLabel:D,edgeOpacity:L=.5,edgeSort:P,tooltip:E,frameProps:W={},onObservation:R,onClick:z,chartId:F,selection:j,linkedHover:$,loading:_,loadingContent:G,emptyContent:K,showLegend:U,legendPosition:X,legendInteraction:Y,stroke:Z,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:h,inferNodes:!0,nodeIdAccessor:k,sourceAccessor:p,targetAccessor:f,colorBy:w,colorScheme:C,showLegend:U,legendPosition:X,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,hasTitle:!!ae,loading:_,loadingContent:G,emptyContent:K}),he=ee(()=>new Map,[]),ge=ee(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=w?b(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(()=>m(w,v),[w,v]),pe=ee(()=>e(d(ge,I,ue,e=>e.data||e),{stroke:Z,strokeWidth:Q,opacity:V}),[ge,I,ue,Z,Q,V]),fe=ee(()=>q({edgeColorBy:A,colorBy:w,colorScale:me.colorScale,nodeStyleFn:pe,edgeOpacity:L,baseStyle:{stroke:"none",strokeWidth:0}}),[A,w,me.colorScale,pe,L]),be=ee(()=>e(fe,{stroke:Z,strokeWidth:Q,opacity:V}),[fe,Z,Q,V]),ye=ee(()=>{if(!se)return;const e=D||k;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[se,D,k]),ve=i({componentName:"SankeyDiagram",edges:h,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!=h&&{edges:me.safeEdges},size:[te,ie],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:me.margin,nodeIDAccessor:k,sourceAccessor:p,targetAccessor:f,valueAccessor:v,orientation:M,nodeAlign:H,nodePaddingRatio:x,nodeWidth:O,nodeStyle:pe,edgeStyle:be,colorBy:w,colorScheme:me.effectivePalette,edgeColorBy:A,edgeOpacity:L,edgeSort:P,nodeLabel:ye,showLabels:se,enableHover:re,tooltipContent:!1===E?()=>null:y(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 I=0;for(;w.length>I;){let e=I;for(;w.length>e+1&&w[e+1].t===w[I].t;)e++;T.push(w[I]);for(let t=I+1;e>=t;t++){const e=T[T.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||T.push(w[t])}I=e+1}const A=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!=A?A:-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},I=[];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)}I.push(i)}const A=[];let M=s+(f[0]?.peak.topPeak??0)*a;f.length>0&&A.push(M);for(let e=1;f.length>e;e++)M+=I[e-1]*a+s,A.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;A.length>t;t++)A[t]*=e}const H=0===f.length?0:f[0].peak.topPeak+I.reduce((e,t)=>e+t,0)+f[f.length-1].peak.botPeak,x={};for(const t of e)x[t.id]=A[p[t.id]];return{effectiveSlotsHeight:H,centerlines:x,laneLifetime:u,slots:f,slotByNode:p,slotCenter:A,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 Ie,jsx as Ae,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:n,edges:i,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:v,xExtentAccessor:k="xExtent",edgeIdAccessor:S="id",colorBy:w,colorScheme:C,showLegend:T,legendPosition:I="right",pairing:A="temporal",packing:M="reuse",laneOrder:H="crossing-min",ribbonLane:x="both",lifetimeMode:B="half",showLaneRails:N=!1,showQualityReadout:O=!1,showLabels:D=!0,width:L=600,height:P=400,margin:E,title:W,description:R,summary:z,accessibleTable:F,responsiveWidth:j,responsiveHeight:$,loading:G,loadingContent:q,emptyContent:K,edgeOpacity:U=.35,timeFormat:X,valueFormat:Y,tooltip:Z,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)},[]),Oe=void 0!==i,De=f(Oe?i:me),Le=be(()=>{const e=f(n??[]),t=ge;if(0===e.length&&0===t.length)return _([],De,d,m);const o=new Set,i=[];for(const t of e){const e=xe(c,t)+"";o.has(e)||(o.add(e),i.push(t))}for(const e of t){const t=xe(c,e)+"";o.has(t)||(o.add(t),i.push(e))}const r=_([],De,d,m);for(const e of r)o.has(e.id)||(o.add(e.id),i.push(e));return i},[n,ge,De,c,d,m]),Pe=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]);o(t,{variant:"network",frameRef:Pe,overrides:{push(e){if(We(e)){if(Oe)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&&(Oe?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(!Oe){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(!Oe){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(){Oe||Be([]),Ne([]),Pe.current?.clear()},getData:()=>De??[],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=(Le??[]).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=(De??[]).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(v){const t=He(xe(v,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}},[Le,De,r,ze,Re,k,d,m,h,g,u,p,v]),qe=J({nodes:Le,edges:De,inferNodes:!1,nodeIdAccessor:c,sourceAccessor:d,targetAccessor:m,colorBy:w,colorScheme:C,showLegend:!1,legendPosition:I,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:L,height:P,hasTitle:!!W,loading:G,loadingContent:q,emptyContent:K}),Je=(T??!!w)&&!!w,Ke=ke(e=>null!=E&&("number"==typeof E||null!=E[e]),[E]),Ue=be(()=>{const e={...qe.margin};return Je&&("right"===I&&!Ke("right")&&140>e.right?e.right=140:"bottom"===I&&!Ke("bottom")&&80>e.bottom&&(e.bottom=80)),e},[qe.margin,Je,I,Ke]),Xe=L-Ue.left-Ue.right,Ye=P-Ue.top-Ue.bottom,Ze=be(()=>re(Fe,je,$e),[Fe,je,$e]),Qe=be(()=>Ze.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:A,packing:M,laneOrder:H,lifetimeMode:B}),[Ze,Fe,je,Ye,A,M,H,B]),Ve=be(()=>Se().domain($e).range([0,Xe]),[$e,Xe]),et=ke((e,t)=>{if(w&&Le){const t=_e.get(e);if(t)return b(t,w,qe.colorScale)}return qe.effectivePalette[t%qe.effectivePalette.length]||"#475569"},[w,Le,_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:U,rawDatum:g,bezier:h})}),{bands:n,ribbons:i}},[Qe,Fe,je,Ve,$e,et,_e,Ge,x,U,tt]),nt=be(()=>({bands:ot.bands,ribbons:ot.ribbons,showLabels:D}),[ot,D]),it=be(()=>{if(!Je||!w)return;const e=new Map;(Le??[]).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,Le,et,ze]),rt=be(()=>!1!==Z&&Q?void 0===Z||!0===Z?null:y(Z)||null:null,[Z,Q]),st=ke(e=>X?X(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[X]),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:[Ae("div",{style:{fontWeight:600,marginBottom:4},children:e}),r.length>0&&Me("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[Ae("thead",{children:Me("tr",{style:{opacity:.6},children:[Ae("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),Ae("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=i&&Ae("th",{})]})}),Ae("tbody",{children:r.map((e,t)=>Me("tr",{children:[Ae("td",{style:{paddingRight:8},children:st(e.t)}),Ae("td",{style:{textAlign:"right"},children:at(e.total)}),null!=i&&Ae("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(Ie,{children:[Ae("span",{style:{opacity:.6},children:"value"}),Ae("span",{style:{textAlign:"right"},children:at(Number(s))})]}),null!=a&&Me(Ie,{children:[Ae("span",{style:{opacity:.6},children:"start"}),Ae("span",{style:{textAlign:"right"},children:st(He(a))})]}),null!=l&&Me(Ie,{children:[Ae("span",{style:{opacity:.6},children:"end"}),Ae("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(Xe,e)),g=h(d??0),u=Math.max(g,h(m??Xe));return Me("g",{children:[O&&null!==(s??null)&&Me("text",{x:Xe,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",r," → ",s," ","edge length: ",Math.round(a)," → ",Math.round(c)]}),i&&Ae("text",{x:Xe,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:Ae("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:[Ae("line",{x1:d,y1:c,x2:m,y2:c,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),Ae("line",{x1:d,y1:c-4,x2:d,y2:c+4,stroke:h,strokeOpacity:.5}),Ae("line",{x1:m,y1:c-4,x2:m,y2:c+4,stroke:h,strokeOpacity:.5})]},"lane-"+i.id)}),Ae("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:X?X(new Date(o)):"";return Me("g",{transform:`translate(${n},${Ye+4})`,children:[Ae("line",{y2:6,stroke:"#94a3b8"}),Ae("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:i})]},t)})]})},[Qe,l,Ve,Xe,Ye,N,Fe,et,O,X]),dt=be(()=>(Le??[]).map(e=>({id:ze(e),data:e})),[Le,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(()=>(De??[]).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}}),[De,Re,d,m,h,mt]),gt=qe.loadingEl,ut=qe.emptyEl;return Ze.length>0?Me("svg",{width:L,height:P,role:"img","aria-label":W??"Process Sankey validation failed",children:[Ae("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ze.map((e,t)=>Ae("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+se(e)},t))]}):gt||ut||Ae(s,{ref:Pe,chartType:"force",nodes:dt,edges:ht,customNetworkLayout:Ce,layoutConfig:nt,size:[L,P],responsiveWidth:j,responsiveHeight:$,margin:Ue,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===Z?()=>null:lt,backgroundGraphics:ct,showParticles:te,particleStyle:oe,legend:it,legendPosition:I,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 Oe}from"react/jsx-runtime";function De(t){const o=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}),{data:n,margin:i,className:a,layout:l="tree",orientation:d="vertical",childrenAccessor:m="children",valueAccessor:h="value",nodeIdAccessor:g="name",colorBy:u,colorScheme:f,colorByDepth:v=!1,edgeStyle:k="curve",nodeLabel:w,nodeSize:C=5,tooltip:I,frameProps:A={},onObservation:M,onClick:H,chartId:x,selection:O,linkedHover:D,loading:L,loadingContent:P,legendInteraction:E,stroke:W,strokeWidth:R,opacity:z}=t,{width:F,height:j,enableHover:_,showLabels:q=!0,title:K,description:U,summary:X,accessibleTable:Y}=o,Z=J({nodes:Ne(()=>$(n??null,m),[n,m]),edges:void 0,inferNodes:!1,colorBy:v?void 0:u,colorScheme:f,showLegend:!1,legendInteraction:E,selection:O,linkedHover:D,onObservation:M,onClick:H,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:o.marginDefaults,userMargin:i,width:F,height:j,hasTitle:!!K,loading:L,loadingContent:P}),Q=Ne(()=>new Map,[]),V=Ne(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=v?p[(e.depth||0)%p.length]:u?b(e.data||e,u,Z.colorScale):S(void 0,Z.themeCategorical,f,void 0,Q),t},[u,v,Z.colorScale,Z.themeCategorical,f,Q]),ee=Ne(()=>e(V,{stroke:W,strokeWidth:R,opacity:z}),[V,W,R,z]),te=Ne(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),oe=Ne(()=>e(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=r({componentName:"TreeDiagram",data:n});return ie?Oe(B,{componentName:"TreeDiagram",message:ie,width:F,height:j}):Z.loadingEl?Z.loadingEl:Oe(N,{componentName:"TreeDiagram",width:F,height:j,children:Oe(s,{chartType:l,...null!=n&&{data:n},size:[F,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,nodeIDAccessor:g,childrenAccessor:m,hierarchySum:ne,treeOrientation:d,edgeType:k,nodeStyle:ee,edgeStyle:oe,colorBy:u,colorScheme:Z.effectivePalette,colorByDepth:v,nodeSize:C,nodeLabel:q?w||g:void 0,showLabels:q,enableHover:_,tooltipContent:!1===I?()=>null:y(I)||void 0,...c({linkedHover:D,selection:O,onObservation:M,onClick:H,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior,linkedHoverInClickPredicate:!1}),...E&&"none"!==E&&{legendHoverBehavior:Z.legendState.onLegendHover,legendClickBehavior:Z.legendState.onLegendClick,legendHighlightedCategory:Z.legendState.highlightedCategory,legendIsolatedCategories:Z.legendState.isolatedCategories},className:a,title:K,description:U,summary:X,accessibleTable:Y,...null!=t.animate&&{animate:t.animate},...A})})}De.displayName="TreeDiagram";import{useMemo as Le,useCallback as Pe}from"react";import{jsx as Ee}from"react/jsx-runtime";function We(t){const o=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,linkedHover:t.linkedHover,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:600,height:600}),{data:i,margin:a,className:l,childrenAccessor:d="children",valueAccessor:m="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:f,colorByDepth:v=!1,labelMode:k="leaf",nodeLabel:w,padding:C=4,paddingTop:I,nodeStyle:A,tooltip:M,frameProps:H={},selection:x,linkedHover:O,onObservation:D,onClick:L,chartId:P,loading:E,loadingContent:W,legendInteraction:R,stroke:z,strokeWidth:F,opacity:j}=t,{nodeStyle:_,...q}=H,{width:K,height:U,enableHover:X,showLabels:Y=!0,title:Z,description:Q,summary:V,accessibleTable:ee}=o,te=J({nodes:Le(()=>$(i??null,d),[i,d]),edges:void 0,inferNodes:!1,colorBy:v?void 0:g,colorScheme:f,showLegend:!1,legendInteraction:R,selection:x,linkedHover:O,onObservation:D,onClick:L,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Treemap",chartId:P,marginDefaults:o.marginDefaults,userMargin:a,width:K,height:U,hasTitle:!!Z,loading:E,loadingContent:W}),oe=n(x),ne=te.customHoverBehavior,ie=Pe(e=>{if(!e)return ne(null);const t=e.data||e;ne({data:t?.data||t})},[ne]),re=Le(()=>new Map,[]),se=Le(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=v?p[(e.depth||0)%p.length]:g?b(e.data||e,g,te.colorScale):S(void 0,te.themeCategorical,f,void 0,re),t},[g,v,te.colorScale,te.themeCategorical,f,re]),ae=Le(()=>A||_?e=>({...se(e),..._?_(e)??{}:{},...A?A(e)??{}:{}}):se,[se,A,_]),le=Le(()=>e(ae,{stroke:z,strokeWidth:F,opacity:j}),[ae,z,F,j]),ce=Le(()=>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??u;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,oe?.unselectedStyle&&Object.assign(t,oe.unselectedStyle)}return t}:le,[le,te.activeSelectionHook,oe]),de=Le(()=>G(m),[m]),me=void 0!==I?I:!Y||"parent"!==k&&"all"!==k?void 0:18,he=r({componentName:"Treemap",data:i});return he?Ee(B,{componentName:"Treemap",message:he,width:K,height:U}):te.loadingEl?te.loadingEl:Ee(N,{componentName:"Treemap",width:K,height:U,children:Ee(s,{chartType:"treemap",...null!=i&&{data:i},size:[K,U],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,nodeIDAccessor:h,childrenAccessor:d,hierarchySum:de,padding:C,paddingTop:me,nodeStyle:ce,colorBy:g,colorScheme:te.effectivePalette,colorByDepth:v,nodeLabel:Y?w||h:void 0,showLabels:Y,labelMode:k,enableHover:X,tooltipContent:!1===M?()=>null:y(M)||void 0,...c({linkedHover:O,selection:x,onObservation:D,onClick:L,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:Z,description:Q,summary:V,accessibleTable:ee,...null!=t.animate&&{animate:t.animate},...q})})}We.displayName="Treemap";import{useMemo as Re}from"react";import{jsx as ze}from"react/jsx-runtime";function Fe(t){const o=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}),{data:n,margin:i,className:a,childrenAccessor:l="children",valueAccessor:d="value",nodeIdAccessor:m="name",colorBy:h,colorScheme:g,colorByDepth:u=!1,nodeLabel:f,circleOpacity:v=.7,padding:k=4,tooltip:w,frameProps:C={},onObservation:I,onClick:A,chartId:M,selection:H,linkedHover:x,loading:O,loadingContent:D,legendInteraction:L,stroke:P,strokeWidth:E,opacity:W}=t,{width:R,height:z,enableHover:F,showLabels:j=!0,title:_,description:q,summary:K,accessibleTable:U}=o,X=J({nodes:Re(()=>$(n??null,l),[n,l]),edges:void 0,inferNodes:!1,colorBy:u?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:L,selection:H,linkedHover:x,onObservation:I,onClick:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"CirclePack",chartId:M,marginDefaults:o.marginDefaults,userMargin:i,width:R,height:z,hasTitle:!!_,loading:O,loadingContent:D}),Y=Re(()=>new Map,[]),Z=Re(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:v};return t.fill=u?p[(e.depth||0)%p.length]:h?b(e.data||e,h,X.colorScale):S(void 0,X.themeCategorical,g,void 0,Y),t},[h,u,X.colorScale,v,X.themeCategorical,g,Y]),Q=Re(()=>e(Z,{stroke:P,strokeWidth:E,opacity:W}),[Z,P,E,W]),V=Re(()=>G(d),[d]),ee=r({componentName:"CirclePack",data:n});return ee?ze(B,{componentName:"CirclePack",message:ee,width:R,height:z}):X.loadingEl?X.loadingEl:ze(N,{componentName:"CirclePack",width:R,height:z,children:ze(s,{chartType:"circlepack",...null!=n&&{data:n},size:[R,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X.margin,nodeIDAccessor:m,childrenAccessor:l,hierarchySum:V,padding:k,nodeStyle:Q,colorBy:h,colorScheme:X.effectivePalette,colorByDepth:u,nodeLabel:j?f||m:void 0,showLabels:j,enableHover:F,tooltipContent:!1===w?()=>null:y(w)||void 0,...c({linkedHover:x,selection:H,onObservation:I,onClick:A,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior,linkedHoverInClickPredicate:!1}),...L&&"none"!==L&&{legendHoverBehavior:X.legendState.onLegendHover,legendClickBehavior:X.legendState.onLegendClick,legendHighlightedCategory:X.legendState.highlightedCategory,legendIsolatedCategories:X.legendState.isolatedCategories},className:a,title:_,description:q,summary:K,accessibleTable:U,...null!=t.animate&&{animate:t.animate},...C})})}Fe.displayName="CirclePack";import{useMemo as je}from"react";import{jsx as $e}from"react/jsx-runtime";var _e=p;function Ge(t){const o=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}),{data:n,margin:i,className:a,childrenAccessor:l="children",nodeIdAccessor:d="name",colorBy:m,colorScheme:u,colorByDepth:p=!1,orbitMode:f="flat",orbitSize:k=2.95,speed:w=.25,revolution:C,revolutionStyle:I,eccentricity:A=1,showRings:M=!0,nodeRadius:H=6,showLabels:x=!1,animated:O=!0,tooltip:D,foregroundGraphics:L,annotations:P,frameProps:E={},onObservation:W,onClick:R,chartId:z,selection:F,linkedHover:j,loading:_,loadingContent:G,stroke:q,strokeWidth:K,opacity:U}=t,{width:X,height:Y,enableHover:Z,title:Q,description:V,summary:ee,accessibleTable:te}=o,oe=J({nodes:je(()=>$(n,l),[n,l]),edges:void 0,inferNodes:!1,colorBy:p?void 0:m,colorScheme:u,showLegend:!1,legendInteraction:void 0,selection:F,linkedHover:j,onObservation:W,onClick:R,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"OrbitDiagram",chartId:z,marginDefaults:v(o),userMargin:i,width:X,height:Y,hasTitle:!!Q,loading:_,loadingContent:G}),ne=je(()=>new Map,[]),{colorScale:ie,customClickBehavior:re,customHoverBehavior:se,themeCategorical:ae}=oe,le=je(()=>{if(Array.isArray(u))return u;const e=h[u];return Array.isArray(e)?e:g},[u]),ce=je(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=p?o?le[0]:_e[(e.depth||0)%_e.length]:m?b(e.data||e,m,ie):S(void 0,ae,u,void 0,ne),t.opacity=o?1:.85,t},[m,p,ie,le,ae,u,ne]),de=je(()=>e(ce,{stroke:q,strokeWidth:K,opacity:U}),[ce,q,K,U]),me=je(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),he=je(()=>e=>{se(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[se]),ge=je(()=>e=>{re(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[re]),ue=r({componentName:"OrbitDiagram",data:n});return ue?$e(B,{componentName:"OrbitDiagram",message:ue,width:X,height:Y}):oe.loadingEl?oe.loadingEl:$e(N,{componentName:"OrbitDiagram",width:X,height:Y,children:$e(s,{chartType:"orbit",...null!=n&&{data:n},size:[X,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe.margin,nodeIDAccessor:d,childrenAccessor:l,nodeStyle:de,edgeStyle:me,colorBy:m,colorScheme:oe.effectivePalette,colorByDepth:p,nodeSize:H,nodeLabel:x?d:void 0,showLabels:x,enableHover:!O&&Z,tooltipContent:O?void 0:!1===D?()=>null:y(D)||void 0,...c({linkedHover:j,selection:F,onObservation:W,onClick:R,mobileInteraction:oe.mobileInteraction,customHoverBehavior:he,customClickBehavior:ge,linkedHoverInClickPredicate:!1}),foregroundGraphics:L,annotations:P,className:a,title:Q,description:V,summary:ee,orbitMode:f,orbitSize:k,orbitSpeed:w,orbitRevolution:C,orbitRevolutionStyle:I,orbitEccentricity:A,orbitShowRings:M,orbitAnimated:O,accessibleTable:te,...null!=t.animate&&{animate:t.animate},...E})})}Ge.displayName="OrbitDiagram";export{W as NetworkCustomChart,U as ForceDirectedGraph,V as ChordDiagram,ie as SankeyDiagram,re as validateProcessSankey,se as formatProcessSankeyIssue,Be as ProcessSankey,De as TreeDiagram,We as Treemap,Fe as CirclePack,Ge as OrbitDiagram};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{buildColorStopGradient as t,buildThresholdLineSegments as e,resolveCSSColor as l,resolveCanvasFill as o,resolveCurveFactory as n}from"./chunk-chunk-7ZDJSYKI.module.min.js";import{line as a}from"d3-shape";function i(t,e,l,o,n,a){if(2>e.length)return;const i=[0];for(let t=1;e.length>t;t++){const l=e[t][0]-e[t-1][0],o=e[t][1]-e[t-1][1];i.push(i[t-1]+Math.sqrt(l*l+o*o))}const h=i[i.length-1];if(0===h)return;const s=Math.min(.2*h,40);t.strokeStyle=l,t.lineWidth=o,t.lineCap=a;for(let l=0;e.length-1>l;l++){const o=(i[l]+i[l+1])/2;let a=n;s>o&&(a*=o/s),s>h-o&&(a*=(h-o)/s),t.globalAlpha=Math.max(0,a),t.beginPath(),t.moveTo(e[l][0],e[l][1]),t.lineTo(e[l+1][0],e[l+1][1]),t.stroke()}}var h=(h,s,r,p)=>{const c=s.filter(t=>"line"===t.type);for(const s of c){if(2>s.path.length)continue;const r=s._introClipFraction;void 0!==r&&1>r&&(h.save(),h.beginPath(),h.rect(0,0,p.width*r,p.height),h.clip());const c=s.style.stroke||"#007bff",f=l(h,c)||c,y=s.style.strokeWidth||2,g=s.colorThresholds,u=s.rawValues;if(h.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(h.globalAlpha=s.style.opacity),h.lineWidth=y,h.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){i(h,s.path,f,y,s.style.opacity??1,s.style.strokeLinecap||"butt"),h.globalAlpha=1,h.setLineDash([]),h.lineCap="butt";continue}const k=n(s.curve),b=g&&g.length>0&&u&&u.length===s.path.length,d=s._decayOpacities;if(d&&d.length===s.path.length&&!b){h.strokeStyle=f;const t=s.style.opacity??1;for(let e=0;s.path.length-1>e;e++)h.globalAlpha=.5*(d[e]+d[e+1])*t,h.beginPath(),h.moveTo(s.path[e][0],s.path[e][1]),h.lineTo(s.path[e+1][0],s.path[e+1][1]),h.stroke()}else if(b){const t=e(s.path,u,g,f);for(const e of t){h.beginPath(),h.strokeStyle=l(h,e.color)||e.color,h.moveTo(e.path[0][0],e.path[0][1]);for(let t=1;e.path.length>t;t++)h.lineTo(e.path[t][0],e.path[t][1]);h.stroke()}}else{h.beginPath();const e=s.strokeGradient&&s.path.length>=2?t(h,s.strokeGradient,f,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(h.strokeStyle=e||f,k)a().x(t=>t[0]).y(t=>t[1]).curve(k).context(h)(s.path);else{const[t,e]=s.path[0];h.moveTo(t,e);for(let t=1;s.path.length>t;t++)h.lineTo(s.path[t][0],s.path[t][1])}h.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(h.beginPath(),h.globalAlpha=s.style.fillOpacity,h.fillStyle=o(h,s.style.fill,s.style.fill),k&&!b)a().x(t=>t[0]).y(t=>t[1]).curve(k).context(h)(s.path);else{const[t,e]=s.path[0];h.moveTo(t,e);for(let t=1;s.path.length>t;t++)h.lineTo(s.path[t][0],s.path[t][1])}const t=s.path[0][0];h.lineTo(s.path[s.path.length-1][0],p.height),h.lineTo(t,p.height),h.closePath(),h.fill()}void 0!==r&&1>r&&h.restore(),h.globalAlpha=1,h.setLineDash([]),h.lineCap="butt"}};function s(t){if(!t)return null;if("heatcell"===t.type)return t.fill||null;if("candlestick"===t.type)return t.isUp?t.upColor:t.downColor;const{style:e}=t;if(!e)return null;const l="string"==typeof e.fill?e.fill:null;return"line"===t.type||"area"===t.type?e.stroke||l||null:l||e.stroke||null}export{h as lineCanvasRenderer,s as resolveNodeColor};
|