semiotic 3.9.1 → 3.9.2
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 +102 -48
- package/agent-skill/semiotic-charts/SKILL.md +14 -10
- package/ai/componentMetadata.cjs +13 -3
- package/ai/dist/mcp-server.js +140 -36407
- package/ai/examples.md +109 -6
- package/ai/reference.md +55 -18
- package/ai/schema.json +5964 -1190
- package/ai/surface-manifest.json +51 -7
- package/ai/system-prompt.md +16 -3
- package/dist/c-3SCUN5HI.min.js +1 -0
- package/dist/c-3VVKFA4M.min.js +1 -0
- package/dist/c-43TJZS3F.min.js +1 -0
- package/dist/c-4DTZPSUD.min.js +1 -0
- package/dist/c-4ES5367Y.min.js +1 -0
- package/dist/c-54IRWOGM.min.js +1 -0
- package/dist/c-5D2S4RMI.min.js +1 -0
- package/dist/c-5JWCTX3G.min.js +1 -0
- package/dist/c-6CMMSN6N.min.js +1 -0
- package/dist/c-6HRB2L7H.min.js +1 -0
- package/dist/c-7W4SV36A.min.js +1 -0
- package/dist/c-A4WRGZFX.min.js +1 -0
- package/dist/c-AG7WWVIH.min.js +1 -0
- package/dist/c-AH6J4MTN.min.js +1 -0
- package/dist/c-ALYR5LKK.min.js +1 -0
- package/dist/c-BYDPC44I.min.js +1 -0
- package/dist/c-CFFIU2MW.min.js +1 -0
- package/dist/c-CGNHBHCE.min.js +1 -0
- package/dist/c-CJYSXIFV.min.js +1 -0
- package/dist/c-CKLIFCGN.min.js +1 -0
- package/dist/c-CZF7MV67.min.js +1 -0
- package/dist/c-D53OKBSY.min.js +1 -0
- package/dist/c-DBQ2V7CH.min.js +1 -0
- package/dist/c-DPMVAUAW.min.js +1 -0
- package/dist/c-ECJCKLYY.min.js +1 -0
- package/dist/c-EGATGOWJ.min.js +1 -0
- package/dist/c-EGR6VYBW.min.js +1 -0
- package/dist/c-ENF72HU5.min.js +1 -0
- package/dist/c-ESNR43AN.min.js +1 -0
- package/dist/c-F3LIKINL.min.js +1 -0
- package/dist/c-F5ZB5GJ6.min.js +1 -0
- package/dist/c-G3VYMHKE.min.js +1 -0
- package/dist/c-GR6MOEQC.min.js +1 -0
- package/dist/c-GSVCN34B.min.js +1 -0
- package/dist/c-GYOQCEFP.min.js +1 -0
- package/dist/c-H3DNMTCC.min.js +1 -0
- package/dist/c-I6J3FEZE.min.js +1 -0
- package/dist/c-IGH6MGJ5.min.js +1 -0
- package/dist/c-II2EEAJN.min.js +1 -0
- package/dist/c-J6M4JHRS.min.js +1 -0
- package/dist/c-JM3MGLQV.min.js +1 -0
- package/dist/c-KM3N7F7R.min.js +1 -0
- package/dist/c-LF5BZFNC.min.js +1 -0
- package/dist/c-LKBSGFQC.min.js +1 -0
- package/dist/c-NDJADPIF.min.js +1 -0
- package/dist/c-NVPQCIL5.min.js +1 -0
- package/dist/c-OFWJBEE5.min.js +1 -0
- package/dist/c-OYFHP5F5.min.js +1 -0
- package/dist/c-PGKQGGQ2.min.js +1 -0
- package/dist/c-Q2IPZ3MU.min.js +1 -0
- package/dist/c-QKHMBE2E.min.js +1 -0
- package/dist/c-QMVM3AY6.min.js +1 -0
- package/dist/c-QSGWX53A.min.js +1 -0
- package/dist/c-RJKEKZOO.min.js +1 -0
- package/dist/c-SFDIIU5G.min.js +1 -0
- package/dist/c-SRTBCRVE.min.js +1 -0
- package/dist/c-T6UAIKBH.min.js +1 -0
- package/dist/c-TMCTEVVW.min.js +1 -0
- package/dist/c-TMOSJLT3.min.js +1 -0
- package/dist/c-U6ESPM7V.min.js +1 -0
- package/dist/c-UC5PTTFI.min.js +1 -0
- package/dist/c-VGKUEZBC.min.js +1 -0
- package/dist/c-VN2HG5BS.min.js +1 -0
- package/dist/{c-J5G56TUH.min.js → c-VPZDY5Q4.min.js} +1 -1
- package/dist/c-VRXUB2F2.min.js +1 -0
- package/dist/c-VUBQNQJH.min.js +1 -0
- package/dist/c-VUH4PGZY.min.js +1 -0
- package/dist/c-XDRV7RKW.min.js +1 -0
- package/dist/c-YGZHURXZ.min.js +1 -0
- package/dist/components/Annotation.d.ts +1 -1
- package/dist/components/access/chartAccessCapabilities.generated.d.ts +14 -0
- package/dist/components/access/chartAccessContract.d.ts +90 -0
- package/dist/components/access/chartAccessContractFixtures.d.ts +11 -0
- package/dist/components/ai/aestheticProfileTypes.d.ts +35 -0
- package/dist/components/ai/annotationProvenance.d.ts +2 -7
- package/dist/components/ai/auditVisualHierarchy.d.ts +49 -0
- package/dist/components/ai/builtInChartRecipeLayouts.d.ts +2 -0
- package/dist/components/ai/builtInChartRecipePublic.d.ts +4 -0
- package/dist/components/ai/builtInChartRecipes.d.ts +26 -0
- package/dist/components/ai/chartCapabilities.d.ts +3 -1
- package/dist/components/ai/chartRecipeRegistry.d.ts +2 -1
- package/dist/components/ai/chartRecipes.d.ts +6 -0
- package/dist/components/ai/colorEvidence.d.ts +12 -0
- package/dist/components/ai/evaluateAesthetics.d.ts +47 -0
- package/dist/components/ai/geoNavigation.d.ts +4 -0
- package/dist/components/ai/hierarchyNavigation.d.ts +4 -0
- package/dist/components/ai/navigationTree.d.ts +7 -1
- package/dist/components/ai/qualityFixtures.d.ts +8 -0
- package/dist/components/ai/suggestionPropContracts.d.ts +1 -1
- package/dist/components/ai/useNavigationSync.d.ts +3 -3
- package/dist/components/charts/index.d.ts +4 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +5 -1
- package/dist/components/charts/network/CirclePack.d.ts +8 -1
- package/dist/components/charts/network/OrbitDiagram.d.ts +9 -0
- package/dist/components/charts/network/TreeDiagram.d.ts +8 -1
- package/dist/components/charts/network/Treemap.d.ts +8 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +6 -0
- package/dist/components/charts/ordinal/BoxPlot.d.ts +3 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +3 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +3 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +3 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +3 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +3 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +3 -0
- package/dist/components/charts/ordinal/RadarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/RadarChart.d.ts +75 -0
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +3 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +3 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +3 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +3 -0
- package/dist/components/charts/physics/GauntletChart.d.ts +1 -5
- package/dist/components/charts/physics/chainReactionTypes.d.ts +3 -0
- package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +7 -1
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +10 -1
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +11 -1
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +14 -5
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +7 -1
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +7 -1
- package/dist/components/charts/realtime/aggregate.d.ts +12 -1
- package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +4 -2
- package/dist/components/charts/realtime/realtimeStyleRules.d.ts +4 -0
- package/dist/components/charts/shared/annotationStatusFilter.d.ts +18 -0
- package/dist/components/charts/shared/chartDefinitionPilot.d.ts +5 -4
- package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
- package/dist/components/charts/shared/heatmapStyleRules.d.ts +13 -0
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/charts/shared/networkUtils.d.ts +14 -0
- package/dist/components/charts/shared/selectionUtils.d.ts +3 -1
- package/dist/components/charts/shared/types.d.ts +4 -2
- package/dist/components/charts/shared/useChartLegend.d.ts +2 -1
- package/dist/components/charts/shared/useLikertAggregation.d.ts +8 -2
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +9 -5
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
- package/dist/components/charts/shared/useXYBrush.d.ts +24 -0
- package/dist/components/charts/xy/Heatmap.d.ts +16 -0
- package/dist/components/charts/xy/LineChart.d.ts +9 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +7 -0
- package/dist/components/charts/xy/WaterfallChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/WaterfallChart.d.ts +68 -0
- package/dist/components/evidence/chartEvidenceEnvelope.d.ts +146 -0
- package/dist/components/evidence/evidenceGate.d.ts +28 -0
- package/dist/components/realtime/BinAccumulator.d.ts +5 -1
- package/dist/components/realtime/types.d.ts +16 -7
- package/dist/components/recipes/adjacencyFlow.d.ts +12 -0
- package/dist/components/recipes/adjacencyFlowAggregation.d.ts +72 -0
- package/dist/components/recipes/adjacencyFlowGeometry.d.ts +79 -0
- package/dist/components/recipes/lineageDag.d.ts +17 -0
- package/dist/components/recipes/lineageDagHulls.d.ts +22 -0
- package/dist/components/recipes/transitDiagram.d.ts +75 -0
- package/dist/components/recipes/transitDiagramGeometry.d.ts +47 -0
- package/dist/components/semiotic-access.d.ts +9 -0
- package/dist/components/semiotic-ai-audits.d.ts +17 -0
- package/dist/components/semiotic-ai-core.d.ts +9 -0
- package/dist/components/semiotic-ai.d.ts +5 -17
- package/dist/components/semiotic-evidence.d.ts +10 -0
- package/dist/components/semiotic-line.d.ts +9 -0
- package/dist/components/semiotic-network.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-realtime-core.d.ts +3 -2
- package/dist/components/semiotic-recipes-core.d.ts +6 -0
- package/dist/components/semiotic-themes-core.d.ts +3 -0
- package/dist/components/semiotic-utils-core.d.ts +5 -0
- package/dist/components/semiotic-xy.d.ts +3 -0
- package/dist/components/semiotic.d.ts +9 -3
- package/dist/components/server/renderDashboard.d.ts +37 -0
- package/dist/components/server/renderEvidence.d.ts +27 -0
- package/dist/components/server/renderToStaticSVG.d.ts +2 -30
- package/dist/components/server/serverChartConfigShared.d.ts +13 -0
- package/dist/components/server/serverChartConfigs.d.ts +9 -0
- package/dist/components/server/serverChartConfigsComposite.d.ts +4 -0
- package/dist/components/server/serverChartConfigsCustom.d.ts +2 -0
- package/dist/components/server/serverChartConfigsGeo.d.ts +1 -0
- package/dist/components/server/serverChartConfigsOrdinal.d.ts +3 -2
- package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
- package/dist/components/server/serverChartConfigsXYExtra.d.ts +3 -0
- package/dist/components/server/serverCompositeChainReaction.d.ts +3 -0
- package/dist/components/server/serverOrdinalGauge.d.ts +3 -0
- package/dist/components/server/serverOrdinalLikert.d.ts +2 -0
- package/dist/components/store/selectionProvenance.d.ts +8 -0
- package/dist/components/store/themeCore.d.ts +5 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +1 -1
- package/dist/components/stream/MarginalGraphics.d.ts +3 -3
- package/dist/components/stream/MarginalGraphicsLazy.d.ts +22 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +2 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +1 -1
- package/dist/components/stream/PipelineStore.d.ts +1 -1
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/canvasSetup.d.ts +8 -2
- package/dist/components/stream/customLayoutAttempt.d.ts +21 -0
- package/dist/components/stream/geoTypes.d.ts +1 -1
- package/dist/components/stream/isServerEnvironment.d.ts +6 -0
- package/dist/components/stream/layouts/forceLayoutNodeSize.d.ts +12 -0
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +2 -9
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +2 -21
- package/dist/components/stream/layouts/forceLayoutWorkerPolicy.d.ts +21 -0
- package/dist/components/stream/layouts/index.d.ts +6 -12
- package/dist/components/stream/layouts/missingPlugin.d.ts +7 -0
- package/dist/components/stream/layouts/registerBuiltIn.d.ts +1 -0
- package/dist/components/stream/layouts/registry.d.ts +12 -0
- package/dist/components/stream/marginalConfig.d.ts +3 -0
- package/dist/components/stream/networkCustomLayout.d.ts +7 -0
- package/dist/components/stream/networkCustomLayoutOutput.d.ts +13 -0
- package/dist/components/stream/networkCustomLayoutRunner.d.ts +1 -1
- package/dist/components/stream/networkTypes.d.ts +5 -1
- package/dist/components/stream/ordinalTypes.d.ts +1 -1
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +1 -1
- package/dist/components/stream/pipelineDomainResolution.d.ts +6 -0
- package/dist/components/stream/renderers/pointCanvasRenderer.d.ts +4 -0
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +4 -4
- package/dist/components/stream/types.d.ts +8 -1
- package/dist/components/stream/useEnsureCustomXYRenderers.d.ts +18 -0
- package/dist/components/stream/useMarginalValues.d.ts +13 -0
- package/dist/components/stream/xyCanvasRenderers.d.ts +4 -4
- package/dist/components/stream/xyPlugins/areaPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/barPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/candlestickPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/customPlugin.d.ts +6 -0
- package/dist/components/stream/xyPlugins/heatmapPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/lineFamily.d.ts +5 -0
- package/dist/components/stream/xyPlugins/linePlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/missingPlugin.d.ts +7 -0
- package/dist/components/stream/xyPlugins/mixedPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/pointPlugin.d.ts +3 -0
- package/dist/components/stream/xyPlugins/registerBuiltIn.d.ts +1 -0
- package/dist/components/stream/xyPlugins/registry.d.ts +31 -0
- package/dist/components/stream/xyPlugins/stackedAreaPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/swarmPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/waterfallPlugin.d.ts +2 -0
- package/dist/forceLayoutWorker.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-access.d.ts +9 -0
- package/dist/semiotic-access.min.js +2 -0
- package/dist/semiotic-access.module.min.js +2 -0
- package/dist/semiotic-ai-core.d.ts +9 -0
- 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 +5 -17
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-client-cjs-shared.min.js +1 -1
- package/dist/semiotic-client-shared.module.min.js +1 -1
- package/dist/semiotic-evidence.d.ts +10 -0
- package/dist/semiotic-evidence.min.js +1 -0
- package/dist/semiotic-evidence.module.min.js +1 -0
- package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
- package/dist/semiotic-experimental-vacp.min.js +1 -1
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-line.d.ts +9 -0
- package/dist/semiotic-line.min.js +2 -0
- package/dist/semiotic-line.module.min.js +2 -0
- package/dist/semiotic-network.d.ts +3 -0
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-realtime-core.d.ts +3 -2
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +6 -0
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-server-edge-node.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-themes-core.d.ts +3 -0
- package/dist/semiotic-themes-core.min.js +1 -1
- package/dist/semiotic-themes-core.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 +5 -0
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +3 -0
- package/dist/semiotic.d.ts +9 -3
- 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.module.min.js +1 -1
- package/package.json +39 -60
- package/dist/c-3KZD6AXJ.min.js +0 -1
- package/dist/c-4TWEX5HG.min.js +0 -1
- package/dist/c-5YCIX3VZ.min.js +0 -1
- package/dist/c-6FEKTA3U.min.js +0 -1
- package/dist/c-74HEEZGK.min.js +0 -1
- package/dist/c-BWNB6USU.min.js +0 -1
- package/dist/c-C25ENHIK.min.js +0 -1
- package/dist/c-CDR5AO3R.min.js +0 -1
- package/dist/c-E3JFRRMI.min.js +0 -1
- package/dist/c-EBFPQHHO.min.js +0 -1
- package/dist/c-GIKRQI4X.min.js +0 -1
- package/dist/c-GPYOFETM.min.js +0 -1
- package/dist/c-IDUHYYSI.min.js +0 -1
- package/dist/c-JAZ73J32.min.js +0 -1
- package/dist/c-KG3NXHAL.min.js +0 -1
- package/dist/c-KII3PLZE.min.js +0 -1
- package/dist/c-LIXGXMNS.min.js +0 -1
- package/dist/c-LVEY6D6B.min.js +0 -1
- package/dist/c-M4Y3BHFR.min.js +0 -1
- package/dist/c-MAIICR2Z.min.js +0 -1
- package/dist/c-MG5DM6VE.min.js +0 -1
- package/dist/c-O6U6K4CW.min.js +0 -1
- package/dist/c-OQ7M4AGV.min.js +0 -1
- package/dist/c-OXYMVK7Q.min.js +0 -1
- package/dist/c-QHF5YON3.min.js +0 -1
- package/dist/c-RR3GO5SW.min.js +0 -1
- package/dist/c-S2BXNNJN.min.js +0 -1
- package/dist/c-SUILCHWU.min.js +0 -1
- package/dist/c-US5ZFT6E.min.js +0 -1
- package/dist/c-UUKVD4WB.min.js +0 -1
- package/dist/c-WJCD5EUY.min.js +0 -1
- package/dist/c-YDAY2WFR.min.js +0 -1
- package/dist/c-ZOWWU34K.min.js +0 -1
- /package/dist/{c-COHXCW3Q.min.js → c-YZVRZGX2.min.js} +0 -0
package/dist/c-KII3PLZE.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{buildRegressionAnnotation as e}from"./c-SLGMUBUL.min.js";import{validateArrayData as t}from"./c-RSVIHIQ4.min.js";import{DefaultTooltip as o,StreamXYFrame_default as i}from"./c-UUKVD4WB.min.js";import{normalizeColorGradient as n,normalizeGradient as r,normalizeSemanticGradient as a,reverseGradient as s,semanticLineStopsForGradient as l}from"./c-C25ENHIK.min.js";import{mergeShapeStyle as c,normalizePartialMargin as h,useChartSetup as d,useCustomChartSetup as m,useFrameImperativeHandle as u,useResolvedSelection as p}from"./c-3KZD6AXJ.min.js";import{accessorName as y,bandTooltipFields as f,buildBaseMetadataProps as g,buildCustomBehaviorProps as b,buildDefaultTooltip as x,buildTooltipProps as v}from"./c-GPYOFETM.min.js";import{useCustomLayoutSelection as A}from"./c-G36WS6LN.min.js";import{makeXYRuleContext as w,resolveStyleRules as S}from"./c-S2BXNNJN.min.js";import{AccessibleDataTable as k,AccessibleTablePortal as C,COLOR_SCHEMES as L,ChartError as R,DEFAULT_COLOR as _,DEFAULT_COLORS as H,DEFAULT_SELECTION_OPACITY as I,FlippingTooltip as P,LinkedCharts as B,MultiPointTooltip as F,SafeRender as D,ScreenReaderSummary as N,SkipToTableLink as M,TooltipRoot as T,composeLegendConfigs as W,defaultTooltipStyle as O,filterSparseArray as E,getColor as j,getCrosshairProps as G,getSequentialInterpolator as z,getSize as V,interpolateViridis as $,isMultiTooltip as X,isMultiTooltipConfig as Q,normalizeLinkedBrush as Y,normalizeTooltip as q,renderEmptyState as K,renderLoadingState as U,resolveDefaultFill as J,resolveExplicitColor as Z,resolveMobileInteraction as ee,resolveMultiCapableTooltip as te,resolveXYFramePropsAxisChrome as oe,useBrushSelection as ie,useChartLegendAndMargin as ne,useChartMode as re,useChartSelection as ae,useColorScale as se,useLegendInteraction as le,useSelection as ce,useThemeCategorical as he,useThemeSequential as de,warnMissingField as me,wrapStyleWithSelection as ue}from"./c-GIKRQI4X.min.js";import{useSelectionSelector as pe,useTheme as ye}from"./c-YDAY2WFR.min.js";import{getMax as fe,getMinMax as ge}from"./c-WJCD5EUY.min.js";import*as be from"react";import{useMemo as xe,useCallback as ve,forwardRef as Ae,useRef as we}from"react";import{useMemo as Se}from"react";function ke(e){const{colorBy:t,colorScale:o,color:i,pointRadius:n=5,radiusFn:r,fillOpacity:a=1,fallbackFill:s,baseStyleExtras:l,stroke:h,strokeWidth:d,opacity:m,effectiveSelectionHook:u,resolvedSelection:p,colorDatumAccessor:y,styleRules:f,ruleContext:g}=e,b=Se(()=>e=>{const c="function"==typeof l?l(e):l,h=c?{...c}:{};if(void 0===h.fillOpacity&&(h.fillOpacity=a),void 0===h.fill)if(t){if(o){const i=y?y(e):e;h.fill=j(i,t,o)}}else h.fill=s?s(e):i||_;return void 0===h.r&&(h.r=r?r(e):n),f&&f.length>0&&Object.assign(h,S(e,f,g?g(e):{value:void 0})),h},[t,o,i,n,r,a,s,l,y,f,g]),x=Se(()=>c(b,{stroke:h,strokeWidth:d,opacity:m}),[b,h,d,m]);return Se(()=>ue(x,u??null,p),[x,u,p])}import{useCallback as Ce,useMemo as Le,useRef as Re,useState as _e}from"react";function He(e){const{accessor:t,data:o,isPushMode:i}=e,n=Re(null),[r,a]=_e(0),s=Ce(e=>{if(!i||!t)return;let o=!1;for(const i of e){const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r="number"==typeof e?e:Number(e);Number.isFinite(r)&&(n.current?(n.current[0]>r&&(n.current[0]=r,o=!0),r>n.current[1]&&(n.current[1]=r,o=!0)):(n.current=[r,r],o=!0))}o&&a(e=>e+1)},[i,t]),l=Ce(()=>{i&&(n.current=null,a(e=>e+1))},[i]);return{domain:Le(()=>{if(i)return n.current??void 0;if(!t||0===o.length)return;const e="function"==typeof t?t:e=>e[t];let r=1/0,a=-1/0;for(const t of o){const o=e(t);if(null==o)continue;const i="number"==typeof o?o:Number(o);Number.isFinite(i)&&(r>i&&(r=i),i>a&&(a=i))}return Number.isFinite(r)&&Number.isFinite(a)?[r,a]:void 0},[o,t,i,r]),trackPushed:s,reset:l}}import{useEffect as Ie,useMemo as Pe,useRef as Be,useState as Fe}from"react";var De="__forecastSegment",Ne=null;async function Me(){return Ne||(Ne=await import("./c-MAIICR2Z.min.js")),Ne}var Te="__semiotic_resolvedX",We="__semiotic_resolvedY";function Oe(e){const{data:t,xAccessor:o,yAccessor:i,forecast:n,anomaly:r,groupBy:a}=e,s="string"==typeof o?o:Te,l="string"==typeof i?i:We,c=Pe(()=>{if(!n&&!r)return t;const e="function"==typeof o,a="function"==typeof i;return e||a?t.map(t=>{const n={...t};return e&&(n[Te]=o(t)),a&&(n[We]=i(t)),n}):t},[t,n,r,o,i]),[h,d]=Fe(null),[m,u]=Fe([]),p=Be(n),y=Be(r);return Ie(()=>{if(!n&&!r)return void((p.current||y.current)&&(d(null),u([]),p.current=n,y.current=r));let e=!1;const t=n!==p.current||r!==y.current;if(p.current=n,y.current=r,t&&(d(null),u([])),n){const t=a&&"string"==typeof a&&"object"==typeof n?{...n,_groupBy:a}:n;(async function(...e){return(await Me()).buildForecast(...e)})(c,s,l,t,r).then(t=>{e||(d(t),u(t.annotations))}).catch(()=>{e||(d(null),u([]))})}else r&&async function(...e){return(await Me()).buildAnomalyAnnotations(...e)}(r).then(t=>{e||(d(null),u(t))}).catch(()=>{e||u([])});return()=>{e=!0}},[c,n,r,s,l,a]),{effectiveData:h?h.processedData:t,statisticalAnnotations:m,hasForecast:!!h,xAccessorKey:s,yAccessorKey:l}}import{jsx as Ee}from"react/jsx-runtime";var je=Ae(function(o,n){const r=we(null),a=re(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:s,margin:l,className:c,xFormat:h,yFormat:m,xAccessor:p="x",yAccessor:f="y",xScaleType:A,yScaleType:S,colorBy:k,colorScheme:C,styleRules:L,sizeBy:_,sizeRange:H=[3,15],symbolBy:I,symbolMap:P,pointRadius:B=5,pointOpacity:F=.8,tooltip:N,marginalGraphics:M,pointIdAccessor:T,annotations:W,regression:O,forecast:j,anomaly:G,xExtent:z,yExtent:$,frameProps:X={},selection:Q,linkedHover:q,linkedBrush:K,onObservation:U,onClick:J,hoverHighlight:Z,chartId:ee,loading:te,loadingContent:ne,emptyContent:ae,legendInteraction:se,legendPosition:le,color:ce,stroke:he,strokeWidth:de,opacity:ue}=o,{width:pe,height:ye,enableHover:fe,showGrid:ge,showLegend:Ae,title:Se,description:Ce,summary:Le,accessibleTable:Re,xLabel:_e,yLabel:Ie}=a,Pe=xe(()=>E(s),[s]),Be=void 0===s,{domain:Fe,trackPushed:De,reset:Ne}=He({accessor:_,data:Pe,isPushMode:Be}),Me=ve(e=>{De([e]),r.current?.push(e)},[De]),Te=ve(e=>{De(e),r.current?.pushMany(e)},[De]);u(n,{variant:"xy",frameRef:r,overrides:{push:Me,pushMany:Te,clear:()=>{Ne(),r.current?.clear()}}});const We=d({data:Pe,rawData:s,colorBy:k,colorScheme:C,legendInteraction:se,legendPosition:le,frameLegend:X,selection:Q,linkedHover:q,fallbackFields:k?["string"==typeof k?k:""]:[],unwrapData:!1,onObservation:U,onClick:J,hoverHighlight:Z,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"Scatterplot",chartId:ee,showLegend:Ae,userMargin:l,marginDefaults:a.marginDefaults,loading:te,loadingContent:ne,emptyContent:ae,width:pe,height:ye,hasTitle:!!Se,axisChrome:oe(X,{showAxes:a.showAxes,xLabel:_e,yLabel:Ie})}),je=Y(K),Ge=ie({name:je?.name||"__unused_brush__",xField:je?.xField||("string"==typeof p?p:void 0),yField:je?.yField||("string"==typeof f?f:void 0)}),ze=je?"xyBrush"===Ge.brushInteraction.brush?"xy":"xBrush"===Ge.brushInteraction.brush?"x":"y":void 0,Ve=be.useRef(Ge.brushInteraction);Ve.current=Ge.brushInteraction;const $e=ve(e=>{const t=Ve.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);me("Scatterplot",Pe,"xAccessor",p),me("Scatterplot",Pe,"yAccessor",f);const Xe=xe(()=>_?Fe??[0,1]:void 0,[_,Fe]),Qe=xe(()=>_?e=>V(e,_,H,Xe):void 0,[_,H,Xe]),Ye=xe(()=>w(p,f),[p,f]),qe=ke({colorBy:k,colorScale:We.colorScale,color:ce,pointRadius:B,fillOpacity:F,radiusFn:Qe,stroke:he,strokeWidth:de,opacity:ue,styleRules:L,ruleContext:Ye,effectiveSelectionHook:We.effectiveSelectionHook,resolvedSelection:We.resolvedSelection}),Ke=xe(()=>x([{label:_e||y(p),accessor:p,role:"x",format:h},{label:Ie||y(f),accessor:f,role:"y",format:m},...k?[{label:y(k),accessor:k,role:"color"}]:[],..._?[{label:y(_),accessor:_,role:"size"}]:[]]),[p,f,_e,Ie,k,_,h,m]),{effectiveData:Ue,statisticalAnnotations:Je}=Oe({data:Pe,xAccessor:p,yAccessor:f,forecast:j,anomaly:G}),Ze=xe(()=>{const t=e(O);return t||0!==Je.length?[...t?[t]:[],...W||[],...Je]:W},[O,W,Je]);if(We.earlyReturn)return We.earlyReturn;const et=t({componentName:"Scatterplot",data:s,accessors:{xAccessor:p,yAccessor:f}});if(et)return Ee(R,{componentName:"Scatterplot",message:et,width:pe,height:ye});const tt={chartType:"scatter",...null!=s&&{data:Ue},xAccessor:p,yAccessor:f,xScaleType:A,yScaleType:S,colorAccessor:k||void 0,sizeAccessor:_||void 0,...I&&{symbolAccessor:I},...P&&{symbolMap:P},sizeRange:H,pointStyle:qe,colorScheme:C,size:[pe,ye],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:We.margin,showAxes:a.showAxes,xLabel:_e,yLabel:Ie,xFormat:h,yFormat:m,enableHover:fe,showGrid:ge,...We.legendBehaviorProps,...g({title:Se,description:Ce,summary:Le,accessibleTable:Re,className:c,animate:o.animate,maxDevicePixelRatio:o.maxDevicePixelRatio,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...v({tooltip:N,defaultTooltipContent:Ke}),...b({linkedHover:q,selection:Q,onObservation:U,onClick:J,hoverHighlight:Z,hoverRadius:o.hoverRadius,mobileInteraction:We.mobileInteraction,customHoverBehavior:We.customHoverBehavior,customClickBehavior:We.customClickBehavior}),...M&&{marginalGraphics:M},...T&&{pointIdAccessor:T},...Ze&&Ze.length>0&&{annotations:Ze},...z&&{xExtent:z},...$&&{yExtent:$},...je&&{brush:{dimension:ze},onBrush:$e},...We.crosshairProps,...X};return Ee(D,{componentName:"Scatterplot",width:pe,height:ye,children:Ee(i,{ref:r,...tt})})});je.displayName="Scatterplot";import{useMemo as Ge,forwardRef as ze,useRef as Ve}from"react";import{Fragment as $e,jsx as Xe}from"react/jsx-runtime";function Qe(e,t){return $(1===t?.5:e/(t-1))}var Ye=ze(function(o,n){const r=Ve(null);u(n,{variant:"xy",frameRef:r});const a=re(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:s,margin:l,className:c,xFormat:h,yFormat:m,xAccessor:p="x",yAccessor:f="y",orderAccessor:A,orderLabel:S,styleRules:k,pointRadius:C=4,tooltip:L,pointIdAccessor:_,annotations:H,regression:P,forecast:B,anomaly:F,xExtent:N,yExtent:M,frameProps:T={},selection:W,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:G,chartId:z,loading:V,loadingContent:$,emptyContent:X,legendInteraction:Q,stroke:Y,strokeWidth:q,opacity:K}=o,{width:U,height:J,enableHover:Z,showGrid:ee,title:te,description:ie,summary:ne,accessibleTable:ae,xLabel:se,yLabel:le}=a,{safeData:ce,orderMap:he}=Ge(()=>{const e=s||[],t="function"==typeof p?p:e=>e[p],o="function"==typeof f?f:e=>e[f];let i=e;if(A&&e.length>0){const t="function"==typeof A?A:e=>e[A];i=[...e].sort((e,o)=>{const i=t(e),n=t(o);return(i instanceof Date?i.getTime():+i)-(n instanceof Date?n.getTime():+n)})}const n=new WeakMap;let r=0;for(const e of i){const i=t(e),n=o(e);null!=i&&null!=n&&isFinite(i)&&isFinite(n)&&r++}let a=0;for(const e of i){const i=t(e),s=o(e);null!=i&&null!=s&&isFinite(i)&&isFinite(s)&&n.set(e,{idx:a++,total:r})}return{safeData:i,orderMap:n}},[s,A,p,f]);me("ConnectedScatterplot",ce,"xAccessor",p),me("ConnectedScatterplot",ce,"yAccessor",f);const de=d({data:ce,rawData:s,colorBy:void 0,colorScheme:void 0,legendInteraction:Q,selection:W,linkedHover:O,fallbackFields:[],unwrapData:!1,onObservation:E,onClick:j,hoverHighlight:G,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ConnectedScatterplot",chartId:z,showLegend:void 0,userMargin:l,marginDefaults:a.marginDefaults,loading:V,loadingContent:$,emptyContent:X,width:U,height:J,hasTitle:!!te,axisChrome:oe(T,{showAxes:a.showAxes,xLabel:se,yLabel:le})}),ue=de.resolvedSelection?.unselectedOpacity??I,pe=Ge(()=>(e,t)=>{const o=t.filter(e=>"point"===e.type);if(2>o.length)return;const i=de.effectiveSelectionHook?.isActive,n=de.effectiveSelectionHook?.predicate,r=100>o.length,a=o.length;e.lineCap="round";for(let t=0;a-1>t;t++){const s=o[t],l=o[t+1],c=Qe(t,a),h=!i||!n||n(s.datum??s)||n(l.datum??l),d=i?h?1:ue:1;r&&(e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=C+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=C,e.globalAlpha=d,e.stroke()}e.globalAlpha=1},[C,de.effectiveSelectionHook,ue]),ye=Ge(()=>[pe],[pe]),fe=Ge(()=>(e,t,o)=>{const i=e.filter(e=>"point"===e.type);if(2>i.length)return null;const n=i.length,r=100>n,a=[];for(let e=0;n-1>e;e++){const t=i[e],o=i[e+1],s=Qe(e,n),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);r&&a.push(Xe("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:C+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),a.push(Xe("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:s,strokeWidth:C,strokeLinecap:"round",opacity:l},"seg-"+e))}return Xe($e,{children:a})},[C]),ge=Ge(()=>[fe],[fe]),be=ke({colorScale:void 0,baseStyleExtras:Ge(()=>e=>{const t=he.get(e),o=t?.idx??0,i=t?.total??1;return{fill:i>0?Qe(o,i):"#6366f1",stroke:"white",strokeWidth:1,r:C,fillOpacity:1}},[C,he]),stroke:Y,strokeWidth:q,opacity:K,styleRules:k,ruleContext:Ge(()=>w(p,f),[p,f]),effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection}),xe=S||("string"==typeof A?A:"Order"),ve=Ge(()=>x([{label:se||y(p),accessor:p,role:"x",format:h},{label:le||y(f),accessor:f,role:"y",format:m},...A?[{label:xe,accessor:A,role:"group"}]:[]]),[p,f,se,le,A,xe,h,m]),Ae=t({componentName:"ConnectedScatterplot",data:s,accessors:{xAccessor:p,yAccessor:f}}),{effectiveData:we,statisticalAnnotations:Se}=Oe({data:ce,xAccessor:p,yAccessor:f,forecast:B,anomaly:F});if(de.earlyReturn)return de.earlyReturn;const Ce=e(P),Le=Ce||Se.length>0?[...Ce?[Ce]:[],...H||[],...Se]:H,Re={chartType:"scatter",...null!=s&&{data:we},xAccessor:p,yAccessor:f,pointStyle:be,size:[U,J],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:de.margin,showAxes:a.showAxes,xLabel:se,yLabel:le,xFormat:h,yFormat:m,enableHover:Z,showGrid:ee,...g({title:te,description:ie,summary:ne,accessibleTable:ae,className:c,animate:o.animate,maxDevicePixelRatio:o.maxDevicePixelRatio,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...v({tooltip:L,defaultTooltipContent:ve}),...b({linkedHover:O,selection:W,onObservation:E,onClick:j,hoverHighlight:G,hoverRadius:o.hoverRadius,mobileInteraction:de.mobileInteraction,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior}),..._&&{pointIdAccessor:_},canvasPreRenderers:ye,svgPreRenderers:ge,...Le&&Le.length>0&&{annotations:Le},...N&&{xExtent:N},...M&&{yExtent:M},...de.crosshairProps,...T};return Ae?Xe(R,{componentName:"ConnectedScatterplot",message:Ae,width:U,height:J}):Xe(D,{componentName:"ConnectedScatterplot",width:U,height:J,children:Xe(i,{ref:r,...Re})})});Ye.displayName="ConnectedScatterplot";import{useMemo as qe,useCallback as Ke,useState as Ue,useEffect as Je,forwardRef as Ze,useRef as et}from"react";import{useMemo as tt}from"react";function ot(e){const{lineWidth:t=2,colorBy:o,colorScale:i,color:n,resolveStroke:r,fillArea:a,areaOpacity:s=.3,stroke:l,strokeWidth:h,opacity:d,effectiveSelectionHook:m,resolvedSelection:u,styleRules:p,ruleContext:y}=e,f=tt(()=>function(e){const{lineWidth:t=2,colorBy:o,colorScale:i,color:n,resolveStroke:r,fillArea:a,areaOpacity:s=.3,styleRules:l,ruleContext:c}=e;return(e,h)=>{const d={strokeWidth:t},m=!0===a||Array.isArray(a)&&null!=h&&a.includes(h);let u;return r?u=r(e,h):o?i&&(u=j(e,o,i)):u=n||_,void 0!==u&&(d.stroke=u,m&&(d.fill=u,d.fillOpacity=s)),l?.length&&Object.assign(d,S(e,l,c?c(e,h):{value:void 0,category:h})),d}}({lineWidth:t,colorBy:o,colorScale:i,color:n,resolveStroke:r,fillArea:a,areaOpacity:s,styleRules:p,ruleContext:y}),[t,o,i,n,r,a,s,p,y]),g=tt(()=>c(f,{stroke:l,strokeWidth:h,opacity:d}),[f,l,h,d]);return tt(()=>ue(g,m??null,u),[g,m,u])}import{jsx as it}from"react/jsx-runtime";var nt="__lineObjectSeries",rt=Ze(function(e,o){const r=et(null);u(o,{variant:"xy",frameRef:r});const a=re(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:l,className:c,xFormat:h,yFormat:m,axisExtent:p,xAccessor:g="x",yAccessor:v="y",lineBy:A,lineDataAccessor:S="coordinates",colorBy:k,colorScheme:C,styleRules:L,curve:H="linear",showPoints:I=!1,pointRadius:P=3,fillArea:B=!1,areaOpacity:N=.3,lineWidth:M=2,lineGradient:T,tooltip:O,pointIdAccessor:G,annotations:z,directLabel:V,gapStrategy:$="break",anomaly:X,forecast:Q,band:Y,xExtent:q,yExtent:K,frameProps:U={},selection:J,linkedHover:Z,onObservation:ee,onClick:ie,hoverHighlight:ne,hoverRadius:ae,chartId:se,loading:le,loadingContent:ce,emptyContent:he,legendInteraction:de,legendPosition:ue,legend:pe,xScaleType:ye,yScaleType:fe,color:ge,stroke:be,strokeWidth:xe,opacity:ve}=e,{legend:Ae,...we}=U,Se=qe(()=>W(Ae,pe),[Ae,pe]),{width:ke,height:Ce,enableHover:Le,showGrid:Re,showLegend:_e,title:He,description:Ie,summary:Pe,accessibleTable:Be,xLabel:Fe,yLabel:Ne}=a,Te=qe(()=>E(s),[s]),We=Array.isArray(Te[0]?.[S])?Te[0][S]:Te;me("LineChart",We,"xAccessor",g),me("LineChart",We,"yAccessor",v);const{effectiveData:Ee,statisticalAnnotations:je}=Oe({data:Te,xAccessor:g,yAccessor:v,forecast:Q,anomaly:X,groupBy:A}),Ge="__compoundGroup",ze=!(!Q||!A),Ve=ze?Ge:Q?De:A,$e=qe(()=>{if(!ze)return Ee;const e="function"==typeof A?A:e=>e[A];return Ee.map(t=>{const o={...t};return o[Ge]=`${e(t)}__${t[De]||"observed"}`,o})},[Ee,ze,A]),Xe=ze?$e:Ee,Qe=k||A,Ye=qe(()=>{if(!Q)return;const e=Q.upperBounds,t=Q.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,i="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let n=1/0,r=-1/0;const a=Ee;for(const e of a){const t="function"==typeof v?v(e):+e[v];if(isFinite(t)&&(n>t&&(n=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),n>t&&(n=t))}if(i){const t=i(e);null!=t&&isFinite(t)&&(n>t&&(n=t),t>r&&(r=t))}}return isFinite(n)&&isFinite(r)?[n,r]:void 0},[Q,Ee,v]),Ze=Ke(e=>{const t="function"==typeof g?g(e):e[g],o="function"==typeof v?v(e):e[v];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[g,v]),tt=void 0!==Xe[0]?.[S],rt=tt?nt:Ve,at=qe(()=>{if(tt)return Xe.map((e,t)=>{const o="function"==typeof A?A(e):"string"==typeof A?e[A]:void 0,i=null==o?"line-"+t:o+"",n=Array.isArray(e[S])?e[S]:[];return{...e,[nt]:i,[S]:n.map(t=>({...t,[nt]:i,parentLine:e,..."string"==typeof A&&void 0!==e[A]?{[A]:e[A]}:{}}))}});if(Ve){const e=Xe.reduce((e,t)=>{const o="function"==typeof Ve?Ve(t):t[Ve];if(!e[o]){const i={[S]:[]};"string"==typeof Ve&&(i[Ve]=o),ze&&(i[De]=t[De],"string"==typeof A&&(i[A]=t[A])),e[o]=i}return e[o][S].push(t),e},{});return Object.values(e)}return[{[S]:Xe}]},[tt,Ve,S,Xe,A,ze]),{gapProcessedLineData:st,hasGaps:lt}=qe(()=>{if("interpolate"===$){let e=!1;const t=[];for(const o of at){const i=(o[S]||[]).filter(t=>!Ze(t)||(e=!0,!1));i.length>0&&t.push({...o,[S]:i})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===$){let e=!1;const t=[];for(const o of at){const i=o[S]||[];let n=[],r=0;const a=rt&&"string"==typeof rt?o[rt]:void 0;for(const s of i)if(Ze(s))e=!0,n.length>0&&(t.push({...o,[S]:n}),n=[],r++);else{const e=null!=a?`${a}__seg${r}`:"__seg"+r;n.push({...s,_gapSegment:e})}n.length>0&&t.push({...o,[S]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===$){let e=!1;const t="string"==typeof v?v:"y",o=[];for(const i of at){const n=i[S]||[],r=[];for(const o of n)Ze(o)?(e=!0,r.push({...o,[t]:0})):r.push(o);o.push({...i,[S]:r})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:at,hasGaps:!1}},[at,$,S,Ze,rt,v]),ct="object"==typeof V?V:{},ht=ct.position||"end",dt=ct.fontSize||11,mt=qe(()=>{if(!V||!Qe)return[];const e="function"==typeof Qe?Qe:e=>e[Qe],t=new Set;for(const o of st){const i=o[S]||[];if(0===i.length)continue;const n=e("end"===ht?i[i.length-1]:i[0])??e(o);if(null==n)continue;const r=n+"";""!==r&&t.add(r)}return Array.from(t)},[V,Qe,st,S,ht]),ut=qe(()=>{if(!V)return a.marginDefaults;const e=mt.reduce((e,t)=>Math.max(e,t.length*(.6*dt)),0)+10,t="end"===ht?"right":"left";return{...a.marginDefaults,[t]:Math.max(a.marginDefaults[t]||0,e)}},[V,mt,dt,ht,a.marginDefaults]),pt=d({data:Ee,rawData:s,colorBy:Qe,colorScheme:C,legendInteraction:de,legendPosition:ue,frameLegend:we,selection:J,linkedHover:Z,fallbackFields:Qe?["string"==typeof Qe?Qe:""]:[],unwrapData:!1,onObservation:ee,onClick:ie,hoverHighlight:ne,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"LineChart",chartId:se,showLegend:(!V||void 0!==_e)&&_e,legend:Se,userMargin:l,marginDefaults:ut,loading:le,loadingContent:ce,emptyContent:he,width:ke,height:Ce,hasTitle:!!He,axisChrome:oe(U,{showAxes:a.showAxes,xLabel:Fe,yLabel:Ne})}),yt=pt.colorScale,ft=pt.effectiveSelectionHook,gt=pt.resolvedSelection,bt=pt.customHoverBehavior,xt=pt.customClickBehavior,vt=pt.crosshairProps,At=qe(()=>{if(Qe)return tt?e=>{const t=e.parentLine||e;return"function"==typeof Qe?Qe(t):t[Qe]}:Qe},[Qe,tt]),wt=qe(()=>w(g,v),[g,v]),St=ot({lineWidth:M,colorBy:At,colorScale:yt,color:ge,fillArea:B,areaOpacity:N,stroke:be,strokeWidth:xe,opacity:ve,effectiveSelectionHook:ft,resolvedSelection:gt,styleRules:L,ruleContext:wt}),[kt,Ct]=Ue(null);Je(()=>{if(!Q)return void Ct(null);let e=!1;return async function(...e){return(await Me()).createSegmentLineStyle(...e)}(St,Q).then(t=>{e||Ct(()=>t)}).catch(()=>{e||Ct(null)}),()=>{e=!0}},[St,Q]);const Lt=kt||St,Rt=qe(()=>{if(I)return e=>{const t={r:P,fillOpacity:1};return Qe?yt&&(t.fill=j(e.parentLine||e,Qe,yt)):t.fill=ge||_,t}},[I,P,Qe,yt,ge]),_t=Array.isArray(B)?"mixed":B?"area":"line",Ht=qe(()=>{if(!V||!Qe)return[];const e="function"==typeof g?g:e=>e[g],t="function"==typeof v?v:e=>e[v],o="function"==typeof Qe?Qe:e=>e[Qe],i=new Map;for(const e of st){const t=e[S]||[];if(0===t.length)continue;const n="end"===ht?t[t.length-1]:t[0],r=o(n)??o(e);if(null==r)continue;const a=r+"";""===a||i.has(a)||i.set(a,n)}const n=Array.from(i.entries()).map(([o,i])=>({type:"text",label:o,["string"==typeof g?g:"x"]:e(i),["string"==typeof v?v:"y"]:t(i),dx:"end"===ht?6:-6,dy:0,color:yt?yt(o):_,fontSize:dt}));n.sort((e,t)=>{const o="string"==typeof v?v:"y";return e[o]-t[o]});for(let e=1;n.length>e;e++){const t="string"==typeof v?v:"y",o=n[e-1],i=n[e];dt+2>Math.abs(i[t]+i.dy-(o[t]+o.dy))&&(i.dy+=dt+2)}return n},[V,Qe,yt,st,S,g,v,ht,dt]),It=pt.margin,Pt=A||k,Bt=qe(()=>x([{label:Fe||y(g),accessor:g,role:"x",format:h},{label:Ne||y(v),accessor:v,role:"y",format:m},...Pt?[{label:y(Pt),accessor:Pt,role:"group"}]:[],...f(Y,m)]),[g,v,Fe,Ne,Pt,h,m,Y]),Ft=t({componentName:"LineChart",data:tt?Ee[0]?.[S]||[]:s,accessors:{xAccessor:g,yAccessor:v}}),Dt=qe(()=>tt||rt||lt?st.flatMap(e=>{const t=e[S]||[];return rt&&"string"==typeof rt?t.map(t=>({...t,[rt]:t[rt]??e[rt]})):t}):Xe,[st,S,tt,rt,Xe,lt]),Nt=n(T),Mt={chartType:_t,...Array.isArray(B)&&{areaGroups:B},...Nt&&{lineGradient:Nt},...null!=s&&{data:Dt},xAccessor:g,yAccessor:v,xScaleType:ye,yScaleType:fe,...q&&{xExtent:q},...!K||null==K[0]&&null==K[1]?Ye?{yExtent:Ye}:{}:{yExtent:K},groupAccessor:"break"===$&<?"_gapSegment":rt||void 0,...Y&&{band:Y},curve:H,lineStyle:Lt,...I&&{pointStyle:Rt},size:[ke,Ce],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},margin:It,showAxes:a.showAxes,xLabel:Fe,yLabel:Ne,xFormat:h,yFormat:m,...void 0!==p&&{axisExtent:p},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:Le,showGrid:Re,...pt.legendBehaviorProps,...He&&{title:He},...Ie&&{description:Ie},...Pe&&{summary:Pe},...void 0!==Be&&{accessibleTable:Be},...c&&{className:c},...null!=e.animate&&{animate:e.animate},...te({tooltip:O,defaultTooltipContent:Bt,multiDefaultContent:F()}),...b({linkedHover:Z,selection:J,onObservation:ee,onClick:ie,hoverRadius:ae,hoverHighlight:ne,mobileInteraction:pt.mobileInteraction,customHoverBehavior:bt,customClickBehavior:xt}),...G&&{pointIdAccessor:G},...(z?.length||je.length||Ht.length)&&{annotations:[...z||[],...je,...Ht]},...vt,...we};return pt.earlyReturn?pt.earlyReturn:Ft?it(R,{componentName:"LineChart",message:Ft,width:ke,height:Ce}):it(D,{componentName:"LineChart",width:ke,height:Ce,children:it(i,{ref:r,...Mt})})});rt.displayName="LineChart";import{forwardRef as at,useMemo as st}from"react";import{jsx as lt}from"react/jsx-runtime";var ct=at(function(e,t){const{data:n,layout:r,layoutConfig:a,onLayoutError:s,xExtent:l,yExtent:c,showAxes:h=!1,margin:d,className:u,annotations:p,onObservation:y,onClick:f,selection:x,linkedHover:v,hoverHighlight:A,chartId:w,loading:S,loadingContent:k,emptyContent:C,colorBy:L,colorScheme:R,legend:_,legendInteraction:H,legendPosition:I,frameProps:P={}}=e,{legend:B,...F}=P,N=st(()=>W(B,_),[B,_]),{frameRef:M,resolved:T,safeData:O,setup:E,earlyReturn:j}=m({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:n,colorBy:L,colorScheme:R,legend:N,legendInteraction:H,legendPosition:I,frameLegend:F,selection:x,linkedHover:v,hoverHighlight:A,onObservation:y,onClick:f,chartId:w,loading:S,loadingContent:k,emptyContent:C,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),G=E.effectiveSelectionHook,z=st(()=>G?.isActive?{isActive:!0,predicate:G.predicate}:null,[G?.isActive,G?.predicate]),V=st(()=>te({tooltip:e.tooltip,defaultTooltipContent:e=>lt(o,{hover:e})}),[e.tooltip]);if(j)return j;const{width:$,height:X,enableHover:Q,showGrid:Y,title:q,description:K,summary:U,accessibleTable:J,xLabel:Z,yLabel:ee}=T,oe={chartType:"custom",...null!=n&&{data:O},customLayout:r,layoutConfig:a,onLayoutError:s,...z&&{layoutSelection:z},xExtent:l,yExtent:c,colorAccessor:L,colorScheme:R,size:[$,X],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:E.margin,showAxes:h,xLabel:Z,yLabel:ee,enableHover:Q,showGrid:Y,...E.legendBehaviorProps,...g({title:q,description:K,summary:U,accessibleTable:J,className:u,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...V,...b({linkedHover:v,selection:x,onObservation:y,onClick:f,hoverRadius:e.hoverRadius,hoverHighlight:A,mobileInteraction:E.mobileInteraction,customHoverBehavior:E.customHoverBehavior,customClickBehavior:E.customClickBehavior}),...p&&p.length>0&&{annotations:p},...E.crosshairProps,...F};return lt(D,{componentName:"XYCustomChart",width:$,height:X,children:lt(i,{ref:M,...oe})})});function ht(e){return e instanceof Date?"date:"+e.getTime():`${typeof e}:${e+""}`}function dt(e,t,o){return"function"==typeof e?e(t,o):t[e]}function mt(e,t={}){const o=t.xAccessor??"x",i=t.yAccessor??"y",n=t.lineBy??"series",r=t.rankDirection??"descending",a=[],s=new Map,l=new Map,c=[],h=new Map;let d=1/0,m=-1/0;e.forEach((e,t)=>{const r=dt(o,e,t),u=ht(r);let p=s.get(u);null==p&&(p=a.length,s.set(u,p),a.push(r),l.set(p,[]));const y=dt(n,e,t)+"";h.has(y)||(h.set(y,c.length),c.push(y));const f=Number(dt(i,e,t));Number.isFinite(f)&&(d=Math.min(d,f),m=Math.max(m,f),l.get(p)?.push({datum:e,inputIndex:t,series:y,value:f}))});const u=[],p=new Map,y=new Map;for(let e=0;a.length>e;e++){const t=l.get(e)??[];t.sort((e,t)=>("descending"===r?t.value-e.value:e.value-t.value)||(h.get(e.series)??0)-(h.get(t.series)??0)),t.forEach((t,o)=>{const i=o+1;u.push({datum:t.datum,xIndex:e,xValue:a[e],series:t.series,value:t.value,rank:i}),p.set(t.series,(p.get(t.series)??0)+i),y.set(t.series,(y.get(t.series)??0)+1)})}const f=c.length+1,g=[...c].sort((e,t)=>{const o=y.get(e)??0,i=y.get(t)??0;return((p.get(e)??0)+(a.length-o)*f)/Math.max(1,a.length)-((p.get(t)??0)+(a.length-i)*f)/Math.max(1,a.length)||(h.get(e)??0)-(h.get(t)??0)}),b=new Set(g.slice(0,null==t.highlightTop?g.length:Math.max(0,Math.floor(t.highlightTop))));return{data:u.map(e=>{const t=b.has(e.series);return{...e.datum,x:e.xIndex,y:e.rank,__bumpRaw:e.datum,__bumpSeries:e.series,__bumpColorGroup:t?e.series:"Other",__bumpValue:e.value,__bumpRank:e.rank,__bumpXValue:e.xValue,__bumpHighlighted:t}}),xValues:a,seriesOrder:c,overallOrder:g,valueExtent:d===1/0?[0,0]:[d,m]}}ct.displayName="XYCustomChart";import{forwardRef as ut,useMemo as pt}from"react";import{useCallback as yt,useMemo as ft}from"react";import{jsx as gt,jsxs as bt}from"react/jsx-runtime";function xt(e,t,o,i,n){const r=1-n;return r*r*r*e+3*r*r*n*t+3*r*n*n*o+n*n*n*i}function vt(e,t,o,i,n){const r=1-n;return 3*r*r*(t-e)+6*r*n*(o-t)+3*n*n*(i-o)}function At(e,t,o,i,n){const r=[],a=(e.x+t.x)/2;for(let s=0;n>=s;s++){const l=s/n;let c,h,d,m;"linear"===i?(c=e.x+(t.x-e.x)*l,h=e.y+(t.y-e.y)*l,d=t.x-e.x,m=t.y-e.y):(c=xt(e.x,a,a,t.x,l),h=xt(e.y,e.y,t.y,t.y,l),d=vt(e.x,a,a,t.x,l),m=vt(e.y,e.y,t.y,t.y,l)),r.push({x:c,y:h,dx:d,dy:m,radius:e.radius+(t.radius-e.radius)*l,datumIndex:.5>l?o:o+1})}return r}function wt(e,t={}){const o=[],i=[],n=[];if(2>e.length)return{topPath:o,bottomPath:i,datumIndices:n};const r=t.curve??"smooth",a=Math.max(2,Math.floor(t.samplesPerSegment??12));for(let t=0;e.length-1>t;t++){const s=At(e[t],e[t+1],t,r,a);for(let e=0===t?0:1;s.length>e;e++){const t=s[e],r=Math.hypot(t.dx,t.dy)||1,a=-t.dy/r,l=t.dx/r,c=Math.max(0,t.radius);o.push([t.x+a*c,t.y+l*c]),i.push([t.x-a*c,t.y-l*c]),n.push(t.datumIndex)}}return{topPath:o,bottomPath:i,datumIndices:n}}import{jsx as St}from"react/jsx-runtime";function kt({datum:e,x:t,y:o,side:i,color:n,highlighted:r,labelStyle:a}){const s=A(),l=s.isActive&&!s.predicate(e),c="function"==typeof a?a(e.__bumpRaw):a;return St("text",{className:"semiotic-bump-label",x:t+("end"===i?8:-8),y:o,dy:"0.35em",textAnchor:"end"===i?"start":"end",fill:n,fillOpacity:l?.16:1,fontWeight:r?650:450,fontSize:12,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-axis-label-font-size, 12px)",...c},children:e.__bumpSeries})}function Ct(e,t,o){const[i,n]=t,[r,a]=o;return n===i?(r+a)/2:r+(a-r)*Math.max(0,Math.min(1,(e-i)/(n-i)))}function Lt(e){const t=e.__bumpXValue instanceof Date?e.__bumpXValue.getTime():Number(e.__bumpXValue);return{value:e.__bumpValue,x:Number.isFinite(t)?t:void 0,y:e.__bumpValue,category:e.__bumpSeries}}function Rt(e){const t=e.config,o=new Map;for(const t of e.data){const e=o.get(t.__bumpSeries)??[];e.push(t),o.set(t.__bumpSeries,e)}const i=t.seriesOrder.filter(e=>o.has(e)).sort((e,i)=>(o.get(e)?.[0]?.__bumpHighlighted?1:0)-(o.get(i)?.[0]?.__bumpHighlighted?1:0)||t.seriesOrder.indexOf(e)-t.seriesOrder.indexOf(i)),n=[],r=[],a=[];for(const r of i){const i=(o.get(r)??[]).sort((e,t)=>e.x-t.x);if(2>i.length)continue;const s=i[0].__bumpHighlighted,l=(t.colorMap&&Z(t.colorMap,r))??e.resolveColor(i[0].__bumpSeries,i[0]),c=t.color??(s?l:t.neutralColor??e.theme.semantic.textSecondary??e.theme.semantic.border??l),h=i.map(o=>({x:e.scales.x(o.x),y:e.scales.y(o.y),radius:t.ribbon?Ct(o.__bumpValue,t.valueExtent,t.ribbonSizeRange)/2:Math.max(.5,t.lineWidth/2)})),d=wt(h,{curve:t.curve,samplesPerSegment:t.samplesPerSegment}),m={fill:c,fillOpacity:1,opacity:s?t.ribbon?t.ribbonOpacity:t.lineOpacity:Math.min(t.ribbon?t.ribbonOpacity:t.lineOpacity,.58)};t.styleRules?.length&&Object.assign(m,S(i[0].__bumpRaw,t.styleRules,Lt(i[0]))),t.areaStyle&&Object.assign(m,t.areaStyle(i[0].__bumpRaw)??{}),void 0!==t.stroke&&(m.stroke=t.stroke),void 0!==t.strokeWidth&&(m.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(m.opacity=t.opacity),n.push({type:"area",topPath:d.topPath,bottomPath:d.bottomPath,style:m,datum:d.datumIndices.map(e=>i[e]),accessibleDatum:i.map(e=>e.__bumpRaw),accessibility:{label:r+" ranking trajectory",tableFields:i.map(e=>e.__bumpRaw)},group:r,interactive:!0}),t.showPoints&&i.forEach((e,o)=>{const i={fill:c,stroke:"none",opacity:s?1:.75};t.styleRules?.length&&Object.assign(i,S(e.__bumpRaw,t.styleRules,Lt(e))),t.pointStyle&&Object.assign(i,t.pointStyle(e.__bumpRaw)??{}),void 0!==t.stroke&&(i.stroke=t.stroke),void 0!==t.strokeWidth&&(i.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(i.opacity=t.opacity),n.push({type:"point",x:h[o].x,y:h[o].y,r:i.r??t.pointRadius,style:i,datum:e,accessibleDatum:e.__bumpRaw,accessibility:{label:`${r}, rank ${e.__bumpRank}, value ${e.__bumpValue}`},pointId:`${r}:${e.x}`})});const u=!0===t.showLabels?"end":t.showLabels,p=(e,o,i)=>{const n=null==t.labelPriorityAccessor?void 0:"function"==typeof t.labelPriorityAccessor?t.labelPriorityAccessor(e.__bumpRaw):Number(e.__bumpRaw[t.labelPriorityAccessor]);a.push({id:`${r}\0${i}`,datum:e,x:h[o].x,y:h[o].y,side:i,rank:e.__bumpRank,highlighted:s,priority:Number.isFinite(n)?n:void 0,color:"string"==typeof m.fill?m.fill:c})};"start"!==u&&"both"!==u||p(i[0],0,"start"),"end"!==u&&"both"!==u&&"auto"!==u||p(i.at(-1),i.length-1,"end")}const s=function(e,t,o,i){const n=Math.max(1,Math.floor(t/18)),r="auto"===o?Number.isFinite(i)&&(i??0)>=0?Math.min(n,Math.floor(i)):n:1/0,a=e.map((e,t)=>({candidate:e,index:t})).sort((e,t)=>(t.candidate.priority??0)-(e.candidate.priority??0)||Number(t.candidate.highlighted)-Number(e.candidate.highlighted)||e.candidate.rank-t.candidate.rank||e.index-t.index),s=[];for(const{candidate:e}of a){if(s.length>=r)break;s.some(t=>t.side===e.side&&14>Math.abs(t.y-e.y))||s.push(e)}return new Set(s.map(e=>e.id))}(a,e.dimensions.plot.height,"auto"!==(!0===t.showLabels?"end":t.showLabels)||"auto",t.maxLabels);for(const e of a)s.has(e.id)&&r.push(St(kt,{datum:e.datum,x:e.x,y:e.y,side:e.side,color:e.color,highlighted:e.highlighted,labelStyle:t.labelStyle},e.id));return{nodes:n,overlays:r.length?St("g",{className:"semiotic-bump-labels",children:r}):void 0,restyle:(e,t)=>{const o=function(e){const t=Array.isArray(e.datum)?e.datum[0]:e.datum;return t&&"object"==typeof t&&"__bumpSeries"in t?t:void 0}(e);if(t?.isActive&&o&&!t.predicate(o))return{opacity:.14}}}}import{jsx as _t}from"react/jsx-runtime";var Ht=ut(function(e,t){const o=he(),i=ye(),{data:n,xAccessor:r,yAccessor:a,lineBy:s,rankDirection:l="descending",ribbon:c=!1,curve:h="smooth",ribbonSizeRange:d=[4,28],samplesPerSegment:m=12,lineWidth:u=3,highlightTop:p,neutralColor:y,styleRules:f,labelStyle:g,colorScheme:b,ribbonOpacity:x=.82,lineOpacity:v=.9,showPoints:A=!1,pointRadius:w=3,showLabels:S=!0,labelPriorityAccessor:k,maxLabels:C,showAxes:L=!0,showGrid:R=!0,showLegend:_=!1,enableHover:H=!0,hoverHighlight:I=!0,tooltip:P,frameProps:B={},xFormat:F,yFormat:D,onClick:N}=e,M=pt(()=>mt(n,{xAccessor:r,yAccessor:a,lineBy:s,rankDirection:l,highlightTop:p}),[n,r,a,s,l,p]),{axes:W,areaStyle:O,pointStyle:E,...j}=B,G=pt(()=>function(e){const{seriesOrder:t,overallOrder:o,highlightTop:i,color:n,colorScheme:r,neutralColor:a,themeCategorical:s,themeNeutral:l}=e;if(null==i&&null==n)return r;const c=new Set(o.slice(0,null==i?o.length:Math.max(0,Math.floor(i)))),h=new Map,d={};for(const e of t)Object.defineProperty(d,e,{configurable:!0,enumerable:!0,writable:!0,value:n??(c.has(e)?J(void 0,s,r,e,h):a??l??"#b8bec8")});return d}({seriesOrder:M.seriesOrder,overallOrder:M.overallOrder,highlightTop:p,color:e.color,colorScheme:b,neutralColor:y,themeCategorical:o,themeNeutral:i.colors.textSecondary}),[M.seriesOrder,M.overallOrder,p,e.color,b,y,o,i.colors.textSecondary]),z=pt(()=>({ribbon:c,curve:h,samplesPerSegment:m,ribbonSizeRange:d,valueExtent:M.valueExtent,seriesOrder:M.seriesOrder,lineWidth:u,ribbonOpacity:x,lineOpacity:v,neutralColor:y,color:e.color,colorMap:G&&"object"==typeof G&&!Array.isArray(G)?G:void 0,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:e.opacity,styleRules:f,areaStyle:O,pointStyle:E,labelStyle:g,showPoints:A,pointRadius:w,showLabels:S,labelPriorityAccessor:k,maxLabels:C}),[c,h,m,d,M.valueExtent,M.seriesOrder,u,x,v,y,G,e.color,e.stroke,e.strokeWidth,e.opacity,f,O,E,g,A,w,S,k,C]),{tooltip:V,formatX:$}=function({tooltip:e,xValues:t,xFormat:o,yFormat:i}){const n=yt((e,i)=>{if(0===t.length)return"";const n=t[Math.max(0,Math.min(t.length-1,Math.round(Number(e))))];return o?o(n,i):(n instanceof Date?n.toLocaleDateString():n)+""},[o,t]),r=yt(e=>i?i(e):e.toLocaleString(),[i]),a=X(e),s=ft(()=>a?void 0:q(e),[a,e]),l=yt(t=>{const o=t?.data??t;return o&&!1!==e?s?s({...t,data:o.__bumpRaw,__semioticHoverData:!0}):bt(T,{children:[gt("div",{style:{fontWeight:700},children:o.__bumpSeries}),bt("div",{children:[n(o.x)," · Rank ",o.__bumpRank]}),bt("div",{children:["Value: ",r(o.__bumpValue)]})]}):null},[r,n,s,e]),c=yt(t=>{const o=(Array.isArray(t.allSeries)?t.allSeries:[]).map(e=>{const t=e.datum;return{...e,value:t?.__bumpValue??e.value,rank:t?.__bumpRank,datum:t?.__bumpRaw??e.datum}}),i=t?.data??t,a={...i?.__bumpRaw??{},xValue:i?.__bumpXValue??t.xValue,allSeries:o};if(Q(e)&&"function"==typeof e.content)return e.content(a);const s=t.xValue??i?.x;return bt(T,{children:[null!=s&>("div",{style:{fontWeight:700,marginBottom:4},children:n(s)}),o.map((e,t)=>bt("div",{style:{display:"flex",alignItems:"center",gap:6},children:[gt("span",{style:{width:8,height:8,borderRadius:"50%",background:e.color,flexShrink:0}}),gt("span",{style:{flex:1},children:e.group}),bt("span",{children:[null!=e.rank?`Rank ${e.rank} · `:"",r(e.value)]})]},`${e.group}-${t}`))]})},[r,n,e]);return{tooltip:ft(()=>!1!==e&&(a?{mode:"multi",content:c}:l),[a,c,l,e]),formatX:n}}({tooltip:P,xValues:M.xValues,xFormat:F,yFormat:D}),Y=pt(()=>{if(N)return(e,t)=>{N(e.__bumpRaw??e,t)}},[N]),K=Math.max(1,M.seriesOrder.length),U=M.xValues.map((e,t)=>t),Z=Array.from({length:K},(e,t)=>t+1),ee=W??[{orient:"left",tickValues:Z,tickFormat:e=>e+"",label:e.yLabel??"Rank",baseline:!1},{orient:"bottom",tickValues:U,tickFormat:$,label:e.xLabel,tickAnchor:"edges"}],te=pt(()=>function(e,t){if(!e?.length)return;const o=new Map(t.map((e,t)=>[ht(e),t]));return e.map(e=>{const t={...e},i=i=>{if(!(i in e))return;const n=o.get(ht(e[i]));void 0!==n&&(t[i]=n)};return i("x"),i("x0"),i("x1"),"string"!=typeof e.type||"x-threshold"!==e.type&&"x"!==e.type||i("value"),t})}(e.annotations,M.xValues),[e.annotations,M.xValues]);return _t(ct,{ref:t,data:M.data,layout:Rt,layoutConfig:z,xExtent:[0,Math.max(1,M.xValues.length-1)],yExtent:[K+.5,.5],showAxes:L,showGrid:R,showLegend:_,enableHover:H,hoverHighlight:I,colorBy:"__bumpSeries",colorScheme:G,tooltip:V,onClick:Y,hoverRadius:e.hoverRadius,width:e.width,height:e.height,responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,responsiveRules:e.responsiveRules,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,mode:e.mode,margin:e.margin??{top:20,right:S?110:24,bottom:48,left:48},className:e.className,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,selection:e.selection,linkedHover:e.linkedHover,legend:e.legend,legendInteraction:e.legendInteraction,legendPosition:e.legendPosition,onObservation:e.onObservation,chartId:e.chartId,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations,annotations:te,xLabel:e.xLabel,yLabel:e.yLabel??"Rank",frameProps:{axes:ee,axisExtent:"exact",...j}})});Ht.displayName="BumpChart";import{useMemo as It,forwardRef as Pt,useRef as Bt}from"react";import{useMemo as Ft}from"react";function Dt(e){const{safeData:t,data:o,areaBy:i,lineDataAccessor:n,colorBy:r,colorScale:a,color:s,stroke:l,strokeWidth:h,opacity:d,effectiveSelectionHook:m,resolvedSelection:u,areaOpacity:p,showLine:g,lineWidth:b,showPoints:v,pointRadius:A,xAccessor:w,yAccessor:k,xLabel:C,yLabel:L,xFormat:R,yFormat:H,groupField:I,styleRules:P,ruleContext:B}=e,F=Ft(()=>function({data:e,safeData:t,areaBy:o,lineDataAccessor:i}){if(null==e)return[];const n=void 0!==t[0]?.[i];if(!n&&!o)return t;let r;if(n)r=t;else{const e=t.reduce((e,t)=>{const n="function"==typeof o?o(t):t[o],r=n+"";if(!e[r]){const t={[i]:[]};"string"==typeof o&&(t[o]=n),e[r]=t}return e[r][i].push(t),e},{});r=Object.values(e)}return r.flatMap(e=>{const t=Array.isArray(e[i])?e[i]:[];return"string"==typeof o?t.map(t=>({...t,[o]:t[o]??e[o]})):t})}({data:o,safeData:t,areaBy:i,lineDataAccessor:n}),[o,t,i,n]),D=Ft(()=>e=>{const t={};if(r){if(a){const o=j(e,r,a);t.fill=o,g?(t.stroke=o,t.strokeWidth=b):t.stroke="none"}}else{const e=s||_;t.fill=e,g?(t.stroke=e,t.strokeWidth=b):t.stroke="none"}return t.fillOpacity=p,P&&P.length>0&&Object.assign(t,S(e,P,B?B(e):{value:void 0})),t},[r,a,s,p,g,b,P,B]),N=Ft(()=>c(D,{stroke:l,strokeWidth:h,opacity:d}),[D,l,h,d]);return{flattenedData:F,lineStyle:Ft(()=>ue(N,m??null,u),[N,m,u]),pointStyle:Ft(()=>{if(v)return e=>{const t={r:A,fillOpacity:1};return r?a&&(t.fill=j(e.parentLine||e,r,a)):t.fill=s||_,t}},[v,A,r,a,s]),defaultTooltipContent:Ft(()=>x([{label:C||y(w),accessor:w,role:"x",format:R},{label:L||y(k),accessor:k,role:"y",format:H},...I?[{label:y(I),accessor:I,role:"group"}]:[],...f(e.band,H)]),[w,k,C,L,I,R,H,e.band])}}import{jsx as Nt}from"react/jsx-runtime";var Mt=Pt(function(e,o){const c=Bt(null);u(o,{variant:"xy",frameRef:c});const h=re(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:m,margin:p,className:y,xFormat:f,yFormat:x,xAccessor:v="x",yAccessor:A="y",areaBy:S,y0Accessor:k,gradientFill:C=!1,semanticGradient:L,semanticLine:_=!0,lineDataAccessor:H="coordinates",colorBy:I,colorScheme:P,styleRules:B,curve:N="monotoneX",areaOpacity:M=.7,lineGradient:T,showLine:W=!0,lineWidth:O=2,showPoints:j=!1,pointRadius:G=3,tooltip:z,annotations:V,forecast:$,anomaly:X,band:Q,xExtent:Y,yExtent:q,frameProps:K={},selection:U,linkedHover:J,onObservation:Z,onClick:ee,hoverHighlight:ie,chartId:ne,loading:ae,loadingContent:se,emptyContent:le,legendInteraction:ce,legendPosition:he,color:de,stroke:ue,strokeWidth:pe,opacity:ye}=e,{width:fe,height:ge,enableHover:be,showGrid:xe,showLegend:ve,title:Ae,description:we,summary:Se,accessibleTable:ke,xLabel:Ce,yLabel:Le}=h,Re=It(()=>E(m),[m]),_e=I||S,He=It(()=>a(L),[L]),Ie=It(()=>He?.stops.length?s(He):r(C),[He,C]),Pe=It(()=>n(T),[T]),Be=It(()=>_?l(He):void 0,[He,_]);me("AreaChart",Re,"xAccessor",v),me("AreaChart",Re,"yAccessor",A);const Fe=d({data:Re,rawData:m,colorBy:_e,colorScheme:P,legendInteraction:ce,legendPosition:he,frameLegend:K,selection:U,linkedHover:J,fallbackFields:_e?["string"==typeof _e?_e:""]:[],unwrapData:!1,onObservation:Z,onClick:ee,hoverHighlight:ie,mobileInteraction:h.mobileInteraction,mobileSemantics:h.mobileSemantics,chartType:"AreaChart",chartId:ne,showLegend:ve,userMargin:p,marginDefaults:h.marginDefaults,loading:ae,loadingContent:se,emptyContent:le,width:fe,height:ge,hasTitle:!!Ae,axisChrome:oe(K,{showAxes:h.showAxes,xLabel:Ce,yLabel:Le})}),{effectiveData:De,statisticalAnnotations:Ne}=Oe({data:Re,xAccessor:v,yAccessor:A,forecast:$,anomaly:X,groupBy:S}),Me=It(()=>w(v,A),[v,A]),{flattenedData:Te,lineStyle:We,pointStyle:Ee,defaultTooltipContent:je}=Dt({safeData:De,data:m,areaBy:S,lineDataAccessor:H,colorBy:_e,colorScale:Fe.colorScale,color:de,stroke:ue,strokeWidth:pe,opacity:ye,effectiveSelectionHook:Fe.effectiveSelectionHook,resolvedSelection:Fe.resolvedSelection,areaOpacity:M,showLine:W,lineWidth:O,showPoints:j,pointRadius:G,xAccessor:v,yAccessor:A,xLabel:Ce,yLabel:Le,xFormat:f,yFormat:x,groupField:S||I,band:Q,styleRules:B,ruleContext:Me}),Ge=t({componentName:"AreaChart",data:m,accessors:{xAccessor:v,yAccessor:A}}),ze={chartType:"area",...null!=m&&{data:Te},xAccessor:v,yAccessor:A,groupAccessor:S||void 0,...k&&{y0Accessor:k},...Q&&{band:Q},...Ie&&{gradientFill:Ie},...Pe&&{lineGradient:Pe},...Be&&{semanticLineStops:Be},curve:N,lineStyle:We,...j&&Ee&&{pointStyle:Ee},size:[fe,ge],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Fe.margin,showAxes:h.showAxes,xLabel:Ce,yLabel:Le,xFormat:f,yFormat:x,enableHover:be,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:xe,...Fe.legendBehaviorProps,...g({title:Ae,description:we,summary:Se,accessibleTable:ke,className:y,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...te({tooltip:z,defaultTooltipContent:je,multiDefaultContent:F()}),...b({linkedHover:J,selection:U,onObservation:Z,onClick:ee,hoverHighlight:ie,hoverRadius:e.hoverRadius,mobileInteraction:Fe.mobileInteraction,customHoverBehavior:Fe.customHoverBehavior,customClickBehavior:Fe.customClickBehavior}),...(V&&V.length>0||Ne.length>0)&&{annotations:[...V||[],...Ne]},...Y&&{xExtent:Y},...q&&{yExtent:q},...Fe.crosshairProps,...K};return Fe.earlyReturn?Fe.earlyReturn:Ge?Nt(R,{componentName:"AreaChart",message:Ge,width:fe,height:ge}):Nt(D,{componentName:"AreaChart",width:fe,height:ge,children:Nt(i,{ref:c,...ze})})});Mt.displayName="AreaChart";import{useMemo as Tt,forwardRef as Wt,useRef as Ot,useState as Et,useImperativeHandle as jt,useCallback as Gt}from"react";import{jsx as zt,jsxs as Vt}from"react/jsx-runtime";function $t(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var Xt=Wt(function(e,t){const o=Ot(null),n=re(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:a,margin:s,className:l,xFormat:c,yFormat:h,xAccessor:m="x",seriesAAccessor:u="a",seriesBAccessor:p="b",seriesALabel:y="A",seriesBLabel:f="B",seriesAColor:x="var(--semiotic-danger, #dc2626)",seriesBColor:v="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:w=1.5,showPoints:S=!1,pointRadius:k=3,curve:C="linear",areaOpacity:L=.6,gradientFill:R,tooltip:_,annotations:H,xExtent:I,yExtent:P,frameProps:B={},selection:F,linkedHover:N,onObservation:M,onClick:T,hoverHighlight:W,chartId:j,loading:G,loadingContent:z,emptyContent:V,legendInteraction:$,legendPosition:X,pointIdAccessor:Q,windowSize:Y}=e,{width:q,height:K,enableHover:U,showGrid:J,showLegend:Z,title:ee,description:ie,summary:ne,accessibleTable:ae,xLabel:se,yLabel:le}=n,ce=Tt(()=>"function"==typeof m?e=>$t(m(e)):e=>$t(e[m]),[m]),he=Tt(()=>"function"==typeof u?e=>$t(u(e)):e=>$t(e[u]),[u]),de=Tt(()=>"function"==typeof p?e=>$t(p(e)):e=>$t(e[p]),[p]),[me,ue]=Et([]),pe=Ot([]),ye=null==a,fe=Tt(()=>E(ye?me:a),[ye,me,a]),ge=Tt(()=>function(e,t,o,i){if(!e.length)return[];const n=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];let a=0,s=null,l=null,c=[];const h=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${e}`,m=e=>r.push(e),u=(e,t)=>{m({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;n.length>e;e++){const r=n[e],p=t(r),y=o(r),f=i(r);if(!Number.isFinite(p)||!Number.isFinite(y)||!Number.isFinite(f))continue;const g=h(y,f);if(null!==g)if(null!=s){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=y-l.a-(f-l.b);if(0!==o){const i=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+i*(p-l.x),t=l.a+i*(y-l.a)}else e=l.x,t=l.a}m({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=g,m({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)u(c[e],s)}else for(const e of c)u(e,s);c=[],m({__x:p,__y:f>y?f:y,__y0:f>y?y:f,__diffSegment:d(s),__diffWinner:s,__valA:y,__valB:f,__sourceDatum:r}),l={x:p,a:y,b:f,w:g}}else{s=g;for(const e of c)u(e,s);c=[],m({__x:p,__y:f>y?f:y,__y0:f>y?y:f,__diffSegment:d(s),__diffWinner:s,__valA:y,__valB:f,__sourceDatum:r}),l={x:p,a:y,b:f,w:g}}else c.push({x:p,y:y,datum:r})}for(const e of c)u(e,s??"A");return r}(fe,ce,he,de),[fe,ce,he,de]),be=Tt(()=>A?function(e,t,o,i){if(!e.length)return[];const n=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];for(const e of n){const n=t(e),a=o(e),s=i(e);Number.isFinite(a)&&r.push({__x:n,__y:a,__diffSegment:"line-A"}),Number.isFinite(s)&&r.push({__x:n,__y:s,__diffSegment:"line-B"})}return r}(fe,ce,he,de):[],[A,fe,ce,he,de]),xe=Tt(()=>[...ge,...be],[ge,be]),ve=Tt(()=>{const e=new Set;for(const t of ge)e.add(t.__diffSegment);return Array.from(e)},[ge]);jt(t,()=>{const e=e=>{const t=Y&&e.length>Y?e.slice(e.length-Y):e;pe.current=t,ue(t)},t=Q?"function"==typeof Q?Q:e=>e[Q]:null;return{push:t=>e([...pe.current,t]),pushMany:t=>e([...pe.current,...t]),remove:o=>{if(!t)return[];const i=Array.isArray(o)?o:[o],n=[],r=[];for(const e of pe.current)i.includes(t(e))?n.push(e):r.push(e);return e(r),n},update:(o,i)=>{if(!t)return[];const n=Array.isArray(o)?o:[o],r=[],a=pe.current.map(e=>{if(n.includes(t(e))){const t=i(e);return r.push(t),t}return e});return e(a),r},clear:()=>e([]),getData:()=>ye?pe.current:fe,getScales:()=>o.current?.getScales()??null}},[ye,fe,Q,Y]);const Ae=Tt(()=>{if(!1!==Z)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:y,color:x},{label:f,color:v}]}]}},[Z,y,f,x,v]),we=Object.hasOwn(B,"legend")?B:{...B,legend:Ae},Se=d({data:fe,rawData:a,colorBy:"__diffWinner",colorScheme:[x,v],legendInteraction:$,legendPosition:X,frameLegend:we,selection:F,linkedHover:N,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:M,onClick:T,hoverHighlight:W,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DifferenceChart",chartId:j,showLegend:Z,userMargin:s,marginDefaults:n.marginDefaults,loading:G,loadingContent:z,emptyContent:V,width:q,height:K,hasTitle:!!ee,axisChrome:oe(B,{showAxes:n.showAxes,xLabel:se,yLabel:le})}),ke=Gt(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?x:v,stroke:"none",fillOpacity:L}},[x,v,L]),Ce=Gt(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?x:v,strokeWidth:w,fill:"none"}),[x,v,w]),Le=Gt(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?x:v,r:k}),[x,v,k]),Re=Gt(e=>{const t=e.data,o=e.allSeries,i=e.xValue??t?.__x;let n=t?.__valA,r=t?.__valB;if(o&&o.length>0){const e=o.find(e=>"line-A"===e.group),t=o.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(n=e.value),null!=t?.value&&Number.isFinite(t.value)&&(r=t.value)}if(null!=i&&(null==n||null==r)){const e=fe.find(e=>ce(e)===i);e&&(null==n&&(n=he(e)),null==r&&(r=de(e)))}const a=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",s=c&&null!=i?c(i):null!=i?i+"":"";return Vt("div",{className:"semiotic-tooltip",style:O,children:[s&&zt("div",{style:{fontWeight:600,marginBottom:4},children:s}),Vt("div",{style:{display:"flex",alignItems:"center",gap:6},children:[zt("span",{style:{width:10,height:10,background:x,display:"inline-block",borderRadius:2}}),Vt("span",{children:[y,": ",a(n)]})]}),Vt("div",{style:{display:"flex",alignItems:"center",gap:6},children:[zt("span",{style:{width:10,height:10,background:v,display:"inline-block",borderRadius:2}}),Vt("span",{children:[f,": ",a(r)]})]}),null!=n&&null!=r&&Number.isFinite(n)&&Number.isFinite(r)&&Vt("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",a(n-r)]})]})},[fe,ce,he,de,c,x,v,y,f]),{tooltipContent:_e,tooltipMode:He}=Tt(()=>te({tooltip:_,defaultTooltipContent:Re,multiDefaultContent:Re}),[_,Re]),Ie=Tt(()=>r(R,{stops:[{offset:0,opacity:.85},{offset:1,opacity:.15}]}),[R]);if(Se.earlyReturn)return Se.earlyReturn;const Pe={chartType:"mixed",data:xe,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ve,curve:C,areaStyle:ke,lineStyle:Ce,...S&&{pointStyle:Le},size:[q,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Se.margin,showAxes:n.showAxes,xLabel:se,yLabel:le,xFormat:c,yFormat:h,enableHover:U,showGrid:J,...Ie&&{gradientFill:Ie},...Se.legendBehaviorProps,...g({title:ee,description:ie,summary:ne,accessibleTable:ae,className:l,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:_e,..."multi"===He&&{tooltipMode:"multi"},...b({linkedHover:N,selection:F,onObservation:M,onClick:T,hoverHighlight:W,hoverRadius:e.hoverRadius,mobileInteraction:Se.mobileInteraction,customHoverBehavior:Se.customHoverBehavior,customClickBehavior:Se.customClickBehavior}),...H&&H.length>0&&{annotations:H},...I&&{xExtent:I},...P&&{yExtent:P},...Se.crosshairProps,...B};return zt(D,{componentName:"DifferenceChart",width:q,height:K,children:zt(i,{ref:o,...Pe})})});"function"==typeof Xt&&(Xt.displayName="DifferenceChart");import{useMemo as Qt,forwardRef as Yt,useRef as qt}from"react";import{jsx as Kt}from"react/jsx-runtime";var Ut=Yt(function(e,o){const n=qt(null),r=re(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:a,margin:s,className:l,xFormat:c,yFormat:h,xAccessor:m="x",yAccessor:p="y",areaBy:y,lineDataAccessor:f="coordinates",colorBy:x,colorScheme:v,styleRules:A,curve:S="monotoneX",areaOpacity:k=.7,showLine:C=!0,lineWidth:L=2,showPoints:_=!1,pointRadius:H=3,normalize:I=!1,baseline:P="zero",stackOrder:B,tooltip:N,annotations:M,xExtent:T,yExtent:W,frameProps:O={},selection:j,linkedHover:G,onObservation:z,onClick:V,hoverHighlight:$,chartId:X,loading:Q,loadingContent:Y,emptyContent:q,legendInteraction:K,legendPosition:U,color:J,stroke:Z,strokeWidth:ee,opacity:ie}=e,{width:ne,height:ae,enableHover:se,showGrid:le,showLegend:ce,title:he,description:de,summary:me,accessibleTable:ue,xLabel:pe,yLabel:ye}=r,fe=Qt(()=>E(a),[a]),ge=x||y;u(o,{variant:"xy",frameRef:n});const be=d({data:fe,rawData:a,colorBy:ge,colorScheme:v,legendInteraction:K,legendPosition:U,frameLegend:O,selection:j,linkedHover:G,fallbackFields:ge?["string"==typeof ge?ge:""]:[],unwrapData:!1,onObservation:z,onClick:V,hoverHighlight:$,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"StackedAreaChart",chartId:X,showLegend:ce,userMargin:s,marginDefaults:r.marginDefaults,loading:Q,loadingContent:Y,emptyContent:q,width:ne,height:ae,hasTitle:!!he,axisChrome:oe(O,{showAxes:r.showAxes,xLabel:pe,yLabel:ye})}),xe=Qt(()=>w(m,p),[m,p]),{flattenedData:ve,lineStyle:Ae,pointStyle:we,defaultTooltipContent:Se}=Dt({safeData:fe,data:a,areaBy:y,lineDataAccessor:f,colorBy:ge,colorScale:be.colorScale,color:J,stroke:Z,strokeWidth:ee,opacity:ie,effectiveSelectionHook:be.effectiveSelectionHook,resolvedSelection:be.resolvedSelection,areaOpacity:k,showLine:C,lineWidth:L,showPoints:_,pointRadius:H,xAccessor:m,yAccessor:p,xLabel:pe,yLabel:ye,xFormat:c,yFormat:h,groupField:y||x,styleRules:A,ruleContext:xe}),ke=t({componentName:"StackedAreaChart",data:a,accessors:{xAccessor:m,yAccessor:p}}),Ce={chartType:"stackedarea",...null!=a&&{data:ve},xAccessor:m,yAccessor:p,groupAccessor:y||void 0,curve:S,normalize:I,baseline:I?"zero":P,stackOrder:B,lineStyle:Ae,..._&&we&&{pointStyle:we},size:[ne,ae],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:be.margin,showAxes:r.showAxes,xLabel:pe,yLabel:ye,xFormat:c,yFormat:h,enableHover:se,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:le,...be.legendBehaviorProps,...g({title:he,description:de,summary:me,accessibleTable:ue,className:l,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...te({tooltip:N,defaultTooltipContent:Se,multiDefaultContent:F()}),...b({linkedHover:G,selection:j,onObservation:z,onClick:V,hoverHighlight:$,hoverRadius:e.hoverRadius,mobileInteraction:be.mobileInteraction,customHoverBehavior:be.customHoverBehavior,customClickBehavior:be.customClickBehavior}),...M&&M.length>0&&{annotations:M},...T&&{xExtent:T},...W&&{yExtent:W},...be.crosshairProps,...O};return be.earlyReturn?be.earlyReturn:ke?Kt(R,{componentName:"StackedAreaChart",message:ke,width:ne,height:ae}):Kt(D,{componentName:"StackedAreaChart",width:ne,height:ae,children:Kt(i,{ref:n,...Ce})})});Ut.displayName="StackedAreaChart";import{useMemo as Jt,forwardRef as Zt,useRef as eo}from"react";import{scaleSequential as to}from"d3-scale";import{jsx as oo}from"react/jsx-runtime";var io=Zt(function(e,o){const n=eo(null);u(o,{variant:"xy",frameRef:n});const r=re(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:a,margin:s,className:l,xAccessor:c="x",yAccessor:h="y",valueAccessor:d="value",xFormat:m,yFormat:f,colorScheme:A,customColorScale:w,showValues:S=!1,valueFormat:k,cellBorderColor:C="#fff",cellBorderWidth:L=1,tooltip:_,annotations:H,xExtent:I,yExtent:P,frameProps:B={},selection:F,linkedHover:N,onObservation:M,onClick:T,hoverHighlight:W,chartId:O,loading:j,loadingContent:V,emptyContent:$,showLegend:X,legendPosition:Q,legend:Y,legendInteraction:q}=e,{width:J,height:Z,enableHover:ee,title:te,description:ie,summary:se,accessibleTable:ce,xLabel:he,yLabel:me}=r,pe=U(j,J,Z,V),ye=pe?null:K(a,J,Z,$),fe=Jt(()=>E(a),[a]),be=de(),xe=("string"==typeof B.colorScheme?B.colorScheme:void 0)??A??be??"blues",ve="function"==typeof B.heatmapColorScale?B.heatmapColorScale:"custom"===xe&&"function"==typeof w?w:void 0,Ae=X??!1,we=Q??"right",{activeSelectionHook:Se,customHoverBehavior:ke,customClickBehavior:Ce,crosshairSourceId:Le}=ae({selection:F,linkedHover:N,fallbackFields:[],onObservation:M,onClick:T,chartType:"Heatmap",chartId:O,hoverHighlight:W,colorByField:void 0,mobileInteraction:r.mobileInteraction}),Re=p(F),_e=G(N,Le);le(q,void 0,[]);const He=Jt(()=>"function"==typeof d?e=>d(e):e=>e[d],[d]),Ie=Jt(()=>{const e=fe.map(He);return ge(e)},[fe,He]),Pe=Jt(()=>{if(ve)return ve;const e=z(xe);return to(e).domain(Ie)},[xe,ve,Ie]),Be=Jt(()=>{const e=Number.isFinite(L)?Math.max(0,L):1;return()=>({stroke:C,strokeWidth:e})},[C,L]),Fe=Jt(()=>ue(Be,Se,Re),[Se,Be,Re]),De=Jt(()=>x([{label:he||y(c),accessor:c,role:"x",format:m},{label:me||y(h),accessor:h,role:"y",format:f},{label:y(d),accessor:d,role:"value",format:k}]),[c,h,he,me,d,m,f,k]),Ne=t({componentName:"Heatmap",data:a,accessors:{xAccessor:c,yAccessor:h,valueAccessor:d}}),Me=Jt(()=>{if(Ae)return{gradient:{colorFn:e=>Pe(e),domain:Ie,label:"string"==typeof d?d:"value",format:k},legendDistance:Y?.legendDistance}},[Ae,Pe,Ie,d,k,Y?.legendDistance]),{margin:Te,legend:We,legendPosition:Oe,legendMarginReserved:Ee}=ne({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:we,userMargin:s,defaults:r.marginDefaults,additionalLegend:Me,chartWidth:J,chartHeight:Z,legendLayout:B.legendLayout,frameLegend:B,hasTitle:!!te,axisChrome:oe(B,{showAxes:r.showAxes,xLabel:he,yLabel:me})}),je={chartType:"heatmap",...null!=a&&{data:fe},xAccessor:c,yAccessor:h,valueAccessor:d,colorScheme:"custom"!==xe?xe:void 0,...ve&&{heatmapColorScale:ve},areaStyle:Fe,showValues:S,heatmapValueFormat:k,size:[J,Z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Te,showAxes:r.showAxes,xLabel:he,yLabel:me,xFormat:m,yFormat:f,enableHover:ee,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...We&&{legend:We,legendPosition:Oe},...Ee&&{__legendMarginReservedFor:We},...g({title:te,description:ie,summary:se,accessibleTable:ce,className:l,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...v({tooltip:_,defaultTooltipContent:De}),...b({linkedHover:N,selection:F,onObservation:M,onClick:T,hoverHighlight:W,hoverRadius:e.hoverRadius,mobileInteraction:r.mobileInteraction,customHoverBehavior:ke,customClickBehavior:Ce}),...H&&H.length>0&&{annotations:H},...I&&{xExtent:I},...P&&{yExtent:P},..._e,...B};return pe||ye||(Ne?oo(R,{componentName:"Heatmap",message:Ne,width:J,height:Z}):oo(D,{componentName:"Heatmap",width:J,height:Z,children:oo(i,{ref:n,...je})}))});io.displayName="Heatmap";import{useMemo as no,useCallback as ro,forwardRef as ao,useRef as so}from"react";import{jsx as lo}from"react/jsx-runtime";var co=ao(function(o,n){const r=so(null),a=re(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:s,margin:l,className:c,xFormat:h,yFormat:m,xAccessor:p="x",yAccessor:f="y",sizeBy:A,sizeRange:S=[5,40],colorBy:k,colorScheme:C,styleRules:L,bubbleOpacity:_=.6,bubbleStrokeWidth:H=1,bubbleStrokeColor:I="white",tooltip:P,marginalGraphics:B,pointIdAccessor:F,annotations:N,regression:M,xExtent:T,yExtent:W,frameProps:O={},selection:j,linkedHover:G,linkedBrush:z,onObservation:$,onClick:X,hoverHighlight:Q,chartId:q,loading:K,loadingContent:U,emptyContent:J,legendInteraction:Z,legendPosition:ee,color:te,stroke:ne,strokeWidth:ae,opacity:se}=o,{width:le,height:ce,enableHover:he,showGrid:de,showLegend:me,title:ue,description:pe,summary:ye,accessibleTable:fe,xLabel:ge,yLabel:be}=a,xe=no(()=>E(s),[s]),ve=void 0===s,Ae=d({data:xe,rawData:s,colorBy:k,colorScheme:C,legendInteraction:Z,legendPosition:ee,frameLegend:O,selection:j,linkedHover:G,fallbackFields:k?["string"==typeof k?k:""]:[],unwrapData:!1,onObservation:$,onClick:X,hoverHighlight:Q,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"BubbleChart",chartId:q,showLegend:me,userMargin:l,marginDefaults:a.marginDefaults,loading:K,loadingContent:U,emptyContent:J,width:le,height:ce,hasTitle:!!ue,axisChrome:oe(O,{showAxes:a.showAxes,xLabel:ge,yLabel:be})}),{domain:we,trackPushed:Se,reset:Ce}=He({accessor:A,data:xe,isPushMode:ve}),Le=ro(e=>{Se([e]),r.current?.push(e)},[Se]),Re=ro(e=>{Se(e),r.current?.pushMany(e)},[Se]);u(n,{variant:"xy",frameRef:r,overrides:{push:Le,pushMany:Re,clear:()=>{Ce(),r.current?.clear()}}});const _e=Y(z),Ie=(ie({name:_e?.name||"__unused_brush__",xField:_e?.xField||("string"==typeof p?p:void 0),yField:_e?.yField||("string"==typeof f?f:void 0)}),no(()=>({stroke:I,strokeWidth:H}),[I,H])),Pe=no(()=>we??[0,1],[we]),Be=ro(e=>V(e,A,S,Pe),[A,S,Pe]),Fe=no(()=>w(p,f),[p,f]),De=ke({colorBy:k,colorScale:Ae.colorScale,color:te,fillOpacity:_,radiusFn:Be,baseStyleExtras:Ie,stroke:ne,strokeWidth:ae,opacity:se,styleRules:L,ruleContext:Fe,effectiveSelectionHook:Ae.effectiveSelectionHook,resolvedSelection:Ae.resolvedSelection}),Ne=no(()=>x([{label:ge||y(p),accessor:p,role:"x",format:h},{label:be||y(f),accessor:f,role:"y",format:m},{label:y(A),accessor:A,role:"size"},...k?[{label:y(k),accessor:k,role:"color"}]:[]]),[p,f,ge,be,A,k,h,m]);if(Ae.earlyReturn)return Ae.earlyReturn;const Me=t({componentName:"BubbleChart",data:s,accessors:{xAccessor:p,yAccessor:f},requiredProps:{sizeBy:A}});if(Me)return lo(R,{componentName:"BubbleChart",message:Me,width:le,height:ce});const Te=e(M),We=Te?[Te,...N||[]]:N,Oe={chartType:"bubble",...null!=s&&{data:xe},xAccessor:p,yAccessor:f,colorAccessor:k||void 0,sizeAccessor:A,sizeRange:S,pointStyle:De,colorScheme:C,size:[le,ce],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ae.margin,showAxes:a.showAxes,xLabel:ge,yLabel:be,xFormat:h,yFormat:m,enableHover:he,showGrid:de,...Ae.legendBehaviorProps,...g({title:ue,description:pe,summary:ye,accessibleTable:fe,className:c,animate:o.animate,maxDevicePixelRatio:o.maxDevicePixelRatio,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...v({tooltip:P,defaultTooltipContent:Ne}),...b({linkedHover:G,selection:j,onObservation:$,onClick:X,hoverHighlight:Q,hoverRadius:o.hoverRadius,mobileInteraction:Ae.mobileInteraction,customHoverBehavior:Ae.customHoverBehavior,customClickBehavior:Ae.customClickBehavior}),...B&&{marginalGraphics:B},...F&&{pointIdAccessor:F},...We&&We.length>0&&{annotations:We},...T&&{xExtent:T},...W&&{yExtent:W},...Ae.crosshairProps,...O};return lo(D,{componentName:"BubbleChart",width:le,height:ce,children:lo(i,{ref:r,...Oe})})});co.displayName="BubbleChart";import*as ho from"react";import{useMemo as mo,useCallback as uo,useState as po,useRef as yo}from"react";import*as fo from"react";import{jsx as go}from"react/jsx-runtime";var bo=null,xo=null;function vo(e){const[t,o]=fo.useState(()=>bo);return fo.useEffect(()=>{if(t)return;let e=!1;return(bo?Promise.resolve(bo):(xo||(xo=import("./c-DADXPJXV.min.js").then(e=>bo=e.ScatterplotMatrixBrushOverlay).catch(e=>{throw xo=null,e})),xo)).then(t=>{e||o(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?go(t,{...e}):null}import{jsx as Ao,jsxs as wo}from"react/jsx-runtime";var So="__splomIdx",ko={top:4,bottom:4,left:4,right:4};function Co({data:e,xField:t,yField:o,fieldLabels:n,cellSize:r,pointRadius:a,pointOpacity:s,colorBy:l,colorScale:c,brushSelectionName:h,hoverSelectionName:d,unselectedOpacity:m,maxDevicePixelRatio:u,mobileInteraction:p,mode:y,onPointHover:f,onPointClick:g}){const x=yo(null),v=ce({name:h,clientId:`splom-${t}-${o}`,fields:[t,o]}),A=ie({name:h,xField:t,yField:o}),w=ce({name:d,clientId:"splom-hover-source",fields:[So]}),S=w.selectPoints,k=uo(e=>{e?A.brushInteraction.during(e):A.brushInteraction.end(null)},[A.brushInteraction]),C=uo(e=>{if(!e)return void f?.(null);const t=e.data,o=t?.[So];void 0!==o&&(S({[So]:[o]}),f?.(t,e.x+ko.left,e.y+ko.top))},[S,f]),L=uo(e=>{if(!e)return void g?.(null);const t=e.data;t&&g?.(t,e.x+ko.left,e.y+ko.top)},[g]),R=uo(e=>{const t={opacity:s,r:a};return t.fill=l?j(e,l,c):_,"hover"===y?w.isActive&&w.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):w.isActive&&(t.opacity=.6*s):v.isActive&&!v.predicate(e)&&(t.opacity=m),t},[s,a,l,y,c,w,v,m]);return wo("div",{style:{position:"relative",width:r,height:r},children:[Ao(i,{ref:x,chartType:"scatter",data:e,size:[r,r],xAccessor:t,yAccessor:o,pointStyle:R,margin:ko,showAxes:!1,maxDevicePixelRatio:u,enableHover:"hover"===y,accessibleTable:!1,description:`${Z(n,t)??t} versus ${Z(n,o)??o} scatterplot`,...b({forceHoverBehavior:"hover"===y,forceClickBehavior:!!g,mobileInteraction:p,customHoverBehavior:C,customClickBehavior:L}),tooltipContent:"hover"===y?()=>null:void 0}),"brush"===y&&Ao(vo,{frameRef:x,cellSize:r,onBrush:k})]})}function Lo({data:e,field:t,label:o,cellSize:i,bins:n,colorBy:r,colorScale:a,brushSelectionName:s,hoverSelectionName:l,mode:c}){const h=ce({name:s,clientId:"splom-diag-"+t,fields:[t]}),d=ce({name:l,clientId:`splom-diag-${t}-hover`,fields:[So]}),m="hover"===c?d:h,u=m.isActive,p=m.predicate,y=mo(()=>{const o="string"==typeof r?r:null,a=[],s=new Set;for(const i of e){const e=i[t];if(null==e||isNaN(e)||a.push(Number(e)),o){const e=i[o];null!=e&&s.add(e+"")}}if(0===a.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=ge(a),h=(c-l)/n||1,d=Array.from(s),m=new Map(d.map((e,t)=>[e,t])),y=Array(n).fill(0),f=Array(n).fill(0),g=Array.from({length:n},()=>Array(d.length).fill(0)),b=Array.from({length:n},()=>Array(d.length).fill(0));for(const i of e){const e=i[t];if(null==e||isNaN(e))continue;const r=Math.min(Math.floor((e-l)/h),n-1);if(y[r]++,u&&!p(i)||f[r]++,o){const e=m.get(i[o]+"");void 0!==e&&(g[r][e]++,u&&!p(i)||b[r][e]++)}}const x=fe(y,1),v=g.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/x*(i-24),s={x:t/n*i,w:i/n-1,h:a,y0:o,category:d[r]};return o+=a,s})}),A=b.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/x*(i-24),s={x:t/n*i,w:i/n-1,h:a,y0:o,category:d[r]};return o+=a,s})});return{bars:y.map((e,t)=>({x:t/n*i,w:i/n-1,h:e/x*(i-24),count:e})),selectedBars:f.map((e,t)=>({x:t/n*i,w:i/n-1,h:e/x*(i-24),count:e})),categoryBars:v,selectedCategoryBars:A,max:x,categories:d}},[e,t,n,i,u,p,r]);return wo("svg",{width:i,height:i,style:{overflow:"hidden"},children:[Ao("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:o}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,o)=>Ao("rect",{x:e.x,y:i-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):_,opacity:u?.3:.6},`bg-${t}-${o}`))):y.bars.map((e,t)=>Ao("rect",{x:e.x,y:i-e.h,width:Math.max(e.w,1),height:e.h,fill:_,opacity:u?.3:.6},"bg-"+t)),u&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,o)=>Ao("rect",{x:e.x,y:i-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):_,opacity:.7},`sel-${t}-${o}`))):y.selectedBars.map((e,t)=>Ao("rect",{x:e.x,y:i-e.h,width:Math.max(e.w,1),height:e.h,fill:_,opacity:.7},"sel-"+t)))]})}function Ro({label:e,cellSize:t}){return Ao("svg",{width:t,height:t,children:Ao("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function _o(e){const{data:t,fields:o,fieldLabels:i={},colorBy:n,colorScheme:r,cellSize:a=150,cellGap:s=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:h="histogram",histogramBins:d=20,brushMode:m="crossfilter",hoverMode:u=!0,unselectedOpacity:p=.1,showGrid:y=!1,maxDevicePixelRatio:f,tooltip:g,showLegend:b,idAccessor:x,width:v,className:A,title:w,description:S,summary:L,accessibleTable:R=!0,onObservation:H,onClick:I,chartId:B}=e,F="splom",D="splom-hover",W=ee(e.mobileInteraction,{mode:e.mode,width:v??o.length*a,mobileSemantics:e.mobileSemantics}),O=u?"hover":m?"brush":"hover",E=pe(e=>e.clearSelection),[j,G]=po(null),z=uo(()=>{E(D),G(null)},[E,D]),V=mo(()=>(t||[]).map((e,t)=>void 0!==e[So]?e:{...e,[So]:t}),[t]),$=se(V,n,r),X=ho.useId().replace(/:/g,"")+"-data-table",Q=mo(()=>(t||[]).map(e=>({type:"point",datum:e})),[t]),Y=mo(()=>q(g),[g]),K=40,U=uo((e,t,o,i)=>[K+s+e*(a+s)+(o??0),t*(a+s)+(i??0)],[K,a,s]),J=void 0!==b?b:!!n,te=mo(()=>{if(!J||!n)return null;const e="string"==typeof n?n:null;return e?Array.from(new Set(V.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:$?$(e+""):_})):null},[J,n,V,$]),oe=mo(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>a+"px").join(" "),gridTemplateRows:o.map(()=>a+"px").join(" ")+" 40px",gap:s+"px",width:"fit-content"}),[o,a,s,K]);return wo("div",{className:A,style:{position:"relative"},role:"group","aria-label":S||w||`Scatterplot matrix comparing ${o.length} fields`,children:[w&&Ao("div",{className:"semiotic-chart-title",style:{fontWeight:600,marginBottom:8},children:w}),R&&Ao(C,{accessibleTable:R,children:Ao(M,{tableId:X})}),Ao(N,{summary:L}),te&&Ao("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:te.map(e=>wo("div",{style:{display:"flex",alignItems:"center",gap:4},children:[Ao("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),Ao("span",{style:{fontSize:11},children:e.label})]},e.label))}),wo("div",{style:{position:"relative",width:"fit-content"},children:[wo("div",{style:oe,onMouseLeave:"hover"===O?z:void 0,children:[o.map((e,t)=>wo(ho.Fragment,{children:[Ao("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:Z(i,e)??e}),o.map((o,r)=>t===r?"label"===h?Ao(Ro,{label:Z(i,e)??e,cellSize:a},"diag-"+e):Ao(Lo,{data:V,field:e,label:Z(i,e)??e,cellSize:a,bins:d,colorBy:n,colorScale:$,brushSelectionName:F,hoverSelectionName:D,unselectedOpacity:p,mode:O},"diag-"+e):Ao(Co,{data:V,xField:o,yField:e,fieldLabels:i,cellSize:a,pointRadius:l,pointOpacity:c,colorBy:n,colorScale:$,brushSelectionName:F,hoverSelectionName:D,unselectedOpacity:p,showGrid:y,maxDevicePixelRatio:f,mobileInteraction:W,mode:O,onPointHover:"hover"===O?(i,n,a)=>{if(i){if(G({datum:i,xField:o,yField:e,colIndex:r,rowIndex:t,px:n??0,py:a??0}),H){const[e,o]=U(r,t,n,a);H({type:"hover",datum:i,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:B})}}else G(null),H&&H({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:B})}:void 0,onPointClick:I||H?(e,o,i)=>{if(!e)return;const[n,a]=U(r,t,o,i);I&&I(e,{x:n,y:a}),H&&H({type:"click",datum:e,x:n,y:a,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:B})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),Ao("div",{})," ",o.map(e=>Ao("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:Z(i,e)??e},"col-label-"+e))]}),j&&"hover"===O&&!1!==g&&(()=>{const e=j.datum,t=Z(i,j.xField)??j.xField,r=Z(i,j.yField)??j.yField,l=n?"function"==typeof n?n(e):e[n]:null,c=x?"function"==typeof x?x(e):e[x]:"Row "+e[So],h=K+s+j.colIndex*(a+s)+j.px,d=j.rowIndex*(a+s)+j.py,m={...e};delete m[So];const u="function"==typeof Y,p=u?Y(m):null,y=wo(T,{style:{color:"var(--semiotic-tooltip-text, #333)",background:"var(--semiotic-tooltip-bg, rgba(255,255,255,0.95))",border:"1px solid var(--semiotic-border, #ddd)",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",boxShadow:"none"},children:[Ao("div",{style:{fontWeight:"bold",marginBottom:2},children:c+""}),wo("div",{children:[t,": ",null!=e[j.xField]?Number(e[j.xField]).toFixed(1):"–"]}),wo("div",{children:[r,": ",null!=e[j.yField]?Number(e[j.yField]).toFixed(1):"–"]}),null!=l&&wo("div",{style:{opacity:.8},children:["string"==typeof n?n:"group",": ",l+""]})]}),f=u?p:y;return f?Ao(P,{x:h,y:d,containerWidth:K+o.length*a+o.length*s,containerHeight:o.length*a+K+o.length*s,margin:{top:0,right:0,bottom:0,left:0},className:"scatterplot-matrix-tooltip",zIndex:10,children:f}):null})()]}),R&&Ao(C,{accessibleTable:R,children:Ao(k,{scene:Q,chartType:"scatterplot matrix",tableId:X,chartTitle:w})})]})}function Ho(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,i={};return!o&&t&&(i.splom={resolution:t}),o&&(i["splom-hover"]={resolution:"union"}),Ao(B,{selections:i,children:Ao(_o,{...e})})}Ho.displayName="ScatterplotMatrix";import{useState as Io,useRef as Po,useEffect as Bo,useMemo as Fo,useCallback as Do}from"react";import*as No from"react";import{jsx as Mo}from"react/jsx-runtime";var To=null,Wo=null;function Oo(e){const[t,o]=No.useState(()=>To);return No.useEffect(()=>{if(t)return;let e=!1;return(To?Promise.resolve(To):(Wo||(Wo=import("./c-MNF2S4AA.min.js").then(e=>To=e.MinimapBrushOverlay).catch(e=>{throw Wo=null,e})),Wo)).then(t=>{e||o(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?Mo(t,{...e}):null}import{jsx as Eo,jsxs as jo}from"react/jsx-runtime";function Go(e){const{data:o,width:n=600,height:r=400,margin:a,className:s,title:l,description:c,summary:h,xLabel:d,yLabel:m,xFormat:u,yFormat:p,xAccessor:f="x",yAccessor:g="y",lineBy:b,lineDataAccessor:v="coordinates",colorBy:A,colorScheme:w,curve:S="linear",lineWidth:k=2,fillArea:C=!1,areaOpacity:L=.3,showPoints:H=!1,pointRadius:I=3,enableHover:P=!0,showGrid:B=!1,showLegend:F,legendPosition:N,tooltip:M,minimap:T={},renderBefore:W=!1,onBrush:O,brushExtent:G,yExtent:z,frameProps:V={},loading:$,loadingContent:X,emptyContent:Q}=e,Y=U($,n,r,X),q=Y?null:K(o,n,r,Q),J=Fo(()=>E(o),[o]),[Z,ee]=Io(null),ie=G??Z,re=Do(e=>{G||ee(e),O?.(e)},[G,O]),ae=Po(null),[le,ce]=Io(null);Bo(()=>{let e=0,t=!1;const o=()=>{if(t)return;const i=ae.current?.getScales?.();i?ce(i):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[o]);const he=void 0!==J[0]?.[v],de=Fo(()=>{if(he)return J;if(b){const e=J.reduce((e,t)=>{const o="function"==typeof b?b(t):t[b];if(!e[o]){const t={[v]:[]};"string"==typeof b&&(t[b]=o),e[o]=t}return e[o][v].push(t),e},{});return Object.values(e)}return[{[v]:J}]},[J,b,v,he]),me=Fo(()=>he||b?de.flatMap(e=>{const t=e[v]||[];return b&&"string"==typeof b?t.map(t=>({...t,[b]:e[b]})):t}):J,[de,v,he,b,J]),ue=se(J,A,w),pe=ot({lineWidth:k,colorBy:A,colorScale:ue,fillArea:C,areaOpacity:L}),ye=Fo(()=>{if(T.lineStyle)return T.lineStyle},[T.lineStyle]),fe=ot({lineWidth:1,colorBy:A,colorScale:ue}),ge=ye??fe,be=Fo(()=>{if(H)return e=>{const t={r:I,fillOpacity:1};return t.fill=A?j(e.parentLine||e,A,ue):_,t}},[H,I,A,ue]),{legend:xe,margin:ve,legendPosition:Ae,legendMarginReserved:we}=ne({data:de,colorBy:A,colorScale:ue,showLegend:F,legendPosition:N,userMargin:a,chartWidth:n,chartHeight:r,frameLegend:V,hasTitle:!!l,axisChrome:oe(V,{showAxes:!0,xLabel:d,yLabel:m})}),Se=T.height||60,ke=Fo(()=>({top:T.margin?.top??0,bottom:T.margin?.bottom??20,left:T.margin?.left??ve.left,right:T.margin?.right??ve.right}),[T.margin,ve]),Ce=T.brushDirection||"x",Le=Fo(()=>x([{label:d||y(f),accessor:f,role:"x",format:u},{label:m||y(g),accessor:g,role:"y",format:p}]),[f,g,d,m,u,p]),Re=t({componentName:"MinimapChart",data:o,accessors:{xAccessor:f,yAccessor:g}});if(Re)return Eo(R,{componentName:"MinimapChart",message:Re,width:n,height:r});const _e=C?"area":"line",He={chartType:_e,data:me,xAccessor:f,yAccessor:g,groupAccessor:b||void 0,curve:S,lineStyle:pe,...H&&{pointStyle:be},size:[n,r],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},margin:ve,showAxes:!0,xLabel:d,yLabel:m,xFormat:u,yFormat:p,enableHover:P,showGrid:B,...xe&&{legend:xe,legendPosition:Ae},...we&&{__legendMarginReservedFor:xe},...l&&{title:l},...c&&{description:c},...h&&{summary:h},...void 0!==e.accessibleTable&&{accessibleTable:e.accessibleTable},...void 0!==e.animate&&{animate:e.animate},...void 0!==e.hoverRadius&&{hoverRadius:e.hoverRadius},...te({tooltip:M,defaultTooltipContent:Le}),...ie&&{xExtent:ie},...z&&{yExtent:z},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...V},Ie={chartType:_e,data:me,xAccessor:f,yAccessor:g,groupAccessor:b||void 0,curve:S,lineStyle:ge,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},size:[n,Se+ke.top+ke.bottom],margin:ke,showAxes:T.showAxes??!1,background:T.background,enableHover:!1,accessibleTable:!1,description:(c||l||"Chart")+" overview minimap",animate:!1,...z&&{yExtent:z}},Pe=jo("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[Eo(i,{ref:ae,...Ie}),Eo(Oo,{width:n-ke.left-ke.right,height:Se,margin:ke,scales:le,brushDirection:Ce,extent:ie,onBrush:re})]},"minimap"),Be=Eo("div",{style:{overflow:"hidden"},children:Eo(i,{...He})},"main");return Y||q||Eo(D,{componentName:"MinimapChart",width:n,height:r,children:jo("div",{className:"minimap-chart"+(s?" "+s:""),role:"group","aria-label":c||l||"Chart with overview minimap",children:[W?Pe:Be,W?Be:Pe]})})}Go.displayName="MinimapChart";import{useMemo as zo,forwardRef as Vo,useRef as $o}from"react";var Xo={topLeft:{label:"Low / High",color:"#E9C46A",opacity:.08},topRight:{label:"High / High",color:"#2A9D8F",opacity:.08},bottomLeft:{label:"Low / Low",color:"#E76F51",opacity:.08},bottomRight:{label:"High / Low",color:"#86BBD8",opacity:.08}};import{Fragment as Qo,jsx as Yo,jsxs as qo}from"react/jsx-runtime";function Ko(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Uo=Vo(function(e,o){const n=$o(null);u(o,{variant:"xy",frameRef:n});const r=re(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:a,margin:s,className:l,xFormat:c,yFormat:h,xAccessor:m="x",yAccessor:p="y",xCenter:f,yCenter:g,quadrants:v,centerlineStyle:A={},showQuadrantLabels:S=!0,quadrantLabelSize:k=12,colorBy:C,colorScheme:L,styleRules:H,sizeBy:I,sizeRange:P=[3,15],pointRadius:B=5,pointOpacity:F=.8,tooltip:N,pointIdAccessor:M,annotations:T,frameProps:W={},selection:O,linkedHover:j,onObservation:G,onClick:z,hoverHighlight:$,chartId:X,loading:Q,loadingContent:Y,emptyContent:K,legendInteraction:U,legendPosition:J,color:Z,stroke:ee,strokeWidth:te,opacity:ie}=e,{width:ne,height:ae,enableHover:se,showGrid:le,showLegend:ce,title:he,description:de,summary:ue,accessibleTable:pe,xLabel:ye,yLabel:fe}=r,be=zo(()=>({topLeft:Ko(Xo.topLeft,v?.topLeft),topRight:Ko(Xo.topRight,v?.topRight),bottomLeft:Ko(Xo.bottomLeft,v?.bottomLeft),bottomRight:Ko(Xo.bottomRight,v?.bottomRight)}),[v]),xe=zo(()=>E(a),[a]),ve=d({data:xe,rawData:a,colorBy:C,colorScheme:L,legendInteraction:U,legendPosition:J,frameLegend:W,selection:O,linkedHover:j,fallbackFields:"string"==typeof C?[C]:[],unwrapData:!1,onObservation:G,onClick:z,hoverHighlight:$,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"QuadrantChart",chartId:X,showLegend:ce,userMargin:s,marginDefaults:r.marginDefaults,loading:Q,loadingContent:Y,emptyContent:K,width:ne,height:ae,hasTitle:!!he,axisChrome:oe(W,{showAxes:r.showAxes,xLabel:ye,yLabel:fe})});me("QuadrantChart",xe,"xAccessor",m),me("QuadrantChart",xe,"yAccessor",p);const Ae=zo(()=>{if(!xe.length)return;const e="function"==typeof m?m:e=>+e[m],t="function"==typeof p?p:e=>+e[p];let o=1/0,i=-1/0,n=1/0,r=-1/0;for(const a of xe){const s=e(a),l=t(a);isFinite(s)&&(o>s&&(o=s),s>i&&(i=s)),isFinite(l)&&(n>l&&(n=l),l>r&&(r=l))}if(null!=f&&isFinite(f)&&(o>f&&(o=f),f>i&&(i=f)),null!=g&&isFinite(g)&&(n>g&&(n=g),g>r&&(r=g)),o===1/0)return;const a=.1*(i-o)||1,s=.1*(r-n)||1;return{xExtent:[o-a,i+a],yExtent:[n-s,r+s]}},[xe,m,p,f,g]),we=zo(()=>{if(!I||0===xe.length)return;const e=xe.map(e=>"function"==typeof I?I(e):e[I]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?ge(e):void 0},[xe,I]),Se=zo(()=>"function"==typeof m?m:e=>+e[m],[m]),Ce=zo(()=>"function"==typeof p?p:e=>+e[p],[p]),Le=zo(()=>e=>{const t=Se(e),o=Ce(e),i=null!=f?t>=f:void 0,n=null!=g?o>=g:void 0;return void 0===n||void 0===i?Z||_:n&&i?be.topRight.color:n&&!i?be.topLeft.color:!n&&i?be.bottomRight.color:be.bottomLeft.color},[Se,Ce,f,g,be,Z]),Re=zo(()=>I?e=>V(e,I,P,we):void 0,[I,P,we]),_e=zo(()=>w(m,p),[m,p]),He=ke({colorBy:C,colorScale:ve.colorScale,color:Z,pointRadius:B,fillOpacity:F,radiusFn:Re,fallbackFill:Le,stroke:ee,strokeWidth:te,opacity:ie,styleRules:H,ruleContext:_e,effectiveSelectionHook:ve.effectiveSelectionHook,resolvedSelection:ve.resolvedSelection}),Ie=zo(()=>{if(!xe.length)return;const e=new Set;"string"==typeof m&&e.add(m),"string"==typeof p&&e.add(p),"string"==typeof C&&e.add(C),"string"==typeof I&&e.add(I);const t=xe[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[xe,m,p,C,I]),Pe=zo(()=>x([...Ie?[{label:Ie,accessor:Ie,role:"title"}]:[],{label:ye||y(m),accessor:m,role:"x",format:c},{label:fe||y(p),accessor:p,role:"y",format:h},...C?[{label:y(C),accessor:C,role:"color"}]:[],...I?[{label:y(I),accessor:I,role:"size"}]:[]]),[Ie,m,p,ye,fe,C,I,c,h]),Be=t({componentName:"QuadrantChart",data:a,accessors:{xAccessor:m,yAccessor:p}}),Fe=zo(()=>{const e={stroke:A.stroke||"#999",strokeWidth:A.strokeWidth??1,dashArray:A.strokeDasharray||[]};return[(t,o,i,n)=>{if(!i?.x||!i?.y)return;const r=n.width,a=n.height,s=null!=f?i.x(f):r/2,l=null!=g?i.y(g):a/2;if(null!=f&&!isFinite(s))return;if(null!=g&&!isFinite(l))return;const c=Math.max(0,Math.min(r,s)),h=Math.max(0,Math.min(a,l)),d=[{config:be.topLeft,x:0,y:0,w:c,h:h},{config:be.topRight,x:c,y:0,w:r-c,h:h},{config:be.bottomLeft,x:0,y:h,w:c,h:a-h},{config:be.bottomRight,x:c,y:h,w:r-c,h:a-h}];for(const e of d)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,a),t.stroke(),t.beginPath(),t.moveTo(0,h),t.lineTo(r,h),t.stroke(),t.setLineDash([])}]},[f,g,be,A]),De=zo(()=>S?[...Fe,(e,t,o,i)=>{if(!o?.x||!o?.y)return;const n=i.width,r=i.height,a=null!=f?o.x(f):n/2,s=null!=g?o.y(g):r/2;(null==f||isFinite(a))&&(null==g||isFinite(s))&&(e.font=`600 ${k}px sans-serif`,e.globalAlpha=.5,e.fillStyle=be.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(be.topLeft.label,8,8),e.fillStyle=be.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(be.topRight.label,n-8,8),e.fillStyle=be.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(be.bottomLeft.label,8,r-8),e.fillStyle=be.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(be.bottomRight.label,n-8,r-8),e.globalAlpha=1)}]:Fe,[Fe,S,k,be,f,g]),Ne=zo(()=>{const e=W.canvasPreRenderers||[];return[...De,...e]},[De,W.canvasPreRenderers]),Me=zo(()=>{const e={stroke:A.stroke||"#999",strokeWidth:A.strokeWidth??1,dashArray:A.strokeDasharray?Array.isArray(A.strokeDasharray)?A.strokeDasharray.join(","):A.strokeDasharray:void 0};return[(t,o,i)=>{if(!o?.x||!o?.y)return null;const n=i.width,r=i.height,a=null!=f?o.x(f):n/2,s=null!=g?o.y(g):r/2;if(null!=f&&!isFinite(a))return null;if(null!=g&&!isFinite(s))return null;const l=Math.max(0,Math.min(n,a)),c=Math.max(0,Math.min(r,s));return qo(Qo,{children:[[{config:be.topLeft,x:0,y:0,w:l,h:c},{config:be.topRight,x:l,y:0,w:n-l,h:c},{config:be.bottomLeft,x:0,y:c,w:l,h:r-c},{config:be.bottomRight,x:l,y:c,w:n-l,h:r-c}].map((e,t)=>e.w>0&&e.h>0?Yo("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),Yo("line",{x1:l,y1:0,x2:l,y2:r,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),Yo("line",{x1:0,y1:c,x2:n,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),S&&qo(Qo,{children:[Yo("text",{x:8,y:8+k,fill:be.topLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:be.topLeft.label}),Yo("text",{x:n-8,y:8+k,fill:be.topRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:be.topRight.label}),Yo("text",{x:8,y:r-8,fill:be.bottomLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:be.bottomLeft.label}),Yo("text",{x:n-8,y:r-8,fill:be.bottomRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:be.bottomRight.label})]})]})}]},[f,g,be,A,S,k]);if(ve.earlyReturn)return ve.earlyReturn;const Te={chartType:"scatter",...null!=a&&{data:xe},xAccessor:m,yAccessor:p,colorAccessor:C||void 0,sizeAccessor:I||void 0,sizeRange:P,pointStyle:He,colorScheme:L,size:[ne,ae],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},margin:ve.margin,showAxes:r.showAxes,xLabel:ye,yLabel:fe,xFormat:c,yFormat:h,enableHover:se,showGrid:le,...Ae&&{xExtent:Ae.xExtent,yExtent:Ae.yExtent},...ve.legendBehaviorProps,...he&&{title:he},...de&&{description:de},...ue&&{summary:ue},...void 0!==pe&&{accessibleTable:pe},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===N?()=>null:!0===N||void 0===N?Pe:q(N)||Pe,...b({linkedHover:j,selection:O,onObservation:G,onClick:z,hoverHighlight:$,hoverRadius:e.hoverRadius,mobileInteraction:ve.mobileInteraction,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior}),...M&&{pointIdAccessor:M},...T&&T.length>0&&{annotations:T},canvasPreRenderers:Ne,...ve.crosshairProps,...W,...Ne.length>0&&{canvasPreRenderers:Ne},svgPreRenderers:Me};return Be?Yo(R,{componentName:"QuadrantChart",message:Be,width:ne,height:ae}):Yo(D,{componentName:"QuadrantChart",width:ne,height:ae,children:Yo(i,{ref:n,...Te})})});Uo.displayName="QuadrantChart";import*as Jo from"react";import{useMemo as Zo,useCallback as ei,forwardRef as ti,useRef as oi,useImperativeHandle as ii}from"react";import{jsx as ni}from"react/jsx-runtime";var ri="__ma_unitized",ai="__ma_series";function si(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function li(e,t){return t[0]+e*(t[1]-t[0])}var ci=ti(function(e,o){const n=oi(null),r=oi([]),a=oi(e.series);a.current=e.series,ii(o,()=>{const e=()=>(a.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const o=e(),i=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],a=t.extent||r.current[e];if(!a)continue;const s=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=s&&isFinite(s)&&n.current.push({...i,[ri]:si(s,a),[ai]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const o=e(),i=[];for(const e of t)for(let t=0;o.length>t&&2>t;t++){const n=o[t],a=n.extent||r.current[t];if(!a)continue;const s=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=s&&isFinite(s)&&i.push({...e,[ri]:si(s,a),[ai]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const s=re(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:l,margin:c,className:h,xFormat:m,xAccessor:u="x",series:p,colorScheme:y,curve:f="monotoneX",lineWidth:g=2,tooltip:x,annotations:v,frameProps:A={},selection:w,linkedHover:S,onObservation:k,onClick:C,hoverHighlight:_,chartId:I,loading:P,loadingContent:B,emptyContent:N,legendInteraction:M,legendPosition:T,stroke:W,strokeWidth:O,opacity:j}=e,{width:G,height:z,enableHover:V,showGrid:$,showLegend:X=!0,title:Y,description:q,summary:J,accessibleTable:Z,xLabel:ee}=s,ie=Zo(()=>E(l),[l]),ne=Zo(()=>E(p),[p]),ae=ne,se=2===ne.length,le=Zo(()=>se?{...A.legendLayout,sideGutter:A.legendLayout?.sideGutter??70}:A.legendLayout,[A.legendLayout,se]);"undefined"==typeof process||"production"===process.env?.NODE_ENV||se||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${ne.length}. Rendering as a standard multi-line chart.`);const ce=U(P,G,z,B),de=ce?null:K(l,G,z,N),me=he(),ue=Zo(()=>{let e;if(Array.isArray(y))e=y;else if(me&&me.length>0)e=me;else{const t=L[y];e=Array.isArray(t)?t:H}return ae.map((t,o)=>t.color||e[o%e.length])},[ae,y,me]),pe=Zo(()=>ne.map((e,t)=>e.label||"Series "+(t+1)),[ne]),{unitizedData:ye,extents:fe}=Zo(()=>{if(0===ie.length){const e=ne.map(e=>e.extent||null).filter(Boolean);return e.length===ne.length&&(r.current=e),{unitizedData:[],extents:e.length===ne.length?e:[]}}const e=ne.map(e=>e.extent||function(e,t){let o=1/0,i=-1/0;const n="function"==typeof t?t:e=>e[t];for(const t of e){const e=n(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>i&&(i=e))}if(!isFinite(o)||!isFinite(i))return[0,1];if(o===i){const e=0===o?1:.1*Math.abs(o);return[o-e,i+e]}return[o,i]}(ie,e.yAccessor));if(r.current=e,!se){const t=[];for(const e of ie)for(let o=0;ne.length>o;o++){const i=ne[o],n=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=n&&t.push({...e,[ri]:n,[ai]:pe[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of ie)for(let i=0;2>i;i++){const n=ne[i],r=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(o);null!=r&&t.push({...o,[ri]:si(r,e[i]),[ai]:pe[i]})}return{unitizedData:t,extents:e}},[ie,ne,se,pe]),ge=Zo(()=>{if(se&&fe.length>=2)return[{orient:"left",label:pe[0],tickFormat:ne[0].format||(e=>{const t=li(e,fe[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:pe[1],tickFormat:ne[1].format||(e=>{const t=li(e,fe[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[se,fe,ne,pe]),be=Zo(()=>ye.length>0?ye:pe.map(e=>({[ai]:e})),[ye,pe]),xe=d({data:be,rawData:l,colorBy:ai,colorScheme:ue,legendInteraction:M,legendPosition:T,frameLegend:{...A,legendLayout:le},selection:w,linkedHover:S,fallbackFields:[ai],unwrapData:!1,onObservation:k,onClick:C,hoverHighlight:_,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"MultiAxisLineChart",chartId:I,showLegend:X,legendLayout:le,userMargin:c,marginDefaults:se?{...s.marginDefaults,left:70,right:70}:s.marginDefaults,loading:P,loadingContent:B,emptyContent:N,width:G,height:z,hasTitle:!!Y,axisChrome:oe(A,{showAxes:s.showAxes,xLabel:ee,yLabel:pe[0],yLabelRight:pe[1],axes:ge})}),ve=Zo(()=>{const e=new Map;return pe.forEach((t,o)=>e.set(t,ue[o])),e},[pe,ue]),Ae=ot({lineWidth:g,resolveStroke:ei(e=>ve.get(e[ai])||ue[0],[ve,ue]),stroke:W,strokeWidth:O,opacity:j,effectiveSelectionHook:xe.effectiveSelectionHook,resolvedSelection:xe.resolvedSelection}),we=Zo(()=>e=>{const t=e.data||e,o=t[ai],i=pe.indexOf(o),n=t[ri],r=se&&i>=0&&fe[i]?li(n,fe[i]):n,a=i>=0&&ne[i]?.format?ne[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),s="function"==typeof u?u(t):t[u];return Jo.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Jo.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ue[i]||"inherit"}},o),Jo.createElement("div",null,`${"string"==typeof u?u:"x"}: ${s}`),Jo.createElement("div",null,`${o}: ${a(r)}`))},[pe,ue,fe,se,ne,u]),Se=ei(e=>{const t=(Array.isArray(e.allSeries)?e.allSeries:[]).map(e=>{const t=pe.indexOf(e.group),o=se&&t>=0&&fe[t]?li(e.value,fe[t]):e.value;let i=e.datum;return i&&(i={...i},delete i[ri],delete i[ai]),{...e,value:o,datum:i}}),o=e.data&&"object"==typeof e.data&&!Array.isArray(e.data)?{...e.data}:e.data;o&&"object"==typeof o&&!Array.isArray(o)&&(delete o[ri],delete o[ai]);const i={...e,data:o,allSeries:t};return delete i[ri],delete i[ai],i},[fe,se,pe]),ke=Zo(()=>F(),[]),Ce=ei(e=>ke(Se(e)),[ke,Se]),Le=Zo(()=>Q(x)&&"function"==typeof x.content?{mode:"multi",content:e=>x.content(Se(e))}:x,[Se,x]),Re=Zo(()=>te({tooltip:Le,defaultTooltipContent:we,multiDefaultContent:Ce}),[we,Ce,Le]);if(xe.earlyReturn)return xe.earlyReturn;const _e=t({componentName:"MultiAxisLineChart",data:l,accessors:{xAccessor:u}}),He=se?[0,1]:void 0,Ie={chartType:"line",...null!=l&&{data:ye},xAccessor:u,yAccessor:ri,groupAccessor:ai,lineStyle:Ae,colorScheme:ue,size:[G,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},margin:xe.margin,showAxes:s.showAxes,...ge&&{axes:ge},xLabel:ee,...se?{}:{yLabel:pe[0]},xFormat:m,...se&&He&&{yExtent:He},enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:$,curve:f,...xe.legendBehaviorProps,...Y&&{title:Y},...q&&{description:q},...J&&{summary:J},...void 0!==Z&&{accessibleTable:Z},...h&&{className:h},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...Re,...v&&{annotations:v},...b({linkedHover:S,selection:w,onObservation:k,onClick:C,hoverHighlight:_,hoverRadius:e.hoverRadius,mobileInteraction:xe.mobileInteraction,customHoverBehavior:xe.customHoverBehavior,customClickBehavior:xe.customClickBehavior}),...xe.crosshairProps,...A,...le&&{legendLayout:le}};return ce||de||(_e?ni(R,{componentName:"MultiAxisLineChart",message:_e,width:G,height:z}):ni(D,{componentName:"MultiAxisLineChart",width:G,height:z,children:ni(i,{ref:n,...Ie})}))});ci.displayName="MultiAxisLineChart";import{useMemo as hi,forwardRef as di,useRef as mi}from"react";import{jsx as ui}from"react/jsx-runtime";var pi=di(function(e,o){const n=mi(null);u(o,{variant:"xy",frameRef:n});const r=re(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:a,margin:s,className:l,xFormat:c,yFormat:d,xAccessor:m="x",highAccessor:p="high",lowAccessor:f="low",openAccessor:A,closeAccessor:w,candlestickStyle:S,tooltip:k,annotations:C,xExtent:L,yExtent:_,frameProps:H={},selection:I,linkedHover:P,onObservation:B,onClick:F,chartId:N,loading:M,loadingContent:T,emptyContent:W}=e,{width:O,height:j,enableHover:z,showGrid:V,title:$,description:X,summary:Q,accessibleTable:Y,xLabel:q,yLabel:J}=r,Z=U(M,O,j,T),ee=Z?null:K(a,O,j,W),te=hi(()=>E(a),[a]),oe=null==A||null==w;me("CandlestickChart",te,"xAccessor",m),me("CandlestickChart",te,"highAccessor",p),me("CandlestickChart",te,"lowAccessor",f),oe||(me("CandlestickChart",te,"openAccessor",A),me("CandlestickChart",te,"closeAccessor",w));const{customHoverBehavior:ie,customClickBehavior:ne,crosshairSourceId:se}=ae({selection:I,linkedHover:P,onObservation:B,onClick:F,chartType:"CandlestickChart",chartId:N,mobileInteraction:r.mobileInteraction}),le=G(P,se),ce=hi(()=>{const e=r.marginDefaults,t="sparkline"===r.mode?{...e,top:0,bottom:0}:e;return null==s?t:{...t,...h(s)}},[s,r.marginDefaults,r.mode]),he=hi(()=>{const e=[{label:q||y(m),accessor:m,role:"x",format:c}];return oe?(e.push({label:"High",accessor:p,role:"y",format:d}),e.push({label:"Low",accessor:f,format:d})):(e.push({label:"Open",accessor:A,format:d}),e.push({label:"High",accessor:p,format:d}),e.push({label:"Low",accessor:f,format:d}),e.push({label:"Close",accessor:w,format:d})),x(e)},[m,q,c,d,p,f,A,w,oe]),de=t({componentName:"CandlestickChart",data:a,accessors:{xAccessor:m,highAccessor:p,lowAccessor:f,...!oe&&{openAccessor:A,closeAccessor:w}}}),ue={chartType:"candlestick",...null!=a&&{data:te},xAccessor:m,yAccessor:p,highAccessor:p,lowAccessor:f,...!oe&&{openAccessor:A,closeAccessor:w},...S&&{candlestickStyle:S},scalePadding:Math.max(2,Math.min(12,Math.round(O/40))),extentPadding:O>200?.1:.02,size:[O,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,showAxes:r.showAxes,xLabel:q,yLabel:J,xFormat:c,yFormat:d,enableHover:z,showGrid:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...g({title:$,description:X,summary:Q,accessibleTable:Y,className:l,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...v({tooltip:k,defaultTooltipContent:he}),...b({linkedHover:P,selection:I,onObservation:B,onClick:F,hoverRadius:e.hoverRadius,mobileInteraction:r.mobileInteraction,customHoverBehavior:ie,customClickBehavior:ne}),...C&&C.length>0&&{annotations:C},...L&&{xExtent:L},..._&&{yExtent:_},...le,...H};return Z||ee||(de?ui(R,{componentName:"CandlestickChart",message:de,width:O,height:j}):ui(D,{componentName:"CandlestickChart",width:O,height:j,children:ui(i,{ref:n,...ue})}))});pi.displayName="CandlestickChart";export{je as Scatterplot,Ye as ConnectedScatterplot,rt as LineChart,ct as XYCustomChart,ht as bumpXIdentity,mt as rankBumpData,Ht as BumpChart,Mt as AreaChart,Xt as DifferenceChart,Ut as StackedAreaChart,io as Heatmap,co as BubbleChart,Ho as ScatterplotMatrix,Go as MinimapChart,Xo as DEFAULT_QUADRANTS,Uo as QuadrantChart,ci as MultiAxisLineChart,pi as CandlestickChart};
|
package/dist/c-LIXGXMNS.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{annotationBudget as t,annotationDensity as e,isNoteAnnotation as i,mulberry32 as n}from"./c-SUILCHWU.min.js";import{resolveLabelFn as s,resolveNodeRefId as o}from"./c-MT3WBK7M.min.js";import{getMinMax as r}from"./c-GGISSW5E.min.js";function a(t){const{desired:e,minGaps:i,weights:n}=t,s=e.length;if(0===s)return[];if(i.length!==Math.max(0,s-1))throw Error("placeWithMinGap: minGaps must have desired.length - 1 entries");const o=Array(s).fill(0);for(let t=1;s>t;t++)o[t]=o[t-1]+Math.max(0,Number.isFinite(i[t-1])?i[t-1]:0);const r=[];for(let t=0;s>t;t++){const i=Math.max(Number.EPSILON,Number.isFinite(n?.[t])?n[t]:1),s=(Number.isFinite(e[t])?e[t]:0)-o[t];for(r.push({start:t,end:t,weight:i,mean:s});r.length>1;){const t=r[r.length-1],e=r[r.length-2];if(t.mean>=e.mean)break;const i=e.weight+t.weight;r.splice(r.length-2,2,{start:e.start,end:t.end,weight:i,mean:(e.mean*e.weight+t.mean*t.weight)/i})}}const a=Number.isFinite(t.min)?t.min:-1/0,c=Number.isFinite(t.max)?t.max-o[s-1]:1/0,d=a>c?a:c,l=Array(s);for(const t of r){const e=Math.max(a,Math.min(d,t.mean));for(let i=t.start;t.end>=i;i++)l[i]=e+o[i]}return l}function c(t,e){let i=0,n=t.length-1,s=-1;for(;n>=i;){const o=i+n>>>1;t[o].at>e?n=o-1:(s=o,i=o+1)}return 0>s?{at:e,before:0,after:0}:t[s]}function d(t,e=0){if(0===t.length)return{adjacentClearance:[],positions:[]};const i=[],n=[0];for(let s=0;t.length-1>s;s++){const o=t[s],r=t[s+1],a=[...new Set([...o.map(t=>t.at),...r.map(t=>t.at)])].sort((t,e)=>t-e);let d=0;for(const t of a){const e=c(o,t),i=c(r,t);d=Math.max(d,e.after+i.before)}i.push(d),n.push(n[n.length-1]+d+e)}return{adjacentClearance:i,positions:n}}function l(t,e,i,n={}){let s=[...t];if(1>=s.length)return s;let o=[...s],r=i(s),a=1;const c=Math.max(0,n.passes??6),d=Math.max(1,n.maxEvaluations??1/0);for(let t=0;c>t&&d>a;t++){const t=new Map(s.map((t,e)=>[t,e])),c=new Map,d=new Map;for(const i of e){const e=t.get(i.source),n=t.get(i.target);if(null==e||null==n)continue;const s=Number.isFinite(i.weight)&&i.weight>0?i.weight:1;c.set(i.source,(c.get(i.source)??0)+n*s),d.set(i.source,(d.get(i.source)??0)+s),c.set(i.target,(c.get(i.target)??0)+e*s),d.set(i.target,(d.get(i.target)??0)+s)}s=s.map((t,e)=>({item:t,index:e,barycenter:(c.get(t)??e)/(d.get(t)??1)})).sort((t,e)=>t.barycenter-e.barycenter||(n.compare?.(t.item,e.item)??t.index-e.index)).map(t=>t.item);const l=i(s);if(a++,r>l)r=l,o=[...s];else if(l===r)break}return o}function h(t,e,i={}){const n=[...t];if(1>=n.length)return n;let s=e(n),o=1;const r=Math.max(0,i.passes??6),a=Math.max(1,i.maxEvaluations??1/0);for(let t=0;r>t&&a>o;t++){let t=!1;for(let i=0;n.length-1>i&&a>o;i++){[n[i],n[i+1]]=[n[i+1],n[i]];const r=e(n);o++,s>r?(s=r,t=!0):[n[i],n[i+1]]=[n[i+1],n[i]]}if(!t)break}return n}function u(t,e,i={}){const n=[...t],s=n.length;if(1>=s||s>(i.maxItems??8))return n;const o=Math.max(1,i.maxEvaluations??1/0);let r=0,a=[...n],c=1/0;const d=()=>{if(r>=o)return;const t=e(n);r++,c>t&&(c=t,a=[...n])};d();const l=Array(s).fill(0);let h=0;for(;s>h&&o>r;)if(h>l[h]){const t=h%2==0?0:l[h];[n[t],n[h]]=[n[h],n[t]],d(),l[h]++,h=0}else l[h]=0,h++;return a}function f(t,e,i=()=>!0){let n=0;for(let s=0;t.length>s;s++){const[o,r]=e(t[s]);for(let a=s+1;t.length>a;a++){if(!i(t[s],t[a]))continue;const[c,d]=e(t[a]);0>(o-c)*(r-d)&&n++}}return n}function p(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function m(t){if(!t||"object"!=typeof t)return!1;const e=t;return"string"==typeof e.id&&(null==e.label||"string"==typeof e.label)&&"number"==typeof e.count&&Number.isFinite(e.count)&&Array.isArray(e.bodyIds)&&e.bodyIds.every(t=>"string"==typeof t)}function y(t,e){if("region-enter"!==e.type)return t;const i=e.region.id,n=p(t,i),s=m(n)?n:{id:i,label:e.region.label??i,count:0,bodyIds:[]};if(s.bodyIds.includes(e.bodyId))return t;const o=[...s.bodyIds,e.bodyId];return{...t,[i]:{...s,count:o.length,bodyIds:o}}}function g(t,e){return(e??Object.keys(t)).map(e=>p(t,e)).filter(m).map(t=>({label:t.label??t.id,value:t.count}))}function b(t,e){const i=e instanceof Set?e:new Set(e);return t.map(t=>{const e=t.bodyIds??[],n=e.filter(t=>!i.has(t)),s=e.length-n.length,o=t.completion?.mode??"allMembersAbsorbed",r=t.completion?.valueByBodyId,a=t=>{const e=r?p(r,t):void 0;return"number"==typeof e&&Number.isFinite(e)&&e>=0?e:1},c=e.reduce((t,e)=>t+a(e),0),d=e.reduce((t,e)=>t+(i.has(e)?a(e):0),0),l=t.completion?.threshold,h="threshold"===o?Number.isFinite(l)&&Number(l)>=0?Number(l):c:void 0;return{id:t.id,label:t.label??t.id,mode:o,complete:e.length>0&&("anyAbsorbed"===o?s>0:"threshold"===o?d>=(h??c):0===n.length),absorbed:s,total:e.length,absorbedValue:d,totalValue:c,threshold:h,missing:n}})}function x(t,e,i){return Math.max(e,Math.min(i,t))}function v(t,e,i,n,s,o={}){return{id:t,friction:o.friction,restitution:o.restitution,bodyFilter:o.bodyFilter,shape:{type:"segment",x1:e,y1:i,x2:n,y2:s,thickness:o.thickness??8}}}function w(t){const e=t.shape??"lane",i=Math.max(1,Math.round(t.width)),n=Math.max(1,Math.round(t.height)),s=t.padX??46,o=t.padY??72,r=s,a=i-s,c=o,d=n-Math.max(24,Math.round(.45*o)),l=(c+d)/2,h=Math.max(1,d-c),u=x(t.pinchRatio??.18,.06,.5),f=Number(t.pinchHeightOffset??0),p=Number.isFinite(f)?f:0,m=x(h*u+p,.06*h,.5*h),y=m/2,g=l-y,b=l+y,w=t.idPrefix??"process",S=t.friction??.58,M=t.restitution??.18,k=t.wallThickness??8,B=t.stages;if(!B.length)throw Error("processStageLayout requires at least one stage");const O=x(t.centerStageIndex??Math.floor(B.length/2),0,B.length-1),q=function(t){const e=t.reduce((t,e)=>t+(e.share??1),0);return e>0?e:t.length}(B),A=a-r;let C=r;const T=B.map((t,e)=>{const i=C,n=e===B.length-1?a:C+(t.share??1)/q*A;return C=n,{id:t.id,label:t.label,description:t.description,kind:t.kind??"stage",index:e,x0:i,x1:n,x:(i+n)/2,width:n-i,y:l,height:h}}),D=T[O],R=D.x0,P=D.x1,$=(t,i)=>{if("lane"===e)return"top"===i?c:d;if("funnel"===e){const e=x((t-r)/Math.max(1,a-r),0,1);return"top"===i?c+(g-c)*e:d+(b-d)*e}if(R>=t){const e=x((t-r)/Math.max(1,R-r),0,1);return"top"===i?c+(g-c)*e:d+(b-d)*e}if(P>=t)return"top"===i?g:b;const n=x((t-P)/Math.max(1,a-P),0,1);return"top"===i?g+(c-g)*n:b+(d-b)*n},j=T.map(t=>{const e=Math.min($(t.x0,"top"),$(t.x1,"top")),i=Math.max($(t.x0,"bottom"),$(t.x1,"bottom"));return{...t,y:(e+i)/2,height:Math.max(1,i-e)}}),F={thickness:k,friction:S,restitution:M},N=[];"lane"===e?N.push(v(w+"-top",r,c,a,c,F),v(w+"-bottom",r,d,a,d,F),v(w+"-left",r,c,r,d,{...F,thickness:Math.max(6,k-2)}),v(w+"-right",a,c,a,d,{...F,thickness:Math.max(6,k)})):"funnel"===e?N.push(v(w+"-top",r,c,a,g,F),v(w+"-bottom",r,d,a,b,F),v(w+"-left",r,c,r,d,{...F,thickness:Math.max(6,k-2)}),v(w+"-right",a,g,a,b,{...F,thickness:Math.max(6,k)})):N.push(v(w+"-left-top",r,c,R,g,F),v(w+"-left-bottom",r,d,R,b,F),v(w+"-center-top",R,g,P,g,F),v(w+"-center-bottom",R,b,P,b,F),v(w+"-right-top",P,g,a,c,F),v(w+"-right-bottom",P,b,a,d,F),v(w+"-left",r,c,r,d,{...F,thickness:Math.max(6,k-2)}),v(w+"-right",a,c,a,d,{...F,thickness:Math.max(6,k)}));const E=t.membraneDampingScale??.5,L=r,Y=Math.max(1,("bowtie"===e?R:a)-L),W=(t.membranes??[]).map(t=>{const e=L+x(t.offset,0,1)*Y,i=t.width??18+18*t.cost,n=h-16,s=l+.25*(t.wobble??0);return{...t,x:e,y:s,width:i,height:n}}),X=!1===t.includeMembraneRegions?[]:W.map(t=>I({id:t.id,label:t.label??t.id,description:t.description??(t.label??t.id)+" is a permeable region. It taxes energy and damps velocity while bodies overlap it.",x:t.x,y:t.y,width:t.width,height:t.height,cost:t.cost,dampingScale:t.dampingScale??E,bodyStyle:t.bodyStyle,metadata:t.metadata,semanticItem:t.semanticItem,color:t.color}));return{shape:e,width:i,height:n,padX:s,padY:o,left:r,right:a,topY:c,bottomY:d,midY:l,centerLeft:R,centerRight:P,pinchHeight:m,pinchTop:g,pinchBottom:b,stages:j,membranes:W,colliders:N,regionEffects:X,boundaryY:$}}function S(t){return{id:t.id,label:t.label,description:t.description,kind:t.kind,shape:(e=t.x,i=t.y,n=t.width,s=t.height,{type:"aabb",x:e,y:i,width:n,height:s}),bodyFilter:t.bodyFilter,collider:t.collider,colliderThickness:t.colliderThickness,friction:t.friction,restitution:t.restitution,semanticItem:t.semanticItem,metadata:t.metadata,bodyStyle:t.bodyStyle,attributes:t.attributes,onEnter:t.onEnter,onExit:t.onExit};var e,i,n,s}function M(t,e={}){const i=e.idPrefix??"stage",n=Math.max(0,e.insetX??0),s=Math.max(0,e.insetY??1);return t.stages.map(t=>{const o="function"==typeof e.metadata?e.metadata(t):e.metadata??{};return{...S({id:i?`${i}:${t.id}`:t.id,label:t.label??t.id,description:t.description,kind:"region",x:t.x,y:t.y,width:Math.max(1,t.width-2*n),height:Math.max(1,t.height-2*s),bodyFilter:e.bodyFilter,semanticItem:e.semanticItem,attributes:{primitive:"processStage",stageId:t.id,stageIndex:t.index},metadata:{...o,primitive:"processStage",stageId:t.id,stageIndex:t.index}})}})}function I(t){const e=t.dampingScale??.5,i=t.energyScale??1,n=x(t.cost,0,2);return{...S({...t,kind:t.kind??"membrane",attributes:{primitive:"membrane",membraneCost:n,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),damping:n*e,energyDelta:-n*i}}function k(t){return{...S({...t,kind:t.kind??"charge-gate",attributes:{primitive:"chargeGate",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),charge:t.charge??!0,energyDelta:t.energyDelta,impulseOnEnter:t.impulseOnEnter}}function B(t){const e="number"==typeof t.force?{x:t.force,y:0}:t.force??{x:12,y:0};return{...S({...t,kind:t.kind??"force-field",attributes:{primitive:"routeSurface",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:e,damping:t.damping??.015}}function O(t){const e=t.pressure??t.occupancy??0,i=t.baseDamping??.08,n=t.dampingPerUnit??.12,s=t.energyPerUnit??0;return{...S({...t,kind:t.kind??"membrane",attributes:{primitive:"pressureField",pressure:e,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),damping:i+e*n,energyDelta:s?-e*s:void 0,force:t.force}}function q(t){const e="number"==typeof t.force?{x:t.force,y:0}:t.force;return{...S({...t,kind:t.kind??"force-field",attributes:{primitive:"capacitatedSensor",capacity:t.capacity,unitsPerSecond:t.unitsPerSecond??t.capacity,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:e,damping:t.damping,charge:t.charge??t.capacity}}function A(t){return{...S({...t,kind:t.kind??"force-field",attributes:{primitive:"portal",targetStage:t.targetStage,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:t.force,impulseOnEnter:t.impulseOnEnter,damping:t.damping??.08}}function C(t){const e="number"==typeof t.force?{x:t.force,y:0}:t.force??{x:24,y:0};return{...S({...t,kind:t.kind??"sink",attributes:{primitive:"absorb",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:e,damping:t.damping??.02,charge:t.charge??"absorbed"}}function T(t){return{...S({...t,kind:t.kind??"force-field",attributes:{primitive:"forceField",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:t.force,damping:t.damping,energyDelta:t.energyDelta}}function D(t){const e=t.x??t.anchor?.x??0,i=t.y??t.anchor?.y??0;return{id:t.id,label:t.label,description:t.description,group:t.group,bodyIds:t.bodyIds,datum:t.datum,state:t.state,x:e,y:i,width:t.width,height:t.height,anchor:t.anchor??{x:e,y:i},completion:t.completion,tether:t.tether,semanticItem:t.semanticItem}}function R(t){const e=t.idPrefix??"lane",i={thickness:t.thickness??8,friction:t.friction??.5,restitution:t.restitution??.16},n=[v(e+"-top",t.left,t.top,t.right,t.top,i),v(e+"-bottom",t.left,t.bottom,t.right,t.bottom,i)];return t.openEnds||n.push(v(e+"-left",t.left,t.top,t.left,t.bottom,i),v(e+"-right",t.right,t.top,t.right,t.bottom,i)),n}import{Fragment as P,jsx as $,jsxs as j}from"react/jsx-runtime";var F={flow:{fill:"rgba(59, 130, 246, 0.14)",stroke:"rgba(96, 165, 250, 0.7)",accent:"#60a5fa"},capacity:{fill:"rgba(251, 146, 60, 0.18)",stroke:"rgba(251, 146, 60, 0.85)",accent:"#fb923c"},portal:{fill:"rgba(244, 114, 182, 0.14)",stroke:"rgba(244, 114, 182, 0.7)",accent:"#f472b6"},absorb:{fill:"rgba(52, 211, 153, 0.18)",stroke:"rgba(52, 211, 153, 0.8)",accent:"#34d399"}};function N(t,e,i){return Math.max(e,Math.min(i,t))}function E(t){return 6.2*t.length}function L(t,e){const i=t.trim();if(e>=i.length)return i;if(1>=e)return i.slice(0,1);const n=i.split(/\s+/).filter(Boolean).map(t=>t[0]).join("").toUpperCase();return n.length>1&&e>=n.length?n:e>3?i.slice(0,Math.max(1,e-2))+"..":i.slice(0,e).toUpperCase()}function Y(t,e,i="auto"){const n=Math.max(1,Math.floor(e/6.2)),s="compact"===i?L(t,n):"full"===i?t:E(t)>e?L(t,n):t;return{text:s,textLength:E(s)>e?Math.max(4,e):void 0}}function W(t,e={}){const{showFlowSpine:i=!0,showStageCounts:n=!0,showCapacityBadges:s=!0,showGroupSockets:o=!0,stageLabelMode:r="auto",outlineStages:a=!1,testId:c="process-flow-chrome"}=e,{width:d,height:l,left:h,right:u,topY:f,bottomY:p,midY:m,stages:y,groups:g=[]}=t,b=p-f;return j("svg",{"aria-hidden":"true","data-testid":c,"data-outline-stages":a?"true":void 0,width:d,height:l,viewBox:`0 0 ${d} ${l}`,style:{position:"absolute",inset:0,pointerEvents:"none"},className:["semiotic-process-chrome",a?"semiotic-process-chrome--outline-stages":null].filter(Boolean).join(" "),children:[$("defs",{children:j("linearGradient",{id:"semiotic-process-floor",x1:"0",x2:"0",y1:"0",y2:"1",children:[$("stop",{offset:"0%",stopColor:"var(--semiotic-process-floor, var(--semiotic-bg, #0f172a))",stopOpacity:"0.2"}),$("stop",{offset:"100%",stopColor:"var(--semiotic-process-lane, var(--semiotic-surface, #1e293b))",stopOpacity:"0.55"})]})}),$("rect",{x:0,y:0,width:d,height:l,fill:"url(#semiotic-process-floor)"}),$("rect",{x:h-6,y:f-8,width:u-h+12,height:b+16,rx:14,fill:"var(--semiotic-process-lane, var(--semiotic-surface, #111827))",fillOpacity:.45,stroke:"var(--semiotic-process-border, var(--semiotic-border, #334155))",strokeOpacity:.95}),i?$("line",{x1:h+8,x2:u-8,y1:m,y2:m,stroke:"var(--semiotic-process-border, var(--semiotic-border, #475569))",strokeWidth:2,strokeDasharray:"6 8",opacity:.55}):null,y.map((t,e)=>{const i=function(t){return t.absorb?"absorb":t.portalTarget?"portal":null!=t.capacity?"capacity":"flow"}(t),o=F[i],c=Math.max(12,t.width-8),d=N(c-8,22,88),h=Y(t.label,Math.max(8,d-10),r),u="none"!==r&&c-8>=22,g=function(t){if(null!=t.capacity){const e=null!=t.queueDepth?" · q "+t.queueDepth:"";return t.capacityLabel?`${t.capacityLabel}${e}`:`cap ${Number.isInteger(t.capacity)?t.capacity+"":t.capacity.toFixed(1)}${e}`}return t.absorb?"absorb":t.portalTarget?"portal":"flow"}(t),x=Y(g,Math.max(16,c-10),"auto"),v=s&&!1!==t.showBadge&&c>=32,w=null!=t.count?`n=${t.count}${null!=t.processed?" done "+t.processed:""}`:"",S=Y(w,Math.max(16,c-8),"auto"),M=Math.max(30,f-15),I=M-13;return j("g",{"data-stage":t.id,"data-role":i,children:[$("rect",{className:"semiotic-process-chrome__stage-bay",x:t.x0+4,y:f+6,width:c,height:b-12,rx:10,fill:a?"none":o.fill,stroke:o.stroke,strokeWidth:a?1.85:"flow"===i?1:1.6}),y.length-1>e?$("polygon",{points:`${t.x1-2},${m-7} ${t.x1+8},${m} ${t.x1-2},${m+7}`,fill:o.accent,opacity:.85}):null,u?j(P,{children:[$("rect",{className:"semiotic-process-chrome__stage-label-bg",x:t.x-d/2,y:I,width:d,height:18,rx:9,fill:"var(--semiotic-bg, #0f172a)",fillOpacity:.75,stroke:o.stroke}),j("text",{x:t.x,y:M,textAnchor:"middle",fill:o.accent,fontSize:10,fontWeight:800,className:"semiotic-process-chrome__stage-label",textLength:h.textLength,lengthAdjust:h.textLength?"spacingAndGlyphs":void 0,children:[$("title",{children:t.label}),h.text]})]}):null,v?j("text",{x:t.x,y:f+22,textAnchor:"middle",fill:"var(--semiotic-process-muted, var(--semiotic-text-secondary, #94a3b8))",fontSize:9,fontWeight:700,textLength:x.textLength,lengthAdjust:x.textLength?"spacingAndGlyphs":void 0,children:[$("title",{children:g}),x.text]}):null,n&&null!=t.count?j("text",{x:t.x,y:Math.min(l-8,p+16),textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #e2e8f0))",fontSize:11,fontWeight:800,textLength:S.textLength,lengthAdjust:S.textLength?"spacingAndGlyphs":void 0,children:[$("title",{children:w}),S.text]}):null]},t.id)}),o?g.map((t,e)=>{const i=t.total??0,n=t.absorbed??0,s=t.complete??(i>0&&n>=i),o=!s&&i>0&&n/i>=.75,r=s?"rgba(52, 211, 153, 0.35)":o?"rgba(251, 191, 36, 0.28)":"rgba(15, 23, 42, 0.75)",a=s?"#34d399":o?"#fbbf24":"var(--semiotic-border, #64748b)",c=i>0?`${n}/${i}${s?" shipped":o?" almost":""}`:"feature "+(e+1),d=N(Math.max(54,E(t.label)+18,E(c)+16),54,104),l=Y(t.label,d-12,"auto"),h=Y(c,d-12,"auto");return j("g",{"data-group":t.id,children:[$("rect",{x:t.x-d/2,y:t.y-22,width:d,height:44,rx:10,fill:r,stroke:a,strokeWidth:1.5}),j("text",{x:t.x,y:t.y-4,textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #f8fafc))",fontSize:10,fontWeight:800,textLength:l.textLength,lengthAdjust:l.textLength?"spacingAndGlyphs":void 0,children:[$("title",{children:t.label}),l.text]}),j("text",{x:t.x,y:t.y+12,textAnchor:"middle",fill:a,fontSize:9,fontWeight:700,textLength:h.textLength,lengthAdjust:h.textLength?"spacingAndGlyphs":void 0,children:[$("title",{children:c}),h.text]})]},t.id)}):null]})}import{symbol as X,symbolCircle as z,symbolCross as G,symbolDiamond as K,symbolSquare as H,symbolStar as _,symbolTriangle as U,symbolWye as V}from"d3-shape";var Q={circle:z,square:H,triangle:U,diamond:K,star:_,cross:G,wye:V},Z=new Set(["circle","square","triangle","diamond","star","cross","wye","chevron"]),J=["circle","triangle","diamond","star","square","chevron","cross","wye"];function tt(t,e,i){if(i)return i;const n=t??"circle";if("chevron"===n)return function(t){const e=1.5*et(t),i=.92*e;return`M0,${-e}L${i},${(.78*e).toFixed(3)}L0,${(.28*e).toFixed(3)}L${-i},${(.78*e).toFixed(3)}Z`}(e);const s=Object.prototype.hasOwnProperty.call(Q,n)?Q[n]:z;return X(s,Math.max(1,e))()??""}function et(t){return Math.sqrt(Math.max(1,t)/Math.PI)}var it=new Map;function nt(t,e,i){if(!i&&"circle"===(t??"circle"))return et(e);const n=i?"p:"+i:`${t}:${Math.round(e)}`,s=it.get(n);if(null!=s)return s;const o=(i??tt(t,e)).match(/-?\d*\.?\d+(?:e-?\d+)?/gi);let r=0;if(o)for(let t=0;o.length>t+1;t+=2){const e=+o[t],i=+o[t+1],n=Math.sqrt(e*e+i*i);n>r&&(r=n)}return r>0||(r=et(e)),it.size>512&&it.clear(),it.set(n,r),r}function st(t,e){const i=new Map;let n=0;return s=>{const o=t(s)+"",r=e&&Object.prototype.hasOwnProperty.call(e,o)?e[o]:void 0;if(r&&Z.has(r))return r;let a=i.get(o);return a||(a=J[n%J.length],n++,i.set(o,a)),a}}var ot=[40,40],rt=[.5,.5];function at(t,e){const[i,n]=t.viewBox??ot,[s,o]=t.anchor??rt,r=n>0?n:1,a=Math.max(0,e)/r,c=(i>0?i:r)*a,d=r*a;return{width:c,height:d,scale:a,offsetX:-s*c,offsetY:-o*d}}function ct(t,e){const i=at(t,e),n=[[i.offsetX,i.offsetY],[i.offsetX+i.width,i.offsetY],[i.offsetX,i.offsetY+i.height],[i.offsetX+i.width,i.offsetY+i.height]];let s=0;for(const[t,e]of n){const i=Math.sqrt(t*t+e*e);i>s&&(s=i)}return s}function dt(t,e,i,n){if("none"!==t)return"color"===t||null==t?e??n:"accent"===t?i:t}function lt(t,e,i=0,n="horizontal"){const[s,o]=t.viewBox??ot,r=Math.min(1,Math.max(0,i)),a=Math.min(1,Math.max(0,e));return a>r?r>0||1>a?"vertical"===n?{x:0,y:o*(1-a),width:s,height:o*(a-r)}:{x:s*r,y:0,width:s*(a-r),height:o}:null:{x:0,y:0,width:0,height:0}}function ht(t,e){const i=at(t,e);return{centerDx:i.offsetX+i.width/2,centerDy:i.offsetY+i.height/2,halfWidth:i.width/2,halfHeight:i.height/2,radius:Math.hypot(i.width,i.height)/2}}function ut(t,e){const i=e.scales?.x??e.scales?.time;return i?null!=t.x?i(t.x):e.xAccessor&&null!=t[e.xAccessor]?i(t[e.xAccessor]):null:null}function ft(t,e){const i=e.scales?.y??e.scales?.value;return i?null!=t.y?i(t.y):e.yAccessor&&null!=t[e.yAccessor]?i(t[e.yAccessor]):null:null}function pt(t){return null==t?null:t+""}function mt(t,e,i){return e.stickyPositionCache?.set(t,i),i}function yt(t,e,i){const n=t.anchor||t.lifecycle?.anchor||"fixed";if("latest"===n){if(null!=t.pointId&&i.pointNodes&&i.pointNodes.length>0)for(let n=i.pointNodes.length-1;n>=0;n--){const s=i.pointNodes[n];if(s.pointId===t.pointId)return mt(e,i,{x:s.x,y:s.y})}const n=function(t){const e=t.data;if(!e||0===e.length)return null;const i=e[e.length-1],n=t.scales?.x??t.scales?.time,s=t.scales?.y??t.scales?.value;if(!n||!s)return null;const o=i[t.xAccessor||"x"],r=i[t.yAccessor||"y"];return null==o||null==r?null:{x:n(o),y:s(r)}}(i);return n?mt(e,i,n):null}if("semantic"===n){const n=function(t,e,i){const n=function(t){return pt(t.provenance?.stableId??t.stableId)}(t);if(!n)return null;const s=i.pointNodes?.find(t=>pt(t.pointId)===n);if(s)return mt(e,i,{x:s.x,y:s.y});const o=i.data?.find(t=>function(t){return pt(t.stableId??t.id??t.provenance?.stableId)}(t)===n);if(!o)return null;const r=ut(o,i),a=ft(o,i);return null==r||null==a?null:mt(e,i,{x:r,y:a})}(t,e,i);if(n)return n}let s=null,o=null;if(null!=t.pointId&&i.pointNodes){const e=i.pointNodes.find(e=>e.pointId===t.pointId);e&&(s=e.x,o=e.y)}if(null!=s&&null!=o||(s=ut(t,i),o=ft(t,i)),null!=s&&null!=o)return mt(e,i,{x:s,y:o});if("sticky"===n){const t=i.stickyPositionCache?.get(e);if(t)return t}return null}function gt(t,e,i,n=50){return!(-n>t||t>(i.width||0)+n||-n>e||e>(i.height||0)+n)}var bt=32,xt=6,vt=4,wt=8,St=72;var Mt={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function It(t){if(!kt(t))return t;const e=("string"==typeof t.mobileText?t.mobileText:void 0)??("string"==typeof t.shortText?t.shortText:void 0);return!e||"string"!=typeof t.label&&null!=t.label?t:{...t,label:e}}function kt(t){return i(t)}function Bt(t,e){if(!t)return[];const i=Math.max(1,Math.floor(e/7)),n=t.split(/\s+/).filter(Boolean),s=[];let o="";for(const t of n)o&&o.length+t.length+1>i?(s.push(o),o=t):o=o?`${o} ${t}`:t;return o&&s.push(o),s}function Ot(t,e,i,n,s){const o=t+i,r=e+n;return Math.abs(i)>Math.abs(n)?{x:0>i?o-s.width-4:o+4,y:0>n?r-s.height:r,width:s.width,height:s.height}:{x:0>i?o-s.width:o,y:0>n?r-s.height-4:r+4,width:s.width,height:s.height}}function qt(t,e){return{x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e}}function At(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function Ct(t,e,i,n,s,o,r,a){const c=qt(t,r);let d=.4*Math.hypot(e.dx,e.dy)+80*function(t,e,i,n){const s=Math.max(0,n-t.x),o=Math.max(0,n-t.y);return(s+Math.max(0,t.x+t.width-(e-n)))*t.height+(o+Math.max(0,t.y+t.height-(i-n)))*t.width}(c,s,o,a);for(const t of i)d+=12*At(c,t);for(const t of n)d+=4*At(c,t);return d}function Tt(i){const{annotations:n,context:s,defaultOffset:o=bt,notePadding:r=xt,markPadding:a=vt,edgePadding:c=wt,preserveManualOffsets:d=!0,routeLongConnectors:l=!0,connectorThreshold:h=St,density:u,progressiveDisclosure:f=!1,redundantCues:p=!1,responsive:m,mobile:y,cohesion:g,audience:b}=i,x=s.width||0,v=s.height||0,w="object"==typeof y?y:{},S=w.breakpoint??480,M=!!y&&S>=x,I=M&&!1!==w.preferShortText?n.map(It):n,k=M&&!u?{maxAnnotations:w.maxAnnotations??("callout-list"===w.strategy?1:2),minVisible:w.minVisible??1}:u,B=f||M&&(!1!==w.progressiveDisclosure||"callout-list"===w.strategy),O=M&&!m?w.responsive??{minWidth:S}:m,q=M&&!g?w.cohesion:g;if(0===I.length||0>=x||0>=v)return I.slice();const A=[],C=function(t,e){return(t.pointNodes||[]).map(t=>{const i=Math.max(1,t.r||1)+e;return{x:t.x-i,y:t.y-i,width:2*i,height:2*i}})}(s,a);let T=!1;const D=I.map((t,e)=>{if(!kt(t))return t;const i=function(t,e,i){if("widget"===t.type&&"number"==typeof t.px&&"number"==typeof t.py)return{x:t.px,y:t.py};const n=t.pointId??t.nodeId;if(null!=n&&i.pointNodes){const t=i.pointNodes.find(t=>t.pointId===n);if(t)return{x:t.x,y:t.y}}const s=t.coordinates,o=i.scales?.geoProjection;if(Array.isArray(s)&&s.length>=2&&o){const t=s[0],e=s[1];if("number"==typeof t&&"number"==typeof e){const i=o([t,e]);if(i&&"number"==typeof i[0]&&"number"==typeof i[1])return{x:i[0],y:i[1]}}}return i.scales||"number"!=typeof t.x||"number"!=typeof t.y?yt(t,e,i):{x:t.x,y:t.y}}(t,e,s);if(!i)return t;const n=function(t){if("widget"===t.type)return{width:"number"==typeof t.width?t.width:32,height:"number"==typeof t.height?t.height:32};const e="number"==typeof t.wrap?t.wrap:120,i=[...Bt("string"==typeof t.title?t.title:void 0,e),...Bt("string"==typeof t.label?t.label:void 0,e)],n=i.reduce((t,e)=>Math.max(t,e.length),0);return{width:Math.max(24,Math.min(e,7*n)+10),height:Math.max(18,16*i.length+6)}}(t);if(d&&("number"==typeof(a=t).dx||"number"==typeof a.dy)){const e=function(t){return"text"===t.type||"widget"===t.type?{dx:0,dy:0}:{dx:30,dy:-30}}(t);return A.push(qt(Ot(i.x,i.y,"number"==typeof t.dx?t.dx:e.dx,"number"==typeof t.dy?t.dy:e.dy,n),r)),t}var a;let u=null,f=1/0;for(const t of function(t){const e=1.6*t;return[{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t},{dx:t,dy:0},{dx:-t,dy:0},{dx:0,dy:-t},{dx:0,dy:t},{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e}]}(o)){const e=Ct(Ot(i.x,i.y,t.dx,t.dy,n),t,A,C,x,v,r,c);f>e&&(u=t,f=e)}if(!u)return t;const p=qt(Ot(i.x,i.y,u.dx,u.dy,n),r);A.push(p);const m=Math.hypot(u.dx,u.dy),y=l&&m>=h&&"text"!==t.type&&"widget"!==t.type?{...t.connector||{end:"arrow"},type:"curve"}:t.connector;return T=!0,{...t,dx:u.dx,dy:u.dy,...y?{connector:y}:{}}}),R=T?D:I.slice();let P=R;if(p){let t=!1;const e=R.map(e=>{const i=function(t){return"text"!==t.type||"string"!=typeof t.color||8>Math.hypot("number"==typeof t.dx?t.dx:0,"number"==typeof t.dy?t.dy:0)?t:{...t,_redundantConnector:!0}}(e);return i!==e&&(t=!0),i});P=t?e:R}{let t=!1;const e=P.map(e=>{if(!0!==e?.defensive)return e;const i=function(t){const e=t?.provenance;if(!e||"object"!=typeof e)return t;const i="string"==typeof e.source?Object.prototype.hasOwnProperty.call(Mt,e.source)?Mt[e.source]:e.source:null,n="number"==typeof e.confidence&&Number.isFinite(e.confidence)?Math.round(100*Math.max(0,Math.min(1,e.confidence)))+"%":null;if(!i&&!n)return t;if(null!=t.label&&"string"!=typeof t.label)return t;const s=[i,n].filter(Boolean).join(" · "),o="string"==typeof t.label?t.label:"";return o.includes(`(${s})`)?t:{...t,label:o?`${o} (${s})`:`(${s})`}}(e);return i!==e&&(t=!0),i});P=t?e:P}const $=new Set;if(k){const i="object"==typeof k?k:{},n=function(t){if(!t)return 1;const e=function(t){const e=t?.familiarity;if(!e)return 3;const i=Object.values(e).filter(t=>"number"==typeof t&&Number.isFinite(t));return 0===i.length?3:i.reduce((t,e)=>t+e,0)/i.length}(t);return e>2?4>e?1:.6:1.5}(b),s=1===n?i:{...i,maxAnnotations:Math.max(0,Math.round((i.maxAnnotations??t(x,v,i))*n))},{deferred:o}=e({annotations:P,width:x,height:v,...s});for(const t of o)$.add(t)}if(O&&("object"==typeof O&&"number"==typeof O.minWidth?O.minWidth:480)>=x)for(const t of P)kt(t)&&"secondary"===t.emphasis&&$.add(t);if($.size>0)for(const t of P)!0===t?.defensive&&$.delete(t);let j;return j=0===$.size?P:B?P.map(t=>$.has(t)?{...t,_annotationDeferred:!0}:t):P.filter(t=>!$.has(t)),q?function(t,e){let i=!1;const n=t.map(t=>kt(t)?"blended"===t.cohesion||"layer"===t.cohesion?t:(i=!0,{...t,cohesion:e}):t);return i?n:t}(j,q):j}import*as Dt from"react";import{jsx as Rt}from"react/jsx-runtime";var Pt,$t={isActive:!1,predicate:()=>!0};function jt(){const t=(Pt??(Pt=Dt.createContext(null)),Pt);return Dt.useContext(t)??$t}var Ft={seed:1,gravity:{x:0,y:980},fixedDt:1/120,cellSize:64,collisionIterations:6,velocityDamping:.995,sleepSpeed:8,sleepAfter:.35,restitution:.1,friction:.35,maxVelocity:1600,contactWakeSpeed:200},Nt=1e-9,Et=.005;function Lt(t){return"circle"===t.type?{type:"circle",radius:t.radius}:{type:"aabb",width:t.width,height:t.height}}function Yt(t){return"aabb"===t.type?{type:"aabb",x:t.x,y:t.y,width:t.width,height:t.height}:{type:"segment",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,thickness:t.thickness}}function Wt(t,e,i){return Math.max(e,Math.min(i,t))}function Xt(t,e,i){return Math.min(t??i,e??i)}function zt(t,e,i){return Wt(Math.max(t??i,e??i),0,1)}function Gt(t){return 0>t?-1:1}function Kt(t){if("circle"===t.shape.type){const e=t.shape.radius;return{minX:t.x-e,minY:t.y-e,maxX:t.x+e,maxY:t.y+e}}const e=t.shape.width/2,i=t.shape.height/2;return{minX:t.x-e,minY:t.y-i,maxX:t.x+e,maxY:t.y+i}}function Ht(t){const e=t.shape;if("aabb"===e.type){const t=e.width/2,i=e.height/2;return{minX:e.x-t,minY:e.y-i,maxX:e.x+t,maxY:e.y+i}}const i=(e.thickness??0)/2;return{minX:Math.min(e.x1,e.x2)-i,minY:Math.min(e.y1,e.y2)-i,maxX:Math.max(e.x1,e.x2)+i,maxY:Math.max(e.y1,e.y2)+i}}function _t(t,e){return!(t.minX>e.maxX||e.minX>t.maxX||t.minY>e.maxY||e.minY>t.maxY)}function Ut(t,e,i,n,s,o,r,a){const c=s-t,d=(i+r)/2-Math.abs(c);if(0>=d)return null;const l=o-e,h=(n+a)/2-Math.abs(l);return h>0?h>d?{nx:Gt(c),ny:0,penetration:d}:{nx:0,ny:Gt(l),penetration:h}:null}function Vt(t,e,i,n,s,o,r){const a=o/2,c=r/2,d=t-Wt(t,n-a,n+a),l=e-Wt(e,s-c,s+c),h=d*d+l*l;if(h>i*i)return null;if(Nt>=h){const o=Math.abs(t-(n-a)),r=Math.abs(t-(n+a)),d=Math.abs(e-(s-c)),l=Math.abs(e-(s+c)),h=Math.min(o,r,d,l);return h===o?{nx:-1,ny:0,penetration:i+o}:h===r?{nx:1,ny:0,penetration:i+r}:h===d?{nx:0,ny:-1,penetration:i+d}:{nx:0,ny:1,penetration:i+l}}const u=Math.sqrt(h);return{nx:d/u,ny:l/u,penetration:i-u}}function Qt(t,e){if("circle"===t.shape.type&&"circle"===e.shape.type)return function(t,e,i,n,s,o){const r=n-t,a=s-e,c=i+o,d=r*r+a*a;if(d>=c*c)return null;if(Nt>=d)return{nx:1,ny:0,penetration:c};const l=Math.sqrt(d);return{nx:r/l,ny:a/l,penetration:c-l}}(t.x,t.y,t.shape.radius,e.x,e.y,e.shape.radius);if("aabb"===t.shape.type&&"aabb"===e.shape.type)return Ut(t.x,t.y,t.shape.width,t.shape.height,e.x,e.y,e.shape.width,e.shape.height);if("circle"===t.shape.type&&"aabb"===e.shape.type){const i=Vt(t.x,t.y,t.shape.radius,e.x,e.y,e.shape.width,e.shape.height);return i?{nx:-i.nx,ny:-i.ny,penetration:i.penetration}:null}return"aabb"===t.shape.type&&"circle"===e.shape.type?Vt(e.x,e.y,e.shape.radius,t.x,t.y,t.shape.width,t.shape.height):null}function Zt(t,e){const i=e.shape;return"aabb"===i.type?"circle"===t.shape.type?Vt(t.x,t.y,t.shape.radius,i.x,i.y,i.width,i.height):Ut(i.x,i.y,i.width,i.height,t.x,t.y,t.shape.width,t.shape.height):function(t,e,i,n,s,o,r,a=0){const c=o-n,d=r-s,l=c*c+d*d,h=l>Nt?Wt(((t-n)*c+(e-s)*d)/l,0,1):0,u=i+a/2,f=t-(n+c*h),p=e-(s+d*h),m=f*f+p*p;if(m>=u*u)return null;if(Nt>=m){const t=Math.sqrt(l);return t>Nt?{nx:-d/t,ny:c/t,penetration:u}:{nx:1,ny:0,penetration:u}}const y=Math.sqrt(m);return{nx:f/y,ny:p/y,penetration:u-y}}(t.x,t.y,"circle"===t.shape.type?t.shape.radius:Math.sqrt(t.shape.width*t.shape.width+t.shape.height*t.shape.height)/2,i.x1,i.y1,i.x2,i.y2,i.thickness??0)}function Jt(t,e){return`${t}\0${e}`}function te(t){const e=t.indexOf("\0");return{sensorId:t.slice(0,e),bodyId:t.slice(e+1)}}function ee(t){return{id:t.id,x:t.x,y:t.y,prevX:t.prevX,prevY:t.prevY,vx:t.vx,vy:t.vy,angle:t.angle,mass:t.mass,bodyCollisions:t.bodyCollisions,shape:Lt(t.shape),sleeping:t.sleeping,datum:t.datum,index:t.index,sleepTime:t.sleepTime,restitution:t.restitution,friction:t.friction}}function ie(t){return t&&"function"!=typeof t?{property:t.property,equals:t.equals,notEquals:t.notEquals,oneOf:t.oneOf?.slice(),notOneOf:t.notOneOf?.slice()}:t}function ne(t){return{id:t.id,shape:Yt(t.shape),sensor:t.sensor,restitution:t.restitution,friction:t.friction,bodyFilter:ie(t.bodyFilter),index:t.index}}function se(t,e){if(!e)return;let i=t;for(const t of e.split(".")){if(null==i||"object"!=typeof i)return;if(!Object.prototype.hasOwnProperty.call(i,t))return;i=i[t]}return i}function oe(t,e){return!!e?.some(e=>Object.is(t,e))}function re(t,e){if(!e)return!0;if("function"==typeof e)return e(t);const i=se(t,e.property);return!("equals"in e&&!Object.is(i,e.equals)||"notEquals"in e&&Object.is(i,e.notEquals)||e.oneOf&&!oe(i,e.oneOf)||e.notOneOf&&oe(i,e.notOneOf))}function ae(t,e){return re(e,t.bodyFilter)}var ce=class{constructor(t={}){this.capabilities={determinism:"strict",sensors:!0,joints:!1,ccd:!1,maxBodiesHint:5e3,worker:!1},this.bodies=new Map,this.colliders=new Map,this.springs=new Map,this.activeSensors=new Set,this.supportedThisStep=new Set,this.lastEvents=[],this.nextBodyIndex=0,this.nextColliderIndex=0,this.nextSpringIndex=0,this.options={...Ft,...t},this.random=n(this.options.seed)}init(t={}){this.options={...Ft,...t},this.random=n(this.options.seed),this.bodies.clear(),this.colliders.clear(),this.springs.clear(),this.activeSensors.clear(),this.lastEvents=[],this.nextBodyIndex=0,this.nextColliderIndex=0,this.nextSpringIndex=0}spawn(t){const e={id:t.id,x:t.x,y:t.y,prevX:t.x,prevY:t.y,vx:t.vx??0,vy:t.vy??0,angle:t.angle??0,mass:Math.max(Nt,t.mass??1),bodyCollisions:t.bodyCollisions??!0,shape:Lt(t.shape),sleeping:!1,datum:t.datum,restitution:t.restitution,friction:t.friction,index:this.nextBodyIndex,sleepTime:0};this.nextBodyIndex+=1,this.bodies.set(t.id,e)}remove(t){for(const e of t){this.bodies.delete(e);for(const t of Array.from(this.activeSensors))te(t).bodyId===e&&this.activeSensors.delete(t)}}setColliders(t){this.colliders.clear(),this.activeSensors.clear(),this.nextColliderIndex=0;for(const e of t)this.colliders.set(e.id,{...e,shape:Yt(e.shape),bodyFilter:ie(e.bodyFilter),index:this.nextColliderIndex}),this.nextColliderIndex+=1}setConstraint(t){const e=t.id??"spring-"+this.nextSpringIndex;return this.springs.set(e,{id:e,bodyId:t.bodyId,target:t.target,restLength:t.restLength??0,stiffness:t.stiffness??40,damping:t.damping??3}),this.nextSpringIndex+=1,e}removeConstraint(t){this.springs.delete(t)}applyImpulse(t,e,i){const n=this.bodies.get(t);n&&(n.vx+=e/n.mass,n.vy+=i/n.mass,this.wake(n))}step(t=this.options.fixedDt){const e=Math.max(0,t);if(this.lastEvents=[],0===e)return;const i=this.sortedBodies();for(const t of i)t.prevX=t.x,t.prevY=t.y;this.applySprings(e);const n=this.options.maxVelocity;for(const t of i)if(!t.sleeping){if(t.vx+=this.options.gravity.x*e,t.vy+=this.options.gravity.y*e,t.vx*=this.options.velocityDamping,t.vy*=this.options.velocityDamping,n>0){const e=Math.sqrt(t.vx*t.vx+t.vy*t.vy);if(e>n){const i=n/e;t.vx*=i,t.vy*=i}}t.x+=t.vx*e,t.y+=t.vy*e}this.supportedThisStep.clear();const s=this.bodyPairKeys(i),o=this.sortedColliders().filter(t=>!t.sensor);for(let t=0;this.options.collisionIterations>t;t+=1)this.resolveBodyPairs(i,s,0===t),this.resolveColliders(i,o,0===t);this.updateSensors(i),this.updateSleeping(i,e)}settle(t=1200,e=this.options.fixedDt){let i=0;for(;t>i&&!this.allSleeping();)this.step(e),i+=1;return i}readState(t=[]){t.length=0;for(const e of this.sortedBodies())t.push({id:e.id,x:e.x,y:e.y,prevX:e.prevX,prevY:e.prevY,vx:e.vx,vy:e.vy,angle:e.angle,mass:e.mass,shape:Lt(e.shape),sleeping:e.sleeping,datum:e.datum});return t}events(){return this.lastEvents.slice()}activeSensorPairs(){return Array.from(this.activeSensors).sort().map(te)}allSleeping(){for(const t of this.bodies.values())if(!t.sleeping)return!1;return!0}snapshot(){return{options:{...this.options,gravity:{...this.options.gravity}},bodies:this.sortedBodies().map(ee),colliders:this.sortedColliders().map(ne),springs:Array.from(this.springs.values()).map(t=>({...t,target:{...t.target}})),activeSensors:Array.from(this.activeSensors).sort()}}restore(t){this.options={...t.options,gravity:{...t.options.gravity}},this.random=n(this.options.seed),this.bodies.clear(),this.colliders.clear(),this.springs.clear(),this.activeSensors=new Set(t.activeSensors),this.lastEvents=[],this.nextBodyIndex=0;for(const e of t.bodies){const t=ee(e);this.bodies.set(t.id,t),this.nextBodyIndex=Math.max(this.nextBodyIndex,t.index+1)}this.nextColliderIndex=0;for(const e of t.colliders){const t=ne(e);this.colliders.set(t.id,t),this.nextColliderIndex=Math.max(this.nextColliderIndex,t.index+1)}this.nextSpringIndex=0;for(const e of t.springs){this.springs.set(e.id,{...e,target:{...e.target}});const t=/^spring-(\d+)$/.exec(e.id);t&&(this.nextSpringIndex=Math.max(this.nextSpringIndex,Number(t[1])+1))}}dispose(){this.bodies.clear(),this.colliders.clear(),this.springs.clear(),this.activeSensors.clear(),this.lastEvents=[]}sortedBodies(){return Array.from(this.bodies.values()).sort((t,e)=>t.index-e.index)}sortedColliders(){return Array.from(this.colliders.values()).sort((t,e)=>t.index-e.index)}applySprings(t){for(const e of Array.from(this.springs.values()).sort((t,e)=>t.id.localeCompare(e.id))){const i=this.bodies.get(e.bodyId);if(!i||i.sleeping)continue;const n="point"===e.target.type?e.target:this.bodies.get(e.target.bodyId);if(!n)continue;const s=n.x-i.x,o=n.y-i.y,r=Math.sqrt(s*s+o*o);if(Nt>=r)continue;const a=s/r,c=o/r,d=(r-e.restLength)*e.stiffness+((("vx"in n?n.vx:0)-i.vx)*a+(("vy"in n?n.vy:0)-i.vy)*c)*e.damping;i.vx+=d*a*t/i.mass,i.vy+=d*c*t/i.mass}}resolveBodyPairs(t,e,i){for(const n of e){const[e,s]=n.split(":").map(Number),o=t[e],r=t[s];if(!o||!r)continue;const a=Qt(o,r);a&&(this.resolveDynamicCollision(o,r,a),i&&this.lastEvents.push({type:"contact",bodyId:o.id,otherId:r.id,sensor:!1}))}}bodyPairKeys(t){const e=Math.max(1,this.options.cellSize),i=new Map;for(let n=0;t.length>n;n+=1){if(!1===t[n].bodyCollisions)continue;const s=Kt(t[n]),o=Math.floor(s.minX/e),r=Math.floor(s.maxX/e),a=Math.floor(s.minY/e),c=Math.floor(s.maxY/e);for(let t=o;r>=t;t+=1)for(let e=a;c>=e;e+=1){const s=`${t}:${e}`,o=i.get(s);o?o.push(n):i.set(s,[n])}}const n=new Set;for(const e of Array.from(i.keys()).sort()){const s=i.get(e)??[];s.sort((t,e)=>t-e);for(let e=0;s.length>e;e+=1)for(let i=e+1;s.length>i;i+=1){const o=s[e],r=s[i];!1!==t[o].bodyCollisions&&!1!==t[r].bodyCollisions&&_t(Kt(t[o]),Kt(t[r]))&&n.add(`${o}:${r}`)}}return Array.from(n).sort((t,e)=>{const[i,n]=t.split(":").map(Number),[s,o]=e.split(":").map(Number);return i===s?n-o:i-s})}resolveDynamicCollision(t,e,i){t.sleeping&&this.contactOpposesGravity(i.nx,i.ny)&&this.supportedThisStep.add(e.id),e.sleeping&&this.contactOpposesGravity(-i.nx,-i.ny)&&this.supportedThisStep.add(t.id);const n=t.sleeping?0:1/t.mass,s=e.sleeping?0:1/e.mass,o=n+s;if(Nt>=o)return;const r=Math.max(0,i.penetration-Et)/o;t.x-=i.nx*r*n,t.y-=i.ny*r*n,e.x+=i.nx*r*s,e.y+=i.ny*r*s;const a=(e.vx-t.vx)*i.nx+(e.vy-t.vy)*i.ny;if(a>0)return;const c=Math.abs(a),d=-(1+Xt(t.restitution,e.restitution,this.options.restitution))*a/o,l=d*i.nx,h=d*i.ny;t.vx-=l*n,t.vy-=h*n,e.vx+=l*s,e.vy+=h*s,this.applyFriction(t,e,i,d,n,s),c>this.options.contactWakeSpeed&&(this.wake(t),this.wake(e))}applyFriction(t,e,i,n,s,o){const r=-i.ny,a=i.nx,c=(e.vx-t.vx)*r+(e.vy-t.vy)*a,d=s+o;if(Nt>=Math.abs(c)||Nt>=d)return;const l=zt(t.friction,e.friction,this.options.friction),h=Wt(-c/d,-n*l,n*l),u=h*r,f=h*a;t.vx-=u*s,t.vy-=f*s,e.vx+=u*o,e.vy+=f*o}resolveColliders(t,e,i){for(const n of t)for(const t of e){if(!ae(t,n))continue;if(!_t(Kt(n),Ht(t)))continue;const e=Zt(n,t);e&&(this.resolveStaticCollision(n,t,e),this.contactOpposesGravity(e.nx,e.ny)&&this.supportedThisStep.add(n.id),i&&this.lastEvents.push({type:"contact",bodyId:n.id,otherId:t.id,sensor:!1}))}}resolveStaticCollision(t,e,i){t.x+=i.nx*Math.max(0,i.penetration-Et),t.y+=i.ny*Math.max(0,i.penetration-Et);const n=t.vx*i.nx+t.vy*i.ny;if(0>n){const s=Xt(t.restitution,e.restitution,this.options.restitution);t.vx-=(1+s)*n*i.nx,t.vy-=(1+s)*n*i.ny;const o=-i.ny,r=i.nx,a=t.vx*o+t.vy*r,c=zt(t.friction,e.friction,this.options.friction);t.vx-=a*o*c,t.vy-=a*r*c}}updateSensors(t){const e=new Set,i=this.sortedColliders().filter(t=>t.sensor);for(const n of t){const t=Kt(n);for(const s of i){if(!ae(s,n))continue;if(!_t(t,Ht(s)))continue;if(!Zt(n,s))continue;const i=Jt(s.id,n.id);e.add(i),this.activeSensors.has(i)||this.lastEvents.push({type:"sensor-enter",bodyId:n.id,sensorId:s.id})}}for(const t of Array.from(this.activeSensors).sort()){if(e.has(t))continue;const{sensorId:i,bodyId:n}=te(t);this.lastEvents.push({type:"sensor-exit",bodyId:n,sensorId:i})}this.activeSensors=e}updateSleeping(t,e){const i=Math.hypot(this.options.gravity.x,this.options.gravity.y)>1;for(const n of t)Math.sqrt(n.vx*n.vx+n.vy*n.vy)>=this.options.sleepSpeed||Math.sqrt((n.x-n.prevX)*(n.x-n.prevX)+(n.y-n.prevY)*(n.y-n.prevY))>=this.options.sleepSpeed*e||i&&!this.supportedThisStep.has(n.id)?n.sleeping?this.wake(n):n.sleepTime=0:(n.sleepTime+=e,n.sleeping||this.options.sleepAfter>n.sleepTime||(n.sleeping=!0,n.vx=0,n.vy=0,this.lastEvents.push({type:"sleep",bodyId:n.id})))}contactOpposesGravity(t,e){const{x:i,y:n}=this.options.gravity,s=Math.hypot(i,n);return 1e-9>=s||-.2>(t*i+e*n)/s}wake(t){t.sleeping&&this.lastEvents.push({type:"wake",bodyId:t.id}),t.sleeping=!1,t.sleepTime=0}nextRandom(){return this.random()}},de=["binId","targetBin","category","windowIndex","lane","group"];function le(t,e){if(!Number.isFinite(e))return;t.count+=1,t.total+=e,t.min=Math.min(t.min,e),t.max=Math.max(t.max,e);const i=e-t.mean;t.mean+=i/t.count,t.m2+=i*(e-t.mean)}function he(t){return{count:t.count,total:t.total,mean:t.count>0?t.mean:0,min:t.count>0?t.min:0,max:t.count>0?t.max:0,variance:t.count>1?t.m2/(t.count-1):0}}function ue(t){return{count:t.count,total:t.total,mean:t.mean,m2:t.variance*Math.max(0,t.count-1),min:t.count>0?t.min:1/0,max:t.count>0?t.max:-1/0}}function fe(t,e){if(null!=t[e])return t[e];const i=t.datum;return i&&"object"==typeof i?i[e]:void 0}function pe(t,e,i){return"function"==typeof t?t(e,i):"string"==typeof t?fe(e,t):void 0}function me(t){if(null==t)return;const e=t+"";return e.trim()?e:void 0}function ye(t){const e=he(t.value);return{id:t.id,label:t.label,count:e.count,total:e.total,bodyIds:t.bodyIds.slice(),lastBodyId:t.lastBodyId,lastDatum:t.lastDatum,x:he(t.x),y:he(t.y),value:e}}var ge=class{constructor(t=!1){this.bins=new Map,this.nextIndex=0,this.config=t}updateConfig(t){void 0!==t&&(this.config=t,!1===t&&this.clear())}isEnabled(){return!1!==this.config}add(t){if(!1===this.config)return null;const e=this.nextIndex;this.nextIndex+=1;const i=me(pe(this.config.binAccessor,t,e))??function(t){for(const e of de){const i=me(fe(t,e));if(i)return i}return"sediment"}(t),n=me(pe(this.config.labelAccessor,t,e))??i,s=function(t,e,i){if("number"==typeof t)return t;const n="function"==typeof t?t(e,i):"string"==typeof t?fe(e,t):1,s="number"==typeof n?n:Number(n);return Number.isFinite(s)?s:1}(this.config.valueAccessor,t,e),o=Math.max(0,Math.floor(this.config.retainBodyIds??12));let r=this.bins.get(i);return r||(r={id:i,label:n,bodyIds:[],x:{count:0,total:0,mean:0,m2:0,min:1/0,max:-1/0},y:{count:0,total:0,mean:0,m2:0,min:1/0,max:-1/0},value:{count:0,total:0,mean:0,m2:0,min:1/0,max:-1/0}},this.bins.set(i,r)),r.label=n,r.lastBodyId=t.id,r.lastDatum=t.datum,le(r.x,t.x),le(r.y,t.y),le(r.value,s),o>0&&(r.bodyIds.push(t.id),r.bodyIds.length>o&&(r.bodyIds=r.bodyIds.slice(r.bodyIds.length-o))),ye(r)}clear(){this.bins.clear(),this.nextIndex=0}snapshot(){return Array.from(this.bins.values()).map(ye)}restore(t=[]){this.bins.clear();for(const e of t)this.bins.set(e.id,{id:e.id,label:e.label,bodyIds:e.bodyIds.slice(),lastBodyId:e.lastBodyId,lastDatum:e.lastDatum,x:ue(e.x),y:ue(e.y),value:ue(e.value)});this.nextIndex=t.reduce((t,e)=>t+e.count,0)}totals(){const t=this.snapshot();return{bins:t.length,count:t.reduce((t,e)=>t+e.count,0),total:t.reduce((t,e)=>t+e.total,0)}}};function be(t,e={}){const{baselineY:i=0,binWidth:n=24,gap:s=2,maxHeight:o=80,value:r="count",x:a}=e,c=Math.max(1,...t.map(t=>t[r]));return t.map((t,e)=>{const d=Math.max(0,t[r]/c*o),l=a?.(t,e)??e*(n+s);return{binId:t.id,label:t.label,index:e,count:t.count,total:t.total,x:l,y:i-d,width:n,height:d,meanX:t.x.mean,meanY:t.y.mean}})}var xe={bodyLimit:1/0,eviction:"oldest",fixedDt:1/120,maxDeltaSeconds:.1,maxSubsteps:8,settleStepLimit:1200,timeScale:1},ve={chartId:"physics",chartType:"physics",sensors:{},onObservation:void 0,onSimulationStateChange:void 0};function we(t={},e=ve){return{chartId:t.chartId??e.chartId,chartType:t.chartType??e.chartType,sensors:t.sensors??e.sensors,onObservation:t.onObservation??e.onObservation,onSimulationStateChange:t.onSimulationStateChange??e.onSimulationStateChange}}function Se(t){return{...t,shape:{...t.shape},datum:t.datum,springs:t.springs?.map(t=>({...t,target:{...t.target}}))}}function Me(t){if(t instanceof Date){const e=t.getTime();return Number.isFinite(e)?e:void 0}const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:void 0}function Ie(t,e){if(null!=t[e])return t[e];const i=t.datum;return i&&"object"==typeof i?i[e]:void 0}function ke(t){return{...Se(t),sequence:t.sequence,spawnAt:t.spawnAt}}function Be(t){return t.map(t=>({...t,shape:{...t.shape},bodyFilter:t.bodyFilter&&"function"!=typeof t.bodyFilter?{...t.bodyFilter,oneOf:t.bodyFilter.oneOf?.slice(),notOneOf:t.bodyFilter.notOneOf?.slice()}:t.bodyFilter}))}function Oe(t){return!1!==t&&{...t}}function qe(t,e){return t.spawnAt===e.spawnAt?t.sequence-e.sequence:t.spawnAt-e.spawnAt}function Ae(t){return{...t,gravity:{...t.gravity}}}function Ce(t,e,i,n){if("circle"===t.shape.type){const s=t.x-e,o=t.y-i,r=t.shape.radius+n,a=s*s+o*o;return a>r*r?null:a}const s=Math.max(Math.abs(e-t.x)-t.shape.width/2,0),o=Math.max(Math.abs(i-t.y)-t.shape.height/2,0),r=s*s+o*o;return r>n*n?null:r}function Te(t){const e=t.indexOf("\0");return{sensorId:t.slice(0,e),bodyId:t.slice(e+1)}}function De(t,e={}){const{idPrefix:i="plot",includeFloor:n=!0,includeCeiling:s=!1,includeLeftWall:o=!0,includeRightWall:r=!0,wallThickness:a=20,floorThickness:c=a}=e,d=[],l=t.x+t.width/2,h=t.y+t.height/2;return n&&d.push({id:i+"-floor",shape:{type:"aabb",x:l,y:t.y+t.height+c/2,width:t.width+2*a,height:c}}),s&&d.push({id:i+"-ceiling",shape:{type:"aabb",x:l,y:t.y-c/2,width:t.width+2*a,height:c}}),o&&d.push({id:i+"-left-wall",shape:{type:"aabb",x:t.x-a/2,y:h,width:a,height:t.height+2*c}}),r&&d.push({id:i+"-right-wall",shape:{type:"aabb",x:t.x+t.width+a/2,y:h,width:a,height:t.height+2*c}}),d}function Re(t){const{idPrefix:e="bin",count:i,domainStart:n,domainStep:s,xScale:o,yTop:r,yBottom:a,wallThickness:c=4,includeBoundaryWalls:d=!0,includeInteriorWalls:l=!0,closedBefore:h,lidY:u=r,lidThickness:f=Math.max(2,c)}=t,p=[],m=r+(a-r)/2,y=Math.abs(a-r),g=d?i:i-1;if(l||d)for(let t=d?0:1;g>=t;t+=1){if(!l&&t>0&&i>t)continue;const r=o(n+t*s);p.push({id:`${e}-wall-${t}`,shape:{type:"aabb",x:r,y:m,width:c,height:y}})}if(null!=h)for(let t=0;i>t;t+=1){const i=n+t*s,r=i+s;if(r>=h)continue;const a=o(i),d=o(r);p.push({id:`${e}-lid-${t}`,shape:{type:"segment",x1:Math.min(a,d)+c/2,y1:u,x2:Math.max(a,d)-c/2,y2:u,thickness:f}})}return p}var Pe=class{constructor(t={}){this.id="builtin",this.capabilities={...(new ce).capabilities,engine:"builtin"},this.world=new ce(t)}init(t={}){this.world.init(t)}spawn(t){this.world.spawn(t)}remove(t){this.world.remove(t)}setColliders(t){this.world.setColliders(t)}setConstraint(t){return this.world.setConstraint(t)}removeConstraint(t){this.world.removeConstraint(t)}applyImpulse(t,e,i){this.world.applyImpulse(t,e,i)}step(t){this.world.step(t)}settle(t,e){return this.world.settle(t,e)}readState(t){return this.world.readState(t)}events(){return this.world.events()}activeSensorPairs(){return this.world.activeSensorPairs()}allSleeping(){return this.world.allSleeping()}snapshot(){return this.world.snapshot()}restore(t){this.world.restore(t)}nextRandom(){return this.world.nextRandom()}dispose(){this.world.dispose()}};function $e(t,e={}){return t?"function"==typeof t?t(e):(t.init(e),t):function(t={}){return new Pe(t)}(e)}function je(t){const e=Number(t);if(Number.isFinite(e)&&e>0)return Math.floor(e)}var Fe={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function Ne(t,e){const i={...t};for(const t of e)i[Fe[t]]++;return i}function Ee(t,e,i){const n=new Set(e);return{changeSet:{...t,...t.keys?{keys:[...t.keys]}:{}},changed:n,revisions:Ne(i,n)}}var Le=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Ee({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}record(t,e){const i=Ee(t,e,this.revisions);this.revisions=i.revisions,this.latest=i;for(const t of[...this.listeners])t();return i}};import{quadtree as Ye}from"d3-quadtree";var We=class{constructor(){this.maxSearchRadius=0,this.revision=-1,this.tree=null}hitTest(t,e,i,n,s,o=0,r){const a=this.ensure(t,e);if(!a)return null;let c=null,d=1/0;const l=Math.max(0,r?.searchRadius??Math.max(0,o)+this.maxSearchRadius),h=n-l,u=n+l,f=s-l,p=s+l;return a.visit((t,e,a,l,m)=>{if(h>l||e>u||f>m||a>p)return!0;if(t.length)return!1;let y=t;for(;y;){const t=y.data;if(t&&(!r?.include||r.include(t))){const e=r?.distanceSquared?r.distanceSquared(t,n,s):Ce(t,n,s,Math.max(0,o));null!=e&&(d>e||e===d&&i.indexOf(t.id)>i.indexOf(c?.id??""))&&(c=t,d=e)}y=y.next}return!1}),c}ensure(t,e){if(this.tree&&this.revision===e)return this.tree;const i=t.readState();return 0===i.length?(this.tree=null,this.maxSearchRadius=0,this.revision=e,null):(this.maxSearchRadius=i.reduce((t,e)=>Math.max(t,function(t){return"circle"===t.shape.type?t.shape.radius:Math.hypot(t.shape.width,t.shape.height)/2}(e)),0),this.tree=Ye().x(t=>t.x).y(t=>t.y).addAll(i),this.revision=e,this.tree)}},Xe=["data","scene-geometry","data-paint","accessibility","evidence"],ze=["scene-geometry","data-paint","accessibility","evidence"],Ge=["overlay","accessibility","evidence"],Ke=(t,e)=>({retainedData:t,invalidations:e}),He=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],_e=["scene-geometry","data-paint","accessibility","evidence"],Ue=[],Ve={engine:Ke("rebuild",["scene-geometry","data-paint","accessibility","evidence"]),kernel:Ke("preserve",_e),colliders:Ke("preserve",_e),sediment:Ke("preserve",_e),bodyBudget:Ke("preserve",He),bodyLimit:Ke("preserve",He),eviction:Ke("preserve",He),fixedDt:Ke("preserve",Ue),maxDeltaSeconds:Ke("preserve",Ue),maxSubsteps:Ke("preserve",Ue),settleStepLimit:Ke("preserve",Ue),timeScale:Ke("preserve",Ue),observation:Ke("preserve",Ue)},Qe=Ke("preserve",He);function Ze(t){let e="preserve";const i=new Set;for(const n of t){const t=Ve[n]??Qe;"rebuild"===t.retainedData&&(e="rebuild");for(const e of t.invalidations)i.add(e)}return{retainedData:e,invalidations:i}}var Je=["seed","fixedDt","cellSize","collisionIterations","velocityDamping","sleepSpeed","sleepAfter","restitution","friction","maxVelocity","contactWakeSpeed"];function ti(t,e){return t===e||!(!t||!e)&&t.gravity?.x===e.gravity?.x&&t.gravity?.y===e.gravity?.y&&Je.every(i=>t[i]===e[i])}function ei(t,e,i,n){return t||!e?"paused":i||!n?"running":"settled"}var ii=class{constructor(){this.seconds=0,this.speed=8,this.scratch=[]}setKernelOptions(t){this.speed=function(t){const e=t?.sleepSpeed;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:8}(t)}reset(){this.seconds=0}isAtRest(){return this.seconds>=.6}refresh(t,e,i){if(i>0)return void(this.seconds=0);const n=t.readState(this.scratch),s=this.speed*this.speed;let o=!0;for(const t of n)if(!t.sleeping&&t.vx*t.vx+t.vy*t.vy>=s){o=!1;break}this.seconds=o?this.seconds+Math.max(0,e):0}},ni=class{constructor(t={}){this.activeSensorPairs=new Set,this.accumulator=0,this.bodyBudgetObservationKey="ok",this.bodySpatialIndex=new We,this.elapsedSeconds=0,this.liveBodyOrder=[],this.nextSequence=0,this.paused=!1,this.queue=[],this.revision=0,this.updateResults=new Le,this.simulationState="settled",this.visible=!0,this.quiescence=new ii;const{bodyBudget:e,colliders:i,engine:n,kernel:s,observation:o,sediment:r,...a}=t;this.config={...xe,...a},this.configInput={...t},this.bodyBudget=e??{},this.engineInput=n,this.observation=we(o),this.sediment=new ge(r??!1),this.world=$e(n,{fixedDt:this.config.fixedDt,...s}),this.quiescence.setKernelOptions(s),i&&this.world.setColliders(Be(i))}updateConfig(t){const e=function(t,e){return Object.keys(t).filter(i=>"kernel"===i?!ti(t.kernel,e.kernel):t[i]!==e[i])}(t,this.configInput),{colliders:i,bodyBudget:n,engine:s,kernel:o,observation:r,sediment:a,...c}=t;if(this.config={...this.config,...c},void 0!==n&&(this.bodyBudget=n,!1===n&&(this.bodyBudgetObservationKey="ok")),s&&s!==this.engineInput){const t=this.world.snapshot();this.world.dispose(),this.engineInput=s,this.world=$e(s,t.options),this.world.restore(t),this.revision+=1}if(o&&!ti(o,this.configInput.kernel)){const t=this.world.snapshot(),e={...t.options,...o,gravity:{...t.options.gravity,...o.gravity}};this.world.restore({...t,options:e}),this.quiescence.setKernelOptions(e),this.revision+=1}r&&(this.observation=we(r,this.observation)),this.sediment.updateConfig(a),i&&(this.world.setColliders(Be(i)),this.revision+=1),this.configInput={...this.configInput,...t};const d=Ze(e);this.updateResults.record({kind:"config",keys:e},d.invalidations)}updateConfigWithResult(t){return this.updateConfig(t),this.updateResults.last}setColliders(t){this.world.setColliders(Be(t)),this.revision+=1,this.updateResults.record({kind:"config",keys:["colliders"]},Ze(["colliders"]).invalidations)}enqueue(t,e){const i=Array.isArray(t)?t:[t],n=e?function(t,e={}){const i=Me(e.startAt)??0,n=e.pacing??"immediate";if("arrival"===n){const n=t.map((t,i)=>function(t,e,i){return"function"==typeof i?Me(i(t,e)):"string"==typeof i?Me(Ie(t,i)):Me(t.spawnAt)??Me(Ie(t,"arrivalTime"))??Me(Ie(t,"timestamp"))??Me(Ie(t,"time"))??Me(Ie(t,"eventTime"))}(t,i,e.timeAccessor)),s=n.filter(t=>null!=t),o=s.length>0?Math.min(...s):0,r=Me(e.timeScale)??1,a=r>0?r:1;return t.map((t,e)=>{const s=n[e],r=null==s?0:Math.max(0,s-o);return{...Se(t),spawnAt:i+r/a}})}if("object"==typeof n){const e=Me(n.ratePerSec);if(e&&e>0)return t.map((t,n)=>({...Se(t),spawnAt:i+n/e}))}return t.map(t=>({...Se(t),spawnAt:i}))}(i,{...e,startAt:e.startAt??this.elapsedSeconds}):i;for(const t of n)this.queue.push({...Se(t),sequence:this.nextSequence,spawnAt:t.spawnAt??this.elapsedSeconds}),this.nextSequence+=1;this.queue.sort(qe),n.length>0&&(this.revision+=1),this.updateResults.record({kind:"enqueue",count:n.length},n.length?Xe:[])}enqueueWithResult(t,e){return this.enqueue(t,e),this.updateResults.last}spawnNow(t){this.spawnOne(Se(t)),this.nextSequence+=1,this.observeBodyBudget(),this.evictOverflow(),this.revision+=1,this.updateResults.record({kind:"enqueue",count:1},Xe)}materializeDueSpawns(){const t=this.revision,e=[],i=[];return this.spawnDue(e,i),0===e.length||(this.observeBodyBudget(i),this.evictOverflow(i),this.syncSimulationState(i),this.revision+=1,this.updateResults.record({kind:"enqueue",count:e.length},this.revision!==t?Xe:[])),e}clear(){const t=this.world.snapshot().options;this.world.init({...t,fixedDt:this.config.fixedDt}),this.activeSensorPairs.clear(),this.liveBodyOrder=[],this.queue=[],this.accumulator=0,this.elapsedSeconds=0,this.nextSequence=0,this.quiescence.reset(),this.sediment.clear(),this.bodyBudgetObservationKey="ok",this.revision+=1,this.syncSimulationState(),this.updateResults.record({kind:"clear"},Xe)}tick(t){const e=this.revision,i=[],n=[],s=[],o=[],r=[];if(this.paused||!this.visible){const t=this.result(0,i,n,s,o,r,!1);return this.updateResults.record({kind:"tick",count:0},[]),t}const a=Math.max(0,Math.min(t,this.config.maxDeltaSeconds))*this.config.timeScale;this.elapsedSeconds+=a,this.spawnDue(i,r);const c=this.observeBodyBudget(r),d=this.evictOverflow(r);n.push(...d.evicted),s.push(...d.sedimented),this.syncSimulationState(r),this.accumulator+=a;let l=0;for(;this.accumulator>=this.config.fixedDt&&this.config.maxSubsteps>l;){this.world.step(this.config.fixedDt);const t=this.world.events();o.push(...t),this.observeKernelEvents(t,r),this.observeSensorTransitions(r),this.accumulator-=this.config.fixedDt,l+=1}l===this.config.maxSubsteps&&(this.accumulator=Math.min(this.accumulator,this.config.fixedDt)),this.quiescence.refresh(this.world,a,i.length),(l>0||i.length>0||n.length>0||s.length>0||o.length>0)&&(this.revision+=1);const h=this.result(l,i,n,s,o,r,void 0,c);return this.updateResults.record({kind:"tick",count:l},this.revision!==e?i.length||n.length||s.length?Xe:ze:[]),h}settle(t=this.config.settleStepLimit){return this.runSettle(t,!1).steps}settleWithObservations(t=this.config.settleStepLimit){return this.runSettle(t,!0)}settleHost(){return{fixedDt:this.config.fixedDt,queueSize:()=>this.queue.length,atRest:()=>this.atRest(),advanceTime:t=>{this.elapsedSeconds+=t},spawnDue:(t,e)=>this.spawnDue(t,e),observeBodyBudget:t=>this.observeBodyBudget(t),evictOverflow:t=>this.evictOverflow(t),step:t=>this.world.step(t),drainEvents:()=>this.world.events(),observeKernelEvents:(t,e)=>this.observeKernelEvents(t,e),observeSensorTransitions:t=>this.observeSensorTransitions(t),refreshQuiescence:(t,e)=>this.quiescence.refresh(this.world,t,e)}}runSettle(t,e){const i=this.revision,n=[],s=[],o=[],r=[],a=e?[]:void 0;if(e&&(this.paused||!this.visible)){const t=this.result(0,n,s,o,r,a??[],!1);return this.updateResults.record({kind:"settle",count:0},[]),t}this.spawnDue(n,a);const c=this.observeBodyBudget(a),d=this.evictOverflow(a);s.push(...d.evicted),o.push(...d.sedimented),this.syncSimulationState(a),n.length>0&&this.quiescence.reset();const l=e?{spawned:n,evicted:s,sedimented:o,events:r,observations:a}:{spawned:n},{steps:h,budget:u}=function(t,e,i){let n,s=0;for(;e>s&&(t.queueSize()>0||!t.atRest());){t.advanceTime(t.fixedDt);const e=[];if(t.spawnDue(e,i.observations),e.length>0){i.spawned.push(...e),n=t.observeBodyBudget(i.observations);const s=t.evictOverflow(i.observations);i.evicted?.push(...s.evicted),i.sedimented?.push(...s.sedimented)}t.step(t.fixedDt);const o=t.drainEvents();i.events&&(i.events.push(...o),t.observeKernelEvents(o,i.observations),t.observeSensorTransitions(i.observations)),s+=1,t.refreshQuiescence(t.fixedDt,e.length)}return{steps:s,budget:n}}(this.settleHost(),t,l),f=n.length+s.length+o.length>0;(h>0||f||r.length>0)&&(this.revision+=1);const p=this.result(h,n,s,o,r,a??[],void 0,u??c);return this.updateResults.record({kind:"settle",count:h},this.revision===i?[]:f?Xe:ze),p}readBodies(t=[]){return this.world.readState(t)}readSediment(){return this.sediment.snapshot()}bodyBudgetStatus(){return this.evaluateBodyBudget()}sedimentTotals(){return this.sediment.totals()}sedimentHeightfield(t={}){return be(this.readSediment(),t)}hitTest(t,e,i=0,n){return this.bodySpatialIndex.hitTest(this.world,this.revision,this.liveBodyOrder,t,e,i,n)}events(){return this.world.events()}allSleeping(){return this.world.allSleeping()}atRest(){return this.world.allSleeping()||this.quiescence.isAtRest()}hasPendingWork(){return this.queue.length>0||!this.atRest()}queueSize(){return this.queue.length}liveBodyCount(){return this.liveBodyOrder.length}elapsed(){return this.elapsedSeconds}recordObservation(t){const{timestamp:e,chartType:i,chartId:n,...s}=t,o={...s,timestamp:e??this.elapsedSeconds,chartType:i??this.observation.chartType,chartId:n??this.observation.chartId};return this.emitObservation(o),this.updateResults.record({kind:"update",count:1},["evidence"]),o}getLastUpdateResult(){return this.updateResults.last}getUpdateSnapshot(){return this.updateResults.last}subscribeUpdateResult(t){return this.updateResults.subscribe(t)}version(){return this.revision}setPaused(t){const e=this.paused!==t;this.paused=t,this.syncSimulationState(),this.updateResults.record({kind:"pause"},e?Ge:[])}setVisible(t){const e=this.visible!==t;this.visible=t,this.syncSimulationState(),this.updateResults.record({kind:"visibility"},e?Ge:[])}remove(t){const e=new Set(t),i=new Set(this.liveBodyOrder),n=new Set(this.queue.map(t=>t.id));this.queue=this.queue.filter(t=>!e.has(t.id)),this.liveBodyOrder=this.liveBodyOrder.filter(t=>!e.has(t)),this.world.remove(t),this.removeActiveSensorPairsForBodies(e);const s=t.filter(t=>i.has(t)||n.has(t));return s.length>0&&(this.revision+=1,this.syncSimulationState()),this.updateResults.record({kind:"remove",keys:s,count:s.length},s.length?Xe:[]),s}setConstraint(t){const e=this.world.setConstraint(t);return this.revision+=1,this.updateResults.record({kind:"constraint",keys:[e]},ze),e}removeConstraint(t){this.world.removeConstraint(t),this.revision+=1,this.updateResults.record({kind:"constraint",keys:[t]},ze)}applyImpulse(t,e,i){this.world.applyImpulse(t,e,i),this.revision+=1,this.updateResults.record({kind:"impulse",keys:[t]},ze)}nextRandom(){return this.world.nextRandom()}controls(){return t=this,{applyImpulse:(e,i,n)=>t.applyImpulse(e,i,n),clear:()=>t.clear(),hitTest:(e,i,n)=>t.hitTest(e,i,n),pause:()=>t.setPaused(!0),push:(e,i)=>t.enqueue(e,i),pushMany:(e,i)=>t.enqueue(e,i),bodyBudgetStatus:()=>t.bodyBudgetStatus(),readBodies:e=>t.readBodies(e),readSediment:()=>t.readSediment(),recordObservation:e=>t.recordObservation(e),remove:e=>t.remove(e),restore:e=>t.restore(e),resume:()=>t.setPaused(!1),settle:e=>t.settle(e),settleWithObservations:e=>t.settleWithObservations(e),snapshot:()=>t.snapshot(),sedimentHeightfield:e=>t.sedimentHeightfield(e),sedimentTotals:()=>t.sedimentTotals(),step:e=>t.tick(e)};var t}snapshot(){const t=this.world.snapshot();return{accumulator:this.accumulator,activeSensorPairs:Array.from(this.activeSensorPairs).sort(),bodyBudget:Oe(this.bodyBudget),config:{...this.config,kernel:Ae(t.options)},elapsedSeconds:this.elapsedSeconds,paused:this.paused,queue:this.queue.map(ke),revision:this.revision,sediment:this.readSediment(),simulationState:this.simulationState,liveBodyOrder:this.liveBodyOrder.slice(),visible:this.visible,world:t}}restore(t){this.config={bodyLimit:t.config.bodyLimit,eviction:t.config.eviction,fixedDt:t.config.fixedDt,maxDeltaSeconds:t.config.maxDeltaSeconds,maxSubsteps:t.config.maxSubsteps,settleStepLimit:t.config.settleStepLimit,timeScale:t.config.timeScale},this.configInput={...t.config,bodyBudget:Oe(t.bodyBudget??{}),kernel:Ae(t.world.options)},this.bodyBudget=Oe(t.bodyBudget??{}),this.bodyBudgetObservationKey="ok",this.quiescence.setKernelOptions(t.world.options),this.quiescence.reset(),this.activeSensorPairs=new Set(t.activeSensorPairs),this.accumulator=t.accumulator,this.elapsedSeconds=t.elapsedSeconds,this.paused=t.paused,this.queue=t.queue.map(ke).sort(qe),this.revision=t.revision,this.sediment.restore(t.sediment??[]),this.simulationState=t.simulationState??ei(t.paused,t.visible,t.queue.length>0,t.world.bodies.every(t=>t.sleeping)),this.liveBodyOrder=t.liveBodyOrder.slice(),this.visible=t.visible,this.nextSequence=this.queue.reduce((t,e)=>Math.max(t,e.sequence),-1)+1,this.world.restore(t.world),this.updateResults.record({kind:"restore"},Xe)}spawnDue(t,e){for(;this.queue.length>0&&this.elapsedSeconds>=this.queue[0].spawnAt;){const i=this.queue.shift();if(!i)return;this.spawnOne(i,e),t.push(i.id)}}spawnOne(t,e){this.liveBodyOrder=this.liveBodyOrder.filter(e=>e!==t.id),this.removeActiveSensorPairsForBodies(new Set([t.id])),this.world.spawn(t),this.liveBodyOrder.push(t.id);for(const e of t.springs??[])this.world.setConstraint({...e,bodyId:t.id});const i=this.world.readState().find(e=>e.id===t.id);this.emitObservation({type:"physics-spawn",timestamp:this.elapsedSeconds,chartType:this.observation.chartType,chartId:this.observation.chartId,bodyId:t.id,datum:i?.datum??t.datum,x:i?.x??t.x,y:i?.y??t.y},e)}result(t,e,i,n,s,o,r,a=this.evaluateBodyBudget()){this.syncSimulationState(o);const c=this.world.allSleeping();return{budget:a,elapsedSeconds:this.elapsedSeconds,evicted:i,events:s,observations:o,queueSize:this.queue.length,revision:this.revision,shouldContinue:r??(this.queue.length>0||!this.atRest()),sleeping:c,sedimented:n,spawned:e,steps:t}}observeKernelEvents(t,e){!function(t,e,i){if(0===e.length)return;const n=new Map(t.readState().map(t=>[t.id,t]));for(const t of e){if("sleep"!==t.type)continue;const e=n.get(t.bodyId);i.emit({type:"physics-settle",timestamp:i.elapsedSeconds,chartType:i.observation.chartType,chartId:i.observation.chartId,bodyId:t.bodyId,datum:e?.datum,x:e?.x,y:e?.y})}}(this.world,t,this.observationContext(e))}observeSensorTransitions(t){this.activeSensorPairs=function(t,e,i){const n=new Set(t.activeSensorPairs().map(t=>`${t.sensorId}\0${t.bodyId}`));if(0===n.size&&0===e.size)return n;const s=new Map(t.readState().map(t=>[t.id,t])),o=(t,e)=>{const{sensorId:n,bodyId:o}=Te(e),r=i.observation.sensors[n],a=s.get(o);i.emit({type:"enter"===t?r?.enterType??"physics-bin-enter":r?.exitType??"physics-bin-exit",timestamp:i.elapsedSeconds,chartType:i.observation.chartType,chartId:i.observation.chartId,bodyId:o,datum:a?.datum,x:a?.x,y:a?.y,sensorId:n,binId:r?.binId??n})};for(const t of Array.from(n).sort())e.has(t)||o("enter",t);for(const t of Array.from(e).sort())n.has(t)||o("exit",t);return n}(this.world,this.activeSensorPairs,this.observationContext(t))}removeActiveSensorPairsForBodies(t){!function(t,e){for(const i of t)e.has(Te(i).bodyId)&&t.delete(i)}(this.activeSensorPairs,t)}observationContext(t){return{elapsedSeconds:this.elapsedSeconds,observation:this.observation,emit:e=>this.emitObservation(e,t)}}emitObservation(t,e){e?.push(t),this.observation.onObservation?.(t)}evaluateBodyBudget(){return function(t){const e=Math.max(0,Math.floor(t.liveBodies)),i=Math.max(0,Math.floor(t.queuedBodies??0)),n=e+i,s=je(t.bodyLimit),o=je(t.engineMaxBodiesHint),r=function(t,e,i){if(!1===i)return;const n=je(i?.warnAt);return null!=n?n:null!=t?Math.max(1,Math.floor(.8*t)):null!=e?Math.max(1,Math.floor(.8*e)):void 0}(s,o,t.options),a=null==s?0:Math.max(0,e-s),c=a>0?"overflow":null==r||r>n?"ok":"warning";return{action:"overflow"!==c?"continue":t.sedimentEnabled?"sediment":t.evictionEnabled?"evict":"retain",bodyLimit:s,engineMaxBodiesHint:o,liveBodies:e,overflow:a,projectedBodies:n,queuedBodies:i,state:c,warnAt:r}}({bodyLimit:this.config.bodyLimit,engineMaxBodiesHint:this.world.capabilities.maxBodiesHint,evictionEnabled:!1!==this.config.eviction,liveBodies:this.liveBodyOrder.length,queuedBodies:this.queue.length,sedimentEnabled:this.sediment.isEnabled(),options:this.bodyBudget})}observeBodyBudget(t){const e=this.evaluateBodyBudget();if("ok"===e.state||!1===this.bodyBudget)return this.bodyBudgetObservationKey="ok",e;const i=`${e.state}:${e.action}`;return i===this.bodyBudgetObservationKey||(this.bodyBudgetObservationKey=i,this.emitObservation({type:"overflow"===e.state?"physics-budget-overflow":"physics-budget-warning",timestamp:this.elapsedSeconds,chartType:this.observation.chartType,chartId:this.observation.chartId,budgetAction:e.action,bodyLimit:e.bodyLimit,engineMaxBodiesHint:e.engineMaxBodiesHint,liveBodies:e.liveBodies,overflow:e.overflow,projectedBodies:e.projectedBodies,queuedBodies:e.queuedBodies,warnAt:e.warnAt},t)),e}syncSimulationState(t){const e=ei(this.paused,this.visible,this.queue.length>0,this.atRest());if(e===this.simulationState)return;const i=this.simulationState;this.simulationState=e,function(t,e,i){i.observation.onSimulationStateChange?.(e,t),"running"!==e&&"settled"!==e||i.emit({type:"running"===e?"sim-active":"sim-idle",timestamp:i.elapsedSeconds,chartType:i.observation.chartType,chartId:i.observation.chartId,simulationState:e,previousSimulationState:t})}(i,e,this.observationContext(t))}evictOverflow(t){const{evicted:e,sedimented:i,liveBodyOrder:n}=function(t,e,i,n,s,o){const r={evicted:[],sedimented:[],liveBodyOrder:s};if(!1===i)return r;const a=Math.max(0,Math.floor(n));if(!Number.isFinite(a))return r;const c=s.length-a;if(0>=c)return r;const d=function(t,e,i){if("sleeping-first"!==e)return i.slice();const n=new Map(t.readState().map(t=>[t.id,t.sleeping])),s=[],o=[];for(const t of i)n.get(t)?s.push(t):o.push(t);return[...s,...o]}(t,i,s),l=d.slice(0,c);if(0===l.length)return r;const h=function(t,e,i,n){const s=new Map(t.readState().map(t=>[t.id,t])),o=[];for(const t of i){const i=s.get(t);if(!i)continue;const r=e.add(i);r&&(o.push(t),n.emit({type:"physics-sediment",timestamp:n.elapsedSeconds,chartType:n.observation.chartType,chartId:n.observation.chartId,bodyId:t,datum:i.datum,x:i.x,y:i.y,binId:r.id,count:r.count,total:r.total}))}return o}(t,e,l,o);t.remove(l);const u=new Set(l);return{evicted:l,sedimented:h,liveBodyOrder:s.filter(t=>!u.has(t))}}(this.world,this.sediment,this.config.eviction,this.config.bodyLimit,this.liveBodyOrder,this.observationContext(t));return e.length>0&&(this.liveBodyOrder=n,this.removeActiveSensorPairsForBodies(new Set(e))),{evicted:e,sedimented:i}}};function si(t){return[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)]}function oi(t,e,i){const n=t=>t.toString(16).padStart(2,"0");return`#${n(t)}${n(e)}${n(i)}`}function ri(t){const e=t.map(si),i=e.length-1;return t=>{if(0>=t){const[t,i,n]=e[0];return oi(t,i,n)}if(t>=1){const[t,n,s]=e[i];return oi(t,n,s)}const n=t*i,s=Math.floor(n),o=n-s,[r,a,c]=e[s],[d,l,h]=e[s+1];return oi(Math.round(r+(d-r)*o),Math.round(a+(l-a)*o),Math.round(c+(h-c)*o))}}var ai=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ci=["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],di=["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],li=ri(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),hi=ri(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),ui=ri(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),fi=ri(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),pi=ri(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),mi=ri(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),yi=ri(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),gi=ri(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),bi=ri(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),xi=ri(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),vi=ri(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),wi=ri(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Si={blues:li,reds:hi,greens:ui,viridis:yi,oranges:fi,purples:pi,greys:mi,plasma:gi,inferno:bi,magma:xi,cividis:vi,turbo:wi};function Mi(t){return t&&Object.prototype.hasOwnProperty.call(Si,t)?Si[t]:li}var Ii=ri(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ki=ri(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Bi=ri(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Oi=ri(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),qi=ri(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Ai=ri(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Ci=ri(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);import{forceSimulation as Ti,forceCenter as Di,forceX as Ri,forceY as Pi,forceLink as $i,forceManyBody as ji,forceCollide as Fi}from"d3-force";import{scaleLinear as Ni}from"d3-scale";var Ei=new Set,Li=new WeakMap;function Yi(t,e){if("production"===process.env.NODE_ENV)return t;if(!t||!t.data||"object"!=typeof t.data)return t;let i=Li.get(t);if(i){const t=i.get(e);if(t)return t}else i=new Map,Li.set(t,i);const n=new Proxy(t,{get(t,i,n){if("string"==typeof i&&!(i in t)&&t.data&&i in t.data){const t=`${e}:${i}`;Ei.has(t)||(Ei.add(t),console.warn(`[Semiotic] "${e}" callback accessed "${i}" on the wrapper object, but it only exists on ".data". Use d.data.${i} (or d.data?.${i}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(t,i,n)}});return i.set(e,n),n}var Wi={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,i,n){if(0===t.length)return;const s=i.forceStrength??.1,r=n[0]/2,a=n[1]/2,c=Math.max(.1,Math.min(1,Math.min(n[0],n[1])/200)),d=Math.min(.5,.06+1.8*(1-c)),l=i.__previousPositions;let h=0;const u=[];for(const e of t){const t=null!=e.x&&null!=e.y&&(0!==e.x||0!==e.y),i=l?.get(e.id);t?h++:i?(e.x=i.x,e.y=i.y,h++):u.push(e)}const f=h>0&&.3>=(t.length>0?u.length/t.length:1);if(f){const i=new Map;for(const e of t)i.set(e.id,e);for(const t of u){const n=Xi(t.id,e,i);if(n.length>0){let e=0,i=0;for(const t of n)e+=t.x,i+=t.y;const s=zi(t.id),o=s%360*(Math.PI/180),r=(10+s%20)*c;t.x=e/n.length+r*Math.cos(o),t.y=i/n.length+r*Math.sin(o)}else{const e=zi(t.id),i=e%360*(Math.PI/180),n=(15+e%30)*c;t.x=r+n*Math.cos(i),t.y=a+n*Math.sin(i)}}}else{const e=2.399963229728653;for(let i=0;t.length>i;i++){const n=t[i];if(null==n.x||null==n.y||0===n.x&&0===n.y){const t=10*Math.sqrt(i+.5)*c,s=i*e;n.x=r+t*Math.cos(s),n.y=a+t*Math.sin(s)}}}const p=i.__skipForceSimulation||0===i.iterations?0:f?40:i.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(t.length-30)))),m=Gi(i.nodeSize,i.nodeSizeRange,t),y=t=>m(t);if(p>0){const l=new Map,h=new Map;for(const e of t)l.set(e.id,0),h.set(e.id,e);for(const t of e){const e=o(t.source),i=o(t.target);l.set(e,(l.get(e)??0)+1),l.set(i,(l.get(i)??0)+1)}const u=$i().strength(t=>{const e=t.weight,i=o(t.source),n=o(t.target),r=Math.max(1,Math.min(l.get(i)??1,l.get(n)??1));return Math.min(2.5,(e&&e>0?Math.sqrt(e):1)*s/(.1*r))}).distance(t=>{const e="string"==typeof t.source?h.get(t.source):t.source,i="string"==typeof t.target?h.get(t.target):t.target,n=(e?y(e):0)+(i?y(i):0)+Math.max(6,12*c);return Math.max(16,40*c,n)}).id(t=>t.id),m=Ti();if(void 0===i.random&&void 0===i.seed||m.randomSource(i.random??function(t){let e=t>>>0;return()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}(i.seed)),m.force("charge",ji().strength(t=>{const e=l.get(t.id)??0;return-15*c*y(t)*Math.sqrt(e+1)})).force("collide",Fi(t=>y(t)+3*c).strength(.9).iterations(2)).force("center",Di(r,a).strength(.8)).force("x",Ri(r).strength(d)).force("y",Pi(a).strength(d)).force("bounds",function(t,e,i=2,n=.6){let s=[];const o=o=>{const r=n*Math.max(o,.2);for(const n of s){const s=n.x??t[0]/2,o=n.y??t[1]/2,a=n.vx??0,c=n.vy??0,d=e(n)+i,l=Math.min(t[0]/2,d),h=Math.max(t[0]/2,t[0]-d),u=Math.min(t[1]/2,d),f=Math.max(t[1]/2,t[1]-d),p=s+a,m=o+c;l>p?n.vx=a+(l-p)*r:p>h&&(n.vx=a+(h-p)*r),u>m?n.vy=c+(u-m)*r:m>f&&(n.vy=c+(f-m)*r)}};return o.initialize=t=>{s=t},o}(n,y)),m.nodes(t),e.length>0){const t=e.map(t=>({...t,source:o(t.source),target:o(t.target)}));u.links(t),m.force("link",u)}f?m.alpha(.3):.1>m.alpha()&&m.alpha(1),m.stop();for(let t=0;p>t;++t)m.tick()}for(const e of t){if(null==e.x||null==e.y)continue;const t=y(e),i=p>0?2:0,s=Math.min(n[0]/2,t+i),o=Math.min(n[1]/2,t+i);e.x=Math.max(s,Math.min(n[0]-s,e.x)),e.y=Math.max(o,Math.min(n[1]-o,e.y)),e.x0=0,e.x1=0,e.y0=0,e.y1=0}const g=new Map;for(const e of t)g.set(e.id,e);for(const t of e){if("string"==typeof t.source){const e=g.get(t.source);e&&(t.source=e)}if("string"==typeof t.target){const e=g.get(t.target);e&&(t.target=e)}}},buildScene(t,e,i,n){const o=i.nodeStyle,r=i.edgeStyle,a=Gi(i.nodeSize,i.nodeSizeRange,t),c=Array.isArray(i.colorScheme)?i.colorScheme:i.themeCategorical&&i.themeCategorical.length>0?i.themeCategorical:ai,d=new Map;t.forEach((t,e)=>{d.set(t.id,c[e%c.length])});const l=[],h=[],u=[];for(const e of t){if(null==e.x||null==e.y)continue;const t=a(Yi(e,"nodeSize")),n=o?o(Yi(e,"nodeStyle")):{},s={fill:n.fill||d.get(e.id)||i.themeSemantic?.primary||"#007bff",stroke:n.stroke||i.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??2,opacity:n.opacity,cursor:n.cursor};l.push({type:"circle",cx:e.x,cy:e.y,r:t,style:s,datum:e,id:e.id,label:e.id})}const f=new Map;for(const e of t)f.set(e.id,e);for(const t of e){const e="object"==typeof t.source?t.source:f.get(t.source),n="object"==typeof t.target?t.target:f.get(t.target);if(!e||!n)continue;if(null==e.x||null==e.y)continue;if(null==n.x||null==n.y)continue;const s=r?r(Yi(t,"edgeStyle")):{};h.push({type:"line",x1:e.x,y1:e.y,x2:n.x,y2:n.y,style:{stroke:s.stroke||i.themeSemantic?.border||i.themeSemantic?.secondary||"#999",strokeWidth:s.strokeWidth??1,opacity:s.opacity??.6,cursor:s.cursor},datum:t})}if(!1!==i.showLabels){const e=s(i.nodeLabel);for(const i of t){if(null==i.x||null==i.y)continue;const t=e?e(i):i.id;if(!t)continue;const n=a(Yi(i,"nodeSize"));u.push({x:i.x,y:i.y-n-4,text:t+"",anchor:"middle",baseline:"auto",fontSize:11})}}return{sceneNodes:l,sceneEdges:h,labels:u}}};function Xi(t,e,i){const n=[];for(const s of e){const e=o(s.source),r=o(s.target);let a=null;if(e===t?a=r:r===t&&(a=e),a){const t=i.get(a);!t||0===t.x&&0===t.y||n.push({x:t.x,y:t.y})}}return n}function zi(t){let e=0;for(let i=0;t.length>i;i++)e=(e<<5)-e+t.charCodeAt(i)|0;return Math.abs(e)}function Gi(t,e,i){if(i.some(t=>null!=t.__forceRadius))return t=>t.__forceRadius??8;if(null==t)return()=>8;if("number"==typeof t)return()=>t;if("function"==typeof t)return e=>t(e)||8;const n=e||[5,20],s=[];for(const e of i){const i=e.data?.[t];"number"==typeof i&&s.push(i)}if(0===s.length)return()=>n[0];const[o,a]=r(s);if(o===a)return()=>(n[0]+n[1])/2;const c=Ni().domain([o,a]).range(n).clamp(!0);return e=>{const i=e.data?.[t];return null==i||"number"!=typeof i?n[0]:c(i)}}export{ai as schemeCategory10,ci as schemeTableau10,di as schemeSet3,yi as interpolateViridis,Si as SEQUENTIAL_INTERPOLATORS,Mi as getSequentialInterpolator,Ii as interpolateRdBu,ki as interpolatePiYG,Bi as interpolatePRGn,Oi as interpolateBrBG,qi as interpolateRdYlBu,Ai as interpolateRdYlGn,Ci as interpolateSpectral,jt as useCustomLayoutSelection,a as placeWithMinGap,d as packBandsBySilhouette,l as orderByBarycenter,h as refineByAdjacentSwaps,u as orderExactSmall,f as countPairwiseCrossings,se as valueAtPath,re as matchesPhysicsBodyFilter,be as sedimentHeightfield,De as collidersFromPlotBounds,Re as collidersFromXScaleBins,Le as UpdateResultTracker,ni as PhysicsPipelineStore,y as aggregateRegionCounts,g as regionCountsToProjectionRows,b as groupCompletionRows,w as processStageLayout,M as processStageRegions,I as membraneRegion,k as chargeGateRegion,B as routeSurfaceRegion,O as pressureFieldRegion,q as capacitatedRegion,A as portalRegion,C as absorbRegion,T as forceFieldRegion,D as bodyGroupSpec,R as processLaneWalls,W as processChrome,J as SYMBOL_SEQUENCE,tt as symbolPathString,et as symbolRadius,nt as symbolExtent,st as makeSymbolResolver,ot as DEFAULT_GLYPH_VIEWBOX,rt as DEFAULT_GLYPH_ANCHOR,at as glyphPlacement,ct as glyphExtent,dt as resolveGlyphPaint,lt as glyphFractionClipRect,ht as glyphHitGeometry,ut as resolveX,ft as resolveY,yt as resolveAnchoredPosition,gt as isInBounds,Tt as annotationLayout,Yi as wrapWithDataHint,Wi as forceLayoutPlugin};
|
package/dist/c-LVEY6D6B.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{StreamXYFrame_default as e}from"./c-UUKVD4WB.min.js";import{useStreamingLegend as t}from"./c-M4Y3BHFR.min.js";import{buildCustomBehaviorProps as n}from"./c-GPYOFETM.min.js";import{DEFAULT_COLORS as o,MultiPointTooltip as i,STREAMING_PALETTE as s,distinctCategories as r,getSequentialInterpolator as a,normalizeLinkedBrush as l,renderEmptyState as c,renderLoadingState as u,resolveBoundedCategoryIndex as m,resolveExplicitColor as d,resolveMultiCapableTooltip as h,resolveTooltipContent as g,useBrushSelection as p,useCategoryColors as v,useChartLegendAndMargin as f,useChartMode as y,useChartSelection as w,useGradientLegendInteraction as x,useLegendInteraction as b,useLinkedChartsActive as k,useThemeCategorical as A,wrapStyleWithSelection as _}from"./c-GIKRQI4X.min.js";var C=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},S=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const n=this.hop,o=Math.floor(e/n);for(let i=Math.floor((e-this.size)/n)+1;o>=i;i++)this.bump(i*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new C,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,o=new C;o.push(t);let i=e,s=e;const r=[],a={start:i,end:s,stats:o};for(const t of this.sessions)e-n>t.end||t.start>e+n?r.push(t):(a.stats.merge(t.stats),i>t.start&&(i=t.start),t.end>s&&(s=t.end));a.start=i,a.end=s,r.push(a),r.sort((e,t)=>e.start-t.start),this.sessions=r}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const o=t+this.size;e.push(this.row(t,o,n,o>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,n,o){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:o}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function H(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}function P(e,t,n,o=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const i=H(e,n),s=e.stddev*o;return[i-s,i+s]}var T={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},I=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function M(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;I.lastIndex=0;let n,o=0,i=0;for(;null!==(n=I.exec(t));){const e=parseFloat(n[1]),t=T[n[2]];if(null==t||!Number.isFinite(e))return null;o+=e*t,i+=n[0].length}return i!==t.length?null:o>0?o:null}var F=class{constructor(e){this.held=[],this._watermark=-1/0,this._releasedThrough=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&Math.max(this._watermark-this.lateness,this._releasedThrough)>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const o of this.held)this.getTime(o)>e?n.push(o):t.push(o);return this.held=n,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),this.markReleased(t),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),this.markReleased(e),e}markReleased(e){for(const t of e){const e=this.getTime(t);Number.isFinite(e)&&e>this._releasedThrough&&(this._releasedThrough=e)}}clear(){this.held=[],this._watermark=-1/0,this._releasedThrough=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}};import{useRef as R,useImperativeHandle as B,forwardRef as z,useCallback as N,useState as D,useEffect as L,useMemo as O}from"react";import{jsx as E,jsxs as j}from"react/jsx-runtime";var W={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},V={opacity:.7,marginRight:4};function $(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function K(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function G(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:o="x",yLabel:i="y"}=e;return e=>{const s=e?.data??null,r=$(s,t,"time"),a=$(s,n,"value");return j("div",{className:"semiotic-tooltip",style:W,children:[j("div",{children:[j("span",{style:V,children:[o,":"]}),K(r)]}),j("div",{children:[j("span",{style:V,children:[i,":"]}),K(a)]})]})}}function Y(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const o=e?.data??null,i=$(o,t,"time"),s=o?.delta??$(o,n,"value"),r=o?.cumEnd,a="number"==typeof s?0>s?K(s):"+"+K(s):K(s);return j("div",{className:"semiotic-tooltip",style:W,children:[j("div",{children:[E("span",{style:V,children:"x:"}),K(i)]}),j("div",{children:[E("span",{style:V,children:"Δ:"}),a]}),null!=r&&j("div",{children:[E("span",{style:V,children:"total:"}),K(r)]})]})}}function U(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const o=e?.data??null;if(null==o?.binStart||null==o?.binEnd){const e=$(o,t,"time"),i=$(o,n,"value");return j("div",{className:"semiotic-tooltip",style:W,children:[j("div",{children:[E("span",{style:V,children:"x:"}),K(e)]}),j("div",{children:[E("span",{style:V,children:"y:"}),K(i)]})]})}return j("div",{className:"semiotic-tooltip",style:W,children:[j("div",{children:[E("span",{style:V,children:"range:"}),K(o.binStart),"–",K(o.binEnd)]}),null!=o.total&&j("div",{children:[E("span",{style:V,children:"count:"}),K(o.total)]}),null!=o.category&&j("div",{children:[E("span",{style:V,children:"category:"}),K(o.category)]})]})}}function X(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:o="x",yLabel:i="y"}=e;return e=>{const s=e?.data??null,r=s?.xCenter??$(s,t,"time"),a=s?.yCenter??$(s,n,"value"),l=s?.count,c=s?.sum,u=s?.value,m=s?.agg??"count";return j("div",{className:"semiotic-tooltip",style:W,children:[j("div",{children:[j("span",{style:V,children:[o,":"]}),K(r)]}),j("div",{children:[j("span",{style:V,children:[i,":"]}),K(a)]}),null!=l&&j("div",{children:[E("span",{style:V,children:"count:"}),K(l)]}),"sum"===m&&null!=c&&j("div",{children:[E("span",{style:V,children:"sum:"}),K(c)]}),"mean"===m&&null!=u&&j("div",{children:[E("span",{style:V,children:"mean:"}),K(u)]})]})}}function q(e,t){return null!=e?e:Math.max(t?.length??0,200)}var Q="time",J="value",Z="__aggLower",ee="__aggUpper",te="__aggPartial",ne="count",oe="__aggStart",ie="__aggEnd";function se(e,t){const n=t.stat??"mean",o=t.band??"none",i=t.sigma??1;return e.emit().map(e=>{const t={[Q]:(e.start+e.end)/2,[J]:H(e,n),[ne]:e.count,[te]:e.partial,[oe]:e.start,[ie]:e.end},s=P(e,o,n,i);return s&&(t[Z]=s[0],t[ee]=s[1]),t})}import*as re from"react";function ae(e){return y(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,showAxes:e.showAxes,showLegend:e.showLegend,enableHover:null==e.enableHover?void 0:!!e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules})}function le(e,t){re.useImperativeHandle(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,n)=>t.current?.update(e,n)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t])}var ce=()=>({});function ue(e,t,n){const o=t.find(Boolean)??null;return re.useMemo(()=>o?_(e??ce,o,n):e,[o,e,n])}function me(e,t,n){return{title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,legendHoverBehavior:t.onLegendHover,legendClickBehavior:t.onLegendClick,legendHighlightedCategory:t.highlightedCategory,legendIsolatedCategories:"isolate"===n?t.isolatedCategories:void 0}}import{jsx as de}from"react/jsx-runtime";function he(e,t,n){const o="function"==typeof t?t(e):e[(t??n)+""];if(null==o)return null;if(o instanceof Date)return o.getTime();const i=Number(o);return Number.isFinite(i)?i:null}var ge=z(function(t,o){const s=ae(t),{size:r,margin:a,className:l,arrowOfTime:m="right",windowMode:d="sliding",windowSize:g,data:p,timeAccessor:v,valueAccessor:y,timeExtent:x,valueExtent:k,extentPadding:A,stroke:_="#007bff",strokeWidth:C=2,strokeDasharray:H,opacity:P,cursor:T,background:I,tooltipContent:z,tooltip:E,onHover:j,annotations:W,autoPlaceAnnotations:V,svgAnnotationRules:$,tickFormatTime:K,tickFormatValue:Y,decay:U,pulse:X,staleness:te,transition:ne,linkedHover:oe,selection:ie,onObservation:re,chartId:le,loading:ce,loadingContent:ue,emptyContent:ge,emphasis:pe,legendPosition:ve,aggregate:fe,eventTime:ye}=t,we=s.showAxes,xe=s.enableHover,be=r??[s.width,s.height],ke="string"==typeof y?y:"Value",Ae=O(()=>{if(s.showLegend)return{legendGroups:[{label:"Series",type:"line",items:[{label:ke,color:_}],styleFn:e=>({stroke:e.color||"var(--semiotic-primary, #007bff)",strokeWidth:C??2})}]}},[s.showLegend,ke,_,C]),_e=b(t.legendInteraction,()=>ke,[ke]),{legend:Ce,margin:Se,legendPosition:He}=f({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:ve,userMargin:a,defaults:s.marginDefaults,additionalLegend:Ae,chartWidth:be[0],chartHeight:be[1],axisChrome:{hasAxis:!1!==s.showAxes}}),Pe=G({timeAccessor:v,valueAccessor:y}),Te=i(),Ie=h({tooltip:E,defaultTooltipContent:Pe,customFunctionContext:"hover",multiDefaultContent:e=>Te({...e,allSeries:Array.isArray(e.allSeries)?e.allSeries.map(e=>({...e,group:e.group||("string"==typeof y?y:"value")})):e.allSeries})}),Me=z??Ie.tooltipContent,Fe=R(null),{customHoverBehavior:Re,customClickBehavior:Be}=w({selection:ie,linkedHover:oe,unwrapData:!0,onObservation:re,chartType:"RealtimeLineChart",chartId:le,mobileInteraction:s.mobileInteraction}),ze=N(e=>{j&&j(e),Re(e)},[j,Re]),Ne=null!=fe,[De,Le]=D([]),Oe=R(null),Ee=R(fe);Ee.current=fe;const je=R(Ne);je.current=Ne;const We=R(De);We.current=De;const Ve=R({timeAccessor:v,valueAccessor:y});Ve.current={timeAccessor:v,valueAccessor:y},L(()=>{if(!Ne)return void(Oe.current=null);const e=Ee.current,t=function(e){const t=e.window??"tumbling",n=M("session"===t?e.gap??e.size:e.size);if(null==n)return null;const o=null!=e.hop?M(e.hop):void 0,i=null!=e.gap?M(e.gap):void 0;return new S({window:t,size:n,hop:o??void 0,gap:i??void 0,retain:e.retain})}(e);if(Oe.current=t,t&&p){const{timeAccessor:e,valueAccessor:n}=Ve.current;for(const o of p){const i=he(o,e,"time"),s=he(o,n,"value");null!=i&&null!=s&&t.push(i,s)}}Le(t?se(t,e):[])},[Ne?[fe.window??"tumbling",fe.size,fe.hop??"",fe.gap??"",fe.retain??""].join("|"):"",Ne,p,v,y]),L(()=>{Ne&&Oe.current&&Le(se(Oe.current,Ee.current))},[fe?.stat,fe?.band,fe?.sigma]);const $e=N(e=>{const t=Oe.current,n=Ee.current;if(!t||!n)return;const{timeAccessor:o,valueAccessor:i}=Ve.current;for(const n of e){const e=he(n,o,"time"),s=he(n,i,"value");null!=e&&null!=s&&t.push(e,s)}Le(se(t,n))},[]),Ke=null!=ye,Ge=R(null),Ye=R(ye);Ye.current=ye;const Ue=R(Ke);Ue.current=Ke;const Xe=R(re);Xe.current=re;const qe=R(le);qe.current=le;const Qe=Ke?`${ye.lateness}|${ye.latePolicy??"drop"}`:"",Je=N(e=>{0!==e.length&&(je.current?$e(e):Fe.current?.pushMany(e))},[$e]);L(()=>{const e=Ge.current;if(e&&Je(e.flush()),!Ke)return void(Ge.current=null);const t=v;Ge.current=function(e){const n=M(e.lateness);return null==n?null:new F({lateness:n,getTime:e=>he(e,t,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(Ye.current)},[Qe,Ke,Je,v]);const Ze=N(e=>{const t=Ge.current;if(!Ue.current||!t)return void Je(e);const n=[];for(const o of e){const e=t.push(o);if(e.released.length&&n.push(...e.released),e.late.length){const n=Xe.current;if(n){const{timeAccessor:o}=Ve.current,i=Ye.current?.latePolicy??"drop";for(const s of e.late)n({type:"late-data",datum:s,eventTime:he(s,o,"time")??NaN,watermark:t.watermark,policy:i,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:qe.current})}}}Je(n)},[Je]),et=N(()=>{const e=Ge.current;Ue.current&&e&&Je(e.flush())},[Je]);B(o,()=>({push:e=>Ze([e]),pushMany:e=>Ze(e),flush:et,remove:e=>je.current?[]:Fe.current?.remove(e)??[],update:(e,t)=>je.current?[]:Fe.current?.update(e,t)??[],clear:()=>{Ge.current?.clear(),je.current?(Oe.current?.clear(),Le([])):Fe.current?.clear()},getData:()=>je.current?We.current:Fe.current?.getData()??[],getScales:()=>Fe.current?.getScales()??null}),[et,Ze]);const tt=u(ce,be[0],be[1],ue),nt=tt?null:c(Ne?void 0:p,be[0],be[1],ge),ot={stroke:_,strokeWidth:C,strokeDasharray:H};null!=P&&(ot.opacity=P),null!=T&&(ot.cursor=T);const it=q(g,p),st=pe?`${l||""} semiotic-emphasis-${pe}`.trim():l,rt=Ne?De:p,at=Ne?Q:v,lt=Ne?J:y,ct=Ne?"growing":d,ut=Ne?Math.max(1,fe?.retain??Math.max(De.length,600)):it,mt=Ne&&fe&&"none"!==(fe.band??"none")?{y0Accessor:Z,y1Accessor:ee,perSeries:!1}:void 0;return tt||nt||de(e,{ref:Fe,chartType:"line",runtimeMode:"streaming",size:be,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:Se,className:st,...me(s,_e,t.legendInteraction),arrowOfTime:m,windowMode:ct,windowSize:ut,data:rt,timeAccessor:at,valueAccessor:lt,xExtent:x,yExtent:k,extentPadding:A,band:mt,lineStyle:ot,showAxes:we,background:I,hoverAnnotation:xe,tooltipContent:Me,tooltipMode:Ie.tooltipMode,...n({linkedHover:oe,selection:ie,onObservation:re,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ze,customClickBehavior:Be}),annotations:W,legend:Ce,legendPosition:He,autoPlaceAnnotations:V,svgAnnotationRules:$,tickFormatTime:K,tickFormatValue:Y,decay:U,pulse:X,staleness:te,transition:ne,pointIdAccessor:t.pointIdAccessor})});ge.displayName="RealtimeLineChart";import{useRef as pe,forwardRef as ve,useCallback as fe,useMemo as ye}from"react";function we(e,t,n){const o="function"==typeof t?t(e):e[t??n];if(null==o)return null;if(o instanceof Date)return o.getTime();if("string"==typeof o&&""===o.trim())return null;const i=Number(o);return Number.isFinite(i)?i:null}import{useEffect as xe,useLayoutEffect as be,useMemo as ke,useRef as Ae}from"react";var _e=Symbol("realtime-function-category-domain"),Ce="undefined"==typeof window?xe:be;function Se({enabled:e,categories:t,colors:n,fallbackColor:i,order:r="discovery",domainKey:a}){const l=v(),c=k(),u=A(),h="function"==typeof a?_e:a,g=Ae(null),p=ke(()=>{const e=g.current,o=e&&Object.is(e.domainKey,h)?new Map(e.indexes):new Map,i=new Set(t),s="explicit-then-alpha"===r?[...Object.keys(n??{}).filter(e=>i.has(e)),...t.filter(e=>!Object.prototype.hasOwnProperty.call(n??{},e)).sort()]:t;for(const e of s)m(o,e);return{domainKey:h,indexes:o}},[t,n,r,h]);Ce(()=>{g.current=p},[p]);const f=p.indexes,y=ke(()=>{if(!e)return;const t=u&&u.length>0?u:c?o:s;return e=>{const o=m(f,e),s=l?d(l,e):void 0;if(s)return s;return(n?d(n,e):void 0)||i||t[o%t.length]}},[f,n,e,i,c,l,u]),w=ke(()=>{if(!e||!y)return n;const o=Object.keys(n??{}),i=new Set(o),s=t.filter(e=>!i.has(e));"explicit-then-alpha"===r&&s.sort();const a=[...o,...s];if(0===a.length)return;const l=new Set(t),c=[];for(const e of a){if(l.has(e)){c.push([e,y(e)]);continue}const t=n?d(n,e):void 0;t&&c.push([e,t])}return c.length>0?Object.fromEntries(c):void 0},[t,y,n,e,r]);return{colorScale:y,colorMap:w}}import{jsx as He}from"react/jsx-runtime";var Pe=[],Te=ve(function(o,i){const s=ae(o),{binSize:a,size:m,margin:d,className:h,arrowOfTime:v="right",windowMode:y="sliding",windowSize:x,data:k,timeAccessor:A,valueAccessor:_,direction:C="up",timeExtent:S,valueExtent:H,extentPadding:P,categoryAccessor:T,colors:I,fill:M,stroke:F,strokeWidth:R,opacity:B,cursor:z,gap:N,background:D,tooltipContent:L,tooltip:O,onHover:E,annotations:j,autoPlaceAnnotations:W,svgAnnotationRules:V,tickFormatTime:$,tickFormatValue:K,linkedHover:G,selection:Y,decay:X,pulse:Q,staleness:J,transition:Z,onObservation:ee,chartId:te,loading:ne,loadingContent:oe,emptyContent:ie,emphasis:se,legendPosition:re,legend:ce,brush:de,onBrush:he,linkedBrush:ge}=o,ve=s.showAxes,xe=s.enableHover,be=m??[s.width,s.height],ke=t({isPushMode:void 0===k,colorBy:T,colorScheme:I,showLegend:!1,legendPosition:re,trackCategoryDomain:!1!==s.showLegend,registerLinkedCategories:!1}),Ae=ye(()=>r(k??[],T),[k,T]),_e=void 0===k?ke.categories:Ae,{colorScale:Ce,colorMap:Te}=Se({enabled:!!T,categories:_e,colors:I,fallbackColor:M,order:"explicit-then-alpha",domainKey:T}),Ie=ye(()=>{if(!Te)return _e;const e=new Set(_e);return Object.keys(Te).filter(t=>e.has(t))},[_e,Te]),Me=fe(e=>null!=e.category?e.category+"":("function"==typeof T?T(e):T?e[T]:"")+"",[T]),{legend:Fe,margin:Re,legendPosition:Be,hasAutomaticLegend:ze}=f({data:Pe,colorBy:T,colorScale:Ce,showLegend:s.showLegend,legendPosition:re,userMargin:d,defaults:s.marginDefaults,categories:Ie,additionalLegend:ce,chartWidth:be[0],chartHeight:be[1],axisChrome:{hasAxis:!1!==s.showAxes}}),Ne=b(o.legendInteraction,T?Me:void 0,Ie,ze,!0),De=L??g({tooltip:O,defaultTooltipContent:U({timeAccessor:A,valueAccessor:_}),customFunctionContext:"hover"}).tooltipContent,Le=pe(null),{activeSelectionHook:Oe,hoverSelectionHook:Ee,customHoverBehavior:je,customClickBehavior:We}=w({selection:Y,linkedHover:G,unwrapData:!0,onObservation:ee,chartType:"RealtimeHistogram",chartId:te,mobileInteraction:s.mobileInteraction}),Ve=fe(e=>{E&&E(e),je(e)},[E,je]),$e=!0===de?{dimension:"x",snap:"bin"}:"x"===de?{dimension:"x"}:"object"==typeof de?de:void 0,Ke=l(ge),Ge="string"==typeof A?A:"time",Ye=p({name:Ke?.name||"__unused_hist_brush__",xField:Ke?.xField||Ge,...Ke?.yField?{yField:Ke.yField}:{}}),Ue=pe(Ye.brushInteraction);Ue.current=Ye.brushInteraction;const Xe=fe(e=>{if(he&&he(e),ee&&ee(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:te}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:te}),Ke){const t=Ue.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[he,ee,te,Ke]);le(i,Le);const qe=u(ne,be[0],be[1],oe),Qe=qe?null:c(k,be[0],be[1],ie),Je={};null!=M&&(Je.fill=M),null!=F&&(Je.stroke=F),null!=R&&(Je.strokeWidth=R),null!=B&&(Je.opacity=B),null!=z&&(Je.cursor=z),null!=N&&(Je.gap=N);const Ze=ue(ye(()=>{if(T&&Ce)return e=>null==e.category?{}:{fill:Ce(e.category+"")}},[T,Ce]),[Ee||Ne.legendSelectionHook||Oe],Y),et=se?`${h||""} semiotic-emphasis-${se}`.trim():h,tt=q(x,k),nt=ye(()=>"down"!==C?H:function({data:e,valueAccessor:t,timeAccessor:n,binSize:o,valueExtent:i,extentPadding:s}){if(i)return[i[1],i[0]];if(!e||0===e.length)return;const r=new Map;for(const i of e){const e=we(i,n,"time"),s=we(i,t,"value");if(null==e||null==s)continue;const a=Math.floor(e/o)*o;r.set(a,(r.get(a)??0)+s)}let a=0;for(const e of r.values())a=Math.max(a,e);return[a>0?a+a*(s??.1):1,0]}({data:k,valueAccessor:_,timeAccessor:A,binSize:a,valueExtent:H,extentPadding:P}),[C,k,_,A,a,H,P]);return qe||Qe||He(e,{ref:Le,chartType:"bar",runtimeMode:"streaming",size:be,maxDevicePixelRatio:o.maxDevicePixelRatio,margin:Re,className:et,...me(s,Ne,o.legendInteraction),arrowOfTime:v,windowMode:y,windowSize:tt,data:k,timeAccessor:A,valueAccessor:_,xExtent:S,yExtent:nt,extentPadding:P,binSize:a,categoryAccessor:T,barColors:Te,barStyle:Je,areaStyle:Ze,showAxes:ve,background:D,hoverAnnotation:xe,tooltipContent:De,...n({linkedHover:G,selection:Y,onObservation:ee,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:Ve,customClickBehavior:We}),annotations:j,autoPlaceAnnotations:W,svgAnnotationRules:V,tickFormatTime:$,tickFormatValue:K,decay:X,pulse:Q,staleness:J,transition:Z,pointIdAccessor:o.pointIdAccessor,legend:Fe,legendPosition:Be,...ke.categoryDomainProps,brush:$e||(ge?{dimension:"x"}:void 0),onBrush:$e||ge?Xe:void 0})});function Ie(e){return He(Te,{...e,windowMode:"growing"})}Te.displayName="RealtimeHistogram",Ie.displayName="TemporalHistogram";var Me=Te;import{useRef as Fe,forwardRef as Re,useCallback as Be,useMemo as ze}from"react";import{jsx as Ne}from"react/jsx-runtime";var De=[],Le=Re(function(o,i){const s=ae(o),{size:a,margin:l,className:m,arrowOfTime:d="right",windowMode:h="sliding",windowSize:p,data:v,timeAccessor:y,valueAccessor:x,timeExtent:k,valueExtent:A,yScaleType:_,extentPadding:C,decay:S,pulse:H,staleness:P,transition:T,categoryAccessor:I,colors:M,radius:F,fill:R,opacity:B,stroke:z,strokeWidth:N,cursor:D,pointStyle:L,background:O,tooltipContent:E,tooltip:j,onHover:W,annotations:V,autoPlaceAnnotations:$,svgAnnotationRules:K,tickFormatTime:Y,tickFormatValue:U,linkedHover:X,selection:Q,onObservation:J,chartId:Z,loading:ee,loadingContent:te,emptyContent:ne,emphasis:oe,legendPosition:ie}=o,se=s.showAxes,re=s.enableHover,ce=!0===s.showLegend,de=a??[s.width,s.height],he=t({isPushMode:void 0===v,colorBy:I,colorScheme:M,showLegend:!1,legendPosition:ie,trackCategoryDomain:ce,registerLinkedCategories:!1}),ge=ze(()=>r(v??[],I),[v,I]),pe=void 0===v?he.categories:ge,{colorScale:ve}=Se({enabled:!!I,categories:pe,colors:M,fallbackColor:R,domainKey:I}),{legend:fe,margin:ye,legendPosition:we,hasAutomaticLegend:xe}=f({data:De,colorBy:I,colorScale:ve,showLegend:ce,legendPosition:ie,userMargin:l,defaults:s.marginDefaults,categories:pe,chartWidth:de[0],chartHeight:de[1],axisChrome:{hasAxis:!1!==s.showAxes}}),be=b(o.legendInteraction,I,pe,xe,!0),ke=E??g({tooltip:j,defaultTooltipContent:G({timeAccessor:y,valueAccessor:x}),customFunctionContext:"hover"}).tooltipContent,Ae=Fe(null),{activeSelectionHook:_e,hoverSelectionHook:Ce,customHoverBehavior:He,customClickBehavior:Pe}=w({selection:Q,linkedHover:X,unwrapData:!0,onObservation:J,chartType:"RealtimeSwarmChart",chartId:Z,mobileInteraction:s.mobileInteraction}),Te=Be(e=>{W&&W(e),He(e)},[W,He]);le(i,Ae);const Ie=u(ee,de[0],de[1],te),Me=Ie?null:c(v,de[0],de[1],ne),Re={};null!=F&&(Re.radius=F),null!=R&&(Re.fill=R),null!=B&&(Re.opacity=B),null!=z&&(Re.stroke=z),null!=N&&(Re.strokeWidth=N),null!=D&&(Re.cursor=D);const Le=L,Oe=ue(ze(()=>{if(I||Le)return e=>{const t="function"==typeof I?I(e):I?e[I]:void 0;return{...I&&ve?{fill:ve(t+"")}:void 0,...Le?.(e)}}},[I,ve,Le]),[Ce||be.legendSelectionHook||_e],Q),Ee=oe?`${m||""} semiotic-emphasis-${oe}`.trim():m,je=q(p,v);return Ie||Me||Ne(e,{ref:Ae,chartType:"swarm",runtimeMode:"streaming",size:de,maxDevicePixelRatio:o.maxDevicePixelRatio,margin:ye,className:Ee,...me(s,be,o.legendInteraction),arrowOfTime:d,windowMode:h,windowSize:je,data:v,timeAccessor:y,valueAccessor:x,xExtent:k,yExtent:A,yScaleType:_,extentPadding:C,decay:S,pulse:H,staleness:P,transition:T,categoryAccessor:I,swarmStyle:Re,pointStyle:Oe,showAxes:se,background:O,hoverAnnotation:re,tooltipContent:ke,...n({linkedHover:X,selection:Q,onObservation:J,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:Te,customClickBehavior:Pe}),annotations:V,autoPlaceAnnotations:$,svgAnnotationRules:K,tickFormatTime:Y,tickFormatValue:U,legend:fe,legendPosition:we,...he.categoryDomainProps,pointIdAccessor:o.pointIdAccessor})});Le.displayName="RealtimeSwarmChart";import{useRef as Oe,forwardRef as Ee,useCallback as je,useMemo as We}from"react";import{jsx as Ve}from"react/jsx-runtime";var $e=Ee(function(t,o){const i=ae(t),{size:s,margin:r,className:a,arrowOfTime:l="right",windowMode:m="sliding",windowSize:d,data:h,timeAccessor:p,valueAccessor:v,timeExtent:y,valueExtent:x,extentPadding:k,decay:A,pulse:_,staleness:C,transition:S,positiveColor:H,negativeColor:P,connectorStroke:T,connectorWidth:I,gap:M,stroke:F,strokeWidth:R,opacity:B,cursor:z,background:N,tooltipContent:D,tooltip:L,onHover:O,annotations:E,autoPlaceAnnotations:j,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,linkedHover:K,selection:G,onObservation:U,chartId:X,loading:Q,loadingContent:J,emptyContent:Z,emphasis:ee,legendPosition:te}=t,ne=i.showAxes,oe=i.enableHover,ie=s??[i.width,i.height],se=We(()=>{if(i.showLegend)return{legendGroups:[{label:"Change",type:"fill",items:[{label:"Positive",color:H},{label:"Negative",color:P}],styleFn:e=>({fill:e.color||("Positive"===e.label?"var(--semiotic-success, #28a745)":"var(--semiotic-danger, #dc3545)")})}]}},[P,H,i.showLegend]),re=je(e=>{const t=e.delta??("function"==typeof v?v(e):e[v??"value"]);return 0>Number(t)?"Negative":"Positive"},[v]),ce=b(t.legendInteraction,re,["Positive","Negative"]),{legend:de,margin:he,legendPosition:ge}=f({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:te,userMargin:r,defaults:i.marginDefaults,additionalLegend:se,chartWidth:ie[0],chartHeight:ie[1],axisChrome:{hasAxis:!1!==i.showAxes}}),pe=D??g({tooltip:L,defaultTooltipContent:Y({timeAccessor:p,valueAccessor:v}),customFunctionContext:"hover"}).tooltipContent,ve=Oe(null),{activeSelectionHook:fe,hoverSelectionHook:ye,customHoverBehavior:we,customClickBehavior:xe}=w({selection:G,linkedHover:K,unwrapData:!0,onObservation:U,chartType:"RealtimeWaterfallChart",chartId:X,mobileInteraction:i.mobileInteraction}),be=je(e=>{O&&O(e),we(e)},[O,we]);le(o,ve);const ke=u(Q,ie[0],ie[1],J),Ae=ke?null:c(h,ie[0],ie[1],Z),_e={};null!=H&&(_e.positiveColor=H),null!=P&&(_e.negativeColor=P),null!=T&&(_e.connectorStroke=T),null!=I&&(_e.connectorWidth=I),null!=M&&(_e.gap=M),null!=F&&(_e.stroke=F),null!=R&&(_e.strokeWidth=R),null!=B&&(_e.opacity=B),null!=z&&(_e.cursor=z);const Ce=ue(void 0,[ye||ce.legendSelectionHook||fe],G),Se=ee?`${a||""} semiotic-emphasis-${ee}`.trim():a,He=q(d,h);return ke||Ae||Ve(e,{ref:ve,chartType:"waterfall",runtimeMode:"streaming",size:ie,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:he,className:Se,...me(i,ce,t.legendInteraction),arrowOfTime:l,windowMode:m,windowSize:He,data:h,timeAccessor:p,valueAccessor:v,xExtent:y,yExtent:x,extentPadding:k,decay:A,pulse:_,staleness:C,transition:S,waterfallStyle:_e,areaStyle:Ce,showAxes:ne,background:N,hoverAnnotation:oe,tooltipContent:pe,...n({linkedHover:K,selection:G,onObservation:U,forceHoverBehavior:!0,mobileInteraction:i.mobileInteraction,customHoverBehavior:be,customClickBehavior:xe}),annotations:E,autoPlaceAnnotations:j,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,legend:de,legendPosition:ge,pointIdAccessor:t.pointIdAccessor})});$e.displayName="RealtimeWaterfallChart";import{useRef as Ke,forwardRef as Ge,useCallback as Ye,useMemo as Ue,useState as Xe}from"react";import{jsx as qe}from"react/jsx-runtime";var Qe=Ge(function(t,o){const i=ae(t),{size:s,margin:r,className:l,arrowOfTime:m="right",windowMode:d="sliding",windowSize:h,data:p,timeAccessor:v,valueAccessor:y,categoryAccessor:b,timeExtent:k,valueExtent:A,extentPadding:_,heatmapXBins:C=20,heatmapYBins:S=20,aggregation:H="count",colorScheme:P,customColorScale:T,cursor:I,background:M,tooltipContent:F,tooltip:R,onHover:B,annotations:z,autoPlaceAnnotations:N,svgAnnotationRules:D,tickFormatTime:L,tickFormatValue:O,decay:E,pulse:j,staleness:W,linkedHover:V,selection:$,onObservation:K,chartId:G,loading:Y,loadingContent:U,emptyContent:Q,emphasis:J,legendPosition:Z}=t,ee=i.showAxes,te=i.enableHover,ne=s??[i.width,i.height],[oe,ie]=Xe(null),se=Ue(()=>oe??[0,1],[oe]),re=Ue(()=>{if("custom"===P&&T)return T;const e=a(P||"blues");return t=>e(Math.max(0,Math.min(1,(t-se[0])/(se[1]-se[0]||1))))},[P,T,se]),ce=x(t.legendInteraction,e=>Number(e.value),se),de=Ue(()=>{if(i.showLegend)return{gradient:{colorFn:re,domain:se,label:H}}},[H,re,i.showLegend,se]),{legend:he,margin:ge,legendPosition:pe}=f({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:Z,userMargin:r,defaults:i.marginDefaults,additionalLegend:de,chartWidth:ne[0],chartHeight:ne[1],axisChrome:{hasAxis:!1!==i.showAxes}}),ve=F??g({tooltip:R,defaultTooltipContent:X({timeAccessor:v,valueAccessor:y}),customFunctionContext:"hover"}).tooltipContent,fe=Ke(null),{activeSelectionHook:ye,hoverSelectionHook:we,customHoverBehavior:xe,customClickBehavior:be}=w({selection:$,linkedHover:V,unwrapData:!0,onObservation:K,chartType:"RealtimeHeatmap",chartId:G,mobileInteraction:i.mobileInteraction}),ke=Ye(e=>{B&&B(e),xe(e)},[B,xe]);le(o,fe);const Ae=u(Y,ne[0],ne[1],U),_e=Ae?null:c(p,ne[0],ne[1],Q),Ce=J?`${l||""} semiotic-emphasis-${J}`.trim():l,Se=q(h,p),He=ue(Ue(()=>{if(null==I)return;const e={cursor:I};return()=>e},[I]),[we,ce.legendSelectionHook,ye],$);return Ae||_e||qe(e,{ref:fe,chartType:"heatmap",runtimeMode:"streaming",size:ne,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:ge,className:Ce,...me(i,ce,t.legendInteraction),arrowOfTime:m,windowMode:d,windowSize:Se,data:p,timeAccessor:v,valueAccessor:y,categoryAccessor:b,xExtent:k,yExtent:A,extentPadding:_,heatmapXBins:C,heatmapYBins:S,heatmapAggregation:H,colorScheme:"custom"!==P?P:void 0,heatmapColorScale:"custom"===P&&"function"==typeof T?T:void 0,onColorDomainChange:ie,areaStyle:He,showAxes:ee,background:M,hoverAnnotation:te,tooltipContent:ve,...n({linkedHover:V,selection:$,onObservation:K,forceHoverBehavior:!0,mobileInteraction:i.mobileInteraction,customHoverBehavior:ke,customClickBehavior:be}),annotations:z,autoPlaceAnnotations:N,svgAnnotationRules:D,tickFormatTime:L,tickFormatValue:O,decay:E,pulse:j,staleness:W,legend:he,legendPosition:pe,pointIdAccessor:t.pointIdAccessor})});Qe.displayName="RealtimeHeatmap";export{C as RunningStats,S as WindowAccumulator,H as statValue,P as bandBounds,M as parseWindowDuration,F as ReorderBuffer,ge as RealtimeLineChart,Te as RealtimeHistogram,Ie as TemporalHistogram,Me as RealtimeTemporalHistogram,Le as RealtimeSwarmChart,$e as RealtimeWaterfallChart,Qe as RealtimeHeatmap};
|
package/dist/c-M4Y3BHFR.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{STREAMING_PALETTE as e,createColorScale as r,createLegend as o,getColor as t,resolveExplicitColor as n,useCategoryColors as i,useLinkedChartCategories as a,useLinkedChartCategoryRegistryActive as s,useThemeCategorical as c}from"./c-GIKRQI4X.min.js";import{useState as g,useCallback as d,useMemo as l}from"react";var f=Symbol("streaming-function-color-domain");function y({isPushMode:y,colorBy:m,colorScheme:u,showLegend:h,legendPosition:p="right",trackCategoryDomain:C=!0,registerLinkedCategories:S=!0}){const[w,A]=g(0),P=i(),b=c(),v=s(),j=y&&!!m&&(C||v),D="function"==typeof m?f:m,M=l(()=>({lifecycle:{colorByDomainKey:D,isPushMode:y,shouldTrackCategoryDomain:j},categories:new Set,ordered:[]}),[D,y,j]),k=d(e=>m?("function"==typeof m?m(e):e[m])+"":null,[m]),B=d(e=>{if(!j)return;let r=!1;for(const o of e){if(!o||"object"!=typeof o)continue;const e=k(o);null==e||M.categories.has(e)||(M.categories.add(e),M.ordered.push(e),r=!0)}r&&A(e=>e+1)},[M,k,j]),L=d(e=>{if(!j)return;const r=Array.from(new Set(e.map(String))),o=M.ordered;o.length===r.length&&o.every((e,o)=>e===r[o])||(M.categories=new Set(r),M.ordered=r,A(e=>e+1))},[M,j]),I=d(e=>r=>{B([r]),e(r)},[B]),K=d(e=>r=>{B(r),e(r)},[B]),_=d(()=>{M.categories=new Set,M.ordered=[],A(e=>e+1)},[M]),x=l(()=>j?[...M.ordered]:[],[M,j,w]);a(S&&y&&m?x:[]);const G=l(()=>{if(!y||!m||!1===h)return;const i=M.ordered;if(0===i.length)return;const a=Array.isArray(u)&&u.length>0||"string"==typeof u&&u.length>0?u:b&&b.length>0?b:e,s="string"==typeof m?m:"__streamCat",c=i.map(e=>({[s]:e})),g=r(c,s,a),d=u&&"object"==typeof u&&!Array.isArray(u)?u:void 0;return o({data:c,colorBy:s,colorScale:e=>(P?n(P,e):void 0)??(d?n(d,e):void 0)??g(e)??"#999",getColor:t})},[y,m,h,u,P,b,w,M]),Q=l(()=>{if(G)return"right"===p?{right:110}:"left"===p?{left:110}:"top"===p?{top:50}:"bottom"===p?{bottom:80}:{right:110}},[G,p]);return{wrapPush:I,wrapPushMany:K,resetCategories:_,categories:x,categoryDomainProps:j?{legendCategoryAccessor:m,onCategoriesChange:L}:{},streamingLegend:G,streamingMarginAdjust:Q}}export{y as useStreamingLegend};
|
package/dist/c-MAIICR2Z.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{darkenColor as t,lightenColor as n}from"./c-X5UBGU2V.min.js";import{confidenceZScore as o,fitLinearForForecast as e,forecastIntervalStats as r,getMax as a,getMinMax as s}from"./c-WJCD5EUY.min.js";var i="__forecastSegment",l="__forecastOpacity";function c(t,n,o,e){const r=n.uncertaintyOpacity,a=n.confidenceAccessor;if(!r&&!a)return;const i="object"==typeof r?r:{},c=i.min??.15,f=i.max??1;if(a){const n="function"==typeof a?a:t=>t[a];for(const o of t){const t=n(o);null!=t&&Number.isFinite(t)&&(o[l]=c+Math.max(0,Math.min(1,t))*(f-c))}return}const p=t.map(t=>{const n=o(t),r=e(t);return null!=n&&null!=r&&Number.isFinite(n)&&Number.isFinite(r)?Math.abs(n-r):NaN}),u=p.filter(t=>Number.isFinite(t));if(0===u.length)return;const[h,y]=s(u),d=y-h;t.forEach((t,n)=>{const o=p[n];Number.isFinite(o)&&(t[l]=f-(d>0?(o-h)/d:0)*(f-c))})}function f(t,n){return"function"==typeof n?n(t):!!t[n]}function p(t){return[{type:"anomaly-band",threshold:t.threshold??2,showBand:!1!==t.showBand,fill:t.bandColor||"#6366f1",fillOpacity:t.bandOpacity??.1,anomalyColor:t.anomalyColor||"#ef4444",anomalyRadius:t.anomalyRadius??6,label:t.label}]}function u(t,n,s,l,p){return(u=l).isTraining||u.isForecast||u.isAnomaly||u.upperBounds||u.lowerBounds?function(t,n,o,e,r){const{isTraining:a,isForecast:s,isAnomaly:l,upperBounds:p,lowerBounds:u,color:h="#6366f1",bandOpacity:y=.15,anomalyColor:d="#ef4444",anomalyRadius:m=6,label:b}=e,g=t.map(t=>{let n="observed";return s&&f(t,s)?n="forecast":a&&f(t,a)&&(n="training"),{...t,[i]:n}}),_=e._groupBy,k=[];if(_){const t=new Map;for(const n of g){const o=n[_]??"__default";t.has(o)||t.set(o,[]),t.get(o).push(n)}const n=[];for(const[,o]of t)for(let t=0;o.length-1>t;t++)o[t][i]!==o[t+1][i]&&(n.push({...o[t+1],[i]:o[t][i]}),n.push({...o[t],[i]:o[t+1][i]}));k.push(...g,...n)}else for(let t=0;g.length>t;t++)k.push(g[t]),g.length-1>t&&g[t][i]!==g[t+1][i]&&(k.push({...g[t+1],[i]:g[t][i]}),k.push({...g[t],[i]:g[t+1][i]}));if(e.trainUnderline){const t=[];for(const n of k)"training"===n[i]&&t.push({...n,[i]:"training-base"});k.unshift(...t)}const O=[];if(p&&u){const t="string"==typeof p?p:"__envUpper",n="string"==typeof u?u:"__envLower";if("function"==typeof p||"function"==typeof u)for(const o of k)"function"==typeof p&&(o[t]=p(o)),"function"==typeof u&&(o[n]=u(o));O.push({type:"envelope",upperAccessor:t,lowerAccessor:n,fill:h,fillOpacity:y,label:b})}if(e.uncertaintyOpacity||e.confidenceAccessor){const t=p?"function"==typeof p?p:t=>t[p]:()=>{},n=u?"function"==typeof u?u:t=>t[u]:()=>{};c(k.filter(t=>"forecast"===t[i]),e,t,n)}if(l){const t=e.anomalyStyle,n={type:"highlight",filter:t=>f(t,l)};t?(n.style=t,n.r=m):"function"==typeof d?(n.style=t=>{const n=d(t);return{stroke:n,strokeWidth:1.5,fill:n,fillOpacity:.7}},n.r=m):(n.color=d,n.r=m,n.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),O.push(n)}return r&&O.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label}),{processedData:k,annotations:O}}(t,0,0,l,p):function(t,n,s,l,f){const{trainEnd:p,steps:u=10,confidence:h=.95,color:y="#6366f1",bandOpacity:d=.15,label:m}=l;if(null==p)return{processedData:t,annotations:[]};const b=[],g=[];for(const o of t)o[n]>p?g.push({...o,[i]:"observed"}):b.push({...o,[i]:"training"});const _=b.map(t=>[t[n],t[s]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,n)=>t[0]-n[0]),k=[],O=[];if(_.length>=3){const f=_.length,p=e(_);if(p){const{se:e,meanX:b,ssX:g}=r(_,p),w=o(h),B=t.map(t=>t[n]).filter(t=>null!=t&&isFinite(t)),C=a(B),F=_.length>1?(_[f-1][0]-_[0][0])/(f-1):1;for(let t=1;u>=t;t++){const o=C+t*F,r=p(o),a=e*Math.sqrt(1+1/f+(g>0?(o-b)**2/g:0))*w;O.push({[n]:o,[s]:r,[i]:"forecast",__forecastUpper:r+a,__forecastLower:r-a})}c(O,l,t=>t.__forecastUpper,t=>t.__forecastLower),k.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:y,fillOpacity:d,label:m})}}k.push({type:"x-threshold",x:p,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),f&&k.push({type:"anomaly-band",threshold:f.threshold??2,showBand:!1!==f.showBand,fill:f.bandColor||"#6366f1",fillOpacity:f.bandOpacity??.1,anomalyColor:f.anomalyColor||"#ef4444",anomalyRadius:f.anomalyRadius??6,label:f.label});const w=[];if(w.push(...b),b.length>0&&g.length>0&&w.push({...b[b.length-1],[i]:"observed"}),w.push(...g),O.length>0){const t=g.length>0?g[g.length-1]:b[b.length-1];t&&w.push({...t,[i]:"forecast"}),w.push(...O)}return{processedData:w,annotations:k}}(t,n,s,l,p);var u}function h(o,e){const r=e.trainDasharray??"8,4",a=e.forecastDasharray??"4,4",s=e.color||"#6366f1",c=e.trainOpacity,f=e.forecastOpacity,p=e.trainStroke,u=e.trainLinecap,h=e.trainUnderline;return e=>{const y=o(e),d=e[i];if("training"===d){let n=y.stroke;return"darken"===p?n=t(y.stroke||"#666",.5):p&&(n=p),{...y,stroke:n,strokeDasharray:r,...u&&{strokeLinecap:u},...null!=c&&{strokeOpacity:c}}}if("training-base"===d){let t=y.stroke||"#666";return"lighten"===h&&(t=n(t,.4)),{...y,stroke:t,strokeDasharray:void 0}}if("forecast"===d){const t=e[l],n=null!=t?t:f;return{...y,stroke:s,strokeDasharray:a,...null!=n&&{strokeOpacity:n}}}return y}}export{l as FORECAST_OPACITY_FIELD,i as SEGMENT_FIELD,p as buildAnomalyAnnotations,u as buildForecast,h as createSegmentLineStyle,t as darkenColor,n as lightenColor,c as stampForecastOpacity};
|