semiotic 3.8.9 → 3.9.1
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/README.md +55 -81
- package/agent-skill/semiotic-charts/SKILL.md +11 -2
- package/ai/behaviorContracts.cjs +33 -3
- package/ai/cli.js +53 -2
- package/ai/componentMetadata.cjs +15 -0
- package/ai/dist/mcp-server.js +1530 -611
- package/ai/examples.md +48 -42
- package/{CLAUDE.md → ai/reference.md} +43 -22
- package/ai/schema.json +10603 -986
- package/ai/surface-manifest.json +643 -2
- package/ai/system-prompt.md +83 -130
- package/dist/c-3BLJEQNG.min.js +1 -0
- package/dist/c-3KZD6AXJ.min.js +1 -0
- package/dist/c-4TWEX5HG.min.js +1 -0
- package/dist/c-52TEGIUJ.min.js +1 -0
- package/dist/c-5YCIX3VZ.min.js +1 -0
- package/dist/c-6FEKTA3U.min.js +1 -0
- package/dist/c-6O5EVOPH.min.js +1 -0
- package/dist/c-74HEEZGK.min.js +1 -0
- package/dist/c-AKAF6JAD.min.js +1 -0
- package/dist/c-BBKITSXB.min.js +1 -0
- package/dist/c-BWNB6USU.min.js +1 -0
- package/dist/c-C25ENHIK.min.js +1 -0
- package/dist/c-CDR5AO3R.min.js +1 -0
- package/dist/c-COHXCW3Q.min.js +1 -0
- package/dist/{chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js → c-DADXPJXV.min.js} +0 -1
- package/dist/c-E3JFRRMI.min.js +1 -0
- package/dist/c-EBFPQHHO.min.js +1 -0
- package/dist/c-G36WS6LN.min.js +1 -0
- package/dist/c-GIKRQI4X.min.js +1 -0
- package/dist/c-GPYOFETM.min.js +1 -0
- package/dist/c-IDUHYYSI.min.js +1 -0
- package/dist/{chunk-chunk-FQPKOAIH.module.min.js → c-IUHFPMHD.min.js} +0 -1
- package/dist/c-J5G56TUH.min.js +1 -0
- package/dist/c-JAZ73J32.min.js +1 -0
- package/dist/c-KG3NXHAL.min.js +1 -0
- package/dist/c-KII3PLZE.min.js +1 -0
- package/dist/c-LIXGXMNS.min.js +1 -0
- package/dist/c-LVEY6D6B.min.js +1 -0
- package/dist/c-M4Y3BHFR.min.js +1 -0
- package/dist/c-MAIICR2Z.min.js +1 -0
- package/dist/c-MG5DM6VE.min.js +1 -0
- package/dist/{chunk-minimapBrushOverlay-JU57U7NM.module.min.js → c-MNF2S4AA.min.js} +0 -1
- package/dist/c-MT3WBK7M.min.js +1 -0
- package/dist/c-NY3JWV2K.min.js +1 -0
- package/dist/c-O6U6K4CW.min.js +1 -0
- package/dist/c-OCI56QF2.min.js +1 -0
- package/dist/c-OQ7M4AGV.min.js +1 -0
- package/dist/c-OXYMVK7Q.min.js +1 -0
- package/dist/c-PPWDL5ZI.min.js +1 -0
- package/dist/c-QHF5YON3.min.js +1 -0
- package/dist/c-RR3GO5SW.min.js +1 -0
- package/dist/{chunk-chunk-J5QD4RAM.module.min.js → c-RSVIHIQ4.min.js} +0 -1
- package/dist/{chunk-chunk-EMO5NUGE.module.min.js → c-S2BXNNJN.min.js} +0 -1
- package/dist/{chunk-chunk-YCQYG6J5.module.min.js → c-SLGMUBUL.min.js} +0 -1
- package/dist/c-SUILCHWU.min.js +1 -0
- package/dist/c-TZW3JGJ5.min.js +1 -0
- package/dist/c-US5ZFT6E.min.js +1 -0
- package/dist/{chunk-chunk-RZH7VZYS.module.min.js → c-USFMFKIH.min.js} +0 -1
- package/dist/c-UUKVD4WB.min.js +1 -0
- package/dist/{chunk-chunk-SV4XAZ3Q.module.min.js → c-VGW3VG3I.min.js} +0 -1
- package/dist/c-W3CE4A4S.min.js +1 -0
- package/dist/{chunk-chunk-2NVFEB7P.module.min.js → c-WJCD5EUY.min.js} +0 -1
- package/dist/{chunk-chunk-2JGJ5GUG.module.min.js → c-X5UBGU2V.min.js} +0 -1
- package/dist/c-YDAY2WFR.min.js +1 -0
- package/dist/c-ZOWWU34K.min.js +1 -0
- package/dist/components/AccessibleNavTree.d.ts +1 -1
- package/dist/components/CategoryColors.d.ts +1 -1
- package/dist/components/GradientLegend.d.ts +14 -0
- package/dist/components/Legend.d.ts +2 -7
- package/dist/components/LinkedCharts.d.ts +1 -1
- package/dist/components/MobileAnnotationCalloutList.d.ts +1 -1
- package/dist/components/ObservationReadout.d.ts +45 -0
- package/dist/components/ThemeProvider.d.ts +4 -4
- package/dist/components/Tooltip/FlippingTooltip.d.ts +5 -7
- package/dist/components/Tooltip/Tooltip.d.ts +30 -5
- package/dist/components/Tooltip/tooltipChrome.d.ts +43 -0
- package/dist/components/ai/chartCapabilityTypes.d.ts +86 -2
- package/dist/components/ai/chartClinic.d.ts +2 -0
- package/dist/components/ai/deriveProfileFields.d.ts +40 -0
- package/dist/components/ai/evaluateChart.d.ts +85 -0
- package/dist/components/ai/fieldPolicy.d.ts +7 -0
- package/dist/components/ai/fieldRoles.d.ts +24 -0
- package/dist/components/ai/generativeChart.d.ts +18 -2
- package/dist/components/ai/inferIntent.d.ts +26 -2
- package/dist/components/ai/intents.d.ts +35 -0
- package/dist/components/ai/navigationTree.d.ts +2 -2
- package/dist/components/ai/observedSceneAudit.d.ts +2 -1
- package/dist/components/ai/profileData.d.ts +11 -0
- package/dist/components/ai/repairChartConfig.d.ts +2 -3
- package/dist/components/ai/semanticEvidence.d.ts +4 -0
- package/dist/components/ai/semanticViability.d.ts +11 -0
- package/dist/components/ai/semanticViabilityRegistry.d.ts +5 -0
- package/dist/components/ai/streamingTypes.d.ts +4 -0
- package/dist/components/ai/suggestCharts.d.ts +5 -6
- package/dist/components/ai/suggestDashboard.d.ts +2 -3
- package/dist/components/ai/suggestStreamCharts.d.ts +1 -1
- package/dist/components/ai/suggestStretchCharts.d.ts +2 -3
- package/dist/components/ai/suggestionPropContracts.d.ts +20 -0
- package/dist/components/ai/variantDiscovery.d.ts +3 -1
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +3 -0
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +3 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +1 -1
- package/dist/components/charts/geo/ChoroplethMap.d.ts +3 -1
- package/dist/components/charts/geo/DistanceCartogram.d.ts +2 -7
- package/dist/components/charts/geo/cartogramOverlay.d.ts +28 -0
- package/dist/components/charts/index.d.ts +4 -3
- package/dist/components/charts/network/ProcessSankey.d.ts +2 -136
- package/dist/components/charts/network/ProcessSankeyProps.d.ts +139 -0
- package/dist/components/charts/network/Treemap.d.ts +2 -1
- package/dist/components/charts/network/processSankey/boundaryHubOrdering.d.ts +23 -0
- package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +2 -0
- package/dist/components/charts/network/processSankey/ordering.d.ts +3 -41
- package/dist/components/charts/network/processSankey/orderingTypes.d.ts +32 -0
- package/dist/components/charts/network/processSankey/packing.d.ts +1 -1
- package/dist/components/charts/network/processSankey/packingCache.d.ts +1 -1
- package/dist/components/charts/network/processSankey/packingOptimization.d.ts +72 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +4 -3
- package/dist/components/charts/ordinal/FunnelChart.d.ts +2 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -2
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -3
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +2 -2
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +2 -9
- package/dist/components/charts/physics/GauntletChart.d.ts +10 -41
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +1 -1
- package/dist/components/charts/physics/chainReactionAccessibleTable.d.ts +9 -0
- package/dist/components/charts/physics/chainReactionRuntime.d.ts +2 -1
- package/dist/components/charts/physics/chainReactionTypes.d.ts +5 -1
- package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +2 -2
- package/dist/components/charts/physics/crucibleClone.d.ts +6 -0
- package/dist/components/charts/physics/crucibleEffects.d.ts +1 -2
- package/dist/components/charts/physics/crucibleRecord.d.ts +7 -0
- package/dist/components/charts/physics/gauntletChrome.d.ts +4 -4
- package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
- package/dist/components/charts/physics/gauntletPublic.d.ts +4 -0
- package/dist/components/charts/physics/packetFlowOverlay.d.ts +7 -0
- package/dist/components/charts/physics/physicsChartLayout.d.ts +8 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +3 -1
- package/dist/components/charts/physics/physicsChartUtils.d.ts +1 -1
- package/dist/components/charts/physics/physicsHocUtils.d.ts +25 -12
- package/dist/components/charts/physics/physicsProjectionOverlays.d.ts +24 -0
- package/dist/components/charts/physics/processFlowOverlays.d.ts +9 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +15 -12
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +10 -7
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +35 -14
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +21 -14
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +20 -13
- package/dist/components/charts/realtime/aggregate.d.ts +4 -1
- package/dist/components/charts/realtime/eventTime.d.ts +4 -0
- package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +27 -0
- package/dist/components/charts/realtime/realtimeChartTypes.d.ts +30 -0
- package/dist/components/charts/realtime/useRealtimeCategoryColors.d.ts +30 -0
- package/dist/components/charts/shared/FrameTextAnnotationSVG.d.ts +10 -0
- package/dist/components/charts/shared/annotationActivation.d.ts +3 -7
- package/dist/components/charts/shared/annotationBandFill.d.ts +6 -0
- package/dist/components/charts/shared/annotationDispatch.d.ts +31 -0
- package/dist/components/charts/shared/annotationIdentity.d.ts +8 -0
- package/dist/components/charts/shared/annotationRules.d.ts +1 -15
- package/dist/components/charts/shared/boundedCategoryRegistry.d.ts +8 -0
- package/dist/components/charts/shared/chainReactionChartSpec.d.ts +3 -0
- package/dist/components/charts/shared/chartMode.d.ts +3 -2
- package/dist/components/charts/shared/chartSpecCore.d.ts +1 -0
- package/dist/components/charts/shared/frameTextAnnotation.d.ts +63 -0
- package/dist/components/charts/shared/gradient.d.ts +16 -0
- package/dist/components/charts/shared/hatchFill.d.ts +15 -0
- package/dist/components/charts/shared/hooks.d.ts +4 -4
- package/dist/components/charts/shared/legendUtils.d.ts +1 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -1
- package/dist/components/charts/shared/styleRules.d.ts +9 -2
- package/dist/components/charts/shared/styleRulesWireSchema.d.ts +353 -0
- package/dist/components/charts/shared/types.d.ts +18 -9
- package/dist/components/charts/shared/useChartLegend.d.ts +43 -9
- package/dist/components/charts/shared/useChartSetup.d.ts +3 -1
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +5 -2
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +5 -1
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +3 -3
- package/dist/components/charts/shared/useStreamingLegend.d.ts +6 -1
- package/dist/components/charts/value/types.d.ts +1 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
- package/dist/components/charts/xy/BumpChart.capability.d.ts +14 -1
- package/dist/components/charts/xy/BumpChart.d.ts +13 -73
- package/dist/components/charts/xy/BumpChart.semanticViability.d.ts +5 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +2 -2
- package/dist/components/charts/xy/LineChart.d.ts +2 -2
- package/dist/components/charts/xy/Scatterplot.d.ts +1 -1
- package/dist/components/charts/xy/bumpData.d.ts +44 -0
- package/dist/components/charts/xy/bumpIdentity.d.ts +2 -0
- package/dist/components/charts/xy/bumpLayout.d.ts +45 -0
- package/dist/components/charts/xy/bumpTooltip.d.ts +20 -0
- package/dist/components/legendLayout.d.ts +131 -4
- package/dist/components/realtime/ReorderBuffer.d.ts +2 -0
- package/dist/components/realtime/types.d.ts +10 -1
- package/dist/components/recipes/balanceSnapshotsToFlows.d.ts +42 -0
- package/dist/components/recipes/directedReachability.d.ts +14 -0
- package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +6 -6
- package/dist/components/recipes/gridObservatory.d.ts +1 -1
- package/dist/components/recipes/networkAnalysis.d.ts +1 -18
- package/dist/components/recipes/physics.d.ts +7 -4
- package/dist/components/recipes/processPhysics.d.ts +0 -1
- package/dist/components/recipes/waffle.d.ts +7 -4
- package/dist/components/semiotic-ai-core.d.ts +13 -4
- package/dist/components/semiotic-ai-observations.d.ts +3 -0
- package/dist/components/semiotic-ai.d.ts +16 -9
- package/dist/components/semiotic-client-shared.d.ts +10 -0
- package/dist/components/semiotic-experimental.d.ts +1 -1
- package/dist/components/semiotic-geo.d.ts +4 -1
- package/dist/components/semiotic-network.d.ts +7 -4
- package/dist/components/semiotic-ordinal.d.ts +4 -1
- package/dist/components/semiotic-physics.d.ts +11 -4
- package/dist/components/semiotic-realtime-core.d.ts +11 -4
- package/dist/components/semiotic-realtime-react.d.ts +4 -3
- package/dist/components/semiotic-realtime.d.ts +3 -1
- package/dist/components/semiotic-recipes-core.d.ts +7 -5
- package/dist/components/semiotic-server-edge.d.ts +3 -2
- package/dist/components/semiotic-server.d.ts +3 -2
- package/dist/components/semiotic-themes-core.d.ts +5 -48
- package/dist/components/semiotic-utils-core.d.ts +10 -5
- package/dist/components/semiotic-utils-react.d.ts +2 -0
- package/dist/components/semiotic-utils.d.ts +1 -1
- package/dist/components/semiotic-xy.d.ts +4 -1
- package/dist/components/semiotic.d.ts +68 -26
- package/dist/components/server/animatedGif.d.ts +1 -1
- package/dist/components/server/renderEvidence.d.ts +25 -2
- package/dist/components/server/renderToStaticSVG.d.ts +15 -7
- package/dist/components/server/serverChartConfigShared.d.ts +8 -1
- package/dist/components/server/serverChartConfigs.d.ts +1 -0
- package/dist/components/server/serverChartConfigsNetwork.d.ts +3 -3
- package/dist/components/server/serverChartConfigsNetworkChord.d.ts +2 -0
- package/dist/components/server/serverChartConfigsNetworkForce.d.ts +2 -0
- package/dist/components/server/serverChartConfigsNetworkHierarchy.d.ts +3 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +3 -3
- package/dist/components/server/serverChartConfigsXYBubble.d.ts +5 -0
- package/dist/components/server/serverChartConfigsXYBump.d.ts +7 -0
- package/dist/components/server/serverChartConfigsXYScatter.d.ts +5 -0
- package/dist/components/server/staticAnnotationFallbacks.d.ts +10 -0
- package/dist/components/server/staticAnnotations.d.ts +28 -1
- package/dist/components/server/staticAxisTickLabel.d.ts +13 -0
- package/dist/components/server/staticLegend.d.ts +1 -1
- package/dist/components/server/staticLegendMargin.d.ts +41 -0
- package/dist/components/server/staticOrdinal.d.ts +8 -2
- package/dist/components/server/staticPhysics.d.ts +13 -1
- package/dist/components/server/staticPhysicsChrome.d.ts +20 -0
- package/dist/components/server/staticRawLegend.d.ts +15 -0
- package/dist/components/server/staticSVGChrome.d.ts +16 -55
- package/dist/components/server/staticXYAxes.d.ts +27 -0
- package/dist/components/server/staticXYAxisTicks.d.ts +39 -0
- package/dist/components/server/staticXYGrid.d.ts +11 -0
- package/dist/components/server/themeResolver.d.ts +5 -1
- package/dist/components/store/ThemeStore.d.ts +2 -98
- package/dist/components/store/designTokens.d.ts +1 -1
- package/dist/components/store/themeCSSVariables.d.ts +10 -0
- package/dist/components/store/themeCore.d.ts +91 -0
- package/dist/components/store/themePresets.d.ts +81 -0
- package/dist/components/store/themeSerialization.d.ts +2 -1
- package/dist/components/stream/AccessibleDataTable.d.ts +12 -14
- package/dist/components/stream/AccessibleTablePortalImpl.d.ts +6 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +2 -0
- package/dist/components/stream/NetworkCanvasHitTester.d.ts +3 -1
- package/dist/components/stream/NetworkSSRFrame.d.ts +2 -1
- package/dist/components/stream/NetworkSVGOverlay.d.ts +3 -31
- package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -0
- package/dist/components/stream/SVGChartTitle.d.ts +9 -0
- package/dist/components/stream/SVGOverlay.d.ts +1 -21
- package/dist/components/stream/SVGUnderlay.d.ts +24 -0
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
- package/dist/components/stream/StreamXYFrame.d.ts +1 -1
- package/dist/components/stream/accessibleDataRows.d.ts +11 -0
- package/dist/components/stream/accessibleDataTableModel.d.ts +40 -0
- package/dist/components/stream/accessibleTableTypes.d.ts +11 -0
- package/dist/components/stream/axisTickUtils.d.ts +19 -0
- package/dist/components/stream/canvasBackground.d.ts +10 -0
- package/dist/components/stream/canvasSetup.d.ts +9 -0
- package/dist/components/stream/frameCursorInteraction.d.ts +25 -0
- package/dist/components/stream/frameDefaultMargins.d.ts +37 -0
- package/dist/components/stream/frameGraphics.d.ts +18 -0
- package/dist/components/stream/frameGraphicsSubscription.d.ts +26 -0
- package/dist/components/stream/frameLegendOptions.d.ts +18 -0
- package/dist/components/stream/geoFrameCursorInteraction.d.ts +9 -0
- package/dist/components/stream/geoFrameHelpers.d.ts +29 -1
- package/dist/components/stream/geoTypes.d.ts +10 -11
- package/dist/components/stream/hitTarget.d.ts +61 -2
- package/dist/components/stream/moduleWorkerSession.d.ts +6 -0
- package/dist/components/stream/networkAnnotationAnchors.d.ts +37 -0
- package/dist/components/stream/networkCustomLayout.d.ts +2 -2
- package/dist/components/stream/networkFrameCursorInteraction.d.ts +12 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +2 -0
- package/dist/components/stream/networkFramePaint.d.ts +7 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +1 -1
- package/dist/components/stream/networkTypes.d.ts +30 -32
- package/dist/components/stream/normalizeXYData.d.ts +7 -0
- package/dist/components/stream/ordinalFrameCursorInteraction.d.ts +7 -0
- package/dist/components/stream/ordinalFrameInteraction.d.ts +29 -0
- package/dist/components/stream/ordinalSceneSVG.d.ts +10 -0
- package/dist/components/stream/ordinalTypes.d.ts +10 -4
- package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +9 -1
- package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +25 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +0 -3
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +4 -1
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +3 -24
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +9 -21
- package/dist/components/stream/physics/PhysicsSettledSVGElement.d.ts +37 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +7 -3
- package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +1 -1
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +23 -4
- package/dist/components/stream/physics/physicsAnnotationContext.d.ts +19 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +4 -0
- package/dist/components/stream/physics/physicsSettledChrome.d.ts +7 -0
- package/dist/components/stream/physics/usePhysicsCanvasPointer.d.ts +32 -0
- package/dist/components/stream/physics/usePhysicsSemanticNavigation.d.ts +36 -0
- package/dist/components/stream/pipelineConfig.d.ts +6 -17
- package/dist/components/stream/pipelineDomainResolution.d.ts +1 -1
- package/dist/components/stream/renderBackend.d.ts +2 -0
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +13 -2
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +7 -0
- package/dist/components/stream/responsiveSize.d.ts +17 -0
- package/dist/components/stream/sceneCursor.d.ts +41 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +1 -1
- package/dist/components/stream/svgOverlayUtils.d.ts +22 -1
- package/dist/components/stream/types.d.ts +25 -12
- package/dist/components/stream/useCanvasFrameHost.d.ts +3 -1
- package/dist/components/stream/useFrame.d.ts +24 -1
- package/dist/components/stream/useResponsiveSize.d.ts +6 -1
- package/dist/components/stream/useStalenessCheck.d.ts +1 -1
- package/dist/components/stream/xyFrameAxisTypes.d.ts +15 -4
- package/dist/components/stream/xyFrameCursorInteraction.d.ts +6 -0
- package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +1 -1
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -26
- package/dist/components/types/legendTypes.d.ts +6 -0
- package/dist/components/types/marginType.d.ts +7 -8
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- package/dist/forceLayoutWorker.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-matter.module.min.js +1 -1
- package/dist/physics-rapier.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/processSankeyLayoutWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-ai-core.d.ts +13 -4
- 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 +16 -9
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-client-cjs-shared.min.js +1 -0
- package/dist/semiotic-client-glyph.module.min.js +2 -0
- package/dist/semiotic-client-responsive.module.min.js +2 -0
- package/dist/semiotic-client-shared.module.min.js +2 -0
- package/dist/semiotic-custom-layout-selection-cjs-shared.min.js +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental-auxiliary.module.min.js +2 -0
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +2 -0
- package/dist/semiotic-experimental-node.module.min.js +2 -0
- package/dist/semiotic-experimental-react-shared.module.min.js +2 -0
- package/dist/semiotic-experimental-vacp.min.js +1 -1
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +4 -1
- package/dist/semiotic-network.d.ts +7 -4
- package/dist/semiotic-ordinal.d.ts +4 -1
- package/dist/semiotic-physics.d.ts +11 -4
- package/dist/semiotic-realtime-core.d.ts +11 -4
- package/dist/semiotic-realtime-core.min.js +2 -1
- package/dist/semiotic-realtime-core.module.min.js +2 -1
- package/dist/semiotic-realtime-react.d.ts +4 -3
- package/dist/semiotic-realtime-react.min.js +1 -1
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-realtime.d.ts +3 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +1 -0
- package/dist/semiotic-recipes-core.d.ts +7 -5
- package/dist/semiotic-recipes-core.min.js +9 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes-geo-cjs.min.js +1 -0
- package/dist/semiotic-recipes-react.min.js +1 -1
- package/dist/semiotic-recipes-react.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +7 -1
- package/dist/semiotic-recipes.module.min.js +2 -1
- package/dist/semiotic-server-edge-node.module.min.js +1 -0
- package/dist/semiotic-server-edge.d.ts +3 -2
- 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 +3 -2
- package/dist/semiotic-themes-core.d.ts +5 -48
- package/dist/semiotic-themes-core.min.js +1 -1
- package/dist/semiotic-themes-core.module.min.js +1 -1
- package/dist/semiotic-themes-react.min.js +1 -1
- package/dist/semiotic-themes-react.module.min.js +1 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils-core.d.ts +10 -5
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils-react.d.ts +2 -0
- package/dist/semiotic-utils-react.min.js +1 -1
- package/dist/semiotic-utils-react.module.min.js +1 -1
- package/dist/semiotic-utils.d.ts +1 -1
- package/dist/semiotic-utils.min.js +2 -1
- package/dist/semiotic-utils.module.min.js +2 -1
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +4 -1
- package/dist/semiotic.d.ts +68 -26
- 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 +53 -19
- package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +0 -20
- package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +0 -2
- package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +0 -1
- package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +0 -2
- package/dist/chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js +0 -2
- package/dist/chunk-chunk-2B3AIKUZ.module.min.js +0 -2
- package/dist/chunk-chunk-2CXCXRB4.module.min.js +0 -1
- package/dist/chunk-chunk-2X3FJCME.module.min.js +0 -1
- package/dist/chunk-chunk-2ZHHWZQM.module.min.js +0 -2
- package/dist/chunk-chunk-4ITOQRXM.module.min.js +0 -2
- package/dist/chunk-chunk-5UKL5W76.module.min.js +0 -2
- package/dist/chunk-chunk-5VVNW5AZ.module.min.js +0 -1
- package/dist/chunk-chunk-5ZON5NMV.module.min.js +0 -2
- package/dist/chunk-chunk-66PCWJUG.module.min.js +0 -1
- package/dist/chunk-chunk-6S3YGYW7.module.min.js +0 -1
- package/dist/chunk-chunk-6V5VQVCT.module.min.js +0 -2
- package/dist/chunk-chunk-7C5EDZ3Z.module.min.js +0 -2
- package/dist/chunk-chunk-A3I4HBD5.module.min.js +0 -1
- package/dist/chunk-chunk-ACLDBMRH.module.min.js +0 -2
- package/dist/chunk-chunk-AFQHURLO.module.min.js +0 -2
- package/dist/chunk-chunk-DDB4TLQG.module.min.js +0 -2
- package/dist/chunk-chunk-DTH3SUOU.module.min.js +0 -2
- package/dist/chunk-chunk-DTSNLGRK.module.min.js +0 -2
- package/dist/chunk-chunk-DVCWU7MT.module.min.js +0 -2
- package/dist/chunk-chunk-FEPXDKJP.module.min.js +0 -1
- package/dist/chunk-chunk-FJ76HWQZ.module.min.js +0 -1
- package/dist/chunk-chunk-FSIHAW6L.module.min.js +0 -2
- package/dist/chunk-chunk-G2RGVEYY.module.min.js +0 -2
- package/dist/chunk-chunk-G75OPF5N.module.min.js +0 -2
- package/dist/chunk-chunk-HADHLMY5.module.min.js +0 -1
- package/dist/chunk-chunk-HAJVODLO.module.min.js +0 -2
- package/dist/chunk-chunk-HBFA4NN6.module.min.js +0 -1
- package/dist/chunk-chunk-HIV7AW2V.module.min.js +0 -2
- package/dist/chunk-chunk-IY7RYD4S.module.min.js +0 -1
- package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
- package/dist/chunk-chunk-J3XWETBJ.module.min.js +0 -2
- package/dist/chunk-chunk-JZAMMSQQ.module.min.js +0 -2
- package/dist/chunk-chunk-KTWEBFMX.module.min.js +0 -2
- package/dist/chunk-chunk-LSJUXBMF.module.min.js +0 -1
- package/dist/chunk-chunk-MXMRXSCI.module.min.js +0 -2
- package/dist/chunk-chunk-MXVBXFKW.module.min.js +0 -2
- package/dist/chunk-chunk-NWIGA3UK.module.min.js +0 -1
- package/dist/chunk-chunk-OFAP623Y.module.min.js +0 -2
- package/dist/chunk-chunk-OHLRAEQZ.module.min.js +0 -2
- package/dist/chunk-chunk-OZK46A5U.module.min.js +0 -1
- package/dist/chunk-chunk-PMR47KRY.module.min.js +0 -2
- package/dist/chunk-chunk-PRNXOCYZ.module.min.js +0 -2
- package/dist/chunk-chunk-Q2YADC2V.module.min.js +0 -2
- package/dist/chunk-chunk-RLKZVJMQ.module.min.js +0 -2
- package/dist/chunk-chunk-ROP4HI7H.module.min.js +0 -2
- package/dist/chunk-chunk-SK2TQMG4.module.min.js +0 -2
- package/dist/chunk-chunk-SKLYXNYW.module.min.js +0 -2
- package/dist/chunk-chunk-TCMHJWFJ.module.min.js +0 -1
- package/dist/chunk-chunk-TSCFL235.module.min.js +0 -1
- package/dist/chunk-chunk-U4NZCU5T.module.min.js +0 -2
- package/dist/chunk-chunk-U66USBWU.module.min.js +0 -1
- package/dist/chunk-chunk-UOQRPGPK.module.min.js +0 -2
- package/dist/chunk-chunk-VKL6DI43.module.min.js +0 -2
- package/dist/chunk-chunk-W62673ZE.module.min.js +0 -1
- package/dist/chunk-chunk-WFHZHWT7.module.min.js +0 -1
- package/dist/chunk-chunk-XCC25CZZ.module.min.js +0 -2
- package/dist/chunk-chunk-XECNOUZY.module.min.js +0 -2
- package/dist/chunk-chunk-XYZDTYAF.module.min.js +0 -2
- package/dist/chunk-chunk-YHNZCPOZ.module.min.js +0 -2
- package/dist/chunk-chunk-YWZB3KPI.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +0 -2
- package/dist/components/stream/test-utils/frameScheduler.d.ts +0 -12
- package/dist/components/stream/test-utils/revisionConsumption.d.ts +0 -13
- package/dist/test-utils/canvasMock.d.ts +0 -86
- package/dist/test-utils/capturedFrameProps.d.ts +0 -67
- package/dist/test-utils/frameMock.d.ts +0 -81
- package/dist/test-utils/ordinalFixtures.d.ts +0 -48
- /package/dist/{chunk-chunk-JJ2OOIET.module.min.js → c-GGISSW5E.min.js} +0 -0
- /package/dist/{chunk-chunk-SIRIJ3DY.module.min.js → c-N4G2L7ID.min.js} +0 -0
- /package/dist/{chunk-chunk-CA3YDW6F.module.min.js → c-S6U5CGT5.min.js} +0 -0
- /package/dist/components/recipes/{mobileAnnotationStrategy.d.ts → mobileAnnotationBehavior.d.ts} +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{mergeShapeStyle as e,useCustomChartScaffold as t,useFrameImperativeHandle as o,useResolvedSelection as n}from"./chunk-chunk-MXMRXSCI.module.min.js";import{validateNetworkData as i,validateObjectData as a}from"./chunk-chunk-J5QD4RAM.module.min.js";import{ModuleWorkerSession as s,StreamNetworkFrame_default as r,buildRibbonGeometry as l,createSharedWorkerSessionHolder as c,errorFromPayload as d,parseModuleWorkerErrorField as u}from"./chunk-chunk-OFAP623Y.module.min.js";import{buildBaseMetadataProps as m,buildCustomBehaviorProps as g}from"./chunk-chunk-DVCWU7MT.module.min.js";import{composeStyleRules as f,makeNodeRuleContext as h,resolveStyleRules as p}from"./chunk-chunk-EMO5NUGE.module.min.js";import{commonJsWorkerModuleUrl as b}from"./chunk-chunk-SV4XAZ3Q.module.min.js";import{COLOR_SCHEMES as y,DEFAULT_COLORS as v,DEFAULT_SELECTION_OPACITY as k,DEPTH_PALETTE_COLORS as w,distinctCategories as x,filterSparseArray as M,getColor as S,isHatchFill as T,normalizeTooltip as C,resolveAxisFreeMarginDefaults as A,resolveCategoricalPalette as I,resolveDefaultFill as O,resolveMobileInteraction as P,useChartLegendAndMargin as N,useChartMode as H,useChartSelection as B,useColorScale as L,useLegendInteraction as D,useThemeCategorical as E}from"./chunk-chunk-SK2TQMG4.module.min.js";import{getMin as F}from"./chunk-chunk-2NVFEB7P.module.min.js";import{ChartError as R,SafeRender as z,renderEmptyState as W,renderLoadingState as j,useWasHydratingFromSSR as $}from"./chunk-chunk-ACLDBMRH.module.min.js";import{forwardRef as _,useMemo as X}from"react";import{jsx as q}from"react/jsx-runtime";var Y=_(function(e,o){const{nodes:n,edges:i,layout:a,layoutConfig:s,onLayoutError:l,nodeIDAccessor:c="id",sourceAccessor:d="source",targetAccessor:u="target",margin:f,className:h,colorBy:p,colorScheme:b,selection:y,linkedHover:v,onObservation:k,onClick:w,chartId:x,annotations:S,autoPlaceAnnotations:T,frameProps:C={}}=e,{frameRef:A,resolved:I,normalizedMargin:O}=t({imperativeRef:o,imperativeVariant:"network",margin:f,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}),N=X(()=>M(n),[n]),H=X(()=>M(i),[i]),L=X(()=>void 0===n&&void 0===i?void 0:[...N,...H],[i,n,H,N]),D=P(e.mobileInteraction,{mode:e.mode,width:I.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:E,customClickBehavior:F,activeSelectionHook:R}=B({selection:y,linkedHover:v,fallbackFields:"string"==typeof p?[p]:[],onObservation:k,onClick:w,chartType:"NetworkCustomChart",chartId:x,colorByField:"string"==typeof p?p:void 0,mobileInteraction:D}),$=X(()=>R?.isActive?{isActive:!0,predicate:R.predicate}:null,[R?.isActive,R?.predicate]),{width:_,height:Y,enableHover:G,title:V,description:U,summary:Q,accessibleTable:J}=I,K=j(e.loading,_,Y,e.loadingContent),Z=K?null:W(L,_,Y,e.emptyContent);if(K||Z)return K||Z;const ee={chartType:"force",...null!=n&&{nodes:N},...null!=i&&{edges:H},customNetworkLayout:a,layoutConfig:s,onLayoutError:l,nodeIDAccessor:c,sourceAccessor:d,targetAccessor:u,colorBy:p,colorScheme:b,size:[_,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:O,enableHover:G,...m({title:V,description:U,summary:Q,accessibleTable:J,className:h,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,autoPlaceAnnotations:T}),...g({linkedHover:v,selection:y,onObservation:k,onClick:w,mobileInteraction:D,customHoverBehavior:E,customClickBehavior:F,linkedHoverInClickPredicate:!1}),layoutSelection:$,...null!=S&&{annotations:S},...C};return q(z,{componentName:"NetworkCustomChart",width:_,height:Y,children:q(r,{ref:A,...ee})})});Y.displayName="NetworkCustomChart";import{useMemo as G,forwardRef as V,useRef as U}from"react";import{useMemo as Q}from"react";function J(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 K(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],a="function"==typeof n?n(e):e[n];i.add(t),i.add(a)}),Array.from(i).map(e=>({id:e}))}function Z(e){return"function"==typeof e?e:t=>t[e]||1}function ee({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:i,baseStyle:a={}}){return s=>{const r={fillOpacity:i,...a};if("function"==typeof e)r.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?r.fill=S(e.data||e,t,o):e&&(r.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?r.fill=S(e.data||e,t,o):e&&(r.fill=n(e,e.index).fill)}else"gradient"===e&&(r.fill="#999",r.fillOpacity=.7*i);return r}}function te(e){const{nodes:t,edges:o,inferNodes:n=!0,sourceAccessor:i="source",targetAccessor:a="target",colorBy:s,colorScheme:r,showLegend:l,legendPosition:c,legendInteraction:d,selection:u,linkedHover:m,onObservation:g,onClick:f,mobileInteraction:h,mobileSemantics:p,chartType:b,chartId:y,marginDefaults:k,userMargin:w,width:S,height:T,hasTitle:C,loading:A,loadingContent:O,emptyContent:H,emptyDataKey:F="edges"}=e,R=Q(()=>M(o),[o]),z=Q(()=>M(t),[t]),$=j(A,S,T,O),_=$?null:W("nodes"===F?void 0===t?void 0:z:void 0===o?void 0:R,S,T,H),X=Q(()=>n?K(z,R,i,a):z,[n,z,R,i,a]),q=L(X,s,r),Y=E(),G=Q(()=>Array.isArray(r)&&r.length>0?r:[...I(r,Y,v)],[r,Y]),V=Q(()=>x(X,s),[X,s]),U=D(d,s,V),{legend:J,margin:Z,legendPosition:ee}=N({data:X,colorBy:s,colorScale:q,showLegend:l,legendPosition:c,userMargin:w,defaults:k,categories:V,chartWidth:S,hasTitle:C}),te=Q(()=>P(h,{width:S,mobileSemantics:p}),[h,S,p]),oe=B({selection:u,linkedHover:m,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:g,onClick:f,mobileInteraction:te,chartType:b,chartId:y}),{customHoverBehavior:ne,customClickBehavior:ie,activeSelectionHook:ae,hoverSelectionHook:se,crosshairSourceId:re}=oe;return{safeNodes:X,safeEdges:R,colorScale:q,effectivePalette:G,themeCategorical:Y,allCategories:V,legendState:U,legend:J,margin:Z,legendPosition:ee,mobileInteraction:te,customHoverBehavior:ne,customClickBehavior:ie,activeSelectionHook:ae,hoverSelectionHook:se,crosshairSourceId:re,loadingEl:$,emptyEl:_}}import{jsx as oe}from"react/jsx-runtime";var ne=V(function(t,n){const a=U(null);o(n,{variant:"network",frameRef:a});const s=H(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:c,margin:d,className:u,nodeIdAccessor:m,nodeIDAccessor:p,sourceAccessor:b="source",targetAccessor:y="target",nodeLabel:v,colorBy:k,colorScheme:w,styleRules:x,nodeSize:M=8,nodeSizeRange:T=[5,20],nodeStroke:A,nodeStrokeWidth:I,edgeWidth:P,edgeColor:N,edgeOpacity:B,iterations:L=300,forceStrength:D=.1,layoutExecution:E="auto",layoutLoadingContent:F,onLayoutStateChange:W,tooltip:j,frameProps:$={},onObservation:_,onClick:X,chartId:q,selection:Y,linkedHover:V,loading:Q,loadingContent:J,emptyContent:K,legendInteraction:Z,legendPosition:ee,stroke:ne,strokeWidth:ie,opacity:ae}=t,se=m??p??"id",{width:re,height:le,enableHover:ce,showLegend:de,showLabels:ue=!1,title:me,description:ge,summary:fe,accessibleTable:he}=s,pe=te({nodes:l,edges:c,inferNodes:!1,nodeIdAccessor:se,sourceAccessor:b,targetAccessor:y,colorBy:k,colorScheme:w,showLegend:de,legendPosition:ee,legendInteraction:Z,selection:Y,linkedHover:V,onObservation:_,onClick:X,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"ForceDirectedGraph",chartId:q,marginDefaults:s.marginDefaults,userMargin:d,width:re,height:le,hasTitle:!!me,loading:Q,loadingContent:J,emptyContent:K,emptyDataKey:"nodes"}),be=G(()=>new Map,[]),ye=G(()=>e=>{const t={};return t.fill=k?S(e.data||e,k,pe.colorScale):O(void 0,pe.themeCategorical,w,void 0,be),"number"==typeof M&&(t.r=M),t},[k,pe.colorScale,M,pe.themeCategorical,w,be]),ve=G(()=>h(k,"number"==typeof M?void 0:M),[k,M]),ke=G(()=>e(f(ye,x,ve,e=>e.data||e),{stroke:A??ne,strokeWidth:I??ie,opacity:ae}),[ye,x,ve,A,ne,I,ie,ae]),we=N??ne??"#999",xe=B??ae??.6,Me=ie??1,Se=G(()=>e=>{const t=e.data||e;let o;if(void 0===P)o=Me;else if("number"==typeof P)o=P;else if("function"==typeof P)o=P(t);else{const e=t[P],n="number"==typeof e?e:Number(e);o=Number.isFinite(n)&&n>0?n:Me}return{stroke:we,strokeWidth:o,opacity:xe}},[P,we,xe,Me]),Te=G(()=>{if(ue&&v)return"function"==typeof v?v:e=>e.data?.[v]??e[v]??e.id},[ue,v]),Ce=i({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:se}});return Ce?oe(R,{componentName:"ForceDirectedGraph",message:Ce,width:re,height:le}):pe.loadingEl?pe.loadingEl:pe.emptyEl?pe.emptyEl:oe(z,{componentName:"ForceDirectedGraph",width:re,height:le,children:oe(r,{ref:a,chartType:"force",...null!=l&&{nodes:pe.safeNodes},...null!=c&&{edges:pe.safeEdges},size:[re,le],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:pe.margin,nodeIDAccessor:se,sourceAccessor:b,targetAccessor:y,iterations:L,forceStrength:D,layoutExecution:E,layoutLoadingContent:F,onLayoutStateChange:W,nodeStyle:ke,edgeStyle:Se,colorBy:k,colorScheme:pe.effectivePalette,nodeSize:M,nodeSizeRange:T,nodeLabel:Te,showLabels:ue,enableHover:ce,tooltipContent:!1===j?()=>null:C(j)||void 0,...g({linkedHover:V,selection:Y,onObservation:_,onClick:X,mobileInteraction:pe.mobileInteraction,customHoverBehavior:pe.customHoverBehavior,customClickBehavior:pe.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:pe.legend,legendPosition:pe.legendPosition,...Z&&"none"!==Z&&{legendHoverBehavior:pe.legendState.onLegendHover,legendClickBehavior:pe.legendState.onLegendClick,legendHighlightedCategory:pe.legendState.highlightedCategory,legendIsolatedCategories:pe.legendState.isolatedCategories},className:u,title:me,description:ge,summary:fe,accessibleTable:he,...null!=t.animate&&{animate:t.animate},...$})})});ne.displayName="ForceDirectedGraph";import{useMemo as ie,forwardRef as ae,useRef as se}from"react";import{jsx as re}from"react/jsx-runtime";var le=ae(function(t,n){const a=se(null);o(n,{variant:"network",frameRef:a,overrides:{getData:()=>a.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const s=H(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:c,margin:d,className:u,sourceAccessor:m="source",targetAccessor:p="target",valueAccessor:b="value",nodeIdAccessor:k="id",colorBy:w,colorScheme:x,styleRules:M,edgeColorBy:T="source",padAngle:A=.01,groupWidth:I=20,sortGroups:P,nodeLabel:N,edgeOpacity:B=.5,tooltip:L,frameProps:D={},onObservation:E,onClick:F,chartId:W,selection:j,linkedHover:$,loading:_,loadingContent:X,emptyContent:q,legendInteraction:Y,stroke:G,strokeWidth:V,opacity:U}=t,{width:Q,height:J,enableHover:K,showLabels:Z=!0,title:oe,description:ne,summary:ae,accessibleTable:le}=s,ce=te({nodes:l,edges:c,inferNodes:!0,nodeIdAccessor:k,sourceAccessor:m,targetAccessor:p,colorBy:w,colorScheme:x,showLegend:!1,legendInteraction:Y,selection:j,linkedHover:$,onObservation:E,onClick:F,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"ChordDiagram",chartId:W,marginDefaults:s.marginDefaults,userMargin:d,width:Q,height:J,hasTitle:!!oe,loading:_,loadingContent:X,emptyContent:q}),de=ie(()=>new Map,[]),ue=ie(()=>new Map,[]),me=ce.safeNodes.length>0,ge=ie(()=>{if(me)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(w)o.fill=S(e.data||e,w,ce.colorScale);else{const n=Array.isArray(x)?x:y[x]||v,i=Array.isArray(n)?n:v,a=(e.id??e.data?.[k]??"")+"";ue.has(a)||ue.set(a,ue.size);const s=e.index??t??ue.get(a);o.fill=i[s%i.length]}return o}},[me,w,ce.colorScale,x,k,ue]),fe=ie(()=>h(w),[w]),he=ie(()=>{if(ge||M&&M.length>0)return e(f(ge,M,fe,e=>e.data||e),{stroke:G,strokeWidth:V,opacity:U})},[ge,M,fe,G,V,U]),pe=ie(()=>{if(me)return ee({edgeColorBy:T,colorBy:w,colorScale:ce.colorScale,nodeStyleFn:he||(e=>({fill:O(void 0,ce.themeCategorical,x,void 0,de)})),edgeOpacity:B,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:B}})},[me,T,w,ce.colorScale,he,B,ce.themeCategorical,x,de]),be=ie(()=>pe?e(pe,{stroke:G,strokeWidth:V,opacity:U}):void 0,[pe,G,V,U]),ye=ie(()=>{if(!Z)return;const e=N||k;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[Z,N,k]),ve=i({componentName:"ChordDiagram",edges:c,edgesRequired:!0});return ve?re(R,{componentName:"ChordDiagram",message:ve,width:Q,height:J}):ce.loadingEl?ce.loadingEl:ce.emptyEl?ce.emptyEl:re(z,{componentName:"ChordDiagram",width:Q,height:J,children:re(r,{ref:a,chartType:"chord",...ce.safeNodes.length>0&&{nodes:ce.safeNodes},...null!=c&&{edges:ce.safeEdges},size:[Q,J],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:ce.margin,nodeIDAccessor:k,sourceAccessor:m,targetAccessor:p,valueAccessor:b,padAngle:A,groupWidth:I,sortGroups:P,nodeStyle:he,edgeStyle:be,colorBy:w,colorScheme:ce.effectivePalette,edgeColorBy:T,edgeOpacity:B,nodeLabel:ye,showLabels:Z,enableHover:K,tooltipContent:!1===L?()=>null:C(L)||void 0,...g({linkedHover:$,selection:j,onObservation:E,onClick:F,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior,linkedHoverInClickPredicate:!1}),...Y&&"none"!==Y&&{legendHoverBehavior:ce.legendState.onLegendHover,legendClickBehavior:ce.legendState.onLegendClick,legendHighlightedCategory:ce.legendState.highlightedCategory,legendIsolatedCategories:ce.legendState.isolatedCategories},className:u,title:oe,description:ne,summary:ae,accessibleTable:le,...null!=t.animate&&{animate:t.animate},...D})})});le.displayName="ChordDiagram";import{useMemo as ce,forwardRef as de,useRef as ue}from"react";import{jsx as me}from"react/jsx-runtime";var ge=de(function(t,n){const a=ue(null);o(n,{variant:"network",frameRef:a,overrides:{getData:()=>a.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const s=H(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:c,margin:d,className:u,sourceAccessor:m="source",targetAccessor:p="target",valueAccessor:b="value",nodeIdAccessor:y="id",colorBy:v,colorScheme:k,styleRules:w,edgeColorBy:x="source",orientation:M="horizontal",nodeAlign:T="justify",nodePaddingRatio:A=.05,nodeWidth:I=15,nodeLabel:P,edgeOpacity:N=.5,edgeSort:B,tooltip:L,frameProps:D={},onObservation:E,onClick:F,chartId:W,selection:j,linkedHover:$,loading:_,loadingContent:X,emptyContent:q,showLegend:Y,legendPosition:G,legendInteraction:V,stroke:U,strokeWidth:Q,opacity:J}=t,{width:K,height:Z,enableHover:oe,showLabels:ne=!0,title:ie,description:ae,summary:se,accessibleTable:re}=s,le=te({nodes:l,edges:c,inferNodes:!0,nodeIdAccessor:y,sourceAccessor:m,targetAccessor:p,colorBy:v,colorScheme:k,showLegend:Y,legendPosition:G,legendInteraction:V,selection:j,linkedHover:$,onObservation:E,onClick:F,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"SankeyDiagram",chartId:W,marginDefaults:s.marginDefaults,userMargin:d,width:K,height:Z,hasTitle:!!ie,loading:_,loadingContent:X,emptyContent:q}),de=ce(()=>new Map,[]),ge=ce(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=v?S(e.data||e,v,le.colorScale):O(void 0,le.themeCategorical,k,void 0,de),t},[v,le.colorScale,le.themeCategorical,k,de]),fe=ce(()=>h(v,b),[v,b]),he=ce(()=>e(f(ge,w,fe,e=>e.data||e),{stroke:U,strokeWidth:Q,opacity:J}),[ge,w,fe,U,Q,J]),pe=ce(()=>ee({edgeColorBy:x,colorBy:v,colorScale:le.colorScale,nodeStyleFn:he,edgeOpacity:N,baseStyle:{stroke:"none",strokeWidth:0}}),[x,v,le.colorScale,he,N]),be=ce(()=>e(pe,{stroke:U,strokeWidth:Q,opacity:J}),[pe,U,Q,J]),ye=ce(()=>{if(!ne)return;const e=P||y;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[ne,P,y]),ve=i({componentName:"SankeyDiagram",edges:c,edgesRequired:!0});return ve?me(R,{componentName:"SankeyDiagram",message:ve,width:K,height:Z}):le.loadingEl?le.loadingEl:le.emptyEl?le.emptyEl:me(z,{componentName:"SankeyDiagram",width:K,height:Z,children:me(r,{ref:a,chartType:"sankey",...le.safeNodes.length>0&&{nodes:le.safeNodes},...null!=c&&{edges:le.safeEdges},size:[K,Z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:le.margin,nodeIDAccessor:y,sourceAccessor:m,targetAccessor:p,valueAccessor:b,orientation:M,nodeAlign:T,nodePaddingRatio:A,nodeWidth:I,nodeStyle:he,edgeStyle:be,colorBy:v,colorScheme:le.effectivePalette,edgeColorBy:x,edgeOpacity:N,edgeSort:B,nodeLabel:ye,showLabels:ne,enableHover:oe,tooltipContent:!1===L?()=>null:C(L)||void 0,...g({linkedHover:$,selection:j,onObservation:E,onClick:F,mobileInteraction:le.mobileInteraction,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:le.legend,legendPosition:le.legendPosition,...V&&"none"!==V&&{legendHoverBehavior:le.legendState.onLegendHover,legendClickBehavior:le.legendState.onLegendClick,legendHighlightedCategory:le.legendState.highlightedCategory,legendIsolatedCategories:le.legendState.isolatedCategories},className:u,title:ie,description:ae,summary:se,accessibleTable:re,...null!=t.animate&&{animate:t.animate},...D})})});ge.displayName="SankeyDiagram";var fe={static:{duplicateIds:"fatal",invalidSystemTime:"warn"},mcp:{duplicateIds:"fatal",invalidSystemTime:"warn"},push:{duplicateIds:"warn",invalidSystemTime:"strip"}};function he(e="static"){return fe[e]??fe.static}var pe=new Set(["invalid-domain","missing-node","backward-edge","invalid-edge-time","invalid-value","invalid-node-time"]);function be(e){return"fatal"===e.severity||"warn"===e.severity?e.severity:pe.has(e.kind)?"fatal":"warn"}function ye(e,t,o,n={}){const i=he(n.usageMode??"static"),a=[],s=new Set;for(const t of e)s.has(t.id)&&a.push({kind:"duplicate-node",id:t.id,severity:i.duplicateIds}),s.add(t.id);const r=new Set,l=Array.isArray(o)&&2===o.length,c=l&&Number.isFinite(o[0])&&Number.isFinite(o[1]);l&&c&&c&&o[1]>=o[0]||a.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]||a.push({kind:"invalid-node-time",id:t.id}));for(const e of t)r.has(e.id)&&a.push({kind:"duplicate-edge",id:e.id,severity:i.duplicateIds}),r.add(e.id),s.has(e.source)||a.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),s.has(e.target)||a.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?((null!=e.systemInTime&&!Number.isFinite(e.systemInTime)||null!=e.systemOutTime&&!Number.isFinite(e.systemOutTime))&&a.push({kind:"invalid-system-time",id:e.id,severity:"warn"}),Number.isFinite(e.value)&&e.value>0||a.push({kind:"invalid-value",id:e.id}),e.startTime>e.endTime&&a.push({kind:"backward-edge",severity:"fatal",id:e.id,source:e.source,target:e.target})):a.push({kind:"invalid-edge-time",id:e.id});return a}function ve(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`:"duplicate-node"===e.kind?`node id "${e.id}" is duplicated`:"duplicate-edge"===e.kind?`edge id "${e.id}" is duplicated`:"invalid-system-time"===e.kind?`edge ${e.id} has an invalid systemInTime or systemOutTime`:e.kind}function ke(e,t,o,n={}){const i=!1!==n.inferOpeningStock,a=[];for(const t of o){const o=Number(t.value);if(!Number.isFinite(o))continue;const n=Number(t.endTime);t.target===e&&Number.isFinite(n)&&a.push({time:n,delta:o});const i=Number(t.startTime);if(t.source===e&&Number.isFinite(i)&&a.push({time:i,delta:-o}),t.target===e&&null!=t.systemOutTime){const e=Number(t.systemOutTime);Number.isFinite(e)&&a.push({time:e,delta:-o})}}a.sort((e,t)=>e.time-t.time||t.delta-e.delta);let s=0,r=0,l=0;for(const e of a)s+=e.delta,r=Math.min(r,s),e.time>t||(l+=e.delta);return i?l-r:l}function we(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function xe(e){const{desired:t,minGaps:o,weights:n}=e,i=t.length;if(0===i)return[];if(o.length!==Math.max(0,i-1))throw Error("placeWithMinGap: minGaps must have desired.length - 1 entries");const a=Array(i).fill(0);for(let e=1;i>e;e++)a[e]=a[e-1]+Math.max(0,Number.isFinite(o[e-1])?o[e-1]:0);const s=[];for(let e=0;i>e;e++){const o=Math.max(Number.EPSILON,Number.isFinite(n?.[e])?n[e]:1),i=(Number.isFinite(t[e])?t[e]:0)-a[e];for(s.push({start:e,end:e,weight:o,mean:i});s.length>1;){const e=s[s.length-1],t=s[s.length-2];if(e.mean>=t.mean)break;const o=t.weight+e.weight;s.splice(s.length-2,2,{start:t.start,end:e.end,weight:o,mean:(t.mean*t.weight+e.mean*e.weight)/o})}}const r=Number.isFinite(e.min)?e.min:-1/0,l=Number.isFinite(e.max)?e.max-a[i-1]:1/0,c=r>l?r:l,d=Array(i);for(const e of s){const t=Math.max(r,Math.min(c,e.mean));for(let o=e.start;e.end>=o;o++)d[o]=t+a[o]}return d}function Me(e,t){let o=0,n=e.length-1,i=-1;for(;n>=o;){const a=o+n>>>1;e[a].at>t?n=a-1:(i=a,o=a+1)}return 0>i?{at:t,before:0,after:0}:e[i]}function Se(e,t=0){if(0===e.length)return{adjacentClearance:[],positions:[]};const o=[],n=[0];for(let i=0;e.length-1>i;i++){const a=e[i],s=e[i+1],r=[...new Set([...a.map(e=>e.at),...s.map(e=>e.at)])].sort((e,t)=>e-t);let l=0;for(const e of r){const t=Me(a,e),o=Me(s,e);l=Math.max(l,t.after+o.before)}o.push(l),n.push(n[n.length-1]+l+t)}return{adjacentClearance:o,positions:n}}function Te(e,t,o,n={}){let i=[...e];if(1>=i.length)return i;let a=[...i],s=o(i),r=1;const l=Math.max(0,n.passes??6),c=Math.max(1,n.maxEvaluations??1/0);for(let e=0;l>e&&c>r;e++){const e=new Map(i.map((e,t)=>[e,t])),l=new Map,c=new Map;for(const o of t){const t=e.get(o.source),n=e.get(o.target);if(null==t||null==n)continue;const i=Number.isFinite(o.weight)&&o.weight>0?o.weight:1;l.set(o.source,(l.get(o.source)??0)+n*i),c.set(o.source,(c.get(o.source)??0)+i),l.set(o.target,(l.get(o.target)??0)+t*i),c.set(o.target,(c.get(o.target)??0)+i)}i=i.map((e,t)=>({item:e,index:t,barycenter:(l.get(e)??t)/(c.get(e)??1)})).sort((e,t)=>e.barycenter-t.barycenter||(n.compare?.(e.item,t.item)??e.index-t.index)).map(e=>e.item);const d=o(i);if(r++,s>d)s=d,a=[...i];else if(d===s)break}return a}function Ce(e,t,o={}){const n=[...e],i=n.length;if(1>=i||i>(o.maxItems??8))return n;const a=Math.max(1,o.maxEvaluations??1/0);let s=0,r=[...n],l=1/0;const c=()=>{if(s>=a)return;const e=t(n);s++,l>e&&(l=e,r=[...n])};c();const d=Array(i).fill(0);let u=0;for(;i>u&&a>s;)if(u>d[u]){const e=u%2==0?0:d[u];[n[e],n[u]]=[n[u],n[e]],c(),d[u]++,u=0}else d[u]=0,u++;return r}function Ae(e,t){return t>e?-1:e>t?1:0}function Ie(e){return e.occupants.map(e=>e.id).sort(Ae).join("\0")}function Oe(e,t,o=0){return e.slice(0,-1).map((n,i)=>null!=n.group&&n.group===e[i+1].group?o:t)}function Pe(e,t){return e.map(e=>{const o=new Map;for(const n of e.occupants){const e=t[n.id];if(e)for(const t of e.samples){const e=o.get(t.t)??{before:0,after:0},n=t.boundaryOffset??0;o.set(t.t,{before:Math.max(e.before,t.topMass-n),after:Math.max(e.after,t.botMass+n)})}}return[...o].sort((e,t)=>e[0]-t[0]).map(([e,t])=>({at:e,...t}))})}function Ne(e,t,o){if(0===e.length)return[];const{padding:n,plotH:i,valueScale:a}=o,s=o.stackValueScale??a,r=Oe(e,n,o.groupPadding??0),l=[n+e[0].peak.topPeak*s];for(let o=1;e.length>o;o++)l.push(l[o-1]+t[o-1]*s+r[o-1]);const c=l[l.length-1]+e[e.length-1].peak.botPeak*s+n;if(c>i&&c>0){const e=i/c;for(let t=0;l.length>t;t++)l[t]*=e}return l}function He(e,t){const o=(e.boundaryOffset??0)*t,n=e.value*t;if("out"===e.kind){const i=e.sideMassBefore*t;return o+("top"===e.side?n/2-i:i-n/2)}const i=e.sideMassAfter*t;return o+("top"===e.side?n/2-i:i-n/2)}function Be(e,t,o,n,i,a){const s=a.adjacentClearance?[...a.adjacentClearance]:Se(Pe(n,o)).adjacentClearance,r=Ne(n,s,a);let l="hug"===a.lanePlacement?function(e,t,o,n,i,a,s){const r=e.length;if(0===r)return[];const{padding:l,plotH:c,valueScale:d}=s,u=Oe(e,l,s.groupPadding??0),m=i.map((e,t)=>e*d+u[t]),g=l+e[0].peak.topPeak*d,f=c-l-e[r-1].peak.botPeak*d;if(m.reduce((e,t)=>e+t,0)+1e-6>=f-g)return Ne(e,i,s);let h=1===r?[(g+f)/2]:[...a];for(let e=0;12>e;e++){const e=Array(r).fill(0),i=Array(r).fill(0);for(const a of o){const o=t[a.source],s=t[a.target];if(null==o||null==s||o===s)continue;const r=n[a.source]?.localAttachments.get(a.id),l=n[a.target]?.localAttachments.get(a.id);if(!r||!l)continue;const c=a.value>0&&Number.isFinite(a.value)?a.value:1,u=He(r,d),m=He(l,d);e[o]+=(h[s]+m-u)*c,i[o]+=c,e[s]+=(h[o]+u-m)*c,i[s]+=c}const a=xe({desired:h.map((t,o)=>0===i[o]?t:.45*t+e[o]/i[o]*.55),minGaps:m,weights:i.map(e=>Math.max(1,e)),min:g,max:f});let s=0;for(let e=0;r>e;e++)s=Math.max(s,Math.abs(a[e]-h[e]));if(h=a,.01>s)break}return h}(n,i,t,o,s,r,a):[...r];if("hug"===a.lanePlacement){const o=t=>{const o={};for(const n of e)o[n.id]=t[i[n.id]];return o};Le(o(l),t)>Le(o(r),t)+1e-6&&(l=[...r])}const c={};for(const t of e)c[t.id]=l[i[t.id]];let d=1/0,u=-1/0;for(const t of e){const e=c[t.id],n=o[t.id];Number.isFinite(e)&&n&&(d=Math.min(d,e-n.topPeak*a.valueScale),u=Math.max(u,e+n.botPeak*a.valueScale))}return{adjacentClearance:s,centerlines:c,slotCenter:l,stackCenter:r,verticalUtilization:Number.isFinite(d)&&Number.isFinite(u)&&a.plotH>0?Math.max(0,Math.min(1,(u-d)/a.plotH)):0}}function Le(e,t){let o=0;for(const n of t){const t=e[n.source],i=e[n.target];Number.isFinite(t)&&Number.isFinite(i)&&(o+=Math.abs(t-i)*(n.value>0?n.value:1))}return o}function De(e,t){const o=e?.samples;if(!o||0===o.length||o[0].t>t)return{top:0,bot:0};let n=0,i=o.length-1,a=0;for(;i>=n;){const e=n+i>>>1;o[e].t>t?i=e-1:(a=e,n=e+1)}const s=o[a].boundaryOffset??0;return{top:o[a].topMass-s,bot:o[a].botMass+s}}function Ee(e,t,o,n,i){const a=1-i;return a*a*a*e+3*a*a*i*t+3*a*i*i*o+i*i*i*n}function Fe(e,t){let o=0,n=1;for(let i=0;28>i;i++){const i=(o+n)/2;e>Ee(0,t,t,1,i)?o=i:n=i}return(o+n)/2}function Re(e,t,o){const n=t+He(e,o),i=e.value*o/2;return[n-i,n+i]}function ze(e,t,o,n){return Math.max(0,Math.min(t,n)-Math.max(e,o))/Math.max(1e-9,t-e)}function We(e,t,o,n,i,a,s){const{valueScale:r,domain:l,mode:c="quality"}=s,d="source"===s.ribbonLane?.85:"target"===s.ribbonLane?.15:.5;let u=0;for(const s of e){const e=n[s.source],m=n[s.target];if(null==e||null==m||2>Math.abs(e-m))continue;const g=t[s.source]?.localAttachments.get(s.id),f=t[s.target]?.localAttachments.get(s.id);if(!g||!f)continue;const h=Math.max(s.startTime,l?.[0]??-1/0),p=Math.min(s.endTime,l?.[1]??1/0);if(h>=p)continue;const[b,y]=Re(g,i[s.source],r),[v,k]=Re(f,i[s.target],r),w=Math.min(e,m)+1,x=Math.max(e,m)-1;for(let e=w;x>=e;e++){const n=o[e];if(!n)continue;const l=[h,p];if("quality"===c)for(const e of n.occupants)for(const o of t[e.id]?.samples??[])o.t>h&&p>o.t&&l.push(o.t);const m=e=>{const o=Fe((e-h)/(p-h),d),l=Ee(b,b,v,v,o),c=Ee(y,y,k,k,o);let u=0;for(const o of n.occupants){if(o.id===s.source||o.id===s.target)continue;const n=a[o.id];if(null!=n?.start&&n.start>e)continue;if(null!=n?.end&&e>n.end)continue;const d=De(t[o.id],e),m=i[o.id];u=Math.max(u,ze(l,c,m-d.top*r,m+d.bot*r))}return u},g=[...new Set(l)].sort((e,t)=>e-t);let f=0;for(let e=0;g.length-1>e;e++){const t=g[e],o=g[e+1]-t;f+=(m(t+.25*o)+m(t+.5*o)+m(t+.75*o))/3*o}u+=f/(p-h)*(s.value>0?s.value:1)}}return u}function je(e,t,o,n,i,a,s,r,l,c,d="both",u){return{crossings:e,weightedLength:t,pixelLength:Le(s,o),transitOcclusion:We(o,n,i,a,s,r,{valueScale:l,ribbonLane:d,domain:u,mode:"quality"}),verticalUtilization:c}}function $e(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function _e(e,t){return e.map(e=>({t:$e(e.t,t),topMass:e.topMass,botMass:e.botMass,...null!=e.boundaryOffset&&{boundaryOffset:e.boundaryOffset}}))}function Xe(e,t,o){const n=t+(e.boundaryOffset??0)*o,i=e.value*o;if("out"===e.kind){const t=e.sideMassBefore*o;if("top"===e.side){const e=n-t;return[e,e+i]}const a=n+t;return[a-i,a]}const a=e.sideMassAfter*o;if("top"===e.side){const e=n-a;return[e,e+i]}const s=n+a;return[s-i,s]}function qe(e,t,o,n,i="temporal"){const a=t.incoming[e.id],s=t.outgoing[e.id],r=[];for(const e of a)r.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:o.get(e.id).targetSide});for(const e of s)r.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:o.get(e.id).sourceSide});const l={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},c=()=>{r.sort((e,t)=>e.time-t.time||(e.phase??0)-(t.phase??0)||(e.sequence??0)-(t.sequence??0)||(l[e.kind]??99)-(l[t.kind]??99)||((e,t)=>{if(!n||!e.edge||!t.edge||e.kind!==t.kind||e.side!==t.side)return 0;if("out"===e.kind){if(e.edge.target===t.edge.target&&e.edge.endTime===t.edge.endTime)return 0;const o=n.get(e.edge.id)?.target,i=n.get(t.edge.id)?.target;return"number"==typeof o&&Number.isFinite(o)&&"number"==typeof i&&Number.isFinite(i)&&o!==i?"top"===e.side?o-i:i-o:0}if("in"===e.kind){if(e.edge.source===t.edge.source&&e.edge.startTime===t.edge.startTime)return 0;const o=n.get(e.edge.id)?.source,i=n.get(t.edge.id)?.source;return"number"==typeof o&&Number.isFinite(o)&&"number"==typeof i&&Number.isFinite(i)&&o!==i?"top"===e.side?i-o:o-i:0}return 0})(e,t)||Ae(e.edge?.id??"",t.edge?.id??"")||Ae(e.side,t.side)||e.delta-t.delta)},d=r.length?F(r.map(e=>e.time)):null,u=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,m=null!=u?u-1:null!=d&&Number.isFinite(d)?d-1:null;c();let g=null,f=0;for(const e of r)e.time!==g&&(g=e.time,f=0),e.sequence=f++;const h=e=>({time:e.time,phase:0,sequence:e.sequence??0}),p=[];let b=0,y=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?b:y);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?b:y);if(n>0){const i=h(e);p.push({...i,delta:-n,kind:"transfer-out",side:t}),p.push({...i,delta:+n,kind:"transfer-in",side:e.side}),"top"===t?b-=n:y-=n,"top"===e.side?b+=n:y+=n,o-=n}o>0&&null!==m&&(p.push({time:m,delta:+o,kind:"create",side:e.side}),"top"===e.side?b+=o:y+=o)}"top"===e.side?b-=t:y-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?b+=t:y+=t}r.push(...p),c();let v=0,k=0,w=0,x=0,M=0,S=0;const T=[],C=new Map,A=e=>{T.push({t:e,topMass:v,botMass:k,...Math.abs(w)>1e-12&&{boundaryOffset:w}})},I=()=>{x=Math.max(x,v+k),M=Math.max(M,v-w),S=Math.max(S,k+w)};for(const e of r){if("transfer-out"!==e.kind&&"transfer-in"!==e.kind&&A(e.time),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?v:k;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),...Math.abs(w)>1e-12&&{boundaryOffset:w}})}"top"===e.side?v+=e.delta:k+=e.delta,"transfer-in"===e.kind?(w+="top"===e.side?e.delta:-e.delta,I(),A(e.time)):"transfer-out"!==e.kind&&(I(),"out"!==e.kind||v+k>1e-12||(w=0),A(e.time))}const O=[];let P=0;for(;T.length>P;){let e=P;for(;T.length>e+1&&T[e+1].t===T[P].t;)e++;O.push(T[P]);for(let t=P+1;e>=t;t++){const e=O[O.length-1];T[t].topMass===e.topMass&&T[t].botMass===e.botMass&&(T[t].boundaryOffset??0)===(e.boundaryOffset??0)||O.push(T[t])}P=e+1}const N=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let H=null;for(const e of s)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===H||H>e.systemInTime)&&(H=e.systemInTime);let B=null;for(const e of a)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===B||e.systemOutTime>B)&&(B=e.systemOutTime);if(O.length>0){const e=O[O.length-1],t=Math.max(null!=N?N:-1/0,null!=B?B:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&O.push({t:t,topMass:e.topMass,botMass:e.botMass,...null!=e.boundaryOffset&&{boundaryOffset:e.boundaryOffset}});const o=O[0],n=O.find(e=>e.topMass+e.botMass>0);let i,a=1/0;null!=u&&Number.isFinite(u)&&o.t>u&&o.topMass+o.botMass>0&&(a=u,i=o),n&&null!=H&&Number.isFinite(H)&&n.t>H&&a>H&&(a=H,i=n),i&&Number.isFinite(a)&&O.unshift({t:a,topMass:i.topMass,botMass:i.botMass,...null!=i.boundaryOffset&&{boundaryOffset:i.boundaryOffset}})}let L=O;if("max"===i&&null!=u&&null!=N&&N>u){let e,t=0;for(const o of O){const n=o.topMass+o.botMass;n>t&&(t=n,e=o)}if(e){const t={topMass:e.topMass,botMass:e.botMass,...null!=e.boundaryOffset&&{boundaryOffset:e.boundaryOffset}};L=[...O.filter(e=>u>e.t),{t:u,...t},{t:N,...t},...O.filter(e=>e.t>N)]}}return{samples:L,peak:x,topPeak:M,botPeak:S,localAttachments:C}}function Ye(e){const t={};return e.forEach((e,o)=>{for(const n of e.occupants)t[n.id]=o}),t}function Ge(e,t,o){e.splice(0,e.length,...o);const n=Ye(o);for(const e of Object.keys(t))delete t[e];Object.assign(t,n)}function Ve(e){const t=new Map,o=[];e.forEach((e,n)=>{if(!e.group)return void o.push({anchor:n,stableId:Ie(e),slots:[e]});const i=t.get(e.group)??{indexes:[],slots:[]};i.indexes.push(n),i.slots.push(e),t.set(e.group,i)});for(const[e,n]of t)o.push({anchor:n.indexes.reduce((e,t)=>e+t,0)/n.indexes.length,stableId:`${e}\0${n.slots.map(Ie).join("\0")}`,slots:n.slots});return o.sort((e,t)=>e.anchor-t.anchor||Ae(e.stableId,t.stableId))}function Ue(e){return e.some(e=>e.group)?Ve(e).flatMap(e=>e.slots):[...e]}function Qe(e){return e.flatMap(e=>e.slots)}function Je(e,t,o){const n=new Map;return e.forEach((e,t)=>{for(const o of e.slots)n.set(o,t)}),e.map((e,i)=>{if(1>=e.slots.length)return e;const a=new Map;for(const t of e.slots)a.set(t,0);for(const e of t){const t=n.get(e.source),o=n.get(e.target);if(null==t||null==o)continue;const s=Number.isFinite(e.weight)&&e.weight>0?e.weight:1;if(t===i&&o!==i){const t=o>i?1:-1;a.set(e.source,(a.get(e.source)??0)+s*t)}else if(o===i&&t!==i){const o=t>i?1:-1;a.set(e.target,(a.get(e.target)??0)+s*o)}}const s=[...e.slots].sort((e,t)=>(a.get(e)??0)-(a.get(t)??0)||o(e,t));return{...e,slots:s}})}function Ke(e,t){e.some(e=>e.group)&&Ge(e,t,Ue(e))}function Ze(e,t){return e.source!==t.source&&e.target!==t.target&&e.source!==t.target&&e.target!==t.source&&Math.min(e.endTime,t.endTime)>Math.max(e.startTime,t.startTime)}function et(e,t){return function(e,t,o=()=>!0){let n=0;for(let i=0;e.length>i;i++){const[a,s]=t(e[i]);for(let r=i+1;e.length>r;r++){if(!o(e[i],e[r]))continue;const[l,c]=t(e[r]);0>(a-l)*(s-c)&&n++}}return n}(t,t=>[e[t.source],e[t.target]],Ze)}function tt(e,t){let o=0;for(const n of t){const t=e[n.source],i=e[n.target];null!=t&&null!=i&&(o+=Math.abs(t-i)*(n.value>0?n.value:1))}return o}function ot(e,t,o){const[n,i]=o.get(e.first),[a,s]=o.get(e.second);return 0>(t.get(n)-t.get(a))*(t.get(i)-t.get(s))?1:0}var nt=e=>{let t=1;for(let o=2;e>=o;o++)t*=o;return t},it=828*nt(8),at=3e3;function st(e,t,o,n,i,a,s){const r=[...i],l=new Map(i.map(e=>[e,Ie(e)])),c=new Map;for(const e of i)for(const t of e.occupants)c.set(t.id,e);const d=new Map,u=[];for(const e of t){const t=c.get(e.source),o=c.get(e.target);t&&o&&(d.set(e,[t,o]),t!==o&&u.push({source:t,target:o,weight:e.value}))}const m=[];for(let e=0;t.length>e;e++)if(d.has(t[e]))for(let o=e+1;t.length>o;o++){if(!d.has(t[o])||!Ze(t[e],t[o]))continue;const n=new Set([...d.get(t[e]),...d.get(t[o])]);m.push({index:m.length,first:t[e],second:t[o],involvedSlots:n})}const g=new Map;for(const e of i)g.set(e,[]);for(const e of m)for(const t of e.involvedSlots)g.get(t)?.push(e);const f=new Uint32Array(m.length);let h=0;const p=t.reduce((e,t)=>e+(t.value>0?t.value:1),0),b=s.plotH/Math.max(1,i.length),y=i.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),v=Math.max(1,p)*(Math.max(1,s.plotH)+b*Math.max(y,i.length)+1e-6*Math.max(1,i.length-1))+1,k=4*b,w={fullCrossing:0,localCrossing:0},x=new Map,M=(e,t)=>{let n=x.get(e);n||(n=new Map,x.set(e,n));const i=n.get(t);if(null!=i)return i;const a=function(e,t,o){return Se(Pe([e,t],o)).adjacentClearance[0]??0}(e,t,o);return n.set(t,a),a},S=new Map(i.map((e,t)=>[e,t])),T=t.flatMap(e=>{const t=d.get(e);return t?[{source:S.get(t[0]),target:S.get(t[1]),weight:e.value>0?e.value:1}]:[]}),C=new Map;for(const e of t){const t=d.get(e);t&&C.set(e,{source:S.get(t[0]),target:S.get(t[1])})}const A=new Map,I=new Map;for(const e of t)A.has(e.source)||A.set(e.source,new Set),I.has(e.target)||I.set(e.target,new Set),A.get(e.source).add(e.target),I.get(e.target).add(e.source);const O=t.flatMap(e=>{if(!(e=>{const t=new Set([...A.get(e.source)??[],...I.get(e.source)??[]]),o=new Set([...A.get(e.target)??[],...I.get(e.target)??[]]);return 1===A.get(e.source)?.size&&A.get(e.source).has(e.target)||1===t.size&&t.has(e.target)||1===o.size&&o.has(e.source)})(e))return[];const t=C.get(e);return t&&t.source!==t.target?[{source:t.source,target:t.target,weight:e.value>0?e.value:1}]:[]}),P=e=>{let t=0;for(const o of O)t+=Math.max(0,Math.abs(e[o.source]-e[o.target])-1)*o.weight;return t*k},N=e=>{const t=new Int16Array(i.length);for(let o=0;e.length>o;o++)t[S.get(e[o])]=o;return P(t)},H=m.map(e=>{const t=C.get(e.first),o=C.get(e.second);return[t.source,t.target,o.source,o.target]}),B=new Int16Array(i.length),L=new Float64Array(i.length),D=new Float64Array(i.length+1),E=e=>{for(let t=0;e.length>t;t++)B[S.get(e[t])]=t;let t=0;for(const[e,o,n,i]of H)0>(B[e]-B[n])*(B[o]-B[i])&&t++;if(e.length>0){const t=S.get(e[0]);L[t]=s.padding+e[0].peak.topPeak*s.valueScale;for(let t=1;e.length>t;t++){const o=S.get(e[t-1]),n=S.get(e[t]);L[n]=L[o]+M(e[t-1],e[t])*s.valueScale+s.padding}const o=S.get(e[e.length-1]),n=L[o]+e[e.length-1].peak.botPeak*s.valueScale+s.padding;if(n>s.plotH&&n>0){const e=s.plotH/n;for(let t=0;L.length>t;t++)L[t]*=e}}D[0]=0;for(let t=0;e.length>t;t++)D[t+1]=D[t]+e[t].peak.topPeak+e[t].peak.botPeak;let o=0,n=0,i=0;for(const e of T){const t=B[e.source],a=B[e.target];if(o+=Math.abs(t-a)*e.weight,n+=Math.abs(L[e.source]-L[e.target])*e.weight,Math.abs(t-a)>=2){const o=Math.min(t,a)+1;i+=(D[Math.max(t,a)]-D[o])*e.weight}}return t*v+n+i*b+P(B)+1e-6*o},F=(e,o)=>{const n=Array(e.length+1).fill(0);for(let t=0;e.length>t;t++)n[t+1]=n[t]+e[t].peak.topPeak+e[t].peak.botPeak;let i=0;for(const e of t){const t=o[e.source],a=o[e.target];if(null==t||null==a||2>Math.abs(t-a))continue;const s=Math.min(t,a)+1;i+=(n[Math.max(t,a)]-n[s])*(e.value>0?e.value:1)}return i},R=n=>{const i=Ye(n),a=n.slice(0,-1).map((e,t)=>M(e,n[t+1])),r=Be(e,t,o,n,i,{plotH:s.plotH,padding:s.padding,valueScale:s.valueScale,lanePlacement:s.lanePlacement??"stack",groupPadding:s.groupPadding,adjacentClearance:a});return{map:i,geometry:r,weightedLength:tt(i,t),pixelLength:Le(r.centerlines,t),transitOcclusion:F(n,i)}},z=(e,t,o)=>({crossings:e,weightedLength:t.weightedLength,pixelLength:t.pixelLength,transitOcclusion:t.transitOcclusion,cost:e*v+t.pixelLength+t.transitOcclusion*b+N(o)+1e-6*t.weightedLength}),W=(e,t)=>{let o=t;if(null==o){const t=new Map(e.map((e,t)=>[e,t]));o=m.reduce((e,o)=>e+ot(o,t,d),0),w.fullCrossing++}return z(o,R(e),e)},j=(e,i,a="quality")=>{let r=i;if(null==r){const t=new Map(e.map((e,t)=>[e,t]));r=m.reduce((e,o)=>e+ot(o,t,d),0),w.fullCrossing++}const l=R(e);return z(r,{...l,transitOcclusion:We(t,o,e,l.map,l.geometry.centerlines,n,{valueScale:s.valueScale,ribbonLane:s.ribbonLane,domain:s.domain,mode:a})},e)};let $=[...r];const _=(e,t)=>Ae(l.get(e),l.get(t)),X=function(e){const t=new Set;for(const o of e)if(o.group){if(t.has(o.group))return!0;t.add(o.group)}return!1}($),q=e=>{const t=(e=>{const t=Te(e,u,e=>W(e).cost,{passes:6,compare:_,maxEvaluations:at});let o=W(t),n=at;for(let e=0;6>e&&n>0;e++){let i=!1;const a=Array.from({length:t.length-1},(e,t)=>t);e%2==1&&a.reverse();for(const e of a){if(0>=n--)break;const a=t[e],s=t[e+1],r=new Map(t.map((e,t)=>[e,t]));let l=0;const c=[];h++;for(const e of[...g.get(a)??[],...g.get(s)??[]])f[e.index]!==h&&(f[e.index]=h,c.push(e),l+=ot(e,r,d));[t[e],t[e+1]]=[s,a];const u=new Map(r);u.set(a,e+1),u.set(s,e);let m=0;for(const e of c)m+=ot(e,u,d);w.localCrossing+=c.length;const p=W(t,o.crossings-l+m);o.cost>p.cost?(o=p,i=!0):[t[e],t[e+1]]=[a,s]}if(!i)break}return t})(e);if((e.length>8?1/0:nt(e.length)*(e.length+T.length+H.length))>it)return t;const o=Ce(e,E,{maxItems:8,maxEvaluations:5e4}),n=j(o),i=j(t);return n.crossings!==i.crossings&&i.crossings>n.crossings?o:t},Y="geometry-refine"===s.mode;if(Y||"crossing-min"!==s.laneOrder&&"crossing-min+inside-out"!==s.laneOrder){if(!Y&&"inside-out"===s.laneOrder)if(X){const e=Ve($),t=e=>e.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),o=[...e].sort((e,o)=>t(o)-t(e)||Ae(e.stableId,o.stableId)),n=Array(o.length);let i=Math.floor((o.length-1)/2)-1,a=Math.floor((o.length-1)/2)+1;o.length>0&&(n[Math.floor((o.length-1)/2)]=o[0]);for(let e=1;o.length>e;e++)e%2==1&&o.length>a||0>i?n[a++]=o[e]:n[i--]=o[e];$=Qe(n)}else{const e=[...$].sort((e,t)=>t.peak.topPeak+t.peak.botPeak-(e.peak.topPeak+e.peak.botPeak)||_(e,t)),t=Array(e.length);let o=Math.floor((e.length-1)/2)-1,n=Math.floor((e.length-1)/2)+1;e.length>0&&(t[Math.floor((e.length-1)/2)]=e[0]);for(let i=1;e.length>i;i++)i%2==1&&e.length>n||0>o?t[n++]=e[i]:t[o--]=e[i];$=t}}else $=X?(e=>{let t=Ve(e);if(1>=t.length)return Qe(t);const o=e=>W(Qe(e)).cost;t=Ve(q(e)),t=Je(t,u,_);const n=function(e,t){const o=new Map;for(const t of e)for(const e of t.slots)o.set(e,t);const n=new Map;for(const e of t){const t=o.get(e.source),i=o.get(e.target);if(!t||!i||t===i)continue;const a=Number.isFinite(e.weight)&&e.weight>0?e.weight:1,s=i.stableId>t.stableId?`${t.stableId}\0${i.stableId}`:`${i.stableId}\0${t.stableId}`,r=n.get(s);r?r.weight=(r.weight??0)+a:n.set(s,{source:t,target:i,weight:a})}return[...n.values()]}(t,u);t=Te(t,n,o,{passes:6,compare:(e,t)=>Ae(e.stableId,t.stableId),maxEvaluations:at}),t=function(e,t,o={}){const n=[...e];if(1>=n.length)return n;let i=t(n),a=1;const s=Math.max(0,o.passes??6),r=Math.max(1,o.maxEvaluations??1/0);for(let e=0;s>e&&r>a;e++){let e=!1;for(let o=0;n.length-1>o&&r>a;o++){[n[o],n[o+1]]=[n[o+1],n[o]];const s=t(n);a++,i>s?(i=s,e=!0):[n[o],n[o+1]]=[n[o+1],n[o]]}if(!e)break}return n}(t,o,{passes:8,maxEvaluations:at});const i=t.length>8?1/0:nt(t.length)*(t.length+T.length+H.length);if(it>=i){const e=Ce(t,e=>E(Qe(e)),{maxItems:8,maxEvaluations:5e4}),o=Qe(e),n=Qe(t),i=j(o),a=j(n);i.crossings!==a.crossings?t=a.crossings>i.crossings?e:t:a.cost>i.cost&&(t=e)}return t=Je(t,u,_),Qe(t)})($):q($);if(!Y&&"crossing-min+inside-out"===s.laneOrder&&$.length>1)if(X){const e=Ve($);let t=W(Qe(e)),o=Qe(e),n=t;const i=Math.floor((e.length-1)/2),a=e=>e.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),s=[...e].sort((e,t)=>a(t)-a(e)||Ae(e.stableId,t.stableId));for(const a of s){const s=e.indexOf(a);if(s===i)continue;e.splice(s,1),e.splice(i,0,a);const r=Qe(e),l=W(r);l.cost>t.cost?(e.splice(i,1),e.splice(s,0,a)):(t=l,n.cost>l.cost&&(o=r,n=l))}$=o}else{let e=W($),t=[...$],o=e;const n=Math.floor(($.length-1)/2),i=[...$].sort((e,t)=>t.peak.topPeak+t.peak.botPeak-(e.peak.topPeak+e.peak.botPeak)||_(e,t));for(const a of i){const i=$.indexOf(a);if(i===n)continue;$.splice(i,1),$.splice(n,0,a);const s=W($);s.cost>e.cost?($.splice(n,1),$.splice(i,0,a)):(e=s,o.cost>s.cost&&(t=[...$],o=s))}$=t}if((Y||"crossing-min"===s.laneOrder||"crossing-min+inside-out"===s.laneOrder)&&$.length>1)if(X){let e=Ve($),t=j(Qe(e),void 0,"score");for(let o=0;6>o&&e.length>1;o++){let o=!1;for(let n=0;e.length-1>n;n++){[e[n],e[n+1]]=[e[n+1],e[n]];const i=Qe(e),a=j(i,void 0,"score");t.cost>a.cost?($=i,t=a,o=!0):[e[n],e[n+1]]=[e[n+1],e[n]]}if(!o)break}e=Je(Ve($),u,_),$=Qe(e)}else{let e=j($,void 0,"score");for(let t=0;$.length-1>t;t++){const o=$[t],n=$[t+1],i=new Map($.map((e,t)=>[e,t]));let a=0;const s=[];h++;for(const e of[...g.get(o)??[],...g.get(n)??[]])f[e.index]!==h&&(f[e.index]=h,s.push(e),a+=ot(e,i,d));[$[t],$[t+1]]=[n,o];const r=new Map(i);r.set(o,t+1),r.set(n,t);let l=0;for(const e of s)l+=ot(e,r,d);w.localCrossing+=s.length;const c=j($,e.crossings-a+l,"score");e.cost>c.cost?e=c:[$[t],$[t+1]]=[o,n]}}const G=Ue(r);$=Ue($);let V=j($);const U=j(G);if(Y){const e=N(G),t=N($);(V.crossings>U.crossings||V.crossings===U.crossings&&t>e+1e-9||V.cost>U.cost)&&($=G,V=U)}else V.cost>U.cost&&($=G,V=U);return Ge(i,a,$),{before:U,after:V,initialOrder:r.map(e=>l.get(e)),evaluations:w}}function rt(e,t,o){const n=e.map(e=>{const n=e.occupants.map(e=>({id:e.id,end:o[e.id]?.end??e.end}));let i=0,a=0;for(const e of n){const o=t[e.id];i=Math.max(i,o?.topPeak||0),a=Math.max(a,o?.botPeak||0)}return{occupants:n,peak:{topPeak:i,botPeak:a},...null!=e.group?{group:e.group}:{}}}),i={};return n.forEach((e,t)=>{for(const o of e.occupants)i[o.id]=t}),{slots:n,slotByNode:i}}var lt=new Map,ct=1e-9,dt=1e5;function ut(e,t){let o=1/0,n=-1/0;for(const t of e?.samples??[])t.topMass+t.botMass>ct&&(o=Math.min(o,t.t),n=Math.max(n,t.t));return Number.isFinite(o)&&Number.isFinite(n)?(null!=t.start&&(o=Math.max(o,t.start)),null!=t.end&&(n=Math.min(n,t.end)),o>n?{start:null,end:null}:{start:o,end:n}):{start:null,end:null}}function mt(e,t){return null!=e.start&&null!=e.end&&null!=t.start&&null!=t.end&&!(t.start>=e.end||e.start>=t.end)}function gt(e,t){return Ae(e,t)>0?`${t}\0${e}`:`${e}\0${t}`}function ft(e){const t=new Map,o=new Map;for(const n of e)o.has(n.source)||o.set(n.source,new Set),t.has(n.target)||t.set(n.target,new Set),o.get(n.source).add(n.target),t.get(n.target).add(n.source);return{incoming:new Map([...t].map(([e,t])=>[e,t.size])),outgoing:new Map([...o].map(([e,t])=>[e,t.size]))}}function ht(e){const t=new Map,o=new Map,n=(e,t,o,n)=>{let i=e.get(t);i||(i=new Map,e.set(t,i)),i.set(o,(i.get(o)??0)+n)};for(const i of e){const e=i.value>0&&Number.isFinite(i.value)?i.value:1;n(t,i.source,i.target,e),n(o,i.target,i.source,e)}const i=new Map,a=e=>{if(i.has(e))return;const n=t.get(e),a=o.get(e);if(n&&1===n.size&&(!a||0===a.size)){const[t,o]=[...n][0];return void i.set(e,{partner:t,weight:o})}const s=new Map;for(const[e,t]of n??[])s.set(e,(s.get(e)??0)+t);for(const[e,t]of a??[])s.set(e,(s.get(e)??0)+t);if(1===s.size){const[t,o]=[...s][0];i.set(e,{partner:t,weight:o})}};for(const t of e)a(t.source),a(t.target);return i}function pt(e,t,o){const n=o.get(e),i=o.get(t);return!n||!i||n.partner===i.partner||n.partner===t||i.partner===e}function bt(e,t,o){return!!o.has(e)&&t.some(t=>!pt(e,t,o))}function yt(e,t){return(e.value>0&&Number.isFinite(e.value)?e.value:1)*(1+(1===t.outgoing.get(e.source)?1:0)+(1===t.incoming.get(e.target)?1:0))}function vt(e,t,o,n){if(12>=e.length||1>=n.slotCount)return n.assignment;const i=new Map(e.map((e,t)=>[e,t])),a=Array.from({length:e.length},()=>new Map),s=ft(o);for(const e of o){const t=i.get(e.source),o=i.get(e.target);if(null==t||null==o||t===o)continue;const n=yt(e,s);a[t].set(o,(a[t].get(o)??0)+n),a[o].set(t,(a[o].get(t)??0)+n)}const r=ht(o),l=e.map(e=>r.get(e)?.weight??0),c=Array.from({length:e.length},()=>new Map);let d=0;for(let o=0;e.length-1>o&&5e4>d;o++)if(r.has(e[o]))for(let n=o+1;e.length>n;n++){if(!r.has(e[n]))continue;if(t.conflicts(e[o],e[n]))continue;d++;const i=Math.min(l[o],l[n])||Math.max(l[o],l[n]),a=pt(e[o],e[n],r)?i:-i;if(Math.abs(a)>ct&&(c[o].set(n,a),c[n].set(o,a),d>=5e4))break}const u=[...n.assignment],m=Array.from({length:n.slotCount},()=>[]);u.forEach((e,t)=>m[e].push(t));const g=(e,t,o)=>{const n=u[t],i=u[o];let a=0;const s=new Set;for(const r of[t,o])for(const[l,c]of e[r]){const e=l>r?`${r}:${l}`:`${l}:${r}`;if(s.has(e))continue;s.add(e);const d=(r===t?i:n)===(l===t?i:l===o?n:u[l]);u[r]===u[l]!==d&&(a+=d?c:-c)}return a},f=(e,t,o)=>{let n=0;for(const[i,a]of e[t]){const e=o===u[i];u[t]===u[i]!==e&&(n+=e?a:-a)}return n},h=(e,t)=>e>ct||ct>=Math.abs(e)&&t>ct,p=(e,t,o,n)=>e>o+ct||ct>=Math.abs(e-o)&&t>n+ct;let b=0;for(let o=0;32>o&&dt>b;o++){let o=null,n=-1,i=-1,s=-1,r=-1/0,l=-1/0;for(let d=0;e.length>d;d++){for(let g=0;m.length>g&&b++<dt;g++){if(g===u[d])continue;if(!m[g].every(o=>!t.conflicts(e[d],e[o])))continue;const b=f(a,d,g),y=f(c,d,g);h(b,y)&&p(b,y,r,l)&&(o="move",n=d,i=-1,s=g,r=b,l=y)}if(b>=dt)break}for(let d=0;e.length-1>d;d++){for(let f=d+1;e.length>f&&b++<dt;f++){const b=u[d],y=u[f];if(b===y)continue;if(!m[y].every(o=>o===f||!t.conflicts(e[d],e[o])))continue;if(!m[b].every(o=>o===d||!t.conflicts(e[f],e[o])))continue;const v=g(a,d,f),k=g(c,d,f);h(v,k)&&p(v,k,r,l)&&(o="swap",n=d,i=f,s=-1,r=v,l=k)}if(b>=dt)break}if(null==o||-1===n)break;if("move"===o){const e=u[n];m[e].splice(m[e].indexOf(n),1),m[s].push(n),u[n]=s;continue}const d=u[n],y=u[i];m[d].splice(m[d].indexOf(n),1,i),m[y].splice(m[y].indexOf(i),1,n),u[n]=y,u[i]=d}return u}function kt(e,t,o,n){const i=function(e,t,o,n){return`${e.map(e=>{const t=o[e.id],i=n[e.id];return[e.id,e.group??"",e.xExtent?.[0]??"",e.xExtent?.[1]??"",t?.topPeak??0,t?.botPeak??0,i?.start??"",i?.end??""].join(":")}).join("|")}#${t.map(e=>[e.id,e.source,e.target,e.value,e.startTime,e.endTime].join(":")).join("|")}`}(e,t,o,n),a=lt.get(i);if(a)return rt(a.slots,o,n);const s={};for(const t of e)s[t.id]=ut(o[t.id],n[t.id]);const r=function(e,t){return e.filter(e=>null!=t[e.id].start).sort((e,o)=>t[e.id].start-t[o.id].start||t[e.id].end-t[o.id].end||Ae(e.id,o.id)).map(e=>e.id)}(e,s),l=new Map(e.map(e=>[e.id,e])),c=new Map(e.map(e=>[e.id,e.group||void 0])),d=function(e,t,o,n,i){const a=new Set,s=new Map(e.map(e=>[e,new Set])),r=new Map(e.map(e=>[e,new Set]));for(const e of n)a.add(gt(e.source,e.target)),s.get(e.target)?.add(e.source),r.get(e.source)?.add(e.target);const l=new Map,c=new Set,d=(e,t)=>{for(let o=0;e.length>o;o++)for(let n=o+1;e.length>n;n++){const i=gt(e[o],e[n]);t instanceof Map?t.set(i,[e[o],e[n]]):t.add(i)}};for(const e of r.values())d([...e],l);for(const e of s.values())d([...e],c);const u=new Set;for(const[e,[n,i]]of l)c.has(e)&&(mt(t[n],t[i])||mt(o[n],o[i])&&(u.add(n),u.add(i)));return{conflicts:(e,o)=>{const n=i.get(e),s=i.get(o);return null!=n&&null!=s&&n!==s||null!=n!=(null!=s)&&!a.has(gt(e,o))||!!mt(t[e],t[o])||!(!u.has(e)&&!u.has(o))&&!a.has(gt(e,o))}}}(r,s,n,t,c),u=function(e,t,o=new Map){const n=[],i=[];for(const a of e){let e=n.findIndex(e=>e.every(e=>!t.conflicts(a,e))&&!bt(a,e,o));-1!==e||o.has(a)||(e=n.findIndex(e=>e.every(e=>!t.conflicts(a,e)))),-1===e&&(e=n.length,n.push([])),n[e].push(a),i.push(e)}return{assignment:i,slotCount:n.length}}(r,d,ht(t)),m=function(e,t,o,n){if(0===e.length||e.length>12||1>=n.slotCount)return n.assignment;const i=new Map(e.map((e,t)=>[e,t])),a=Array.from({length:e.length},()=>new Float64Array(e.length)),s=Array.from({length:e.length},()=>new Map),r=Array.from({length:e.length},()=>new Map),l=ft(o);for(const e of o){const t=i.get(e.source),o=i.get(e.target);if(null==t||null==o||t===o)continue;const n=yt(e,l);a[t][o]+=n,a[o][t]+=n,r[t].set(o,(r[t].get(o)??0)+n),s[o].set(t,(s[o].get(t)??0)+n)}const c=ht(o),d=e.map(e=>c.get(e)?.weight??0),u=Array.from({length:e.length},()=>new Float64Array(e.length));for(let t=0;e.length>t;t++)for(let o=t+1;e.length>o;o++){for(const[e,n]of s[t])u[t][o]+=Math.min(n,s[o].get(e)??0);for(const[e,n]of r[t])u[t][o]+=Math.min(n,r[o].get(e)??0);if(c.has(e[t])&&c.has(e[o])){const n=Math.min(d[t],d[o])||Math.max(d[t],d[o]);u[t][o]+=pt(e[t],e[o],c)?n:-n}u[o][t]=u[t][o]}let m=[...n.assignment],g=(t=>{let o=0,n=0;for(let i=0;e.length>i;i++)for(let s=i+1;e.length>s;s++)t[i]===t[s]&&(o+=a[i][s],n+=u[i][s]);return{flow:o,affinity:n}})(m),f=0;const h=Array(e.length).fill(-1),p=Array.from({length:n.slotCount},()=>[]),b=(o,i,s,r)=>{if(f>=75e3)return;if(o===e.length)return f++,void((s>g.flow||s===g.flow&&r>g.affinity||s===g.flow&&r===g.affinity&&function(e,t){for(let o=0;Math.min(e.length,t.length)>o;o++)if(e[o]!==t[o])return t[o]>e[o];return t.length>e.length}(h,m))&&(m=[...h],g={flow:s,affinity:r}));const l=Math.min(i+1,n.slotCount-1);for(let n=0;l>=n;n++){if(p[n].some(n=>t.conflicts(e[o],e[n])))continue;let l=0,c=0;for(const e of p[n])l+=a[o][e],c+=u[o][e];if(h[o]=n,p[n].push(o),b(o+1,Math.max(i,n),s+l,r+c),p[n].pop(),h[o]=-1,f>=75e3)return}};return h[0]=0,p[0].push(0),b(1,0,0,0),m}(r,d,t,{...u,assignment:vt(r,d,t,u)}),g=new Map,f=m.map(e=>(g.has(e)||g.set(e,g.size),g.get(e))),h=Array.from({length:g.size||(e.length>0?1:0)},()=>({occupants:[],peak:{topPeak:0,botPeak:0}})),p={};r.forEach((e,t)=>{const o=f[t],n=h[o];n.occupants.push({id:e,end:s[e].end??-1/0});const i=l.get(e)?.group;i&&(n.group=i),p[e]=o});for(const t of[...e].sort((e,t)=>Ae(e.id,t.id)))null==p[t.id]&&(h[0].occupants.push({id:t.id,end:-1/0}),p[t.id]=0);for(const e of h){e.occupants.sort((e,t)=>(s[e.id].start??1/0)-(s[t.id].start??1/0)||Ae(e.id,t.id));for(const t of e.occupants){const n=o[t.id];e.peak.topPeak=Math.max(e.peak.topPeak,n?.topPeak||0),e.peak.botPeak=Math.max(e.peak.botPeak,n?.botPeak||0)}}const b={slots:h,slotByNode:p};return function(e,t){for(lt.has(e)&<.delete(e),lt.set(e,{slots:t.slots.map(e=>({occupants:e.occupants.map(e=>({...e})),peak:{...e.peak},...null!=e.group?{group:e.group}:{}})),slotByNode:{...t.slotByNode}});lt.size>12;){const e=lt.keys().next().value;if(null==e)break;lt.delete(e)}}(i,b),b}function wt(e){return e.topMass+e.botMass}function xt(e,t){const o=e.samples.filter(e=>e.t===t);if(o.length>0)return o.reduce((e,t)=>wt(t)<wt(e)?e:t,o[0]);let n=null;for(const o of e.samples){if(o.t>t)break;n=o}return n}function Mt(e,t,o,n,i,a,s=0){const r=new Map;for(const o of e){if(!o.group||!t[o.id])continue;const e=r.get(o.group)??[];e.push(o),r.set(o.group,e)}if(0===r.size||0>=a)return t;const l=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,{...t,samples:t.samples.map(e=>({...e})),localAttachments:new Map([...t.localAttachments].map(([e,t])=>[e,{...t}]))}]));for(const[e,c]of r){const r=o.map((e,t)=>({slot:e,index:t})).filter(({slot:t})=>t.group===e);if(0===r.length)continue;const d=r[0].slot,u=r.at(-1).slot,m=i[d.occupants[0]?.id],g=i[u.occupants[0]?.id];if(!Number.isFinite(m)||!Number.isFinite(g))continue;const f=(m-d.peak.topPeak*a+(g+u.peak.botPeak*a))/2,h=[...new Set(c.flatMap(e=>t[e.id].samples.map(e=>e.t)))].sort((e,t)=>e-t),p=new Map;for(const e of c)p.set(e.id,new Map);for(const e of h){const o=new Map;for(const i of c){const a=xt(t[i.id],e);if(!a||1e-9>=wt(a))continue;const s=n[i.id];if(null==s)continue;const r=o.get(s)??[];r.push({node:i,sample:a}),o.set(s,r)}const r=[...o].sort((e,t)=>e[0]-t[0]).map(([e,t])=>({slot:e,active:t,mass:Math.max(...t.map(({sample:e})=>wt(e)))}));if(0===r.length)continue;let l=f-(r.reduce((e,t)=>e+t.mass,0)*a+Math.max(0,s)*Math.max(0,r.length-1))/2;for(const t of r){for(const{node:o,sample:n}of t.active){const t=(l-i[o.id])/a+n.topMass-(n.boundaryOffset??0);p.get(o.id).set(e,t)}l+=t.mass*a+Math.max(0,s)}}for(const e of c){const o=t[e.id],n=l[e.id],i=p.get(e.id),a=[];for(const e of h){const t=i.get(e),n=o.samples.filter(t=>t.t===e);if(n.length>0){a.push(...n.map(e=>({...e,...null!=t?{boundaryOffset:(e.boundaryOffset??0)+t}:{}})));continue}const s=xt(o,e);null!=t&&s&&wt(s)>1e-9&&a.push({...s,t:e,boundaryOffset:(s.boundaryOffset??0)+t})}n.samples=a,n.localAttachments=new Map([...o.localAttachments].map(([e,t])=>{const o=i.get(t.time);return[e,{...t,...null!=o?{boundaryOffset:(t.boundaryOffset??0)+o}:{}}]}))}}return l}function St(e,t,o,n,i){const{plotH:a,padding:s,valueScale:r,packing:l,laneOrder:c,lifetimeMode:d="half",lanePlacement:u="stack",groupPadding:m=0,ribbonLane:g="both",domain:f}=i,h={},p={};for(const t of e)h[t.id]=o[t.id].topPeak||0,p[t.id]=o[t.id].botPeak||0;const b="half"===d,y={};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,a=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=b?(e.startTime+e.endTime)/2:e.endTime;t>a&&(a=t)}for(const e of n.incoming[t.id]){const t=b?(e.startTime+e.endTime)/2:e.startTime;i>t&&(i=t),e.endTime>a&&(a=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>a&&(a=e.systemOutTime)}y[t.id]={start:Number.isFinite(i)?i:null,end:Number.isFinite(a)?a:null}}let v={},k=[],w=[];if(i.frozenSlots){const e=rt(i.frozenSlots,o,y);k=e.slots,v=e.slotByNode,w=k.map(Ie)}else if("reuse"===l){const n=kt(e,t,o,y);k=n.slots,v=n.slotByNode}else e.forEach((e,t)=>{k.push({occupants:[{id:e.id,end:y[e.id]?.end??-1/0}],peak:{topPeak:h[e.id],botPeak:p[e.id]},...e.group?{group:e.group}:{}}),v[e.id]=t});Ke(k,v),0===w.length&&(w=k.map(Ie));let x=null;i.frozenSlots||(i.fixedSlotOrder?function(e,t,o){const n=new Map(o.map((e,t)=>[e,t]));Ge(e,t,[...e].sort((e,t)=>(n.get(Ie(e))??1/0)-(n.get(Ie(t))??1/0)||Ae(Ie(e),Ie(t))))}(k,v,i.fixedSlotOrder):i.runOrdering&&c&&"insertion"!==c&&(x=st(e,t,o,y,k,v,{plotH:a,padding:s,valueScale:r,groupPadding:m,laneOrder:c,ribbonLane:g,domain:f}))),Ke(k,v);const M=Be(e,t,o,k,v,{plotH:a,padding:s,valueScale:r,stackValueScale:i.stackValueScale,lanePlacement:u,groupPadding:m}),S=0===k.length?0:k[0].peak.topPeak+M.adjacentClearance.reduce((e,t)=>e+t,0)+k[k.length-1].peak.botPeak,T=x?.before.crossings??null,C=x?.after.crossings??null,A=x?.before.weightedLength??null,I=x?.after.weightedLength??null;return{effectiveSlotsHeight:S,centerlines:M.centerlines,laneLifetime:y,slots:k,slotByNode:v,slotCenter:M.slotCenter,stackCenter:M.stackCenter,verticalUtilization:M.verticalUtilization,selectedSlotOrder:k.map(Ie),initialSlotOrder:w,ordering:x,crossingsBefore:T,crossingsAfter:C,lengthBefore:A,lengthAfter:I}}import{forwardRef as Tt,useMemo as Ct,useRef as At,useCallback as It,useEffect as Ot}from"react";function Pt(e,t,o,n="horizontal"){return"vertical"===n?{top:e?38:t?28:16,right:24,bottom:24,left:o?72:24}:{top:e?30:t?24:8,right:80,bottom:o?28:8,left:80}}import{Fragment as Nt,jsx as Ht,jsxs as Bt}from"react/jsx-runtime";var Lt="var(--semiotic-grid, #94a3b8)",Dt="var(--semiotic-text-secondary, #475569)",Et="var(--semiotic-text-secondary, #94a3b8)";import{useEffect as Ft,useMemo as Rt,useRef as zt,useState as Wt}from"react";import{scaleTime as jt}from"d3-scale";import{scaleTime as $t}from"d3-scale";function _t(e,t,o,n,i,a,s,r,l={}){const c=i,d=e=>r?Math.max(r[0],Math.min(r[1],e)):e;let u=a(d(e.time));const m=a(d(o.time)),g=e.value*c,f=o.value*c,h=t+(e.boundaryOffset??0)*c,p=n+(o.boundaryOffset??0)*c,b=e.sideMassBefore*c,y=o.sideMassAfter*c;let v,k,w,x;"top"===e.side?(v=h-b,k=v+g):(k=h+b,v=k-g),"top"===o.side?(w=p-y,x=w+f):(x=p+y,w=x-f);const M=l.sourceRunwayStart,S=l.minRun,T=Math.abs((w+x)/2-(v+k)/2),C=m-u,A="number"==typeof M&&Number.isFinite(M),I="number"==typeof S&&Number.isFinite(S)&&S>0;if(A&&T>1e-9&&C>0&&("auto"===S||I)){const t="source"===s?.85:"target"===s?.15:.5,o="auto"===S?Math.min(144,Math.sqrt(8*T/(1.5*Math.min(t*t,(1-t)*(1-t))))):S;if(o>C){const t=a(d(Math.min(M,e.time)));Number.isFinite(t)&&(u=Math.min(u,Math.max(Math.min(u,t),m-o)))}}const O="source"===s?u+.85*(m-u):"target"===s?u+.15*(m-u):(u+m)/2;return{sx:u,sTop:v,sBot:k,tx:m,tTop:w,tBot:x,cp1X:O,cp2X:O}}function Xt(e){return Math.max(18,11*e.length*.58)}function qt(e){const t=1.22*Xt(e.labelText)+4;return"start"===e.labelAnchor?[e.labelX,e.labelX+t]:"middle"===e.labelAnchor?[e.labelX-t/2,e.labelX+t/2]:[e.labelX-t,e.labelX]}function Yt(e,t){const o=e.labelX-Xt(e.labelText),n=t.labelX-Xt(t.labelText);return t.labelX+3>=o&&e.labelX+3>=n}var Gt=/(-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?),(-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)/gi;function Vt(e){return e.replace(Gt,(e,t,o)=>`${o},${t}`)}function Ut(e){if(!e)return;const t=e=>({x:e.y,y:e.x});return{...e,...e.points&&{points:e.points.map(t)},...e.segments&&{segments:e.segments.map(e=>e.map(t))}}}function Qt(e){return{...e,pathD:Vt(e.pathD),y0:e.x0,y1:e.x1,x0:0,x1:0}}function Jt(e){const{nodes:t,edges:o,domain:n,plotW:i,plotH:a,ribbonLane:s,ribbonMinRun:r=0,edgeOpacity:c,colorOf:d,layoutOpts:u,orientation:m="horizontal",showLabels:g=!0,labelPriorityAccessor:f,maxLabels:b,selectionDatum:y="raw",styleRules:v,colorBy:k,valueAccessor:w,usageMode:x="static"}=e,M="vertical"===m?a:i,S="vertical"===m?i:a,C=ye(t,o,n,{usageMode:x}),{fatal:A,warnings:I}=function(e){const t=[],o=[];for(const n of e)"fatal"===be(n)?t.push(n):o.push(n);return{fatal:t,warnings:o}}(C),O=function(e,t,o="static"){if("strip"!==he(o).invalidSystemTime)return e;const n=new Set(t.filter(e=>"invalid-system-time"===e.kind).map(e=>e.id));return 0===n.size?e:e.map(e=>{if(!n.has(e.id))return e;const t={...e};return null==t.systemInTime||Number.isFinite(t.systemInTime)||delete t.systemInTime,null==t.systemOutTime||Number.isFinite(t.systemOutTime)||delete t.systemOutTime,t})}(o,C,x),P=$t().domain(n).range([0,M]);if(A.length>0)return{layout:null,layoutConfig:{bands:[],ribbons:[],showLabels:!1!==g},issues:A,warnings:I,xScale:P};const N=function(e,t,o){const{plotH:n,pairing:i="temporal",packing:a="reuse",laneOrder:s="crossing-min",lifetimeMode:r="half",maxValueScale:l,lanePlacement:c="stack",nodeSizing:d="temporal",groupPadding:u=0,ribbonLane:m="both",domain:g}=o,f=Number.isFinite(u)?Math.max(0,u):0,h=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),p=function(e,t,o,n="temporal"){const i="temporal"===n?(e,t)=>e.endTime-t.endTime||Ae(e.id,t.id):(e,t)=>t.value-e.value||Ae(e.id,t.id),a="temporal"===n?(e,t)=>e.startTime-t.startTime||Ae(e.id,t.id):(e,t)=>t.value-e.value||Ae(e.id,t.id),s=new Map;for(const e of t)s.set(e.id,{});const r=(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||Ae(e.partner,o.partner):e.latestEnd-o.latestEnd||Ae(e.partner,o.partner):(e,t)=>t.total-e.total||Ae(e.partner,t.partner));for(const e of s)e.edges.sort("target"===t?a:i);return s};for(const t of e){const e=o.outgoing[t.id],n=o.incoming[t.id];if(0===n.length)r(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)r(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=r(n,"source"),o=r(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,h,i);let b={};for(const t of e)b[t.id]=qe(t,h,p,void 0,d);const y=St(e,t,b,h,{plotH:n,padding:12,valueScale:1,packing:a,laneOrder:s,lifetimeMode:r,runOrdering:!0,lanePlacement:"stack",groupPadding:f,ribbonLane:m,domain:g}),v=y.slots.map(e=>({occupants:e.occupants.map(e=>({...e})),peak:{...e.peak},...null!=e.group?{group:e.group}:{}})),k=new Set;for(const e of t){const t=y.slotByNode[e.source],o=y.slotByNode[e.target];if(void 0===t||void 0===o)continue;const n=p.get(e.id);t!==o?t>o?(n.sourceSide="top",n.targetSide="bot"):(n.sourceSide="bot",n.targetSide="top"):(k.add(e.id),n.sourceSide="bot",n.targetSide="bot")}for(const t of e){const e=h.outgoing[t.id],o=h.incoming[t.id],n=new Set(e.map(e=>p.get(e.id).sourceSide)),i=new Set(o.map(e=>p.get(e.id).targetSide));if(1===n.size&&o.length>0){const e=[...n][0];for(const t of o)y.slotByNode[t.source]===y.slotByNode[t.target]&&(p.get(t.id).targetSide=e)}if(1===i.size&&e.length>0){const t=[...i][0];for(const o of e)y.slotByNode[o.source]===y.slotByNode[o.target]&&(p.get(o.id).sourceSide=t)}}!function(e,t,o){const n=new Map,i=[];for(const t of e)i.push({time:t.startTime,kind:"out",edge:t}),i.push({time:t.endTime,kind:"in",edge:t});i.sort((e,t)=>e.time-t.time||(e.kind===t.kind?0:"in"===e.kind?-1:1)||("out"===e.kind?t.edge.value-e.edge.value:0)||Ae(e.edge.id,t.edge.id));const a=e=>{let t=n.get(e);return t||(t={top:0,bot:0},n.set(e,t)),t},s=(e,t,o)=>{const n="top"===t?"bot":"top",i=Math.min(o,e[t]);e[t]-=i;const a=o-i;a>0&&(e[n]=Math.max(0,e[n]-a))};for(const e of i){const{edge:n}=e;if("in"===e.kind){const e=t.get(n.id)?.targetSide??"bot";a(n.target)[e]+=n.value;continue}const i=a(n.source),r=t.get(n.id);let l=r.sourceSide??"bot";if(o[n.source]===o[n.target]){const e=i.top>=n.value,t=i.bot>=n.value;e!==t?l=e?"top":"bot":e||t||i.top===i.bot||(l=i.top>i.bot?"top":"bot"),r.sourceSide=l,r.targetSide=l}s(i,l,n.value)}}(t,p,y.slotByNode),function(e,t,o,n){for(const i of e){const e=t.incoming[i.id],a=t.outgoing[i.id];if(0===e.length||0===a.length)continue;const s=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const n of e)"top"===o.get(n.id).targetSide?t.inTop+=n.value:t.inBot+=n.value;for(const e of a)"top"===o.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},r=(e,t)=>{const i=s(),r="top"===e?i.outTop-i.inTop:i.outBot-i.inBot,l="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=l)return!1;const c=Math.min(r,l),d=a.filter(t=>!n.has(t.id)&&o.get(t.id).sourceSide===e&&c>=t.value).sort((e,t)=>t.value-e.value||Ae(e.id,t.id));return 0!==d.length&&(o.get(d[0].id).sourceSide=t,!0)};let l=a.length+1;for(;l-- >0&&(r("top","bot")||r("bot","top")););}}(e,h,p,k),b={};for(const t of e)b[t.id]=qe(t,h,p,void 0,d);const w=St(e,t,b,h,{plotH:n,padding:12,valueScale:1,packing:a,laneOrder:s,lifetimeMode:r,frozenSlots:v,lanePlacement:"stack",groupPadding:f,ribbonLane:m,domain:g}),x=w.effectiveSlotsHeight??w.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),M=w.slots.slice(0,-1).reduce((e,t,o)=>e+(null!=t.group&&t.group===w.slots[o+1].group?1:0),0),S=Math.max(1,w.slots.length+1-M),T=Math.min(12,Math.max(0,.35*n-M*f)/S),C=2*T+Oe(w.slots,T,f).reduce((e,t)=>e+t,0),A=x>0?Math.max(0,(n-C)/x):1,I=Number.isFinite(l)&&l>0?Math.min(A,l):A;let O=St(e,t,b,h,{plotH:n,padding:T,valueScale:I,packing:a,laneOrder:s,lifetimeMode:r,frozenSlots:v,lanePlacement:c,groupPadding:f,ribbonLane:m,domain:g,stackValueScale:A});const P=Number.isFinite(l)&&l>0&&A>l+1e-12;if("insertion"!==s&&("hug"===c||P)&&O.slots.length>1&&(st(e,t,b,O.laneLifetime,O.slots,O.slotByNode,{plotH:n,padding:T,valueScale:I,groupPadding:f,laneOrder:s,ribbonLane:m,domain:g,lanePlacement:c,mode:"geometry-refine"}),O=St(e,t,b,h,{plotH:n,padding:T,valueScale:I,packing:a,laneOrder:s,lifetimeMode:r,frozenSlots:O.slots,fixedSlotOrder:O.slots.map(Ie),lanePlacement:c,groupPadding:f,ribbonLane:m,domain:g,stackValueScale:A})),function(e,t){const o=(e,o)=>{for(const n of e){const e=new Map;for(const i of n){const n=`${("out"===o?t.get(i.id)?.sourceSide:t.get(i.id)?.targetSide)??""}\0${"out"===o?i.startTime:i.endTime}`,a="out"===o?`${i.target}\0${i.endTime}`:`${i.source}\0${i.startTime}`,s=e.get(n);if(null!=s&&s!==a)return!0;e.set(n,a)}}return!1};return o(Object.values(e.outgoing),"out")||o(Object.values(e.incoming),"in")}(h,p)){const o=function(e,t,o,n){const i=new Map;for(const a of e){const e=t[a.source]?.localAttachments.get(a.id),s=t[a.target]?.localAttachments.get(a.id),r=o[a.source],l=o[a.target];if(!(e&&s&&Number.isFinite(r)&&Number.isFinite(l)))continue;const c=Xe(e,r,n),d=Xe(s,l,n);i.set(a.id,{source:(c[0]+c[1])/2,target:(d[0]+d[1])/2})}return i}(t,b,O.centerlines,I);b={};for(const t of e)b[t.id]=qe(t,h,p,o,d);O=St(e,t,b,h,{plotH:n,padding:T,valueScale:I,packing:a,laneOrder:s,lifetimeMode:r,frozenSlots:O.slots,fixedSlotOrder:O.slots.map(Ie),lanePlacement:c,groupPadding:f,ribbonLane:m,domain:g,stackValueScale:A})}const N=new Map(y.initialSlotOrder.map((e,t)=>[e,t])),H=[...O.slots].sort((e,t)=>(N.get(Ie(e))??1/0)-(N.get(Ie(t))??1/0)||Ae(Ie(e),Ie(t))),B={};H.forEach((e,t)=>{for(const o of e.occupants)B[o.id]=t});const L=Be(e,t,b,H,B,{plotH:n,padding:T,valueScale:I,stackValueScale:A,lanePlacement:"stack",groupPadding:f}),D=Mt(e,b,H,B,L.centerlines,I,f),E=je(et(B,t),tt(B,t),t,D,H,B,L.centerlines,O.laneLifetime,I,L.verticalUtilization,m,g);b=Mt(e,b,O.slots,O.slotByNode,O.centerlines,I,f);const F=je(et(O.slotByNode,t),tt(O.slotByNode,t),t,b,O.slots,O.slotByNode,O.centerlines,O.laneLifetime,I,O.verticalUtilization,m,g);return{nodeData:b,sides:p,valueScale:I,padding:T,compressedPadding:12>T,centerlines:O.centerlines,laneLifetime:O.laneLifetime,slots:O.slots,slotByNode:O.slotByNode,crossingsBefore:"insertion"===s?null:E.crossings,crossingsAfter:"insertion"===s?null:F.crossings,lengthBefore:"insertion"===s?null:E.weightedLength,lengthAfter:"insertion"===s?null:F.weightedLength,layoutQualityBefore:E,layoutQuality:F}}(t,O,{plotH:S,...u,ribbonLane:s,domain:n}),{centerlines:H,nodeData:B,valueScale:L}=N,D=h(k,w),E=[],F=[],R=0===r?new Map:function(e,t,o){const n=new Set(t.map(e=>e.target)),i=new Map(e.map(e=>[e.id,e])),a=new Map;for(const e of t){if(n.has(e.source))continue;const t=a.get(e.source)??[];t.push(e),a.set(e.source,t)}const s=new Map;for(const t of e){if(!t.group)continue;const e=s.get(t.group)??[];e.push(t),s.set(t.group,e)}const r=new Set;for(const[e,t]of s){const o=t.flatMap(e=>a.get(e.id)??[]),i=new Set(o.map(e=>e.startTime));o.length>0&&1===i.size&&t.every(e=>{const t=e.xExtent?.[0],i=o[0].startTime;return!n.has(e.id)&&(a.get(e.id)?.length??0)>0&&Number.isFinite(t)&&i>t})&&r.add(e)}const l=new Map;for(const[e,t]of a){const n=i.get(e);if(n?.group&&!r.has(n.group))continue;const a=n?.xExtent?.[0],s=[...t].sort((e,t)=>e.startTime-t.startTime||e.id.localeCompare(t.id)),c=s[0]?.startTime-1;let d=null;for(let e=0;s.length>e;){const t=s[e].startTime;let n=e+1;for(;s.length>n&&s[n].startTime===t;)n++;for(let t=e;n>t;t++){const e=s[t],n=Number.isFinite(a)&&e.startTime>a,i=Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime;if(!n&&!i)continue;let r=o[0];n&&(r=Math.max(r,a)),i&&(r=Math.max(r,e.systemInTime)),!n&&i&&Number.isFinite(c)&&(r=Math.max(r,c)),null!=d&&(r=Math.max(r,d)),e.startTime>r&&l.set(e.id,r)}d=t,e=n}}for(const[e,t]of s){if(!r.has(e))continue;const o=t.flatMap(e=>a.get(e.id)??[]);if(!o.every(e=>l.has(e.id))){for(const e of o)l.delete(e.id);continue}const n=Math.max(...o.map(e=>l.get(e.id)));for(const e of o)l.set(e.id,n)}return l}(t,O,n),z=new Map(t.filter(e=>e.group).map(e=>[e.id,e.group])),W=new Map;for(const e of O){const t=B[e.source]?.localAttachments.get(e.id),o=B[e.target]?.localAttachments.get(e.id);t&&o&&W.set(e.id,_t(t,H[e.source],o,H[e.target],L,P,s,n,{minRun:r,sourceRunwayStart:R.get(e.id)}))}const j=function(e,t,o,n,i,a){const s=new Map(t),r=new Map;for(const t of e){const e=a?.get(t.source),o=null==e?"node:"+t.source:"group:"+e,n=r.get(o)??new Map,i=n.get(t.startTime)??[];i.push(t),n.set(t.startTime,i),r.set(o,n)}for(const e of r.values())for(const[a,r]of e){if(!r.some(e=>o.has(e.id)))continue;const e=r.map(e=>t.get(e.id));if(e.some(e=>null==e))continue;const l=n(a),c=Math.min(...e.map(e=>e.sx));if(c>=l-1e-9)continue;const d=Math.max(...r.map(e=>{const t=o.get(e.id);return null==t?l:Math.min(l,n(t))})),u=Math.min(l,Math.max(c,d));for(const e of r){const o=t.get(e.id),n=u+(o.tx-u)*("source"===i?.85:"target"===i?.15:.5);s.set(e.id,{...o,sx:u,cp1X:n,cp2X:n})}}return s}(O,W,R,P,s,z),$=function(e,t,o,n,i){const a=new Map;for(const s of e){if(!o.has(s.id))continue;const e=t.get(s.id);if(!e||e.sx>=n(s.startTime)-1e-9)continue;const r=i(e.sx);Number.isFinite(r)&&s.startTime>r&&a.set(s.id,r)}return a}(O,j,R,P,e=>n[0]+e/M*(n[1]-n[0])),_=function(e,t,o){const n=new Map,i=new Map;for(const[e,t]of o??[]){const o=i.get(t)??[];o.push(e),i.set(t,o)}for(const a of e){const e=t.get(a.id);if(null==e||!Number.isFinite(e)||e>=a.startTime)continue;const s=o?.get(a.source),r=null==s?[a.source]:i.get(s)??[a.source];for(const t of r){const o=n.get(t)??new Map,i=o.get(a.startTime);o.set(a.startTime,null==i?e:Math.min(i,e)),n.set(t,o)}}return n}(O,$,z);t.forEach((e,t)=>{const o=B[e.id];if(!o||0===o.samples.length)return;const i=(a=o.samples,(s=_.get(e.id))&&0!==s.size?a.map(e=>{const t=s.get(e.t);return null==t?e:{...e,t:t}}):a);var a,s;const r=function(e,t,o,n,i){if(0===e.length)return null;const a=_e(e,i),s=e=>t+(a[e].boundaryOffset??0)*o,r=e=>s(e)-a[e].topMass*o,l=e=>s(e)+a[e].botMass*o;let c=`M${n(a[0].t)},${r(0)}`;for(let e=1;a.length>e;e++)c+=` L${n(a[e].t)},${r(e)}`;c+=` L${n(a[a.length-1].t)},${l(a.length-1)}`;for(let e=a.length-2;e>=0;e--)c+=` L${n(a[e].t)},${l(e)}`;return c+" Z"}(i,H[e.id],L,P,n);if(!r)return;const l=_e(i,n),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=H[e.id]+(c.botMass-c.topMass+2*(c.boundaryOffset??0))*L/2;let g,f,h=d(e.id,t),b=h,y=.5;const k=e.__raw??e;if(v&&v.length>0){const e=p(k,v,D(k));"string"==typeof e.fill?h=e.fill:null!=e.fill&&T(e.fill)&&(f=e.fill,h=e.fill.background&&"transparent"!==e.fill.background?e.fill.background:h),"string"==typeof e.stroke&&(b=e.stroke),"number"==typeof e.strokeWidth&&(y=e.strokeWidth),"number"==typeof e.fillOpacity&&(g=e.fillOpacity),"number"==typeof e.opacity&&null==g&&(g=e.opacity)}const w=function(e,t,o,n,i,a){const s=o.nodeData[e];if(!s||0===s.samples.length)return[];const r=o.valueScale,l=o.centerlines[e],c=_e(s.samples,i),d=c.find(e=>e.topMass+e.botMass>0)||c[0],u=[...c].reverse().find(e=>e.topMass+e.botMass>0)||c[c.length-1],m=n(d.t),g=n(u.t),f=e=>n($e(e,i)),h=[],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=s.localAttachments.get(o.id),t=a?.get(o.id)??o.startTime;if(e&&"out"===e.kind&&t>o.systemInTime){const n=f(o.systemInTime),a=f(t),s=null!=i&&i[0]>o.systemInTime,c=s?n:n-20,d=s?Math.min(a,n+20):n,u=Math.max(m,c);if(a>u){const[t,o]=Xe(e,l,r);h.push({pathD:p(u,t,a,o),x0:c,x1:d,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=s.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=f(o.systemOutTime),n=f(o.endTime),i=t+20,a=Math.min(g,i);if(a>n){const[o,s]=Xe(e,l,r);h.push({pathD:p(n,o,a,s),x0:t,x1:i,from:1,to:0})}}}}return h}(e.id,O,N,P,n,$);E.push({id:e.id,pathD:r,fill:h,stroke:b,strokeWidth:y,...null!=g&&{fillOpacity:g},...f&&{hatchFill:f},...w.length>0&&{gradientStubs:w},rawDatum:k,labelX:P("vertical"===m&&e.xExtent?e.xExtent[0]:c.t)-4,labelY:u,labelText:e.label??e.id})});const X=new Map;t.forEach((e,t)=>X.set(e.id,t)),O.forEach(e=>{const t=j.get(e.id);if(!t)return;const o=X.get(e.source)??0,n=d(e.source,o),{pathD:i,bezier:a}=l(t),s=e.__raw??e,r="function"==typeof c?Number(c(s)):c,u=Number.isFinite(r)?Math.max(0,Math.min(1,r)):.35;F.push({id:e.id,pathD:i,fill:n,opacity:u,rawDatum:s,bezier:a})});const q=function(e,t,o){const n=e.map(e=>({...e})),i=new Map;for(const e of n){const o=t[e.id];if(null==o)continue;const n=i.get(o)??[];n.push(e),i.set(o,n)}const a=e=>{if(2>e.length)return;const t=e.reduce((e,t)=>e+t.labelY,0)/e.length,n=(e.length-1)/2;e.forEach((e,i)=>{e.labelY=Math.max(8,Math.min(o-8,t+16*(i-n)))})};for(const e of i.values()){e.sort((e,t)=>e.labelX-t.labelX||e.id.localeCompare(t.id));let t=[],o=-1/0;for(const n of e){const e=n.labelX-Xt(n.labelText);t.length>0&&e>o+3&&(a(t),t=[],o=-1/0),t.push(n),o=Math.max(o,n.labelX)}a(t)}return function(e,t){const o=[...e].sort((e,t)=>e.labelY-t.labelY||e.labelX-t.labelX||e.id.localeCompare(t.id));for(let e=0;3>e;e+=1){for(let e=0;o.length>e;e+=1){let t=8;for(let n=0;e>n;n+=1)Yt(o[e],o[n])&&(t=Math.max(t,o[n].labelY+16));o[e].labelY=Math.max(o[e].labelY,t)}for(let e=o.length-1;e>=0;e-=1){let n=t-8;for(let t=e+1;o.length>t;t+=1)Yt(o[e],o[t])&&(n=Math.min(n,o[t].labelY-16));o[e].labelY=Math.min(o[e].labelY,n)}}}(n,o),n}(E,N.slotByNode,S).map(e=>function(e,t){return"horizontal"===t?e:{...e,pathD:Vt(e.pathD),gradientStubs:e.gradientStubs?.map(Qt),labelX:e.labelY,labelY:e.labelX,labelAnchor:"middle",labelBaseline:"auto"}}(e,m)),Y="vertical"===m?function(e,t,o){const n=e.map(e=>({...e}));for(const e of n){const o=1.22*Xt(e.labelText)+4;e.labelX=t-4>o?Math.max(o/2+2,Math.min(t-o/2-2,e.labelX)):t/2}const i=[],a=[...n].sort((e,t)=>e.labelY-t.labelY||e.labelX-t.labelX);for(const e of a){const t=i[i.length-1];!t||Math.abs(t[0].labelY-e.labelY)>14?i.push([e]):t.push(e)}for(const e of i){e.sort((e,t)=>e.labelX-t.labelX||e.id.localeCompare(t.id));const t=[],n=new Map;for(const o of e){const[e,i]=qt(o);let a=t.findIndex(t=>e>t+8);-1===a&&(a=t.length),t[a]=i,n.set(o,a)}const i=e.reduce((e,t)=>e+t.labelY,0)/e.length,a=14*t.length+8>i;for(const t of e){const e=n.get(t)??0;t.labelY=a?Math.min(o-8,12+14*e):Math.max(8,i-14*e)}}return n}(q,i,a):q,G=new Map;if(null!=f)for(const e of t){const t=e.__raw??e,o="function"==typeof f?f(t):Number(t[f]);Number.isFinite(o)&&G.set(e.id,o)}const V=function(e,t,o,n,i={}){if(!1===n)return e.map(e=>({...e,labelText:"",labelDeferred:!1,labelFullText:void 0}));if(!0===n)return e.map(e=>({...e,labelDeferred:!1,labelFullText:void 0}));let a=Math.max(4,Math.min(e.length,Math.floor(Math.max(1,t*o)/14e3)));Number.isFinite(i.maxLabels)&&i.maxLabels>=0&&(a=Math.min(a,Math.floor(i.maxLabels)));const s=e.map((e,t)=>{const o=i.priorityById?.get(e.id),n=Math.abs(e.labelY);return{band:e,index:t,score:null!=o&&Number.isFinite(o)?1e6*o+Xt(e.labelText):Xt(e.labelText)+.01*n}}).filter(e=>e.band.labelText.trim().length>0).sort((e,t)=>t.score-e.score||e.index-t.index||e.band.id.localeCompare(t.band.id)),r=new Set(s.slice(0,a).map(e=>e.band.id));return e.map(e=>r.has(e.id)||0===e.labelText.trim().length?{...e,labelDeferred:!1,labelFullText:void 0}:{...e,labelFullText:e.labelText,labelText:"",labelDeferred:!0})}(Y,i,a,g,{...G.size>0&&{priorityById:G},...null!=b&&{maxLabels:b}});return{layout:N,layoutConfig:{bands:V,ribbons:F.map(e=>function(e,t){return"horizontal"===t?e:{...e,pathD:Vt(e.pathD),bezier:Ut(e.bezier)}}(e,m)),showLabels:!1!==g,selectionDatum:y},issues:[],warnings:I,xScale:P}}import{scaleTime as Kt}from"d3-scale";function Zt(e,t,o,n="reuse",i="crossing-min",a=5e4){return"sync"!==e&&("worker"===e||function(e,t,o="reuse",n="crossing-min"){return e*e*("reuse"===o?80:1)+t*t*(n&&"insertion"!==n?40:1)+10*(e+t)}(t,o,n,i)>=a)}function eo(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}function to(e){if(!e)return null;const t=e.sides,o=t instanceof Map?t:new Map(Array.isArray(t)?t:[]);return{...e,sides:o}}var oo=class{constructor(e=function(){const e="string"==typeof import.meta.url&&import.meta.url?new URL("./processSankeyLayoutWorker.js",import.meta.url):b("processSankeyLayoutWorker.js");return new Worker(e,{type:"module",name:"semiotic-process-sankey-layout"})}()){this.session=new s({name:"ProcessSankey layout",createWorker:()=>e,parseMessage:e=>{const t=e,{requestId:o,error:n}=u(t);return n?{requestId:o,ok:!1,error:d(n)}:{requestId:o,ok:!0,payload:{layout:to(t.layout),layoutConfig:t.layoutConfig??{bands:[],ribbons:[],showLabels:!0},issues:t.issues??[],warnings:t.warnings??[],domain:t.domain??[0,1],timelineExtent:t.timelineExtent??0}}}})}get isDead(){return this.session.isDead}request(e,t){return this.session.request(e,t)}terminate(){this.session.terminate()}},no=c(()=>new oo);function io(e){if(function(e){if(!e||0===e.length)return!1;for(const t of e){if("function"==typeof t.when)return!0;if("function"==typeof t.style)return!0}return!1}(e.styleRules))return!0;if("function"==typeof e.edgeOpacity)return!0;if("function"==typeof e.labelPriorityAccessor)return!0;if(e.styleRules&&e.styleRules.length>0){if("function"==typeof e.colorBy)return!0;if("function"==typeof e.valueAccessor)return!0}return!1}function ao(e){if(null!=e&&"object"==typeof e){try{if("function"==typeof structuredClone)return structuredClone(e)}catch{}try{return JSON.parse(JSON.stringify(e))}catch{return}}}function so(e){const t=ao(e.__raw);return{id:e.id,...null!=e.label&&{label:e.label},...null!=e.group&&{group:e.group},...null!=e.xExtent&&{xExtent:e.xExtent},...null!=t&&{__raw:t}}}function ro(e){const t=ao(e.__raw);return{id:e.id,source:e.source,target:e.target,value:e.value,startTime:e.startTime,endTime:e.endTime,...null!=e.systemInTime&&{systemInTime:e.systemInTime},...null!=e.systemOutTime&&{systemOutTime:e.systemOutTime},...null!=t&&{__raw:t}}}var lo=(e,t)=>({layout:null,layoutConfig:{bands:[],ribbons:[],showLabels:!0},issues:[],warnings:[],xScale:jt().domain(e).range([0,t])});function co(e,t){const o=$(),{execution:n="auto",workerThreshold:i,colorById:a,fallbackPalette:s,rawNodeById:r,rawEdgeById:l}=t,c=Rt(()=>Object.keys(a).sort().map(e=>`${e}:${a[e]}`).join("|"),[a]),d=Rt(()=>e?[e.nodes,e.edges,e.plotW,e.plotH,e.orientation??"horizontal",e.ribbonLane,(e.ribbonMinRun??0)+"",e.edgeOpacity,(e.showLabels??!0)+"",e.layoutOpts.pairing??"temporal",e.layoutOpts.packing??"reuse",e.layoutOpts.laneOrder??"crossing-min",e.layoutOpts.lifetimeMode??"half",e.layoutOpts.maxValueScale??"",e.layoutOpts.lanePlacement??"stack",e.layoutOpts.nodeSizing??"temporal",e.layoutOpts.groupPadding??0,e.domain[0],e.domain[1],e.styleRules,c]:"null",[e,c]),u=!!e&&!o&&function(e,t,o){return"undefined"!=typeof window&&!!eo()&&!io(e)&&Zt(t,e.nodes.length,e.edges.length,e.layoutOpts.packing??"reuse",e.layoutOpts.laneOrder??"crossing-min",o)}(e,n,i),m=Rt(()=>e?u?null:Jt(e):lo([0,1],1),[d,u,e]),g=zt(o),[f,h]=Wt(()=>e?o?{...Jt(e),status:"ready",error:null}:u?{...lo(e.domain,"vertical"===e.orientation?e.plotH:e.plotW),status:"pending",error:null}:{...Jt(e),status:"ready",error:null}:{...lo([0,1],1),status:"ready",error:null});return Ft(()=>{if(g.current)return void(g.current=!1);if(!e||!u)return;const t=new AbortController;return h(e=>({...e,status:"pending",error:null})),async function(e,t){const{execution:o="auto",workerThreshold:n,signal:i,colorById:a,fallbackPalette:s=["#475569"],rawNodeById:r=new Map,rawEdgeById:l=new Map}=t,c=e.layoutOpts.packing??"reuse",d=e.layoutOpts.laneOrder??"crossing-min";if(!eo()||io(e)||!Zt(o,e.nodes.length,e.edges.length,c,d,n))return Jt(e);try{const t=await function(e,t){return eo()?no.get().request(e,t):Promise.reject(Error("Web Workers are unavailable"))}(function(e,t,o){return{input:{nodes:e.nodes.map(so),edges:e.edges.map(ro),domain:e.domain,plotW:e.plotW,plotH:e.plotH,orientation:e.orientation,ribbonLane:e.ribbonLane,ribbonMinRun:e.ribbonMinRun,edgeOpacity:"number"==typeof e.edgeOpacity?e.edgeOpacity:.35,layoutOpts:{...e.layoutOpts},showLabels:e.showLabels,..."string"==typeof e.labelPriorityAccessor&&{labelPriorityAccessor:e.labelPriorityAccessor},...null!=e.maxLabels&&{maxLabels:e.maxLabels},...null!=e.selectionDatum&&{selectionDatum:e.selectionDatum},...null!=e.usageMode&&{usageMode:e.usageMode},styleRules:e.styleRules,colorBy:"string"==typeof e.colorBy?e.colorBy:void 0,valueAccessor:"string"==typeof e.valueAccessor?e.valueAccessor:void 0},colorById:t,fallbackPalette:o}}(e,a,s),i);return function(e,t,o){const n=(e.layoutConfig.bands??[]).map(e=>({...e,rawDatum:t.get(e.id)??{id:e.id}})),i=(e.layoutConfig.ribbons??[]).map(e=>({...e,rawDatum:o.get(e.id)??{id:e.id}})),a=Kt().domain(e.domain).range([0,e.timelineExtent]);return{layout:e.layout,layoutConfig:{bands:n,ribbons:i,showLabels:e.layoutConfig.showLabels},issues:e.issues,warnings:e.warnings,xScale:a}}(t,r,l)}catch(t){if("AbortError"===t?.name)throw t;return Jt(e)}}(e,{execution:n,workerThreshold:i,signal:t.signal,colorById:a,fallbackPalette:s,rawNodeById:r,rawEdgeById:l}).then(e=>{h({...e,status:"ready",error:null})}).catch(e=>{"AbortError"!==e.name&&h(t=>({...t,status:"error",error:e}))}),()=>t.abort()},[d,u,n,i,s,r,l]),m?{...m,status:"ready",error:null}:f}import{useCallback as uo,useMemo as mo,useRef as go,useState as fo}from"react";function ho(e,t){return"function"==typeof e?e(t):t[e]}import{useCallback as po,useMemo as bo}from"react";var yo=.22;function vo(e,t,o){return!t?.isActive||t.predicate(function(e,t){return"scene"===t?e:e.data}(e,o))}var ko=e=>{const{bands:t=[],ribbons:o=[],showLabels:n=!0,selectionDatum:i="raw"}=e.config,a=e.selection??null,s=[];for(const e of o){const t={__kind:"ribbon",data:e.rawDatum,id:e.id},o=!vo(t,a,i);s.push({type:"bezier",pathD:e.pathD,...e.bezier&&{bezierCache:e.bezier},style:{fill:e.fill,opacity:o?Math.min(e.opacity,yo):e.opacity,stroke:"none"},datum:t})}for(const e of t){if(!e.gradientStubs)continue;const t=!vo({__kind:"band",data:e.rawDatum,id:e.id},a,i);for(let o=0;e.gradientStubs.length>o;o++){const n=e.gradientStubs[o];s.push({type:"bezier",pathD:n.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:t?yo:e.fillOpacity??.86,stroke:"none"},_gradient:{x0:n.x0,x1:n.x1,...null!=n.y0&&{y0:n.y0},...null!=n.y1&&{y1:n.y1},from:n.from,to:n.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${o}`}})}}for(const e of t){const t=!(!e.gradientStubs||0>=e.gradientStubs.length),o={__kind:"band",data:e.rawDatum,id:e.id},n=!vo(o,a,i);s.push({type:"bezier",pathD:e.pathD,style:{...t?{fill:"none"}:{fill:e.hatchFill??e.fill,fillOpacity:n?yo:e.fillOpacity??.86},stroke:e.stroke??("string"==typeof e.fill?e.fill:"#666"),strokeWidth:e.strokeWidth??.5,...n&&t?{opacity:yo}:{}},datum:o})}const r=n?t.flatMap(e=>{const t=e.labelDeferred&&e.labelFullText?.trim(),o=e.labelText.trim().length>0,n=t&&a?.isActive&&vo({__kind:"band",data:e.rawDatum,id:e.id},a,i),s=o?e.labelText:n?e.labelFullText:"";return s.trim()?[{x:e.labelX,y:e.labelY,text:s,anchor:e.labelAnchor??"end",baseline:e.labelBaseline??"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:s,labels:r}};function wo(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}import{Fragment as xo,jsx as Mo,jsxs as So}from"react/jsx-runtime";import{jsx as To,jsxs as Co}from"react/jsx-runtime";var Ao=Tt(function(e,t){const{nodes:n,edges:i,domain:a,axisTicks:s=[],nodeIdAccessor:l="id",nodeLabel:c,sourceAccessor:d="source",targetAccessor:u="target",valueAccessor:m="value",startTimeAccessor:f="startTime",endTimeAccessor:h="endTime",systemInTimeAccessor:p,systemOutTimeAccessor:b,xExtentAccessor:y="xExtent",groupBy:v,edgeIdAccessor:k="id",colorBy:w,colorScheme:x,showLegend:T,legendPosition:A="right",orientation:I="horizontal",pairing:O="temporal",packing:P="reuse",laneOrder:N="crossing-min",maxValueScale:H,lanePlacement:B="stack",nodeSizing:L="temporal",groupPadding:D=0,ribbonLane:E="both",ribbonMinRun:F=0,lifetimeMode:R="half",showLaneRails:z=!1,showQualityReadout:W=!1,showLabels:$=!0,labelPriorityAccessor:_,maxLabels:X,selectionDatum:q="raw",styleRules:Y,layoutExecution:G="auto",layoutWorkerThreshold:V,layoutLoadingContent:U,onLayoutStateChange:Q,width:J=600,height:Z=400,margin:ee,title:oe,description:ne,summary:ie,accessibleTable:ae,responsiveWidth:se,responsiveHeight:re,loading:le,loadingContent:ce,emptyContent:de,edgeOpacity:ue=.35,timeFormat:me,valueFormat:ge,tooltip:fe,enableHover:he=!0,onObservation:pe,onClick:be,selection:ye,linkedHover:ke,showParticles:xe=!1,particleStyle:Me,chartId:Se,frameProps:Te={}}=e,Ce=At(null),Ae=At(null),{rawNodes:Ie,rawEdges:Oe,frameRef:Pe,getNodeId:Ne,getEdgeId:He}=function(e){const{ref:t,rawNodesProp:n,rawEdgesProp:i,nodeIdAccessor:a,edgeIdAccessor:s,sourceAccessor:r,targetAccessor:l,scalesRef:c,layoutSnapshotRef:d}=e,[u,m]=fo([]),[g,f]=fo([]),h=go(u),p=go(g);h.current=u,p.current=g;const b=uo(e=>{h.current=e,m(e)},[]),y=uo(e=>{p.current=e,f(e)},[]),v=void 0!==i,k=M(v?i:u),w=mo(()=>{const e=M(n??[]),t=g;if(0===e.length&&0===t.length)return K([],k,r,l);const o=new Set,i=[];for(const t of e){const e=ho(a,t)+"";o.has(e)||(o.add(e),i.push(t))}for(const e of t){const t=ho(a,e)+"";o.has(t)||(o.add(t),i.push(e))}const s=K([],k,r,l);for(const e of s)o.has(e.id)||(o.add(e.id),i.push(e));return i},[n,g,k,a,r,l]),x=go(null),S=uo((e,t)=>{const o=ho(s,e);return null!=o?o+"":`${ho(r,e)}-${ho(l,e)}-${t}`},[s,r,l]),T=uo(e=>{if(null==e)return!1;const t=e;return null!=ho(r,t)&&null!=ho(l,t)},[r,l]),C=uo(e=>ho(a,e)+"",[a]);return o(t,{variant:"network",frameRef:x,overrides:{push(e){if(T(e)){if(v)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");b([...h.current,e])}else y([...p.current,e])},pushMany(e){const t=[],o=[];for(const n of e)T(n)?t.push(n):o.push(n);t.length>0&&(v?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):b([...h.current,...t])),o.length>0&&y([...p.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!v){const e=h.current,n=[];for(let i=0;e.length>i;i++){const a=e[i];t.has(S(a,i))?o.push(a):n.push(a)}n.length!==e.length&&b(n)}const n=p.current,i=[];for(const e of n){const n=ho(a,e)+"";t.has(n)?o.push(e):i.push(e)}return i.length!==n.length&&y(i),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),n=[];if(!v){let e=!1;const i=h.current.map((i,a)=>o.has(S(i,a))?(n.push(i),e=!0,t(i)):i);e&&b(i)}let i=!1;const s=p.current.map(e=>{const s=ho(a,e)+"";return o.has(s)?(n.push(e),i=!0,t(e)):e});return i&&y(s),n},clear(){v||b([]),y([]),x.current?.clear()},getData:()=>k??[],getScales:()=>c.current,getCustomLayout:()=>d.current}}),{rawNodes:w,rawEdges:k,frameRef:x,getNodeId:C,getEdgeId:S,isControlled:v}}({ref:t,rawNodesProp:n,rawEdgesProp:i,nodeIdAccessor:l,edgeIdAccessor:k,sourceAccessor:d,targetAccessor:u,scalesRef:Ce,layoutSnapshotRef:Ae}),{nodes:Be,edges:Le,domain:De,rawNodeById:Ee,rawEdgeById:Fe}=Ct(()=>{const e=(Ie??[]).map(e=>{const t=Ne(e),o=c?ho(c,e):t,n={id:t,label:null==o?t:o+"",__raw:e},i=v?ho(v,e):null;null!=i&&i+""!=""&&(n.group=i+"");const a=y?ho(y,e):null;if(Array.isArray(a)&&2===a.length){const e=we(a[0]),t=we(a[1]);Number.isFinite(e)&&Number.isFinite(t)&&(n.xExtent=[e,t])}return n}),t=(Oe??[]).map((e,t)=>{const o={id:He(e,t),source:ho(d,e)+"",target:ho(u,e)+"",value:Number(ho(m,e)),startTime:we(ho(f,e)),endTime:we(ho(h,e)),__raw:e};if(p){const t=we(ho(p,e));Number.isFinite(t)&&(o.systemInTime=t)}if(b){const t=we(ho(b,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[we(a[0]),we(a[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}},[Ie,Oe,a,Ne,He,c,y,v,d,u,m,f,h,p,b]),Re=te({nodes:Ie,edges:Oe,inferNodes:!1,nodeIdAccessor:l,sourceAccessor:d,targetAccessor:u,colorBy:w,colorScheme:x,showLegend:!1,legendPosition:A,selection:ye,linkedHover:ke,onObservation:pe,onClick:be?(e,t)=>{wo(e)?be(e.data,t):be(e,t)}:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"ProcessSankey",chartId:Se,marginDefaults:Pt(!!oe,W,s.length>0,I),userMargin:ee,width:J,height:Z,hasTitle:!!oe,loading:le,loadingContent:ce,emptyContent:de}),ze=(T??!!w)&&!!w,We=It(e=>null!=ee&&("number"==typeof ee||null!=ee[e]),[ee]),je=Ct(()=>{const e={...Re.margin};return ze&&("right"===A&&!We("right")&&140>e.right?e.right=140:"bottom"===A&&!We("bottom")&&80>e.bottom&&(e.bottom=80)),e},[Re.margin,ze,A,We]),$e=J-je.left-je.right,_e=Z-je.top-je.bottom,Xe="vertical"===I?_e:$e,qe=It((e,t)=>{if(w&&Ie){const t=Ee.get(e);if(t)return S(t,w,Re.colorScale)}return Re.effectivePalette[t%Re.effectivePalette.length]||"#475569"},[w,Ie,Ee,Re.colorScale,Re.effectivePalette]),Ye=co(Ct(()=>$e>0&&_e>0?{nodes:Be,edges:Le,domain:De,plotW:$e,plotH:_e,orientation:I,ribbonLane:E,ribbonMinRun:F,edgeOpacity:"function"==typeof ue?e=>ue(e):ue,colorOf:qe,showLabels:$,labelPriorityAccessor:_,maxLabels:X,selectionDatum:q,styleRules:Y,usageMode:"push",colorBy:w,valueAccessor:m,layoutOpts:{pairing:O,packing:P,laneOrder:N,lifetimeMode:R,maxValueScale:H,lanePlacement:B,nodeSizing:L,groupPadding:D}}:null,[Be,Le,De,$e,_e,I,E,F,ue,qe,$,_,X,q,Y,w,m,O,P,N,R,H,B,L,D]),{execution:G,workerThreshold:V,colorById:Ct(()=>{const e={};return Be.forEach((t,o)=>{e[t.id]=qe(t.id,o)}),e},[Be,qe]),fallbackPalette:Re.effectivePalette,rawNodeById:Ee,rawEdgeById:Fe}),{issues:Ge,warnings:Ve,layout:Ue,xScale:Qe}=Ye,Je=Ye.layoutConfig,Ke=Ye.status;Ce.current=Ue?{time:Qe,centerlines:Ue.centerlines}:{time:Qe},Ae.current=Ue?{layout:Ue,nodes:Be,edges:Le,bands:Je.bands,ribbons:Je.ribbons,warnings:Ve,status:Ke}:null;const Ze=At(Q);Ze.current=Q,Ot(()=>{Ze.current?.(Ke)},[Ke]),Ot(()=>{0!==Ve.length&&console.warn("ProcessSankey warnings:",Ve.map(ve).join("; "))},[Ve]);const et=Ct(()=>{if(!ze||!w)return;const e=new Map;(Ie??[]).forEach((t,o)=>{const n=ho(w,t),i=null==n?"":n+"";i&&!e.has(i)&&e.set(i,{label:i,color:qe(Ne(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},[ze,w,Ie,qe,Ne]),tt=function(e){const{tooltip:t,enableHover:o,layout:n,timeFormat:i,valueFormat:a,sourceAccessor:s,targetAccessor:r,valueAccessor:l,startTimeAccessor:c,endTimeAccessor:d}=e,u=bo(()=>!1!==t&&o?void 0===t||!0===t?null:C(t)||null:null,[t,o]),m=po(e=>i?i(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[i]),g=po(e=>a?a(e):e+"",[a]);return po(e=>{if(!e||!e.data)return null;const t=e.data;if(!wo(t))return null;const o=t.data;if(u)return u(o);if("band"===t.__kind){const e=t.id,o=n?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}(n.nodeData[e]):[],i=5,a=o.length>i?o.length:null,s=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"}],a=new Set,s=[];for(const e of i)a.has(e.t)||(a.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(o,i);return So("div",{style:{minWidth:160},children:[Mo("div",{style:{fontWeight:600,marginBottom:4},children:e}),s.length>0&&So("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[Mo("thead",{children:So("tr",{style:{opacity:.6},children:[Mo("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),Mo("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=a&&Mo("th",{})]})}),Mo("tbody",{children:s.map((e,t)=>So("tr",{children:[Mo("td",{style:{paddingRight:8},children:m(e.t)}),Mo("td",{style:{textAlign:"right"},children:g(e.total)}),null!=a&&Mo("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=a&&So("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",s.length," of ",a," samples"]})]})}const i=o,a=ho(s,i),f=ho(r,i),h=ho(l,i),p=ho(c,i),b=ho(d,i);return So("div",{style:{minWidth:160},children:[So("div",{style:{fontWeight:600,marginBottom:4},children:[a+""," → ",f+""]}),So("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=h&&So(xo,{children:[Mo("span",{style:{opacity:.6},children:"value"}),Mo("span",{style:{textAlign:"right"},children:g(Number(h))})]}),null!=p&&So(xo,{children:[Mo("span",{style:{opacity:.6},children:"start"}),Mo("span",{style:{textAlign:"right"},children:m(we(p))})]}),null!=b&&So(xo,{children:[Mo("span",{style:{opacity:.6},children:"end"}),Mo("span",{style:{textAlign:"right"},children:m(we(b))})]})]})]})},[n,u,m,g,s,r,l,c,d])}({tooltip:fe,enableHover:he,layout:Ue,timeFormat:me,valueFormat:ge,sourceAccessor:d,targetAccessor:u,valueAccessor:m,startTimeAccessor:f,endTimeAccessor:h}),ot=Ct(()=>{if(!Ue)return null;const e=Ve.map(e=>ve(e));return function(e){const t=e.layout,o=e.nodes,n=e.orientation,i=e.plotW,a=e.plotH,s=e.timelineExtent,r=e.axisTicks,l=e.showQualityReadout??!1,c=e.showLaneRails??!1,d=(e.warnings??[]).slice(0,3),u=e.timeFormat,m=e.colorOf,g=e.toTime,f=e.xScale,{centerlines:h,laneLifetime:p,nodeData:b,valueScale:y,compressedPadding:v,crossingsBefore:k,crossingsAfter:w,layoutQualityBefore:x,layoutQuality:M}=t;let S=null,T=null;for(const e of o){const t=p[e.id];if(!t||null===t.start||null===t.end)continue;const o=f(t.start),n=f(t.end);(null===S||S>o)&&(S=o),(null===T||n>T)&&(T=n)}const C=e=>Math.max(0,Math.min(s,e)),A=C(S??0),I=Math.max(A,C(T??s)),O=r.map((e,t)=>({tick:e,index:t,coordinate:f(g(e.date))})).filter(({coordinate:e})=>e>=A-.5&&I+.5>=e),P=null!==(w??null)&&null!=x&&null!=M,N=l&&(P||d.length>0)?Bt("g",{fill:Et,fontSize:10,textAnchor:"end",children:[P&&Bt(Nt,{children:[Bt("text",{x:i,y:-14,children:["crossings: ",k," → ",w," ","pixel length: ",Math.round(x.pixelLength)," → ",Math.round(M.pixelLength)]}),Bt("text",{x:i,y:-3,children:["transit: ",x.transitOcclusion.toFixed(1)," → ",M.transitOcclusion.toFixed(1)," ","lane use: ",Math.round(100*M.verticalUtilization),"%"]})]}),d.map((e,t)=>Bt("text",{x:i,y:P?10+11*t:11*t-3,fill:"var(--semiotic-warning, #b45309)",children:["warn: ",e]},"warn-"+t))]}):null,H=v?Ht("text",{x:i,y:"vertical"===n?-3:2,fontSize:10,fill:Et,textAnchor:"end",children:"dense layout: lane gaps compressed"}):null,B=(e,t)=>m?m(e,t):Lt;return Bt("g","vertical"===n?{children:[N,H,O.map(({index:e,coordinate:t})=>Ht("line",{x1:0,y1:t,x2:i,y2:t,stroke:Lt,strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+e)),c&&o.map((e,t)=>{const o=p[e.id];if(!o||null===o.start)return null;const n=b[e.id],i=n?{topPeak:n.topPeak,botPeak:n.botPeak}:{topPeak:0,botPeak:0},a=h[e.id]+(i.botPeak-i.topPeak)*y/2,s=f(o.start),r=f(o.end),l=B(e.id,t);return Bt("g",{children:[Ht("line",{x1:a,y1:s,x2:a,y2:r,stroke:l,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),Ht("line",{x1:a-4,y1:s,x2:a+4,y2:s,stroke:l,strokeOpacity:.5}),Ht("line",{x1:a-4,y1:r,x2:a+4,y2:r,stroke:l,strokeOpacity:.5})]},"lane-"+e.id)}),Ht("line",{x1:-4,y1:A,x2:-4,y2:I,stroke:Lt}),O.map(({tick:e,index:t,coordinate:o})=>{const n=g(e.date),i=null!=e.label?e.label:u?u(new Date(n)):"";return Bt("g",{transform:`translate(-4,${o})`,children:[Ht("line",{x2:-6,stroke:Lt}),Ht("text",{x:-10,y:4,textAnchor:"end",fontSize:11,fill:Dt,children:i})]},t)})]}:{children:[N,H,O.map(({index:e,coordinate:t})=>Ht("line",{x1:t,y1:0,x2:t,y2:a,stroke:Lt,strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+e)),c&&o.map((e,t)=>{const o=p[e.id];if(!o||null===o.start)return null;const n=b[e.id],i=n?{topPeak:n.topPeak,botPeak:n.botPeak}:{topPeak:0,botPeak:0},a=h[e.id]+(i.botPeak-i.topPeak)*y/2,s=f(o.start),r=f(o.end),l=B(e.id,t);return Bt("g",{children:[Ht("line",{x1:s,y1:a,x2:r,y2:a,stroke:l,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),Ht("line",{x1:s,y1:a-4,x2:s,y2:a+4,stroke:l,strokeOpacity:.5}),Ht("line",{x1:r,y1:a-4,x2:r,y2:a+4,stroke:l,strokeOpacity:.5})]},"lane-"+e.id)}),Ht("line",{x1:A,y1:a+4,x2:I,y2:a+4,stroke:Lt}),O.map(({tick:e,index:t,coordinate:o})=>{const n=g(e.date),i=null!=e.label?e.label:u?u(new Date(n)):"";return Bt("g",{transform:`translate(${o},${a+4})`,children:[Ht("line",{y2:6,stroke:Lt}),Ht("text",{y:20,textAnchor:"middle",fontSize:11,fill:Dt,children:i})]},t)})]})}({layout:Ue,nodes:Be,orientation:I,plotW:$e,plotH:_e,timelineExtent:Xe,axisTicks:s,showQualityReadout:W,showLaneRails:z,warnings:e,timeFormat:me?e=>me(e):void 0,colorOf:qe,toTime:we,xScale:e=>Number(Qe(e))})},[Ue,Be,I,$e,_e,Xe,s,W,z,Ve,me,qe,Qe]),nt=Ct(()=>(Ie??[]).map(e=>({id:Ne(e),data:e})),[Ie,Ne]),it=Ct(()=>{const e=new Map;for(const t of Je.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Je]),at=Ct(()=>(Oe??[]).map((e,t)=>{const o=He(e,t),n=Number(ho(m,e));return{id:o,source:ho(d,e)+"",target:ho(u,e)+"",value:Number.isFinite(n)?n:0,bezier:it.get(o),data:e}}),[Oe,He,d,u,m,it]);return Ge.length>0?Co("svg",{width:J,height:Z,role:"img","aria-label":oe??"Process Sankey validation failed",children:[To("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ge.map((e,t)=>To("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+ve(e)},t))]}):Re.loadingEl?Re.loadingEl:Re.emptyEl?Re.emptyEl:Co("div",{style:{position:"relative",width:J,height:Z},children:["pending"===Ke&&!1!==U&&!Ue&&To("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:j(!0,J,Z,U)}),To(r,{ref:Pe,chartType:"force",nodes:nt,edges:at,customNetworkLayout:ko,layoutConfig:Je,size:[J,Z],responsiveWidth:se,responsiveHeight:re,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:je,title:oe,description:ne??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:ie,accessibleTable:ae,enableHover:he,tooltipContent:!1===fe?()=>null:tt,backgroundGraphics:ot,showParticles:xe,particleStyle:Me,legend:et,legendPosition:A,...g({linkedHover:ke,selection:ye,onObservation:pe,onClick:be,mobileInteraction:Re.mobileInteraction,customHoverBehavior:Re.customHoverBehavior,customClickBehavior:Re.customClickBehavior,linkedHoverInClickPredicate:!1}),chartId:Se,colorScheme:Array.isArray(x)?x:void 0,layoutSelection:Re.activeSelectionHook,...Te})]})});Ao.displayName="ProcessSankey";import{useMemo as Io}from"react";import{jsx as Oo}from"react/jsx-runtime";function Po(t){const o=H(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:s,layout:l="tree",orientation:c="vertical",childrenAccessor:d="children",valueAccessor:u="value",nodeIdAccessor:m="name",colorBy:f,colorScheme:h,colorByDepth:p=!1,edgeStyle:b="curve",nodeLabel:y,nodeSize:v=5,tooltip:k,frameProps:x={},onObservation:M,onClick:T,chartId:A,selection:I,linkedHover:P,loading:N,loadingContent:B,legendInteraction:L,stroke:D,strokeWidth:E,opacity:F}=t,{width:W,height:j,enableHover:$,showLabels:_=!0,title:X,description:q,summary:Y,accessibleTable:G}=o,V=te({nodes:Io(()=>J(n??null,d),[n,d]),edges:void 0,inferNodes:!1,colorBy:p?void 0:f,colorScheme:h,showLegend:!1,legendInteraction:L,selection:I,linkedHover:P,onObservation:M,onClick:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"TreeDiagram",chartId:A,marginDefaults:o.marginDefaults,userMargin:i,width:W,height:j,hasTitle:!!X,loading:N,loadingContent:B}),U=Io(()=>new Map,[]),Q=Io(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?w[(e.depth||0)%w.length]:f?S(e.data||e,f,V.colorScale):O(void 0,V.themeCategorical,h,void 0,U),t},[f,p,V.colorScale,V.themeCategorical,h,U]),K=Io(()=>e(Q,{stroke:D,strokeWidth:E,opacity:F}),[Q,D,E,F]),ee=Io(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),oe=Io(()=>e(ee,{stroke:D,strokeWidth:E,opacity:F}),[ee,D,E,F]),ne=Io(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return Z(u)},[l,u]),ie=a({componentName:"TreeDiagram",data:n});return ie?Oo(R,{componentName:"TreeDiagram",message:ie,width:W,height:j}):V.loadingEl?V.loadingEl:Oo(z,{componentName:"TreeDiagram",width:W,height:j,children:Oo(r,{chartType:l,...null!=n&&{data:n},size:[W,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:V.margin,nodeIDAccessor:m,childrenAccessor:d,hierarchySum:ne,treeOrientation:c,edgeType:b,nodeStyle:K,edgeStyle:oe,colorBy:f,colorScheme:V.effectivePalette,colorByDepth:p,nodeSize:v,nodeLabel:_?y||m:void 0,showLabels:_,enableHover:$,tooltipContent:!1===k?()=>null:C(k)||void 0,...g({linkedHover:P,selection:I,onObservation:M,onClick:T,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),...L&&"none"!==L&&{legendHoverBehavior:V.legendState.onLegendHover,legendClickBehavior:V.legendState.onLegendClick,legendHighlightedCategory:V.legendState.highlightedCategory,legendIsolatedCategories:V.legendState.isolatedCategories},className:s,title:X,description:q,summary:Y,accessibleTable:G,...null!=t.animate&&{animate:t.animate},...x})})}Po.displayName="TreeDiagram";import{useMemo as No,useCallback as Ho}from"react";import{jsx as Bo}from"react/jsx-runtime";function Lo(t){const o=H(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:s,className:l,childrenAccessor:c="children",valueAccessor:d="value",nodeIdAccessor:u="name",colorBy:m,colorScheme:f,colorByDepth:h=!1,labelMode:p="leaf",nodeLabel:b,padding:y=4,paddingTop:v,nodeStyle:x,tooltip:M,frameProps:T={},selection:A,linkedHover:I,onObservation:P,onClick:N,chartId:B,loading:L,loadingContent:D,legendInteraction:E,stroke:F,strokeWidth:W,opacity:j}=t,{nodeStyle:$,..._}=T,{width:X,height:q,enableHover:Y,showLabels:G=!0,title:V,description:U,summary:Q,accessibleTable:K}=o,ee=te({nodes:No(()=>J(i??null,c),[i,c]),edges:void 0,inferNodes:!1,colorBy:h?void 0:m,colorScheme:f,showLegend:!1,legendInteraction:E,selection:A,linkedHover:I,onObservation:P,onClick:N,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Treemap",chartId:B,marginDefaults:o.marginDefaults,userMargin:s,width:X,height:q,hasTitle:!!V,loading:L,loadingContent:D}),oe=n(A),ne=ee.customHoverBehavior,ie=Ho(e=>{if(!e)return ne(null);const t=e.data||e;ne({data:t?.data||t})},[ne]),ae=No(()=>new Map,[]),se=No(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=h?w[(e.depth||0)%w.length]:m?S(e.data||e,m,ee.colorScale):O(void 0,ee.themeCategorical,f,void 0,ae),t},[m,h,ee.colorScale,ee.themeCategorical,f,ae]),re=No(()=>x||$?e=>({...se(e),...$?$(e)??{}:{},...x?x(e)??{}:{}}):se,[se,x,$]),le=No(()=>e(re,{stroke:F,strokeWidth:W,opacity:j}),[re,F,W,j]),ce=No(()=>ee.activeSelectionHook?e=>{const t={...le(e)};if(ee.activeSelectionHook.isActive)if(ee.activeSelectionHook.predicate(e.data||e))oe?.selectedStyle&&Object.assign(t,oe.selectedStyle);else{const e=oe?.unselectedOpacity??k;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,oe?.unselectedStyle&&Object.assign(t,oe.unselectedStyle)}return t}:le,[le,ee.activeSelectionHook,oe]),de=No(()=>Z(d),[d]),ue=void 0!==v?v:!G||"parent"!==p&&"all"!==p?void 0:18,me=a({componentName:"Treemap",data:i});return me?Bo(R,{componentName:"Treemap",message:me,width:X,height:q}):ee.loadingEl?ee.loadingEl:Bo(z,{componentName:"Treemap",width:X,height:q,children:Bo(r,{chartType:"treemap",...null!=i&&{data:i},size:[X,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:ee.margin,nodeIDAccessor:u,childrenAccessor:c,hierarchySum:de,padding:y,paddingTop:ue,nodeStyle:ce,colorBy:m,colorScheme:ee.effectivePalette,colorByDepth:h,nodeLabel:G?b||u:void 0,showLabels:G,labelMode:p,enableHover:Y,tooltipContent:!1===M?()=>null:C(M)||void 0,...g({linkedHover:I,selection:A,onObservation:P,onClick:N,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ie,customClickBehavior:ee.customClickBehavior,linkedHoverInClickPredicate:!1}),...E&&"none"!==E&&{legendHoverBehavior:ee.legendState.onLegendHover,legendClickBehavior:ee.legendState.onLegendClick,legendHighlightedCategory:ee.legendState.highlightedCategory,legendIsolatedCategories:ee.legendState.isolatedCategories},className:l,title:V,description:U,summary:Q,accessibleTable:K,...null!=t.animate&&{animate:t.animate},..._})})}Lo.displayName="Treemap";import{useMemo as Do}from"react";import{jsx as Eo}from"react/jsx-runtime";function Fo(t){const o=H(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:s,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:d="name",colorBy:u,colorScheme:m,colorByDepth:f=!1,nodeLabel:h,circleOpacity:p=.7,padding:b=4,tooltip:y,frameProps:v={},onObservation:k,onClick:x,chartId:M,selection:T,linkedHover:A,loading:I,loadingContent:P,legendInteraction:N,stroke:B,strokeWidth:L,opacity:D}=t,{width:E,height:F,enableHover:W,showLabels:j=!0,title:$,description:_,summary:X,accessibleTable:q}=o,Y=te({nodes:Do(()=>J(n??null,l),[n,l]),edges:void 0,inferNodes:!1,colorBy:f?void 0:u,colorScheme:m,showLegend:!1,legendInteraction:N,selection:T,linkedHover:A,onObservation:k,onClick:x,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"CirclePack",chartId:M,marginDefaults:o.marginDefaults,userMargin:i,width:E,height:F,hasTitle:!!$,loading:I,loadingContent:P}),G=Do(()=>new Map,[]),V=Do(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=f?w[(e.depth||0)%w.length]:u?S(e.data||e,u,Y.colorScale):O(void 0,Y.themeCategorical,m,void 0,G),t},[u,f,Y.colorScale,p,Y.themeCategorical,m,G]),U=Do(()=>e(V,{stroke:B,strokeWidth:L,opacity:D}),[V,B,L,D]),Q=Do(()=>Z(c),[c]),K=a({componentName:"CirclePack",data:n});return K?Eo(R,{componentName:"CirclePack",message:K,width:E,height:F}):Y.loadingEl?Y.loadingEl:Eo(z,{componentName:"CirclePack",width:E,height:F,children:Eo(r,{chartType:"circlepack",...null!=n&&{data:n},size:[E,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:Y.margin,nodeIDAccessor:d,childrenAccessor:l,hierarchySum:Q,padding:b,nodeStyle:U,colorBy:u,colorScheme:Y.effectivePalette,colorByDepth:f,nodeLabel:j?h||d:void 0,showLabels:j,enableHover:W,tooltipContent:!1===y?()=>null:C(y)||void 0,...g({linkedHover:A,selection:T,onObservation:k,onClick:x,mobileInteraction:Y.mobileInteraction,customHoverBehavior:Y.customHoverBehavior,customClickBehavior:Y.customClickBehavior,linkedHoverInClickPredicate:!1}),...N&&"none"!==N&&{legendHoverBehavior:Y.legendState.onLegendHover,legendClickBehavior:Y.legendState.onLegendClick,legendHighlightedCategory:Y.legendState.highlightedCategory,legendIsolatedCategories:Y.legendState.isolatedCategories},className:s,title:$,description:_,summary:X,accessibleTable:q,...null!=t.animate&&{animate:t.animate},...v})})}Fo.displayName="CirclePack";import{useMemo as Ro}from"react";import{jsx as zo}from"react/jsx-runtime";var Wo=w;function jo(t){const o=H(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:s,childrenAccessor:l="children",nodeIdAccessor:c="name",colorBy:d,colorScheme:u,colorByDepth:m=!1,orbitMode:f="flat",orbitSize:h=2.95,speed:p=.25,revolution:b,revolutionStyle:k,eccentricity:w=1,showRings:x=!0,nodeRadius:M=6,showLabels:T=!1,animated:I=!0,tooltip:P,foregroundGraphics:N,annotations:B,frameProps:L={},onObservation:D,onClick:E,chartId:F,selection:W,linkedHover:j,loading:$,loadingContent:_,stroke:X,strokeWidth:q,opacity:Y}=t,{width:G,height:V,enableHover:U,title:Q,description:K,summary:Z,accessibleTable:ee}=o,oe=te({nodes:Ro(()=>J(n,l),[n,l]),edges:void 0,inferNodes:!1,colorBy:m?void 0:d,colorScheme:u,showLegend:!1,legendInteraction:void 0,selection:W,linkedHover:j,onObservation:D,onClick:E,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"OrbitDiagram",chartId:F,marginDefaults:A(o),userMargin:i,width:G,height:V,hasTitle:!!Q,loading:$,loadingContent:_}),ne=Ro(()=>new Map,[]),{colorScale:ie,customClickBehavior:ae,customHoverBehavior:se,themeCategorical:re}=oe,le=Ro(()=>{if(Array.isArray(u))return u;const e=y[u];return Array.isArray(e)?e:v},[u]),ce=Ro(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=m?o?le[0]:Wo[(e.depth||0)%Wo.length]:d?S(e.data||e,d,ie):O(void 0,re,u,void 0,ne),t.opacity=o?1:.85,t},[d,m,ie,le,re,u,ne]),de=Ro(()=>e(ce,{stroke:X,strokeWidth:q,opacity:Y}),[ce,X,q,Y]),ue=Ro(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),me=Ro(()=>e=>{se(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[se]),ge=Ro(()=>e=>{ae(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[ae]),fe=a({componentName:"OrbitDiagram",data:n});return fe?zo(R,{componentName:"OrbitDiagram",message:fe,width:G,height:V}):oe.loadingEl?oe.loadingEl:zo(z,{componentName:"OrbitDiagram",width:G,height:V,children:zo(r,{chartType:"orbit",...null!=n&&{data:n},size:[G,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:oe.margin,nodeIDAccessor:c,childrenAccessor:l,nodeStyle:de,edgeStyle:ue,colorBy:d,colorScheme:oe.effectivePalette,colorByDepth:m,nodeSize:M,nodeLabel:T?c:void 0,showLabels:T,enableHover:!I&&U,tooltipContent:I?void 0:!1===P?()=>null:C(P)||void 0,...g({linkedHover:j,selection:W,onObservation:D,onClick:E,mobileInteraction:oe.mobileInteraction,customHoverBehavior:me,customClickBehavior:ge,linkedHoverInClickPredicate:!1}),foregroundGraphics:N,annotations:B,className:s,title:Q,description:K,summary:Z,orbitMode:f,orbitSize:h,orbitSpeed:p,orbitRevolution:b,orbitRevolutionStyle:k,orbitEccentricity:w,orbitShowRings:x,orbitAnimated:I,accessibleTable:ee,...null!=t.animate&&{animate:t.animate},...L})})}jo.displayName="OrbitDiagram";export{Y as NetworkCustomChart,ne as ForceDirectedGraph,le as ChordDiagram,ge as SankeyDiagram,ye as validateProcessSankey,ve as formatProcessSankeyIssue,ke as inventoryAtTime,we as toProcessSankeyTime,Ao as ProcessSankey,Po as TreeDiagram,Lo as Treemap,Fo as CirclePack,jo as OrbitDiagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{filterAnnotationsByStatus as e}from"./chunk-chunk-5VVNW5AZ.module.min.js";import{resolveAccessor as t,resolveRawAccessor as n}from"./chunk-chunk-NWIGA3UK.module.min.js";var r=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),o=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),a=new Set(["PieChart","DonutChart","FunnelChart"]),i=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function s(e,t){return o.has(e)||a.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function l(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const n=e[t];if("string"==typeof n&&n)return n}}function c(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function u(e,t=new Set){if(null===e)return!0;const n=typeof e;if("string"===n||"boolean"===n)return!0;if("number"===n)return Number.isFinite(e);if("object"!==n)return!1;if(t.has(e))return!1;t.add(e);const r=Array.isArray(e)?e.every(e=>u(e,t)):Object.entries(e).every(([,e])=>u(e,t));return t.delete(e),r}var h=Symbol.for("semiotic.chartRecipeRegistry");function d(e){return function(){const e=globalThis;return e[h]||(e[h]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[h]}().recipes.get(e)}function p(e){return"string"==typeof e?d(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function f(e){return"string"==typeof e?e:e.id??e.name}function m(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function g(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function y(e,t,n){return n??p(t.recipe)??p(t.recipeId)??d(e)}function $(e,t,n=[]){const r=e.accessor?t[e.accessor]:void 0;if("string"==typeof r&&r)return r;if(e.field)return e.field;const o=n.find(e=>e&&"object"==typeof e);if(!o)return;const a=Object.entries(o).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?a.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in o):a.find(([,e])=>"string"==typeof e)?.[0]}function b(e,t){return e.dataRoles.find(e=>e.role===t)}function v(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function C(e,t,n,r,o,a={}){const i={...a};if(t)for(const[e,n]of Object.entries(t))i[e]=n;for(const e of n.dataRoles){const n=$(e,r,o),a=t&&n?t[n]:n;void 0!==a&&(i[e.role]=a)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const n=i[t];return null==n?`{${t}}`:n+""})}var w={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",UnitPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PacketFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",CrucibleChart:"crucible physics chart",PhysicsCustomChart:"custom physics chart"},S=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),x=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]);function k(e){return w[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function A(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var P=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),j={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},F={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},L=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],D={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function B(e){return j[e]}function N(e,t){const n=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,n={};for(const[e,r]of Object.entries(t.intentScores))"number"==typeof r&&Number.isFinite(r)&&(n[e]=r);return{family:t.family,intentScores:Object.keys(n).length?n:void 0}}return e}}(t);if(n?.act)return n.act;if(n?.intentScores){const e=function(e){let t,n=0;for(const[r,o]of Object.entries(e))if("number"==typeof o&&o>0)if(o>n)t=r,n=o;else if(o===n&&void 0!==t){const e=L.indexOf(r),n=L.indexOf(t);-1===e||-1!==n&&e>=n||(t=r)}return t}(n.intentScores);if(e&&j[e]&&(n.intentScores[e]??0)>=3)return j[e]}return n?.family?F[n.family]:function(e){return a.has(e)||"StackedAreaChart"===e?"apportioning":P.has(e)?"relating":o.has(e)?"comparing":i.has(e)?"characterizing":r.has(e)?"tracking":S.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}var I=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),M=new Set(["system","agent","watcher"]),T=new Set(["ai","agent","system","computed","dbt","great-expectations"]),O=new Set(["rule","statistical-test","llm-inference","computed"]);function R(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!I.has(t.type))return!1;const n=t.provenance;return!(!n||"object"!=typeof n)&&(M.has(n.authorKind)||T.has(n.source)||O.has(n.basis))})}function G(e="en"){let t,n;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),n=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),n=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?n.format(e):t.format(e):e+""}var E={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function U(e){const t=E["string"==typeof e.type?e.type:"annotation"]||"an annotation",n=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,n=t?.authorKind??t?.source??t?.basis;return"watcher"===n?"a watcher-flagged ":"agent"===n||"ai"===n||"llm-inference"===n?"an AI-suggested ":""}(e),r=n?n+t.replace(/^an? /,""):t,o="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return o?`${r} labeled "${o}"`:r}function q(t){const n=Array.isArray(t.annotations)?t.annotations:null;if(!n||0===n.length)return;const r=e(n.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return;const o=r.map(U),a=o.slice(0,5),i=o.length-a.length,s=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(a)+(i>0?`, and ${i} more`:""),l=r.length;return`The author has marked ${1===l?"one feature":l+" features"} on this chart: ${s}.`}function z(e,u,h={}){const d=void 0!==h.levels,p=new Set(h.levels??["l1","l2","l3"]);d||!h.capability&&!R(u)||p.add("l4");const b=y(e,u,h.recipe);if(b){const e=["l1","l2","l3","l4"].filter(e=>p.has(e));d||e.includes("l4")||e.push("l4");const t=function(e,t,n={}){const r=g(t),o=m(t),a=n.locale??"en",i="function"==typeof e.description?e.description({data:r,config:o,locale:a}):void 0,s=i?.levels??function(e,t,n,r){const o=v(e,["nominal","ordinal"]),a=v(e,["quantitative"]),i=o?$(o,n,t):void 0,s=a?$(a,n,t):void 0,l=o?.role??i??"category",c=a?.role??s??"value",u=e.encodings??[],h=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:d,percent:p}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(r),m=new Map;if(i&&s)for(const e of t){const t=(e[i]??"Uncategorized")+"",n=Number(e[s]);Number.isFinite(n)&&m.set(t,(m.get(t)??0)+n)}const g=[...m].sort((e,t)=>t[1]-e[1]),y=g.reduce((e,[,t])=>e+t,0),b=g[0],C=g[1],w=y>0?((b?.[1]??0)+(C?.[1]??0))/y:0,S=e.intents.map(e=>({id:f(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,x=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${k=h,k?k.charAt(0).toUpperCase()+k.slice(1):k}.`,l2:g.length>0?`${g.length} categories total ${d.format(y)}. ${b[0]} accounts for ${d.format(b[1])}${y>0?` (${p.format(b[1]/y)})`:""}${C?`, followed by ${C[0]} at ${d.format(C[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>g.length?b?b[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>w?`The total is distributed across ${g.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${b[0]} and ${C[0]}, which together account for ${p.format(w)}.`,l4:`The chart is intended for ${S??"explanation"}${x?` with a ${x} audience`:""}: ${e.designContract.whyCustom}`};var k}(e,r,o,a),l=n.levels??["l1","l2","l3","l4"],c={};for(const e of l)s[e]&&(c[e]=s[e]);const u=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),h=n.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...h?.length?{caveats:h}:{}}}(b,u,{levels:e,locale:h.locale,audience:h.audience,includeCaveats:h.includeCaveats}),n=q(u);return{...t,text:n?`${n} ${t.text}`.trim():t.text,...n?{annotations:n}:{}}}const C=G(h.locale??"en"),w=k(e),P=Array.isArray(u.data)?u.data:null,j=l(u),F=x.has(e)?function(e,t){const n=e.physics&&"object"==typeof e.physics?e.physics:null,r=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,o=[e.settledProjectionRows,e.projectionRows,r?.rows,n?.settledProjectionRows,n?.projectionRows,n?.settledProjection&&"object"==typeof n.settledProjection?n.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(o)?o.map((e,n)=>{if(!e||"object"!=typeof e)return null;const r=e,o=A(r.count??r.value??r.total??r.bodies??r.events);if(null==o)return null;const a=r.label??r.id??r.name??"container "+(n+1),i=A(r.secondary??r.secondaryCount),s=A(r.observed??r.observedCount);return{label:c(a,t),count:o,...null!=i?{secondary:i}:{},..."string"==typeof r.secondaryLabel&&r.secondaryLabel?{secondaryLabel:r.secondaryLabel}:{},...null!=s?{observed:s}:{}}}).filter(e=>null!=e):null}(u,C):null,{measure:L,measureFallback:B,dimension:I,dimensionFallback:M}=s(e,u),T="string"==typeof L&&L?L:B,O="string"==typeof I&&I?I:M,E={};if(x.has(e)&&function(e,t,n,r,o,a){const i=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PacketFlowChart"===e?"flow node":"CrucibleChart"===e?"result group":"container"}(e),s=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PacketFlowChart"===e?"packet":"CrucibleChart"===e?"settled item":"body"}(e);if(o.has("l1")&&(r.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"UnitPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PacketFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":"CrucibleChart"===e?"A crucible physics chart that replays authored phases and events into declared products and outlets; the settled ledger, not collisions, determines the result.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!o.has("l2")&&!o.has("l3"))return;if(!n||0===n.length)return void(o.has("l2")&&(r.l2="No settled projection is loaded yet."));const l=n.reduce((e,t)=>e+t.count,0),c=n.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=c[0]??n.slice().sort((e,t)=>t.count-e.count)[0];if(!u)return;const h=n.reduce((e,t)=>e+(t.secondary??0),0),d=n.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(o.has("l2"))if(0===c.length)r.l2=`The settled projection contains ${a(l)} ${J(l,s)} across ${n.length} ${J(n.length,i)}; no ${J(2,i)} are non-empty yet.`;else{const e=h>0?` ${a(h)} ${J(h,s)} ${1===h?"is":"are"} marked ${d}.`:"";r.l2=`The settled projection contains ${a(l)} ${J(l,s)} across ${n.length} ${J(n.length,i)}; ${c.length} ${J(c.length,i)} ${1===c.length?"is":"are"} non-empty. The largest ${i} is ${u.label} with ${a(u.count)} ${J(u.count,s)}.${e}`}if(o.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==u),t=function(e,t){if(0>=t)return"0%";const n=e/t*100;return(10>n?Math.round(10*n)/10:Math.round(n))+"%"}(u.count,l);r.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${a(u.count)} ${J(u.count,s)} (${t}); ${e.label} follows with ${a(e.count)} ${J(e.count,s)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${a(u.count)} ${J(u.count,s)}.`}}(e,w,F,E,p,C),p.has("l1")&&!x.has(e))if(r.has(e)||o.has(e))E.l1=`A ${w} of ${T} by ${O}`+(j?`, split by ${j}.`:".");else if(a.has(e))E.l1=`A ${w} showing ${T} across ${O} categories.`;else if(i.has(e))E.l1=`A ${w} of the distribution of ${T}`+(j?` by ${j}.`:".");else if(S.has(e)){const e=Array.isArray(u.nodes)?u.nodes.length:void 0,t=Array.isArray(u.edges)?u.edges.length:void 0,n=[null!=e?`${e} ${J(e,"node")}`:null,null!=t?`${t} ${J(t,"edge")}`:null].filter(Boolean);E.l1=`A ${w}${n.length?" with "+n.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof u.label?u.label:T;E.l1=`A single value${e?" for "+e:""}.`}else E.l1=`A ${w}.`;const U=r.has(e)||o.has(e)||a.has(e)||i.has(e);let z=null;if((p.has("l2")||p.has("l3")||p.has("l4"))&&U&&P&&P.length>0&&(z=function(e,t,n,r){let o=0,a=0,i=1/0,s=-1/0,l=null,u=null,h=0,d=0,p=null,f=null,m=NaN,g=NaN;for(const n of e){const e=t(n);Number.isFinite(e)&&(0===o&&(m=e,p=n),g=e,f=n,i>e&&(i=e,l=n,h=o),e>s&&(s=e,u=n,d=o),o++,a+=e)}return 0===o?null:{count:o,min:i,max:s,mean:a/o,minLabel:c(null!=l?n(l):null,r),maxLabel:c(null!=u?n(u):null,r),first:m,last:g,firstLabel:c(null!=p?n(p):null,r),lastLabel:c(null!=f?n(f):null,r),minIndex:h,maxIndex:d}}(P,t(L,B),n(I,M),C)),p.has("l2")&&U&&(P&&0!==P.length?z&&(E.l2=a.has(e)?`${z.count} segments totaling ${C(function(e){return e.mean*e.count}(z))}. Largest is ${z.maxLabel} at ${C(z.max)}; smallest is ${z.minLabel} at ${C(z.min)}.`:`${T} ranges from ${C(z.min)} (${z.minLabel}) to ${C(z.max)} (${z.maxLabel}), with a mean of ${C(z.mean)} across ${z.count} points.`):E.l2="No data is loaded yet."),p.has("l3")&&z&&!j&&r.has(e)?E.l3=function(e,t,n){const{first:r,last:o,min:a,max:i,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:h,maxIndex:d,count:p}=e,f=i-a,m=o-r;if(0===f)return`${H(t)} is constant at ${n(r)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${H(t)} ends roughly where it started (${n(r)} at ${c} to ${n(o)} at ${u}), ranging between ${n(a)} and ${n(i)}.`;const g=d>0&&p-1>d,y=h>0&&p-1>h,$=(i-Math.max(r,o))/f,b=(Math.min(r,o)-a)/f;return g&&$>.15?`Overall ${t} climbs to a peak of ${n(i)} (${s}), then falls to ${n(o)} (${u}).`:y&&b>.15?`Overall ${t} drops to a low of ${n(a)} (${l}), then recovers to ${n(o)} (${u}).`:.05>Math.abs(m)/f?`${H(t)} ends roughly where it started (${n(r)} at ${c} to ${n(o)} at ${u}), ranging between ${n(a)} and ${n(i)}.`:m>0?d===p-1?`Overall ${t} rises from ${n(r)} (${c}) to a peak of ${n(o)} (${u}).`:`Overall ${t} rises from ${n(r)} (${c}) to ${n(o)} (${u}), after peaking at ${n(i)} (${s}).`:h===p-1?`Overall ${t} falls from ${n(r)} (${c}) to a low of ${n(o)} (${u}).`:`Overall ${t} falls from ${n(r)} (${c}) to ${n(o)} (${u}), after dipping to ${n(a)} (${l}).`}(z,T,C):p.has("l3")&&z&&!j&&o.has(e)&&(E.l3=`The highest ${O} is ${z.maxLabel} and the lowest is ${z.minLabel}.`),p.has("l4")){const t=R(u)?"alerting":N(e,h.capability);t&&(E.l4=function(e,t,n,r,i,s,l,c){const u=D[e],h=/^[aeiou]/i.test(u)?"an":"a";let d,p;switch(e){case"locating":d="This is a map",p="read values by location";break;case"presenting":d="This is a single-value display",p=`read ${"string"==typeof n.label&&n.label?n.label:i} as the headline number`;break;case"tracing":d=`This is ${h} ${u} chart`,p="follow the movement between states";break;case"nesting":d=`This is ${h} ${u} chart`,p="read it for nested structure and how children sum into their parents";break;case"relating":d=`This is ${h} ${u} chart`,p=`read it for whether ${s} and ${i} move together`;break;default:d=`This is ${h} ${u} chart`,p=function(e,t,n,r,i,s){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+n;case"comparing":return`compare ${n} across ${r}`;case"ranking":return"read it top to bottom by "+n;case"apportioning":return`read each ${r}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+n;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,n){if(o.has(n)||a.has(n))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:r,last:i,min:s,max:l,minLabel:c,maxLabel:u,lastLabel:h,minIndex:d,maxIndex:p,count:f}=e,m=l-s;if(m>0){const e=p>0&&f-1>p,n=d>0&&f-1>d,o=(l-Math.max(r,i))/m,a=(Math.min(r,i)-s)/m;if(e&&o>.15)return`the peak of ${t(l)} at ${u} is the point to investigate`;if(n&&a>.15)return`the dip to ${t(s)} at ${c} is the point to investigate`;if(i>=l)return`the climb to ${t(i)} at ${h} warrants a closer look`;if(s>=i)return`the drop to ${t(i)} at ${h} warrants a closer look`}return`the extremes — ${u} (${t(l)}) and ${c} (${t(s)}) — are the points to check`}(t,i,s);case"tracking":return`read it for the trajectory of ${n}, which ${function(e){const t=e.max-e.min,n=e.last-e.first;return 0===t||.05>Math.abs(n)/t?"holds roughly steady":n>0?"rises":"falls"}(t)} from ${i(t.first)} (${t.firstLabel}) to ${i(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${n} across ${r}; ${t.maxLabel} leads at ${i(t.max)}`;case"ranking":return`read it top to bottom by ${n}; ${t.maxLabel} ranks highest at ${i(t.max)}`;case"apportioning":{const e=t.mean*t.count,n=e>0?Math.round(t.max/e*100):null;return`read each ${r}'s share of the ${i(e)} total; ${t.maxLabel} is the largest at ${i(t.max)}${null!=n?` (${n}%)`:""}`}case"characterizing":return`read it for the spread of ${n}, from ${i(t.min)} to ${i(t.max)}`;default:return"read the highlighted features"}}(e,r,i,s,l,t)}return`${d}; ${p}.${function(e,t){if(!t)return"";const n=t.familiarity?.[e];return"number"!=typeof n||n>2?"":` This ${k(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,c)}`}(t,e,u,j?null:z,T,O,C,h.audience))}const V=["l1","l2","l3","l4"].filter(e=>p.has(e)&&E[e]).map(e=>E[e]).join(" "),K=q(u);return{text:K?`${K} ${V}`.trim():V,levels:E,...K?{annotations:K}:{}}}function H(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function J(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function V(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function K(u,h,d={}){const p=d.locale??"en",f=Math.max(1,d.maxLeaves??200),w=G(p),S=y(u,h,d.recipe);if(S)return function(e,t,n={}){const r=g(t),o=m(t),a=Math.max(1,n.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:r,config:o,locale:n.locale??"en"});const i=(s=e.navigation)&&"object"==typeof s?e.navigation:void 0;var s;const l=(i?.groupByRole?b(e,i.groupByRole):void 0)??(i?.groupBy?.[0]?b(e,i.groupBy[0])??e.dataRoles.find(e=>e.field===i.groupBy?.[0]):void 0)??v(e,["nominal","ordinal"]),c=l?$(l,o,r):void 0,u=(i?.idRole?b(e,i.idRole):void 0)??v(e,["identifier"]),h=u?$(u,o,r):void 0,d={id:"root",role:"chart",label:i?.summaryTemplate?C(i.summaryTemplate,void 0,e,o,r,{count:r.length}):`${e.name}: ${r.length} ${1===r.length?"item":"items"} represented.`,level:1,children:[]};let p=0;const f=(t,n,a)=>{const s=h?t[h]:void 0,l=i?.itemLabelTemplate?C(i.itemLabelTemplate,t,e,o,r,{count:r.length}):function(e,t,n,r){const o=v(t,["nominal","ordinal"]),a=t.dataRoles.filter(e=>"quantitative"===e.semanticType),i=o?$(o,n,r):void 0,s=[];i&&null!=e[i]&&s.push(e[i]+"");for(const t of a){const o=$(t,n,r);o&&null!=e[o]&&s.push(`${t.role}: ${e[o]+""}`)}return s.length>0?s.join(", "):"Data item"}(t,e,o,r);return{id:"datum-"+V(s??n),role:"datum",label:l,level:a,datum:t}};if(c){const e=new Map;for(const t of r){const n=(t[c]??"Uncategorized")+"",r=e.get(n);r?r.push(t):e.set(n,[t])}d.children=[...e].map(([e,t],n)=>{const r=t.slice(0,Math.max(0,a-p));p+=r.length;const o=r.map((e,t)=>f(e,1e5*n+t,3));return t.length>r.length&&o.push({id:"more-"+V(e),role:"datum",label:`…and ${t.length-r.length} more items`,level:3}),{id:"group-"+V(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:o}})}else{const e=r.slice(0,a);d.children=e.map((e,t)=>f(e,t,2)),r.length>e.length&&d.children.push({id:"more",role:"datum",label:`…and ${r.length-e.length} more items`,level:2})}return d}(S,h,{maxLeaves:f,locale:p});const x={id:"root",role:"chart",label:z(u,h,{locale:p}).text||"Chart.",level:1,children:[]},k=function(t,n){const r=Array.isArray(t.annotations)?t.annotations:null;if(!r)return null;const o=e(r.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return null;let a=0;const i=o.slice(0,n).map(e=>{const t=e.lifecycle?.status,n=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+a++,role:"annotation",level:3,label:`${r=U(e),r?r.charAt(0).toUpperCase()+r.slice(1):r}${n}.`,datum:e};var r});o.length>n&&i.push({id:"annotation-"+a++,role:"annotation",level:3,label:`…and ${o.length-n} more annotations.`});const s=o.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:i}}(h,f),A=Array.isArray(h.data)?h.data:null,P=r.has(u)||o.has(u)||a.has(u)||i.has(u);if(!A||0===A.length||!P)return k&&(x.children=[k]),x;const{measure:j,measureFallback:F,dimension:L,dimensionFallback:D}=s(u,h),B=t(j,F),N=n(L,D),I="string"==typeof j&&j?j:F,M="string"==typeof L&&L?L:D,T=l(h);let O=0;const R=e=>`${e}-${O++}`,E=(e,t)=>{const n=e.slice(0,f).map(e=>((e,t)=>{const n=B(e),r=c(N(e),w);return{id:R("datum"),role:"datum",level:t,label:`${r}: ${Number.isFinite(n)?w(n):"—"}`,value:Number.isFinite(n)?n:void 0,datum:e}})(e,t));return e.length>f&&n.push({id:R("more"),role:"datum",level:t,label:`…and ${e.length-f} more points`}),n},q=[];if(r.has(u)||o.has(u)){let e=1/0,t=-1/0,n=1/0,r=-1/0;const a=[];let i=!0;for(const o of A){const s=B(o);Number.isFinite(s)&&(e>s&&(e=s),s>t&&(t=s));const l=N(o);a.push(l),"number"==typeof l&&Number.isFinite(l)?(n>l&&(n=l),l>r&&(r=l)):i=!1}const s=new Set,l=[];for(const e of a){const t=e+"";s.has(t)||(s.add(t),l.push(e))}const h=i?`${w(n)} to ${w(r)}`:`${c(l[0],w)} to ${c(l[l.length-1],w)} (${o.has(u)?l.length+" categories":A.length+" points"})`;q.push({id:R("axis"),role:"axis",level:2,label:`${o.has(u)?"Category axis":"X axis"}: ${M}, ${h}.`}),e>t||q.push({id:R("axis"),role:"axis",level:2,label:`Value axis: ${I}, ${w(e)} to ${w(t)}.`})}if(T){const e=n(T,T),t=new Map;for(const n of A){const r=(e(n)??"—")+"",o=t.get(r);o?o.push(n):t.set(r,[n])}const r=[];for(const[e,n]of t){const t=z(u,{...h,data:n},{levels:["l2","l3"],locale:p}).text;r.push({id:R("series"),role:"series",level:2,label:`Series ${e}: ${t}`,children:E(n,3)})}x.children=[...q,...r]}else x.children=[...q,...E(A,2)];return k&&x.children.push(k),x}function Q(e,t){const n=[],r=e=>{if(n.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)r(t)};return r(e),n}function W(e){let t=1;if(e.children)for(const n of e.children)t+=W(n);return t}var _=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","PhysicsCustomChart"]);function Z(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function X(e){return Z(e)?e:void 0}function Y(e){const t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:void 0}function ee(e){const t=Y(e);return null==t?void 0:Math.max(0,Math.floor(t))}function te(...e){return e.map(X).find(Boolean)}function ne(...e){return e.find(Array.isArray)}function re(e){const t={};for(const[n,r]of Object.entries(e))void 0!==r&&(t[n]=r);return t}function oe(e,t,n){return e["string"==typeof t&&t?t:n]}function ae(e){return e instanceof Date?e.toISOString():"number"==typeof e?Number.isInteger(e)?e+"":Math.round(1e3*e)/1e3+"":(e??"—")+""}function ie(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function se(e){return Number.isInteger(e)?e+"":Math.round(1e3*e)/1e3+""}function le(e,t,n){const r=e?.filter(e=>!0===X(e)?.sensor).length,o=X(t?.observation),a=X(o?.sensors),i=ne(n?.activeSensors);return Math.max(r??0,a?Object.keys(a).length:0,i?.length??0)||void 0}function ce(e,t,n={}){const{capability:r,audience:o,locale:a}=n,i=n.levels??["l1","l2","l3"],s=!1!==n.includeStructure,l=N(e,r),c=z(e,t,{levels:l?[...i,"l4"]:i,locale:a,capability:r,audience:o}),{l4:u,...h}=c.levels,d=["l1","l2","l3"].map(e=>c.levels[e]).filter(Boolean).join(" "),p={levels:h,text:c.annotations?`${c.annotations} ${d}`.trim():d,...c.annotations?{annotations:c.annotations}:{}};let f;if(l&&u){const e=(m=r)?"fits"in m||"buildProps"in m?{family:m.family}:{family:m.family,intentScores:m.intentScores}:{};f={act:l,sentence:u,family:e.family,intentScores:e.intentScores}}var m;const g=s?K(e,t,{maxLeaves:n.maxLeaves,locale:a}):void 0,y=function(e,t,n){if(!1===n)return;const r=Z(n)?n:void 0,o=X(t.physics),a=te(r?.snapshot,o?.snapshot,t.physicsSnapshot,function(e){const t=X(e);return!!t&&(Z(t.world)||"simulationState"in t||"liveBodyOrder"in t)}(t.snapshot)?t.snapshot:void 0),i=te(r?.evidence,o?.evidence,t.physicsEvidence,t.settledEvidence),s=te(r?.config,o?.config,a?.config,t.config),l=te(X(a?.world),X(o?.world)),c=te(X(s?.kernel),X(l?.options)),u=ne(l?.bodies),h=ne(l?.colliders,s?.colliders),d=ne(a?.queue,o?.queue),p=ne(a?.liveBodyOrder),f=ne(l?.springs),m=ne(a?.activeSensorPairs),g=function(e){if(!e||0===e.length)return;const t=e.map((e,t)=>{const n=X(e);if(!n)return;const r=Y(n.count??n.value??n.total??n.bodies??n.events);if(null==r)return;const o=(n.label??n.id??n.name??"container "+(t+1))+"",a=null==n.id?void 0:n.id+"",i=Y(n.secondary??n.secondaryCount),s=Y(n.observed??n.observedCount);return re({id:a,label:o,count:r,secondary:i,secondaryLabel:"string"==typeof n.secondaryLabel?n.secondaryLabel:void 0,observed:s})}).filter(e=>null!=e);if(0===t.length)return;const n=t.reduce((e,t)=>e+t.count,0),r=t.filter(e=>e.count>0).length,o=t.slice().sort((e,t)=>t.count-e.count)[0];return{rows:t,totalCount:n,populatedCount:r,...o?{leader:o}:{}}}(function(e,t,n,r){const o=X(e.settledProjection),a=X(t?.settledProjection);return ne(n?.projectionRows,n?.aggregates,e.settledProjectionRows,e.projectionRows,o?.rows,t?.settledProjectionRows,t?.projectionRows,a?.rows,r?.binCounts)}(t,o,r,i)),y=function(e,t){const n=e?.map((e,t)=>{const n=X(e);if(!n)return;const r=Y(n.count)??0,o=Y(n.total),a={label:(n.label??n.id??"sediment "+(t+1))+"",count:r};return null!=n.id&&(a.id=n.id+""),null!=o&&(a.total=o),a}).filter(e=>null!=e),r=ee(t?.bins)??n?.length??0,o=Y(t?.count)??n?.reduce((e,t)=>e+t.count,0)??0,a=Y(t?.total)??n?.reduce((e,t)=>e+(t.total??0),0),i=n?.slice().sort((e,t)=>t.count-e.count)[0];if(0!==r||0!==o||a)return{bins:r,count:o,...null!=a&&a>0?{total:a}:{},...i?{leader:i}:{}}}(ne(r?.sediment,o?.sediment,a?.sediment),te(r?.sedimentTotals,o?.sedimentTotals)),$=p?.length??u?.length??ee(i?.bodyCount),b=function(e){if(e)return e.filter(e=>!0===X(e)?.sleeping).length}(u)??ee(i?.sleepingCount),v=d?.length,C="string"==typeof a?.simulationState?a.simulationState:void 0,w="boolean"==typeof i?.settled?i.settled:C?"settled"===C:null!=$||null!=b||null!=v?null!=$&&b===$&&0===(v??0):void 0,S=X(c?.gravity),x=Y(S?.x),k=Y(S?.y),A=re({state:C,settled:w,elapsedSeconds:Y(a?.elapsedSeconds),paused:"boolean"==typeof a?.paused?a.paused:void 0,visible:"boolean"==typeof a?.visible?a.visible:void 0,seed:Y(c?.seed),gravity:null!=x&&null!=k?{x:x,y:k}:void 0,fixedDt:Y(s?.fixedDt??c?.fixedDt),timeScale:Y(s?.timeScale),maxSubsteps:ee(s?.maxSubsteps),liveBodies:$,sleepingBodies:b,queued:v,bodyLimit:Y(s?.bodyLimit),eviction:"string"==typeof s?.eviction?s.eviction:void 0}),P=re({colliders:h?.length,sensors:le(h,s,l),springs:f?.length,activeSensorPairs:m?.length}),j=Object.keys(P).length>0,F=_.has(e);if(!(Object.keys(A).length>0||j||g||y)||!F&&null==n)return;const L={simulation:A,...j?{geometry:P}:{},...g?{aggregates:g}:{},...y?{sediment:y}:{}},D=function(e){const t=[],n=e.simulation,r=[n.state??(n.settled?"settled":void 0),null!=n.liveBodies?`${n.liveBodies} live ${ie(n.liveBodies,"body")}`:void 0,null!=n.sleepingBodies?n.sleepingBodies+" sleeping":void 0,null!=n.queued?n.queued+" queued":void 0,null!=n.seed?"seed "+se(n.seed):void 0,n.gravity?`gravity (${se(n.gravity.x)}, ${se(n.gravity.y)})`:void 0,null!=n.fixedDt?`fixed step ${se(n.fixedDt)}s`:void 0,null!=n.timeScale?se(n.timeScale)+"x time":void 0].filter(Boolean);r.length>0&&t.push(`Physics simulation: ${r.join("; ")}.`);const o=e.geometry;if(o){const e=[null!=o.colliders?`${o.colliders} ${ie(o.colliders,"collider")}`:void 0,null!=o.sensors?`${o.sensors} ${ie(o.sensors,"sensor")}`:void 0,null!=o.springs?`${o.springs} ${ie(o.springs,"spring")}`:void 0,null!=o.activeSensorPairs?`${o.activeSensorPairs} active sensor ${ie(o.activeSensorPairs,"pair")}`:void 0].filter(Boolean);e.length>0&&t.push(`Physics geometry: ${e.join("; ")}.`)}const a=e.aggregates;if(a){const e=a.leader,n=e?` Largest is ${e.label} with ${se(e.count)}.`:"";t.push(`Physics aggregates: ${se(a.totalCount)} settled ${ie(a.totalCount,"body")} across ${a.rows.length} ${ie(a.rows.length,"container")}; ${a.populatedCount} populated.${n}`)}const i=e.sediment;if(i){const e=null!=i.total?", value total "+se(i.total):"",n=i.leader?`; largest sediment bin is ${i.leader.label} with ${se(i.leader.count)}`:"";t.push(`Physics sediment: ${i.count} retained ${ie(i.count,"body")} in ${i.bins} ${ie(i.bins,"bin")}${e}${n}.`)}return t.join(" ")}(L);return{...L,text:D}}(e,t,n.physics),$=function(e,t,n){const r=[];if("GaugeChart"===e){"number"==typeof t.value&&Number.isFinite(t.value)&&r.push(`Current value is ${ae(t.value)}.`);const e="number"==typeof t.min&&Number.isFinite(t.min)?t.min:0,n="number"==typeof t.max&&Number.isFinite(t.max)?t.max:100;r.push(`The gauge scale runs from ${ae(e)} to ${ae(n)}.`)}if("SankeyDiagram"===e||"ProcessSankey"===e){const o=Array.isArray(t.edges)?t.edges:[];if("ProcessSankey"===e&&Array.isArray(t.domain)&&2===t.domain.length&&r.push(`The ProcessSankey time domain runs from ${ae(t.domain[0])} to ${ae(t.domain[1])}.`),o.length>0){r.push(`${o.length} source flow${1===o.length?"":"s"} are supplied.`);for(const a of o.slice(0,n)){const n=oe(a,t.sourceAccessor,"source"),o=oe(a,t.targetAccessor,"target"),i=oe(a,t.valueAccessor,"value");r.push("ProcessSankey"!==e||null==a.startTime&&null==a.endTime?`${ae(n)} to ${ae(o)} has value ${ae(i)}.`:`${ae(n)} to ${ae(o)} has value ${ae(i)} over ${ae(a.startTime)}–${ae(a.endTime)}.`)}}}if("Treemap"===e||"CirclePack"===e||"TreeDiagram"===e||"OrbitDiagram"===e){const e=X(t.data),o="string"==typeof t.childrenAccessor&&t.childrenAccessor?t.childrenAccessor:"children",a="string"==typeof t.valueAccessor&&t.valueAccessor?t.valueAccessor:"value",i="string"==typeof t.nodeIdAccessor&&t.nodeIdAccessor?t.nodeIdAccessor:"string"==typeof t.nodeIDAccessor&&t.nodeIDAccessor?t.nodeIDAccessor:"name",s=[],l=e=>{const t=Array.isArray(e[o])?e[o]:[];if(0!==t.length)for(const e of t){const t=X(e);t&&l(t)}else s.push(e)};if(e&&l(e),s.length>0){r.push(s.length+" hierarchy leaves are supplied.");for(const e of s.slice(0,n))r.push(`${ae(e[i])} has value ${ae(e[a])}.`)}}if(_.has(e)&&Array.isArray(t.data)){const n=t.data;r.push(`${n.length} observed source row${1===n.length?"":"s"} are supplied.`);const o="CollisionSwarmChart"===e?t.xAccessor:t.valueAccessor,a="CollisionSwarmChart"===e?"x":"value",i=n.map(e=>Y(oe(e,o,a))).filter(e=>null!=e);i.length>0&&r.push(`Observed ${"string"==typeof o?o:a} ranges from ${ae(Math.min(...i))} to ${ae(Math.max(...i))}.`)}if(0!==r.length)return{source:"chart-props",statements:r,text:"Exact chart-prop facts: "+r.join(" ")}}(e,t,Math.max(1,n.maxLeaves??200)),b=[p.text,f?.sentence,y?.text,$?.text].filter(Boolean).join(" ");return{component:e,description:p,intent:f,structure:g,physics:y,facts:$,text:b}}var ue=["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","SwimlaneChart","LikertChart","LineChart","BumpChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","GauntletChart","CrucibleChart","ProcessFlowChart","PacketFlowChart","ChainReactionChart","BigNumber"],he=new Set(ue);function de(e){return he.has(e)}var pe=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),fe=new Set(["data","nodes","edges","points","areas","lines","flows"]);function me(e){if(null==e)return e;if("function"==typeof e)return;if("object"!=typeof e)return e;if(e.$$typeof)return;if(Array.isArray(e))return e.map(me).filter(e=>void 0!==e);if(e instanceof Date)return e;const t={};for(const[n,r]of Object.entries(e)){if("function"==typeof r)continue;if(r&&"object"==typeof r&&r.$$typeof)continue;const e=me(r);void 0!==e&&(t[n]=e)}return t}function ge(e,t){return!!fe.has(e)&&("areas"!==e||"string"!=typeof t)}var ye="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function $e(e,t,n){const r=d(e)??p(t.recipe)??p(t.recipeId);if(r)return function(e,t,n){const r=function(e,t,n){const r={};for(const[o,a]of Object.entries(e))if(null!=a&&!pe.has(o)&&"recipeId"!==o&&(t||!ge(o,a)))if("function"==typeof a||a?.$$typeof){if(n)throw Error(`Portable recipe prop "${o}" is not JSON-safe.`)}else if(u(a))r[o]=ye(a);else if(n)throw Error(`Portable recipe prop "${o}" is not JSON-safe.`);return r}(t,!1!==n?.includeData,"portable"===e.portability),o=e.intents.map(f).filter(e=>!!e),a={name:e.name,intents:o,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!u(r))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:r,manifest:a,version:"1",createdAt:(new Date).toISOString(),...n?.selections?{selections:n.selections}:{}}}return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:"Recipe contains or may depend on non-serializable local layout callbacks.",warnings:["This config is inspectable but cannot be rendered remotely by CLI or MCP."],props:r,manifest:a,version:"1",createdAt:(new Date).toISOString(),...n?.selections?{selections:n.selections}:{}}}(r,t,n);if(!de(e))throw Error(`Unknown component "${e}". Known components: ${ue.join(", ")}`);const o=!1!==n?.includeData,a={};for(const[e,n]of Object.entries(t))if(null!=n&&!pe.has(e)&&(o||!ge(e,n))&&"function"!=typeof n&&!n?.$$typeof)try{a[e]=ye(me(n))}catch{}return{component:e,props:a,version:"1",createdAt:(new Date).toISOString(),...n?.selections?{selections:n.selections}:{}}}function be(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if("ChartRecipe"===e.component||"LocalChartRecipe"===e.component){if(!e.recipeId)throw Error("Invalid chart recipe config: missing recipeId");const t=d(e.recipeId);if(!t)throw Error(`Unknown chart recipe "${e.recipeId}". Register it before deserializing this config.`);if("LocalChartRecipe"!==e.component&&!1!==e.portable&&"portable"!==t.portability)throw Error(`Chart recipe "${e.recipeId}" is registered as local, not portable.`);return{componentName:"ChartRecipe",props:{...ye(e.props),recipeId:e.recipeId}}}if(!de(e.component))throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:ye(e.props)}}function ve(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ce(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(escape(atob(n)));return JSON.parse(r)}async function we(e,t="json"){const n="jsx"===t?Se(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");await navigator.clipboard.writeText(n)}function Se(e){const{props:t}=e,n=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&n.push(` recipeId="${e.recipeId}"`);for(const[e,r]of Object.entries(t))if("string"==typeof r)n.push(` ${e}="${r}"`);else if("boolean"==typeof r&&!0===r)n.push(" "+e);else if("boolean"==typeof r&&!1===r)n.push(` ${e}={false}`);else if("number"==typeof r)n.push(` ${e}={${r}}`);else{const t=JSON.stringify(r);n.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(r,null,2)}}`)}return n.push("/>"),n.join("\n")}export{d as getChartRecipe,f as recipeIntentId,m as recipeConfig,$ as fieldForRole,B as communicativeActForIntent,N as resolveCommunicativeAct,z as describeChart,K as buildNavigationTree,Q as flattenVisible,W as countNodes,ce as buildReaderGrounding,$e as toConfig,be as fromConfig,ve as toURL,Ce as fromURL,we as copyConfig,Se as configToJSX};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getMinMax as e}from"./chunk-chunk-JJ2OOIET.module.min.js";function t(t,a){const{field:i,bins:r=10}=a,s=t.map(e=>Number(e[i])).filter(e=>!isNaN(e));if(0===s.length)return[];const[n,l]=e(s),c=a.domain?a.domain[0]:n,u=a.domain?a.domain[1]:l;if(c===u)return[{category:`${c}-${u}`,value:s.length}];const d=(u-c)/r,f=Array(r).fill(0);for(const e of s){let t=Math.floor((e-c)/d);t===r&&(t=r-1),t>=0&&r>t&&f[t]++}return f.map((e,t)=>{const a=c+t*d,i=a+d;return{category:`${o(a)}-${o(i)}`,value:e}})}function a(t,a){const{groupBy:i,value:r,agg:o="sum"}=a,s=new Map;for(const e of t){const t=e[i]+"";s.has(t)||s.set(t,[]),s.get(t).push(Number(e[r]))}const n=[];for(const[t,a]of s){let r;switch(o){case"count":r=a.length;break;case"mean":r=a.reduce((e,t)=>e+t,0)/a.length;break;case"min":r=e(a)[0];break;case"max":r=e(a)[1];break;default:r=a.reduce((e,t)=>e+t,0)}n.push({[i]:t,value:r})}return n}function i(e,t){const{key:a,fields:i}=t,r=new Map;for(const t of e){const e=t[a]+"";if(r.has(e)||r.set(e,[]),i){const a={};for(const e of i)e in t&&(a[e]=t[e]);r.get(e).push(a)}else r.get(e).push({...t})}const o=[];for(const[e,t]of r)o.push({id:e,coordinates:t});return o}function r(e,t){const{columns:a,nameField:i="name",valueField:r="value"}=t,o=new Set(a),s=[];for(const t of e){const e={};for(const a of Object.keys(t))o.has(a)||(e[a]=t[a]);for(const o of a)s.push({...e,[i]:o,[r]:t[o]})}return s}function o(e){return Math.round(1e3*e)/1e3+""}function s(e){return"nominal"===e||"ordinal"===e}function n(e){return"quantitative"===e||"temporal"===e}var l={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},c={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},u={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function d(e){e=function(e){if(!function(e){return e.usermeta?.idid}(e)||!Array.isArray(e.layer))return e;const t=e.layer.filter(e=>!function(e){return"annotation-layer"===e.usermeta?.idid?.role}(e));if(1!==t.length)return e;const{layer:a,...i}=e,{usermeta:r,...o}=t[0];return{...i,...o}}(e);const t=[],{type:i,markProps:r}=function(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...a}=e;return{type:t,markProps:a}}(e.mark),o=e.encoding||{},d=o.x,y=o.y,m=o.color,g=o.size,h=o.theta,v=o.opacity;let b;e.data?.values?b=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||o.facet||o.row||o.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const x={};e.width&&(x.width=e.width),e.height&&(x.height=e.height);const k=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(k&&(x.title=k),m?.field&&(x.colorBy=m.field,m.scale?.scheme)){const e=l[m.scale.scheme];e&&(x.colorScheme=e)}void 0!==v?.value&&(x.pointOpacity=v.value);const A=d?.aggregate,L=y?.aggregate;if(b&&(A||L)){const e=L?y:d,t=L?d:y,i=u[e.aggregate];if(i&&t?.field&&e.field)b=a(b,{groupBy:t.field,value:e.field,agg:i});else if(("count"===i||"count"===e.aggregate)&&t?.field&&b){const e=new Map;for(const a of b){const i=a[t.field]+"";e.set(i,(e.get(i)||0)+1)}b=Array.from(e,([e,a])=>({[t.field]:e,value:a}))}}if(d?.bin||y?.bin){const e="Histogram";b&&(x.data=b),d?.bin?(x.valueAccessor=d.field,y?.field&&(x.categoryAccessor=y.field),d.axis?.title&&(x.valueLabel=d.axis.title)):y?.bin&&(x.valueAccessor=y.field,d?.field&&(x.categoryAccessor=d.field),y.axis?.title&&(x.valueLabel=y.axis.title));const a=d?.bin||y?.bin,i="object"==typeof a?a.maxbins:void 0;return i&&(x.bins=i),p(e,x,t)}let w;switch(i){case"bar":w=function(e,t,a,i,r,o,l){let c;return a?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(c="StackedBarChart",i.stackBy=a.field):c="BarChart",s(e?.type)&&n(t?.type)?(i.categoryAccessor=e.field,i.valueAccessor=l?"value":t.field,e?.axis?.title&&(i.categoryLabel=e.axis.title),t?.axis?.title&&(i.valueLabel=t.axis.title)):n(e?.type)&&s(t?.type)?(i.categoryAccessor=t.field,i.valueAccessor=o?"value":e.field,i.orientation="horizontal",t?.axis?.title&&(i.categoryLabel=t.axis.title),e?.axis?.title&&(i.valueLabel=e.axis.title)):(e?.field&&(i.categoryAccessor=e.field),t?.field&&(i.valueAccessor=l?"value":t.field),e?.axis?.title&&(i.categoryLabel=e.axis.title),t?.axis?.title&&(i.valueLabel=t.axis.title)),r&&(i.data=r),c}(d,y,m,x,b,A,L);break;case"line":if(w="LineChart",f(d,y,x,A,L),m?.field&&(x.lineBy=m.field),r.interpolate){const e=c[r.interpolate];e&&(x.curve=e)}!0===r.point&&(x.showPoints=!0),b&&(x.data=b);break;case"area":if(m?.field?(w="StackedAreaChart",x.areaBy=m.field):w="AreaChart",f(d,y,x,A,L),r.interpolate){const e=c[r.interpolate];e&&(x.curve=e)}void 0!==r.opacity&&(x.areaOpacity=r.opacity),b&&(x.data=b);break;case"point":case"circle":case"square":g?.field?(w="BubbleChart",x.sizeBy=g.field,g.scale?.range&&(x.sizeRange=g.scale.range)):w="Scatterplot",f(d,y,x,A,L),b&&(x.data=b);break;case"rect":w="Heatmap",d?.field&&(x.xAccessor=d.field),y?.field&&(x.yAccessor=y.field),m?.field&&(x.valueAccessor=m.field,delete x.colorBy),d?.axis?.title&&(x.xLabel=d.axis.title),y?.axis?.title&&(x.yLabel=y.axis.title),b&&(x.data=b);break;case"arc":r.innerRadius&&r.innerRadius>0?(w="DonutChart",x.innerRadius=r.innerRadius):w="PieChart",h?.field?x.valueAccessor=h.field:y?.field&&(x.valueAccessor=L?"value":y.field),m?.field&&(x.categoryAccessor=m.field),d?.field&&!h?.field&&(x.categoryAccessor=d.field),b&&(x.data=b);break;case"tick":w="DotPlot",s(d?.type)?(x.categoryAccessor=d.field,y?.field&&(x.valueAccessor=L?"value":y.field),d?.axis?.title&&(x.categoryLabel=d.axis.title),y?.axis?.title&&(x.valueLabel=y.axis.title)):s(y?.type)?(x.categoryAccessor=y.field,d?.field&&(x.valueAccessor=A?"value":d.field),x.orientation="horizontal",y?.axis?.title&&(x.categoryLabel=y.axis.title),d?.axis?.title&&(x.valueLabel=d.axis.title)):(d?.field&&(x.categoryAccessor=d.field),y?.field&&(x.valueAccessor=L?"value":y.field)),b&&(x.data=b);break;default:t.push(`Unsupported mark type "${i}". Defaulting to Scatterplot.`),w="Scatterplot",f(d,y,x,A,L),b&&(x.data=b)}return p(w,x,t)}function f(e,t,a,i,r){e?.field&&(a.xAccessor=i?"value":e.field),t?.field&&(a.yAccessor=r?"value":t.field),e?.axis?.title&&(a.xLabel=e.axis.title),t?.axis?.title&&(a.yLabel=t.axis.title)}function p(e,t,a){const i={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(a.length>0){i.warnings=a;for(const e of a)console.warn("[semiotic/fromVegaLite] "+e)}return i}export{t as bin,a as rollup,i as groupBy,r as pivot,d as fromVegaLite};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{renderRectPulse as t}from"./chunk-chunk-DVCWU7MT.module.min.js";import{buildLinearFillGradient as e,clampCornerRadii as o,filterSparseArray as i,hasAnyCornerRadius as n,resolveCSSColor as r,resolveCanvasFill as s}from"./chunk-chunk-SK2TQMG4.module.min.js";var a=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(t){Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}evict(t){t!==this._min&&t!==this._max||(this._dirty=!0)}recalculate(t,e){this._min=1/0,this._max=-1/0;for(const o of t){const t=e?e(o):o;Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}},h=class{constructor(t,e){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=t,this.chunkThreshold=e?.chunkThreshold??5e3,this.chunkSize=e?.chunkSize??5e3}updateChunkOptions(t){null!=t.chunkThreshold&&(this.chunkThreshold=t.chunkThreshold),null!=t.chunkSize&&(this.chunkSize=t.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(t){if(t=i(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,totalSize:t.length});let e=this.chunkSize;const o=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const i=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,i),bounded:!1}),e=i,this.chunkTimer=t.length>e?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(t){if(t=i(t),this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:t.length});let e=this.chunkSize;const o=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const i=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,i),bounded:!1}),e=i,this.chunkTimer=t.length>e?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const t=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:t,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(t){null!=t&&"object"==typeof t&&(this.pushBuffer.push(t),this.scheduleFlush())}pushMany(t){if(0===t.length)return;let e=0;for(let o=0;t.length>o;o++){const i=t[o];null!=i&&"object"==typeof i&&(this.pushBuffer.push(i),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},l={stops:[{offset:0,opacity:.8},{offset:1,opacity:.05}]};function c(t,e=l){if(t)return!0===t?e:"stops"in t?Array.isArray(t.stops)?t:void 0:"colorStops"in t?Array.isArray(t.colorStops)?{stops:t.colorStops.map(({offset:t,color:e})=>({offset:t,color:e}))}:void 0:{stops:[{offset:0,opacity:t.topOpacity??e.stops[0]?.opacity??.8},{offset:1,opacity:t.bottomOpacity??e.stops.at(-1)?.opacity??.05}]}}function u(t){return t?c(t):void 0}function f(t){if(t)return Array.isArray(t)?{stops:t.map(({at:t,color:e,opacity:o})=>({offset:t/100,color:e,...null!=o&&{opacity:o}}))}:Array.isArray(t.stops)?t:void 0}function d(t){return{stops:t.stops.map(t=>({...t,offset:1-t.offset})).sort((t,e)=>t.offset-e.offset)}}function g(t,e,o,i){return"function"==typeof t?t({size:e,margin:o,scales:i}):t}function y(t,e,o,i){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:i,fn:e}:{key:void 0,fn:null}}function p(t,e,o){return i=>{if(!i||!o||!t.fn&&!e.fn)return i;let n=!1;const r=i.map(o=>{const i=t.fn&&t.key&&!(t.key in o),r=e.fn&&e.key&&!(e.key in o);if(!i&&!r)return o;n=!0;const s={...o};return i&&(s[t.key]=t.fn(o)),r&&(s[e.key]=e.fn(o)),s});return n?r:i}}function m(t){return new Set(Array.isArray(t)?t:[t])}function _(t){for(const e of t){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style={...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0);else if("glyph"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0);else if("rect"===e.type||"heatcell"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0);else if("candlestick"===e.type)void 0!==e._targetX&&(e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0);else if("line"===e.type||"area"===e.type){if(e._introClipFraction=void 0,"line"===e.type&&e._targetPath){for(let t=0;e.path.length>t;t++)e.path[t]=e._targetPath[t];e._prevPath=void 0,e._targetPath=void 0}if("area"===e.type){if(e._targetTopPath)for(let t=0;e.topPath.length>t;t++)e.topPath[t]=e._targetTopPath[t];if(e._targetBottomPath)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=e._targetBottomPath[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0}}}}function k(t){for(const e of t){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style={...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}"point"===e.type?void 0!==e._targetX?(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0):void 0!==e._targetR&&(e.r=e._targetR,e._targetR=void 0):"rect"===e.type?void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0):"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0)}}function v(t,e,o){return"exact"===o?function(t,e){const o=t.domain(),i=o[0],n=o[o.length-1],r=i instanceof Date,s=i instanceof Date?i.getTime():i,a=n instanceof Date?n.getTime():n;if(2>e||s===a)return r?[new Date(s),new Date(a)]:[s,a];const h=(a-s)/(e-1),l=Array(e);for(let t=0;e>t;t++){const o=t===e-1?a:s+t*h;l[t]=r?new Date(o):o}return l}(t,e):t.ticks(e)}function T(t,e){const{x:i,y:n,w:r,h:s}=e,{tl:a,tr:h,br:l,bl:c}=o(e);t.beginPath(),t.moveTo(i+a,n),t.lineTo(i+r-h,n),h>0&&t.arcTo(i+r,n,i+r,n+h,h),t.lineTo(i+r,n+s-l),l>0&&t.arcTo(i+r,n+s,i+r-l,n+s,l),t.lineTo(i+c,n+s),c>0&&t.arcTo(i,n+s,i,n+s-c,c),t.lineTo(i,n+a),a>0&&t.arcTo(i,n,i+a,n,a),t.closePath()}function x(t,o){const i=s(t,o.style.fill,r(t,"var(--semiotic-primary, #007bff)")),n=function(t){switch(t.roundedEdge){case"bottom":return{x0:t.x,y0:t.y+t.h,x1:t.x,y1:t.y};case"right":return{x0:t.x+t.w,y0:t.y,x1:t.x,y1:t.y};case"left":return{x0:t.x,y0:t.y,x1:t.x+t.w,y1:t.y};default:return{x0:t.x,y0:t.y,x1:t.x,y1:t.y+t.h}}}(o);return(o.fillGradient&&"string"==typeof i?e(t,o.fillGradient,i,n.x0,n.y0,n.x1,n.y1):null)||i}function b(t,e){return!(!e.style.stroke||"none"===e.style.stroke||(t.strokeStyle=r(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,0))}var w=(e,o,i,r)=>{const s=o.filter(t=>"rect"===t.type);for(const o of s){if(null!=o.style.opacity&&(e.globalAlpha=o.style.opacity),o.style.icon)A(e,o);else if(o.cornerRadii&&n(o.cornerRadii))e.fillStyle=x(e,o),T(e,o),e.fill(),b(e,o)&&e.stroke();else if(o.roundedTop&&o.roundedTop>0){e.fillStyle=x(e,o);const t=Math.min(o.roundedTop,o.w/2,o.h/2);e.beginPath();const{x:i,y:n,w:r,h:s}=o;switch(o.roundedEdge){case"right":e.moveTo(i,n),e.lineTo(i+r-t,n),e.arcTo(i+r,n,i+r,n+t,t),e.lineTo(i+r,n+s-t),e.arcTo(i+r,n+s,i+r-t,n+s,t),e.lineTo(i,n+s);break;case"left":e.moveTo(i+r,n),e.lineTo(i+t,n),e.arcTo(i,n,i,n+t,t),e.lineTo(i,n+s-t),e.arcTo(i,n+s,i+t,n+s,t),e.lineTo(i+r,n+s);break;case"bottom":e.moveTo(i,n),e.lineTo(i+r,n),e.lineTo(i+r,n+s-t),e.arcTo(i+r,n+s,i+r-t,n+s,t),e.lineTo(i+t,n+s),e.arcTo(i,n+s,i,n+s-t,t);break;default:e.moveTo(i,n+s),e.lineTo(i,n+t),e.arcTo(i,n,i+t,n,t),e.lineTo(i+r-t,n),e.arcTo(i+r,n,i+r,n+t,t),e.lineTo(i+r,n+s)}e.closePath(),e.fill(),b(e,o)&&e.stroke()}else e.fillStyle=x(e,o),e.fillRect(o.x,o.y,o.w,o.h),b(e,o)&&e.strokeRect(o.x,o.y,o.w,o.h);t(e,o),e.globalAlpha=1}};function A(t,e){const o=e.style.icon,i=e.style.iconPadding||2,n=Math.min(e.w,e.h)-i;if(0>=n)return;const r=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),r){const r=n+i,s=e.x+(e.w-n)/2;for(let i=e.y+e.h-n;i>=e.y-n;i-=r)t.drawImage(o,s,i,n,n)}else{const r=n+i,s=e.y+(e.h-n)/2;for(let i=e.x;e.x+e.w>i;i+=r)t.drawImage(o,i,s,n,n)}t.restore()}function Y(t,e,o,i,n,r){const s=[];for(const n of t){const t=o(n),r=i(n);Number.isFinite(t)&&Number.isFinite(r)&&s.push({px:e.x(t),py:e.y(r),rawY:r,d:n})}s.sort((t,e)=>t.px-e.px);const a=Array(s.length),h=Array(s.length),l=Array(s.length);for(let t=0;s.length>t;t++){const e=s[t];a[t]=[e.px,e.py],h[t]=e.rawY,l[t]=e.d}return{type:"line",path:a,rawValues:h,style:n,datum:l,group:r}}function S(t,e,o,i,n,r,s,a){const h=[];for(const r of t){const t=o(r),s=i(r);if(!Number.isFinite(t)||!Number.isFinite(s))continue;const l=e.x(t),c=a?a(r):n;h.push({px:l,topY:e.y(s),botY:e.y(c),rawY:s})}h.sort((t,e)=>t.px-e.px);const l=Array(h.length),c=Array(h.length),u=Array(h.length);for(let t=0;h.length>t;t++){const e=h[t];l[t]=[e.px,e.topY],c[t]=[e.px,e.botY],u[t]=e.rawY}return{type:"area",topPath:l,bottomPath:c,rawValues:u,style:r,datum:t,group:s}}function F(t,e,o,i){const n=new Map;if("silhouette"===i)for(const i of t){let t=0;for(const n of e)t+=o(n,i)||0;n.set(i,-t/2)}else if("wiggle"===i){t.length>0&&n.set(t[0],0);for(let i=1;t.length>i;i++){const r=t[i-1],s=t[i];let a=0,h=0,l=0;for(const t of e){const e=o(t,s)||0;a+=(2*l+e)*(e-(o(t,r)||0)),h+=e,l+=e}const c=n.get(r)??0;n.set(s,c-(h>0?a/(2*h):0))}if(t.length>0){let i=0;for(const r of t){let t=0;for(const i of e)t+=o(i,r)||0;i+=(n.get(r)??0)+t/2}const r=i/t.length;for(const e of t)n.set(e,(n.get(e)??0)-r)}}else for(const e of t)n.set(e,0);return n}function P(t,e,o){let i=0,n=0;for(const r of t){let t=0,s=0;for(const i of e){const e=o(i,r)||0;0>e?s+=e:t+=e}i>s&&(i=s),t>n&&(n=t)}return[i,n]}function B(t,e,o,i,n,r,s,a="zero"){const h=new Set;for(const e of t)for(const t of e.data){const e=o(t);Number.isFinite(e)&&h.add(e)}const l=Array.from(h).sort((t,e)=>t-e),c=new Map;for(const e of t){const t=new Map;for(const n of e.data){const e=o(n),r=i(n);Number.isFinite(e)&&Number.isFinite(r)&&t.set(e,(t.get(e)||0)+r)}c.set(e.key,t)}let u;if(r){u=new Map;for(const e of l){let o=0;for(const i of t)o+=c.get(i.key)?.get(e)||0;u.set(e,o||1)}}const f=F(l,t.map(t=>t.key),(t,e)=>c.get(t)?.get(e)||0,a),d="diverging"===a&&!r,g=[],y=new Map,p=new Map,m=new Map,_=new Map;for(const t of l)p.set(t,f.get(t)??0),m.set(t,0),_.set(t,0);for(const o of t){const t=c.get(o.key),i=new Map;let a=[],h=[];const f=()=>{if(a.length>=2){const t={type:"area",topPath:a,bottomPath:h,style:n(o.key,o.data[0]),datum:o.data,group:o.key};s&&(t.curve=s),g.push(t)}a=[],h=[]};for(const o of l){const n=t.has(o);let s,l,c=n?t.get(o):0;if(r&&n&&(c/=u.get(o)),!n||!Number.isFinite(c)||0===c){f();continue}d?c>0?(s=m.get(o),l=s+c,m.set(o,l)):(s=_.get(o),l=s+c,_.set(o,l)):(s=p.get(o),l=s+c,p.set(o,l));const g=e.x(o);h.push([g,e.y(s)]),a.push([g,e.y(l)]),i.set(o,l)}f(),y.set(o.key,i)}return{nodes:g,stackedTops:y}}function D(t,e,o,i,n,r,s){const a=o(t),h=i(t);if(!Number.isFinite(a)||!Number.isFinite(h))return null;const l={type:"point",x:e.x(a),y:e.y(h),r:n,style:r,datum:t};return void 0!==s&&(l.pointId=s),l}function X(t,e,o,i,n,r,s,a){const h=o(t),l=i(t);if(!Number.isFinite(h)||!Number.isFinite(l))return null;const c={type:"symbol",x:e.x(h),y:e.y(l),size:n,symbolType:r,style:s,datum:t};return void 0!==a&&(c.pointId=a),c}function z(t,e,o,i,n,r,s){return{type:"rect",x:t,y:e,w:o,h:i,style:n,datum:r,group:s}}function M(t,e,o,i,n,r,s){const a={type:"heatcell",x:t,y:e,w:o,h:i,fill:n,datum:r};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}export{h as DataSourceAdapter,a as IncrementalExtent,m as toIdSet,Y as buildLineNode,S as buildAreaNode,F as computeStackOffsets,P as computeDivergingStackExtent,B as buildStackedAreaNodes,D as buildPointNode,X as buildSymbolNode,z as buildRectNode,M as buildHeatcellNode,c as normalizeGradient,u as normalizeColorGradient,f as normalizeSemanticGradient,d as reverseGradient,_ as snapXYIntroTargets,k as snapOrdinalIntroTargets,v as ticksForMode,g as resolveFrameGraphics,y as resolveAnnotationAccessor,p as buildEnrichAnnotationData,w as barCanvasRenderer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),n=new Set(["label","callout","callout-circle","callout-rect"]);function t(e){return"string"==typeof e?.type?e.type:""}function a(n){return!!n&&"object"==typeof n&&e.has(t(n))}function i(e){return n.has(t(e))&&!function(e){return Array.isArray(e?.disable)&&e.disable.includes("connector")}(e)}var r=2e4;function o(e){return"primary"===e?.emphasis||!0===e?.defensive}function s(e,n,t={}){return"number"==typeof t.maxAnnotations&&Number.isFinite(t.maxAnnotations)?Math.max(0,Math.floor(t.maxAnnotations)):e>0&&n>0?Math.max(1,Math.round(e*n/(t.areaPerAnnotation&&t.areaPerAnnotation>0?t.areaPerAnnotation:2e4))):1/0}function c(e){let n;const t=e?.emphasis;n="primary"===t?100:"secondary"===t?10:50;const a=e?.provenance?.confidence;switch("number"==typeof a&&Number.isFinite(a)&&(n+=15*Math.max(0,Math.min(1,a))),e?.lifecycle?.freshness){case"fresh":n+=8;break;case"aging":n+=4;break;case"stale":n+=1;break;case"expired":n-=200}return n}function l(e){const{annotations:n,width:t,height:i}=e,r=Math.max(0,e.minVisible??1),l=s(t,i,e),u=n.map((e,n)=>{return{annotation:e,index:n,note:(t=e,a(t))};var t}),h=u.filter(e=>e.note);if(0===h.length||l>=h.length)return{visible:n.slice(),deferred:[],budget:l};const f=h.filter(e=>o(e.annotation)),m=h.filter(e=>!o(e.annotation)).sort((e,n)=>c(n.annotation)-c(e.annotation)||e.index-n.index),d=Math.min(m.length,Math.max(Math.max(0,l-f.length),Math.max(0,r-f.length))),x=new Set([...f.map(e=>e.index),...m.slice(0,d).map(e=>e.index)]),p=[],b=[];for(const{annotation:e,index:n,note:t}of u)!t||x.has(n)?p.push(e):b.push(e);return{visible:p,deferred:b,budget:l}}export{t as annotationType,a as isNoteAnnotation,i as annotationDrawsConnector,r as DEFAULT_AREA_PER_ANNOTATION,s as annotationBudget,l as annotationDensity};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import*as e from"react";import{jsx as t,jsxs as n}from"react/jsx-runtime";function a(e,t,n=0){const a=Math.min(t[0],t[1]),i=Math.max(t[0],t[1]),o=Math.max(a,Math.min(i,e[0])),r=Math.max(a,Math.min(i,e[1])),l=o>r?[r,o]:[o,r];if(l[1]-l[0]>=n)return l;const s=(l[0]+l[1])/2,d=n/2;return[Math.max(a,Math.min(i-n,s-d)),Math.min(i,Math.max(a+n,s+d))]}function i(e,t,n,i=1,o=i){const r="in"===n?i:-i;return a([e[0]+r,e[1]-r],t,o)}function o(t){const{domain:n,initialValue:o=n,step:r=1,minSpan:l=r,label:s,formatValue:d,onChange:u}=t,[c,m]=e.useState(()=>a(o,n,l)),h=a(c,n,l),b=e.useCallback(e=>{const t=a(e,n,l);m(t),u?.(t)},[n,l,u]),g=e.useMemo(()=>({label:s,domain:n,value:h,step:r,formatValue:d,onChange:b,onClear:()=>b(n)}),[n,d,s,b,r,h]),p=e.useMemo(()=>({onZoomIn:()=>b(i(h,n,"in",r,l)),onZoomOut:()=>b(i(h,n,"out",r,l)),onReset:()=>b(n)}),[n,l,b,r,h]);return{value:h,setValue:b,xExtent:h,brush:g,zoom:p}}var r={display:"grid",gap:8,padding:"10px 12px",border:"1px solid var(--semiotic-border, #d8dee4)",borderRadius:12,background:"var(--semiotic-surface, var(--semiotic-bg, rgba(255,255,255,0.92)))"},l={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function s(e,t){return{minWidth:e,minHeight:e,padding:"0 12px",borderRadius:999,border:"1px solid var(--semiotic-border, #d8dee4)",background:t?"var(--semiotic-primary, #0969da)":"var(--semiotic-bg, #fff)",color:t?"var(--semiotic-bg, #fff)":"var(--semiotic-text, #24292f)",fontSize:13,fontWeight:650,touchAction:"manipulation"}}function d(e){return"function"==typeof e}function u({brush:e,targetSize:a}){const i=e?.value,o=e?.domain,u=!!i&&!!o,c=!0===e?.disabled,m=e?.formatValue??(e=>e),h=!!e?.onChange&&u&&!c,b=o?.[0]??0,g=o?.[1]??1,p=i?.[0]??b,y=i?.[1]??g,f=e?.step??((g-b)/100||1);return n("section",{style:r,"aria-label":"Brush controls",children:[t("div",{style:l,children:e?.label??"Filter range"}),u?n("div",{style:{display:"grid",gap:8},children:[n("label",{style:{display:"grid",gap:4,fontSize:12},children:[n("span",{children:["Start: ",m(p)]}),t("input",{type:"range",min:b,max:g,step:f,value:p,disabled:!h,style:{minHeight:a},onChange:t=>{const n=Number(t.currentTarget.value);e?.onChange?.([Math.min(n,y),y])}})]}),n("label",{style:{display:"grid",gap:4,fontSize:12},children:[n("span",{children:["End: ",m(y)]}),t("input",{type:"range",min:b,max:g,step:f,value:y,disabled:!h,style:{minHeight:a},onChange:t=>{const n=Number(t.currentTarget.value);e?.onChange?.([p,Math.max(n,p)])}})]})]}):t("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),t("button",{type:"button",disabled:c||!d(e?.onClear),onClick:e?.onClear,style:s(a),children:"Clear range"})]})}function c({zoom:e,targetSize:a}){const i=!0===e?.disabled;return n("section",{style:r,"aria-label":"Zoom controls",children:[t("div",{style:l,children:e?.label??"Zoom"}),n("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[t("button",{type:"button","aria-label":"Zoom out",disabled:i||!d(e?.onZoomOut),onClick:e?.onZoomOut,style:s(a),children:"-"}),t("button",{type:"button","aria-label":"Reset zoom",disabled:i||!d(e?.onReset),onClick:e?.onReset,style:s(a),children:"Reset"}),t("button",{type:"button","aria-label":"Zoom in",disabled:i||!d(e?.onZoomIn),onClick:e?.onZoomIn,style:s(a),children:"+"})]})]})}function m({legend:e,targetSize:a}){const i=!0===e?.disabled,o=e?.items??[];return n("section",{style:r,"aria-label":"Legend controls",children:[t("div",{style:l,children:e?.label??"Series"}),o.length>0&&t("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:o.map(o=>{const r=!1!==o.active;return n("button",{type:"button",disabled:i||o.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(o.id,!r),style:s(a,r),"aria-pressed":r,children:[o.color&&t("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:o.color}}),o.label??o.id]},o.id)})}),n("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[t("button",{type:"button",disabled:i||!d(e?.onShowAll),onClick:e?.onShowAll,style:s(a),children:"Show all"}),t("button",{type:"button",disabled:i||!d(e?.onHideAll),onClick:e?.onHideAll,style:s(a),children:"Hide all"})]})]})}function h({controls:e,targetSize:a=44,compact:i=!1,className:o,style:r,ariaLabel:l="Mobile chart controls",brush:s,zoom:d,legend:h}){const b=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const n=[];return t.brush&&n.push("brush"),t.zoom&&n.push("zoom"),t.legend&&n.push("legend"),n}(e,{brush:s,zoom:d,legend:h});return 0===b.length?null:n("div",{className:o,role:"group","aria-label":l,style:{display:"grid",gridTemplateColumns:i?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...r},children:[b.includes("brush")&&t(u,{brush:s,targetSize:a}),b.includes("zoom")&&t(c,{zoom:d,targetSize:a}),b.includes("legend")&&t(m,{legend:h,targetSize:a})]})}export{a as clampMobileRange,i as zoomMobileRange,o as useMobileRangeControls,h as MobileStandardControls};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{buildNavGraph as t,extractGeoNavPoints as e,extractOrdinalNavPoints as r,extractXYNavPoints as n,navPointToHover as i,nextGraphIndex as s,nextIndex as o,renderCirclePulse as c,resolvePosition as u}from"./chunk-chunk-DVCWU7MT.module.min.js";import{emitClickObservations as a,emitHoverObservations as l,isInteractiveKeyboardTarget as f,resolveCanvasFill as h}from"./chunk-chunk-SK2TQMG4.module.min.js";var p=class{constructor(t){if(this._capacity=t,this.head=0,this._size=0,1>t)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(t)}push(t){let e;return this._size===this._capacity?e=this.buffer[this.head]:this._size++,this.buffer[this.head]=t,this.head=(this.head+1)%this._capacity,e}pushMany(t){const e=[];for(const r of t){const t=this.push(r);void 0!==t&&e.push(t)}return e}get(t){if(t>=0&&this._size>t)return this.buffer[(this.head-this._size+t+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let t=0;return{next:()=>this._size>t?{done:!1,value:this.get(t++)}:{done:!0,value:void 0}}}forEach(t){const e=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++)t(this.buffer[(e+r)%this._capacity],r)}toArray(){const t=Array(this._size),e=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++)t[r]=this.buffer[(e+r)%this._capacity];return t}resize(t){if(1>t)throw Error("RingBuffer capacity must be at least 1");const e=this.toArray();let r=0,n=[];e.length>t&&(r=e.length-t,n=e.slice(0,r)),this._capacity=t,this.buffer=Array(t),this.head=0,this._size=0;for(let t=r;e.length>t;t++)this.push(e[t]);return n}update(t,e){const r=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const s=(n+i)%this._capacity,o=this.buffer[s];if(t(o)){let t;t="object"!=typeof o||null===o?o:Array.isArray(o)?[...o]:{...o},r.push(t),this.buffer[s]=e(o)}}return r}remove(t){const e=[],r=[];if(this.forEach(n=>{t(n)?r.push(n):e.push(n)}),0===r.length)return r;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const t of e)this.push(t);return r}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}};function y(t,e,r,n){return"function"==typeof e.style?e.style(n||{},r):e.style&&"object"==typeof e.style?e.style:t.resolveBoundsStyle(r,n)}function d(t,e,r,n){if(!t.scales)return null;const i=[],s=[];for(const r of e){const e=t.getX(r);if(!Number.isFinite(e))continue;const o=n.getTop(r),c=n.getBottom(r);if(!Number.isFinite(o)||!Number.isFinite(c))continue;const u=t.scales.x(e),a=t.scales.y(o),l=t.scales.y(c);Number.isFinite(u)&&Number.isFinite(a)&&Number.isFinite(l)&&(i.push([u,a]),s.push([u,l]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:s,...t.config.curve&&"linear"!==t.config.curve&&{curve:t.config.curve},style:y(t,n,r,e[0]),datum:e,group:r,interactive:n.interactive}}function v(t){const e=[],r=[];if(!t)return{perSeries:e,aggregate:r};for(const n of t)n.perSeries?e.push(n):r.push(n);return{perSeries:e,aggregate:r}}function _(t,e,r){const n=[];for(const i of r){const r=d(t,e,"__ribbon_aggregate",i);r&&n.push(r)}return n}function g(t,e,r,n){const i=[];for(const s of n){const n=d(t,e,r,s);n&&i.push(n)}return i}function m(t,e){if(!t)return{};if(!e||0===e.length)return t;const r=[];for(const n of e){if("band"!==n.kind)continue;const e=n.getTop(t),i=n.getBottom(t);Number.isFinite(i)&&Number.isFinite(e)&&r.push({y0:i,y1:e})}return 0===r.length?t:{...t,band:r[0],bands:r}}function b(t,e,r,n){const i=n.current,s=!0===t.lastCustomLayoutFailure?.preservedLastGoodScene,o=!s&&t.hasActivePulsesAt(e),c=!(r||s||!o&&!i)&&t.refreshPulse(e);return n.current=o,{changed:c,pending:o}}import{useCallback as k,useRef as z}from"react";function A(t,e,r,n){const i=z({accessor:e,onChange:r,readData:n}),s=z([]);return i.current={accessor:e,onChange:r,readData:n},k(()=>{const{accessor:e,onChange:r,readData:n}=i.current;if(!r||!e)return;const o=function(t,e){if(!e)return[];const r=new Set,n=[];for(const i of t){if(!i||"object"!=typeof i)continue;const t="function"==typeof e?e(i):i[e];if(null==t)continue;const s=t+"";r.has(s)||(r.add(s),n.push(s))}return n}(t.current?n(t.current):[],e);(function(t,e){if(t.length!==e.length)return!1;for(let r=0;t.length>r;r++)if(t[r]!==e[r])return!1;return!0})(o,s.current)||(s.current=o,r(o))},[t])}var w=(t,e,r,n)=>{const i=e.filter(t=>"point"===t.type);if(0!==i.length){t.save();try{const e=t.globalAlpha;for(const r of i)t.beginPath(),t.arc(r.x,r.y,r.r,0,2*Math.PI),t.globalAlpha=e*(r.style.opacity??r.style.fillOpacity??1),t.fillStyle=h(t,r.style.fill,"#4e79a7"),t.fill(),r.style.stroke&&"none"!==r.style.stroke&&(t.strokeStyle=h(t,r.style.stroke,r.style.stroke),t.lineWidth=r.style.strokeWidth||1,t.stroke()),c(t,r)}finally{t.restore()}}};import{useCallback as R}from"react";function x({customHoverBehavior:t,customClickBehavior:e,onObservation:r,chartId:n,chartType:i}){const s=!(!t&&!r),o=!(!e&&!r),c=R((e,s)=>{t?.(e,s),l({onObservation:r,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:i,chartId:n,context:s})},[n,i,t,r]),u=R((t,s)=>{e?.(t,s),a({onObservation:r,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:i,chartId:n,context:s})},[n,i,e,r]);return{customHoverBehavior:s?c:void 0,customClickBehavior:o?u:void 0,hasClickBehavior:o}}import{useCallback as C,useRef as D}from"react";function P({storeRef:e,hoverRef:r,hoveredNodeRef:n,setHoverPoint:i,customHoverBehavior:o,customClickBehavior:c,scheduleRender:a,extractPoints:l,toHover:h}){const p=D(-1),y=D(null),d=D(null),v=C(v=>{if(f(v))return;const _=e.current;if(!_)return;const g=()=>{p.current=-1,y.current=null,r.current=null,n&&(n.current=null),i(null),o?.(null),a()};if(0===_.scene.length)return void(0>p.current||g());let m;if(d.current?.version===_.version)m=d.current.graph;else{const e=l(_.scene);if(0===e.length)return void(0>p.current||g());m=t(e),d.current={version:_.version,graph:m}}let b=p.current;if(m.flat.length>b||(g(),b=-1),("Enter"===v.key||" "===v.key)&&b>=0)return v.preventDefault(),void c?.(h(m.flat[b],_),{type:"activate",inputType:"keyboard"});if(0>b){if("Escape"===v.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(v.key))return;v.preventDefault(),p.current=0;const t=m.flat[0];y.current=t;const e=h(t,_);return r.current=e,i(e),o?.(e,{type:"focus",inputType:"keyboard"}),void a()}const k=s(v.key,u(m,b),m);if(null===k)return;if(v.preventDefault(),0>k)return void g();p.current=k;const z=m.flat[k];y.current=z;const A=h(z,_);r.current=A,i(A),o?.(A,{type:"focus",inputType:"keyboard"}),a()},[c,o,l,r,n,a,i,e,h]);return{kbFocusIndexRef:p,focusedNavPointRef:y,onKeyDown:v}}function B(t){return P({...t,extractPoints:n,toHover:(t,e)=>i({...t,datum:m(t.datum,e.resolvedRibbons)})})}function T({chartType:t,oAccessor:e,rAccessor:n,...s}){return P({...s,extractPoints:r,toHover:r=>({...i(r),__oAccessor:"string"==typeof e?e:void 0,__rAccessor:"string"==typeof n?n:void 0,__chartType:t})})}function N(t){const e=t.datum;return{...e||{},...e?.properties||{},data:e,properties:e?.properties,x:t.x,y:t.y,__semioticHoverData:!0}}function F({storeRef:t,hoverRef:r,hoveredNodeRef:n,setHoverPoint:i,customHoverBehavior:s,customClickBehavior:c,scheduleRender:u}){const a=D(-1),l=D(null),h=C(h=>{if(f(h))return;const p=t.current;if(!p)return;const y=()=>{a.current=-1,l.current=null,r.current=null,n&&(n.current=null),i(null),s?.(null),u()};if(0===p.scene.length)return void(0>a.current||y());const d=e(p.scene);if(0===d.length)return void(0>a.current||y());let v=a.current;if(d.length>v||(y(),v=-1),("Enter"===h.key||" "===h.key)&&v>=0)return h.preventDefault(),void c?.(N(d[v]),{type:"activate",inputType:"keyboard"});const _=o(h.key,0>v?-1:v,d.length);if(null===_)return;if(h.preventDefault(),0>_)return void y();const g=0>v?0:_;a.current=g;const m=d[g];l.current=m;const b=N(m);r.current=b,i(b),s?.(b,{type:"focus",inputType:"keyboard"}),u()},[c,s,r,n,u,i,t]);return{kbFocusIndexRef:a,focusedNavPointRef:l,onKeyDown:h}}function H(t,e,r){const n=t.duration??500,i=r-e;return n>i?1-i/n:0}function S(t,e,r,n,i,s=("undefined"!=typeof performance?performance.now():Date.now())){const o=t.color??"rgba(255,255,255,0.6)",c=t.glowRadius??4;let u=!1;const a=i??(()=>{const t=new Map;for(let e=0;r.length>e;e++)t.set(r[e],e);return t})();for(const r of e){if("line"===r.type)continue;if("area"===r.type){const e=Array.isArray(r.datum)?r.datum:[r.datum];let i=0,c=!1;for(const r of e){const e=a.get(r);if(null==e)continue;c=!0;const o=n.get(e);if(null==o)continue;const u=H(t,o,s);u>i&&(i=u)}c&&(u=E(r,i,o)||u);continue}const e=a.get(r.datum);if(null==e)continue;const i=n.get(e);u=E(r,null==i?0:H(t,i,s),o,c)||u}return u}function E(t,e,r,n){let i=!1;return e>0?(t._pulseIntensity!==e&&(t._pulseIntensity=e,i=!0),t._pulseColor!==r&&(t._pulseColor=r,i=!0),t._pulseGlowRadius!==n&&(t._pulseGlowRadius=n,i=!0),i):(0!==t._pulseIntensity&&(t._pulseIntensity=0,i=!0),void 0!==t._pulseColor&&(t._pulseColor=void 0,i=!0),void 0!==t._pulseGlowRadius&&(t._pulseGlowRadius=void 0,i=!0),i)}function I(t,e,r=("undefined"!=typeof performance?performance.now():Date.now())){if(!e||0===e.size)return!1;const n=t.duration??500,i=e.peek();return null!=i&&n>r-i}function G(t,e,r){e>t.capacity&&(t.resize(e),r&&e>r.capacity&&r.resize(e))}function j(t,e){const r=new p(t.capacity);return t.forEach(()=>r.push(e)),r}function M(t,e,r,n){const i=t.push(e);return r&&r.push(n),i}function O(t,e,r){if(!e||0===e.size)return;const n=new Set;if(t.forEach((t,e)=>{r(t)&&n.add(e)}),0===n.size)return;const i=e.toArray();e.clear();for(let t=0;i.length>t;t++)n.has(t)||e.push(i[t])}export{p as RingBuffer,H as computePulseIntensity,S as applyPulse,E as setPulseState,I as hasActivePulses,v as partitionRibbons,_ as buildAggregateRibbons,g as buildPerSeriesRibbons,m as enrichDatumWithBand,G as ensureRingBufferCapacity,j as createTimestampBufferForData,M as pushWithTimestamp,O as compactTimestampBufferForRemoval,b as refreshIdlePulse,A as useLegendCategoryEmission,w as pointCanvasRenderer,x as useSemanticFrameInteractions,B as useXYKeyboardNavigation,T as useOrdinalKeyboardNavigation,F as useGeoKeyboardNavigation};
|