jbrowse-plugin-graphgenomeviewer 4.3.0 → 4.4.0

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["global-externals:@jbrowse/render-core/useRenderingBackend", "../../src/GraphGenomeView/components/GraphCanvas.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/Info.mjs", "../../src/GraphGenomeView/components/BubbleHalos.tsx", "../../src/GraphGenomeView/components/legendStyles.ts", "../../src/GraphGenomeView/components/FacetPanels.tsx", "../../src/GraphGenomeView/components/WalkKey.tsx", "../../src/GraphGenomeView/components/usePaneGestures.ts", "../../packages/core/src/util/SpatialIndex.ts", "../../packages/core/src/util/hitDetection.ts", "../../packages/core/src/util/wheelZoom.ts", "../../src/GraphGenomeView/components/GenePins.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/CropFree.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/ZoomIn.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/ZoomOut.mjs", "../../src/GraphGenomeView/components/GraphToolbar.tsx", "../../src/GraphGenomeView/components/ColorSchemeSelect.tsx", "../../src/GraphGenomeView/components/GraphStats.tsx", "../../src/GraphGenomeView/components/LayoutSelect.tsx", "../../src/GraphGenomeView/components/RepeatSelect.tsx", "../../src/GraphGenomeView/components/SettingsMenu.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/Delete.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/MoreVert.mjs", "../../src/GraphGenomeView/components/WalkSelect.tsx", "../../src/GraphGenomeView/components/LabelLayer.tsx", "../../src/GraphGenomeView/components/LabelChip.tsx", "../../src/GraphGenomeView/components/ReferenceStripOverlay.tsx", "../../src/GraphGenomeView/components/TubeMapOverlay.tsx", "../../src/GraphGenomeView/components/UnpopButton.tsx", "../../src/GraphGenomeView/components/WalkRowContextMenu.tsx", "../../src/GraphGenomeView/components/WalkRowsOverlay.tsx", "../../src/GraphGenomeView/components/ElTree.tsx", "../../src/GraphGenomeView/components/WalkStrip.tsx", "../../src/GraphGenomeView/components/WalkStripLocator.tsx", "../../src/GraphGenomeView/renderer/GraphRenderer.ts"],
4
- "sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/render-core/useRenderingBackend\"];", "import { useEffect, useRef } from 'react'\n\nimport { formatBp } from '@jbrowse/bandage-core/graphLabels'\nimport { LEGEND_INSET_PX } from '@jbrowse/bandage-core/labelLayout'\nimport { RAMP_GRADIENT_CSS } from '@jbrowse/bandage-core/referenceRampCss'\nimport {\n LIFT_BACKDROP_CSS,\n REFERENCE_RAMP_ALT_CSS,\n} from '@jbrowse/bandage-core/renderer/GeometryBuilder'\nimport { ErrorBanner, LoadingOverlay, Menu } from '@jbrowse/core/ui'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { useRenderingBackend } from '@jbrowse/render-core/useRenderingBackend'\nimport InfoIcon from '@mui/icons-material/Info'\nimport { observer } from 'mobx-react'\n\nimport BubbleHalos, { HaloLegend } from './BubbleHalos'\nimport FacetPanels from './FacetPanels'\nimport GenePins, { EXON_COLOR } from './GenePins'\nimport GraphToolbar from './GraphToolbar'\nimport LabelLayer from './LabelLayer'\nimport ReferenceStripOverlay, {\n ReferenceStripLegend,\n} from './ReferenceStripOverlay'\nimport TubeMapOverlay, { TubeMapLegend } from './TubeMapOverlay'\nimport UnpopButton from './UnpopButton'\nimport WalkKey, { walkSwatchStyle } from './WalkKey'\nimport { WalkRowContextMenu } from './WalkRowContextMenu'\nimport WalkRowsOverlay, { WalkRowsLegend } from './WalkRowsOverlay'\nimport WalkStrip from './WalkStrip'\nimport WalkStripLocator from './WalkStripLocator'\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\nimport { usePaneGestures, useWheelZoom } from './usePaneGestures'\nimport { locLabel, nodeOwnLocation } from '../../launchFromGraph/contributors'\nimport { nodeLaunchMenuItems } from '../../launchFromGraph/graphMenuItems'\nimport { createGraphRenderer } from '../renderer/GraphRenderer'\n\nimport type { GraphPaneModel } from '../model'\n\n// Bottom RIGHT, not bottom left: the row labels of a row-structured layout are\n// pinned to the left edge, so a bottom-left tooltip lands on top of them and\n// covers the one thing that says which haplotype a row is. Nothing is drawn\n// against the right edge.\nconst tooltipStyle = {\n position: 'absolute' as const,\n bottom: 8,\n right: 8,\n background: 'rgba(0,0,0,0.75)',\n color: 'white',\n padding: '4px 8px',\n borderRadius: 4,\n fontSize: 12,\n pointerEvents: 'none' as const,\n zIndex: 6,\n}\n\nconst wrapperStyle = { position: 'relative' as const }\n\n// The overlay origin has to be the canvas, not the wrapper: the wrapper also\n// holds the toolbar, so anything positioned against it is offset by the\n// toolbar's height, and a row label lands a whole row off the row it names.\nconst canvasAreaStyle = {\n position: 'relative' as const,\n lineHeight: 0,\n isolation: 'isolate' as const,\n}\n\n// Under a transparent canvas, from below the reference strip down, so the\n// linear view's gridlines show only behind the strip\nconst paperStyle = {\n position: 'absolute' as const,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 0,\n}\n\n// Above the labels, pins and legends drawn over the canvas, and with the line\n// height the canvas area zeroes, which would collapse the overlay's label\nconst loadingLayerStyle = {\n position: 'absolute' as const,\n inset: 0,\n zIndex: 10,\n lineHeight: 'normal',\n pointerEvents: 'none' as const,\n}\n\nconst rowLabelStyle = {\n position: 'absolute' as const,\n left: 6,\n transform: 'translateY(-50%)',\n background: 'rgba(255,255,255,0.82)',\n padding: '0 4px',\n borderRadius: 3,\n fontSize: 11,\n // explicit, because the canvas container zeroes line-height to kill the\n // inline-block gap under the canvas. Inherited, that collapses the label to a\n // zero-height box: it still paints, but it has no layout, so anything asking\n // whether it is visible (a screenshot spec's waitForVisible, a11y tooling)\n // is told no.\n lineHeight: '16px',\n whiteSpace: 'nowrap' as const,\n pointerEvents: 'none' as const,\n zIndex: 4,\n}\n\n// Names the rows of a row-structured layout (anchored, sample rows). Without\n// them the layout draws real structure that cannot be read: a stack of bars\n// where every row means something and nothing says what.\n//\n// Positioned from the layout's own `rowLabels` through the same transform the\n// canvas draws with, so a label tracks its row across pan and zoom instead of\n// sitting at a measured pixel. It therefore has to be mounted in the canvas's\n// own positioning context (canvasAreaStyle) \u2014 against the wrapper it picks up\n// the toolbar's height and names the wrong row. Pinned to the left edge rather\n// than to the row's own x, because a row's leftmost node is wherever its first\n// allele happens to branch. Rows scrolled out of the canvas are dropped rather\n// than clamped to the edge, so a label never points at a row that is not\n// there.\nconst RowLabels = observer(function RowLabels({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const rowLabels = model.drawnRowLabels\n return (\n <>\n {rowLabels.map(({ label, y }) => {\n const screenY = y * model.scaleY + model.translateY\n return screenY >= 0 && screenY <= model.canvasHeight ? (\n // Keyed on the row, not on the label: two rows can carry the same\n // words. The sample-row layout names row 0 for the assembly the\n // backbone comes from and the rows below it for the samples\n // contributing alleles, and a diploid reference is in both lists \u2014\n // one haplotype is the reference path, the other walks alleles of its\n // own, and `parsePanSN` reduces both to one sample name.\n <div\n key={y}\n data-testid=\"graph-row-label\"\n style={{ ...rowLabelStyle, top: screenY }}\n >\n {label}\n </div>\n ) : null\n })}\n </>\n )\n})\n\n// Top RIGHT: the row labels own the left edge and the hover tooltip owns the\n// bottom right, so this is the one corner nothing else claims. A row-structured\n// layout draws its band across the middle, which is what the keys are for. The\n// two keys stack rather than each claiming the corner, since a path-coloured\n// graph can also be reference-position coloured.\nconst legendStackStyle = {\n position: 'absolute' as const,\n top: LEGEND_INSET_PX,\n right: LEGEND_INSET_PX,\n display: 'flex',\n flexDirection: 'column' as const,\n alignItems: 'flex-end',\n gap: 4,\n pointerEvents: 'none' as const,\n zIndex: 4,\n}\n\nconst pathSwatchStyle = { width: 18, height: 3, borderRadius: 2 }\n\n// Which haplotype each ribbon colour is. The ribbons are one stroke per path\n// fanned across every edge the path crosses, so without this the drawing states\n// that the alleles are taken by *different* samples and never which.\nconst PathLegend = observer(function PathLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { pathLegend } = model\n return pathLegend.length > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-path-legend\">\n {pathLegend.map(({ name, label, color }) => (\n <div key={name} style={legendRowStyle}>\n <div style={{ ...pathSwatchStyle, backgroundColor: color }} />\n <span>{label}</span>\n </div>\n ))}\n </div>\n ) : null\n})\n\n// Each lifted walk's key, then what the faded rest is\nconst WalkReadout = observer(function WalkReadout({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const lift = model.walkLift\n if (!lift) {\n return null\n }\n return (\n <div style={legendBoxStyle} data-testid=\"graph-walk-readout\">\n {lift.walks.map(w => (\n <WalkKey\n key={w.name}\n walk={w}\n label={model.walkLabel(w.name)}\n reference={model.walkReference}\n at={model.hoveredOn(w)}\n />\n ))}\n {/* the ramp's own key, which names this, is off while walks are lifted */}\n {model.liftPaintsOffReference ? <OffReferenceRow /> : null}\n <div style={legendRowStyle}>\n <div style={{ ...walkSwatchStyle, background: LIFT_BACKDROP_CSS }} />\n <span>not on {model.liftedWalksLabel}</span>\n </div>\n </div>\n )\n})\n\n// The reference-position ramp, as a strip labelled with the interval it runs\n// over. Nothing on screen used to say that red-to-magenta means left-to-right of\n// the cut window, so two tutorials carried that sentence in prose and a reader\n// arriving at a figure had no way to know it at all.\nconst rampStripStyle = {\n minWidth: 90,\n height: 8,\n borderRadius: 2,\n background: RAMP_GRADIENT_CSS,\n}\n\nconst rampEndsStyle = {\n display: 'flex',\n justifyContent: 'space-between',\n gap: 8,\n}\n\nconst ReferenceRampLegend = observer(function ReferenceRampLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n // under lifted walks each lane states its own scale, and the rest is grey\n const domain = model.walkLift ? undefined : model.referenceRampDomain\n const { offReference, unplaced } = model.referenceRampOffKeys\n // a measured domain runs between node midpoints, which can fall on a half bp\n const start = Math.round(domain?.start ?? 0)\n const end = Math.round(domain?.end ?? 0)\n return domain ? (\n <div style={legendBoxStyle} data-testid=\"graph-ramp-legend\">\n <div style={rampStripStyle} />\n <div style={rampEndsStyle}>\n <span>{start.toLocaleString()}</span>\n <span>({formatBp(end - start)})</span>\n <span>{end.toLocaleString()}</span>\n </div>\n {offReference ? <OffReferenceRow /> : null}\n {unplaced ? (\n <div style={legendRowStyle}>\n <div style={{ ...walkSwatchStyle, background: UNPLACED_SWATCH }} />\n <span>no reference position</span>\n </div>\n ) : null}\n </div>\n ) : null\n})\n\n// getNodeColor's grey for a node the ramp cannot place\nconst UNPLACED_SWATCH = 'rgb(160, 160, 160)'\n\n// The charcoal both the ramp and a lane coloured by reference position give\n// sequence the reference does not carry\nfunction OffReferenceRow() {\n return (\n <div style={legendRowStyle}>\n <div style={{ ...walkSwatchStyle, background: REFERENCE_RAMP_ALT_CSS }} />\n <span>off the reference</span>\n </div>\n )\n}\n\nconst exonSwatchStyle = {\n ...walkSwatchStyle,\n border: `2px solid ${EXON_COLOR}`,\n borderRadius: 5,\n boxSizing: 'border-box' as const,\n}\n\nconst GeneLegend = observer(function GeneLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return model.genePins.some(pin => pin.exonsByNode.length > 0) ? (\n <div style={legendBoxStyle} data-testid=\"graph-gene-legend\">\n <div style={legendRowStyle}>\n <div style={exonSwatchStyle} />\n <span>exon</span>\n </div>\n </div>\n ) : null\n})\n\nconst nodeLabelStyle = {\n position: 'absolute' as const,\n transform: 'translate(-50%, -50%)',\n background: 'rgba(255,255,255,0.78)',\n padding: '0 3px',\n borderRadius: 3,\n fontSize: 10,\n lineHeight: '13px',\n whiteSpace: 'nowrap' as const,\n pointerEvents: 'none' as const,\n zIndex: 3,\n}\n\n// Matches EDGE_DELETION_COLOR, so the words and the arc they name are one thing.\nconst deletionLabelStyle = {\n ...nodeLabelStyle,\n color: '#18181c',\n fontWeight: 600,\n}\n\n// Under the labels (z 3) and over the canvas, so a leader runs beneath the text\n// it points from rather than across it. `overflow: visible` because a label\n// displaced past the canvas edge is culled by the placement, not clipped here.\nconst leaderStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 2,\n}\n\n// Measures itself for the model, so no label is placed under a legend and\n// none gives way to one that is not drawn.\n//\n// At rest only: the walk keys' hover readout would otherwise refit the view,\n// and the refit clears the hover that grew it\nconst Legends = observer(function Legends({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n const el = ref.current\n if (!el) {\n return\n }\n // the last callback can land after the track is closed\n const observer = new ResizeObserver(() => {\n if (isAlive(model) && model.hoveredNode === null) {\n model.setLegendSize({ width: el.offsetWidth, height: el.offsetHeight })\n }\n })\n observer.observe(el)\n return () => {\n observer.disconnect()\n }\n }, [model])\n return (\n <div\n ref={ref}\n style={{\n ...legendStackStyle,\n top: LEGEND_INSET_PX + model.referenceStripZonePx,\n }}\n >\n <ReferenceRampLegend model={model} />\n <ReferenceStripLegend model={model} />\n <HaloLegend model={model} />\n <GeneLegend model={model} />\n <PathLegend model={model} />\n <TubeMapLegend model={model} />\n <WalkRowsLegend model={model} />\n <WalkReadout model={model} />\n </div>\n )\n})\n\n// Writes each drawn thing's size onto it, which is what Bandage's Length label\n// does and what the tooltip alone could not: a graph you have to hover to read\n// is a graph nobody reads. graphLabels applies the same transform the canvas\n// draws with \u2014 so a label tracks its node across pan and zoom \u2014 and decides\n// which labels fit; this only paints them, mounted in the canvas's own\n// positioning context for the reason RowLabels is.\nconst GraphSizeLabels = observer(function GraphSizeLabels({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const labels = model.overlayLabels.sizes\n // A label too wide for the arc it names is placed clear of it and tethered\n // back; nothing else in the drawing carries one.\n const leaders = labels.flatMap(({ key, leader }) =>\n leader ? [{ key, ...leader }] : [],\n )\n return (\n <>\n {leaders.length > 0 ? (\n <svg\n style={leaderStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n >\n {leaders.map(({ key, arcX, arcY, labelX, labelY }) => (\n <line\n key={key}\n data-testid=\"graph-label-leader\"\n x1={arcX}\n y1={arcY}\n x2={labelX}\n y2={labelY}\n stroke=\"#18181c\"\n strokeWidth={1}\n />\n ))}\n </svg>\n ) : null}\n {labels.map(({ key, text, x, y, kind }) => (\n <div\n key={key}\n data-testid=\"graph-size-label\"\n style={{\n ...(kind === 'deletion' ? deletionLabelStyle : nodeLabelStyle),\n left: x,\n top: y,\n }}\n >\n {text}\n </div>\n ))}\n </>\n )\n})\n\nconst HoverTooltips = observer(function HoverTooltips({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const hoveredNodeData = model.hoveredNode\n ? model.nodeById?.get(model.hoveredNode)\n : null\n\n const hoveredEdgeData =\n model.hoveredEdge !== null && model.graph\n ? model.graph.edges[model.hoveredEdge]\n : null\n\n const ownLocation = hoveredNodeData\n ? nodeOwnLocation(hoveredNodeData)\n : undefined\n\n const hoveredDeletion =\n model.hoveredEdge === null\n ? undefined\n : model.deletions.find(d => d.edgeIndex === model.hoveredEdge)\n\n return (\n <>\n {hoveredNodeData ? (\n <div style={tooltipStyle}>\n <strong>{hoveredNodeData.name}</strong> \u2014{' '}\n {hoveredNodeData.length.toLocaleString()} bp, depth{' '}\n {hoveredNodeData.depth.toFixed(1)}\n {/* Which assembly contributed this segment, and where it sits on it.\n rGFA states both, and until now neither reached the screen: the\n node was a bare id in a picture. */}\n {ownLocation ? (\n <>\n <br />\n {ownLocation.sample} {locLabel(ownLocation)} (rank{' '}\n {hoveredNodeData.stable?.rank})\n </>\n ) : null}\n </div>\n ) : null}\n {hoveredEdgeData ? (\n <div style={tooltipStyle}>\n {/* A deletion edge is the one link that means something on its own \u2014\n the backbone it skips is sequence some haplotype does not carry \u2014\n so it says how much rather than just naming its endpoints. */}\n {hoveredDeletion ? (\n <>\n <strong>Deletion</strong> {hoveredDeletion.bp.toLocaleString()} bp\n <br />\n {hoveredDeletion.refName}:{hoveredDeletion.start.toLocaleString()}\n -{hoveredDeletion.end.toLocaleString()}\n </>\n ) : (\n <>\n Edge: {hoveredEdgeData.from} \u2192 {hoveredEdgeData.to}\n </>\n )}\n </div>\n ) : null}\n </>\n )\n})\n\n// Flat rather than under a \"Launch view\" submenu: this menu is two or three\n// items long and every one of them is contextual to the node just clicked. The\n// submenu grouping earns its keep in the long view and track menus.\nconst NodeContextMenu = observer(function NodeContextMenu({\n model,\n nodeId,\n top,\n left,\n onClose,\n}: {\n model: GraphPaneModel\n nodeId: string\n top: number\n left: number\n onClose: () => void\n}) {\n const { own, reference, highlight } = model.nodeLaunchTargets(nodeId)\n return (\n <Menu\n open\n anchorReference=\"anchorPosition\"\n anchorPosition={{ top, left }}\n onClose={() => {\n onClose()\n }}\n onMenuItemClick={callback => {\n callback()\n }}\n menuItems={[\n {\n label: 'Node details',\n icon: InfoIcon,\n onClick: () => {\n model.showNodeDetails(nodeId)\n },\n },\n ...nodeLaunchMenuItems({\n own,\n reference,\n highlight,\n onShowLinear: target => {\n model.showInLinearView(target)\n },\n onHighlight: model.canHighlightInLinearView\n ? target => {\n model.highlightInLinearView(target)\n }\n : undefined,\n }),\n ]}\n />\n )\n})\n\n// `ownChrome` false for a pane inside a track, whose controls, loading state\n// and errors are the track's. A hosted pane whose x the host places takes no pan or wheel of its\n// own: those are the linear view's, as on any other track. One drawing its\n// own coordinates inside a track keeps them, and keeps them from the view.\nconst GraphCanvas = observer(function GraphCanvas({\n model,\n ownChrome = true,\n}: {\n model: GraphPaneModel\n ownChrome?: boolean\n}) {\n const {\n canvasRef,\n canvas,\n error: renderError,\n retry: retryRender,\n } = useRenderingBackend(createGraphRenderer, model)\n const { handlers, contextNode, contextRow, closeContextMenu } =\n usePaneGestures(model)\n useWheelZoom(canvas, model)\n const faceted = model.facetPanels !== undefined\n\n return (\n <div style={wrapperStyle}>\n {ownChrome ? <GraphToolbar model={model} /> : null}\n\n <div\n style={canvasAreaStyle}\n onMouseEnter={() => {\n model.setPointerInPane(true)\n }}\n onMouseLeave={() => {\n if (isAlive(model)) {\n model.setPointerInPane(false)\n }\n }}\n >\n {model.referenceStripShown ? (\n <div\n style={{\n ...paperStyle,\n top: model.referenceStripZonePx,\n background: model.paperCss,\n }}\n />\n ) : null}\n <canvas\n ref={canvasRef}\n data-testid=\"graph-genome-canvas\"\n style={{\n width: model.paneWidth,\n height: model.canvasHeight,\n cursor: model.isPanning || model.draggingNode ? 'grabbing' : 'grab',\n display: 'block',\n position: 'relative',\n zIndex: 1,\n }}\n {...handlers}\n />\n\n {faceted ? (\n <FacetPanels model={model} handlers={handlers} />\n ) : (\n <>\n <TubeMapOverlay model={model} />\n <ReferenceStripOverlay model={model} />\n <RowLabels model={model} />\n <GraphSizeLabels model={model} />\n <BubbleHalos model={model} />\n <GenePins model={model} />\n <LabelLayer model={model} />\n <WalkRowsOverlay model={model} />\n <WalkStripLocator model={model} />\n <Legends model={model} />\n </>\n )}\n <UnpopButton model={model} />\n\n {ownChrome ? (\n <div style={loadingLayerStyle}>\n <LoadingOverlay\n isVisible={model.isLoading}\n immediate={!model.layoutResult}\n statusMessage={model.statusMessage}\n onCancel={\n model.canCancelLoad\n ? () => {\n model.cancelLoad()\n }\n : undefined\n }\n />\n </div>\n ) : null}\n </div>\n\n {model.walkStripShown ? <WalkStrip model={model} /> : null}\n\n <HoverTooltips model={model} />\n\n {contextNode ? (\n <NodeContextMenu\n model={model}\n nodeId={contextNode.nodeId}\n top={contextNode.top}\n left={contextNode.left}\n onClose={closeContextMenu}\n />\n ) : null}\n\n {contextRow ? (\n <WalkRowContextMenu\n model={model}\n row={contextRow.row}\n top={contextRow.top}\n left={contextRow.left}\n onClose={closeContextMenu}\n />\n ) : null}\n\n {renderError ? (\n <ErrorBanner error={renderError} onReset={retryRender} />\n ) : null}\n\n {ownChrome && model.error ? (\n <ErrorBanner\n error={model.error}\n onReset={\n model.canRetryLoad\n ? () => {\n model.retryLoad()\n }\n : undefined\n }\n />\n ) : null}\n </div>\n )\n})\n\nexport default GraphCanvas\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z\"\n}), 'Info');", "import { sameBubble } from '@jbrowse/bandage-core/bubbles/bubbleLine'\nimport {\n BUBBLE_KIND_COLORS,\n BUBBLE_KIND_NAMES,\n} from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { HALO_FACTOR } from '@jbrowse/bandage-core/labelLayout'\nimport { observer } from 'mobx-react'\n\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\nimport type { BubbleHalo } from '@jbrowse/bandage-core/bubbles/bubbleHalos'\n\n// The bubbles over a node drawing: each a translucent halo along its nodes,\n// drawn once in layout units and moved with the canvas by one transform. The\n// halo takes no pointer events, so the nodes under it still hover and drag;\n// its name and its routes' chips are LabelLayer's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 2,\n}\n\nconst BubbleHalos = observer(function BubbleHalos({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbleHalos, walkLift, hoveredBubble } = model\n if (bubbleHalos.length === 0) {\n return null\n }\n const {\n scaleX,\n scaleY,\n translateX,\n translateY,\n paneWidth: width,\n canvasHeight,\n } = model\n const halo = model.contigThickness * HALO_FACTOR\n // lifted walks dim the bubbles none of them enters\n const dimmedBubble = (h: BubbleHalo) =>\n walkLift !== undefined && !h.nodeIds.some(id => walkLift.nodeIds.has(id))\n\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-bubble-halos\"\n >\n <g\n transform={`translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`}\n >\n {bubbleHalos\n .filter(h => !h.whole)\n .map(h => (\n <path\n key={`${h.bubble.start}-${h.bubble.end}`}\n d={h.path}\n fill=\"none\"\n stroke={BUBBLE_KIND_COLORS[h.kind]}\n strokeOpacity={\n hoveredBubble && sameBubble(h.bubble, hoveredBubble)\n ? 0.45\n : dimmedBubble(h)\n ? 0.06\n : 0.22\n }\n strokeWidth={halo}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n vectorEffect=\"non-scaling-stroke\"\n />\n ))}\n </g>\n </svg>\n )\n})\n\nexport default BubbleHalos\n\nfunction HaloSwatch({ color }: { color: string }) {\n return (\n <svg width={18} height={10} style={{ flex: 'none' }}>\n <line\n x1={5}\n y1={5}\n x2={13}\n y2={5}\n stroke={color}\n strokeOpacity={0.35}\n strokeWidth={8}\n strokeLinecap=\"round\"\n />\n </svg>\n )\n}\n\n// One row per halo colour on screen, naming the kinds it stands for\nexport const HaloLegend = observer(function HaloLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const kindsByColor = new Map<string, Set<string>>()\n for (const h of model.bubbleHalos) {\n if (!h.whole) {\n const color = BUBBLE_KIND_COLORS[h.kind]\n const kinds = kindsByColor.get(color) ?? new Set<string>()\n kinds.add(BUBBLE_KIND_NAMES[h.kind])\n kindsByColor.set(color, kinds)\n }\n }\n return kindsByColor.size > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-halo-legend\">\n {[...kindsByColor].map(([color, kinds]) => (\n <div key={color} style={legendRowStyle}>\n <HaloSwatch color={color} />\n <span>bubble: {[...kinds].join(', ')}</span>\n </div>\n ))}\n </div>\n ) : null\n})\n", "// A key's box over the drawing, and one row in it: a swatch beside its words\nexport const legendBoxStyle = {\n background: 'rgba(255,255,255,0.82)',\n padding: '4px 6px',\n borderRadius: 3,\n fontSize: 11,\n lineHeight: '15px',\n whiteSpace: 'nowrap' as const,\n}\n\nexport const legendRowStyle = { display: 'flex', alignItems: 'center', gap: 5 }\n", "import { useEffect, useState } from 'react'\n\nimport { FACET_GAP_PX, FACET_TITLE_PX } from '@jbrowse/bandage-core/facetGrid'\nimport { Canvas2DRenderer } from '@jbrowse/bandage-core/renderer/Canvas2DRenderer'\nimport { autorun, computed } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport WalkKey from './WalkKey'\nimport { useWheelZoom } from './usePaneGestures'\n\nimport type { PaneHandlers } from './usePaneGestures'\nimport type { GraphPaneModel } from '../model'\nimport type { WalkLift } from '@jbrowse/bandage-core/walkHighlight'\n\n// The pane faceted by walk: the same layout drawn once per lifted walk, each\n// panel with that walk alone shading along itself, so walks compare by where\n// they go rather than by which lane is which colour. The panels share the\n// pane's transform, so a pan, zoom or hover in one is in all of them.\n\nconst gridStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n zIndex: 4,\n display: 'grid',\n gap: FACET_GAP_PX,\n lineHeight: 'normal',\n}\n\nconst titleStyle = {\n height: FACET_TITLE_PX,\n padding: '2px 6px',\n boxSizing: 'border-box' as const,\n fontFamily: 'inherit',\n fontSize: 11,\n color: 'inherit',\n cursor: 'pointer',\n border: 'none',\n background: 'none',\n textAlign: 'left' as const,\n display: 'block',\n}\n\nconst FacetPanel = observer(function FacetPanel({\n model,\n lift,\n width,\n height,\n cell,\n handlers,\n}: {\n model: GraphPaneModel\n lift: WalkLift\n width: number\n height: number\n cell: { gridRow: number; gridColumn: number }\n handlers: PaneHandlers\n}) {\n const [canvas, setCanvas] = useState<HTMLCanvasElement | null>(null)\n const walk = lift.walks[0]!\n useWheelZoom(canvas, model)\n\n useEffect(() => {\n if (!canvas) {\n return undefined\n }\n const renderer = new Canvas2DRenderer(canvas)\n renderer.resize(width, height)\n const drawing = computed(() => model.buildDrawing(lift, false))\n let uploaded: ReturnType<typeof model.buildDrawing>\n const dispose = autorun(() => {\n const built = drawing.get()\n if (!built) {\n return\n }\n if (built !== uploaded) {\n renderer.uploadGeometry(built.batch)\n uploaded = built\n }\n model.applyHighlights(renderer)\n model.paint(renderer)\n })\n return () => {\n dispose()\n renderer.dispose()\n }\n }, [canvas, model, lift, width, height])\n\n const label = model.walkLabel(walk.name)\n return (\n <div style={cell}>\n <button\n type=\"button\"\n style={titleStyle}\n data-testid=\"graph-facet-title\"\n onClick={() => {\n model.liftWalks([walk.name])\n model.setFacet('')\n }}\n >\n <WalkKey\n walk={walk}\n label={label}\n reference={model.walkReference}\n hint={`click to lift ${label} alone`}\n at={model.hoveredOn(walk)}\n />\n </button>\n <canvas\n ref={setCanvas}\n data-testid=\"graph-facet-canvas\"\n style={{\n width,\n height,\n display: 'block',\n cursor: model.isPanning || model.draggingNode ? 'grabbing' : 'grab',\n }}\n {...handlers}\n />\n </div>\n )\n})\n\nconst FacetPanels = observer(function FacetPanels({\n model,\n handlers,\n}: {\n model: GraphPaneModel\n handlers: PaneHandlers\n}) {\n const panels = model.facetPanels\n const grid = model.facetGrid\n const place = model.facetPlacement\n if (!panels || !grid || !place) {\n return null\n }\n const { columns, width, height } = grid\n return (\n <div\n data-testid=\"graph-facet-panels\"\n style={{\n ...gridStyle,\n width: model.paneWidth,\n minHeight: model.canvasHeight,\n gridTemplateColumns: `repeat(${columns}, ${width}px)`,\n background: model.darkMode ? '#1f1f1f' : 'white',\n }}\n >\n {panels.map((lift, i) => (\n <FacetPanel\n key={lift.walks[0]!.name}\n model={model}\n lift={lift}\n width={width}\n height={height}\n cell={{\n gridRow: Math.floor(place.cells[i]! / columns) + 1,\n gridColumn: (place.cells[i]! % columns) + 1,\n }}\n handlers={handlers}\n />\n ))}\n </div>\n )\n})\n\nexport default FacetPanels\n", "import { encodingSwatchCss } from '@jbrowse/bandage-core/walkEncoding'\nimport { walkKey } from '@jbrowse/bandage-core/walkKey'\n\nimport { legendRowStyle } from './legendStyles'\n\nimport type { LiftedWalk } from '@jbrowse/bandage-core/walkHighlight'\n\nexport const walkSwatchStyle = {\n width: 18,\n height: 8,\n borderRadius: 2,\n flex: 'none',\n}\nconst walkBlockStyle = { marginBottom: 2 }\nconst walkBarStyle = { ...walkSwatchStyle, width: 48 }\n\n// One walk's key: a swatch, or a short bar of the scale its lane shades by,\n// then its name; see walkKey for the words. `at`, where the hovered node sits\n// on the walk, stands in for the scale's stretch while there is one.\nexport default function WalkKey({\n walk,\n label,\n reference,\n hint,\n at,\n}: {\n walk: LiftedWalk\n label: string\n reference?: { name?: string; start: number; end: number }\n hint?: string\n at?: string\n}) {\n const key = walkKey(walk, reference)\n return (\n <div\n style={walkBlockStyle}\n title={[key.hover, hint].filter(Boolean).join(' \u00B7 ') || undefined}\n >\n <div style={legendRowStyle}>\n <div\n style={{\n ...(key.shades ? walkBarStyle : walkSwatchStyle),\n background: encodingSwatchCss(walk.encoding),\n }}\n />\n <span>\n <strong>{label}</strong>\n {key.delta}\n {key.outside}\n {key.reversed}\n </span>\n </div>\n {at ? (\n <div data-testid=\"graph-walk-at\">{at}</div>\n ) : key.scale ? (\n <div>{key.scale}</div>\n ) : null}\n </div>\n )\n}\n", "import { useEffect, useRef, useState } from 'react'\n\nimport {\n findHoveredEdge,\n findHoveredNode,\n} from '@jbrowse/bandage-core/util/hitDetection'\nimport { wheelZoomFactor } from '@jbrowse/bandage-core/util/wheelZoom'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\n\nimport type { GraphPaneModel } from '../model'\n\n// wheel events need passive:false to call preventDefault \u2014 React registers\n// wheel listeners as passive, so we must add this imperatively\nexport function useWheelZoom(\n canvas: HTMLCanvasElement | null | undefined,\n model: GraphPaneModel,\n) {\n useEffect(() => {\n if (!canvas) {\n return undefined\n }\n const c = canvas\n function handleWheel(e: WheelEvent) {\n if (model.hostPlacesX) {\n return\n }\n if (model.host) {\n e.stopPropagation()\n }\n e.preventDefault()\n const rect = c.getBoundingClientRect()\n model.zoom(\n wheelZoomFactor(e),\n e.clientX - rect.left,\n e.clientY - rect.top,\n )\n }\n c.addEventListener('wheel', handleWheel, { passive: false })\n return () => {\n c.removeEventListener('wheel', handleWheel)\n }\n }, [canvas, model])\n}\n\n// The pointer on a canvas drawing the pane's transform: the pane's own, or any\n// facet panel, since the panels share it. Coordinates are read against the\n// canvas the event is on.\nexport function usePaneGestures(model: GraphPaneModel) {\n // Where the pointer was last, and whether it has travelled since mousedown \u2014\n // per-gesture scratch that nothing renders from, which is what a ref is for.\n // Whether a drag is in progress is model state (`isPanning`/`draggingNode`),\n // because the cursor renders from it.\n const lastMouseRef = useRef({ x: 0, y: 0 })\n const hasMovedRef = useRef(false)\n // A pan and a hover are applied once per frame, not once per mousemove:\n // mousemove fires in bursts well above the frame rate, and each pan step\n // repainted the canvas and re-placed every overlay label, while each hover\n // step ran both hit indexes. The pending pan is the summed delta; the pending\n // hover is the last pointer position, since only the last one can be right.\n const pendingRef = useRef<{\n frame: number\n pan: { dx: number; dy: number } | null\n hover: { x: number; y: number } | null\n }>({ frame: 0, pan: null, hover: null })\n useEffect(\n () => () => {\n cancelAnimationFrame(pendingRef.current.frame)\n },\n [],\n )\n const [contextNode, setContextNode] = useState<\n { nodeId: string; top: number; left: number } | undefined\n >(undefined)\n const [contextRow, setContextRow] = useState<\n { row: number; top: number; left: number } | undefined\n >(undefined)\n\n function screenToGraph(screenX: number, screenY: number) {\n return {\n x: (screenX - model.translateX) / model.scaleX,\n y: (screenY - model.translateY) / model.scaleY,\n }\n }\n\n function getMouseCoord(e: React.MouseEvent) {\n const rect = (e.currentTarget as HTMLCanvasElement).getBoundingClientRect()\n return screenToGraph(e.clientX - rect.left, e.clientY - rect.top)\n }\n\n // The node at a graph coordinate, which mousedown, mousemove and click all\n // need. Takes the coordinate rather than the event so a caller that already\n // has one does not pay for a second getBoundingClientRect.\n function nodeAt(x: number, y: number) {\n const { nodePositions } = model\n const sx = x * model.scaleX + model.translateX\n const sy = y * model.scaleY + model.translateY\n if (model.layoutResult?.tubeMap) {\n return model.tubeMapNodeAt(sx, sy)\n }\n const onStrip = model.referenceStripNodeAt(sx, sy)\n if (onStrip) {\n return onStrip\n }\n return nodePositions\n ? findHoveredNode(\n nodePositions,\n x,\n y,\n model.axisScale,\n model.positionsVersion,\n model.nodeInk,\n )\n : null\n }\n\n function onMouseDown(e: React.MouseEvent) {\n if (e.button === 0) {\n hasMovedRef.current = false\n if (model.hostPlacesX) {\n return\n }\n if (model.host) {\n e.stopPropagation()\n }\n const { x, y } = getMouseCoord(e)\n // a tube map's boxes are the layout's, and the strip's are bp, not\n // positions to drag\n const node =\n model.layoutResult?.tubeMap ||\n e.nativeEvent.offsetY < model.referenceStripZonePx\n ? null\n : nodeAt(x, y)\n if (node) {\n model.setDraggingNode(node)\n } else {\n model.setPanning(true)\n }\n lastMouseRef.current = { x: e.clientX, y: e.clientY }\n }\n }\n\n function applyPending() {\n const pending = pendingRef.current\n pending.frame = 0\n if (pending.pan) {\n model.setTransform(\n model.scale,\n model.translateX + pending.pan.dx,\n model.translateY + pending.pan.dy,\n )\n pending.pan = null\n }\n if (pending.hover && model.nodePositions && model.graph) {\n const { x, y } = screenToGraph(pending.hover.x, pending.hover.y)\n pending.hover = null\n const node = nodeAt(x, y)\n model.setHoveredNode(node)\n model.setHoveredEdge(\n node || model.layoutResult?.tubeMap\n ? null\n : findHoveredEdge(\n model.nodePositions,\n model.graph,\n x,\n y,\n model.axisScale,\n // resolved, so the hit index bounds the ribbons that are\n // actually drawn \u2014 see effectiveDrawPaths. Facet panels draw\n // none.\n model.effectiveDrawPaths && !model.facetPanels,\n model.positionsVersion,\n model.deletionEdgeIndexes,\n model.hiddenEdgeIndexes,\n model.deletionRoutes,\n ),\n )\n }\n }\n\n function scheduleFrame() {\n if (!pendingRef.current.frame) {\n pendingRef.current.frame = requestAnimationFrame(applyPending)\n }\n }\n\n function dropPending() {\n const pending = pendingRef.current\n cancelAnimationFrame(pending.frame)\n pending.frame = 0\n pending.pan = null\n pending.hover = null\n }\n\n function onMouseMove(e: React.MouseEvent) {\n const dx = e.clientX - lastMouseRef.current.x\n const dy = e.clientY - lastMouseRef.current.y\n lastMouseRef.current = { x: e.clientX, y: e.clientY }\n\n if (Math.abs(dx) > 1 || Math.abs(dy) > 1) {\n hasMovedRef.current = true\n }\n\n const pending = pendingRef.current\n if (model.draggingNode) {\n model.moveNode(model.draggingNode, dx / model.scaleX, dy / model.scaleY)\n } else if (model.isPanning) {\n pending.pan = {\n dx: (pending.pan?.dx ?? 0) + dx,\n dy: (pending.pan?.dy ?? 0) + dy,\n }\n scheduleFrame()\n } else {\n const rect = (\n e.currentTarget as HTMLCanvasElement\n ).getBoundingClientRect()\n pending.hover = { x: e.clientX - rect.left, y: e.clientY - rect.top }\n scheduleFrame()\n }\n }\n\n function onMouseUp() {\n model.stopDragging()\n }\n\n // also fired by the canvas unmounting under a resting pointer, after the\n // view closing it has destroyed the model\n function onMouseLeave() {\n dropPending()\n if (!isAlive(model)) {\n return\n }\n model.stopDragging()\n model.setHoveredNode(null)\n model.setHoveredEdge(null)\n }\n\n // Right-clicking a node is the gesture that asks \"where is this?\", and until\n // now the graph had no answer: a node named an assembly and an offset in its\n // tags that nothing surfaced. The items come from the model's launch targets,\n // so what is offered is what can actually be opened.\n function onContextMenu(e: React.MouseEvent) {\n const { x, y } = getMouseCoord(e)\n const node = nodeAt(x, y)\n if (node) {\n e.preventDefault()\n setContextNode({ nodeId: node, top: e.clientY, left: e.clientX })\n return\n }\n const row = model.walkRowAt(\n x * model.scaleX + model.translateX,\n y * model.scaleY + model.translateY,\n )\n if (row !== undefined) {\n e.preventDefault()\n setContextRow({ row, top: e.clientY, left: e.clientX })\n }\n }\n\n function onClick(e: React.MouseEvent) {\n // a click that ended a drag selects nothing\n if (!hasMovedRef.current) {\n const { x, y } = getMouseCoord(e)\n const node = nodeAt(x, y)\n model.setSelectedNode(node)\n if (node) {\n model.showNodeDetails(node)\n }\n }\n }\n\n return {\n handlers: {\n onMouseDown,\n onMouseMove,\n onMouseUp,\n onMouseLeave,\n onClick,\n onContextMenu,\n },\n contextNode,\n contextRow,\n closeContextMenu: () => {\n setContextNode(undefined)\n setContextRow(undefined)\n },\n }\n}\n\nexport type PaneHandlers = ReturnType<typeof usePaneGestures>['handlers']\n", "import { baseEdgeCurves } from './edgeCurves'\nimport { curveBounds, pathRibbonOffsets } from './geometry'\n\nimport type { EdgeCurves } from './edgeCurves'\nimport type { DeletionRoutes } from '../layout/deletionRoutes'\nimport type { Graph, NodeSegment } from '../types'\nimport type { AxisScale } from './geometry'\n\ninterface CellEntry {\n nodeId: string\n segmentIdx: number\n}\n\n// A uniform grid only performs when its cells are about the size of the things\n// in them: too large and every query scans a crowd, too small and every item is\n// stamped into hundreds of cells. World units here are whatever the layout uses,\n// and the two differ by orders of magnitude \u2014 the force layout's are screen-ish\n// (nodes ~8 units long), while the reference-anchored layouts put x in bp, so a\n// 100 kb window is 100,000 units wide. A fixed 50 was tuned for the first and\n// left the second stamping each edge into hundreds of cells: measured 7.2 ms to\n// index 800 bp-scale edges, against 2.8 ms for 8,000 screen-scale ones.\n//\n// So the size is derived from the mean extent of the items being indexed \u2014\n// **per axis**, for the reason the query radius below is already per axis: on a\n// row layout x is bp and y is screen px, and one size taken from the two summed\n// is the x size. Applied to y it swallowed every row into one cell, so the grid\n// degenerated to a 1-D index on x and each query handed the distance loop every\n// row in the band. On HPRC's rGFA, whose mean segment is ~7 kb against a 20 px\n// row pitch, that is all of them.\nconst FALLBACK_CELL_SIZE = 50\n\nexport interface CellSize {\n x: number\n y: number\n}\n\nfunction meanExtentCellSize(extentTotal: number, count: number) {\n return count > 0 ? Math.max(1, extentTotal / count) : FALLBACK_CELL_SIZE\n}\n\n// The y size for the layouts whose items have no y extent of their own. Every\n// row there is a horizontal line, so the mean per-item extent is exactly zero\n// and says nothing about how the rows are spaced. What separates them is the\n// ROW PITCH, which is their spread over the number of rows they occupy.\nfunction rowPitchOf(boxes: { minY: number }[]) {\n const distinct = new Set<number>()\n let min = Infinity\n let max = -Infinity\n for (const box of boxes) {\n distinct.add(box.minY)\n min = Math.min(min, box.minY)\n max = Math.max(max, box.minY)\n }\n return distinct.size > 1 ? (max - min) / (distinct.size - 1) : undefined\n}\n\n// A row layout with one row has nothing to separate on y, so it takes the x\n// size and lands in one cell rather than being stamped across thousands.\nfunction cellSizeFrom(\n boxes: { minY: number }[],\n extentX: number,\n extentY: number,\n): CellSize {\n const x = meanExtentCellSize(extentX, boxes.length)\n return {\n x,\n y:\n extentY > 0\n ? meanExtentCellSize(extentY, boxes.length)\n : (rowPitchOf(boxes) ?? x),\n }\n}\n\nfunction resolveCellSize(\n given: number | CellSize | undefined,\n boxes: { minY: number }[],\n extentX: number,\n extentY: number,\n): CellSize {\n return given === undefined\n ? cellSizeFrom(boxes, extentX, extentY)\n : typeof given === 'number'\n ? { x: given, y: given }\n : given\n}\n\nfunction getOrCreateCell<T>(\n cells: Map<number, Map<number, T[]>>,\n cx: number,\n cy: number,\n) {\n let row = cells.get(cx)\n if (!row) {\n row = new Map()\n cells.set(cx, row)\n }\n let cell = row.get(cy)\n if (!cell) {\n cell = []\n row.set(cy, cell)\n }\n return cell\n}\n\nfunction addToGrid<T>(\n cells: Map<number, Map<number, T[]>>,\n cellSize: CellSize,\n minX: number,\n minY: number,\n maxX: number,\n maxY: number,\n entry: T,\n) {\n const cx0 = Math.floor(minX / cellSize.x)\n const cx1 = Math.floor(maxX / cellSize.x)\n const cy0 = Math.floor(minY / cellSize.y)\n const cy1 = Math.floor(maxY / cellSize.y)\n for (let cx = cx0; cx <= cx1; cx++) {\n for (let cy = cy0; cy <= cy1; cy++) {\n getOrCreateCell(cells, cx, cy).push(entry)\n }\n }\n}\n\n// The radius is per axis because the two axes need not be in the same units: a\n// row layout's x is bp and its y is screen px, so the same 5 px of slack is\n// hundreds of bp one way and 5 the other. Passing the x radius on both axes\n// would sweep every row in the band into the candidate set.\nfunction queryGrid<T>(\n cells: Map<number, Map<number, T[]>>,\n cellSize: CellSize,\n x: number,\n y: number,\n radiusX: number,\n radiusY: number,\n): T[] {\n const cx0 = Math.floor((x - radiusX) / cellSize.x)\n const cx1 = Math.floor((x + radiusX) / cellSize.x)\n const cy0 = Math.floor((y - radiusY) / cellSize.y)\n const cy1 = Math.floor((y + radiusY) / cellSize.y)\n const results: T[] = []\n const seen = new Set<T>()\n for (let cx = cx0; cx <= cx1; cx++) {\n const row = cells.get(cx)\n if (row) {\n for (let cy = cy0; cy <= cy1; cy++) {\n const cell = row.get(cy)\n if (cell) {\n for (const entry of cell) {\n if (!seen.has(entry)) {\n seen.add(entry)\n results.push(entry)\n }\n }\n }\n }\n }\n }\n return results\n}\n\nexport class SpatialIndex {\n private cellSize: CellSize\n private cells = new Map<number, Map<number, CellEntry[]>>()\n\n constructor(\n nodePositions: Record<string, NodeSegment[]>,\n // one number sets both axes, which is what a test that only cares about\n // bucketing wants\n cellSize?: number | CellSize,\n ) {\n // Segment boxes are collected first so the cell size can come from their\n // mean extent; the grid itself needs the size up front.\n const boxes: {\n entry: CellEntry\n minX: number\n minY: number\n maxX: number\n maxY: number\n }[] = []\n let extentX = 0\n let extentY = 0\n for (const [nodeId, segments] of Object.entries(nodePositions)) {\n for (let i = 0; i < segments.length - 1; i++) {\n const seg = segments[i]!\n const next = segments[i + 1]!\n const minX = Math.min(seg.x, next.x)\n const minY = Math.min(seg.y, next.y)\n const maxX = Math.max(seg.x, next.x)\n const maxY = Math.max(seg.y, next.y)\n extentX += maxX - minX\n extentY += maxY - minY\n boxes.push({ entry: { nodeId, segmentIdx: i }, minX, minY, maxX, maxY })\n }\n }\n\n this.cellSize = resolveCellSize(cellSize, boxes, extentX, extentY)\n for (const b of boxes) {\n addToGrid(\n this.cells,\n this.cellSize,\n b.minX,\n b.minY,\n b.maxX,\n b.maxY,\n b.entry,\n )\n }\n }\n\n query(x: number, y: number, radiusX: number, radiusY = radiusX) {\n return queryGrid(this.cells, this.cellSize, x, y, radiusX, radiusY)\n }\n}\n\nexport class EdgeSpatialIndex {\n private cellSize: CellSize\n private cells = new Map<number, Map<number, number[]>>()\n // Base curves (offset 0) by edge index \u2014 the shared derivation, which the\n // geometry builder draws the same edges from. findHoveredEdge reuses them on\n // every mousemove; path-offset variants translate them (pure translation).\n private edgeCurves: EdgeCurves\n\n constructor(\n nodePositions: Record<string, NodeSegment[]>,\n graph: Graph,\n drawPaths: boolean,\n // The transform the curves indexed here were drawn under, so hit detection\n // tests the shape on screen. See AxisScale.\n axis: AxisScale,\n cellSize?: number | CellSize,\n // Bypassed backbone ids per deletion edge, i.e. what GeometryBuilder is\n // given. Without it a deletion is indexed and hit-tested on the STRAIGHT\n // chord between its endpoints while it is drawn as an arc bowed off that\n // chord, so the shape on screen is not hoverable and the empty space where\n // the chord runs is \u2014 and the tutorial tells the reader to hover it for the\n // interval and the bp. Bowing is part of the drawn geometry, so it has to be\n // part of the geometry hit detection uses.\n deletions?: Map<number, string[]>,\n // Bumped when a drag moves the positions in place; see baseEdgeCurves.\n version = 0,\n routes?: DeletionRoutes,\n ) {\n this.edgeCurves = baseEdgeCurves(\n nodePositions,\n graph,\n axis,\n deletions,\n version,\n routes,\n )\n const boxes: {\n ei: number\n minX: number\n minY: number\n maxX: number\n maxY: number\n }[] = []\n let extentX = 0\n let extentY = 0\n for (let ei = 0; ei < graph.edges.length; ei++) {\n const edge = graph.edges[ei]!\n const fromSegments = nodePositions[edge.from]\n const toSegments = nodePositions[edge.to]\n const curves = this.edgeCurves.get(ei)\n if (fromSegments?.length && toSegments?.length && curves) {\n // The control polygon's box, which contains the curve \u2014 the same\n // measure the geometry builder culls by, from the one function that\n // takes it.\n let { minX, minY, maxX, maxY } = curveBounds(curves)\n\n // Ribbons sit off the edge itself, so the box has to hold them too. Per\n // axis and off the offsets actually used, rather than one number on\n // both: the fan is perpendicular to the edge, so an edge running along\n // x spends all of it on y and none on x, and on a row layout the two\n // axes are not even in the same units.\n const numPaths = edge.pathIds?.length ?? 0\n if (drawPaths && numPaths > 0) {\n let padX = 0\n let padY = 0\n for (const o of pathRibbonOffsets(\n fromSegments,\n toSegments,\n numPaths,\n axis,\n )) {\n padX = Math.max(padX, Math.abs(o.x))\n padY = Math.max(padY, Math.abs(o.y))\n }\n minX -= padX\n minY -= padY\n maxX += padX\n maxY += padY\n }\n\n extentX += maxX - minX\n extentY += maxY - minY\n boxes.push({ ei, minX, minY, maxX, maxY })\n }\n }\n\n this.cellSize = resolveCellSize(cellSize, boxes, extentX, extentY)\n for (const b of boxes) {\n addToGrid(this.cells, this.cellSize, b.minX, b.minY, b.maxX, b.maxY, b.ei)\n }\n }\n\n getCurves(ei: number) {\n return this.edgeCurves.get(ei)\n }\n\n query(x: number, y: number, radiusX: number, radiusY = radiusX) {\n return queryGrid(this.cells, this.cellSize, x, y, radiusX, radiusY)\n }\n}\n", "import { EdgeSpatialIndex, SpatialIndex } from './SpatialIndex'\nimport { pathRibbonOffsets, translateCurves, yToXOf } from './geometry'\n\nimport type { DeletionRoutes } from '../layout/deletionRoutes'\nimport type { Graph, NodeSegment } from '../types'\nimport type { AxisScale, BezierCurve } from './geometry'\n\nexport function distanceToSegment(\n px: number,\n py: number,\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n) {\n const dx = x2 - x1\n const dy = y2 - y1\n const lenSq = dx * dx + dy * dy\n if (lenSq === 0) {\n return Math.hypot(px - x1, py - y1)\n }\n const t = Math.max(0, Math.min(1, ((px - x1) * dx + (py - y1) * dy) / lenSq))\n return Math.hypot(px - (x1 + t * dx), py - (y1 + t * dy))\n}\n\nexport function distanceToCubicBezier(\n px: number,\n py: number,\n x1: number,\n y1: number,\n cx1: number,\n cy1: number,\n cx2: number,\n cy2: number,\n x2: number,\n y2: number,\n) {\n // To the chords between samples, not to the samples: on a long curve they\n // are tens of px apart, and a cursor on the curve between two of them\n // measured as far off it as half that gap.\n let minDist = Infinity\n const samples = 20\n let lastX = x1\n let lastY = y1\n for (let i = 1; i <= samples; i++) {\n const t = i / samples\n const u = 1 - t\n const bx =\n u * u * u * x1 +\n 3 * u * u * t * cx1 +\n 3 * u * t * t * cx2 +\n t * t * t * x2\n const by =\n u * u * u * y1 +\n 3 * u * u * t * cy1 +\n 3 * u * t * t * cy2 +\n t * t * t * y2\n minDist = Math.min(minDist, distanceToSegment(px, py, lastX, lastY, bx, by))\n lastX = bx\n lastY = by\n }\n return minDist\n}\n\nfunction distanceToBezierCurve(px: number, py: number, c: BezierCurve) {\n return distanceToCubicBezier(\n px,\n py,\n c.x0,\n c.y0,\n c.cx0,\n c.cy0,\n c.cx1,\n c.cy1,\n c.x1,\n c.y1,\n )\n}\n\nfunction distanceToEdgeCurves(\n px: number,\n py: number,\n curves: BezierCurve[],\n yToX = 1,\n) {\n let minDist = Infinity\n for (const c of curves) {\n const d = distanceToBezierCurve(\n px,\n py,\n yToX === 1\n ? c\n : {\n x0: c.x0,\n y0: c.y0 * yToX,\n cx0: c.cx0,\n cy0: c.cy0 * yToX,\n cx1: c.cx1,\n cy1: c.cy1 * yToX,\n x1: c.x1,\n y1: c.y1 * yToX,\n },\n )\n if (d < minDist) {\n minDist = d\n }\n }\n return minDist\n}\n\n// Indexes are cached against the layout they were built from, in a WeakMap\n// rather than a module-level slot. A single slot meant two graph views in one\n// session evicted each other's index on alternating mousemoves, and held the last\n// graph's positions alive for as long as the tab lived. Keyed this way each view\n// keeps its own, and an entry becomes collectable when its layout is replaced.\n//\n// `version` still has to be compared: a node drag mutates the position objects in\n// place, so the identity of `nodePositions` cannot report that it changed.\nconst nodeCache = new WeakMap<\n Record<string, NodeSegment[]>,\n { version: number; index: SpatialIndex }\n>()\n\nfunction getSpatialIndex(\n nodePositions: Record<string, NodeSegment[]>,\n version: number,\n) {\n const cached = nodeCache.get(nodePositions)\n if (cached?.version === version) {\n return cached.index\n }\n const index = new SpatialIndex(nodePositions)\n nodeCache.set(nodePositions, { version, index })\n return index\n}\n\nconst edgeCache = new WeakMap<\n Record<string, NodeSegment[]>,\n {\n graph: Graph\n drawPaths: boolean\n // compared by VALUE, not by the AxisScale's identity: the model rebuilds\n // that object whenever either scale changes, so identity would miss a cache\n // hit on every mousemove\n scaleX: number\n scaleY: number\n version: number\n index: EdgeSpatialIndex\n deletions?: Map<number, string[]>\n routes?: DeletionRoutes\n }\n>()\n\nfunction getEdgeSpatialIndex(\n nodePositions: Record<string, NodeSegment[]>,\n graph: Graph,\n drawPaths: boolean,\n axis: AxisScale,\n version: number,\n deletions?: Map<number, string[]>,\n routes?: DeletionRoutes,\n) {\n const cached = edgeCache.get(nodePositions)\n if (\n cached?.graph === graph &&\n cached.drawPaths === drawPaths &&\n cached.scaleX === axis.scaleX &&\n cached.scaleY === axis.scaleY &&\n cached.version === version &&\n cached.deletions === deletions &&\n cached.routes === routes\n ) {\n return cached.index\n }\n const index = new EdgeSpatialIndex(\n nodePositions,\n graph,\n drawPaths,\n axis,\n undefined,\n deletions,\n version,\n routes,\n )\n edgeCache.set(nodePositions, {\n graph,\n drawPaths,\n scaleX: axis.scaleX,\n scaleY: axis.scaleY,\n version,\n index,\n deletions,\n routes,\n })\n return index\n}\n\n// Every distance below is measured with y converted into x units by `yToX` (the\n// model's scaleY / scaleX), because on a row layout the two axes are bp and\n// screen px and a raw hypot over them is not a distance at all \u2014 5 bp of x and\n// 5 px of y are nothing alike. The thresholds stay screen px over the x scale,\n// which is what they always were; on an isotropic layout yToX is 1 and this is\n// the arithmetic it has always done.\n//\n// `ink` is how far from its centreline each node is drawn, in screen px, and\n// the most any node is. A node drawn thick by its depth is 18 px across at the\n// defaults, and a fixed tolerance missed the pointer on its outer ink, where\n// the link beside it took the hover instead. MIN_NODE_REACH_PX keeps a thin\n// node catchable.\nconst MIN_NODE_REACH_PX = 5\n\nexport interface NodeInk {\n halfWidthPx: (nodeId: string) => number\n maxHalfWidthPx: number\n}\n\nexport function findHoveredNode(\n nodePositions: Record<string, NodeSegment[]>,\n graphX: number,\n graphY: number,\n axis: AxisScale,\n version = 0,\n ink?: NodeInk,\n) {\n const yToX = yToXOf(axis)\n const index = getSpatialIndex(nodePositions, version)\n const reach = (px: number) => Math.max(MIN_NODE_REACH_PX, px) / axis.scaleX\n // the query has to cover the thickest node there could be\n const queryReach = reach(ink?.maxHalfWidthPx ?? 0)\n const candidates = index.query(graphX, graphY, queryReach, queryReach / yToX)\n\n // The nearest candidate, not the first one inside its reach. The reach is in\n // world units, so when zoomed out it covers several nodes at once and \"first\"\n // meant whichever the grid happened to visit first \u2014 the cursor could sit on\n // one node and highlight its neighbour.\n let hovered: string | null = null\n let best = Infinity\n for (const { nodeId, segmentIdx } of candidates) {\n const segments = nodePositions[nodeId]!\n const dist = distanceToSegment(\n graphX,\n graphY * yToX,\n segments[segmentIdx]!.x,\n segments[segmentIdx]!.y * yToX,\n segments[segmentIdx + 1]!.x,\n segments[segmentIdx + 1]!.y * yToX,\n )\n if (dist < best && dist < reach(ink?.halfWidthPx(nodeId) ?? 0)) {\n best = dist\n hovered = nodeId\n }\n }\n return hovered\n}\n\nexport function findHoveredEdge(\n nodePositions: Record<string, NodeSegment[]>,\n graph: Graph,\n graphX: number,\n graphY: number,\n axis: AxisScale,\n drawPaths: boolean,\n version = 0,\n deletions?: Map<number, string[]>,\n hiddenEdges?: ReadonlySet<number>,\n deletionRoutes?: DeletionRoutes,\n) {\n const yToX = yToXOf(axis)\n const edgeThreshold = 10 / axis.scaleX\n const edgeIndex = getEdgeSpatialIndex(\n nodePositions,\n graph,\n drawPaths,\n axis,\n version,\n deletions,\n deletionRoutes,\n )\n const candidates = edgeIndex.query(\n graphX,\n graphY,\n edgeThreshold,\n edgeThreshold / yToX,\n )\n\n // Nearest, not first \u2014 same reason as findHoveredNode.\n let hovered: number | null = null\n let best = edgeThreshold\n for (const edgeIdx of candidates) {\n const edge = graph.edges[edgeIdx]!\n const fromSegments = nodePositions[edge.from]\n const toSegments = nodePositions[edge.to]\n if (\n !fromSegments?.length ||\n !toSegments?.length ||\n hiddenEdges?.has(edgeIdx)\n ) {\n continue\n }\n\n const numPaths = edge.pathIds?.length ?? 0\n const baseCurves = edgeIndex.getCurves(edgeIdx)\n if (!baseCurves) {\n continue\n }\n let dist: number\n\n if (!drawPaths || numPaths === 0) {\n dist = distanceToEdgeCurves(graphX, graphY * yToX, baseCurves, yToX)\n } else {\n // The same offsets GeometryBuilder drew the ribbons at, from the one\n // function that decides them, so a ribbon is hoverable where it is drawn.\n let minDist = Infinity\n for (const offset of pathRibbonOffsets(\n fromSegments,\n toSegments,\n numPaths,\n axis,\n )) {\n const curves =\n offset.x === 0 && offset.y === 0\n ? baseCurves\n : translateCurves(baseCurves, offset.x, offset.y)\n const d = distanceToEdgeCurves(graphX, graphY * yToX, curves, yToX)\n if (d < minDist) {\n minDist = d\n }\n }\n dist = minDist\n }\n\n if (dist < best) {\n best = dist\n hovered = edgeIdx\n }\n }\n return hovered\n}\n", "const ZOOM_PER_NOTCH = 1.1\nconst NOTCH_PX = 100\nconst LINE_PX = 40\nconst PAGE_PX = 800\nconst PINCH_GAIN = 10\nconst MAX_NOTCHES_PER_EVENT = 2\n\n// Zoom by how far the wheel moved rather than by one step per event. A mouse\n// sends one event of about NOTCH_PX per notch and still zooms ZOOM_PER_NOTCH;\n// a trackpad sends sixty small ones a second, which at a step each compounded\n// to hundreds of times per second. A pinch arrives as ctrl+wheel with deltas a\n// tenth the size. The delta is normalized here rather than with core's\n// normalizeWheelDelta, which a released host may not export.\nexport function wheelZoomFactor(e: {\n deltaY: number\n deltaMode: number\n ctrlKey: boolean\n}) {\n const px =\n e.deltaY * (e.deltaMode === 1 ? LINE_PX : e.deltaMode === 2 ? PAGE_PX : 1)\n const notches = ((e.ctrlKey ? PINCH_GAIN : 1) * px) / NOTCH_PX\n return (\n ZOOM_PER_NOTCH **\n -Math.max(-MAX_NOTCHES_PER_EVENT, Math.min(MAX_NOTCHES_PER_EVENT, notches))\n )\n}\n", "import { useId } from 'react'\n\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\n// The session's genes drawn onto the graph: each exon outlined in the gene\n// track's CDS colour, a rounded box around the backbone stretch that carries\n// it, in layout units, moved by the same transform the halos use. The box\n// clears the node's ink, lifted lanes included, so a node or lane keeps its\n// colour inside it and an exon on a faded node reads as well as one on a lane.\n// Their names are LabelLayer's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 2,\n}\n\nexport const EXON_COLOR = '#daa520'\n// a lifted walk's lane at the least, as the geometry draws it\nconst MIN_LANE_PX = 4\nconst EXON_GAP_PX = 1\nconst EXON_LINE_PX = 2\n\nconst GenePins = observer(function GenePins({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const maskId = `exon-outline-${useId().replaceAll(/[^\\w-]/g, '')}`\n const { genePins, walkLift, nodeInk } = model\n if (genePins.length === 0) {\n return null\n }\n const {\n scaleX,\n scaleY,\n translateX,\n translateY,\n paneWidth: width,\n canvasHeight,\n } = model\n const inkPx = (nodeId: string) => {\n const own = nodeInk.halfWidthPx(nodeId) * 2\n return walkLift?.nodeIds.has(nodeId)\n ? Math.max(own, walkLift.walks.length * MIN_LANE_PX)\n : own\n }\n const stretches = genePins.flatMap(pin =>\n pin.exonsByNode.map(({ nodeId, d }) => ({\n key: `${pin.gene.name}-${pin.gene.start}-${nodeId}`,\n d,\n inner: inkPx(nodeId) + 2 * EXON_GAP_PX,\n })),\n )\n const transform = `translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`\n const stroke = {\n fill: 'none',\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n vectorEffect: 'non-scaling-stroke',\n }\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-gene-pins\"\n >\n <mask\n id={maskId}\n maskUnits=\"userSpaceOnUse\"\n x={0}\n y={0}\n width={width}\n height={canvasHeight}\n >\n <g transform={transform}>\n {stretches.map(s => (\n <path\n key={s.key}\n d={s.d}\n stroke=\"#fff\"\n strokeWidth={s.inner + 2 * EXON_LINE_PX}\n {...stroke}\n />\n ))}\n {stretches.map(s => (\n <path\n key={s.key}\n d={s.d}\n stroke=\"#000\"\n strokeWidth={s.inner}\n {...stroke}\n />\n ))}\n </g>\n </mask>\n <rect\n width={width}\n height={canvasHeight}\n fill={EXON_COLOR}\n mask={`url(#${maskId})`}\n />\n </svg>\n )\n})\n\nexport default GenePins\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2\"\n}), 'CropFree');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon([/*#__PURE__*/_jsx(\"path\", {\n d: \"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14\"\n}, \"0\"), /*#__PURE__*/_jsx(\"path\", {\n d: \"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z\"\n}, \"1\")], 'ZoomIn');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z\"\n}), 'ZoomOut');", "import CropFreeIcon from '@mui/icons-material/CropFree'\nimport ZoomInIcon from '@mui/icons-material/ZoomIn'\nimport ZoomOutIcon from '@mui/icons-material/ZoomOut'\nimport { IconButton, Tooltip, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport ColorSchemeSelect from './ColorSchemeSelect'\nimport GraphStats from './GraphStats'\nimport LayoutSelect from './LayoutSelect'\nimport RepeatSelect from './RepeatSelect'\nimport SettingsMenu from './SettingsMenu'\nimport WalkSelect from './WalkSelect'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n toolbar: {\n display: 'flex',\n alignItems: 'center',\n gap: 4,\n padding: '2px 4px',\n borderBottom: '1px solid #ddd',\n },\n})\n\nconst ZoomDisplay = observer(function ZoomDisplay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return <Typography variant=\"body2\">{model.zoomPercent}</Typography>\n})\n\nconst GraphToolbar = observer(function GraphToolbar({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n return (\n <div className={classes.toolbar}>\n <LayoutSelect model={model} />\n <ColorSchemeSelect model={model} />\n <WalkSelect model={model} />\n <RepeatSelect model={model} />\n <Tooltip title=\"Zoom in\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoom(1.5, model.viewBox.width / 2, model.viewBox.height / 2)\n }}\n >\n <ZoomInIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Zoom out\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoom(\n 1 / 1.5,\n model.viewBox.width / 2,\n model.viewBox.height / 2,\n )\n }}\n >\n <ZoomOutIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Zoom to fit\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoomToFit()\n }}\n >\n <CropFreeIcon />\n </IconButton>\n </Tooltip>\n <ZoomDisplay model={model} />\n <GraphStats model={model} />\n <SettingsMenu model={model} />\n </div>\n )\n})\n\nexport default GraphToolbar\n", "import { COLOR_SCHEMES } from '@jbrowse/bandage-core/colorSchemes'\nimport { FormControl, InputLabel, MenuItem, Select } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 100,\n },\n})\n\nconst ColorSchemeSelect = observer(function ColorSchemeSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const fixed = model.colorSchemeLock\n return (\n <FormControl\n size=\"small\"\n className={classes.formControl}\n disabled={fixed !== undefined}\n title={fixed?.why}\n >\n <InputLabel>Color</InputLabel>\n <Select\n value={model.chosenColorScheme}\n label=\"Color\"\n renderValue={fixed ? () => fixed.value : undefined}\n onChange={e => {\n model.setColorScheme(e.target.value)\n }}\n >\n {COLOR_SCHEMES.map(({ value, label }) => (\n <MenuItem key={value} value={value}>\n {label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default ColorSchemeSelect\n", "import { Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n stats: {\n marginLeft: 'auto',\n },\n perf: {\n color: '#888',\n fontVariantNumeric: 'tabular-nums',\n },\n})\n\nfunction fmtMs(ms: number | undefined) {\n return ms === undefined ? '\u2013' : `${Math.round(ms)}ms`\n}\n\n// The perf READOUT, off by default: it sat in the toolbar of every published\n// graph figure, where one machine's fetch time is a number a reader has to work\n// out is not about them. `showPerf` is in the settings menu.\n//\n// The numbers themselves are not conditional \u2014 they ride the stats element's\n// data-* attributes either way (see GraphStats), so a browser test asserting a\n// timing budget never depends on a display setting, and turning the text off\n// costs no coverage. They live there rather than on this element so that\n// switching the text off leaves no empty node behind to carry them.\nconst GraphPerf = observer(function GraphPerf({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { lastFetchMs, lastLayoutMs, lastGeometryMs } = model\n const hasMetrics =\n lastFetchMs !== undefined ||\n lastLayoutMs !== undefined ||\n lastGeometryMs !== undefined\n return model.showPerf && hasMetrics ? (\n <Typography\n variant=\"caption\"\n className={classes.perf}\n data-testid=\"graph-perf-stats\"\n >\n fetch {fmtMs(lastFetchMs)} \u00B7 layout {fmtMs(lastLayoutMs)} \u00B7 geom{' '}\n {fmtMs(lastGeometryMs)}\n </Typography>\n ) : null\n})\n\nconst GraphStats = observer(function GraphStats({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n return (\n <div\n className={classes.stats}\n data-testid=\"graph-stats\"\n data-node-count={model.nodeCount}\n data-edge-count={model.edgeCount}\n data-path-count={model.pathCount}\n // unconditional, whatever `showPerf` is doing to the text beside them \u2014\n // see GraphPerf\n data-fetch-ms={model.lastFetchMs ?? ''}\n data-layout-ms={model.lastLayoutMs ?? ''}\n data-geometry-ms={model.lastGeometryMs ?? ''}\n data-geometry-strokes={model.lastGeometryStrokeCount ?? ''}\n >\n <Typography variant=\"body2\" component=\"span\">\n {model.nodeCount} nodes, {model.edgeCount} edges\n {model.pathCount > 0 ? `, ${model.pathCount} paths` : ''}\n </Typography>{' '}\n <GraphPerf model={model} />\n </div>\n )\n})\n\nexport default GraphStats\n", "import { LAYOUT_MODES } from '@jbrowse/bandage-core/layoutModes'\nimport {\n FormControl,\n InputLabel,\n MenuItem,\n Select,\n Tooltip,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 150,\n },\n})\n\nconst LayoutSelect = observer(function LayoutSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { graph } = model\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Layout</InputLabel>\n <Select\n value={model.chosenLayoutMode}\n label=\"Layout\"\n data-testid=\"graph-layout-select\"\n onChange={e => {\n void model.switchLayout(e.target.value)\n }}\n >\n {LAYOUT_MODES.map(({ value, label, description, available }) => (\n <MenuItem\n key={value}\n value={value}\n disabled={graph ? !available(graph) : false}\n >\n <Tooltip title={description} placement=\"right\">\n <span>{label}</span>\n </Tooltip>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default LayoutSelect\n", "import { FormControl, InputLabel, MenuItem, Select } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 130,\n maxWidth: 240,\n },\n})\n\n// Which tandem repeat array the walk rows measure between and tile by, from\n// the session's repeat annotation over the window. Only the walk rows read it.\nconst RepeatSelect = observer(function RepeatSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { repeatChoices } = model\n if (model.chosenLayoutMode !== 'walkrows' || repeatChoices.length === 0) {\n return null\n }\n const keys = new Set(repeatChoices.map(r => r.key))\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Repeat</InputLabel>\n <Select\n value={keys.has(model.repeatKey) ? model.repeatKey : ''}\n label=\"Repeat\"\n data-testid=\"graph-repeat-select\"\n onChange={e => {\n model.setRepeatKey(e.target.value)\n }}\n >\n <MenuItem value=\"\">\n <em>Whole window</em>\n </MenuItem>\n {repeatChoices.map(({ key, name, unit }) => (\n <MenuItem key={key} value={key}>\n {name} \u00B7 {unit.toLocaleString()} bp unit\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default RepeatSelect\n", "import { useState } from 'react'\n\nimport { CascadingMenuButton } from '@jbrowse/core/ui'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport MoreVertIcon from '@mui/icons-material/MoreVert'\nimport SettingsIcon from '@mui/icons-material/Settings'\nimport { observer } from 'mobx-react'\n\nimport GraphSettingsDialog from './GraphSettingsDialog'\n\nimport type { GraphPaneModel } from '../model'\n\nconst SettingsMenu = observer(function SettingsMenu({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const [settingsOpen, setSettingsOpen] = useState(false)\n\n return (\n <>\n <CascadingMenuButton\n size=\"small\"\n menuItems={[\n {\n type: 'checkbox' as const,\n label: 'Linear layout',\n checked: model.linearLayout,\n onClick: () => {\n model.setLinearLayout(!model.linearLayout)\n void model.recomputeLayout()\n },\n },\n {\n type: 'checkbox' as const,\n label: 'Show deletion edges',\n checked: model.showDeletionEdges,\n onClick: () => {\n model.setShowDeletionEdges(!model.showDeletionEdges)\n },\n },\n {\n type: 'checkbox' as const,\n label: 'Show timings',\n checked: model.showPerf,\n onClick: () => {\n model.setShowPerf(!model.showPerf)\n },\n },\n { type: 'divider' as const },\n {\n label: 'Settings',\n icon: SettingsIcon,\n onClick: () => {\n setSettingsOpen(true)\n },\n },\n { type: 'divider' as const },\n {\n label: 'Return to import form',\n icon: DeleteIcon,\n onClick: () => {\n model.clearGraph()\n },\n },\n ]}\n >\n <MoreVertIcon />\n </CascadingMenuButton>\n\n <GraphSettingsDialog\n model={model}\n open={settingsOpen}\n onClose={() => {\n setSettingsOpen(false)\n }}\n />\n </>\n )\n})\n\nexport default SettingsMenu\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z\"\n}), 'Delete');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2\"\n}), 'MoreVert');", "import {\n Checkbox,\n FormControl,\n InputLabel,\n ListItemText,\n MenuItem,\n Select,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 130,\n maxWidth: 260,\n },\n})\n\n// Which walks to lift out of the drawing: Bandage's path highlight, for as many\n// of the haplotypes a GBZ cut carries as the reader picks. Absent from a graph\n// with no walks, and from a tube map, whose tubes are the walks.\nconst WalkSelect = observer(function WalkSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { walkChoices } = model\n if (walkChoices.length === 0 || !model.liftsWalks) {\n return null\n }\n const names = new Set(walkChoices.map(c => c.name))\n const labels = new Map(walkChoices.map(c => [c.name, c.label]))\n const picked = model.walkLayers\n .map(layer => layer.walk)\n .filter(name => names.has(name))\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Walks</InputLabel>\n <Select\n multiple\n value={picked}\n label=\"Walks\"\n data-testid=\"graph-walk-select\"\n renderValue={selected => selected.map(n => labels.get(n)).join(', ')}\n onChange={e => {\n const { value } = e.target\n model.liftWalks(typeof value === 'string' ? value.split(',') : value)\n }}\n >\n {walkChoices.map(({ name, label }) => (\n <MenuItem key={name} value={name} dense>\n <Checkbox size=\"small\" checked={picked.includes(name)} />\n <ListItemText primary={label} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default WalkSelect\n", "import { BUBBLE_KIND_COLORS } from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { geneCoverageNote } from '@jbrowse/bandage-core/labelLayout'\nimport { LABEL_PX } from '@jbrowse/bandage-core/overlayLabels'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { observer } from 'mobx-react'\n\nimport { EXON_COLOR } from './GenePins'\nimport LabelChip from './LabelChip'\n\nimport type { GraphPaneModel } from '../model'\nimport type {\n BubbleHalo,\n RouteLabel,\n} from '@jbrowse/bandage-core/bubbles/bubbleHalos'\n\n// Every chip drawn over the graph, above all of its ink: bubble names, gene\n// names on their pins, and the routes' walkers. `overlayLabels` has placed\n// them against each other and against the row labels already.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 3,\n}\n\nconst GENE_INK = '#1c1c22'\n\nconst LabelLayer = observer(function LabelLayer({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbles, genes, routes } = model.overlayLabels\n if (bubbles.length + genes.length + routes.length === 0) {\n return null\n }\n const { walkLift, scaleY, translateY, contigThickness } = model\n // lifted walks dim the bubbles none of them enters and the routes none of\n // them takes\n const dimmedBubble = (h: BubbleHalo) =>\n walkLift !== undefined && !h.nodeIds.some(id => walkLift.nodeIds.has(id))\n const dimmedRoute = (r: RouteLabel) =>\n walkLift !== undefined && !r.route.walks.some(w => walkLift.names.has(w))\n\n return (\n <svg\n style={svgStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n data-testid=\"graph-label-layer\"\n >\n {genes.map(({ item: pin, x, y, w, text }) => {\n const { gene } = pin\n const note = geneCoverageNote(pin)\n return (\n <g key={`${gene.name}-${gene.start}`}>\n <line\n x1={x}\n x2={x}\n y1={y - LABEL_PX - 2}\n y2={pin.at.y * scaleY + translateY + contigThickness / 2}\n stroke={GENE_INK}\n strokeWidth={0.8}\n strokeOpacity={0.6}\n />\n <LabelChip\n x={x}\n y={y}\n w={w}\n text={gene.name}\n note={text.slice(gene.name.length) || undefined}\n color={GENE_INK}\n edge={EXON_COLOR}\n italic\n title={`${gene.name} ${gene.refName}:${gene.start.toLocaleString()}-${gene.end.toLocaleString()}${note ? `, ${note} in the cut` : ''}`}\n testId=\"graph-gene-pin-label\"\n />\n </g>\n )\n })}\n {routes.map(({ item: { halo: h, route }, x, y, w, text }) => (\n <LabelChip\n key={`${h.bubble.start}-${h.bubble.end}-${route.route.steps.join(',')}`}\n x={x}\n y={y}\n w={w}\n text={text}\n color={BUBBLE_KIND_COLORS[h.kind]}\n small\n dimmed={dimmedRoute(route)}\n title={`${route.route.walks.length} walk(s): ${route.route.walks.join(', ')}`}\n testId=\"graph-route-label\"\n />\n ))}\n {bubbles.map(({ item: h, x, y, w, text }) => (\n <LabelChip\n key={`${h.bubble.start}-${h.bubble.end}`}\n x={x}\n y={y}\n w={w}\n text={text}\n color={BUBBLE_KIND_COLORS[h.kind]}\n dimmed={dimmedBubble(h)}\n title={`${h.label}\\n${h.bubble.segmentCount} segments \u00B7 click to open`}\n testId=\"graph-bubble-halo-label\"\n onClick={() => {\n void model.popBubble(h.bubble)\n }}\n // a leave also fires as the view closing it unmounts the chip\n onHover={hovered => {\n if (isAlive(model)) {\n model.setHoveredBubble(hovered ? h.bubble : null)\n }\n }}\n />\n ))}\n </svg>\n )\n})\n\nexport default LabelLayer\n", "import { LABEL_PAD, LABEL_PX } from '@jbrowse/bandage-core/overlayLabels'\n\n// One label on an overlay: a white chip with a coloured edge and text, its\n// baseline at y and centred on x. A note follows the text in plain type.\nexport default function LabelChip({\n x,\n y,\n w,\n text,\n note,\n color,\n edge = color,\n italic,\n small,\n dimmed,\n title,\n testId,\n onClick,\n onHover,\n}: {\n x: number\n y: number\n w: number\n text: string\n note?: string\n color: string\n edge?: string\n italic?: boolean\n small?: boolean\n dimmed?: boolean\n title?: string\n testId?: string\n onClick?: () => void\n onHover?: (hovered: boolean) => void\n}) {\n return (\n <g\n style={{\n pointerEvents: onClick || onHover ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : undefined,\n opacity: dimmed ? 0.35 : 1,\n }}\n data-testid={testId}\n onClick={onClick}\n onMouseEnter={() => {\n onHover?.(true)\n }}\n onMouseLeave={() => {\n onHover?.(false)\n }}\n >\n {title ? <title>{title}</title> : null}\n <rect\n x={x - w / 2}\n y={y - LABEL_PX - LABEL_PAD + 2}\n width={w}\n height={LABEL_PX + LABEL_PAD * 2 - 2}\n rx={3}\n fill=\"rgba(255,255,255,0.85)\"\n stroke={edge}\n strokeWidth={small ? 0.6 : 1}\n />\n <text\n x={x}\n y={y}\n fontSize={small ? LABEL_PX - 1 : LABEL_PX}\n fontFamily=\"sans-serif\"\n fontStyle={italic ? 'italic' : undefined}\n fontWeight={italic ? 600 : undefined}\n fill={color}\n textAnchor=\"middle\"\n >\n {text}\n {note ? (\n <tspan fontStyle=\"normal\" fontWeight=\"normal\">\n {note}\n </tspan>\n ) : null}\n </text>\n </g>\n )\n}\n", "import { useEffect, useRef } from 'react'\n\nimport { drawReferenceStrip } from '@jbrowse/bandage-core/referenceStrip'\nimport { LIFT_BACKDROP_CSS } from '@jbrowse/bandage-core/renderer/GeometryBuilder'\nimport { encodingSwatchCss } from '@jbrowse/bandage-core/walkEncoding'\nimport { getDpr } from '@jbrowse/render-core/canvas2dUtils'\nimport { autorun } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\n\nconst canvasStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n zIndex: 5,\n}\n\n// Each reference segment at its bp in the linear view, over a drawing that\n// has no bp axis of its own. Repainted by an autorun, so a pan in the linear\n// view moves the strip in the same frame as its other tracks.\nconst ReferenceStripOverlay = observer(function ReferenceStripOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { referenceStripShown, paneWidth, canvasHeight } = model\n useEffect(\n () =>\n autorun(() => {\n const canvas = ref.current\n const frame = model.referenceStripFrame\n const ctx = canvas?.getContext('2d')\n if (canvas && ctx && frame && model.referenceStripShown) {\n const dpr = getDpr()\n const width = model.paneWidth\n const height = model.canvasHeight\n canvas.width = Math.round(width * dpr)\n canvas.height = Math.round(height * dpr)\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0)\n ctx.clearRect(0, 0, width, height)\n drawReferenceStrip(ctx, model.referenceStripBlocks, frame, {\n width,\n lit: model.referenceStripLit,\n darkMode: model.darkMode,\n dpr,\n })\n }\n }),\n [model],\n )\n return (\n <canvas\n ref={ref}\n data-testid={referenceStripShown ? 'graph-reference-strip' : undefined}\n style={{\n ...canvasStyle,\n width: paneWidth,\n height: canvasHeight,\n display: referenceStripShown ? 'block' : 'none',\n }}\n />\n )\n})\n\nexport default ReferenceStripOverlay\n\nconst SWATCH_PX = 18\n\nconst RAMP_SWATCH =\n 'linear-gradient(to right, hsl(0, 70%, 50%) 0 33%, hsl(120, 70%, 50%) 33% 61%, hsl(240, 70%, 50%) 61%)'\n\n// A scheme other than the ramp shows a few of the strip's own blocks in bp\n// order, as the strip draws them, rather than a rainbow it does not\nconst SAMPLED_BLOCKS = 6\n\nfunction sampledSwatch(colors: string[]) {\n const distinct = colors.filter((c, i) => c !== colors[i - 1])\n const n = Math.min(SAMPLED_BLOCKS, distinct.length)\n const picked = Array.from(\n { length: n },\n (_, i) =>\n distinct[n > 1 ? Math.round((i * (distinct.length - 1)) / (n - 1)) : 0]!,\n )\n return picked.length > 1\n ? `linear-gradient(to right, ${picked.join(', ')})`\n : (picked[0] ?? LIFT_BACKDROP_CSS)\n}\n\n// the strip's own colours: a row per lifted walk in its lane's, else the\n// node scheme's\nfunction StripSwatch({\n rows,\n}: {\n rows: { key: string; background: string }[]\n}) {\n return (\n <div style={{ width: SWATCH_PX, flex: 'none' }}>\n {rows.map(({ key, background }) => (\n <div\n key={key}\n style={{ height: rows.length > 1 ? 3 : 4, background }}\n />\n ))}\n </div>\n )\n}\n\nfunction stripRows(model: GraphPaneModel) {\n return (\n model.walkLift?.walks.map(w => ({\n key: w.name,\n background: encodingSwatchCss(w.encoding),\n })) ?? [\n {\n key: 'scheme',\n background:\n model.effectiveColorScheme === 'reference-position'\n ? RAMP_SWATCH\n : sampledSwatch(model.referenceStripBlocks.map(b => b.colors[0]!)),\n },\n ]\n )\n}\n\nfunction OverhangSwatch() {\n return (\n <svg width={SWATCH_PX} height={10} style={{ flex: 'none' }}>\n <path d=\"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z\" fill=\"#18181c\" />\n </svg>\n )\n}\n\n// Hovering a node boxes its span on the strip and draws a leader to it\nexport const ReferenceStripLegend = observer(function ReferenceStripLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const rowPerWalk = (model.walkLift?.walks.length ?? 0) > 1\n return model.referenceStripShown ? (\n <div style={legendBoxStyle} data-testid=\"graph-reference-strip-legend\">\n <div style={legendRowStyle}>\n <StripSwatch rows={stripRows(model)} />\n <span>\n top strip: reference segments at their bp\n {rowPerWalk ? ', a row per walk' : ''}\n </span>\n </div>\n {model.referenceStripFaded ? (\n <div style={legendRowStyle}>\n <StripSwatch\n rows={[{ key: 'pale', background: LIFT_BACKDROP_CSS }]}\n />\n <span>\n reference not on{' '}\n {rowPerWalk ? \"that row's walk\" : model.liftedWalksLabel}\n </span>\n </div>\n ) : null}\n {model.referenceStripOverhangs ? (\n <div style={legendRowStyle}>\n <OverhangSwatch />\n <span>the graph draws reference past this edge</span>\n </div>\n ) : null}\n </div>\n ) : null\n})\n", "import { useEffect, useRef } from 'react'\nimport type { ReactNode } from 'react'\n\nimport { formatBp } from '@jbrowse/bandage-core/graphLabels'\nimport { drawTubeMapRuler, rulerInk } from '@jbrowse/bandage-core/tubeMap/axis'\nimport { drawTubeMapConnectors } from '@jbrowse/bandage-core/tubeMap/connectors'\nimport {\n deviationInk,\n drawDeviationMarks,\n} from '@jbrowse/bandage-core/tubeMap/deviations'\nimport { drawTubeMap } from '@jbrowse/bandage-core/tubeMap/draw'\nimport { drawTubeMapGenes } from '@jbrowse/bandage-core/tubeMap/genes'\nimport {\n FORWARD_READ_COLORS,\n REVERSE_READ_COLORS,\n} from '@jbrowse/bandage-core/tubeMap/reads'\nimport { getDpr } from '@jbrowse/render-core/canvas2dUtils'\nimport { autorun } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\n\nconst canvasStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n zIndex: 1,\n}\n\n// The tube map's ink, over the canvas, which draws nothing under a tube map\n// layout. Above the tubes go the session's genes in a view of its own, or in\n// a linear view the bands tying each reference box to its bp there; under\n// them a reference ruler, unless the linear view's is already the axis.\n// Repainted by an autorun on every change of transform, so a pan in the linear\n// view above moves the tubes in the same frame as its other tracks.\nconst TubeMapOverlay = observer(function TubeMapOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { tubeMapPicture, paneWidth, canvasHeight } = model\n useEffect(\n () =>\n autorun(() => {\n const canvas = ref.current\n const picture = model.tubeMapPicture\n const frame = model.tubeMapFrame\n const ctx = canvas?.getContext('2d')\n if (canvas && ctx && picture && frame) {\n const dpr = getDpr()\n const width = model.paneWidth\n const height = model.canvasHeight\n canvas.width = Math.round(width * dpr)\n canvas.height = Math.round(height * dpr)\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0)\n ctx.clearRect(0, 0, width, height)\n const tubeFrame = {\n ...frame,\n width,\n highlightNode: model.hoveredNode ?? model.selectedNode,\n darkMode: model.darkMode,\n tubeColors: model.tubeMapTubeColors,\n nodeColors: model.tubeMapNodeColors,\n }\n drawTubeMap(ctx, picture, tubeFrame)\n drawDeviationMarks(ctx, model.tubeMapDeviations, tubeFrame)\n drawTubeMapConnectors(\n ctx,\n model.tubeMapConnectors,\n model.connectorZoneBottom,\n tubeFrame,\n )\n const { bounds } = picture\n drawTubeMapGenes(\n ctx,\n model.tubeMapGenes,\n tubeFrame,\n frame.y(bounds.minY) - 2,\n )\n const boxes = model.tubeMapRulerBoxes\n if (boxes) {\n drawTubeMapRuler(\n ctx,\n boxes,\n tubeFrame,\n frame.y(bounds.maxY) + 4,\n model.layoutResult?.referenceAxis,\n )\n }\n }\n }),\n [model],\n )\n // Mounted whether or not there is a tube map, so the autorun above has its\n // canvas the moment a layout brings one.\n return (\n <canvas\n ref={ref}\n data-testid={tubeMapPicture ? 'graph-tube-map' : undefined}\n style={{\n ...canvasStyle,\n width: paneWidth,\n height: canvasHeight,\n display: tubeMapPicture ? 'block' : 'none',\n }}\n />\n )\n})\n\nexport default TubeMapOverlay\n\nconst SWATCH_PX = 18\n\n// Two boxes' brackets, as the ruler draws them under every box\nfunction BracketSwatch() {\n const brackets = [\n [0.5, 5.5],\n [8.5, SWATCH_PX - 0.5],\n ]\n return (\n <svg width={SWATCH_PX} height={7} style={{ flex: 'none' }}>\n <path\n d={brackets.map(([x0, x1]) => `M${x0},6 V1.5 H${x1} V6`).join(' ')}\n fill=\"none\"\n stroke={rulerInk()}\n strokeWidth={1}\n />\n </svg>\n )\n}\n\nconst barSwatchStyle = { width: SWATCH_PX, height: 7, flex: 'none' }\n\nconst tubeSwatchStyle = {\n ...barSwatchStyle,\n display: 'flex',\n justifyContent: 'center',\n backgroundColor: '#b8b8c0',\n}\n\nfunction TickSwatch() {\n return (\n <div style={tubeSwatchStyle}>\n <div style={{ width: 2, backgroundColor: deviationInk() }} />\n </div>\n )\n}\n\n// A read takes one shade of its strand's palette, varied so neighbours differ\nfunction ReadSwatch({ colors }: { colors: readonly string[] }) {\n const step = 100 / colors.length\n const stops = colors.map((c, i) => `${c} ${i * step}% ${(i + 1) * step}%`)\n return (\n <div\n style={{\n ...barSwatchStyle,\n background: `linear-gradient(to right, ${stops.join(', ')})`,\n }}\n />\n )\n}\n\nconst glyphSwatchStyle = {\n width: SWATCH_PX,\n flex: 'none',\n textAlign: 'center' as const,\n fontFamily: 'monospace',\n fontSize: 12,\n}\n\nfunction DeletionSwatch() {\n return <div style={{ ...barSwatchStyle, backgroundColor: 'grey' }} />\n}\n\nfunction LegendRow({\n swatch,\n children,\n}: {\n swatch: ReactNode\n children: ReactNode\n}) {\n return (\n <div style={legendRowStyle}>\n {swatch}\n <span>{children}</span>\n </div>\n )\n}\n\n// What a tube map draws that nothing else on screen explains, each listed\n// only while it applies\nexport const TubeMapLegend = observer(function TubeMapLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { logWidths, foldBp, forwardReads, reverseReads, mismatches } =\n model.tubeMapKeys\n const rows = [\n forwardReads && (\n <LegendRow key=\"fwd\" swatch={<ReadSwatch colors={FORWARD_READ_COLORS} />}>\n read on the forward strand\n </LegendRow>\n ),\n reverseReads && (\n <LegendRow key=\"rev\" swatch={<ReadSwatch colors={REVERSE_READ_COLORS} />}>\n read on the reverse strand\n </LegendRow>\n ),\n mismatches.has('substitution') && (\n <LegendRow key=\"sub\" swatch={<span style={glyphSwatchStyle}>A</span>}>\n a read's base unlike the node's\n </LegendRow>\n ),\n mismatches.has('insertion') && (\n <LegendRow key=\"ins\" swatch={<span style={glyphSwatchStyle}>*</span>}>\n bases a read inserts\n </LegendRow>\n ),\n mismatches.has('deletion') && (\n <LegendRow key=\"del\" swatch={<DeletionSwatch />}>\n bases a read skips\n </LegendRow>\n ),\n foldBp !== undefined && (\n <LegendRow key=\"fold\" swatch={<TickSwatch />}>\n a haplotype's variant under {formatBp(foldBp)}\n </LegendRow>\n ),\n logWidths && (\n <LegendRow key=\"log\" swatch={<BracketSwatch />}>\n width grows with log of length\n </LegendRow>\n ),\n ].filter(Boolean)\n return rows.length > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-tube-map-legend\">\n {rows}\n </div>\n ) : null\n})\n", "import { Button } from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\nconst style = {\n position: 'absolute' as const,\n left: 8,\n zIndex: 5,\n background: 'rgba(255,255,255,0.9)',\n textTransform: 'none' as const,\n}\n\nconst UnpopButton = observer(function UnpopButton({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { poppedFrom } = model\n return poppedFrom ? (\n <Button\n size=\"small\"\n variant=\"outlined\"\n style={{ ...style, ...(model.facetPanels ? { bottom: 8 } : { top: 8 }) }}\n data-testid=\"graph-unpop-bubble\"\n onClick={() => {\n void model.unpopBubble()\n }}\n >\n \u25C0 Back to {poppedFrom.label}\n </Button>\n ) : null\n})\n\nexport default UnpopButton\n", "import { Menu } from '@jbrowse/core/ui'\nimport LineStyleIcon from '@mui/icons-material/LineStyle'\nimport { observer } from 'mobx-react'\n\nimport { locLabel } from '../../launchFromGraph/contributors'\n\nimport type { GraphPaneModel } from '../model'\nimport type { WalkRows } from '@jbrowse/bandage-core/layout/walkRows'\n\n// A walk row's bar stands for a span of its haplotype's own contig, so the\n// question a right-click asks is answered by a linear view on that assembly,\n// with its genes\nexport const WalkRowContextMenu = observer(function WalkRowContextMenu({\n model,\n row,\n bars,\n top,\n left,\n onClose,\n}: {\n model: GraphPaneModel\n row: number\n // the rows `row` indexes, walk rows' own unless a strip's\n bars?: WalkRows\n top: number\n left: number\n onClose: () => void\n}) {\n const target = model.walkRowLaunchTarget(row, bars ?? model.walkRowBars)\n const assembly = target?.assembly\n return (\n <Menu\n open\n anchorReference=\"anchorPosition\"\n anchorPosition={{ top, left }}\n onClose={() => {\n onClose()\n }}\n onMenuItemClick={callback => {\n callback()\n }}\n menuItems={[\n target && assembly\n ? {\n label: `Linear genome view \u2014 ${assembly} ${locLabel(target.location)}`,\n icon: LineStyleIcon,\n onClick: () => {\n model.showInLinearView({ location: target.location, assembly })\n },\n }\n : {\n label: 'Linear genome view',\n icon: LineStyleIcon,\n disabled: true,\n disabledHelpText: target\n ? `No assembly in this session is ${target.location.haplotype ?? target.label}`\n : 'This walk states no contig coordinates',\n onClick: () => {},\n },\n ]}\n />\n )\n})\n", "import { useId } from 'react'\n\nimport {\n BAR_PX,\n DISAGREES,\n GAP_PX,\n GENE_INK,\n walkRowsKey,\n walkRowsTree,\n} from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport { RAMP_GRADIENT_CSS } from '@jbrowse/bandage-core/referenceRampCss'\nimport { observer } from 'mobx-react'\n\nimport ElTree from './ElTree'\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\nimport { CALL_TOLERANCE } from '../repeats/walkCalls'\n\nimport type { GraphPaneModel } from '../model'\nimport type { KeySwatch } from '@jbrowse/bandage-core/layout/walkRowDraw'\n\n// The walk-rows layout's bars: one per haplotype walk under the reference\n// row, each on its own bp axis from the window's left edge, drawn from core's\n// walkRowsTree: runs coloured by whether they are on the reference walk's\n// path, unit separators, each row's genes from its own assembly's\n// annotation, the allele a repeat genotype called and a readout. Under the\n// reference-position ramp an aligned run takes the hue of the reference it is\n// threaded through. In a tandem array that is the aligner's pick among\n// near-identical copies, so the hue says which reference copy the graph used,\n// not which one a copy resembles.\n//\n// The walk rows pair a repeat record's allele with each walk \u2014 see\n// repeats/walkCalls.ts, which also holds the threshold a red readout is read\n// off. Colouring each copy by its unit is jbrowse-plugin-tandem-repeat's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 3,\n}\n\nconst CALL_TICK = '#111'\nconst UNBACKED_TICK = '#9e9e9e'\n\nconst swatchStyle = { width: 18, height: BAR_PX - 4, borderRadius: 2 }\nconst tickSwatchStyle = {\n ...swatchStyle,\n display: 'flex',\n justifyContent: 'center',\n}\n\nfunction TickSwatch({ color }: { color: string }) {\n return (\n <div style={tickSwatchStyle}>\n <div style={{ width: 2, backgroundColor: color }} />\n </div>\n )\n}\n\nexport function Swatch({ swatch }: { swatch: KeySwatch }) {\n return swatch.kind === 'gene' ? (\n <div\n style={{\n ...swatchStyle,\n boxSizing: 'border-box',\n border: `1.5px solid ${GENE_INK}`,\n borderRadius: 0,\n }}\n />\n ) : (\n <div\n style={{\n ...swatchStyle,\n height: swatch.kind === 'gap' ? GAP_PX : swatchStyle.height,\n background: swatch.fill,\n }}\n />\n )\n}\n\n// What the bar colours, genes and ticks mean, in the legend stack with the\n// other keys. Each tick row appears once the rows hold one, so a catalogue\n// with no genotypes keeps the plain key.\nexport const WalkRowsLegend = observer(function WalkRowsLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const bars = model.walkRowBars\n if (!bars) {\n return null\n }\n const calls = [bars.reference, ...bars.rows].flatMap(row => row.call ?? [])\n const key = walkRowsKey(bars, {\n ramp: model.referenceRampDomain,\n rampCss: RAMP_GRADIENT_CSS,\n genes: model.walkRowGenes?.size ? model.walkRowGeneGaps : undefined,\n })\n return (\n <div style={legendBoxStyle} data-testid=\"graph-walk-rows-legend\">\n {key.map(entry =>\n entry.note ? (\n <div key={entry.label} style={{ color: '#666', fontStyle: 'italic' }}>\n {entry.label}\n </div>\n ) : (\n <div key={entry.label} style={legendRowStyle}>\n <Swatch swatch={entry.swatch} />\n <span>{entry.label}</span>\n </div>\n ),\n )}\n {calls.some(call => call.spanningReads !== 0) ? (\n <div style={legendRowStyle}>\n <TickSwatch color={CALL_TICK} />\n <span>allele length called for this walk</span>\n </div>\n ) : null}\n {calls.some(call => call.spanningReads === 0) ? (\n <div style={legendRowStyle}>\n <TickSwatch color={UNBACKED_TICK} />\n <span>called with no read spanning it</span>\n </div>\n ) : null}\n {calls.some(call => call.agrees === false) ? (\n <div style={legendRowStyle}>\n <div style={swatchStyle} />\n <span style={{ color: DISAGREES }}>\n walk and call over {Math.round(CALL_TOLERANCE * 100)}% apart\n </span>\n </div>\n ) : null}\n </div>\n )\n})\n\nconst WalkRowsOverlay = observer(function WalkRowsOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const idPrefix = useId().replace(/[^\\w-]/g, '')\n const bars = model.walkRowBars\n if (!bars) {\n return null\n }\n const { paneWidth: width, canvasHeight } = model\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-walk-rows\"\n >\n <ElTree\n el={walkRowsTree(\n bars,\n {\n scaleX: model.scaleX,\n scaleY: model.scaleY,\n translateX: model.translateX,\n translateY: model.translateY,\n width,\n height: canvasHeight,\n },\n {\n ramp: model.referenceRampDomain,\n rowGenes: model.walkRowGenes,\n idPrefix,\n },\n )}\n />\n </svg>\n )\n})\n\nexport default WalkRowsOverlay\n", "import { createElement } from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { El } from '@jbrowse/bandage-core/el'\n\n// SVG's attribute names as React's props: `class` is className, `data-` and\n// `aria-` keep their dashes, the rest are camel-cased (`stroke-width` is\n// strokeWidth)\nfunction propName(name: string) {\n return name === 'class'\n ? 'className'\n : /^(data|aria)-/.test(name)\n ? name\n : name.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase())\n}\n\nfunction toReact(node: El | string, key: number): ReactNode {\n if (typeof node === 'string') {\n return node\n }\n const props: Record<string, unknown> = { key }\n for (const [name, value] of Object.entries(node.attrs)) {\n if (value !== undefined) {\n props[propName(name)] = value\n }\n }\n return createElement(node.tag, props, ...node.children.map(toReact))\n}\n\n// A core element tree as React elements\nexport default function ElTree({ el }: { el: El }) {\n return toReact(el, 0)\n}\n", "import { useId, useMemo, useState } from 'react'\n\nimport {\n walkRowReadout,\n walkRowsKey,\n walkRowsTree,\n} from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport {\n stripRowAt,\n walkMarksTree,\n} from '@jbrowse/bandage-core/layout/walkStrip'\nimport { RAMP_GRADIENT_CSS } from '@jbrowse/bandage-core/referenceRampCss'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { observer } from 'mobx-react'\n\nimport ElTree from './ElTree'\nimport { WalkRowContextMenu } from './WalkRowContextMenu'\nimport { Swatch } from './WalkRowsOverlay'\nimport { legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\nimport type { WalkRows } from '@jbrowse/bandage-core/layout/walkRows'\nimport type { StripFrame } from '@jbrowse/bandage-core/layout/walkStrip'\n\n// Walk rows under a layout that draws nodes, each haplotype's walk on its own\n// bp, linked to the drawing above: the hovered node ticks every bar where its\n// walk passes it, and a point on a bar lights its node, ringed, above. The\n// bars share the drawing's colours, so under the reference-position ramp a hue\n// in the drawing is the same hue on each bar. Every row is shown; rows too\n// thin to letter say who they are on hover.\n\nconst keyStyle = {\n display: 'flex',\n flexWrap: 'wrap' as const,\n gap: '2px 14px',\n padding: '2px 8px 6px',\n fontSize: 11,\n color: '#333',\n}\n\nconst tipStyle = {\n position: 'absolute' as const,\n pointerEvents: 'none' as const,\n background: 'rgba(255,255,255,0.92)',\n border: '1px solid #ccc',\n borderRadius: 3,\n padding: '1px 6px',\n fontSize: 11,\n whiteSpace: 'nowrap' as const,\n zIndex: 4,\n}\n\n// The bars, built once per rows, frame and colouring rather than per hover\nconst StripBars = observer(function StripBars({\n bars,\n frame,\n ramp,\n}: {\n bars: WalkRows\n frame: StripFrame\n ramp: { start: number; end: number } | undefined\n}) {\n const idPrefix = useId().replace(/[^\\w-]/g, '')\n const tree = useMemo(\n () => walkRowsTree(bars, frame, { ramp, idPrefix }),\n [bars, frame, ramp, idPrefix],\n )\n return <ElTree el={tree} />\n})\n\nconst WalkStrip = observer(function WalkStrip({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const bars = model.walkStripRows\n const frame = model.walkStripFrame\n const [menu, setMenu] = useState<\n { row: number; top: number; left: number } | undefined\n >(undefined)\n const [tip, setTip] = useState<\n { text: string; x: number; y: number } | undefined\n >(undefined)\n if (!bars || !frame) {\n return null\n }\n const rows = [bars.reference, ...bars.rows]\n const hit = (e: React.MouseEvent<SVGSVGElement>) => {\n const box = e.currentTarget.getBoundingClientRect()\n const x = e.clientX - box.left\n const y = e.clientY - box.top\n return { ...stripRowAt(bars, frame, x, y), x, y }\n }\n const key = walkRowsKey(bars, {\n ramp: model.referenceRampDomain,\n rampCss: RAMP_GRADIENT_CSS,\n })\n return (\n <div\n data-testid=\"graph-walk-strip\"\n style={{ position: 'relative', borderTop: '1px solid #ddd' }}\n onMouseEnter={() => {\n model.setPointerInPane(true)\n }}\n onMouseLeave={() => {\n if (isAlive(model)) {\n model.setPointerInPane(false)\n model.setStripHover(null)\n }\n setTip(undefined)\n }}\n >\n <svg\n width={frame.width}\n height={frame.height}\n style={{ display: 'block', cursor: 'pointer' }}\n onMouseMove={e => {\n const at = hit(e)\n if (at.row) {\n model.setStripHover({ row: at.row.name, offset: at.offset! })\n setTip(\n frame.labelled\n ? undefined\n : {\n text: `${at.row.label} \u00B7 ${walkRowReadout(\n at.row,\n at.index === 0 ? undefined : bars.reference,\n )}`,\n x: at.x,\n y: at.y,\n },\n )\n } else {\n model.setStripHover(null)\n setTip(undefined)\n }\n }}\n onClick={e => {\n const at = hit(e)\n if (at.row && at.index! > 0) {\n model.toggleWalk(at.row.name)\n }\n }}\n onContextMenu={e => {\n const at = hit(e)\n if (at.row) {\n e.preventDefault()\n setMenu({ row: at.index!, top: e.clientY, left: e.clientX })\n }\n }}\n >\n <StripBars bars={bars} frame={frame} ramp={model.referenceRampDomain} />\n <ElTree el={walkMarksTree(bars, frame, model.walkStripMarks)} />\n {frame.labelled\n ? rows.map((row, i) => (\n <text\n key={row.name}\n x={6}\n y={i * frame.rowPx + frame.translateY + 4}\n fontSize={11}\n fontFamily=\"sans-serif\"\n fill=\"#333\"\n fontWeight={\n model.walkLayers.some(l => l.walk === row.name) ? 600 : 400\n }\n >\n {row.label}\n </text>\n ))\n : null}\n </svg>\n {tip ? (\n <div style={{ ...tipStyle, left: tip.x + 12, top: tip.y - 18 }}>\n {tip.text}\n </div>\n ) : null}\n <div style={keyStyle} data-testid=\"graph-walk-strip-key\">\n {key.map(entry => (\n <div key={entry.label} style={legendRowStyle}>\n <Swatch swatch={entry.swatch} />\n <span>{entry.label}</span>\n </div>\n ))}\n <div style={legendRowStyle}>\n <span>\n \u25AE ticks: where each walk passes the node under the pointer \u00B7 click a\n bar to lift its walk\n </span>\n </div>\n </div>\n {menu ? (\n <WalkRowContextMenu\n model={model}\n row={menu.row}\n bars={bars}\n top={menu.top}\n left={menu.left}\n onClose={() => {\n setMenu(undefined)\n }}\n />\n ) : null}\n </div>\n )\n})\n\nexport default WalkStrip\n", "import { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 4,\n}\n\n// A ring round the node a point on the walk strip lights, so a one-bp node\n// can be found in a hairball\nconst WalkStripLocator = observer(function WalkStripLocator({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const at = model.walkStripLocator\n return at ? (\n <svg\n style={svgStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n data-testid=\"graph-walk-strip-locator\"\n >\n <circle\n cx={at.x}\n cy={at.y}\n r={11}\n fill=\"none\"\n stroke=\"white\"\n strokeWidth={4}\n />\n <circle\n cx={at.x}\n cy={at.y}\n r={11}\n fill=\"none\"\n stroke=\"#111\"\n strokeWidth={1.75}\n />\n </svg>\n ) : null\n})\n\nexport default WalkStripLocator\n", "import { Canvas2DRenderer } from '@jbrowse/bandage-core/renderer/Canvas2DRenderer'\n\n// Canvas2D only, and deliberately not through render-core's GPU ladder. The\n// batch is strokes and arrowheads in layout units, and stroking them batched by\n// colour is inside a frame budget at the node counts this view caps itself at\n// (agent-docs/GRAPH_SCALE_AND_LOD.md), so a GPU backend would buy a few\n// milliseconds for ~30 KB of bundled HAL and a shader toolchain. If one is ever\n// wanted, it should take the same `Renderer` interface and draw the batch as\n// instances \u2014 a capsule per node segment, a bezier ribbon per edge stroke \u2014\n// rather than reviving a triangle mesh; agent-docs/IDEAS.md scopes it.\nexport function createGraphRenderer(canvas: HTMLCanvasElement) {\n return Promise.resolve(new Canvas2DRenderer(canvas))\n}\n"],
5
- "mappings": "2rBAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,QAAU,eAAe,0CAA0C,ICA1E,IAAAC,GAAkC,SASlC,IAAAC,GAAkD,UAClDC,GAAwB,UACxBC,GAAoC,UCRpC,IAAAC,GAA4B,SACrBC,MAAQ,oBAA2B,GAAAC,KAAK,OAAQ,CACrD,EAAG,6FACL,CAAC,EAAG,MAAM,EDOV,IAAAC,EAAyB,SEPzB,IAAAC,GAAyB,SCLlB,IAAMC,EAAiB,CAC5B,WAAY,yBACZ,QAAS,UACT,aAAc,EACd,SAAU,GACV,WAAY,OACZ,WAAY,QACd,EAEaC,EAAiB,CAAE,QAAS,OAAQ,WAAY,SAAU,IAAK,CAAE,EDoDlE,IAAAC,EAAA,SA5CNC,GAAW,CACf,SAAU,WACV,KAAM,EACN,IAAK,EACL,cAAe,OACf,SAAU,SACV,OAAQ,CACV,EAEMC,MAAc,aAAS,SAAqB,CAChD,MAAAC,CACF,EAEG,CACD,GAAM,CAAE,YAAAC,EAAa,SAAAC,EAAU,cAAAC,CAAc,EAAIH,EACjD,GAAIC,EAAY,SAAW,EACzB,OAAO,KAET,GAAM,CACJ,OAAAG,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,UAAWC,EACX,aAAAC,CACF,EAAIT,EACEU,EAAOV,EAAM,gBAAkBW,GAE/BC,EAAgBC,GACpBX,IAAa,QAAa,CAACW,EAAE,QAAQ,KAAKC,GAAMZ,EAAS,QAAQ,IAAIY,CAAE,CAAC,EAE1E,SACE,OAAC,OACC,MAAOhB,GACP,MAAOU,EACP,OAAQC,EACR,cAAY,qBAEZ,mBAAC,KACC,UAAW,aAAaH,CAAU,IAAIC,CAAU,WAAWH,CA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CACJA,EAAM,UAAU,CAClB,EACA,OAER,EACE,MACN,CAEJ,CAAC,EAEM0G,GAAQ1B",
6
- "names": ["require_useRenderingBackend", "__commonJSMin", "exports", "module", "import_react", "import_ui", "import_mobx_state_tree", "import_useRenderingBackend", "import_jsx_runtime", "Info_default", "_jsx", "import_mobx_react", "import_mobx_react", "legendBoxStyle", "legendRowStyle", "import_jsx_runtime", "svgStyle", "BubbleHalos", "model", "bubbleHalos", "walkLift", "hoveredBubble", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "halo", "HALO_FACTOR", "dimmedBubble", "h", "id", "BUBBLE_KIND_COLORS", "sameBubble", "BubbleHalos_default", "HaloSwatch", "color", "HaloLegend", "kindsByColor", "kinds", "BUBBLE_KIND_NAMES", "legendBoxStyle", "legendRowStyle", "import_react", "import_mobx", "import_mobx_react", "import_jsx_runtime", "walkSwatchStyle", "walkBlockStyle", "walkBarStyle", "WalkKey", "walk", "label", "reference", "hint", "at", "key", "walkKey", "legendRowStyle", "encodingSwatchCss", "import_react", "FALLBACK_CELL_SIZE", "meanExtentCellSize", "extentTotal", "count", "rowPitchOf", "boxes", "distinct", "min", "max", "box", "cellSizeFrom", "extentX", "extentY", "x", "resolveCellSize", "given", "getOrCreateCell", "cells", "cx", "cy", "row", "cell", "addToGrid", "cellSize", "minX", "minY", "maxX", "maxY", "entry", "cx0", "cx1", "cy0", "cy1", "queryGrid", "y", "radiusX", "radiusY", "results", "seen", "SpatialIndex", "nodePositions", "nodeId", "segments", "i", "seg", "next", "b", "EdgeSpatialIndex", "graph", "drawPaths", "axis", "deletions", "version", "routes", "baseEdgeCurves", "ei", "edge", "fromSegments", "toSegments", "curves", "curveBounds", "numPaths", "padX", "padY", "o", "pathRibbonOffsets", "distanceToSegment", "px", "py", "x1", "y1", "x2", "y2", "dx", "dy", "lenSq", "t", "distanceToCubicBezier", "cx1", "cy1", "cx2", "cy2", "minDist", "samples", "lastX", "lastY", "i", "u", "bx", "by", "distanceToBezierCurve", "c", "distanceToEdgeCurves", "curves", "yToX", "d", "nodeCache", "getSpatialIndex", "nodePositions", "version", "cached", "index", "SpatialIndex", "edgeCache", "getEdgeSpatialIndex", "graph", "drawPaths", "axis", "deletions", "routes", "EdgeSpatialIndex", "MIN_NODE_REACH_PX", "findHoveredNode", "graphX", "graphY", "ink", "yToXOf", "reach", "queryReach", "candidates", "hovered", "best", "nodeId", "segmentIdx", "segments", "dist", "findHoveredEdge", "hiddenEdges", "deletionRoutes", "edgeThreshold", "edgeIndex", "edgeIdx", "edge", "fromSegments", "toSegments", "numPaths", "baseCurves", "offset", "pathRibbonOffsets", "translateCurves", "wheelZoomFactor", "e", "px", "notches", "import_mobx_state_tree", "useWheelZoom", "canvas", "model", "c", "handleWheel", "e", "rect", "wheelZoomFactor", "usePaneGestures", "lastMouseRef", "hasMovedRef", "pendingRef", "contextNode", "setContextNode", "contextRow", "setContextRow", "screenToGraph", "screenX", "screenY", "getMouseCoord", "nodeAt", "x", "y", "nodePositions", "sx", "sy", "onStrip", "findHoveredNode", "onMouseDown", "node", "applyPending", "pending", "findHoveredEdge", "scheduleFrame", "dropPending", "onMouseMove", "dx", "dy", "onMouseUp", "onMouseLeave", "onContextMenu", "row", "onClick", "import_jsx_runtime", "gridStyle", "titleStyle", "FacetPanel", "model", "lift", "width", "height", "cell", "handlers", "canvas", "setCanvas", "walk", "useWheelZoom", "renderer", "Canvas2DRenderer", "drawing", "uploaded", "dispose", "built", "label", "WalkKey", "FacetPanels", "panels", "grid", "place", "columns", "i", "FacetPanels_default", "import_react", "import_mobx_react", "import_jsx_runtime", "svgStyle", "EXON_COLOR", "MIN_LANE_PX", "EXON_GAP_PX", "EXON_LINE_PX", "GenePins", "model", "maskId", "genePins", "walkLift", "nodeInk", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "inkPx", "nodeId", "own", "stretches", "pin", "d", "transform", "stroke", "s", "GenePins_default", "import_jsx_runtime", "CropFree_default", "_jsx", "import_jsx_runtime", "ZoomIn_default", "_jsx", "import_jsx_runtime", "ZoomOut_default", "_jsx", "import_material", "import_mobx_react", "import_mui", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "ColorSchemeSelect", "model", "classes", "fixed", "e", "COLOR_SCHEMES", "value", "label", "ColorSchemeSelect_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "fmtMs", "ms", "GraphPerf", "model", "classes", "lastFetchMs", "lastLayoutMs", "lastGeometryMs", "hasMetrics", "GraphStats", "GraphStats_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "LayoutSelect", "model", "classes", "graph", "e", "LAYOUT_MODES", "value", "label", "description", "available", "LayoutSelect_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "RepeatSelect", "model", "classes", "repeatChoices", "keys", "r", "e", "key", "name", "unit", "RepeatSelect_default", "import_react", "import_ui", "import_jsx_runtime", "Delete_default", "_jsx", "import_jsx_runtime", "MoreVert_default", "_jsx", "import_mobx_react", "import_jsx_runtime", "SettingsMenu", "model", "settingsOpen", "setSettingsOpen", "Settings_default", "Delete_default", "MoreVert_default", "GraphSettingsDialog_default", "SettingsMenu_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "WalkSelect", "model", "classes", "walkChoices", "names", "c", "labels", "picked", "layer", "name", "selected", "n", "e", "value", "label", "WalkSelect_default", "import_jsx_runtime", "useStyles", "ZoomDisplay", "model", "GraphToolbar", "classes", "LayoutSelect_default", "ColorSchemeSelect_default", "WalkSelect_default", "RepeatSelect_default", "ZoomIn_default", "ZoomOut_default", "CropFree_default", "GraphStats_default", "SettingsMenu_default", "GraphToolbar_default", "import_mobx_state_tree", "import_mobx_react", "import_jsx_runtime", "LabelChip", "x", "y", "w", "text", "note", "color", "edge", "italic", "small", "dimmed", "title", "testId", "onClick", "onHover", "import_jsx_runtime", "svgStyle", "GENE_INK", "LabelLayer", "model", "bubbles", "genes", "routes", "walkLift", "scaleY", "translateY", "contigThickness", "dimmedBubble", "h", "id", "dimmedRoute", "r", "w", "pin", "x", "y", "text", "gene", "note", "geneCoverageNote", "LabelChip", "EXON_COLOR", "route", "BUBBLE_KIND_COLORS", "hovered", "LabelLayer_default", "import_react", "import_canvas2dUtils", "import_mobx", "import_mobx_react", "import_jsx_runtime", "canvasStyle", "ReferenceStripOverlay", "model", "ref", "referenceStripShown", "paneWidth", "canvasHeight", "canvas", "frame", "ctx", "dpr", "width", "height", "drawReferenceStrip", "ReferenceStripOverlay_default", "SWATCH_PX", "RAMP_SWATCH", "SAMPLED_BLOCKS", "sampledSwatch", "colors", "distinct", "c", "i", "n", "picked", "_", "LIFT_BACKDROP_CSS", "StripSwatch", "rows", "key", "background", "stripRows", "w", "encodingSwatchCss", "b", "OverhangSwatch", "ReferenceStripLegend", "rowPerWalk", "legendBoxStyle", "legendRowStyle", "import_react", "import_canvas2dUtils", "import_mobx", "import_mobx_react", "import_jsx_runtime", "canvasStyle", "TubeMapOverlay", "model", "ref", "tubeMapPicture", "paneWidth", "canvasHeight", "canvas", "picture", "frame", "ctx", "dpr", "width", "height", "tubeFrame", "drawTubeMap", "drawDeviationMarks", "drawTubeMapConnectors", "bounds", "drawTubeMapGenes", "boxes", "drawTubeMapRuler", "TubeMapOverlay_default", "SWATCH_PX", "BracketSwatch", "brackets", "x0", "x1", "rulerInk", "barSwatchStyle", "tubeSwatchStyle", "TickSwatch", "deviationInk", "ReadSwatch", "colors", "step", "stops", "c", "i", "glyphSwatchStyle", "DeletionSwatch", "LegendRow", "swatch", "children", "legendRowStyle", "TubeMapLegend", "logWidths", "foldBp", "forwardReads", "reverseReads", "mismatches", "rows", "FORWARD_READ_COLORS", "REVERSE_READ_COLORS", "formatBp", "legendBoxStyle", "import_material", "import_mobx_react", "import_jsx_runtime", "style", "UnpopButton", "model", "poppedFrom", "UnpopButton_default", "import_ui", "import_mobx_react", "import_jsx_runtime", "WalkRowContextMenu", "model", "row", "bars", "top", "left", "onClose", "target", "assembly", "callback", "locLabel", "LineStyle_default", "import_react", "import_mobx_react", "import_react", "propName", "name", "_", "c", "toReact", "node", "key", "props", "value", "ElTree", "el", "import_jsx_runtime", "svgStyle", "CALL_TICK", "UNBACKED_TICK", "swatchStyle", "BAR_PX", "tickSwatchStyle", "TickSwatch", "color", "Swatch", "swatch", "GENE_INK", "GAP_PX", "WalkRowsLegend", "model", "bars", "calls", "row", "key", "walkRowsKey", "RAMP_GRADIENT_CSS", "legendBoxStyle", "entry", "legendRowStyle", "call", "DISAGREES", "WalkRowsOverlay", "idPrefix", "width", "canvasHeight", "ElTree", "walkRowsTree", "WalkRowsOverlay_default", "import_react", "import_mobx_state_tree", "import_mobx_react", "import_jsx_runtime", "keyStyle", "tipStyle", "StripBars", "bars", "frame", "ramp", "idPrefix", "tree", "walkRowsTree", "ElTree", "WalkStrip", "model", "menu", "setMenu", "tip", "setTip", "rows", "hit", "e", "box", "x", "y", "stripRowAt", "key", "walkRowsKey", "RAMP_GRADIENT_CSS", "at", "walkRowReadout", "walkMarksTree", "row", "i", "l", "entry", "legendRowStyle", "Swatch", "WalkRowContextMenu", "WalkStrip_default", "import_mobx_react", "import_jsx_runtime", "svgStyle", "WalkStripLocator", "model", "at", "WalkStripLocator_default", "createGraphRenderer", "canvas", "Canvas2DRenderer", "import_jsx_runtime", "tooltipStyle", "wrapperStyle", "canvasAreaStyle", "paperStyle", "loadingLayerStyle", "rowLabelStyle", "RowLabels", "model", "rowLabels", "label", "y", "screenY", "legendStackStyle", "LEGEND_INSET_PX", "pathSwatchStyle", "PathLegend", "pathLegend", "legendBoxStyle", "name", "color", "legendRowStyle", "WalkReadout", "lift", "w", "WalkKey", "OffReferenceRow", "walkSwatchStyle", "LIFT_BACKDROP_CSS", "rampStripStyle", "RAMP_GRADIENT_CSS", "rampEndsStyle", "ReferenceRampLegend", "domain", "offReference", "unplaced", "start", "end", "formatBp", "UNPLACED_SWATCH", "REFERENCE_RAMP_ALT_CSS", "exonSwatchStyle", "EXON_COLOR", "GeneLegend", "pin", "nodeLabelStyle", "deletionLabelStyle", "leaderStyle", "Legends", "ref", "el", "observer", "ReferenceStripLegend", "HaloLegend", "TubeMapLegend", "WalkRowsLegend", "GraphSizeLabels", "labels", "leaders", "key", "leader", "arcX", "arcY", "labelX", "labelY", "text", "x", "kind", "HoverTooltips", "hoveredNodeData", "hoveredEdgeData", "ownLocation", "nodeOwnLocation", "hoveredDeletion", "d", "locLabel", "NodeContextMenu", "nodeId", "top", "left", "onClose", "own", "reference", "highlight", "callback", "Info_default", "nodeLaunchMenuItems", "target", "GraphCanvas", "ownChrome", "canvasRef", "canvas", "renderError", "retryRender", "createGraphRenderer", "handlers", "contextNode", "contextRow", "closeContextMenu", "usePaneGestures", "useWheelZoom", "faceted", "GraphToolbar_default", "FacetPanels_default", "TubeMapOverlay_default", "ReferenceStripOverlay_default", "BubbleHalos_default", "GenePins_default", "LabelLayer_default", "WalkRowsOverlay_default", "WalkStripLocator_default", "UnpopButton_default", "WalkStrip_default", "WalkRowContextMenu", "GraphCanvas_default"]
4
+ "sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/render-core/useRenderingBackend\"];", "import { useEffect, useRef } from 'react'\n\nimport { formatBp } from '@jbrowse/bandage-core/graphLabels'\nimport { LEGEND_INSET_PX } from '@jbrowse/bandage-core/labelLayout'\nimport { RAMP_GRADIENT_CSS } from '@jbrowse/bandage-core/referenceRampCss'\nimport {\n LIFT_BACKDROP_CSS,\n REFERENCE_RAMP_ALT_CSS,\n} from '@jbrowse/bandage-core/renderer/GeometryBuilder'\nimport { ErrorBanner, LoadingOverlay, Menu } from '@jbrowse/core/ui'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { useRenderingBackend } from '@jbrowse/render-core/useRenderingBackend'\nimport InfoIcon from '@mui/icons-material/Info'\nimport { observer } from 'mobx-react'\n\nimport BubbleHalos, { HaloLegend } from './BubbleHalos'\nimport FacetPanels from './FacetPanels'\nimport GenePins, { EXON_COLOR } from './GenePins'\nimport GraphToolbar from './GraphToolbar'\nimport LabelLayer from './LabelLayer'\nimport ReferenceStripOverlay, {\n ReferenceStripLegend,\n} from './ReferenceStripOverlay'\nimport TubeMapOverlay, { TubeMapLegend } from './TubeMapOverlay'\nimport UnpopButton from './UnpopButton'\nimport WalkKey, { walkSwatchStyle } from './WalkKey'\nimport { WalkRowContextMenu } from './WalkRowContextMenu'\nimport WalkRowsOverlay, { WalkRowsLegend } from './WalkRowsOverlay'\nimport WalkStrip from './WalkStrip'\nimport WalkStripLocator from './WalkStripLocator'\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\nimport { usePaneGestures, useWheelZoom } from './usePaneGestures'\nimport { locLabel, nodeOwnLocation } from '../../launchFromGraph/contributors'\nimport { nodeLaunchMenuItems } from '../../launchFromGraph/graphMenuItems'\nimport { createGraphRenderer } from '../renderer/GraphRenderer'\n\nimport type { GraphPaneModel } from '../model'\n\n// Bottom RIGHT, not bottom left: the row labels of a row-structured layout are\n// pinned to the left edge, so a bottom-left tooltip lands on top of them and\n// covers the one thing that says which haplotype a row is. Nothing is drawn\n// against the right edge.\nconst tooltipStyle = {\n position: 'absolute' as const,\n bottom: 8,\n right: 8,\n background: 'rgba(0,0,0,0.75)',\n color: 'white',\n padding: '4px 8px',\n borderRadius: 4,\n fontSize: 12,\n pointerEvents: 'none' as const,\n zIndex: 6,\n}\n\nconst wrapperStyle = { position: 'relative' as const }\n\n// The overlay origin has to be the canvas, not the wrapper: the wrapper also\n// holds the toolbar, so anything positioned against it is offset by the\n// toolbar's height, and a row label lands a whole row off the row it names.\nconst canvasAreaStyle = {\n position: 'relative' as const,\n lineHeight: 0,\n isolation: 'isolate' as const,\n}\n\n// Under a transparent canvas, from below the reference strip down, so the\n// linear view's gridlines show only behind the strip\nconst paperStyle = {\n position: 'absolute' as const,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 0,\n}\n\n// Above the labels, pins and legends drawn over the canvas, and with the line\n// height the canvas area zeroes, which would collapse the overlay's label\nconst loadingLayerStyle = {\n position: 'absolute' as const,\n inset: 0,\n zIndex: 10,\n lineHeight: 'normal',\n pointerEvents: 'none' as const,\n}\n\nconst rowLabelStyle = {\n position: 'absolute' as const,\n left: 6,\n transform: 'translateY(-50%)',\n background: 'rgba(255,255,255,0.82)',\n padding: '0 4px',\n borderRadius: 3,\n fontSize: 11,\n // explicit, because the canvas container zeroes line-height to kill the\n // inline-block gap under the canvas. Inherited, that collapses the label to a\n // zero-height box: it still paints, but it has no layout, so anything asking\n // whether it is visible (a screenshot spec's waitForVisible, a11y tooling)\n // is told no.\n lineHeight: '16px',\n whiteSpace: 'nowrap' as const,\n pointerEvents: 'none' as const,\n zIndex: 4,\n}\n\n// Names the rows of a row-structured layout (anchored, sample rows). Without\n// them the layout draws real structure that cannot be read: a stack of bars\n// where every row means something and nothing says what.\n//\n// Positioned from the layout's own `rowLabels` through the same transform the\n// canvas draws with, so a label tracks its row across pan and zoom instead of\n// sitting at a measured pixel. It therefore has to be mounted in the canvas's\n// own positioning context (canvasAreaStyle) \u2014 against the wrapper it picks up\n// the toolbar's height and names the wrong row. Pinned to the left edge rather\n// than to the row's own x, because a row's leftmost node is wherever its first\n// allele happens to branch. Rows scrolled out of the canvas are dropped rather\n// than clamped to the edge, so a label never points at a row that is not\n// there.\nconst RowLabels = observer(function RowLabels({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const rowLabels = model.drawnRowLabels\n return (\n <>\n {rowLabels.map(({ label, y }) => {\n const screenY = y * model.scaleY + model.translateY\n return screenY >= 0 && screenY <= model.canvasHeight ? (\n // Keyed on the row, not on the label: two rows can carry the same\n // words. The sample-row layout names row 0 for the assembly the\n // backbone comes from and the rows below it for the samples\n // contributing alleles, and a diploid reference is in both lists \u2014\n // one haplotype is the reference path, the other walks alleles of its\n // own, and `parsePanSN` reduces both to one sample name.\n <div\n key={y}\n data-testid=\"graph-row-label\"\n style={{ ...rowLabelStyle, top: screenY }}\n >\n {label}\n </div>\n ) : null\n })}\n </>\n )\n})\n\n// Top RIGHT: the row labels own the left edge and the hover tooltip owns the\n// bottom right, so this is the one corner nothing else claims. A row-structured\n// layout draws its band across the middle, which is what the keys are for. The\n// two keys stack rather than each claiming the corner, since a path-coloured\n// graph can also be reference-position coloured.\nconst legendStackStyle = {\n position: 'absolute' as const,\n top: LEGEND_INSET_PX,\n right: LEGEND_INSET_PX,\n display: 'flex',\n flexDirection: 'column' as const,\n alignItems: 'flex-end',\n gap: 4,\n pointerEvents: 'none' as const,\n zIndex: 4,\n}\n\nconst pathSwatchStyle = { width: 18, height: 3, borderRadius: 2 }\n\n// Which haplotype each ribbon colour is. The ribbons are one stroke per path\n// fanned across every edge the path crosses, so without this the drawing states\n// that the alleles are taken by *different* samples and never which.\nconst PathLegend = observer(function PathLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { pathLegend } = model\n return pathLegend.length > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-path-legend\">\n {pathLegend.map(({ name, label, color }) => (\n <div key={name} style={legendRowStyle}>\n <div style={{ ...pathSwatchStyle, backgroundColor: color }} />\n <span>{label}</span>\n </div>\n ))}\n </div>\n ) : null\n})\n\n// Each lifted walk's key, then what the faded rest is\nconst WalkReadout = observer(function WalkReadout({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const lift = model.walkLift\n if (!lift) {\n return null\n }\n return (\n <div style={legendBoxStyle} data-testid=\"graph-walk-readout\">\n {lift.walks.map(w => (\n <WalkKey\n key={w.name}\n walk={w}\n label={model.walkLabel(w.name)}\n reference={model.walkReference}\n at={model.hoveredOn(w)}\n />\n ))}\n {/* the ramp's own key, which names this, is off while walks are lifted */}\n {model.liftPaintsOffReference ? <OffReferenceRow /> : null}\n <div style={legendRowStyle}>\n <div style={{ ...walkSwatchStyle, background: LIFT_BACKDROP_CSS }} />\n <span>not on {model.liftedWalksLabel}</span>\n </div>\n </div>\n )\n})\n\n// The reference-position ramp, as a strip labelled with the interval it runs\n// over. Nothing on screen used to say that red-to-magenta means left-to-right of\n// the cut window, so two tutorials carried that sentence in prose and a reader\n// arriving at a figure had no way to know it at all.\nconst rampStripStyle = {\n minWidth: 90,\n height: 8,\n borderRadius: 2,\n background: RAMP_GRADIENT_CSS,\n}\n\nconst rampEndsStyle = {\n display: 'flex',\n justifyContent: 'space-between',\n gap: 8,\n}\n\nconst ReferenceRampLegend = observer(function ReferenceRampLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n // under lifted walks each lane states its own scale, and the rest is grey\n const domain = model.walkLift ? undefined : model.referenceRampDomain\n const { offReference, unplaced } = model.referenceRampOffKeys\n // a measured domain runs between node midpoints, which can fall on a half bp\n const start = Math.round(domain?.start ?? 0)\n const end = Math.round(domain?.end ?? 0)\n return domain ? (\n <div style={legendBoxStyle} data-testid=\"graph-ramp-legend\">\n <div style={rampStripStyle} />\n <div style={rampEndsStyle}>\n <span>{start.toLocaleString()}</span>\n <span>({formatBp(end - start)})</span>\n <span>{end.toLocaleString()}</span>\n </div>\n {offReference ? <OffReferenceRow /> : null}\n {unplaced ? (\n <div style={legendRowStyle}>\n <div style={{ ...walkSwatchStyle, background: UNPLACED_SWATCH }} />\n <span>no reference position</span>\n </div>\n ) : null}\n </div>\n ) : null\n})\n\n// getNodeColor's grey for a node the ramp cannot place\nconst UNPLACED_SWATCH = 'rgb(160, 160, 160)'\n\n// The charcoal both the ramp and a lane coloured by reference position give\n// sequence the reference does not carry\nfunction OffReferenceRow() {\n return (\n <div style={legendRowStyle}>\n <div style={{ ...walkSwatchStyle, background: REFERENCE_RAMP_ALT_CSS }} />\n <span>off the reference</span>\n </div>\n )\n}\n\nconst exonSwatchStyle = {\n ...walkSwatchStyle,\n border: `2px solid ${EXON_COLOR}`,\n borderRadius: 5,\n boxSizing: 'border-box' as const,\n}\n\nconst GeneLegend = observer(function GeneLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return model.genePins.some(pin => pin.exonsByNode.length > 0) ? (\n <div style={legendBoxStyle} data-testid=\"graph-gene-legend\">\n <div style={legendRowStyle}>\n <div style={exonSwatchStyle} />\n <span>exon</span>\n </div>\n </div>\n ) : null\n})\n\nconst nodeLabelStyle = {\n position: 'absolute' as const,\n transform: 'translate(-50%, -50%)',\n background: 'rgba(255,255,255,0.78)',\n padding: '0 3px',\n borderRadius: 3,\n fontSize: 10,\n lineHeight: '13px',\n whiteSpace: 'nowrap' as const,\n pointerEvents: 'none' as const,\n zIndex: 3,\n}\n\n// Matches EDGE_DELETION_COLOR, so the words and the arc they name are one thing.\nconst deletionLabelStyle = {\n ...nodeLabelStyle,\n color: '#18181c',\n fontWeight: 600,\n}\n\n// Under the labels (z 3) and over the canvas, so a leader runs beneath the text\n// it points from rather than across it. `overflow: visible` because a label\n// displaced past the canvas edge is culled by the placement, not clipped here.\nconst leaderStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 2,\n}\n\n// Measures itself for the model, so no label is placed under a legend and\n// none gives way to one that is not drawn.\n//\n// At rest only: the walk keys' hover readout would otherwise refit the view,\n// and the refit clears the hover that grew it\nconst Legends = observer(function Legends({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n const el = ref.current\n if (!el) {\n return\n }\n // the last callback can land after the track is closed\n const observer = new ResizeObserver(() => {\n if (isAlive(model) && model.hoveredNode === null) {\n model.setLegendSize({ width: el.offsetWidth, height: el.offsetHeight })\n }\n })\n observer.observe(el)\n return () => {\n observer.disconnect()\n }\n }, [model])\n return (\n <div\n ref={ref}\n style={{\n ...legendStackStyle,\n top: LEGEND_INSET_PX + model.referenceStripZonePx,\n }}\n >\n <ReferenceRampLegend model={model} />\n <ReferenceStripLegend model={model} />\n <HaloLegend model={model} />\n <GeneLegend model={model} />\n <PathLegend model={model} />\n <TubeMapLegend model={model} />\n <WalkRowsLegend model={model} />\n <WalkReadout model={model} />\n </div>\n )\n})\n\n// Writes each drawn thing's size onto it, which is what Bandage's Length label\n// does and what the tooltip alone could not: a graph you have to hover to read\n// is a graph nobody reads. graphLabels applies the same transform the canvas\n// draws with \u2014 so a label tracks its node across pan and zoom \u2014 and decides\n// which labels fit; this only paints them, mounted in the canvas's own\n// positioning context for the reason RowLabels is.\nconst GraphSizeLabels = observer(function GraphSizeLabels({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const labels = model.overlayLabels.sizes\n // A label too wide for the arc it names is placed clear of it and tethered\n // back; nothing else in the drawing carries one.\n const leaders = labels.flatMap(({ key, leader }) =>\n leader ? [{ key, ...leader }] : [],\n )\n return (\n <>\n {leaders.length > 0 ? (\n <svg\n style={leaderStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n >\n {leaders.map(({ key, arcX, arcY, labelX, labelY }) => (\n <line\n key={key}\n data-testid=\"graph-label-leader\"\n x1={arcX}\n y1={arcY}\n x2={labelX}\n y2={labelY}\n stroke=\"#18181c\"\n strokeWidth={1}\n />\n ))}\n </svg>\n ) : null}\n {labels.map(({ key, text, x, y, kind }) => (\n <div\n key={key}\n data-testid=\"graph-size-label\"\n style={{\n ...(kind === 'deletion' ? deletionLabelStyle : nodeLabelStyle),\n left: x,\n top: y,\n }}\n >\n {text}\n </div>\n ))}\n </>\n )\n})\n\nconst HoverTooltips = observer(function HoverTooltips({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const hoveredNodeData = model.hoveredNode\n ? model.nodeById?.get(model.hoveredNode)\n : null\n\n const hoveredEdgeData =\n model.hoveredEdge !== null && model.graph\n ? model.graph.edges[model.hoveredEdge]\n : null\n\n const ownLocation = hoveredNodeData\n ? nodeOwnLocation(hoveredNodeData)\n : undefined\n\n const hoveredDeletion =\n model.hoveredEdge === null\n ? undefined\n : model.deletions.find(d => d.edgeIndex === model.hoveredEdge)\n\n return (\n <>\n {hoveredNodeData ? (\n <div style={tooltipStyle}>\n <strong>{hoveredNodeData.name}</strong> \u2014{' '}\n {hoveredNodeData.length.toLocaleString()} bp, depth{' '}\n {hoveredNodeData.depth.toFixed(1)}\n {/* Which assembly contributed this segment, and where it sits on it.\n rGFA states both, and until now neither reached the screen: the\n node was a bare id in a picture. */}\n {ownLocation ? (\n <>\n <br />\n {ownLocation.sample} {locLabel(ownLocation)} (rank{' '}\n {hoveredNodeData.stable?.rank})\n </>\n ) : null}\n </div>\n ) : null}\n {hoveredEdgeData ? (\n <div style={tooltipStyle}>\n {/* A deletion edge is the one link that means something on its own \u2014\n the backbone it skips is sequence some haplotype does not carry \u2014\n so it says how much rather than just naming its endpoints. */}\n {hoveredDeletion ? (\n <>\n <strong>Deletion</strong> {hoveredDeletion.bp.toLocaleString()} bp\n <br />\n {hoveredDeletion.refName}:{hoveredDeletion.start.toLocaleString()}\n -{hoveredDeletion.end.toLocaleString()}\n </>\n ) : (\n <>\n Edge: {hoveredEdgeData.from} \u2192 {hoveredEdgeData.to}\n </>\n )}\n </div>\n ) : null}\n </>\n )\n})\n\n// Flat rather than under a \"Launch view\" submenu: this menu is two or three\n// items long and every one of them is contextual to the node just clicked. The\n// submenu grouping earns its keep in the long view and track menus.\nconst NodeContextMenu = observer(function NodeContextMenu({\n model,\n nodeId,\n top,\n left,\n onClose,\n}: {\n model: GraphPaneModel\n nodeId: string\n top: number\n left: number\n onClose: () => void\n}) {\n const { own, reference, highlight } = model.nodeLaunchTargets(nodeId)\n return (\n <Menu\n open\n anchorReference=\"anchorPosition\"\n anchorPosition={{ top, left }}\n onClose={() => {\n onClose()\n }}\n onMenuItemClick={callback => {\n callback()\n }}\n menuItems={[\n {\n label: 'Node details',\n icon: InfoIcon,\n onClick: () => {\n model.showNodeDetails(nodeId)\n },\n },\n ...nodeLaunchMenuItems({\n own,\n reference,\n highlight,\n onShowLinear: target => {\n model.showInLinearView(target)\n },\n onHighlight: model.canHighlightInLinearView\n ? target => {\n model.highlightInLinearView(target)\n }\n : undefined,\n }),\n ]}\n />\n )\n})\n\n// `ownChrome` false for a pane inside a track, whose controls, loading state\n// and errors are the track's. A hosted pane whose x the host places takes no pan or wheel of its\n// own: those are the linear view's, as on any other track. One drawing its\n// own coordinates inside a track keeps them, and keeps them from the view.\nconst GraphCanvas = observer(function GraphCanvas({\n model,\n ownChrome = true,\n}: {\n model: GraphPaneModel\n ownChrome?: boolean\n}) {\n const {\n canvasRef,\n canvas,\n error: renderError,\n retry: retryRender,\n } = useRenderingBackend(createGraphRenderer, model)\n const { handlers, contextNode, contextRow, closeContextMenu } =\n usePaneGestures(model)\n useWheelZoom(canvas, model)\n const faceted = model.facetPanels !== undefined\n\n return (\n <div style={wrapperStyle}>\n {ownChrome ? <GraphToolbar model={model} /> : null}\n\n <div\n style={canvasAreaStyle}\n onMouseEnter={() => {\n model.setPointerInPane(true)\n }}\n onMouseLeave={() => {\n if (isAlive(model)) {\n model.setPointerInPane(false)\n }\n }}\n >\n {model.referenceStripShown ? (\n <div\n style={{\n ...paperStyle,\n top: model.referenceStripZonePx,\n background: model.paperCss,\n }}\n />\n ) : null}\n <canvas\n ref={canvasRef}\n data-testid=\"graph-genome-canvas\"\n style={{\n width: model.paneWidth,\n height: model.canvasHeight,\n cursor: model.isPanning || model.draggingNode ? 'grabbing' : 'grab',\n display: 'block',\n position: 'relative',\n zIndex: 1,\n }}\n {...handlers}\n />\n\n {faceted ? (\n <FacetPanels model={model} handlers={handlers} />\n ) : (\n <>\n <TubeMapOverlay model={model} />\n <ReferenceStripOverlay model={model} />\n <RowLabels model={model} />\n <GraphSizeLabels model={model} />\n <BubbleHalos model={model} />\n <GenePins model={model} />\n <LabelLayer model={model} />\n <WalkRowsOverlay model={model} />\n <WalkStripLocator model={model} />\n <Legends model={model} />\n </>\n )}\n <UnpopButton model={model} />\n\n {ownChrome ? (\n <div style={loadingLayerStyle}>\n <LoadingOverlay\n isVisible={model.isLoading}\n immediate={!model.layoutResult}\n statusMessage={model.statusMessage}\n onCancel={\n model.canCancelLoad\n ? () => {\n model.cancelLoad()\n }\n : undefined\n }\n />\n </div>\n ) : null}\n </div>\n\n {model.walkStripShown ? <WalkStrip model={model} /> : null}\n\n <HoverTooltips model={model} />\n\n {contextNode ? (\n <NodeContextMenu\n model={model}\n nodeId={contextNode.nodeId}\n top={contextNode.top}\n left={contextNode.left}\n onClose={closeContextMenu}\n />\n ) : null}\n\n {contextRow ? (\n <WalkRowContextMenu\n model={model}\n row={contextRow.row}\n top={contextRow.top}\n left={contextRow.left}\n onClose={closeContextMenu}\n />\n ) : null}\n\n {renderError ? (\n <ErrorBanner error={renderError} onReset={retryRender} />\n ) : null}\n\n {ownChrome && model.error ? (\n <ErrorBanner\n error={model.error}\n onReset={\n model.canRetryLoad\n ? () => {\n model.retryLoad()\n }\n : undefined\n }\n />\n ) : null}\n </div>\n )\n})\n\nexport default GraphCanvas\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z\"\n}), 'Info');", "import { sameBubble } from '@jbrowse/bandage-core/bubbles/bubbleLine'\nimport {\n BUBBLE_KIND_COLORS,\n BUBBLE_KIND_NAMES,\n} from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { HALO_FACTOR } from '@jbrowse/bandage-core/labelLayout'\nimport { observer } from 'mobx-react'\n\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\nimport type { BubbleHalo } from '@jbrowse/bandage-core/bubbles/bubbleHalos'\n\n// The bubbles over a node drawing: each a translucent halo along its nodes,\n// drawn once in layout units and moved with the canvas by one transform. The\n// halo takes no pointer events, so the nodes under it still hover and drag;\n// its name and its routes' chips are LabelLayer's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 2,\n}\n\nconst BubbleHalos = observer(function BubbleHalos({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbleHalos, walkLift, hoveredBubble } = model\n if (bubbleHalos.length === 0) {\n return null\n }\n const {\n scaleX,\n scaleY,\n translateX,\n translateY,\n paneWidth: width,\n canvasHeight,\n } = model\n const halo = model.contigThickness * HALO_FACTOR\n // lifted walks dim the bubbles none of them enters\n const dimmedBubble = (h: BubbleHalo) =>\n walkLift !== undefined && !h.nodeIds.some(id => walkLift.nodeIds.has(id))\n\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-bubble-halos\"\n >\n <g\n transform={`translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`}\n >\n {bubbleHalos\n .filter(h => !h.whole)\n .map(h => (\n <path\n key={`${h.bubble.start}-${h.bubble.end}`}\n d={h.path}\n fill=\"none\"\n stroke={BUBBLE_KIND_COLORS[h.kind]}\n strokeOpacity={\n hoveredBubble && sameBubble(h.bubble, hoveredBubble)\n ? 0.45\n : dimmedBubble(h)\n ? 0.06\n : 0.22\n }\n strokeWidth={halo}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n vectorEffect=\"non-scaling-stroke\"\n />\n ))}\n </g>\n </svg>\n )\n})\n\nexport default BubbleHalos\n\nfunction HaloSwatch({ color }: { color: string }) {\n return (\n <svg width={18} height={10} style={{ flex: 'none' }}>\n <line\n x1={5}\n y1={5}\n x2={13}\n y2={5}\n stroke={color}\n strokeOpacity={0.35}\n strokeWidth={8}\n strokeLinecap=\"round\"\n />\n </svg>\n )\n}\n\n// One row per halo colour on screen, naming the kinds it stands for\nexport const HaloLegend = observer(function HaloLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const kindsByColor = new Map<string, Set<string>>()\n for (const h of model.bubbleHalos) {\n if (!h.whole) {\n const color = BUBBLE_KIND_COLORS[h.kind]\n const kinds = kindsByColor.get(color) ?? new Set<string>()\n kinds.add(BUBBLE_KIND_NAMES[h.kind])\n kindsByColor.set(color, kinds)\n }\n }\n return kindsByColor.size > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-halo-legend\">\n {[...kindsByColor].map(([color, kinds]) => (\n <div key={color} style={legendRowStyle}>\n <HaloSwatch color={color} />\n <span>bubble: {[...kinds].join(', ')}</span>\n </div>\n ))}\n </div>\n ) : null\n})\n", "// A key's box over the drawing, and one row in it: a swatch beside its words\nexport const legendBoxStyle = {\n background: 'rgba(255,255,255,0.82)',\n padding: '4px 6px',\n borderRadius: 3,\n fontSize: 11,\n lineHeight: '15px',\n whiteSpace: 'nowrap' as const,\n}\n\nexport const legendRowStyle = { display: 'flex', alignItems: 'center', gap: 5 }\n", "import { useEffect, useState } from 'react'\n\nimport { FACET_GAP_PX, FACET_TITLE_PX } from '@jbrowse/bandage-core/facetGrid'\nimport { Canvas2DRenderer } from '@jbrowse/bandage-core/renderer/Canvas2DRenderer'\nimport { autorun, computed } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport WalkKey from './WalkKey'\nimport { useWheelZoom } from './usePaneGestures'\n\nimport type { PaneHandlers } from './usePaneGestures'\nimport type { GraphPaneModel } from '../model'\nimport type { WalkLift } from '@jbrowse/bandage-core/walkHighlight'\n\n// The pane faceted by walk: the same layout drawn once per lifted walk, each\n// panel with that walk alone shading along itself, so walks compare by where\n// they go rather than by which lane is which colour. The panels share the\n// pane's transform, so a pan, zoom or hover in one is in all of them.\n\nconst gridStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n zIndex: 4,\n display: 'grid',\n gap: FACET_GAP_PX,\n lineHeight: 'normal',\n}\n\nconst titleStyle = {\n height: FACET_TITLE_PX,\n padding: '2px 6px',\n boxSizing: 'border-box' as const,\n fontFamily: 'inherit',\n fontSize: 11,\n color: 'inherit',\n cursor: 'pointer',\n border: 'none',\n background: 'none',\n textAlign: 'left' as const,\n display: 'block',\n}\n\nconst FacetPanel = observer(function FacetPanel({\n model,\n lift,\n width,\n height,\n cell,\n handlers,\n}: {\n model: GraphPaneModel\n lift: WalkLift\n width: number\n height: number\n cell: { gridRow: number; gridColumn: number }\n handlers: PaneHandlers\n}) {\n const [canvas, setCanvas] = useState<HTMLCanvasElement | null>(null)\n const walk = lift.walks[0]!\n useWheelZoom(canvas, model)\n\n useEffect(() => {\n if (!canvas) {\n return undefined\n }\n const renderer = new Canvas2DRenderer(canvas)\n renderer.resize(width, height)\n const drawing = computed(() => model.buildDrawing(lift, false))\n let uploaded: ReturnType<typeof model.buildDrawing>\n const dispose = autorun(() => {\n const built = drawing.get()\n if (!built) {\n return\n }\n if (built !== uploaded) {\n renderer.uploadGeometry(built.batch)\n uploaded = built\n }\n model.applyHighlights(renderer)\n model.paint(renderer)\n })\n return () => {\n dispose()\n renderer.dispose()\n }\n }, [canvas, model, lift, width, height])\n\n const label = model.walkLabel(walk.name)\n return (\n <div style={cell}>\n <button\n type=\"button\"\n style={titleStyle}\n data-testid=\"graph-facet-title\"\n onClick={() => {\n model.liftWalks([walk.name])\n model.setFacet('')\n }}\n >\n <WalkKey\n walk={walk}\n label={label}\n reference={model.walkReference}\n hint={`click to lift ${label} alone`}\n at={model.hoveredOn(walk)}\n />\n </button>\n <canvas\n ref={setCanvas}\n data-testid=\"graph-facet-canvas\"\n style={{\n width,\n height,\n display: 'block',\n cursor: model.isPanning || model.draggingNode ? 'grabbing' : 'grab',\n }}\n {...handlers}\n />\n </div>\n )\n})\n\nconst FacetPanels = observer(function FacetPanels({\n model,\n handlers,\n}: {\n model: GraphPaneModel\n handlers: PaneHandlers\n}) {\n const panels = model.facetPanels\n const grid = model.facetGrid\n const place = model.facetPlacement\n if (!panels || !grid || !place) {\n return null\n }\n const { columns, width, height } = grid\n return (\n <div\n data-testid=\"graph-facet-panels\"\n style={{\n ...gridStyle,\n width: model.paneWidth,\n minHeight: model.canvasHeight,\n gridTemplateColumns: `repeat(${columns}, ${width}px)`,\n background: model.darkMode ? '#1f1f1f' : 'white',\n }}\n >\n {panels.map((lift, i) => (\n <FacetPanel\n key={lift.walks[0]!.name}\n model={model}\n lift={lift}\n width={width}\n height={height}\n cell={{\n gridRow: Math.floor(place.cells[i]! / columns) + 1,\n gridColumn: (place.cells[i]! % columns) + 1,\n }}\n handlers={handlers}\n />\n ))}\n </div>\n )\n})\n\nexport default FacetPanels\n", "import { encodingSwatchCss } from '@jbrowse/bandage-core/walkEncoding'\nimport { walkKey } from '@jbrowse/bandage-core/walkKey'\n\nimport { legendRowStyle } from './legendStyles'\n\nimport type { LiftedWalk } from '@jbrowse/bandage-core/walkHighlight'\n\nexport const walkSwatchStyle = {\n width: 18,\n height: 8,\n borderRadius: 2,\n flex: 'none',\n}\nconst walkBlockStyle = { marginBottom: 2 }\nconst walkBarStyle = { ...walkSwatchStyle, width: 48 }\n\n// One walk's key: a swatch, or a short bar of the scale its lane shades by,\n// then its name; see walkKey for the words. `at`, where the hovered node sits\n// on the walk, stands in for the scale's stretch while there is one.\nexport default function WalkKey({\n walk,\n label,\n reference,\n hint,\n at,\n}: {\n walk: LiftedWalk\n label: string\n reference?: { name?: string; start: number; end: number }\n hint?: string\n at?: string\n}) {\n const key = walkKey(walk, reference)\n return (\n <div\n style={walkBlockStyle}\n title={[key.hover, hint].filter(Boolean).join(' \u00B7 ') || undefined}\n >\n <div style={legendRowStyle}>\n <div\n style={{\n ...(key.shades ? walkBarStyle : walkSwatchStyle),\n background: encodingSwatchCss(walk.encoding),\n }}\n />\n <span>\n <strong>{label}</strong>\n {key.delta}\n {key.outside}\n {key.reversed}\n </span>\n </div>\n {at ? (\n <div data-testid=\"graph-walk-at\">{at}</div>\n ) : key.scale ? (\n <div>{key.scale}</div>\n ) : null}\n </div>\n )\n}\n", "import { useEffect, useRef, useState } from 'react'\n\nimport {\n findHoveredEdge,\n findHoveredNode,\n} from '@jbrowse/bandage-core/util/hitDetection'\nimport { wheelZoomFactor } from '@jbrowse/bandage-core/util/wheelZoom'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\n\nimport type { GraphPaneModel } from '../model'\n\n// wheel events need passive:false to call preventDefault \u2014 React registers\n// wheel listeners as passive, so we must add this imperatively\nexport function useWheelZoom(\n canvas: HTMLCanvasElement | null | undefined,\n model: GraphPaneModel,\n) {\n useEffect(() => {\n if (!canvas) {\n return undefined\n }\n const c = canvas\n function handleWheel(e: WheelEvent) {\n if (model.hostPlacesX) {\n return\n }\n if (model.host) {\n e.stopPropagation()\n }\n e.preventDefault()\n const rect = c.getBoundingClientRect()\n model.zoom(\n wheelZoomFactor(e),\n e.clientX - rect.left,\n e.clientY - rect.top,\n )\n }\n c.addEventListener('wheel', handleWheel, { passive: false })\n return () => {\n c.removeEventListener('wheel', handleWheel)\n }\n }, [canvas, model])\n}\n\n// The pointer on a canvas drawing the pane's transform: the pane's own, or any\n// facet panel, since the panels share it. Coordinates are read against the\n// canvas the event is on.\nexport function usePaneGestures(model: GraphPaneModel) {\n // Where the pointer was last, and whether it has travelled since mousedown \u2014\n // per-gesture scratch that nothing renders from, which is what a ref is for.\n // Whether a drag is in progress is model state (`isPanning`/`draggingNode`),\n // because the cursor renders from it.\n const lastMouseRef = useRef({ x: 0, y: 0 })\n const hasMovedRef = useRef(false)\n // A pan and a hover are applied once per frame, not once per mousemove:\n // mousemove fires in bursts well above the frame rate, and each pan step\n // repainted the canvas and re-placed every overlay label, while each hover\n // step ran both hit indexes. The pending pan is the summed delta; the pending\n // hover is the last pointer position, since only the last one can be right.\n const pendingRef = useRef<{\n frame: number\n pan: { dx: number; dy: number } | null\n hover: { x: number; y: number } | null\n }>({ frame: 0, pan: null, hover: null })\n useEffect(\n () => () => {\n cancelAnimationFrame(pendingRef.current.frame)\n },\n [],\n )\n const [contextNode, setContextNode] = useState<\n { nodeId: string; top: number; left: number } | undefined\n >(undefined)\n const [contextRow, setContextRow] = useState<\n { row: number; top: number; left: number } | undefined\n >(undefined)\n\n function screenToGraph(screenX: number, screenY: number) {\n return {\n x: (screenX - model.translateX) / model.scaleX,\n y: (screenY - model.translateY) / model.scaleY,\n }\n }\n\n function getMouseCoord(e: React.MouseEvent) {\n const rect = (e.currentTarget as HTMLCanvasElement).getBoundingClientRect()\n return screenToGraph(e.clientX - rect.left, e.clientY - rect.top)\n }\n\n // The node at a graph coordinate, which mousedown, mousemove and click all\n // need. Takes the coordinate rather than the event so a caller that already\n // has one does not pay for a second getBoundingClientRect.\n function nodeAt(x: number, y: number) {\n const { nodePositions } = model\n const sx = x * model.scaleX + model.translateX\n const sy = y * model.scaleY + model.translateY\n if (model.layoutResult?.tubeMap) {\n return model.tubeMapNodeAt(sx, sy)\n }\n const onStrip = model.referenceStripNodeAt(sx, sy)\n if (onStrip) {\n return onStrip\n }\n return nodePositions\n ? findHoveredNode(\n nodePositions,\n x,\n y,\n model.axisScale,\n model.positionsVersion,\n model.nodeInk,\n )\n : null\n }\n\n function onMouseDown(e: React.MouseEvent) {\n if (e.button === 0) {\n hasMovedRef.current = false\n if (model.hostPlacesX) {\n return\n }\n if (model.host) {\n e.stopPropagation()\n }\n const { x, y } = getMouseCoord(e)\n // a tube map's boxes are the layout's, and the strip's are bp, not\n // positions to drag\n const node =\n model.layoutResult?.tubeMap ||\n e.nativeEvent.offsetY < model.referenceStripZonePx\n ? null\n : nodeAt(x, y)\n if (node) {\n model.setDraggingNode(node)\n } else {\n model.setPanning(true)\n }\n lastMouseRef.current = { x: e.clientX, y: e.clientY }\n }\n }\n\n function applyPending() {\n const pending = pendingRef.current\n pending.frame = 0\n if (pending.pan) {\n model.setTransform(\n model.scale,\n model.translateX + pending.pan.dx,\n model.translateY + pending.pan.dy,\n )\n pending.pan = null\n }\n if (pending.hover && model.nodePositions && model.graph) {\n const { x, y } = screenToGraph(pending.hover.x, pending.hover.y)\n pending.hover = null\n const node = nodeAt(x, y)\n model.setHoveredNode(node)\n model.setHoveredEdge(\n node || model.layoutResult?.tubeMap\n ? null\n : findHoveredEdge(\n model.nodePositions,\n model.graph,\n x,\n y,\n model.axisScale,\n // resolved, so the hit index bounds the ribbons that are\n // actually drawn \u2014 see effectiveDrawPaths. Facet panels draw\n // none.\n model.effectiveDrawPaths && !model.facetPanels,\n model.positionsVersion,\n model.deletionEdgeIndexes,\n model.hiddenEdgeIndexes,\n model.deletionRoutes,\n ),\n )\n }\n }\n\n function scheduleFrame() {\n if (!pendingRef.current.frame) {\n pendingRef.current.frame = requestAnimationFrame(applyPending)\n }\n }\n\n function dropPending() {\n const pending = pendingRef.current\n cancelAnimationFrame(pending.frame)\n pending.frame = 0\n pending.pan = null\n pending.hover = null\n }\n\n function onMouseMove(e: React.MouseEvent) {\n const dx = e.clientX - lastMouseRef.current.x\n const dy = e.clientY - lastMouseRef.current.y\n lastMouseRef.current = { x: e.clientX, y: e.clientY }\n\n if (Math.abs(dx) > 1 || Math.abs(dy) > 1) {\n hasMovedRef.current = true\n }\n\n const pending = pendingRef.current\n if (model.draggingNode) {\n model.moveNode(model.draggingNode, dx / model.scaleX, dy / model.scaleY)\n } else if (model.isPanning) {\n pending.pan = {\n dx: (pending.pan?.dx ?? 0) + dx,\n dy: (pending.pan?.dy ?? 0) + dy,\n }\n scheduleFrame()\n } else {\n const rect = (\n e.currentTarget as HTMLCanvasElement\n ).getBoundingClientRect()\n pending.hover = { x: e.clientX - rect.left, y: e.clientY - rect.top }\n scheduleFrame()\n }\n }\n\n function onMouseUp() {\n model.stopDragging()\n }\n\n // also fired by the canvas unmounting under a resting pointer, after the\n // view closing it has destroyed the model\n function onMouseLeave() {\n dropPending()\n if (!isAlive(model)) {\n return\n }\n model.stopDragging()\n model.setHoveredNode(null)\n model.setHoveredEdge(null)\n }\n\n // Right-clicking a node is the gesture that asks \"where is this?\", and until\n // now the graph had no answer: a node named an assembly and an offset in its\n // tags that nothing surfaced. The items come from the model's launch targets,\n // so what is offered is what can actually be opened.\n function onContextMenu(e: React.MouseEvent) {\n const { x, y } = getMouseCoord(e)\n const node = nodeAt(x, y)\n if (node) {\n e.preventDefault()\n setContextNode({ nodeId: node, top: e.clientY, left: e.clientX })\n return\n }\n const row = model.walkRowAt(\n x * model.scaleX + model.translateX,\n y * model.scaleY + model.translateY,\n )\n if (row !== undefined) {\n e.preventDefault()\n setContextRow({ row, top: e.clientY, left: e.clientX })\n }\n }\n\n function onClick(e: React.MouseEvent) {\n // a click that ended a drag selects nothing\n if (!hasMovedRef.current) {\n const { x, y } = getMouseCoord(e)\n const node = nodeAt(x, y)\n model.setSelectedNode(node)\n if (node) {\n model.showNodeDetails(node)\n }\n }\n }\n\n return {\n handlers: {\n onMouseDown,\n onMouseMove,\n onMouseUp,\n onMouseLeave,\n onClick,\n onContextMenu,\n },\n contextNode,\n contextRow,\n closeContextMenu: () => {\n setContextNode(undefined)\n setContextRow(undefined)\n },\n }\n}\n\nexport type PaneHandlers = ReturnType<typeof usePaneGestures>['handlers']\n", "import { baseEdgeCurves } from './edgeCurves'\nimport { curveBounds, pathRibbonOffsets } from './geometry'\n\nimport type { EdgeCurves } from './edgeCurves'\nimport type { DeletionRoutes } from '../layout/deletionRoutes'\nimport type { Graph, NodeSegment } from '../types'\nimport type { AxisScale } from './geometry'\n\ninterface CellEntry {\n nodeId: string\n segmentIdx: number\n}\n\n// A uniform grid only performs when its cells are about the size of the things\n// in them: too large and every query scans a crowd, too small and every item is\n// stamped into hundreds of cells. World units here are whatever the layout uses,\n// and the two differ by orders of magnitude \u2014 the force layout's are screen-ish\n// (nodes ~8 units long), while the reference-anchored layouts put x in bp, so a\n// 100 kb window is 100,000 units wide. A fixed 50 was tuned for the first and\n// left the second stamping each edge into hundreds of cells: measured 7.2 ms to\n// index 800 bp-scale edges, against 2.8 ms for 8,000 screen-scale ones.\n//\n// So the size is derived from the mean extent of the items being indexed \u2014\n// **per axis**, for the reason the query radius below is already per axis: on a\n// row layout x is bp and y is screen px, and one size taken from the two summed\n// is the x size. Applied to y it swallowed every row into one cell, so the grid\n// degenerated to a 1-D index on x and each query handed the distance loop every\n// row in the band. On HPRC's rGFA, whose mean segment is ~7 kb against a 20 px\n// row pitch, that is all of them.\nconst FALLBACK_CELL_SIZE = 50\n\nexport interface CellSize {\n x: number\n y: number\n}\n\nfunction meanExtentCellSize(extentTotal: number, count: number) {\n return count > 0 ? Math.max(1, extentTotal / count) : FALLBACK_CELL_SIZE\n}\n\n// The y size for the layouts whose items have no y extent of their own. Every\n// row there is a horizontal line, so the mean per-item extent is exactly zero\n// and says nothing about how the rows are spaced. What separates them is the\n// ROW PITCH, which is their spread over the number of rows they occupy.\nfunction rowPitchOf(boxes: { minY: number }[]) {\n const distinct = new Set<number>()\n let min = Infinity\n let max = -Infinity\n for (const box of boxes) {\n distinct.add(box.minY)\n min = Math.min(min, box.minY)\n max = Math.max(max, box.minY)\n }\n return distinct.size > 1 ? (max - min) / (distinct.size - 1) : undefined\n}\n\n// A row layout with one row has nothing to separate on y, so it takes the x\n// size and lands in one cell rather than being stamped across thousands.\nfunction cellSizeFrom(\n boxes: { minY: number }[],\n extentX: number,\n extentY: number,\n): CellSize {\n const x = meanExtentCellSize(extentX, boxes.length)\n return {\n x,\n y:\n extentY > 0\n ? meanExtentCellSize(extentY, boxes.length)\n : (rowPitchOf(boxes) ?? x),\n }\n}\n\nfunction resolveCellSize(\n given: number | CellSize | undefined,\n boxes: { minY: number }[],\n extentX: number,\n extentY: number,\n): CellSize {\n return given === undefined\n ? cellSizeFrom(boxes, extentX, extentY)\n : typeof given === 'number'\n ? { x: given, y: given }\n : given\n}\n\nfunction getOrCreateCell<T>(\n cells: Map<number, Map<number, T[]>>,\n cx: number,\n cy: number,\n) {\n let row = cells.get(cx)\n if (!row) {\n row = new Map()\n cells.set(cx, row)\n }\n let cell = row.get(cy)\n if (!cell) {\n cell = []\n row.set(cy, cell)\n }\n return cell\n}\n\nfunction addToGrid<T>(\n cells: Map<number, Map<number, T[]>>,\n cellSize: CellSize,\n minX: number,\n minY: number,\n maxX: number,\n maxY: number,\n entry: T,\n) {\n const cx0 = Math.floor(minX / cellSize.x)\n const cx1 = Math.floor(maxX / cellSize.x)\n const cy0 = Math.floor(minY / cellSize.y)\n const cy1 = Math.floor(maxY / cellSize.y)\n for (let cx = cx0; cx <= cx1; cx++) {\n for (let cy = cy0; cy <= cy1; cy++) {\n getOrCreateCell(cells, cx, cy).push(entry)\n }\n }\n}\n\n// The radius is per axis because the two axes need not be in the same units: a\n// row layout's x is bp and its y is screen px, so the same 5 px of slack is\n// hundreds of bp one way and 5 the other. Passing the x radius on both axes\n// would sweep every row in the band into the candidate set.\nfunction queryGrid<T>(\n cells: Map<number, Map<number, T[]>>,\n cellSize: CellSize,\n x: number,\n y: number,\n radiusX: number,\n radiusY: number,\n): T[] {\n const cx0 = Math.floor((x - radiusX) / cellSize.x)\n const cx1 = Math.floor((x + radiusX) / cellSize.x)\n const cy0 = Math.floor((y - radiusY) / cellSize.y)\n const cy1 = Math.floor((y + radiusY) / cellSize.y)\n const results: T[] = []\n const seen = new Set<T>()\n for (let cx = cx0; cx <= cx1; cx++) {\n const row = cells.get(cx)\n if (row) {\n for (let cy = cy0; cy <= cy1; cy++) {\n const cell = row.get(cy)\n if (cell) {\n for (const entry of cell) {\n if (!seen.has(entry)) {\n seen.add(entry)\n results.push(entry)\n }\n }\n }\n }\n }\n }\n return results\n}\n\nexport class SpatialIndex {\n private cellSize: CellSize\n private cells = new Map<number, Map<number, CellEntry[]>>()\n\n constructor(\n nodePositions: Record<string, NodeSegment[]>,\n // one number sets both axes, which is what a test that only cares about\n // bucketing wants\n cellSize?: number | CellSize,\n ) {\n // Segment boxes are collected first so the cell size can come from their\n // mean extent; the grid itself needs the size up front.\n const boxes: {\n entry: CellEntry\n minX: number\n minY: number\n maxX: number\n maxY: number\n }[] = []\n let extentX = 0\n let extentY = 0\n for (const [nodeId, segments] of Object.entries(nodePositions)) {\n for (let i = 0; i < segments.length - 1; i++) {\n const seg = segments[i]!\n const next = segments[i + 1]!\n const minX = Math.min(seg.x, next.x)\n const minY = Math.min(seg.y, next.y)\n const maxX = Math.max(seg.x, next.x)\n const maxY = Math.max(seg.y, next.y)\n extentX += maxX - minX\n extentY += maxY - minY\n boxes.push({ entry: { nodeId, segmentIdx: i }, minX, minY, maxX, maxY })\n }\n }\n\n this.cellSize = resolveCellSize(cellSize, boxes, extentX, extentY)\n for (const b of boxes) {\n addToGrid(\n this.cells,\n this.cellSize,\n b.minX,\n b.minY,\n b.maxX,\n b.maxY,\n b.entry,\n )\n }\n }\n\n query(x: number, y: number, radiusX: number, radiusY = radiusX) {\n return queryGrid(this.cells, this.cellSize, x, y, radiusX, radiusY)\n }\n}\n\nexport class EdgeSpatialIndex {\n private cellSize: CellSize\n private cells = new Map<number, Map<number, number[]>>()\n // Base curves (offset 0) by edge index \u2014 the shared derivation, which the\n // geometry builder draws the same edges from. findHoveredEdge reuses them on\n // every mousemove; path-offset variants translate them (pure translation).\n private edgeCurves: EdgeCurves\n\n constructor(\n nodePositions: Record<string, NodeSegment[]>,\n graph: Graph,\n drawPaths: boolean,\n // The transform the curves indexed here were drawn under, so hit detection\n // tests the shape on screen. See AxisScale.\n axis: AxisScale,\n cellSize?: number | CellSize,\n // Bypassed backbone ids per deletion edge, i.e. what GeometryBuilder is\n // given. Without it a deletion is indexed and hit-tested on the STRAIGHT\n // chord between its endpoints while it is drawn as an arc bowed off that\n // chord, so the shape on screen is not hoverable and the empty space where\n // the chord runs is \u2014 and the tutorial tells the reader to hover it for the\n // interval and the bp. Bowing is part of the drawn geometry, so it has to be\n // part of the geometry hit detection uses.\n deletions?: Map<number, string[]>,\n // Bumped when a drag moves the positions in place; see baseEdgeCurves.\n version = 0,\n routes?: DeletionRoutes,\n ) {\n this.edgeCurves = baseEdgeCurves(\n nodePositions,\n graph,\n axis,\n deletions,\n version,\n routes,\n )\n const boxes: {\n ei: number\n minX: number\n minY: number\n maxX: number\n maxY: number\n }[] = []\n let extentX = 0\n let extentY = 0\n for (let ei = 0; ei < graph.edges.length; ei++) {\n const edge = graph.edges[ei]!\n const fromSegments = nodePositions[edge.from]\n const toSegments = nodePositions[edge.to]\n const curves = this.edgeCurves.get(ei)\n if (fromSegments?.length && toSegments?.length && curves) {\n // The control polygon's box, which contains the curve \u2014 the same\n // measure the geometry builder culls by, from the one function that\n // takes it.\n let { minX, minY, maxX, maxY } = curveBounds(curves)\n\n // Ribbons sit off the edge itself, so the box has to hold them too. Per\n // axis and off the offsets actually used, rather than one number on\n // both: the fan is perpendicular to the edge, so an edge running along\n // x spends all of it on y and none on x, and on a row layout the two\n // axes are not even in the same units.\n const numPaths = edge.pathIds?.length ?? 0\n if (drawPaths && numPaths > 0) {\n let padX = 0\n let padY = 0\n for (const o of pathRibbonOffsets(\n fromSegments,\n toSegments,\n numPaths,\n axis,\n )) {\n padX = Math.max(padX, Math.abs(o.x))\n padY = Math.max(padY, Math.abs(o.y))\n }\n minX -= padX\n minY -= padY\n maxX += padX\n maxY += padY\n }\n\n extentX += maxX - minX\n extentY += maxY - minY\n boxes.push({ ei, minX, minY, maxX, maxY })\n }\n }\n\n this.cellSize = resolveCellSize(cellSize, boxes, extentX, extentY)\n for (const b of boxes) {\n addToGrid(this.cells, this.cellSize, b.minX, b.minY, b.maxX, b.maxY, b.ei)\n }\n }\n\n getCurves(ei: number) {\n return this.edgeCurves.get(ei)\n }\n\n query(x: number, y: number, radiusX: number, radiusY = radiusX) {\n return queryGrid(this.cells, this.cellSize, x, y, radiusX, radiusY)\n }\n}\n", "import { EdgeSpatialIndex, SpatialIndex } from './SpatialIndex'\nimport { pathRibbonOffsets, translateCurves, yToXOf } from './geometry'\n\nimport type { DeletionRoutes } from '../layout/deletionRoutes'\nimport type { Graph, NodeSegment } from '../types'\nimport type { AxisScale, BezierCurve } from './geometry'\n\nexport function distanceToSegment(\n px: number,\n py: number,\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n) {\n const dx = x2 - x1\n const dy = y2 - y1\n const lenSq = dx * dx + dy * dy\n if (lenSq === 0) {\n return Math.hypot(px - x1, py - y1)\n }\n const t = Math.max(0, Math.min(1, ((px - x1) * dx + (py - y1) * dy) / lenSq))\n return Math.hypot(px - (x1 + t * dx), py - (y1 + t * dy))\n}\n\nexport function distanceToCubicBezier(\n px: number,\n py: number,\n x1: number,\n y1: number,\n cx1: number,\n cy1: number,\n cx2: number,\n cy2: number,\n x2: number,\n y2: number,\n) {\n // To the chords between samples, not to the samples: on a long curve they\n // are tens of px apart, and a cursor on the curve between two of them\n // measured as far off it as half that gap.\n let minDist = Infinity\n const samples = 20\n let lastX = x1\n let lastY = y1\n for (let i = 1; i <= samples; i++) {\n const t = i / samples\n const u = 1 - t\n const bx =\n u * u * u * x1 +\n 3 * u * u * t * cx1 +\n 3 * u * t * t * cx2 +\n t * t * t * x2\n const by =\n u * u * u * y1 +\n 3 * u * u * t * cy1 +\n 3 * u * t * t * cy2 +\n t * t * t * y2\n minDist = Math.min(minDist, distanceToSegment(px, py, lastX, lastY, bx, by))\n lastX = bx\n lastY = by\n }\n return minDist\n}\n\nfunction distanceToBezierCurve(px: number, py: number, c: BezierCurve) {\n return distanceToCubicBezier(\n px,\n py,\n c.x0,\n c.y0,\n c.cx0,\n c.cy0,\n c.cx1,\n c.cy1,\n c.x1,\n c.y1,\n )\n}\n\nfunction distanceToEdgeCurves(\n px: number,\n py: number,\n curves: BezierCurve[],\n yToX = 1,\n) {\n let minDist = Infinity\n for (const c of curves) {\n const d = distanceToBezierCurve(\n px,\n py,\n yToX === 1\n ? c\n : {\n x0: c.x0,\n y0: c.y0 * yToX,\n cx0: c.cx0,\n cy0: c.cy0 * yToX,\n cx1: c.cx1,\n cy1: c.cy1 * yToX,\n x1: c.x1,\n y1: c.y1 * yToX,\n },\n )\n if (d < minDist) {\n minDist = d\n }\n }\n return minDist\n}\n\n// Indexes are cached against the layout they were built from, in a WeakMap\n// rather than a module-level slot. A single slot meant two graph views in one\n// session evicted each other's index on alternating mousemoves, and held the last\n// graph's positions alive for as long as the tab lived. Keyed this way each view\n// keeps its own, and an entry becomes collectable when its layout is replaced.\n//\n// `version` still has to be compared: a node drag mutates the position objects in\n// place, so the identity of `nodePositions` cannot report that it changed.\nconst nodeCache = new WeakMap<\n Record<string, NodeSegment[]>,\n { version: number; index: SpatialIndex }\n>()\n\nfunction getSpatialIndex(\n nodePositions: Record<string, NodeSegment[]>,\n version: number,\n) {\n const cached = nodeCache.get(nodePositions)\n if (cached?.version === version) {\n return cached.index\n }\n const index = new SpatialIndex(nodePositions)\n nodeCache.set(nodePositions, { version, index })\n return index\n}\n\nconst edgeCache = new WeakMap<\n Record<string, NodeSegment[]>,\n {\n graph: Graph\n drawPaths: boolean\n // compared by VALUE, not by the AxisScale's identity: the model rebuilds\n // that object whenever either scale changes, so identity would miss a cache\n // hit on every mousemove\n scaleX: number\n scaleY: number\n version: number\n index: EdgeSpatialIndex\n deletions?: Map<number, string[]>\n routes?: DeletionRoutes\n }\n>()\n\nfunction getEdgeSpatialIndex(\n nodePositions: Record<string, NodeSegment[]>,\n graph: Graph,\n drawPaths: boolean,\n axis: AxisScale,\n version: number,\n deletions?: Map<number, string[]>,\n routes?: DeletionRoutes,\n) {\n const cached = edgeCache.get(nodePositions)\n if (\n cached?.graph === graph &&\n cached.drawPaths === drawPaths &&\n cached.scaleX === axis.scaleX &&\n cached.scaleY === axis.scaleY &&\n cached.version === version &&\n cached.deletions === deletions &&\n cached.routes === routes\n ) {\n return cached.index\n }\n const index = new EdgeSpatialIndex(\n nodePositions,\n graph,\n drawPaths,\n axis,\n undefined,\n deletions,\n version,\n routes,\n )\n edgeCache.set(nodePositions, {\n graph,\n drawPaths,\n scaleX: axis.scaleX,\n scaleY: axis.scaleY,\n version,\n index,\n deletions,\n routes,\n })\n return index\n}\n\n// Every distance below is measured with y converted into x units by `yToX` (the\n// model's scaleY / scaleX), because on a row layout the two axes are bp and\n// screen px and a raw hypot over them is not a distance at all \u2014 5 bp of x and\n// 5 px of y are nothing alike. The thresholds stay screen px over the x scale,\n// which is what they always were; on an isotropic layout yToX is 1 and this is\n// the arithmetic it has always done.\n//\n// `ink` is how far from its centreline each node is drawn, in screen px, and\n// the most any node is. A node drawn thick by its depth is 18 px across at the\n// defaults, and a fixed tolerance missed the pointer on its outer ink, where\n// the link beside it took the hover instead. MIN_NODE_REACH_PX keeps a thin\n// node catchable.\nconst MIN_NODE_REACH_PX = 5\n\nexport interface NodeInk {\n halfWidthPx: (nodeId: string) => number\n maxHalfWidthPx: number\n}\n\nexport function findHoveredNode(\n nodePositions: Record<string, NodeSegment[]>,\n graphX: number,\n graphY: number,\n axis: AxisScale,\n version = 0,\n ink?: NodeInk,\n) {\n const yToX = yToXOf(axis)\n const index = getSpatialIndex(nodePositions, version)\n const reach = (px: number) => Math.max(MIN_NODE_REACH_PX, px) / axis.scaleX\n // the query has to cover the thickest node there could be\n const queryReach = reach(ink?.maxHalfWidthPx ?? 0)\n const candidates = index.query(graphX, graphY, queryReach, queryReach / yToX)\n\n // The nearest candidate, not the first one inside its reach. The reach is in\n // world units, so when zoomed out it covers several nodes at once and \"first\"\n // meant whichever the grid happened to visit first \u2014 the cursor could sit on\n // one node and highlight its neighbour.\n let hovered: string | null = null\n let best = Infinity\n for (const { nodeId, segmentIdx } of candidates) {\n const segments = nodePositions[nodeId]!\n const dist = distanceToSegment(\n graphX,\n graphY * yToX,\n segments[segmentIdx]!.x,\n segments[segmentIdx]!.y * yToX,\n segments[segmentIdx + 1]!.x,\n segments[segmentIdx + 1]!.y * yToX,\n )\n if (dist < best && dist < reach(ink?.halfWidthPx(nodeId) ?? 0)) {\n best = dist\n hovered = nodeId\n }\n }\n return hovered\n}\n\nexport function findHoveredEdge(\n nodePositions: Record<string, NodeSegment[]>,\n graph: Graph,\n graphX: number,\n graphY: number,\n axis: AxisScale,\n drawPaths: boolean,\n version = 0,\n deletions?: Map<number, string[]>,\n hiddenEdges?: ReadonlySet<number>,\n deletionRoutes?: DeletionRoutes,\n) {\n const yToX = yToXOf(axis)\n const edgeThreshold = 10 / axis.scaleX\n const edgeIndex = getEdgeSpatialIndex(\n nodePositions,\n graph,\n drawPaths,\n axis,\n version,\n deletions,\n deletionRoutes,\n )\n const candidates = edgeIndex.query(\n graphX,\n graphY,\n edgeThreshold,\n edgeThreshold / yToX,\n )\n\n // Nearest, not first \u2014 same reason as findHoveredNode.\n let hovered: number | null = null\n let best = edgeThreshold\n for (const edgeIdx of candidates) {\n const edge = graph.edges[edgeIdx]!\n const fromSegments = nodePositions[edge.from]\n const toSegments = nodePositions[edge.to]\n if (\n !fromSegments?.length ||\n !toSegments?.length ||\n hiddenEdges?.has(edgeIdx)\n ) {\n continue\n }\n\n const numPaths = edge.pathIds?.length ?? 0\n const baseCurves = edgeIndex.getCurves(edgeIdx)\n if (!baseCurves) {\n continue\n }\n let dist: number\n\n if (!drawPaths || numPaths === 0) {\n dist = distanceToEdgeCurves(graphX, graphY * yToX, baseCurves, yToX)\n } else {\n // The same offsets GeometryBuilder drew the ribbons at, from the one\n // function that decides them, so a ribbon is hoverable where it is drawn.\n let minDist = Infinity\n for (const offset of pathRibbonOffsets(\n fromSegments,\n toSegments,\n numPaths,\n axis,\n )) {\n const curves =\n offset.x === 0 && offset.y === 0\n ? baseCurves\n : translateCurves(baseCurves, offset.x, offset.y)\n const d = distanceToEdgeCurves(graphX, graphY * yToX, curves, yToX)\n if (d < minDist) {\n minDist = d\n }\n }\n dist = minDist\n }\n\n if (dist < best) {\n best = dist\n hovered = edgeIdx\n }\n }\n return hovered\n}\n", "const ZOOM_PER_NOTCH = 1.1\nconst NOTCH_PX = 100\nconst LINE_PX = 40\nconst PAGE_PX = 800\nconst PINCH_GAIN = 10\nconst MAX_NOTCHES_PER_EVENT = 2\n\n// Zoom by how far the wheel moved rather than by one step per event. A mouse\n// sends one event of about NOTCH_PX per notch and still zooms ZOOM_PER_NOTCH;\n// a trackpad sends sixty small ones a second, which at a step each compounded\n// to hundreds of times per second. A pinch arrives as ctrl+wheel with deltas a\n// tenth the size. The delta is normalized here rather than with core's\n// normalizeWheelDelta, which a released host may not export.\nexport function wheelZoomFactor(e: {\n deltaY: number\n deltaMode: number\n ctrlKey: boolean\n}) {\n const px =\n e.deltaY * (e.deltaMode === 1 ? LINE_PX : e.deltaMode === 2 ? PAGE_PX : 1)\n const notches = ((e.ctrlKey ? PINCH_GAIN : 1) * px) / NOTCH_PX\n return (\n ZOOM_PER_NOTCH **\n -Math.max(-MAX_NOTCHES_PER_EVENT, Math.min(MAX_NOTCHES_PER_EVENT, notches))\n )\n}\n", "import { useId } from 'react'\n\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\n// The session's genes drawn onto the graph: each exon outlined in the gene\n// track's CDS colour, a rounded box around the backbone stretch that carries\n// it, in layout units, moved by the same transform the halos use. The box\n// clears the node's ink, lifted lanes included, so a node or lane keeps its\n// colour inside it and an exon on a faded node reads as well as one on a lane.\n// Their names are LabelLayer's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 2,\n}\n\nexport const EXON_COLOR = '#daa520'\n// a lifted walk's lane at the least, as the geometry draws it\nconst MIN_LANE_PX = 4\nconst EXON_GAP_PX = 1\nconst EXON_LINE_PX = 2\n\nconst GenePins = observer(function GenePins({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const maskId = `exon-outline-${useId().replaceAll(/[^\\w-]/g, '')}`\n const { genePins, walkLift, nodeInk } = model\n if (genePins.length === 0) {\n return null\n }\n const {\n scaleX,\n scaleY,\n translateX,\n translateY,\n paneWidth: width,\n canvasHeight,\n } = model\n const inkPx = (nodeId: string) => {\n const own = nodeInk.halfWidthPx(nodeId) * 2\n return walkLift?.nodeIds.has(nodeId)\n ? Math.max(own, walkLift.walks.length * MIN_LANE_PX)\n : own\n }\n const stretches = genePins.flatMap(pin =>\n pin.exonsByNode.map(({ nodeId, d }) => ({\n key: `${pin.gene.name}-${pin.gene.start}-${nodeId}`,\n d,\n inner: inkPx(nodeId) + 2 * EXON_GAP_PX,\n })),\n )\n const transform = `translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`\n const stroke = {\n fill: 'none',\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n vectorEffect: 'non-scaling-stroke',\n }\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-gene-pins\"\n >\n <mask\n id={maskId}\n maskUnits=\"userSpaceOnUse\"\n x={0}\n y={0}\n width={width}\n height={canvasHeight}\n >\n <g transform={transform}>\n {stretches.map(s => (\n <path\n key={s.key}\n d={s.d}\n stroke=\"#fff\"\n strokeWidth={s.inner + 2 * EXON_LINE_PX}\n {...stroke}\n />\n ))}\n {stretches.map(s => (\n <path\n key={s.key}\n d={s.d}\n stroke=\"#000\"\n strokeWidth={s.inner}\n {...stroke}\n />\n ))}\n </g>\n </mask>\n <rect\n width={width}\n height={canvasHeight}\n fill={EXON_COLOR}\n mask={`url(#${maskId})`}\n />\n </svg>\n )\n})\n\nexport default GenePins\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2\"\n}), 'CropFree');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon([/*#__PURE__*/_jsx(\"path\", {\n d: \"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14\"\n}, \"0\"), /*#__PURE__*/_jsx(\"path\", {\n d: \"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z\"\n}, \"1\")], 'ZoomIn');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z\"\n}), 'ZoomOut');", "import CropFreeIcon from '@mui/icons-material/CropFree'\nimport ZoomInIcon from '@mui/icons-material/ZoomIn'\nimport ZoomOutIcon from '@mui/icons-material/ZoomOut'\nimport { IconButton, Tooltip, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport ColorSchemeSelect from './ColorSchemeSelect'\nimport GraphStats from './GraphStats'\nimport LayoutSelect from './LayoutSelect'\nimport RepeatSelect from './RepeatSelect'\nimport SettingsMenu from './SettingsMenu'\nimport WalkSelect from './WalkSelect'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n toolbar: {\n display: 'flex',\n alignItems: 'center',\n gap: 4,\n padding: '2px 4px',\n borderBottom: '1px solid #ddd',\n },\n})\n\nconst ZoomDisplay = observer(function ZoomDisplay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return <Typography variant=\"body2\">{model.zoomPercent}</Typography>\n})\n\nconst GraphToolbar = observer(function GraphToolbar({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n return (\n <div className={classes.toolbar}>\n <LayoutSelect model={model} />\n <ColorSchemeSelect model={model} />\n <WalkSelect model={model} />\n <RepeatSelect model={model} />\n <Tooltip title=\"Zoom in\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoom(1.5, model.viewBox.width / 2, model.viewBox.height / 2)\n }}\n >\n <ZoomInIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Zoom out\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoom(\n 1 / 1.5,\n model.viewBox.width / 2,\n model.viewBox.height / 2,\n )\n }}\n >\n <ZoomOutIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Zoom to fit\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoomToFit()\n }}\n >\n <CropFreeIcon />\n </IconButton>\n </Tooltip>\n <ZoomDisplay model={model} />\n <GraphStats model={model} />\n <SettingsMenu model={model} />\n </div>\n )\n})\n\nexport default GraphToolbar\n", "import { COLOR_SCHEMES } from '@jbrowse/bandage-core/colorSchemes'\nimport { FormControl, InputLabel, MenuItem, Select } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 100,\n },\n})\n\nconst ColorSchemeSelect = observer(function ColorSchemeSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const fixed = model.colorSchemeLock\n return (\n <FormControl\n size=\"small\"\n className={classes.formControl}\n disabled={fixed !== undefined}\n title={fixed?.why}\n >\n <InputLabel>Color</InputLabel>\n <Select\n value={model.chosenColorScheme}\n label=\"Color\"\n renderValue={fixed ? () => fixed.value : undefined}\n onChange={e => {\n model.setColorScheme(e.target.value)\n }}\n >\n {COLOR_SCHEMES.map(({ value, label }) => (\n <MenuItem key={value} value={value}>\n {label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default ColorSchemeSelect\n", "import { Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n stats: {\n marginLeft: 'auto',\n },\n perf: {\n color: '#888',\n fontVariantNumeric: 'tabular-nums',\n },\n})\n\nfunction fmtMs(ms: number | undefined) {\n return ms === undefined ? '\u2013' : `${Math.round(ms)}ms`\n}\n\n// The perf READOUT, off by default: it sat in the toolbar of every published\n// graph figure, where one machine's fetch time is a number a reader has to work\n// out is not about them. `showPerf` is in the settings menu.\n//\n// The numbers themselves are not conditional \u2014 they ride the stats element's\n// data-* attributes either way (see GraphStats), so a browser test asserting a\n// timing budget never depends on a display setting, and turning the text off\n// costs no coverage. They live there rather than on this element so that\n// switching the text off leaves no empty node behind to carry them.\nconst GraphPerf = observer(function GraphPerf({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { lastFetchMs, lastLayoutMs, lastGeometryMs } = model\n const hasMetrics =\n lastFetchMs !== undefined ||\n lastLayoutMs !== undefined ||\n lastGeometryMs !== undefined\n return model.showPerf && hasMetrics ? (\n <Typography\n variant=\"caption\"\n className={classes.perf}\n data-testid=\"graph-perf-stats\"\n >\n fetch {fmtMs(lastFetchMs)} \u00B7 layout {fmtMs(lastLayoutMs)} \u00B7 geom{' '}\n {fmtMs(lastGeometryMs)}\n </Typography>\n ) : null\n})\n\nconst GraphStats = observer(function GraphStats({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n return (\n <div\n className={classes.stats}\n data-testid=\"graph-stats\"\n data-node-count={model.nodeCount}\n data-edge-count={model.edgeCount}\n data-path-count={model.pathCount}\n // unconditional, whatever `showPerf` is doing to the text beside them \u2014\n // see GraphPerf\n data-fetch-ms={model.lastFetchMs ?? ''}\n data-layout-ms={model.lastLayoutMs ?? ''}\n data-geometry-ms={model.lastGeometryMs ?? ''}\n data-geometry-strokes={model.lastGeometryStrokeCount ?? ''}\n >\n <Typography variant=\"body2\" component=\"span\">\n {model.nodeCount} nodes, {model.edgeCount} edges\n {model.pathCount > 0 ? `, ${model.pathCount} paths` : ''}\n </Typography>{' '}\n <GraphPerf model={model} />\n </div>\n )\n})\n\nexport default GraphStats\n", "import { LAYOUT_MODES } from '@jbrowse/bandage-core/layoutModes'\nimport {\n FormControl,\n InputLabel,\n MenuItem,\n Select,\n Tooltip,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 150,\n },\n})\n\nconst LayoutSelect = observer(function LayoutSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { graph } = model\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Layout</InputLabel>\n <Select\n value={model.chosenLayoutMode}\n label=\"Layout\"\n data-testid=\"graph-layout-select\"\n onChange={e => {\n void model.switchLayout(e.target.value)\n }}\n >\n {LAYOUT_MODES.map(({ value, label, description, available }) => (\n <MenuItem\n key={value}\n value={value}\n disabled={graph ? !available(graph) : false}\n >\n <Tooltip title={description} placement=\"right\">\n <span>{label}</span>\n </Tooltip>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default LayoutSelect\n", "import { FormControl, InputLabel, MenuItem, Select } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 130,\n maxWidth: 240,\n },\n})\n\n// Which tandem repeat array the walk rows measure between and tile by, from\n// the session's repeat annotation over the window. Only the walk rows read it.\nconst RepeatSelect = observer(function RepeatSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { repeatChoices } = model\n if (model.chosenLayoutMode !== 'walkrows' || repeatChoices.length === 0) {\n return null\n }\n const keys = new Set(repeatChoices.map(r => r.key))\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Repeat</InputLabel>\n <Select\n value={keys.has(model.repeatKey) ? model.repeatKey : ''}\n label=\"Repeat\"\n data-testid=\"graph-repeat-select\"\n onChange={e => {\n model.setRepeatKey(e.target.value)\n }}\n >\n <MenuItem value=\"\">\n <em>Whole window</em>\n </MenuItem>\n {repeatChoices.map(({ key, name, unit }) => (\n <MenuItem key={key} value={key}>\n {name} \u00B7 {unit.toLocaleString()} bp unit\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default RepeatSelect\n", "import { useState } from 'react'\n\nimport { CascadingMenuButton } from '@jbrowse/core/ui'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport MoreVertIcon from '@mui/icons-material/MoreVert'\nimport SettingsIcon from '@mui/icons-material/Settings'\nimport { observer } from 'mobx-react'\n\nimport GraphSettingsDialog from './GraphSettingsDialog'\n\nimport type { GraphPaneModel } from '../model'\n\nconst SettingsMenu = observer(function SettingsMenu({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const [settingsOpen, setSettingsOpen] = useState(false)\n\n return (\n <>\n <CascadingMenuButton\n size=\"small\"\n menuItems={[\n {\n type: 'checkbox' as const,\n label: 'Linear layout',\n checked: model.linearLayout,\n onClick: () => {\n model.setLinearLayout(!model.linearLayout)\n void model.recomputeLayout()\n },\n },\n {\n type: 'checkbox' as const,\n label: 'Show deletion edges',\n checked: model.showDeletionEdges,\n onClick: () => {\n model.setShowDeletionEdges(!model.showDeletionEdges)\n },\n },\n {\n type: 'checkbox' as const,\n label: 'Show timings',\n checked: model.showPerf,\n onClick: () => {\n model.setShowPerf(!model.showPerf)\n },\n },\n { type: 'divider' as const },\n {\n label: 'Settings',\n icon: SettingsIcon,\n onClick: () => {\n setSettingsOpen(true)\n },\n },\n { type: 'divider' as const },\n {\n label: 'Return to import form',\n icon: DeleteIcon,\n onClick: () => {\n model.clearGraph()\n },\n },\n ]}\n >\n <MoreVertIcon />\n </CascadingMenuButton>\n\n <GraphSettingsDialog\n model={model}\n open={settingsOpen}\n onClose={() => {\n setSettingsOpen(false)\n }}\n />\n </>\n )\n})\n\nexport default SettingsMenu\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z\"\n}), 'Delete');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2\"\n}), 'MoreVert');", "import {\n Checkbox,\n FormControl,\n InputLabel,\n ListItemText,\n MenuItem,\n Select,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 130,\n maxWidth: 260,\n },\n})\n\n// Which walks to lift out of the drawing: Bandage's path highlight, for as many\n// of the haplotypes a GBZ cut carries as the reader picks. Absent from a graph\n// with no walks, and from a tube map, whose tubes are the walks.\nconst WalkSelect = observer(function WalkSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { walkChoices } = model\n if (walkChoices.length === 0 || !model.liftsWalks) {\n return null\n }\n const names = new Set(walkChoices.map(c => c.name))\n const labels = new Map(walkChoices.map(c => [c.name, c.label]))\n const picked = model.walkLayers\n .map(layer => layer.walk)\n .filter(name => names.has(name))\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Walks</InputLabel>\n <Select\n multiple\n value={picked}\n label=\"Walks\"\n data-testid=\"graph-walk-select\"\n renderValue={selected => selected.map(n => labels.get(n)).join(', ')}\n onChange={e => {\n const { value } = e.target\n model.liftWalks(typeof value === 'string' ? value.split(',') : value)\n }}\n >\n {walkChoices.map(({ name, label }) => (\n <MenuItem key={name} value={name} dense>\n <Checkbox size=\"small\" checked={picked.includes(name)} />\n <ListItemText primary={label} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default WalkSelect\n", "import { BUBBLE_KIND_COLORS } from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { geneCoverageNote } from '@jbrowse/bandage-core/labelLayout'\nimport { LABEL_PX } from '@jbrowse/bandage-core/overlayLabels'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { observer } from 'mobx-react'\n\nimport { EXON_COLOR } from './GenePins'\nimport LabelChip from './LabelChip'\n\nimport type { GraphPaneModel } from '../model'\nimport type {\n BubbleHalo,\n RouteLabel,\n} from '@jbrowse/bandage-core/bubbles/bubbleHalos'\n\n// Every chip drawn over the graph, above all of its ink: bubble names, gene\n// names on their pins, and the routes' walkers. `overlayLabels` has placed\n// them against each other and against the row labels already.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 3,\n}\n\nconst GENE_INK = '#1c1c22'\n\nconst LabelLayer = observer(function LabelLayer({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbles, genes, routes } = model.overlayLabels\n if (bubbles.length + genes.length + routes.length === 0) {\n return null\n }\n const { walkLift, scaleY, translateY, contigThickness } = model\n // lifted walks dim the bubbles none of them enters and the routes none of\n // them takes\n const dimmedBubble = (h: BubbleHalo) =>\n walkLift !== undefined && !h.nodeIds.some(id => walkLift.nodeIds.has(id))\n const dimmedRoute = (r: RouteLabel) =>\n walkLift !== undefined && !r.route.walks.some(w => walkLift.names.has(w))\n\n return (\n <svg\n style={svgStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n data-testid=\"graph-label-layer\"\n >\n {genes.map(({ item: pin, x, y, w, text }) => {\n const { gene } = pin\n const note = geneCoverageNote(pin)\n return (\n <g key={`${gene.name}-${gene.start}`}>\n <line\n x1={x}\n x2={x}\n y1={y - LABEL_PX - 2}\n y2={pin.at.y * scaleY + translateY + contigThickness / 2}\n stroke={GENE_INK}\n strokeWidth={0.8}\n strokeOpacity={0.6}\n />\n <LabelChip\n x={x}\n y={y}\n w={w}\n text={gene.name}\n note={text.slice(gene.name.length) || undefined}\n color={GENE_INK}\n edge={EXON_COLOR}\n italic\n title={`${gene.name} ${gene.refName}:${gene.start.toLocaleString()}-${gene.end.toLocaleString()}${note ? `, ${note} in the cut` : ''}`}\n testId=\"graph-gene-pin-label\"\n />\n </g>\n )\n })}\n {routes.map(({ item: { halo: h, route }, x, y, w, text }) => (\n <LabelChip\n key={`${h.bubble.start}-${h.bubble.end}-${route.route.steps.join(',')}`}\n x={x}\n y={y}\n w={w}\n text={text}\n color={BUBBLE_KIND_COLORS[h.kind]}\n small\n dimmed={dimmedRoute(route)}\n title={`${route.route.walks.length} walk(s): ${route.route.walks.join(', ')}`}\n testId=\"graph-route-label\"\n />\n ))}\n {bubbles.map(({ item: h, x, y, w, text }) => (\n <LabelChip\n key={`${h.bubble.start}-${h.bubble.end}`}\n x={x}\n y={y}\n w={w}\n text={text}\n color={BUBBLE_KIND_COLORS[h.kind]}\n dimmed={dimmedBubble(h)}\n title={`${h.label}\\n${h.bubble.segmentCount} segments \u00B7 click to open`}\n testId=\"graph-bubble-halo-label\"\n onClick={() => {\n void model.popBubble(h.bubble)\n }}\n // a leave also fires as the view closing it unmounts the chip\n onHover={hovered => {\n if (isAlive(model)) {\n model.setHoveredBubble(hovered ? h.bubble : null)\n }\n }}\n />\n ))}\n </svg>\n )\n})\n\nexport default LabelLayer\n", "import { LABEL_PAD, LABEL_PX } from '@jbrowse/bandage-core/overlayLabels'\n\n// One label on an overlay: a white chip with a coloured edge and text, its\n// baseline at y and centred on x. A note follows the text in plain type.\nexport default function LabelChip({\n x,\n y,\n w,\n text,\n note,\n color,\n edge = color,\n italic,\n small,\n dimmed,\n title,\n testId,\n onClick,\n onHover,\n}: {\n x: number\n y: number\n w: number\n text: string\n note?: string\n color: string\n edge?: string\n italic?: boolean\n small?: boolean\n dimmed?: boolean\n title?: string\n testId?: string\n onClick?: () => void\n onHover?: (hovered: boolean) => void\n}) {\n return (\n <g\n style={{\n pointerEvents: onClick || onHover ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : undefined,\n opacity: dimmed ? 0.35 : 1,\n }}\n data-testid={testId}\n onClick={onClick}\n onMouseEnter={() => {\n onHover?.(true)\n }}\n onMouseLeave={() => {\n onHover?.(false)\n }}\n >\n {title ? <title>{title}</title> : null}\n <rect\n x={x - w / 2}\n y={y - LABEL_PX - LABEL_PAD + 2}\n width={w}\n height={LABEL_PX + LABEL_PAD * 2 - 2}\n rx={3}\n fill=\"rgba(255,255,255,0.85)\"\n stroke={edge}\n strokeWidth={small ? 0.6 : 1}\n />\n <text\n x={x}\n y={y}\n fontSize={small ? LABEL_PX - 1 : LABEL_PX}\n fontFamily=\"sans-serif\"\n fontStyle={italic ? 'italic' : undefined}\n fontWeight={italic ? 600 : undefined}\n fill={color}\n textAnchor=\"middle\"\n >\n {text}\n {note ? (\n <tspan fontStyle=\"normal\" fontWeight=\"normal\">\n {note}\n </tspan>\n ) : null}\n </text>\n </g>\n )\n}\n", "import { useEffect, useRef } from 'react'\n\nimport { drawReferenceStrip } from '@jbrowse/bandage-core/referenceStrip'\nimport { LIFT_BACKDROP_CSS } from '@jbrowse/bandage-core/renderer/GeometryBuilder'\nimport { encodingSwatchCss } from '@jbrowse/bandage-core/walkEncoding'\nimport { getDpr } from '@jbrowse/render-core/canvas2dUtils'\nimport { autorun } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\n\nconst canvasStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n zIndex: 5,\n}\n\n// Each reference segment at its bp in the linear view, over a drawing that\n// has no bp axis of its own. Repainted by an autorun, so a pan in the linear\n// view moves the strip in the same frame as its other tracks.\nconst ReferenceStripOverlay = observer(function ReferenceStripOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { referenceStripShown, paneWidth, canvasHeight } = model\n useEffect(\n () =>\n autorun(() => {\n const canvas = ref.current\n const frame = model.referenceStripFrame\n const ctx = canvas?.getContext('2d')\n if (canvas && ctx && frame && model.referenceStripShown) {\n const dpr = getDpr()\n const width = model.paneWidth\n const height = model.canvasHeight\n canvas.width = Math.round(width * dpr)\n canvas.height = Math.round(height * dpr)\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0)\n ctx.clearRect(0, 0, width, height)\n drawReferenceStrip(ctx, model.referenceStripBlocks, frame, {\n width,\n lit: model.referenceStripLit,\n darkMode: model.darkMode,\n dpr,\n })\n }\n }),\n [model],\n )\n return (\n <canvas\n ref={ref}\n data-testid={referenceStripShown ? 'graph-reference-strip' : undefined}\n style={{\n ...canvasStyle,\n width: paneWidth,\n height: canvasHeight,\n display: referenceStripShown ? 'block' : 'none',\n }}\n />\n )\n})\n\nexport default ReferenceStripOverlay\n\nconst SWATCH_PX = 18\n\nconst RAMP_SWATCH =\n 'linear-gradient(to right, hsl(0, 70%, 50%) 0 33%, hsl(120, 70%, 50%) 33% 61%, hsl(240, 70%, 50%) 61%)'\n\n// A scheme other than the ramp shows a few of the strip's own blocks in bp\n// order, as the strip draws them, rather than a rainbow it does not\nconst SAMPLED_BLOCKS = 6\n\nfunction sampledSwatch(colors: string[]) {\n const distinct = colors.filter((c, i) => c !== colors[i - 1])\n const n = Math.min(SAMPLED_BLOCKS, distinct.length)\n const picked = Array.from(\n { length: n },\n (_, i) =>\n distinct[n > 1 ? Math.round((i * (distinct.length - 1)) / (n - 1)) : 0]!,\n )\n return picked.length > 1\n ? `linear-gradient(to right, ${picked.join(', ')})`\n : (picked[0] ?? LIFT_BACKDROP_CSS)\n}\n\n// the strip's own colours: a row per lifted walk in its lane's, else the\n// node scheme's\nfunction StripSwatch({\n rows,\n}: {\n rows: { key: string; background: string }[]\n}) {\n return (\n <div style={{ width: SWATCH_PX, flex: 'none' }}>\n {rows.map(({ key, background }) => (\n <div\n key={key}\n style={{ height: rows.length > 1 ? 3 : 4, background }}\n />\n ))}\n </div>\n )\n}\n\nfunction stripRows(model: GraphPaneModel) {\n return (\n model.walkLift?.walks.map(w => ({\n key: w.name,\n background: encodingSwatchCss(w.encoding),\n })) ?? [\n {\n key: 'scheme',\n background:\n model.effectiveColorScheme === 'reference-position'\n ? RAMP_SWATCH\n : sampledSwatch(model.referenceStripBlocks.map(b => b.colors[0]!)),\n },\n ]\n )\n}\n\nfunction OverhangSwatch() {\n return (\n <svg width={SWATCH_PX} height={10} style={{ flex: 'none' }}>\n <path d=\"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z\" fill=\"#18181c\" />\n </svg>\n )\n}\n\n// Hovering a node boxes its span on the strip and draws a leader to it\nexport const ReferenceStripLegend = observer(function ReferenceStripLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const rowPerWalk = (model.walkLift?.walks.length ?? 0) > 1\n return model.referenceStripShown ? (\n <div style={legendBoxStyle} data-testid=\"graph-reference-strip-legend\">\n <div style={legendRowStyle}>\n <StripSwatch rows={stripRows(model)} />\n <span>\n top strip: reference segments at their bp\n {rowPerWalk ? ', a row per walk' : ''}\n </span>\n </div>\n {model.referenceStripFaded ? (\n <div style={legendRowStyle}>\n <StripSwatch\n rows={[{ key: 'pale', background: LIFT_BACKDROP_CSS }]}\n />\n <span>\n reference not on{' '}\n {rowPerWalk ? \"that row's walk\" : model.liftedWalksLabel}\n </span>\n </div>\n ) : null}\n {model.referenceStripOverhangs ? (\n <div style={legendRowStyle}>\n <OverhangSwatch />\n <span>the graph draws reference past this edge</span>\n </div>\n ) : null}\n </div>\n ) : null\n})\n", "import { useEffect, useRef } from 'react'\nimport type { ReactNode } from 'react'\n\nimport { formatBp } from '@jbrowse/bandage-core/graphLabels'\nimport { drawTubeMapRuler, rulerInk } from '@jbrowse/bandage-core/tubeMap/axis'\nimport { drawTubeMapConnectors } from '@jbrowse/bandage-core/tubeMap/connectors'\nimport {\n deviationInk,\n drawDeviationMarks,\n} from '@jbrowse/bandage-core/tubeMap/deviations'\nimport { drawTubeMap } from '@jbrowse/bandage-core/tubeMap/draw'\nimport { drawTubeMapGenes } from '@jbrowse/bandage-core/tubeMap/genes'\nimport {\n FORWARD_READ_COLORS,\n REVERSE_READ_COLORS,\n} from '@jbrowse/bandage-core/tubeMap/reads'\nimport { getDpr } from '@jbrowse/render-core/canvas2dUtils'\nimport { autorun } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\n\nconst canvasStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n zIndex: 1,\n}\n\n// The tube map's ink, over the canvas, which draws nothing under a tube map\n// layout. Above the tubes go the session's genes in a view of its own, or in\n// a linear view the bands tying each reference box to its bp there; under\n// them a reference ruler, unless the linear view's is already the axis.\n// Repainted by an autorun on every change of transform, so a pan in the linear\n// view above moves the tubes in the same frame as its other tracks.\nconst TubeMapOverlay = observer(function TubeMapOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { tubeMapPicture, paneWidth, canvasHeight } = model\n useEffect(\n () =>\n autorun(() => {\n const canvas = ref.current\n const picture = model.tubeMapPicture\n const frame = model.tubeMapFrame\n const ctx = canvas?.getContext('2d')\n if (canvas && ctx && picture && frame) {\n const dpr = getDpr()\n const width = model.paneWidth\n const height = model.canvasHeight\n canvas.width = Math.round(width * dpr)\n canvas.height = Math.round(height * dpr)\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0)\n ctx.clearRect(0, 0, width, height)\n const tubeFrame = {\n ...frame,\n width,\n highlightNode: model.hoveredNode ?? model.selectedNode,\n darkMode: model.darkMode,\n tubeColors: model.tubeMapTubeColors,\n nodeColors: model.tubeMapNodeColors,\n }\n drawTubeMap(ctx, picture, tubeFrame)\n drawDeviationMarks(ctx, model.tubeMapDeviations, tubeFrame)\n drawTubeMapConnectors(\n ctx,\n model.tubeMapConnectors,\n model.connectorZoneBottom,\n tubeFrame,\n )\n const { bounds } = picture\n drawTubeMapGenes(\n ctx,\n model.tubeMapGenes,\n tubeFrame,\n frame.y(bounds.minY) - 2,\n )\n const boxes = model.tubeMapRulerBoxes\n if (boxes) {\n drawTubeMapRuler(\n ctx,\n boxes,\n tubeFrame,\n frame.y(bounds.maxY) + 4,\n model.layoutResult?.referenceAxis,\n )\n }\n }\n }),\n [model],\n )\n // Mounted whether or not there is a tube map, so the autorun above has its\n // canvas the moment a layout brings one.\n return (\n <canvas\n ref={ref}\n data-testid={tubeMapPicture ? 'graph-tube-map' : undefined}\n style={{\n ...canvasStyle,\n width: paneWidth,\n height: canvasHeight,\n display: tubeMapPicture ? 'block' : 'none',\n }}\n />\n )\n})\n\nexport default TubeMapOverlay\n\nconst SWATCH_PX = 18\n\n// Two boxes' brackets, as the ruler draws them under every box\nfunction BracketSwatch() {\n const brackets = [\n [0.5, 5.5],\n [8.5, SWATCH_PX - 0.5],\n ]\n return (\n <svg width={SWATCH_PX} height={7} style={{ flex: 'none' }}>\n <path\n d={brackets.map(([x0, x1]) => `M${x0},6 V1.5 H${x1} V6`).join(' ')}\n fill=\"none\"\n stroke={rulerInk()}\n strokeWidth={1}\n />\n </svg>\n )\n}\n\nconst barSwatchStyle = { width: SWATCH_PX, height: 7, flex: 'none' }\n\nconst tubeSwatchStyle = {\n ...barSwatchStyle,\n display: 'flex',\n justifyContent: 'center',\n backgroundColor: '#b8b8c0',\n}\n\nfunction TickSwatch() {\n return (\n <div style={tubeSwatchStyle}>\n <div style={{ width: 2, backgroundColor: deviationInk() }} />\n </div>\n )\n}\n\n// A read takes one shade of its strand's palette, varied so neighbours differ\nfunction ReadSwatch({ colors }: { colors: readonly string[] }) {\n const step = 100 / colors.length\n const stops = colors.map((c, i) => `${c} ${i * step}% ${(i + 1) * step}%`)\n return (\n <div\n style={{\n ...barSwatchStyle,\n background: `linear-gradient(to right, ${stops.join(', ')})`,\n }}\n />\n )\n}\n\nconst glyphSwatchStyle = {\n width: SWATCH_PX,\n flex: 'none',\n textAlign: 'center' as const,\n fontFamily: 'monospace',\n fontSize: 12,\n}\n\nfunction DeletionSwatch() {\n return <div style={{ ...barSwatchStyle, backgroundColor: 'grey' }} />\n}\n\nfunction LegendRow({\n swatch,\n children,\n}: {\n swatch: ReactNode\n children: ReactNode\n}) {\n return (\n <div style={legendRowStyle}>\n {swatch}\n <span>{children}</span>\n </div>\n )\n}\n\n// What a tube map draws that nothing else on screen explains, each listed\n// only while it applies\nexport const TubeMapLegend = observer(function TubeMapLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { logWidths, foldBp, forwardReads, reverseReads, mismatches } =\n model.tubeMapKeys\n const rows = [\n forwardReads && (\n <LegendRow key=\"fwd\" swatch={<ReadSwatch colors={FORWARD_READ_COLORS} />}>\n read on the forward strand\n </LegendRow>\n ),\n reverseReads && (\n <LegendRow key=\"rev\" swatch={<ReadSwatch colors={REVERSE_READ_COLORS} />}>\n read on the reverse strand\n </LegendRow>\n ),\n mismatches.has('substitution') && (\n <LegendRow key=\"sub\" swatch={<span style={glyphSwatchStyle}>A</span>}>\n a read's base unlike the node's\n </LegendRow>\n ),\n mismatches.has('insertion') && (\n <LegendRow key=\"ins\" swatch={<span style={glyphSwatchStyle}>*</span>}>\n bases a read inserts\n </LegendRow>\n ),\n mismatches.has('deletion') && (\n <LegendRow key=\"del\" swatch={<DeletionSwatch />}>\n bases a read skips\n </LegendRow>\n ),\n foldBp !== undefined && (\n <LegendRow key=\"fold\" swatch={<TickSwatch />}>\n a haplotype's variant under {formatBp(foldBp)}\n </LegendRow>\n ),\n logWidths && (\n <LegendRow key=\"log\" swatch={<BracketSwatch />}>\n width grows with log of length\n </LegendRow>\n ),\n ].filter(Boolean)\n return rows.length > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-tube-map-legend\">\n {rows}\n </div>\n ) : null\n})\n", "import { Button } from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\nconst style = {\n position: 'absolute' as const,\n left: 8,\n zIndex: 5,\n background: 'rgba(255,255,255,0.9)',\n textTransform: 'none' as const,\n}\n\nconst UnpopButton = observer(function UnpopButton({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { poppedFrom } = model\n return poppedFrom ? (\n <Button\n size=\"small\"\n variant=\"outlined\"\n style={{ ...style, ...(model.facetPanels ? { bottom: 8 } : { top: 8 }) }}\n data-testid=\"graph-unpop-bubble\"\n onClick={() => {\n void model.unpopBubble()\n }}\n >\n \u25C0 Back to {poppedFrom.label}\n </Button>\n ) : null\n})\n\nexport default UnpopButton\n", "import { Menu } from '@jbrowse/core/ui'\nimport LineStyleIcon from '@mui/icons-material/LineStyle'\nimport { observer } from 'mobx-react'\n\nimport { locLabel } from '../../launchFromGraph/contributors'\n\nimport type { GraphPaneModel } from '../model'\nimport type { WalkRows } from '@jbrowse/bandage-core/layout/walkRows'\n\n// A walk row's bar stands for a span of its haplotype's own contig, so the\n// question a right-click asks is answered by a linear view on that assembly,\n// with its genes\nexport const WalkRowContextMenu = observer(function WalkRowContextMenu({\n model,\n row,\n bars,\n top,\n left,\n onClose,\n}: {\n model: GraphPaneModel\n row: number\n // the rows `row` indexes, walk rows' own unless a strip's\n bars?: WalkRows\n top: number\n left: number\n onClose: () => void\n}) {\n const target = model.walkRowLaunchTarget(row, bars ?? model.walkRowBars)\n const assembly = target?.assembly\n return (\n <Menu\n open\n anchorReference=\"anchorPosition\"\n anchorPosition={{ top, left }}\n onClose={() => {\n onClose()\n }}\n onMenuItemClick={callback => {\n callback()\n }}\n menuItems={[\n target && assembly\n ? {\n label: `Linear genome view \u2014 ${assembly} ${locLabel(target.location)}`,\n icon: LineStyleIcon,\n onClick: () => {\n model.showInLinearView({ location: target.location, assembly })\n },\n }\n : {\n label: 'Linear genome view',\n icon: LineStyleIcon,\n disabled: true,\n disabledHelpText: target\n ? `No assembly in this session is ${target.location.haplotype ?? target.label}`\n : 'This walk states no contig coordinates',\n onClick: () => {},\n },\n ]}\n />\n )\n})\n", "import { useId } from 'react'\n\nimport {\n BAR_PX,\n DISAGREES,\n GAP_PX,\n GENE_INK,\n walkRowsKey,\n walkRowsTree,\n} from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport { RAMP_GRADIENT_CSS } from '@jbrowse/bandage-core/referenceRampCss'\nimport { observer } from 'mobx-react'\n\nimport ElTree from './ElTree'\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\nimport { CALL_TOLERANCE } from '../repeats/walkCalls'\n\nimport type { GraphPaneModel } from '../model'\nimport type { KeySwatch } from '@jbrowse/bandage-core/layout/walkRowDraw'\n\n// The walk-rows layout's bars: one per haplotype walk under the reference\n// row, each on its own bp axis from the window's left edge, drawn from core's\n// walkRowsTree: runs coloured by whether they are on the reference walk's\n// path, unit separators, each row's genes from its own assembly's\n// annotation, the allele a repeat genotype called and a readout. Under the\n// reference-position ramp an aligned run takes the hue of the reference it is\n// threaded through. In a tandem array that is the aligner's pick among\n// near-identical copies, so the hue says which reference copy the graph used,\n// not which one a copy resembles.\n//\n// The walk rows pair a repeat record's allele with each walk \u2014 see\n// repeats/walkCalls.ts, which also holds the threshold a red readout is read\n// off. Colouring each copy by its unit is jbrowse-plugin-tandem-repeat's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 3,\n}\n\nconst CALL_TICK = '#111'\nconst UNBACKED_TICK = '#9e9e9e'\n\nconst swatchStyle = { width: 18, height: BAR_PX - 4, borderRadius: 2 }\nconst tickSwatchStyle = {\n ...swatchStyle,\n display: 'flex',\n justifyContent: 'center',\n}\n\nfunction TickSwatch({ color }: { color: string }) {\n return (\n <div style={tickSwatchStyle}>\n <div style={{ width: 2, backgroundColor: color }} />\n </div>\n )\n}\n\nexport function Swatch({ swatch }: { swatch: KeySwatch }) {\n return swatch.kind === 'gene' ? (\n <div\n style={{\n ...swatchStyle,\n boxSizing: 'border-box',\n border: `1.5px solid ${GENE_INK}`,\n borderRadius: 0,\n }}\n />\n ) : (\n <div\n style={{\n ...swatchStyle,\n height: swatch.kind === 'gap' ? GAP_PX : swatchStyle.height,\n background: swatch.fill,\n }}\n />\n )\n}\n\n// What the bar colours, genes and ticks mean, in the legend stack with the\n// other keys. Each tick row appears once the rows hold one, so a catalogue\n// with no genotypes keeps the plain key.\nexport const WalkRowsLegend = observer(function WalkRowsLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const bars = model.walkRowBars\n if (!bars) {\n return null\n }\n const calls = [bars.reference, ...bars.rows].flatMap(row => row.call ?? [])\n const key = walkRowsKey(bars, {\n ramp: model.referenceRampDomain,\n rampCss: RAMP_GRADIENT_CSS,\n genes: model.walkRowGenes?.size ? model.walkRowGeneGaps : undefined,\n })\n return (\n <div style={legendBoxStyle} data-testid=\"graph-walk-rows-legend\">\n {key.map(entry =>\n entry.note ? (\n <div key={entry.label} style={{ color: '#666', fontStyle: 'italic' }}>\n {entry.label}\n </div>\n ) : (\n <div key={entry.label} style={legendRowStyle}>\n <Swatch swatch={entry.swatch} />\n <span>{entry.label}</span>\n </div>\n ),\n )}\n {calls.some(call => call.spanningReads !== 0) ? (\n <div style={legendRowStyle}>\n <TickSwatch color={CALL_TICK} />\n <span>allele length called for this walk</span>\n </div>\n ) : null}\n {calls.some(call => call.spanningReads === 0) ? (\n <div style={legendRowStyle}>\n <TickSwatch color={UNBACKED_TICK} />\n <span>called with no read spanning it</span>\n </div>\n ) : null}\n {calls.some(call => call.agrees === false) ? (\n <div style={legendRowStyle}>\n <div style={swatchStyle} />\n <span style={{ color: DISAGREES }}>\n walk and call over {Math.round(CALL_TOLERANCE * 100)}% apart\n </span>\n </div>\n ) : null}\n </div>\n )\n})\n\nconst WalkRowsOverlay = observer(function WalkRowsOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const idPrefix = useId().replace(/[^\\w-]/g, '')\n const bars = model.walkRowBars\n if (!bars) {\n return null\n }\n const { paneWidth: width, canvasHeight } = model\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-walk-rows\"\n >\n <ElTree\n el={walkRowsTree(\n bars,\n {\n scaleX: model.scaleX,\n scaleY: model.scaleY,\n translateX: model.translateX,\n translateY: model.translateY,\n width,\n height: canvasHeight,\n },\n {\n ramp: model.referenceRampDomain,\n rowGenes: model.walkRowGenes,\n idPrefix,\n },\n )}\n />\n </svg>\n )\n})\n\nexport default WalkRowsOverlay\n", "import { createElement } from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { El } from '@jbrowse/bandage-core/el'\n\n// SVG's attribute names as React's props: `class` is className, `data-` and\n// `aria-` keep their dashes, the rest are camel-cased (`stroke-width` is\n// strokeWidth)\nfunction propName(name: string) {\n return name === 'class'\n ? 'className'\n : /^(data|aria)-/.test(name)\n ? name\n : name.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase())\n}\n\nfunction toReact(node: El | string, key: number): ReactNode {\n if (typeof node === 'string') {\n return node\n }\n const props: Record<string, unknown> = { key }\n for (const [name, value] of Object.entries(node.attrs)) {\n if (value !== undefined) {\n props[propName(name)] = value\n }\n }\n return createElement(node.tag, props, ...node.children.map(toReact))\n}\n\n// A core element tree as React elements\nexport default function ElTree({ el }: { el: El }) {\n return toReact(el, 0)\n}\n", "import { useId, useMemo, useState } from 'react'\n\nimport {\n walkRowReadout,\n walkRowsKey,\n walkRowsTree,\n} from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport {\n stripGeneGaps,\n stripRowAt,\n walkMarksTree,\n walkStripLabelsTree,\n} from '@jbrowse/bandage-core/layout/walkStrip'\nimport { RAMP_GRADIENT_CSS } from '@jbrowse/bandage-core/referenceRampCss'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { observer } from 'mobx-react'\n\nimport ElTree from './ElTree'\nimport { WalkRowContextMenu } from './WalkRowContextMenu'\nimport { Swatch } from './WalkRowsOverlay'\nimport { legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\nimport type { RowGene } from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport type { WalkRows } from '@jbrowse/bandage-core/layout/walkRows'\nimport type { StripFrame } from '@jbrowse/bandage-core/layout/walkStrip'\n\n// Walk rows under a layout that draws nodes, each haplotype's walk on its own\n// bp, linked to the drawing above: the hovered node ticks every bar where its\n// walk passes it, and a point on a bar lights its node, ringed, above. The\n// bars share the drawing's colours, so under the reference-position ramp a hue\n// in the drawing is the same hue on each bar. Every row is shown; rows too\n// thin to letter say who they are on hover.\n\nconst keyStyle = {\n display: 'flex',\n flexWrap: 'wrap' as const,\n gap: '2px 14px',\n padding: '2px 8px 6px',\n fontSize: 11,\n color: '#333',\n}\n\nconst tipStyle = {\n position: 'absolute' as const,\n pointerEvents: 'none' as const,\n background: 'rgba(255,255,255,0.92)',\n border: '1px solid #ccc',\n borderRadius: 3,\n padding: '1px 6px',\n fontSize: 11,\n whiteSpace: 'nowrap' as const,\n zIndex: 4,\n}\n\n// The bars, built once per rows, frame, colouring and genes rather than per\n// hover\nconst StripBars = observer(function StripBars({\n bars,\n frame,\n ramp,\n rowGenes,\n}: {\n bars: WalkRows\n frame: StripFrame\n ramp: { start: number; end: number } | undefined\n rowGenes: Map<string, RowGene[]> | undefined\n}) {\n const idPrefix = useId().replace(/[^\\w-]/g, '')\n const tree = useMemo(\n () => walkRowsTree(bars, frame, { ramp, rowGenes, idPrefix }),\n [bars, frame, ramp, rowGenes, idPrefix],\n )\n return <ElTree el={tree} />\n})\n\nconst WalkStrip = observer(function WalkStrip({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const bars = model.walkStripRows\n const frame = model.walkStripFrame\n const [menu, setMenu] = useState<\n { row: number; top: number; left: number } | undefined\n >(undefined)\n const [tip, setTip] = useState<\n { text: string; x: number; y: number } | undefined\n >(undefined)\n if (!bars || !frame) {\n return null\n }\n const hit = (e: React.MouseEvent<SVGSVGElement>) => {\n const box = e.currentTarget.getBoundingClientRect()\n const x = e.clientX - box.left\n const y = e.clientY - box.top\n return { ...stripRowAt(bars, frame, x, y), x, y }\n }\n const key = walkRowsKey(bars, {\n ramp: model.referenceRampDomain,\n rampCss: RAMP_GRADIENT_CSS,\n genes: model.walkRowGenes?.size\n ? stripGeneGaps(frame, model.walkRowGeneGaps)\n : undefined,\n })\n return (\n <div\n data-testid=\"graph-walk-strip\"\n style={{ position: 'relative', borderTop: '1px solid #ddd' }}\n onMouseEnter={() => {\n model.setPointerInPane(true)\n }}\n onMouseLeave={() => {\n if (isAlive(model)) {\n model.setPointerInPane(false)\n model.setStripHover(null)\n }\n setTip(undefined)\n }}\n >\n <svg\n width={frame.width}\n height={frame.height}\n style={{ display: 'block', cursor: 'pointer' }}\n onMouseMove={e => {\n const at = hit(e)\n if (at.row) {\n model.setStripHover({ row: at.row.name, offset: at.offset! })\n setTip(\n frame.labelled\n ? undefined\n : {\n text: `${at.row.label} \u00B7 ${walkRowReadout(\n at.row,\n at.index === 0 ? undefined : bars.reference,\n )}`,\n x: at.x,\n y: at.y,\n },\n )\n } else {\n model.setStripHover(null)\n setTip(undefined)\n }\n }}\n onClick={e => {\n const at = hit(e)\n if (at.row && at.index! > 0) {\n model.toggleWalk(at.row.name)\n }\n }}\n onContextMenu={e => {\n const at = hit(e)\n if (at.row) {\n e.preventDefault()\n setMenu({ row: at.index!, top: e.clientY, left: e.clientX })\n }\n }}\n >\n <StripBars\n bars={bars}\n frame={frame}\n ramp={model.referenceRampDomain}\n rowGenes={model.walkRowGenes}\n />\n <ElTree el={walkMarksTree(bars, frame, model.walkStripMarks)} />\n <ElTree\n el={walkStripLabelsTree(\n bars,\n frame,\n new Set(model.walkLayers.map(l => l.walk)),\n )}\n />\n </svg>\n {tip ? (\n <div style={{ ...tipStyle, left: tip.x + 12, top: tip.y - 18 }}>\n {tip.text}\n </div>\n ) : null}\n <div style={keyStyle} data-testid=\"graph-walk-strip-key\">\n {key.map(entry => (\n <div key={entry.label} style={legendRowStyle}>\n <Swatch swatch={entry.swatch} />\n <span>{entry.label}</span>\n </div>\n ))}\n <div style={legendRowStyle}>\n <span>\n \u25AE ticks: where each walk passes the node under the pointer \u00B7 click a\n bar to lift its walk\n </span>\n </div>\n </div>\n {menu ? (\n <WalkRowContextMenu\n model={model}\n row={menu.row}\n bars={bars}\n top={menu.top}\n left={menu.left}\n onClose={() => {\n setMenu(undefined)\n }}\n />\n ) : null}\n </div>\n )\n})\n\nexport default WalkStrip\n", "import { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 4,\n}\n\n// A ring round the node a point on the walk strip lights, so a one-bp node\n// can be found in a hairball\nconst WalkStripLocator = observer(function WalkStripLocator({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const at = model.walkStripLocator\n return at ? (\n <svg\n style={svgStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n data-testid=\"graph-walk-strip-locator\"\n >\n <circle\n cx={at.x}\n cy={at.y}\n r={11}\n fill=\"none\"\n stroke=\"white\"\n strokeWidth={4}\n />\n <circle\n cx={at.x}\n cy={at.y}\n r={11}\n fill=\"none\"\n stroke=\"#111\"\n strokeWidth={1.75}\n />\n </svg>\n ) : null\n})\n\nexport default WalkStripLocator\n", "import { Canvas2DRenderer } from '@jbrowse/bandage-core/renderer/Canvas2DRenderer'\n\n// Canvas2D only, and deliberately not through render-core's GPU ladder. The\n// batch is strokes and arrowheads in layout units, and stroking them batched by\n// colour is inside a frame budget at the node counts this view caps itself at\n// (agent-docs/GRAPH_SCALE_AND_LOD.md), so a GPU backend would buy a few\n// milliseconds for ~30 KB of bundled HAL and a shader toolchain. If one is ever\n// wanted, it should take the same `Renderer` interface and draw the batch as\n// instances \u2014 a capsule per node segment, a bezier ribbon per edge stroke \u2014\n// rather than reviving a triangle mesh; agent-docs/IDEAS.md scopes it.\nexport function createGraphRenderer(canvas: HTMLCanvasElement) {\n return Promise.resolve(new Canvas2DRenderer(canvas))\n}\n"],
5
+ "mappings": "4sBAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,QAAU,eAAe,0CAA0C,ICA1E,IAAAC,GAAkC,SASlC,IAAAC,GAAkD,UAClDC,GAAwB,UACxBC,GAAoC,UCRpC,IAAAC,GAA4B,SACrBC,MAAQ,oBAA2B,GAAAC,KAAK,OAAQ,CACrD,EAAG,6FACL,CAAC,EAAG,MAAM,EDOV,IAAAC,EAAyB,SEPzB,IAAAC,GAAyB,SCLlB,IAAMC,EAAiB,CAC5B,WAAY,yBACZ,QAAS,UACT,aAAc,EACd,SAAU,GACV,WAAY,OACZ,WAAY,QACd,EAEaC,EAAiB,CAAE,QAAS,OAAQ,WAAY,SAAU,IAAK,CAAE,EDoDlE,IAAAC,EAAA,SA5CNC,GAAW,CACf,SAAU,WACV,KAAM,EACN,IAAK,EACL,cAAe,OACf,SAAU,SACV,OAAQ,CACV,EAEMC,MAAc,aAAS,SAAqB,CAChD,MAAAC,CACF,EAEG,CACD,GAAM,CAAE,YAAAC,EAAa,SAAAC,EAAU,cAAAC,CAAc,EAAIH,EACjD,GAAIC,EAAY,SAAW,EACzB,OAAO,KAET,GAAM,CACJ,OAAAG,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,UAAWC,EACX,aAAAC,CACF,EAAIT,EACEU,EAAOV,EAAM,gBAAkBW,GAE/BC,EAAgB,GACpBV,IAAa,QAAa,CAAC,EAAE,QAAQ,KAAKW,GAAMX,EAAS,QAAQ,IAAIW,CAAE,CAAC,EAE1E,SACE,OAAC,OACC,MAAOf,GACP,MAAOU,EACP,OAAQC,EACR,cAAY,qBAEZ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ACN,CAEJ,CAAC,EAEM0G,GAAQ1B",
6
+ "names": ["require_useRenderingBackend", "__commonJSMin", "exports", "module", "import_react", "import_ui", "import_mobx_state_tree", "import_useRenderingBackend", "import_jsx_runtime", "Info_default", "_jsx", "import_mobx_react", "import_mobx_react", "legendBoxStyle", "legendRowStyle", "import_jsx_runtime", "svgStyle", "BubbleHalos", "model", "bubbleHalos", "walkLift", "hoveredBubble", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "halo", "HALO_FACTOR", "dimmedBubble", "id", "BUBBLE_KIND_COLORS", "sameBubble", "BubbleHalos_default", "HaloSwatch", "color", "HaloLegend", "kindsByColor", "h", "kinds", "BUBBLE_KIND_NAMES", "legendBoxStyle", "legendRowStyle", "import_react", "import_mobx", "import_mobx_react", "import_jsx_runtime", "walkSwatchStyle", "walkBlockStyle", "walkBarStyle", "WalkKey", "walk", "label", "reference", "hint", "at", "key", "walkKey", "legendRowStyle", "encodingSwatchCss", "import_react", "FALLBACK_CELL_SIZE", "meanExtentCellSize", "extentTotal", "count", "rowPitchOf", "boxes", "distinct", "min", "max", "box", "cellSizeFrom", "extentX", "extentY", "x", "resolveCellSize", "given", "getOrCreateCell", "cells", "cx", "cy", "row", "cell", "addToGrid", "cellSize", "minX", "minY", "maxX", "maxY", "entry", "cx0", "cx1", "cy0", "cy1", "queryGrid", "y", "radiusX", "radiusY", "results", "seen", "SpatialIndex", "nodePositions", "nodeId", "segments", "i", "seg", "next", "b", "EdgeSpatialIndex", "graph", "drawPaths", "axis", "deletions", "version", "routes", "baseEdgeCurves", "ei", "edge", "fromSegments", "toSegments", "curves", "curveBounds", "numPaths", "padX", "padY", "o", "pathRibbonOffsets", "distanceToSegment", "px", "py", "x1", "y1", "x2", "y2", "dx", "dy", "lenSq", "t", "distanceToCubicBezier", "cx1", "cy1", "cx2", "cy2", "minDist", "samples", "lastX", "lastY", "i", "u", "bx", "by", "distanceToBezierCurve", "c", "distanceToEdgeCurves", "curves", "yToX", "d", "nodeCache", "getSpatialIndex", "nodePositions", "version", "cached", "index", "SpatialIndex", "edgeCache", "getEdgeSpatialIndex", "graph", "drawPaths", "axis", "deletions", "routes", "EdgeSpatialIndex", "MIN_NODE_REACH_PX", "findHoveredNode", "graphX", "graphY", "ink", "yToXOf", "reach", "queryReach", "candidates", "hovered", "best", "nodeId", "segmentIdx", "segments", "dist", "findHoveredEdge", "hiddenEdges", "deletionRoutes", "edgeThreshold", "edgeIndex", "edgeIdx", "edge", "fromSegments", "toSegments", "numPaths", "baseCurves", "offset", "pathRibbonOffsets", "translateCurves", "wheelZoomFactor", "e", "px", "notches", "import_mobx_state_tree", "useWheelZoom", "canvas", "model", "c", "handleWheel", "e", "rect", "wheelZoomFactor", "usePaneGestures", "lastMouseRef", "hasMovedRef", "pendingRef", "contextNode", "setContextNode", "contextRow", "setContextRow", "screenToGraph", "screenX", "screenY", "getMouseCoord", "nodeAt", "x", "y", "nodePositions", "sx", "sy", "onStrip", "findHoveredNode", "onMouseDown", "node", "applyPending", "pending", "findHoveredEdge", "scheduleFrame", "dropPending", "onMouseMove", "dx", "dy", "onMouseUp", "onMouseLeave", "onContextMenu", "row", "onClick", "import_jsx_runtime", "gridStyle", "titleStyle", "FacetPanel", "model", "lift", "width", "height", "cell", "handlers", "canvas", "setCanvas", "walk", "useWheelZoom", "renderer", "Canvas2DRenderer", "drawing", "uploaded", "dispose", "built", "label", "WalkKey", "FacetPanels", "panels", "grid", "place", "columns", "i", "FacetPanels_default", "import_react", "import_mobx_react", "import_jsx_runtime", "svgStyle", "EXON_COLOR", "MIN_LANE_PX", "EXON_GAP_PX", "EXON_LINE_PX", "GenePins", "model", "maskId", "genePins", "walkLift", "nodeInk", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "inkPx", "nodeId", "own", "stretches", "pin", "d", "transform", "stroke", "s", "GenePins_default", "import_jsx_runtime", "CropFree_default", "_jsx", "import_jsx_runtime", "ZoomIn_default", "_jsx", "import_jsx_runtime", "ZoomOut_default", "_jsx", "import_material", "import_mobx_react", "import_mui", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "ColorSchemeSelect", "model", "classes", "fixed", "e", "COLOR_SCHEMES", "value", "label", "ColorSchemeSelect_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "fmtMs", "ms", "GraphPerf", "model", "classes", "lastFetchMs", "lastLayoutMs", "lastGeometryMs", "hasMetrics", "GraphStats", "GraphStats_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "LayoutSelect", "model", "classes", "graph", "e", "LAYOUT_MODES", "value", "label", "description", "available", "LayoutSelect_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "RepeatSelect", "model", "classes", "repeatChoices", "keys", "r", "e", "key", "name", "unit", "RepeatSelect_default", "import_react", "import_ui", "import_jsx_runtime", "Delete_default", "_jsx", "import_jsx_runtime", "MoreVert_default", "_jsx", "import_mobx_react", "import_jsx_runtime", "SettingsMenu", "model", "settingsOpen", "setSettingsOpen", "Settings_default", "Delete_default", "MoreVert_default", "GraphSettingsDialog_default", "SettingsMenu_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "WalkSelect", "model", "classes", "walkChoices", "names", "c", "labels", "picked", "layer", "name", "selected", "n", "e", "value", "label", "WalkSelect_default", "import_jsx_runtime", "useStyles", "ZoomDisplay", "model", "GraphToolbar", "classes", "LayoutSelect_default", "ColorSchemeSelect_default", "WalkSelect_default", "RepeatSelect_default", "ZoomIn_default", "ZoomOut_default", "CropFree_default", "GraphStats_default", "SettingsMenu_default", "GraphToolbar_default", "import_mobx_state_tree", "import_mobx_react", "import_jsx_runtime", "LabelChip", "x", "y", "w", "text", "note", "color", "edge", "italic", "small", "dimmed", "title", "testId", "onClick", "onHover", "import_jsx_runtime", "svgStyle", "GENE_INK", "LabelLayer", "model", "bubbles", "genes", "routes", "walkLift", "scaleY", "translateY", "contigThickness", "dimmedBubble", "h", "id", "dimmedRoute", "r", "w", "pin", "x", "y", "text", "gene", "note", "geneCoverageNote", "LabelChip", "EXON_COLOR", "route", "BUBBLE_KIND_COLORS", "hovered", "LabelLayer_default", "import_react", "import_canvas2dUtils", "import_mobx", "import_mobx_react", "import_jsx_runtime", "canvasStyle", "ReferenceStripOverlay", "model", "ref", "referenceStripShown", "paneWidth", "canvasHeight", "canvas", "frame", "ctx", "dpr", "width", "height", "drawReferenceStrip", "ReferenceStripOverlay_default", "SWATCH_PX", "RAMP_SWATCH", "SAMPLED_BLOCKS", "sampledSwatch", "colors", "distinct", "c", "i", "n", "picked", "_", "LIFT_BACKDROP_CSS", "StripSwatch", "rows", "key", "background", "stripRows", "w", "encodingSwatchCss", "b", "OverhangSwatch", "ReferenceStripLegend", "rowPerWalk", "legendBoxStyle", "legendRowStyle", "import_react", "import_canvas2dUtils", "import_mobx", "import_mobx_react", "import_jsx_runtime", "canvasStyle", "TubeMapOverlay", "model", "ref", "tubeMapPicture", "paneWidth", "canvasHeight", "canvas", "picture", "frame", "ctx", "dpr", "width", "height", "tubeFrame", "drawTubeMap", "drawDeviationMarks", "drawTubeMapConnectors", "bounds", "drawTubeMapGenes", "boxes", "drawTubeMapRuler", "TubeMapOverlay_default", "SWATCH_PX", "BracketSwatch", "brackets", "x0", "x1", "rulerInk", "barSwatchStyle", "tubeSwatchStyle", "TickSwatch", "deviationInk", "ReadSwatch", "colors", "step", "stops", "c", "i", "glyphSwatchStyle", "DeletionSwatch", "LegendRow", "swatch", "children", "legendRowStyle", "TubeMapLegend", "logWidths", "foldBp", "forwardReads", "reverseReads", "mismatches", "rows", "FORWARD_READ_COLORS", "REVERSE_READ_COLORS", "formatBp", "legendBoxStyle", "import_material", "import_mobx_react", "import_jsx_runtime", "style", "UnpopButton", "model", "poppedFrom", "UnpopButton_default", "import_ui", "import_mobx_react", "import_jsx_runtime", "WalkRowContextMenu", "model", "row", "bars", "top", "left", "onClose", "target", "assembly", "callback", "locLabel", "LineStyle_default", "import_react", "import_mobx_react", "import_react", "propName", "name", "_", "c", "toReact", "node", "key", "props", "value", "ElTree", "el", "import_jsx_runtime", "svgStyle", "CALL_TICK", "UNBACKED_TICK", "swatchStyle", "BAR_PX", "tickSwatchStyle", "TickSwatch", "color", "Swatch", "swatch", "GENE_INK", "GAP_PX", "WalkRowsLegend", "model", "bars", "calls", "row", "key", "walkRowsKey", "RAMP_GRADIENT_CSS", "legendBoxStyle", "entry", "legendRowStyle", "call", "DISAGREES", "WalkRowsOverlay", "idPrefix", "width", "canvasHeight", "ElTree", "walkRowsTree", "WalkRowsOverlay_default", "import_react", "import_mobx_state_tree", "import_mobx_react", "import_jsx_runtime", "keyStyle", "tipStyle", "StripBars", "bars", "frame", "ramp", "rowGenes", "idPrefix", "tree", "walkRowsTree", "ElTree", "WalkStrip", "model", "menu", "setMenu", "tip", "setTip", "hit", "e", "box", "x", "y", "stripRowAt", "key", "walkRowsKey", "RAMP_GRADIENT_CSS", "stripGeneGaps", "at", "walkRowReadout", "walkMarksTree", "walkStripLabelsTree", "l", "entry", "legendRowStyle", "Swatch", "WalkRowContextMenu", "WalkStrip_default", "import_mobx_react", "import_jsx_runtime", "svgStyle", "WalkStripLocator", "model", "at", "WalkStripLocator_default", "createGraphRenderer", "canvas", "Canvas2DRenderer", "import_jsx_runtime", "tooltipStyle", "wrapperStyle", "canvasAreaStyle", "paperStyle", "loadingLayerStyle", "rowLabelStyle", "RowLabels", "model", "rowLabels", "label", "y", "screenY", "legendStackStyle", "LEGEND_INSET_PX", "pathSwatchStyle", "PathLegend", "pathLegend", "legendBoxStyle", "name", "color", "legendRowStyle", "WalkReadout", "lift", "w", "WalkKey", "OffReferenceRow", "walkSwatchStyle", "LIFT_BACKDROP_CSS", "rampStripStyle", "RAMP_GRADIENT_CSS", "rampEndsStyle", "ReferenceRampLegend", "domain", "offReference", "unplaced", "start", "end", "formatBp", "UNPLACED_SWATCH", "REFERENCE_RAMP_ALT_CSS", "exonSwatchStyle", "EXON_COLOR", "GeneLegend", "pin", "nodeLabelStyle", "deletionLabelStyle", "leaderStyle", "Legends", "ref", "el", "observer", "ReferenceStripLegend", "HaloLegend", "TubeMapLegend", "WalkRowsLegend", "GraphSizeLabels", "labels", "leaders", "key", "leader", "arcX", "arcY", "labelX", "labelY", "text", "x", "kind", "HoverTooltips", "hoveredNodeData", "hoveredEdgeData", "ownLocation", "nodeOwnLocation", "hoveredDeletion", "d", "locLabel", "NodeContextMenu", "nodeId", "top", "left", "onClose", "own", "reference", "highlight", "callback", "Info_default", "nodeLaunchMenuItems", "target", "GraphCanvas", "ownChrome", "canvasRef", "canvas", "renderError", "retryRender", "createGraphRenderer", "handlers", "contextNode", "contextRow", "closeContextMenu", "usePaneGestures", "useWheelZoom", "faceted", "GraphToolbar_default", "FacetPanels_default", "TubeMapOverlay_default", "ReferenceStripOverlay_default", "BubbleHalos_default", "GenePins_default", "LabelLayer_default", "WalkRowsOverlay_default", "WalkStripLocator_default", "UnpopButton_default", "WalkStrip_default", "WalkRowContextMenu", "GraphCanvas_default"]
7
7
  }