@mcurcio/patchbay 0.6.0 → 0.7.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.
Files changed (32) hide show
  1. package/README.md +2 -1
  2. package/dist/composites.js +190 -158
  3. package/dist/composites.js.map +1 -1
  4. package/dist/graph.js +70 -67
  5. package/dist/graph.js.map +1 -1
  6. package/dist/primitives.css +1 -1
  7. package/dist/primitives.js +108 -93
  8. package/dist/primitives.js.map +1 -1
  9. package/dist/testing.js +207 -0
  10. package/dist/testing.js.map +1 -0
  11. package/dist/types/composites/banner/Banner.d.ts +9 -3
  12. package/dist/types/composites/banner/index.d.ts +2 -2
  13. package/dist/types/composites/command-palette/CommandPalette.d.ts +16 -10
  14. package/dist/types/composites/command-palette/index.d.ts +2 -2
  15. package/dist/types/composites/shortcut-sheet/ShortcutSheet.d.ts +17 -11
  16. package/dist/types/composites/shortcut-sheet/index.d.ts +2 -2
  17. package/dist/types/composites/toaster/Toaster.d.ts +15 -9
  18. package/dist/types/composites/toaster/index.d.ts +2 -2
  19. package/dist/types/graph/meter/Meter.d.ts +9 -3
  20. package/dist/types/graph/meter/index.d.ts +2 -2
  21. package/dist/types/graph/node-box/NodeBox.d.ts +7 -8
  22. package/dist/types/graph/node-box/index.d.ts +2 -2
  23. package/dist/types/primitives/dialog/Dialog.d.ts +8 -2
  24. package/dist/types/primitives/dialog/index.d.ts +2 -2
  25. package/dist/types/primitives/sheet/Sheet.d.ts +8 -2
  26. package/dist/types/primitives/sheet/index.d.ts +2 -2
  27. package/dist/types/primitives/splitter/Splitter.d.ts +8 -2
  28. package/dist/types/primitives/splitter/splitter-math.d.ts +12 -4
  29. package/dist/types/testing/brand-css.d.ts +41 -0
  30. package/dist/types/testing/contrast.d.ts +36 -0
  31. package/dist/types/testing/index.d.ts +2 -0
  32. package/package.json +5 -1
package/dist/graph.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"graph.js","names":["_Fragment","_Fragment","_Fragment","isPane","target","endOf","event","touch","elementAt","x","y","useAddAt","enabled","options","useReactFlow","latest","useRef","origin","useMemo","add","on","toFlow","nodeId","handleType","from","state","end","fallback","slowMotionMs","value","element","parsed","defaultCanvasToolsLabels","glyph","path","glyphs","CanvasTools","words","labels","flow","store","useStoreApi","duration","tool","keys","keyShortcuts","name","IconButton","pressed","act","Fragment","Panel","className","ToolGroup","onFit","fitOptions","onTidy","onMinimap","minimap","children","MiniMap","minimapNodeClassName","mergeFlowProps","objects","values","handlers","object","list","merged","only","args","each","ConnectHintsContext","createContext","ConnectHints","useConnectHintsValue","useContext","verdictKey","to","samePort","a","b","useConnectHints","rule","canConnect","verdicts","setOrigin","useState","judge","kept","key","known","verdict","flowProps","connection","side","port","at","allMeasured","node","useFollowFit","width","useStore","height","measured","following","setFollowing","fittedFor","land","useCallback","useEffect","last","now","GhostWire","labelX","labelY","getBezierPath","sourceX","sourceY","sourcePosition","targetX","targetY","targetPosition","tone","data","label","BaseEdge","EdgeLabelRenderer","defaultMeterScale","meterTitleEveryMs","toDb","linear","meterFraction","db","floor","formatDb","defaultMeterTitle","peakDb","rmsDb","silent","createPainter","scale","initial","level","frame","hovered","titledAt","stale","tickAt","falling","fallen","writeTitle","clipped","paint","tick","lit","\"peak\"","\"clipped\"","run","wake","stop","next","moved","peak","rms","Meter","rest","painter","attach","useLiveValue","subscribe","read","useImperativeHandle","ref","mid","hot","zones","classes","zoneStyle","style","orientation","onPointerEnter","onPointerLeave","knownHints","PortRow","ownHint","ownReason","isInput","drag","useNodeId","fromDrag","id","hint","reason","shown","refused","Handle","Position","connectable","typeLabel","problem","WarnMark","trailing","defaultChangeLabels","knownChanges","NodeBox","titleId","useId","layout","ports","inputs","outputs","changeLabels","changeWord","change","hasPorts","inputRows","outputRows","disabled","failed","selected","title","subtitle","Badge","status","line","footer","usePortsMeasured","updateNodeInternals","useUpdateNodeInternals","NODE_WIDTH","NODE_HEADER","NODE_LINE","NODE_ROW","NODE_PAD","NODE_FOOTER","HANDLE_SIZE","HANDLE_HIT","nodePortRows","nodeBoxSize","rows","ARROW_LENGTH","ARROW_HALF","emphasisOf","arrowPath","dx","dy","baseX","baseY","px","py","WireBody","memo","arrow","interactionWidth","Wire","showArrow","emphasis"],"sources":["../src/graph/add-at/useAddAt.ts","../src/graph/canvas-tools/motion.ts","../src/graph/canvas-tools/CanvasTools.tsx","../src/graph/connect-hints/mergeFlowProps.ts","../src/graph/connect-hints/useConnectHints.tsx","../src/graph/follow-fit/useFollowFit.ts","../src/graph/ghost-wire/GhostWire.tsx","../src/graph/meter/Meter.tsx","../src/graph/port-row/PortRow.tsx","../src/graph/node-box/NodeBox.tsx","../src/graph/node-box/geometry.ts","../src/graph/wire/Wire.tsx"],"sourcesContent":["// Adding at a place on the canvas (docs/graph.md#useaddat): a double-click on empty canvas, or a wire dropped there,\n// asks the app to add a node at that point, in flow coordinates, with the port the wire came from. Only the pane\n// counts: a double-click or a drop on a node, an edge, a handle or a panel is not empty canvas.\nimport { type OnConnectEnd, type OnConnectStart, useReactFlow } from \"@xyflow/react\";\nimport { type MouseEvent as ReactMouseEvent, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { PortRef } from \"../connect-hints\";\nimport type { PortSide } from \"../port-row\";\n\n/** A point in flow coordinates. */\nexport type FlowPoint = { x: number; y: number };\n\n/** Called with where to add, and the port a dropped wire came from (absent for a double-click). */\nexport type OnAddAt = (point: FlowPoint, from?: PortRef & { side: PortSide }) => void;\n\n/** The props `useAddAt` gives `<ReactFlow>`. */\nexport type AddAtFlowProps = {\n onDoubleClick: (event: ReactMouseEvent<HTMLDivElement>) => void;\n onConnectStart: OnConnectStart;\n onConnectEnd: OnConnectEnd;\n zoomOnDoubleClick: false;\n};\n\nexport type AddAtOptions = {\n /** false switches adding off (as while the graph is read-only); true by default. */\n enabled?: boolean;\n};\n\n/** Whether the element is this canvas's empty pane, not anything drawn on it. */\nconst isPane = (target: EventTarget | null) =>\n target instanceof Element && target.classList.contains(\"react-flow__pane\");\n\n/** Where a mouse or touch event ended, in the window's coordinates; a touch's end is in `changedTouches`. */\nfunction endOf(event: MouseEvent | TouchEvent): { x: number; y: number } | null {\n if (\"changedTouches\" in event) {\n const touch = event.changedTouches[0];\n return touch === undefined ? null : { x: touch.clientX, y: touch.clientY };\n }\n return { x: event.clientX, y: event.clientY };\n}\n\n/** The element at a point in the window, or null where the browser cannot say. */\nconst elementAt = ({ x, y }: { x: number; y: number }) =>\n typeof document.elementFromPoint === \"function\" ? document.elementFromPoint(x, y) : null;\n\n/**\n * Calls `onAddAt` for a double-click on empty canvas and for a wire dropped there where no handle took it. Its\n * `flowProps` go to `<ReactFlow>` (through `mergeFlowProps` with others); it turns React Flow's zoom on double-click\n * off, as the double-click is the add.\n */\nexport function useAddAt(onAddAt: OnAddAt, options: AddAtOptions = {}): { flowProps: AddAtFlowProps } {\n const enabled = options.enabled ?? true;\n const { screenToFlowPosition } = useReactFlow();\n const latest = useRef({ onAddAt, enabled, screenToFlowPosition });\n useLayoutEffect(() => {\n latest.current = { onAddAt, enabled, screenToFlowPosition };\n });\n // The handle the wire in progress began at; null outside a drag.\n const origin = useRef<(PortRef & { side: PortSide }) | null>(null);\n\n const flowProps = useMemo<AddAtFlowProps>(\n () => ({\n onDoubleClick: (event) => {\n const { onAddAt: add, enabled: on, screenToFlowPosition: toFlow } = latest.current;\n if (!on || !isPane(event.target)) return;\n add(toFlow({ x: event.clientX, y: event.clientY }));\n },\n onConnectStart: (_event, { nodeId, handleId, handleType }) => {\n origin.current =\n nodeId === null ? null : { nodeId, handleId, side: handleType === \"target\" ? \"input\" : \"output\" };\n },\n onConnectEnd: (event, state) => {\n const from = origin.current;\n origin.current = null;\n const { onAddAt: add, enabled: on, screenToFlowPosition: toFlow } = latest.current;\n if (!on || from === null || state.toHandle !== null) return;\n const end = endOf(event);\n if (end === null) return;\n // A mouse's up is on the element under it; a touch's end is on the element it began on, so ask the page.\n const target = \"changedTouches\" in event ? elementAt(end) : event.target;\n if (!isPane(target)) return;\n add(toFlow(end), from);\n },\n zoomOnDoubleClick: false,\n }),\n [],\n );\n\n return { flowProps };\n}\n","// How long a view move takes that a person asked for (a zoom, a fit; docs/graph.md#canvastools): the canvas's\n// --pb-motion-slow, which tokens.css sets to 0 ms under reduced motion, so a brand's duration and the person's wish\n// both hold. Read from the canvas's element at the move, since a brand or the theme can change it at any time.\n\nconst fallback = 180;\n\n/** `--pb-motion-slow` on `element` in milliseconds; without the tokens loaded, 180 ms, or 0 under reduced motion. */\nexport function slowMotionMs(element: Element | null | undefined): number {\n const value =\n element === null || element === undefined ? \"\" : getComputedStyle(element).getPropertyValue(\"--pb-motion-slow\");\n const parsed = /^\\s*(\\d+(?:\\.\\d+)?)(ms|s)\\s*$/.exec(value);\n if (parsed !== null) return Number(parsed[1]) * (parsed[2] === \"s\" ? 1000 : 1);\n const reduced =\n typeof window.matchMedia === \"function\" && window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n return reduced ? 0 : fallback;\n}\n","// A canvas's tools (docs/graph.md#canvastools), a child of the app's own <ReactFlow>: zoom, fit, and when the app\n// gives them, tidy and the minimap, as one ToolGroup in React Flow's <Panel>, and React Flow's <MiniMap> while the\n// minimap is on. The layout behind tidy and the minimap's state are the app's; the zoom and fit move the view through\n// React Flow over --pb-motion-slow, at once under reduced motion.\nimport {\n type FitViewOptions,\n MiniMap,\n type Node,\n Panel,\n type PanelPosition,\n useReactFlow,\n useStoreApi,\n} from \"@xyflow/react\";\nimport type { ReactNode } from \"react\";\nimport { IconButton, ToolGroup } from \"../../primitives\";\nimport { slowMotionMs } from \"./motion\";\nimport \"./CanvasTools.css\";\n\n/** The tools' words, each replaceable. */\nexport interface CanvasToolsLabels {\n /** The tool group's accessible name: \"Canvas\". */\n toolbar: string;\n zoomIn: string;\n zoomOut: string;\n fit: string;\n tidy: string;\n minimap: string;\n}\n\nexport const defaultCanvasToolsLabels: CanvasToolsLabels = {\n toolbar: \"Canvas\",\n zoomIn: \"Zoom in\",\n zoomOut: \"Zoom out\",\n fit: \"Fit the view\",\n tidy: \"Tidy the layout\",\n minimap: \"Minimap\",\n};\n\n/** The app's own key bindings for the tools, as `aria-keyshortcuts` values: shown, not bound. */\nexport type CanvasToolsShortcuts = Partial<Record<\"zoomIn\" | \"zoomOut\" | \"fit\" | \"tidy\" | \"minimap\", string>>;\n\nexport type CanvasToolsProps<NodeType extends Node = Node> = {\n /** Where the panel sits on the canvas, React Flow's `PanelPosition`: \"bottom-left\" by default. */\n position?: PanelPosition | (string & {});\n /** React Flow's fit options for the fit tool. */\n fitOptions?: FitViewOptions<NodeType>;\n /** Replaces the fit tool's own fit (pass useFollowFit's `fit`, so the tool also resumes following). */\n onFit?: () => void;\n /** The tidy tool, shown only when given: the layout is the app's. */\n onTidy?: () => void;\n /** Whether the minimap is on: the minimap tool is pressed and React Flow's <MiniMap> is drawn. */\n minimap?: boolean;\n /** The minimap tool, shown only when given: called with the state a press asks for. */\n onMinimap?: (next: boolean) => void;\n /** The class of each node's shape in the minimap, so the app colours it by the node's state. */\n minimapNodeClassName?: string | ((node: NodeType) => string);\n keyShortcuts?: CanvasToolsShortcuts;\n /** Words to replace; the rest keep their defaults. */\n labels?: Partial<CanvasToolsLabels>;\n /** Added to the panel's own `pb-canvas-tools` class. */\n className?: string;\n /** More tools (IconButtons) after patchbay's. */\n children?: ReactNode;\n};\n\nconst glyph = (path: string) => (\n <svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <path d={path} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nconst glyphs = {\n zoomIn: glyph(\"M3 8h10M8 3v10\"),\n zoomOut: glyph(\"M3 8h10\"),\n fit: glyph(\"M2 6V2h4M10 2h4v4M14 10v4h-4M6 14H2v-4\"),\n tidy: glyph(\"M2 2h5v5H2zM9 2h5v5H9zM2 9h5v5H2zM9 9h5v5H9z\"),\n minimap: glyph(\"M1.5 3h13v10h-13zM8.5 8h4v3h-4z\"),\n};\n\nexport function CanvasTools<NodeType extends Node = Node>({\n position = \"bottom-left\",\n fitOptions,\n onFit,\n onTidy,\n minimap = false,\n onMinimap,\n minimapNodeClassName,\n keyShortcuts,\n labels,\n className,\n children,\n}: CanvasToolsProps<NodeType>) {\n const words = { ...defaultCanvasToolsLabels, ...labels };\n const flow = useReactFlow<NodeType>();\n const store = useStoreApi<NodeType>();\n const duration = () => slowMotionMs(store.getState().domNode);\n\n const tool = (name: keyof CanvasToolsShortcuts, act: () => void, pressed?: boolean) => {\n const keys = keyShortcuts?.[name];\n return (\n <IconButton\n label={words[name]}\n title={keys === undefined || keys === \"\" ? words[name] : `${words[name]} (${keys})`}\n aria-keyshortcuts={keys === \"\" ? undefined : keys}\n aria-pressed={pressed}\n onClick={act}\n >\n {glyphs[name]}\n </IconButton>\n );\n };\n\n return (\n <>\n <Panel\n position={position as PanelPosition}\n className={className === undefined ? \"pb-canvas-tools\" : `pb-canvas-tools ${className}`}\n >\n <ToolGroup label={words.toolbar}>\n {tool(\"zoomIn\", () => void flow.zoomIn({ duration: duration() }))}\n {tool(\"zoomOut\", () => void flow.zoomOut({ duration: duration() }))}\n {tool(\"fit\", () => {\n if (onFit !== undefined) onFit();\n else void flow.fitView({ ...fitOptions, duration: duration() });\n })}\n {onTidy !== undefined && tool(\"tidy\", onTidy)}\n {onMinimap !== undefined &&\n tool(\n \"minimap\",\n () => {\n onMinimap(!minimap);\n },\n minimap,\n )}\n {children}\n </ToolGroup>\n </Panel>\n {minimap && (\n <MiniMap<NodeType>\n className=\"pb-canvas-minimap\"\n ariaLabel={words.minimap}\n nodeClassName={minimapNodeClassName}\n />\n )}\n </>\n );\n}\n","// Joins the props several hooks give <ReactFlow> (docs/graph.md#mergeflowprops), so each hook's handler still runs\n// when two of them, or the app, handle the same event.\n\ntype UnionToIntersection<U> = (U extends unknown ? (each: U) => void : never) extends (each: infer I) => void\n ? I\n : never;\n\n/** The objects' props together: each handler is every object's handler for that name. */\nexport type MergedFlowProps<T extends readonly (object | undefined)[]> = UnionToIntersection<\n Exclude<T[number], undefined>\n>;\n\ntype Handler = (...args: unknown[]) => unknown;\n\n/**\n * One object of `<ReactFlow>` props from several: a handler given by more than one object calls each in order, and\n * `isValidConnection` accepts only when each accepts (it stops at the first that refuses). Any other prop is the last\n * object's that gives it; `undefined` gives nothing.\n */\nexport function mergeFlowProps<const T extends readonly (object | undefined)[]>(...objects: T): MergedFlowProps<T> {\n const values = new Map<string, unknown>();\n const handlers = new Map<string, Handler[]>();\n for (const object of objects) {\n if (object === undefined) continue;\n for (const [name, value] of Object.entries(object)) {\n if (value === undefined) continue;\n if (typeof value === \"function\") {\n const list = handlers.get(name) ?? [];\n list.push(value as Handler);\n handlers.set(name, list);\n values.delete(name);\n } else {\n values.set(name, value);\n handlers.delete(name);\n }\n }\n }\n const merged: Record<string, unknown> = Object.fromEntries(values);\n for (const [name, list] of handlers) {\n const [only] = list;\n if (list.length === 1 && only !== undefined) merged[name] = only;\n else if (name === \"isValidConnection\")\n merged[name] = (...args: unknown[]) => list.every((each) => each(...args) === true);\n else\n merged[name] = (...args: unknown[]) => {\n for (const each of list) each(...args);\n };\n }\n return merged as MergedFlowProps<T>;\n}\n","// One rule for which ports may be joined (docs/graph.md#useconnecthints), used both for the hints every PortRow shows\n// while a wire is dragged and for React Flow's own check on the drop. The state changes twice per drag, at its start\n// and its end, never per pointer move; each candidate handle's verdict is asked of the rule once per drag and kept.\nimport type { Connection, Edge, OnConnectEnd, OnConnectStart } from \"@xyflow/react\";\nimport { createContext, type ReactNode, useContext, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { PortHint, PortSide } from \"../port-row\";\n\n/** One handle: its node's id and its handle id (`null` for a handle without one). */\nexport type PortRef = { nodeId: string; handleId: string | null };\n\n/**\n * Whether a wire may join `from` (always the output) to `to` (always the input), whichever end the drag began at:\n * `true` accepts, `false` refuses, a string refuses and is the reason.\n */\nexport type CanConnect = (from: PortRef, to: PortRef) => boolean | string;\n\n/** What one handle shows while a wire is dragged, and why when it refuses. */\nexport type PortHintOf = { hint: PortHint; reason?: string };\n\n/** The drag in progress, as `<ConnectHints>` hands it to every `PortRow`; `null` while no wire is dragged. */\nexport type ConnectHintsValue = {\n /** The handle the drag began at, and its side. */\n origin: PortRef & { side: PortSide };\n /** The hint for one handle: `origin`, `ok` or `no` (with its reason) on the other side, `null` on the origin's. */\n hintFor: (port: PortRef, side: PortSide) => PortHintOf;\n} | null;\n\n/** The handlers `useConnectHints` gives `<ReactFlow>`. */\nexport type ConnectHintsFlowProps = {\n onConnectStart: OnConnectStart;\n onConnectEnd: OnConnectEnd;\n isValidConnection: (connection: Edge | Connection) => boolean;\n};\n\nconst ConnectHintsContext = createContext<ConnectHintsValue>(null);\n\n/** Hands a drag's hints to every `PortRow` inside it. */\nexport function ConnectHints({ value, children }: { value: ConnectHintsValue; children?: ReactNode }) {\n return <ConnectHintsContext value={value}>{children}</ConnectHintsContext>;\n}\n\n/** The drag's hints from the nearest `<ConnectHints>`, or `null` outside one or while no wire is dragged. */\nexport function useConnectHintsValue(): ConnectHintsValue {\n return useContext(ConnectHintsContext);\n}\n\nconst verdictKey = (from: PortRef, to: PortRef) => JSON.stringify([from.nodeId, from.handleId, to.nodeId, to.handleId]);\n\nconst samePort = (a: PortRef, b: PortRef) => a.nodeId === b.nodeId && a.handleId === b.handleId;\n\n/**\n * Tracks a wire's drag from React Flow's connect start to its end and judges each candidate handle by `canConnect`.\n * `flowProps` goes to `<ReactFlow>` (through `mergeFlowProps` with others), `value` to `<ConnectHints>`.\n */\nexport function useConnectHints(canConnect: CanConnect): {\n value: ConnectHintsValue;\n flowProps: ConnectHintsFlowProps;\n} {\n const rule = useRef(canConnect);\n useLayoutEffect(() => {\n rule.current = canConnect;\n });\n // The verdicts of the drag in progress, so each candidate is judged once per drag; none outside a drag.\n const verdicts = useRef<Map<string, boolean | string> | null>(null);\n const [origin, setOrigin] = useState<(PortRef & { side: PortSide }) | null>(null);\n\n const judge = useMemo(\n () =>\n (from: PortRef, to: PortRef): boolean | string => {\n const kept = verdicts.current;\n if (kept === null) return rule.current(from, to);\n const key = verdictKey(from, to);\n const known = kept.get(key);\n if (known !== undefined) return known;\n const verdict = rule.current(from, to);\n kept.set(key, verdict);\n return verdict;\n },\n [],\n );\n\n const flowProps = useMemo<ConnectHintsFlowProps>(\n () => ({\n onConnectStart: (_event, { nodeId, handleId, handleType }) => {\n if (nodeId === null) return;\n verdicts.current = new Map();\n setOrigin({ nodeId, handleId, side: handleType === \"target\" ? \"input\" : \"output\" });\n },\n onConnectEnd: () => {\n verdicts.current = null;\n setOrigin(null);\n },\n isValidConnection: (connection) =>\n judge(\n { nodeId: connection.source, handleId: connection.sourceHandle ?? null },\n { nodeId: connection.target, handleId: connection.targetHandle ?? null },\n ) === true,\n }),\n [judge],\n );\n\n const value = useMemo<ConnectHintsValue>(() => {\n if (origin === null) return null;\n return {\n origin,\n hintFor: (port, side) => {\n if (side === origin.side) return { hint: samePort(port, origin) ? \"origin\" : null };\n const at: PortRef = { nodeId: origin.nodeId, handleId: origin.handleId };\n const verdict = side === \"input\" ? judge(at, port) : judge(port, at);\n if (verdict === true) return { hint: \"ok\" };\n return typeof verdict === \"string\" ? { hint: \"no\", reason: verdict } : { hint: \"no\" };\n },\n };\n }, [origin, judge]);\n\n return { value, flowProps };\n}\n","// Keeping the whole graph in view until the person takes the view over (docs/graph.md#usefollowfit). While following,\n// the view fits again when the app's key changes or the canvas changes size, each time once every node is measured;\n// a move the person makes stops it, and fit() fits and follows again. onFitted comes in the frame after each fit lands.\nimport {\n type FitViewOptions,\n type Node,\n type OnMove,\n type ReactFlowState,\n type Viewport,\n useReactFlow,\n useStore,\n useStoreApi,\n} from \"@xyflow/react\";\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { slowMotionMs } from \"../canvas-tools/motion\";\n\nexport type FollowFitOptions<NodeType extends Node = Node> = {\n /** The app's value that changes when nodes are added, removed or laid out; a change fits again while following. */\n key: unknown;\n /** React Flow's fit options, for every fit. */\n fitOptions?: FitViewOptions<NodeType>;\n /** Called with the viewport after each fit has landed, in the frame after the viewport is set. */\n onFitted?: (viewport: Viewport) => void;\n};\n\n/** The props `useFollowFit` gives `<ReactFlow>`. */\nexport type FollowFitFlowProps = { onMoveStart: OnMove };\n\nexport type FollowFit = {\n /** Whether the view fits again on its own: true from the start, false once the person moves the view. */\n following: boolean;\n /** Fits now, moving as the fit tool does, and follows again. */\n fit: () => void;\n flowProps: FollowFitFlowProps;\n};\n\n/** Whether every node React Flow shows has been measured (none counts as all). */\nconst allMeasured = (state: ReactFlowState) => {\n for (const node of state.nodeLookup.values()) {\n if (node.hidden !== true && (node.measured.width === undefined || node.measured.height === undefined)) return false;\n }\n return true;\n};\n\ntype Fitted = { key: unknown; width: number; height: number };\n\nexport function useFollowFit<NodeType extends Node = Node>({\n key,\n fitOptions,\n onFitted,\n}: FollowFitOptions<NodeType>): FollowFit {\n const flow = useReactFlow<NodeType>();\n const store = useStoreApi();\n const width = useStore((state) => state.width);\n const height = useStore((state) => state.height);\n const measured = useStore(allMeasured);\n const [following, setFollowing] = useState(true);\n const latest = useRef({ key, width, height, fitOptions, onFitted });\n useLayoutEffect(() => {\n latest.current = { key, width, height, fitOptions, onFitted };\n });\n // What the last fit was for, so a render that changes none of it does not fit again.\n const fittedFor = useRef<Fitted | null>(null);\n\n const land = useCallback(\n async (duration: number) => {\n // With no node there is nothing to fit, and the view stays; onFitted still says the layout is ready.\n if (store.getState().nodeLookup.size > 0) await flow.fitView({ ...latest.current.fitOptions, duration });\n requestAnimationFrame(() => {\n latest.current.onFitted?.(flow.getViewport());\n });\n },\n [flow, store],\n );\n\n useEffect(() => {\n if (!following || width === 0 || height === 0) return;\n // The store, not this render's `measured`, which only wakes the effect: nodes React Flow took in this commit (its\n // effects run before this one) are in the store but not yet measured, while this render still says all were.\n if (!allMeasured(store.getState())) return;\n const last = fittedFor.current;\n if (last !== null && Object.is(last.key, key) && last.width === width && last.height === height) return;\n fittedFor.current = { key, width, height };\n void land(0);\n }, [following, key, width, height, measured, store, land]);\n\n const fit = useCallback(() => {\n const now = latest.current;\n fittedFor.current = { key: now.key, width: now.width, height: now.height };\n setFollowing(true);\n void land(slowMotionMs(store.getState().domNode));\n }, [land, store]);\n\n const flowProps = useMemo<FollowFitFlowProps>(\n () => ({\n // A move made by code (a fit, a zoom from a tool) has no event; only the person's own move stops following.\n onMoveStart: (event) => {\n if (event !== null) setFollowing(false);\n },\n }),\n [],\n );\n\n return { following, fit, flowProps };\n}\n","// A ghost wire (docs/graph.md#ghostwire): a request on its way, before the app's graph holds the edge. An edge type the\n// app registers as `ghost`; it draws with React Flow's BaseEdge but has no hit path and takes no pointer events, so it\n// can be neither hovered nor clicked. How long a refused one stays is the app's: it removes the edge.\nimport { BaseEdge, type Edge, EdgeLabelRenderer, type EdgeProps, getBezierPath } from \"@xyflow/react\";\nimport { type ReactNode, useMemo } from \"react\";\nimport \"./GhostWire.css\";\n\n/** `pending` (the default) or `refused`; any other string is drawn as `pending`. */\nexport type GhostWireTone = \"pending\" | \"refused\" | (string & {});\n\n/** A ghost wire's look, as React Flow's edge `data`. */\nexport type GhostWireData = {\n /** `pending` (dashed in the quiet tone, dimmed) or `refused` (the error tone). */\n tone?: GhostWireTone;\n /** At the midpoint, on the raised surface; it takes no pointer events. */\n label?: ReactNode;\n};\n\n/** An edge drawn by `GhostWire`: register it as `edgeTypes={{ ghost: GhostWire }}`. */\nexport type GhostWireEdge = Edge<GhostWireData, \"ghost\">;\n\n/** Draws a request's wire between two handles while it is on its way. */\nexport function GhostWire({\n id,\n sourceX,\n sourceY,\n targetX,\n targetY,\n sourcePosition,\n targetPosition,\n data,\n}: EdgeProps<GhostWireEdge>) {\n const [path, labelX, labelY] = useMemo(\n () => getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition }),\n [sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition],\n );\n const tone = data?.tone === \"refused\" ? \"refused\" : \"pending\";\n const label = data?.label;\n return (\n <>\n <g className=\"pb-ghost-wire\" data-tone={tone} aria-hidden=\"true\">\n <BaseEdge id={id} path={path} className=\"pb-ghost-wire-path\" interactionWidth={0} />\n </g>\n {label !== undefined && label !== null && (\n <EdgeLabelRenderer>\n <div\n className=\"pb-ghost-wire-label\"\n data-tone={tone}\n style={{ transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)` }}\n >\n {label}\n </div>\n </EdgeLabelRenderer>\n )}\n </>\n );\n}\n","// A level bar on a decibel scale (docs/graph.md#meter). It is painted through refs and never re-renders through\n// React for a level: useLiveValue hands each new value to paint(), which sets CSS variables and data attributes on\n// the element, and requestAnimationFrame runs only while something moves (a new value, a held tick that will fall, a\n// lit clip lamp counting down). Times come from performance.now(), a monotonic clock.\nimport {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type Ref,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useState,\n} from \"react\";\nimport { type LiveSubscribe, useLiveValue } from \"../../hooks\";\nimport \"./Meter.css\";\n\n/** Which way the bar fills: an open enum, and one it does not know is drawn horizontal. */\nexport type MeterOrientation = \"horizontal\" | \"vertical\" | (string & {});\n\n/** Writes the tooltip from the current peak and RMS in dBFS (`-Infinity` for silence) and whether the lamp is lit. */\nexport type MeterTitle = (peakDb: number, rmsDb: number, clipped: boolean) => string;\n\n/** What a parent can do to a meter through its `ref`. */\nexport type MeterHandle = {\n /** Empties the bar and clears the held peak and the clip lamp, as when the source closes. */\n reset(): void;\n};\n\nexport type MeterProps = Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"title\" | \"role\"> & {\n /** Adds a listener that means a new value is ready to read; returns what removes it. */\n subscribe: LiveSubscribe;\n /** The current `[peak, rms]` as linear amplitude, 1.0 being 0 dBFS. Not a number, or 0 and below, is silence. */\n read: () => readonly [peak: number, rms: number];\n /** `horizontal` (the default) or `vertical`. */\n orientation?: MeterOrientation;\n /** dBFS at the bar's empty end; the full end is 0 dBFS. -60 by default. */\n floor?: number;\n /** `[mid, hot]` in dBFS, where the bar turns from `--pb-meter-low` to `--pb-meter-mid` and to `--pb-meter-hot`. */\n zones?: readonly [mid: number, hot: number];\n /** How long the peak tick holds the highest peak, in ms. 1500 by default. */\n holdMs?: number;\n /** How fast the tick then falls toward the current peak, in dB a second. 20 by default. */\n fallDbPerS?: number;\n /** A peak at or above this linear amplitude lights the clip lamp. 1.0 (0 dBFS) by default. */\n clipAt?: number;\n /** How long the lamp stays lit after the last such peak, in ms. 2000 by default. */\n clipHoldMs?: number;\n /** The accessible name (\"Level\" by default); the numbers are never announced. */\n label?: string;\n /** The tooltip's words; `defaultMeterTitle` by default. */\n title?: MeterTitle;\n /** `reset()`, for when the source closes. */\n ref?: Ref<MeterHandle>;\n};\n\n/** The scale's defaults, each a prop. */\nexport const defaultMeterScale = {\n floor: -60,\n zones: [-18, -6] as const,\n holdMs: 1500,\n fallDbPerS: 20,\n clipAt: 1,\n clipHoldMs: 2000,\n} as const;\n\n/** How often, at most, the tooltip is refreshed while the pointer is over the meter, in ms. */\nexport const meterTitleEveryMs = 250;\n\n/** A linear amplitude in dBFS; not a number, or 0 and below, is silence (`-Infinity`). */\nexport function toDb(linear: number): number {\n return Number.isFinite(linear) && linear > 0 ? 20 * Math.log10(linear) : linear === Infinity ? Infinity : -Infinity;\n}\n\n/** Where a level in dBFS sits on a bar from `floor` (0) to 0 dBFS (1), clamped. */\nexport function meterFraction(db: number, floor: number): number {\n if (Number.isNaN(db) || floor >= 0) return 0;\n return Math.min(1, Math.max(0, (db - floor) / -floor));\n}\n\nconst formatDb = (db: number) => (db === -Infinity ? \"−∞\" : db.toFixed(1));\n\n/** The English tooltip: \"peak -12.0 dB, rms -18.3 dB\", with −∞ for silence. */\nexport const defaultMeterTitle: MeterTitle = (peakDb, rmsDb) =>\n `peak ${formatDb(peakDb)} dB, rms ${formatDb(rmsDb)} dB`;\n\ntype Level = {\n peakDb: number;\n rmsDb: number;\n /** The tick's level when it was last set, and when; it holds, then falls from there. */\n heldDb: number;\n heldAt: number;\n /** When the last peak at or above `clipAt` came, or -Infinity. */\n clippedAt: number;\n};\n\ntype Scale = Required<Pick<MeterProps, \"floor\" | \"holdMs\" | \"fallDbPerS\" | \"clipAt\" | \"clipHoldMs\" | \"title\">>;\n\nconst silent = (): Level => ({\n peakDb: -Infinity,\n rmsDb: -Infinity,\n heldDb: -Infinity,\n heldAt: -Infinity,\n clippedAt: -Infinity,\n});\n\n/**\n * The meter's moving parts outside React: the level, the held tick and the lamp, the frame loop and the tooltip.\n * One is made per mounted meter; it paints into whatever element `attach` gave it.\n */\nfunction createPainter(initial: Scale) {\n let element: HTMLElement | null = null;\n let scale = initial;\n let level = silent();\n let frame: number | undefined;\n let hovered = false;\n let titledAt = -Infinity;\n /** A level came since the tooltip was last written. */\n let stale = false;\n\n /** The tick's level at `now`: the held peak, then falling at the set rate, never below the current peak. */\n const tickAt = (now: number) => {\n const falling = Math.max(0, now - level.heldAt - scale.holdMs);\n const fallen = falling === 0 ? level.heldDb : level.heldDb - (Math.max(0, scale.fallDbPerS) * falling) / 1000;\n return Math.max(level.peakDb, fallen);\n };\n\n const writeTitle = (now: number) => {\n if (element === null) return;\n const clipped = now - level.clippedAt < scale.clipHoldMs;\n element.title = scale.title(level.peakDb, level.rmsDb, clipped);\n titledAt = now;\n stale = false;\n };\n\n /** Draws the level at `now`; says whether anything will still move. */\n const paint = (now: number) => {\n if (element === null) return false;\n const tick = tickAt(now);\n const lit = now - level.clippedAt < scale.clipHoldMs;\n element.style.setProperty(\"--pb-meter-level\", String(meterFraction(level.rmsDb, scale.floor)));\n element.style.setProperty(\"--pb-meter-tick\", String(meterFraction(tick, scale.floor)));\n element.dataset[\"peak\"] = tick > scale.floor ? \"shown\" : \"hidden\";\n element.dataset[\"clipped\"] = String(lit);\n if (hovered && now - titledAt >= meterTitleEveryMs) writeTitle(now);\n // Still moving while the tick is above the current peak and the floor (held, or falling), or the lamp is lit; and,\n // while hovered, until the tooltip has caught up with the last level.\n return (tick > level.peakDb && tick > scale.floor) || lit || (hovered && stale);\n };\n\n const run = () => {\n frame = undefined;\n if (paint(performance.now())) frame = requestAnimationFrame(run);\n };\n\n const wake = () => {\n if (frame === undefined && element !== null) frame = requestAnimationFrame(run);\n };\n\n const stop = () => {\n if (frame !== undefined) cancelAnimationFrame(frame);\n frame = undefined;\n };\n\n return {\n attach(next: HTMLElement | null) {\n element = next;\n if (next === null) stop();\n else wake();\n },\n setScale(next: Scale) {\n const moved =\n next.floor !== scale.floor ||\n next.holdMs !== scale.holdMs ||\n next.fallDbPerS !== scale.fallDbPerS ||\n next.clipHoldMs !== scale.clipHoldMs;\n scale = next;\n if (moved) wake();\n },\n take: ([peak, rms]: readonly [number, number]) => {\n const now = performance.now();\n const peakDb = toDb(peak);\n const tick = tickAt(now);\n level.peakDb = peakDb;\n level.rmsDb = toDb(rms);\n if (peakDb >= tick) {\n level.heldDb = peakDb;\n level.heldAt = now;\n }\n if (peak >= scale.clipAt) level.clippedAt = now;\n stale = true;\n wake();\n },\n reset: () => {\n level = silent();\n stop();\n const now = performance.now();\n paint(now);\n if (hovered) writeTitle(now);\n },\n hover(on: boolean) {\n hovered = on;\n if (on) writeTitle(performance.now());\n },\n };\n}\n\nexport function Meter({\n subscribe,\n read,\n orientation = \"horizontal\",\n floor = defaultMeterScale.floor,\n zones = defaultMeterScale.zones,\n holdMs = defaultMeterScale.holdMs,\n fallDbPerS = defaultMeterScale.fallDbPerS,\n clipAt = defaultMeterScale.clipAt,\n clipHoldMs = defaultMeterScale.clipHoldMs,\n label = \"Level\",\n title = defaultMeterTitle,\n ref,\n className,\n style,\n onPointerEnter,\n onPointerLeave,\n ...rest\n}: MeterProps) {\n const [painter] = useState(() => createPainter({ floor, holdMs, fallDbPerS, clipAt, clipHoldMs, title }));\n // Every render hands the painter the scale and words; a new scale redraws the level on it.\n useLayoutEffect(() => {\n painter.setScale({ floor, holdMs, fallDbPerS, clipAt, clipHoldMs, title });\n });\n const attach = useCallback(\n (element: HTMLDivElement | null) => {\n painter.attach(element);\n },\n [painter],\n );\n useLiveValue(subscribe, read, painter.take);\n useImperativeHandle(ref, () => ({ reset: painter.reset }), [painter]);\n\n const [mid, hot] = zones;\n const classes = className === undefined ? \"pb-meter\" : `pb-meter ${className}`;\n const zoneStyle = {\n ...style,\n \"--pb-meter-mid-at\": String(meterFraction(mid, floor)),\n \"--pb-meter-hot-at\": String(meterFraction(hot, floor)),\n } as CSSProperties;\n\n return (\n <div\n {...rest}\n ref={attach}\n className={classes}\n role=\"img\"\n aria-label={label}\n data-orientation={orientation}\n data-peak=\"hidden\"\n data-clipped=\"false\"\n style={zoneStyle}\n onPointerEnter={(event) => {\n painter.hover(true);\n onPointerEnter?.(event);\n }}\n onPointerLeave={(event) => {\n painter.hover(false);\n onPointerLeave?.(event);\n }}\n >\n <span className=\"pb-meter-track\" aria-hidden=\"true\">\n <span className=\"pb-meter-bar\" />\n <span className=\"pb-meter-peak\" />\n </span>\n <span className=\"pb-meter-lamp\" aria-hidden=\"true\" />\n </div>\n );\n}\n","// One port of a node (docs/graph.md#portrow): its React Flow handle at the box's edge and its words. NodeBox draws its\n// rows with it; an app drawing a box of its own may use it alone, inside a React Flow node. React Flow's own handle\n// classes stay on the handle, so its connection logic and connectionRadius work as on any handle.\nimport { Handle, Position, useNodeId } from \"@xyflow/react\";\nimport type { ReactNode } from \"react\";\nimport { WarnMark } from \"../../primitives\";\nimport { useConnectHintsValue } from \"../connect-hints/useConnectHints\";\nimport \"./PortRow.css\";\n\n/** Which side of the box a port is on: an input is a target handle on the left edge, an output a source on the right. */\nexport type PortSide = \"input\" | \"output\";\n\n/**\n * What a port shows while a wire is dragged: `origin` the handle the drag began at, `ok` a handle that accepts it,\n * `no` one that refuses it, `null` no drag. An open enum; one it does not know is drawn as `null`.\n */\nexport type PortHint = \"ok\" | \"no\" | \"origin\" | null | (string & {});\n\nexport type PortRowProps = {\n /** The handle id, passed to React Flow's `<Handle id>` unchanged (the app's own scheme). */\n id: string;\n /** `input` (a target handle on the left edge) or `output` (a source handle on the right edge). */\n side: PortSide;\n /** The port's name; a string is also its tooltip. */\n label: ReactNode;\n /** After the label in the muted code face: the port's type. */\n typeLabel?: ReactNode;\n /** While a wire is dragged: `origin`, `ok`, `no`, or `null` for no drag. Given, it wins over `<ConnectHints>`'. */\n hint?: PortHint;\n /** Why the port refuses the wire: the handle's and the row's tooltip while `hint` is `no`. */\n reason?: string;\n /** A problem with the port: a warning mark beside the label, with these as its words. */\n problem?: string;\n /** A slot at the row's inner end, toward the box's centre (a `Meter`). */\n trailing?: ReactNode;\n /** Whether a wire may start or end here; true by default (`<Handle isConnectable>`). */\n connectable?: boolean;\n};\n\nconst knownHints: readonly string[] = [\"ok\", \"no\", \"origin\"];\n\n/** Draws one port: its handle at the edge, its label and type, a problem's mark and a trailing slot. */\nexport function PortRow({\n id,\n side,\n label,\n typeLabel,\n hint: ownHint,\n reason: ownReason,\n problem,\n trailing,\n connectable = true,\n}: PortRowProps) {\n const isInput = side !== \"output\";\n const drag = useConnectHintsValue();\n const nodeId = useNodeId();\n // A hint given as a prop wins; otherwise the drag in progress says, judged once per drag for this handle.\n const fromDrag =\n ownHint === undefined && drag !== null && nodeId !== null\n ? drag.hintFor({ nodeId, handleId: id }, isInput ? \"input\" : \"output\")\n : undefined;\n const hint = fromDrag === undefined ? (ownHint ?? null) : fromDrag.hint;\n const reason = fromDrag === undefined ? ownReason : (fromDrag.reason ?? ownReason);\n const shown = hint !== null && knownHints.includes(hint) ? hint : undefined;\n const refused = shown === \"no\" && reason !== undefined ? reason : undefined;\n return (\n <div\n className=\"pb-port-row\"\n data-side={isInput ? \"input\" : \"output\"}\n data-hint={shown}\n title={refused ?? (typeof label === \"string\" ? label : undefined)}\n >\n <Handle\n id={id}\n type={isInput ? \"target\" : \"source\"}\n position={isInput ? Position.Left : Position.Right}\n isConnectable={connectable}\n className=\"pb-port-handle\"\n data-hint={shown}\n title={refused}\n />\n <span className=\"pb-port-words\">\n <span className=\"pb-port-label\">{label}</span>\n {typeLabel !== undefined && <code className=\"pb-port-type\">{typeLabel}</code>}\n {problem !== undefined && <WarnMark label={problem} title={problem} />}\n </span>\n {trailing !== undefined && <span className=\"pb-port-trailing\">{trailing}</span>}\n </div>\n );\n}\n","// A node's box (docs/graph.md#nodebox): the body of an app's own React Flow node type, a header (title, subtitle, a\n// change's badge and a status slot), a line saying why the node is silent, its ports as PortRows, and a footer. Its\n// sizes come from the --pb-node-* tokens, the same values as the geometry constants an app lays its nodes out with\n// (nodeBoxSize), so a rendered box is the size the layout made room for.\nimport { useNodeId, useUpdateNodeInternals } from \"@xyflow/react\";\nimport { type ComponentPropsWithoutRef, type CSSProperties, type ReactNode, useEffect, useId, useRef } from \"react\";\nimport { Badge } from \"../../primitives\";\nimport { PortRow, type PortRowProps } from \"../port-row\";\nimport type { NodePorts } from \"./geometry\";\nimport \"./NodeBox.css\";\n\n/** A box's stripe down its start edge: an open enum, and one it does not know is drawn in `--pb-line-strong`. */\nexport type NodeBoxTone = \"ok\" | \"warn\" | \"err\" | \"quiet\" | \"off\" | \"accent\" | \"muted\" | (string & {});\n\n/** An edit not yet applied: an open enum, and one it does not know is a plain border with its own string as the word. */\nexport type NodeBoxChange = \"added\" | \"removed\" | \"renamed\" | \"changed\" | (string & {});\n\n/** The words of the change badge. */\nexport type NodeBoxChangeLabels = { added: string; removed: string; renamed: string; changed: string };\n\n/** English defaults for `changeLabels`. */\nexport const defaultChangeLabels: NodeBoxChangeLabels = {\n added: \"added\",\n removed: \"removed\",\n renamed: \"renamed\",\n changed: \"changed\",\n};\n\n/** One port of a box: a `PortRow`'s props without `side`, which `NodeBox` sets. */\nexport type PortSpec = Omit<PortRowProps, \"side\">;\n\nexport type NodeBoxProps = Omit<ComponentPropsWithoutRef<\"div\">, \"title\" | \"children\" | \"role\"> & {\n /** The node's name, one line cut with an ellipsis; a string is also the header's tooltip. Names the box's group. */\n title: ReactNode;\n /** The second header line, muted: the node's type. */\n subtitle?: ReactNode;\n /** The stripe down the box's start edge, in the tone's colour; none, or one it does not know, in `--pb-line-strong`. */\n tone?: NodeBoxTone;\n /** A dashed border, the stripe hatched and the words muted. Drawing only: whether its ports connect is the app's. */\n disabled?: boolean;\n /** The border in `--pb-err` and the header on `--pb-err-soft`; the reason goes in `line`. */\n failed?: boolean;\n /** An edit not yet applied: a 2 px border in its tone and a badge with its word; `removed` strikes the title. */\n change?: NodeBoxChange;\n /** The change badge's words; English by default. */\n changeLabels?: Partial<NodeBoxChangeLabels>;\n /** A slot at the header's end (a `Pill`). */\n status?: ReactNode;\n /** One row under the header saying why the node is silent; a string is also its tooltip. */\n line?: ReactNode;\n /** The input ports, keyed by `id`. */\n inputs?: readonly PortSpec[];\n /** The output ports, keyed by `id`. */\n outputs?: readonly PortSpec[];\n /** `stacked` (the default: the inputs' rows, then the outputs') or `side-by-side` (two columns). */\n ports?: NodePorts;\n /** A slot: one row at the foot (badges). */\n footer?: ReactNode;\n /** Selected, from React Flow's `NodeProps`: a 2 px outline in the accent. */\n selected?: boolean;\n /** Its width in px; `NODE_WIDTH` by default. */\n width?: number;\n};\n\nconst knownChanges: readonly string[] = [\"added\", \"removed\", \"renamed\", \"changed\"];\n\n/** Draws a node's box; render it inside a React Flow node. */\nexport function NodeBox({\n title,\n subtitle,\n tone,\n disabled = false,\n failed = false,\n change,\n changeLabels,\n status,\n line,\n inputs = [],\n outputs = [],\n ports = \"stacked\",\n footer,\n selected = false,\n width,\n className,\n style,\n ...rest\n}: NodeBoxProps) {\n const titleId = useId();\n const layout = ports === \"side-by-side\" ? \"side-by-side\" : \"stacked\";\n usePortsMeasured(inputs, outputs, layout);\n\n const words = { ...defaultChangeLabels, ...changeLabels };\n const changeWord =\n change === undefined\n ? undefined\n : knownChanges.includes(change)\n ? words[change as keyof NodeBoxChangeLabels]\n : change;\n const hasPorts = inputs.length > 0 || outputs.length > 0;\n const inputRows = inputs.map((port) => <PortRow key={port.id} {...port} side=\"input\" />);\n const outputRows = outputs.map((port) => <PortRow key={port.id} {...port} side=\"output\" />);\n\n return (\n <div\n {...rest}\n className={className === undefined ? \"pb-node-box\" : `pb-node-box ${className}`}\n role=\"group\"\n aria-labelledby={titleId}\n data-tone={tone}\n data-change={change}\n data-disabled={disabled ? \"\" : undefined}\n data-failed={failed ? \"\" : undefined}\n data-selected={selected ? \"\" : undefined}\n style={width === undefined ? style : ({ ...style, width: `${width}px` } satisfies CSSProperties)}\n >\n <div className=\"pb-node-header\">\n <div className=\"pb-node-heading\">\n <span id={titleId} className=\"pb-node-title\" title={typeof title === \"string\" ? title : undefined}>\n {title}\n </span>\n {subtitle !== undefined && <span className=\"pb-node-subtitle\">{subtitle}</span>}\n </div>\n {changeWord !== undefined && (\n <Badge tone={change ?? \"\"} className=\"pb-node-change\">\n {changeWord}\n </Badge>\n )}\n {status !== undefined && <div className=\"pb-node-status\">{status}</div>}\n </div>\n {line !== undefined && (\n <div className=\"pb-node-line\" title={typeof line === \"string\" ? line : undefined}>\n {line}\n </div>\n )}\n {hasPorts &&\n (layout === \"side-by-side\" ? (\n <div className=\"pb-node-ports\" data-ports=\"side-by-side\">\n <div className=\"pb-node-column\" data-side=\"input\">\n {inputRows}\n </div>\n <div className=\"pb-node-column\" data-side=\"output\">\n {outputRows}\n </div>\n </div>\n ) : (\n <div className=\"pb-node-ports\" data-ports=\"stacked\">\n {inputRows}\n {outputRows}\n </div>\n ))}\n {footer !== undefined && <div className=\"pb-node-footer\">{footer}</div>}\n </div>\n );\n}\n\n/**\n * Asks React Flow to measure the node's handles again when its ordered port ids or their layout change, so a handle\n * added or moved is where a wire meets it. React Flow measures a node's handles itself when the node first renders.\n */\nfunction usePortsMeasured(inputs: readonly PortSpec[], outputs: readonly PortSpec[], layout: string) {\n const nodeId = useNodeId();\n const updateNodeInternals = useUpdateNodeInternals();\n const key = JSON.stringify([layout, inputs.map((port) => port.id), outputs.map((port) => port.id)]);\n const measured = useRef(key);\n useEffect(() => {\n if (measured.current === key) return;\n measured.current = key;\n if (nodeId !== null) updateNodeInternals(nodeId);\n }, [key, nodeId, updateNodeInternals]);\n}\n","// A node box's geometry (docs/graph.md#geometry). An app sizes its nodes before they render (dagre and ELK take\n// sizes), so the sizes are fixed: these constants are what layout code reads, and tokens.css holds the same values as\n// --pb-node-* tokens, which NodeBox and PortRow size themselves from. geometry.test.ts holds each token equal to its\n// constant, and tokens.test.ts fails on a brand that sets one.\n\n/** The default width of a node box, in px; `NodeBox`'s `width` overrides it per node (`--pb-node-width`). */\nexport const NODE_WIDTH = 240;\n/** The header (title and subtitle), with or without a subtitle, in px (`--pb-node-header`). */\nexport const NODE_HEADER = 46;\n/** The `line` row, when there is one, in px (`--pb-node-line`). */\nexport const NODE_LINE = 22;\n/** One port row, in px (`--pb-node-row`). */\nexport const NODE_ROW = 22;\n/** The space above the first port row and below the last, in px (`--pb-node-pad`). */\nexport const NODE_PAD = 8;\n/** The footer, when there is one, in px (`--pb-node-footer`). */\nexport const NODE_FOOTER = 28;\n/** A handle's dot, in px (`--pb-node-handle`). */\nexport const HANDLE_SIZE = 10;\n/** A handle's hit area, centred on the dot, in px (`--pb-node-handle-hit`); 32 px on a touch screen. */\nexport const HANDLE_HIT = 20;\n\n/**\n * How a node box lays out its ports: `stacked` (the inputs' rows, then the outputs') or `side-by-side` (two columns,\n * row n of each on one line). An open enum; one it does not know is stacked.\n */\nexport type NodePorts = \"stacked\" | \"side-by-side\" | (string & {});\n\n/** What decides a node box's size: its port counts, their layout, and whether it has a line and a footer. */\nexport type NodeBoxShape = {\n /** How many input ports. */\n inputs: number;\n /** How many output ports. */\n outputs: number;\n /** How the ports are laid out. */\n ports: NodePorts;\n /** Whether it has a `line` row. */\n line: boolean;\n /** Whether it has a footer. */\n footer: boolean;\n /** Its width in px; `NODE_WIDTH` by default. */\n width?: number;\n};\n\n/** How many port rows a box draws: inputs plus outputs stacked, the larger of the two side by side. */\nexport function nodePortRows(inputs: number, outputs: number, ports: NodePorts): number {\n return ports === \"side-by-side\" ? Math.max(inputs, outputs) : inputs + outputs;\n}\n\n/**\n * A node box's size in px, the one formula layout code sizes nodes with: the header, the line when there is one, the\n * port rows and the padding above and below them when there are ports, and the footer when there is one. The box's\n * 1 px border is inside it; the selection ring is outside.\n */\nexport function nodeBoxSize({ inputs, outputs, ports, line, footer, width = NODE_WIDTH }: NodeBoxShape): {\n width: number;\n height: number;\n} {\n const rows = nodePortRows(Math.max(0, inputs), Math.max(0, outputs), ports);\n const height =\n NODE_HEADER + (line ? NODE_LINE : 0) + (rows > 0 ? 2 * NODE_PAD + rows * NODE_ROW : 0) + (footer ? NODE_FOOTER : 0);\n return { width, height };\n}\n","// A wire (docs/graph.md#wire): an edge type an app registers in edgeTypes, its look from the edge's data. The visible\n// path is React Flow's BaseEdge, so its react-flow__edge-path class and selection stay; the hit path keeps\n// react-flow__edge-interaction and carries the tooltip. The path is rebuilt only when an end moves: the level arrives\n// as --pb-wire-emphasis on the wire's group, so a change of level restyles it without touching the path.\nimport { BaseEdge, type Edge, EdgeLabelRenderer, type EdgeProps, getBezierPath, Position } from \"@xyflow/react\";\nimport { type CSSProperties, memo, type ReactNode, useMemo } from \"react\";\nimport type { PillTone } from \"../../primitives\";\nimport \"./Wire.css\";\n\n/** Pill's tones, the changes, `pending` and `refused`; any other string is drawn in the edge stroke. */\nexport type WireTone = PillTone | \"added\" | \"removed\" | \"changed\" | \"pending\" | \"refused\" | (string & {});\n\n/** A wire's look, as React Flow's edge `data`. */\nexport type WireData = {\n /** The stroke's tone; none, or one it does not know, is React Flow's edge stroke. */\n tone?: WireTone;\n /** The signal's level, 0 to 1 (clamped; not a number is 0): thickness and brightness. None is the plain wire. */\n emphasis?: number;\n /** Dashes: an edit not yet saved. */\n dashed?: boolean;\n /** Dots moving along the wire toward the input; not drawn under reduced motion. */\n flow?: boolean;\n /** An arrowhead at the input end, facing the handle's side. */\n arrow?: boolean;\n /** At the midpoint, on the raised surface; it takes no pointer events. */\n label?: ReactNode;\n /** The wire's tooltip, on its hit path. */\n title?: string;\n};\n\n/** An edge drawn by `Wire`: register it as `edgeTypes={{ wire: Wire }}`. */\nexport type WireEdge = Edge<WireData, \"wire\">;\n\n/** The arrowhead's length along the wire and half its width, in px. */\nconst ARROW_LENGTH = 8;\nconst ARROW_HALF = 4;\n\n/** A level as the wire draws it: 0 to 1, anything not a number 0. */\nfunction emphasisOf(value: unknown): number {\n if (typeof value !== \"number\" || Number.isNaN(value)) return 0;\n return Math.min(1, Math.max(0, value));\n}\n\n/** A triangle with its tip on the handle, pointing into the node from the side the handle is on. */\nfunction arrowPath(x: number, y: number, side: Position): string {\n // The way back from the tip, away from the node.\n const dx = side === Position.Left ? -1 : side === Position.Right ? 1 : 0;\n const dy = side === Position.Top ? -1 : side === Position.Bottom ? 1 : 0;\n const baseX = x + dx * ARROW_LENGTH;\n const baseY = y + dy * ARROW_LENGTH;\n // Perpendicular to the direction, for the base's two corners.\n const px = -dy * ARROW_HALF;\n const py = dx * ARROW_HALF;\n return `M ${x} ${y} L ${baseX + px} ${baseY + py} L ${baseX - px} ${baseY - py} Z`;\n}\n\ntype WireBodyProps = {\n id: string;\n path: string;\n flow: boolean;\n arrow: string | undefined;\n title: string | undefined;\n interactionWidth: number;\n markerStart: string | undefined;\n markerEnd: string | undefined;\n style: CSSProperties | undefined;\n};\n\n/** The paths, which change only when an end, the flow, the arrow or the tooltip does. */\nconst WireBody = memo(function WireBody({\n id,\n path,\n flow,\n arrow,\n title,\n interactionWidth,\n markerStart,\n markerEnd,\n style,\n}: WireBodyProps) {\n return (\n <>\n <BaseEdge\n id={id}\n path={path}\n className=\"pb-wire-path\"\n interactionWidth={0}\n markerStart={markerStart}\n markerEnd={markerEnd}\n style={style}\n />\n {flow && <path d={path} fill=\"none\" className=\"pb-wire-flow\" aria-hidden=\"true\" />}\n {arrow !== undefined && <path d={arrow} className=\"pb-wire-arrow\" aria-hidden=\"true\" />}\n {interactionWidth > 0 && (\n <path\n d={path}\n fill=\"none\"\n strokeOpacity={0}\n strokeWidth={interactionWidth}\n className=\"react-flow__edge-interaction\"\n >\n {title !== undefined && <title>{title}</title>}\n </path>\n )}\n </>\n );\n});\n\n/** Draws a wire between two handles: its tone, level, dashes, flow, arrow, label and tooltip from the edge's data. */\nexport function Wire({\n id,\n sourceX,\n sourceY,\n targetX,\n targetY,\n sourcePosition,\n targetPosition,\n data,\n selected,\n interactionWidth = 20,\n markerStart,\n markerEnd,\n style,\n}: EdgeProps<WireEdge>) {\n const [path, labelX, labelY] = useMemo(\n () => getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition }),\n [sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition],\n );\n const showArrow = data?.arrow === true;\n const arrow = useMemo(\n () => (showArrow ? arrowPath(targetX, targetY, targetPosition) : undefined),\n [showArrow, targetX, targetY, targetPosition],\n );\n const emphasis = data?.emphasis === undefined ? undefined : emphasisOf(data.emphasis);\n const level = emphasis === undefined ? undefined : ({ \"--pb-wire-emphasis\": emphasis } as CSSProperties);\n const label = data?.label;\n return (\n <>\n <g\n className=\"pb-wire\"\n data-tone={data?.tone}\n data-selected={selected === true ? \"\" : undefined}\n data-dashed={data?.dashed === true ? \"\" : undefined}\n data-emphasis={emphasis === undefined ? undefined : \"\"}\n style={level}\n >\n <WireBody\n id={id}\n path={path}\n flow={data?.flow === true}\n arrow={arrow}\n title={data?.title}\n interactionWidth={interactionWidth}\n markerStart={markerStart}\n markerEnd={markerEnd}\n style={style}\n />\n </g>\n {label !== undefined && label !== null && (\n <EdgeLabelRenderer>\n <div\n className=\"pb-wire-label\"\n data-tone={data?.tone}\n style={{ transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)` }}\n >\n {label}\n </div>\n </EdgeLabelRenderer>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;AA4BA,IAAMG,KAAU,MACdC,aAAkB,WAAWA,EAAO,UAAU,SAAS,kBAAkB;AAG3E,SAASC,EAAM,GAAiE;CAC9E,IAAI,oBAAoBC,GAAO;EAC7B,I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C;EAASC;CAAc,CACrE,GACMsI,IAAYpI,GAAM,UAAU,IAC5BiI,IAAQ3O,QACL8O,IAAYZ,GAAU5H,GAASC,GAASC,CAAc,IAAI,KAAA,GACjE;EAACsI;EAAWxI;EAASC;EAASC;CAAc,CAC9C,GACMuI,IAAWrI,GAAM,aAAa,KAAA,IAAY,KAAA,IAAYuH,GAAWvH,EAAK,QAAQ,GAC9EmB,IAAQkH,MAAa,KAAA,IAAY,KAAA,IAAa,EAAE,sBAAsBA,EAAS,GAC/EpI,IAAQD,GAAM;CACpB,OACE,kBAAA1H,GAAA,EAAA,UAAA,CACE,kBAAC,KAAD;EACE,WAAU;EACV,aAAW0H,GAAM;EACjB,iBAAegG,MAAa,KAAO,KAAK,KAAA;EACxC,eAAahG,GAAM,WAAW,KAAO,KAAK,KAAA;EAC1C,iBAAeqI,MAAa,KAAA,IAAY,KAAA,IAAY;EACpD,OAAOlH;EAEP,UAAA,kBAAC4G,IAAD;GACM;GACE;GACN,MAAM/H,GAAM,SAAS;GACd;GACP,OAAOA,GAAM;GACK;GACL;GACF;GACJ;EACR,CAAA;CACA,CAAA,GACFC,KAAiC,QAChC,kBAACE,GAAD,EAAA,UACE,kBAAC,OAAD;EACE,WAAU;EACV,aAAWH,GAAM;EACjB,OAAO,EAAE,WAAW,mCAAmCV,EAAO,MAAMC,EAAO,KAAK;EAE/E,UAAAU;CACE,CAAA,EACY,CAAA,CAErB,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"graph.js","names":["_Fragment","_Fragment","_Fragment","isPane","target","endOf","event","touch","elementAt","x","y","useAddAt","enabled","options","useReactFlow","latest","useRef","origin","useMemo","add","on","toFlow","nodeId","handleType","from","state","end","fallback","slowMotionMs","value","element","parsed","defaultCanvasToolsLabels","glyph","path","glyphs","CanvasTools","words","labels","flow","store","useStoreApi","duration","tool","keys","keyShortcuts","name","IconButton","pressed","act","Fragment","Panel","className","ToolGroup","onFit","fitOptions","onTidy","onMinimap","minimap","children","MiniMap","minimapNodeClassName","mergeFlowProps","objects","values","handlers","object","list","merged","only","args","each","ConnectHintsContext","createContext","ConnectHints","useConnectHintsValue","useContext","verdictKey","to","samePort","a","b","useConnectHints","rule","canConnect","verdicts","setOrigin","useState","judge","kept","key","known","verdict","flowProps","connection","side","port","at","allMeasured","node","useFollowFit","width","useStore","height","measured","following","setFollowing","fittedFor","land","useCallback","useEffect","last","now","GhostWire","labelX","labelY","getBezierPath","sourceX","sourceY","sourcePosition","targetX","targetY","targetPosition","tone","data","label","BaseEdge","EdgeLabelRenderer","defaultMeterScale","meterTitleEveryMs","toDb","linear","meterFraction","db","floor","formatDb","defaultMeterTitle","peakDb","rmsDb","defaultMeterLabels","silent","createPainter","scale","initial","level","frame","hovered","titledAt","stale","tickAt","falling","fallen","writeTitle","clipped","paint","tick","lit","\"peak\"","\"clipped\"","run","wake","stop","next","moved","peak","rms","Meter","rest","painter","attach","useLiveValue","subscribe","read","useImperativeHandle","ref","mid","hot","zones","classes","zoneStyle","style","orientation","onPointerEnter","onPointerLeave","knownHints","PortRow","ownHint","ownReason","isInput","drag","useNodeId","fromDrag","id","hint","reason","shown","refused","Handle","Position","connectable","typeLabel","problem","WarnMark","trailing","defaultNodeBoxLabels","knownChanges","NodeBox","titleId","useId","layout","ports","inputs","outputs","changeWord","change","hasPorts","inputRows","outputRows","disabled","failed","selected","title","subtitle","Badge","status","line","footer","usePortsMeasured","updateNodeInternals","useUpdateNodeInternals","NODE_WIDTH","NODE_HEADER","NODE_LINE","NODE_ROW","NODE_PAD","NODE_FOOTER","HANDLE_SIZE","HANDLE_HIT","nodePortRows","nodeBoxSize","rows","ARROW_LENGTH","ARROW_HALF","emphasisOf","arrowPath","dx","dy","baseX","baseY","px","py","WireBody","memo","arrow","interactionWidth","Wire","showArrow","emphasis"],"sources":["../src/graph/add-at/useAddAt.ts","../src/graph/canvas-tools/motion.ts","../src/graph/canvas-tools/CanvasTools.tsx","../src/graph/connect-hints/mergeFlowProps.ts","../src/graph/connect-hints/useConnectHints.tsx","../src/graph/follow-fit/useFollowFit.ts","../src/graph/ghost-wire/GhostWire.tsx","../src/graph/meter/Meter.tsx","../src/graph/port-row/PortRow.tsx","../src/graph/node-box/NodeBox.tsx","../src/graph/node-box/geometry.ts","../src/graph/wire/Wire.tsx"],"sourcesContent":["// Adding at a place on the canvas (docs/graph.md#useaddat): a double-click on empty canvas, or a wire dropped there,\n// asks the app to add a node at that point, in flow coordinates, with the port the wire came from. Only the pane\n// counts: a double-click or a drop on a node, an edge, a handle or a panel is not empty canvas.\nimport { type OnConnectEnd, type OnConnectStart, useReactFlow } from \"@xyflow/react\";\nimport { type MouseEvent as ReactMouseEvent, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { PortRef } from \"../connect-hints\";\nimport type { PortSide } from \"../port-row\";\n\n/** A point in flow coordinates. */\nexport type FlowPoint = { x: number; y: number };\n\n/** Called with where to add, and the port a dropped wire came from (absent for a double-click). */\nexport type OnAddAt = (point: FlowPoint, from?: PortRef & { side: PortSide }) => void;\n\n/** The props `useAddAt` gives `<ReactFlow>`. */\nexport type AddAtFlowProps = {\n onDoubleClick: (event: ReactMouseEvent<HTMLDivElement>) => void;\n onConnectStart: OnConnectStart;\n onConnectEnd: OnConnectEnd;\n zoomOnDoubleClick: false;\n};\n\nexport type AddAtOptions = {\n /** false switches adding off (as while the graph is read-only); true by default. */\n enabled?: boolean;\n};\n\n/** Whether the element is this canvas's empty pane, not anything drawn on it. */\nconst isPane = (target: EventTarget | null) =>\n target instanceof Element && target.classList.contains(\"react-flow__pane\");\n\n/** Where a mouse or touch event ended, in the window's coordinates; a touch's end is in `changedTouches`. */\nfunction endOf(event: MouseEvent | TouchEvent): { x: number; y: number } | null {\n if (\"changedTouches\" in event) {\n const touch = event.changedTouches[0];\n return touch === undefined ? null : { x: touch.clientX, y: touch.clientY };\n }\n return { x: event.clientX, y: event.clientY };\n}\n\n/** The element at a point in the window, or null where the browser cannot say. */\nconst elementAt = ({ x, y }: { x: number; y: number }) =>\n typeof document.elementFromPoint === \"function\" ? document.elementFromPoint(x, y) : null;\n\n/**\n * Calls `onAddAt` for a double-click on empty canvas and for a wire dropped there where no handle took it. Its\n * `flowProps` go to `<ReactFlow>` (through `mergeFlowProps` with others); it turns React Flow's zoom on double-click\n * off, as the double-click is the add.\n */\nexport function useAddAt(onAddAt: OnAddAt, options: AddAtOptions = {}): { flowProps: AddAtFlowProps } {\n const enabled = options.enabled ?? true;\n const { screenToFlowPosition } = useReactFlow();\n const latest = useRef({ onAddAt, enabled, screenToFlowPosition });\n useLayoutEffect(() => {\n latest.current = { onAddAt, enabled, screenToFlowPosition };\n });\n // The handle the wire in progress began at; null outside a drag.\n const origin = useRef<(PortRef & { side: PortSide }) | null>(null);\n\n const flowProps = useMemo<AddAtFlowProps>(\n () => ({\n onDoubleClick: (event) => {\n const { onAddAt: add, enabled: on, screenToFlowPosition: toFlow } = latest.current;\n if (!on || !isPane(event.target)) return;\n add(toFlow({ x: event.clientX, y: event.clientY }));\n },\n onConnectStart: (_event, { nodeId, handleId, handleType }) => {\n origin.current =\n nodeId === null ? null : { nodeId, handleId, side: handleType === \"target\" ? \"input\" : \"output\" };\n },\n onConnectEnd: (event, state) => {\n const from = origin.current;\n origin.current = null;\n const { onAddAt: add, enabled: on, screenToFlowPosition: toFlow } = latest.current;\n if (!on || from === null || state.toHandle !== null) return;\n const end = endOf(event);\n if (end === null) return;\n // A mouse's up is on the element under it; a touch's end is on the element it began on, so ask the page.\n const target = \"changedTouches\" in event ? elementAt(end) : event.target;\n if (!isPane(target)) return;\n add(toFlow(end), from);\n },\n zoomOnDoubleClick: false,\n }),\n [],\n );\n\n return { flowProps };\n}\n","// How long a view move takes that a person asked for (a zoom, a fit; docs/graph.md#canvastools): the canvas's\n// --pb-motion-slow, which tokens.css sets to 0 ms under reduced motion, so a brand's duration and the person's wish\n// both hold. Read from the canvas's element at the move, since a brand or the theme can change it at any time.\n\nconst fallback = 180;\n\n/** `--pb-motion-slow` on `element` in milliseconds; without the tokens loaded, 180 ms, or 0 under reduced motion. */\nexport function slowMotionMs(element: Element | null | undefined): number {\n const value =\n element === null || element === undefined ? \"\" : getComputedStyle(element).getPropertyValue(\"--pb-motion-slow\");\n const parsed = /^\\s*(\\d+(?:\\.\\d+)?)(ms|s)\\s*$/.exec(value);\n if (parsed !== null) return Number(parsed[1]) * (parsed[2] === \"s\" ? 1000 : 1);\n const reduced =\n typeof window.matchMedia === \"function\" && window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n return reduced ? 0 : fallback;\n}\n","// A canvas's tools (docs/graph.md#canvastools), a child of the app's own <ReactFlow>: zoom, fit, and when the app\n// gives them, tidy and the minimap, as one ToolGroup in React Flow's <Panel>, and React Flow's <MiniMap> while the\n// minimap is on. The layout behind tidy and the minimap's state are the app's; the zoom and fit move the view through\n// React Flow over --pb-motion-slow, at once under reduced motion.\nimport {\n type FitViewOptions,\n MiniMap,\n type Node,\n Panel,\n type PanelPosition,\n useReactFlow,\n useStoreApi,\n} from \"@xyflow/react\";\nimport type { ReactNode } from \"react\";\nimport { IconButton, ToolGroup } from \"../../primitives\";\nimport { slowMotionMs } from \"./motion\";\nimport \"./CanvasTools.css\";\n\n/** The tools' words, each replaceable. */\nexport interface CanvasToolsLabels {\n /** The tool group's accessible name: \"Canvas\". */\n toolbar: string;\n zoomIn: string;\n zoomOut: string;\n fit: string;\n tidy: string;\n minimap: string;\n}\n\nexport const defaultCanvasToolsLabels: CanvasToolsLabels = {\n toolbar: \"Canvas\",\n zoomIn: \"Zoom in\",\n zoomOut: \"Zoom out\",\n fit: \"Fit the view\",\n tidy: \"Tidy the layout\",\n minimap: \"Minimap\",\n};\n\n/** The app's own key bindings for the tools, as `aria-keyshortcuts` values: shown, not bound. */\nexport type CanvasToolsShortcuts = Partial<Record<\"zoomIn\" | \"zoomOut\" | \"fit\" | \"tidy\" | \"minimap\", string>>;\n\nexport type CanvasToolsProps<NodeType extends Node = Node> = {\n /** Where the panel sits on the canvas, React Flow's `PanelPosition`: \"bottom-left\" by default. */\n position?: PanelPosition | (string & {});\n /** React Flow's fit options for the fit tool. */\n fitOptions?: FitViewOptions<NodeType>;\n /** Replaces the fit tool's own fit (pass useFollowFit's `fit`, so the tool also resumes following). */\n onFit?: () => void;\n /** The tidy tool, shown only when given: the layout is the app's. */\n onTidy?: () => void;\n /** Whether the minimap is on: the minimap tool is pressed and React Flow's <MiniMap> is drawn. */\n minimap?: boolean;\n /** The minimap tool, shown only when given: called with the state a press asks for. */\n onMinimap?: (next: boolean) => void;\n /** The class of each node's shape in the minimap, so the app colours it by the node's state. */\n minimapNodeClassName?: string | ((node: NodeType) => string);\n keyShortcuts?: CanvasToolsShortcuts;\n /** Words to replace; the rest keep their defaults. */\n labels?: Partial<CanvasToolsLabels>;\n /** Added to the panel's own `pb-canvas-tools` class. */\n className?: string;\n /** More tools (IconButtons) after patchbay's. */\n children?: ReactNode;\n};\n\nconst glyph = (path: string) => (\n <svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <path d={path} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nconst glyphs = {\n zoomIn: glyph(\"M3 8h10M8 3v10\"),\n zoomOut: glyph(\"M3 8h10\"),\n fit: glyph(\"M2 6V2h4M10 2h4v4M14 10v4h-4M6 14H2v-4\"),\n tidy: glyph(\"M2 2h5v5H2zM9 2h5v5H9zM2 9h5v5H2zM9 9h5v5H9z\"),\n minimap: glyph(\"M1.5 3h13v10h-13zM8.5 8h4v3h-4z\"),\n};\n\nexport function CanvasTools<NodeType extends Node = Node>({\n position = \"bottom-left\",\n fitOptions,\n onFit,\n onTidy,\n minimap = false,\n onMinimap,\n minimapNodeClassName,\n keyShortcuts,\n labels,\n className,\n children,\n}: CanvasToolsProps<NodeType>) {\n const words = { ...defaultCanvasToolsLabels, ...labels };\n const flow = useReactFlow<NodeType>();\n const store = useStoreApi<NodeType>();\n const duration = () => slowMotionMs(store.getState().domNode);\n\n const tool = (name: keyof CanvasToolsShortcuts, act: () => void, pressed?: boolean) => {\n const keys = keyShortcuts?.[name];\n return (\n <IconButton\n label={words[name]}\n title={keys === undefined || keys === \"\" ? words[name] : `${words[name]} (${keys})`}\n aria-keyshortcuts={keys === \"\" ? undefined : keys}\n aria-pressed={pressed}\n onClick={act}\n >\n {glyphs[name]}\n </IconButton>\n );\n };\n\n return (\n <>\n <Panel\n position={position as PanelPosition}\n className={className === undefined ? \"pb-canvas-tools\" : `pb-canvas-tools ${className}`}\n >\n <ToolGroup label={words.toolbar}>\n {tool(\"zoomIn\", () => void flow.zoomIn({ duration: duration() }))}\n {tool(\"zoomOut\", () => void flow.zoomOut({ duration: duration() }))}\n {tool(\"fit\", () => {\n if (onFit !== undefined) onFit();\n else void flow.fitView({ ...fitOptions, duration: duration() });\n })}\n {onTidy !== undefined && tool(\"tidy\", onTidy)}\n {onMinimap !== undefined &&\n tool(\n \"minimap\",\n () => {\n onMinimap(!minimap);\n },\n minimap,\n )}\n {children}\n </ToolGroup>\n </Panel>\n {minimap && (\n <MiniMap<NodeType>\n className=\"pb-canvas-minimap\"\n ariaLabel={words.minimap}\n nodeClassName={minimapNodeClassName}\n />\n )}\n </>\n );\n}\n","// Joins the props several hooks give <ReactFlow> (docs/graph.md#mergeflowprops), so each hook's handler still runs\n// when two of them, or the app, handle the same event.\n\ntype UnionToIntersection<U> = (U extends unknown ? (each: U) => void : never) extends (each: infer I) => void\n ? I\n : never;\n\n/** The objects' props together: each handler is every object's handler for that name. */\nexport type MergedFlowProps<T extends readonly (object | undefined)[]> = UnionToIntersection<\n Exclude<T[number], undefined>\n>;\n\ntype Handler = (...args: unknown[]) => unknown;\n\n/**\n * One object of `<ReactFlow>` props from several: a handler given by more than one object calls each in order, and\n * `isValidConnection` accepts only when each accepts (it stops at the first that refuses). Any other prop is the last\n * object's that gives it; `undefined` gives nothing.\n */\nexport function mergeFlowProps<const T extends readonly (object | undefined)[]>(...objects: T): MergedFlowProps<T> {\n const values = new Map<string, unknown>();\n const handlers = new Map<string, Handler[]>();\n for (const object of objects) {\n if (object === undefined) continue;\n for (const [name, value] of Object.entries(object)) {\n if (value === undefined) continue;\n if (typeof value === \"function\") {\n const list = handlers.get(name) ?? [];\n list.push(value as Handler);\n handlers.set(name, list);\n values.delete(name);\n } else {\n values.set(name, value);\n handlers.delete(name);\n }\n }\n }\n const merged: Record<string, unknown> = Object.fromEntries(values);\n for (const [name, list] of handlers) {\n const [only] = list;\n if (list.length === 1 && only !== undefined) merged[name] = only;\n else if (name === \"isValidConnection\")\n merged[name] = (...args: unknown[]) => list.every((each) => each(...args) === true);\n else\n merged[name] = (...args: unknown[]) => {\n for (const each of list) each(...args);\n };\n }\n return merged as MergedFlowProps<T>;\n}\n","// One rule for which ports may be joined (docs/graph.md#useconnecthints), used both for the hints every PortRow shows\n// while a wire is dragged and for React Flow's own check on the drop. The state changes twice per drag, at its start\n// and its end, never per pointer move; each candidate handle's verdict is asked of the rule once per drag and kept.\nimport type { Connection, Edge, OnConnectEnd, OnConnectStart } from \"@xyflow/react\";\nimport { createContext, type ReactNode, useContext, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { PortHint, PortSide } from \"../port-row\";\n\n/** One handle: its node's id and its handle id (`null` for a handle without one). */\nexport type PortRef = { nodeId: string; handleId: string | null };\n\n/**\n * Whether a wire may join `from` (always the output) to `to` (always the input), whichever end the drag began at:\n * `true` accepts, `false` refuses, a string refuses and is the reason.\n */\nexport type CanConnect = (from: PortRef, to: PortRef) => boolean | string;\n\n/** What one handle shows while a wire is dragged, and why when it refuses. */\nexport type PortHintOf = { hint: PortHint; reason?: string };\n\n/** The drag in progress, as `<ConnectHints>` hands it to every `PortRow`; `null` while no wire is dragged. */\nexport type ConnectHintsValue = {\n /** The handle the drag began at, and its side. */\n origin: PortRef & { side: PortSide };\n /** The hint for one handle: `origin`, `ok` or `no` (with its reason) on the other side, `null` on the origin's. */\n hintFor: (port: PortRef, side: PortSide) => PortHintOf;\n} | null;\n\n/** The handlers `useConnectHints` gives `<ReactFlow>`. */\nexport type ConnectHintsFlowProps = {\n onConnectStart: OnConnectStart;\n onConnectEnd: OnConnectEnd;\n isValidConnection: (connection: Edge | Connection) => boolean;\n};\n\nconst ConnectHintsContext = createContext<ConnectHintsValue>(null);\n\n/** Hands a drag's hints to every `PortRow` inside it. */\nexport function ConnectHints({ value, children }: { value: ConnectHintsValue; children?: ReactNode }) {\n return <ConnectHintsContext value={value}>{children}</ConnectHintsContext>;\n}\n\n/** The drag's hints from the nearest `<ConnectHints>`, or `null` outside one or while no wire is dragged. */\nexport function useConnectHintsValue(): ConnectHintsValue {\n return useContext(ConnectHintsContext);\n}\n\nconst verdictKey = (from: PortRef, to: PortRef) => JSON.stringify([from.nodeId, from.handleId, to.nodeId, to.handleId]);\n\nconst samePort = (a: PortRef, b: PortRef) => a.nodeId === b.nodeId && a.handleId === b.handleId;\n\n/**\n * Tracks a wire's drag from React Flow's connect start to its end and judges each candidate handle by `canConnect`.\n * `flowProps` goes to `<ReactFlow>` (through `mergeFlowProps` with others), `value` to `<ConnectHints>`.\n */\nexport function useConnectHints(canConnect: CanConnect): {\n value: ConnectHintsValue;\n flowProps: ConnectHintsFlowProps;\n} {\n const rule = useRef(canConnect);\n useLayoutEffect(() => {\n rule.current = canConnect;\n });\n // The verdicts of the drag in progress, so each candidate is judged once per drag; none outside a drag.\n const verdicts = useRef<Map<string, boolean | string> | null>(null);\n const [origin, setOrigin] = useState<(PortRef & { side: PortSide }) | null>(null);\n\n const judge = useMemo(\n () =>\n (from: PortRef, to: PortRef): boolean | string => {\n const kept = verdicts.current;\n if (kept === null) return rule.current(from, to);\n const key = verdictKey(from, to);\n const known = kept.get(key);\n if (known !== undefined) return known;\n const verdict = rule.current(from, to);\n kept.set(key, verdict);\n return verdict;\n },\n [],\n );\n\n const flowProps = useMemo<ConnectHintsFlowProps>(\n () => ({\n onConnectStart: (_event, { nodeId, handleId, handleType }) => {\n if (nodeId === null) return;\n verdicts.current = new Map();\n setOrigin({ nodeId, handleId, side: handleType === \"target\" ? \"input\" : \"output\" });\n },\n onConnectEnd: () => {\n verdicts.current = null;\n setOrigin(null);\n },\n isValidConnection: (connection) =>\n judge(\n { nodeId: connection.source, handleId: connection.sourceHandle ?? null },\n { nodeId: connection.target, handleId: connection.targetHandle ?? null },\n ) === true,\n }),\n [judge],\n );\n\n const value = useMemo<ConnectHintsValue>(() => {\n if (origin === null) return null;\n return {\n origin,\n hintFor: (port, side) => {\n if (side === origin.side) return { hint: samePort(port, origin) ? \"origin\" : null };\n const at: PortRef = { nodeId: origin.nodeId, handleId: origin.handleId };\n const verdict = side === \"input\" ? judge(at, port) : judge(port, at);\n if (verdict === true) return { hint: \"ok\" };\n return typeof verdict === \"string\" ? { hint: \"no\", reason: verdict } : { hint: \"no\" };\n },\n };\n }, [origin, judge]);\n\n return { value, flowProps };\n}\n","// Keeping the whole graph in view until the person takes the view over (docs/graph.md#usefollowfit). While following,\n// the view fits again when the app's key changes or the canvas changes size, each time once every node is measured;\n// a move the person makes stops it, and fit() fits and follows again. onFitted comes in the frame after each fit lands.\nimport {\n type FitViewOptions,\n type Node,\n type OnMove,\n type ReactFlowState,\n type Viewport,\n useReactFlow,\n useStore,\n useStoreApi,\n} from \"@xyflow/react\";\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { slowMotionMs } from \"../canvas-tools/motion\";\n\nexport type FollowFitOptions<NodeType extends Node = Node> = {\n /** The app's value that changes when nodes are added, removed or laid out; a change fits again while following. */\n key: unknown;\n /** React Flow's fit options, for every fit. */\n fitOptions?: FitViewOptions<NodeType>;\n /** Called with the viewport after each fit has landed, in the frame after the viewport is set. */\n onFitted?: (viewport: Viewport) => void;\n};\n\n/** The props `useFollowFit` gives `<ReactFlow>`. */\nexport type FollowFitFlowProps = { onMoveStart: OnMove };\n\nexport type FollowFit = {\n /** Whether the view fits again on its own: true from the start, false once the person moves the view. */\n following: boolean;\n /** Fits now, moving as the fit tool does, and follows again. */\n fit: () => void;\n flowProps: FollowFitFlowProps;\n};\n\n/** Whether every node React Flow shows has been measured (none counts as all). */\nconst allMeasured = (state: ReactFlowState) => {\n for (const node of state.nodeLookup.values()) {\n if (node.hidden !== true && (node.measured.width === undefined || node.measured.height === undefined)) return false;\n }\n return true;\n};\n\ntype Fitted = { key: unknown; width: number; height: number };\n\nexport function useFollowFit<NodeType extends Node = Node>({\n key,\n fitOptions,\n onFitted,\n}: FollowFitOptions<NodeType>): FollowFit {\n const flow = useReactFlow<NodeType>();\n const store = useStoreApi();\n const width = useStore((state) => state.width);\n const height = useStore((state) => state.height);\n const measured = useStore(allMeasured);\n const [following, setFollowing] = useState(true);\n const latest = useRef({ key, width, height, fitOptions, onFitted });\n useLayoutEffect(() => {\n latest.current = { key, width, height, fitOptions, onFitted };\n });\n // What the last fit was for, so a render that changes none of it does not fit again.\n const fittedFor = useRef<Fitted | null>(null);\n\n const land = useCallback(\n async (duration: number) => {\n // With no node there is nothing to fit, and the view stays; onFitted still says the layout is ready.\n if (store.getState().nodeLookup.size > 0) await flow.fitView({ ...latest.current.fitOptions, duration });\n requestAnimationFrame(() => {\n latest.current.onFitted?.(flow.getViewport());\n });\n },\n [flow, store],\n );\n\n useEffect(() => {\n if (!following || width === 0 || height === 0) return;\n // The store, not this render's `measured`, which only wakes the effect: nodes React Flow took in this commit (its\n // effects run before this one) are in the store but not yet measured, while this render still says all were.\n if (!allMeasured(store.getState())) return;\n const last = fittedFor.current;\n if (last !== null && Object.is(last.key, key) && last.width === width && last.height === height) return;\n fittedFor.current = { key, width, height };\n void land(0);\n }, [following, key, width, height, measured, store, land]);\n\n const fit = useCallback(() => {\n const now = latest.current;\n fittedFor.current = { key: now.key, width: now.width, height: now.height };\n setFollowing(true);\n void land(slowMotionMs(store.getState().domNode));\n }, [land, store]);\n\n const flowProps = useMemo<FollowFitFlowProps>(\n () => ({\n // A move made by code (a fit, a zoom from a tool) has no event; only the person's own move stops following.\n onMoveStart: (event) => {\n if (event !== null) setFollowing(false);\n },\n }),\n [],\n );\n\n return { following, fit, flowProps };\n}\n","// A ghost wire (docs/graph.md#ghostwire): a request on its way, before the app's graph holds the edge. An edge type the\n// app registers as `ghost`; it draws with React Flow's BaseEdge but has no hit path and takes no pointer events, so it\n// can be neither hovered nor clicked. How long a refused one stays is the app's: it removes the edge.\nimport { BaseEdge, type Edge, EdgeLabelRenderer, type EdgeProps, getBezierPath } from \"@xyflow/react\";\nimport { type ReactNode, useMemo } from \"react\";\nimport \"./GhostWire.css\";\n\n/** `pending` (the default) or `refused`; any other string is drawn as `pending`. */\nexport type GhostWireTone = \"pending\" | \"refused\" | (string & {});\n\n/** A ghost wire's look, as React Flow's edge `data`. */\nexport type GhostWireData = {\n /** `pending` (dashed in the quiet tone, dimmed) or `refused` (the error tone). */\n tone?: GhostWireTone;\n /** At the midpoint, on the raised surface; it takes no pointer events. */\n label?: ReactNode;\n};\n\n/** An edge drawn by `GhostWire`: register it as `edgeTypes={{ ghost: GhostWire }}`. */\nexport type GhostWireEdge = Edge<GhostWireData, \"ghost\">;\n\n/** Draws a request's wire between two handles while it is on its way. */\nexport function GhostWire({\n id,\n sourceX,\n sourceY,\n targetX,\n targetY,\n sourcePosition,\n targetPosition,\n data,\n}: EdgeProps<GhostWireEdge>) {\n const [path, labelX, labelY] = useMemo(\n () => getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition }),\n [sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition],\n );\n const tone = data?.tone === \"refused\" ? \"refused\" : \"pending\";\n const label = data?.label;\n return (\n <>\n <g className=\"pb-ghost-wire\" data-tone={tone} aria-hidden=\"true\">\n <BaseEdge id={id} path={path} className=\"pb-ghost-wire-path\" interactionWidth={0} />\n </g>\n {label !== undefined && label !== null && (\n <EdgeLabelRenderer>\n <div\n className=\"pb-ghost-wire-label\"\n data-tone={tone}\n style={{ transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)` }}\n >\n {label}\n </div>\n </EdgeLabelRenderer>\n )}\n </>\n );\n}\n","// A level bar on a decibel scale (docs/graph.md#meter). It is painted through refs and never re-renders through\n// React for a level: useLiveValue hands each new value to paint(), which sets CSS variables and data attributes on\n// the element, and requestAnimationFrame runs only while something moves (a new value, a held tick that will fall, a\n// lit clip lamp counting down). Times come from performance.now(), a monotonic clock.\nimport {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type Ref,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useState,\n} from \"react\";\nimport { type LiveSubscribe, useLiveValue } from \"../../hooks\";\nimport \"./Meter.css\";\n\n/** Which way the bar fills: an open enum, and one it does not know is drawn horizontal. */\nexport type MeterOrientation = \"horizontal\" | \"vertical\" | (string & {});\n\n/** Writes the tooltip from the current peak and RMS in dBFS (`-Infinity` for silence) and whether the lamp is lit. */\nexport type MeterTitle = (peakDb: number, rmsDb: number, clipped: boolean) => string;\n\n/** What a parent can do to a meter through its `ref`. */\nexport type MeterHandle = {\n /** Empties the bar and clears the held peak and the clip lamp, as when the source closes. */\n reset(): void;\n};\n\nexport type MeterProps = Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"title\" | \"role\"> & {\n /** Adds a listener that means a new value is ready to read; returns what removes it. */\n subscribe: LiveSubscribe;\n /** The current `[peak, rms]` as linear amplitude, 1.0 being 0 dBFS. Not a number, or 0 and below, is silence. */\n read: () => readonly [peak: number, rms: number];\n /** `horizontal` (the default) or `vertical`. */\n orientation?: MeterOrientation;\n /** dBFS at the bar's empty end; the full end is 0 dBFS. -60 by default. */\n floor?: number;\n /** `[mid, hot]` in dBFS, where the bar turns from `--pb-meter-low` to `--pb-meter-mid` and to `--pb-meter-hot`. */\n zones?: readonly [mid: number, hot: number];\n /** How long the peak tick holds the highest peak, in ms. 1500 by default. */\n holdMs?: number;\n /** How fast the tick then falls toward the current peak, in dB a second. 20 by default. */\n fallDbPerS?: number;\n /** A peak at or above this linear amplitude lights the clip lamp. 1.0 (0 dBFS) by default. */\n clipAt?: number;\n /** How long the lamp stays lit after the last such peak, in ms. 2000 by default. */\n clipHoldMs?: number;\n /** The accessible name (\"Level\" by default); the numbers are never announced. */\n label?: string;\n /** Words to replace; the rest keep their defaults. */\n labels?: Partial<MeterLabels>;\n /** `reset()`, for when the source closes. */\n ref?: Ref<MeterHandle>;\n};\n\n/** The scale's defaults, each a prop. */\nexport const defaultMeterScale = {\n floor: -60,\n zones: [-18, -6] as const,\n holdMs: 1500,\n fallDbPerS: 20,\n clipAt: 1,\n clipHoldMs: 2000,\n} as const;\n\n/** How often, at most, the tooltip is refreshed while the pointer is over the meter, in ms. */\nexport const meterTitleEveryMs = 250;\n\n/** A linear amplitude in dBFS; not a number, or 0 and below, is silence (`-Infinity`). */\nexport function toDb(linear: number): number {\n return Number.isFinite(linear) && linear > 0 ? 20 * Math.log10(linear) : linear === Infinity ? Infinity : -Infinity;\n}\n\n/** Where a level in dBFS sits on a bar from `floor` (0) to 0 dBFS (1), clamped. */\nexport function meterFraction(db: number, floor: number): number {\n if (Number.isNaN(db) || floor >= 0) return 0;\n return Math.min(1, Math.max(0, (db - floor) / -floor));\n}\n\nconst formatDb = (db: number) => (db === -Infinity ? \"−∞\" : db.toFixed(1));\n\n/** The English tooltip: \"peak -12.0 dB, rms -18.3 dB\", with −∞ for silence. */\nexport const defaultMeterTitle: MeterTitle = (peakDb, rmsDb) =>\n `peak ${formatDb(peakDb)} dB, rms ${formatDb(rmsDb)} dB`;\n\n/** The meter's own words, each replaceable. */\nexport interface MeterLabels {\n /** Writes the tooltip from the level: `defaultMeterTitle`, \"peak -12.0 dB, rms -18.3 dB\". */\n title: MeterTitle;\n}\n\nexport const defaultMeterLabels: MeterLabels = {\n title: defaultMeterTitle,\n};\n\ntype Level = {\n peakDb: number;\n rmsDb: number;\n /** The tick's level when it was last set, and when; it holds, then falls from there. */\n heldDb: number;\n heldAt: number;\n /** When the last peak at or above `clipAt` came, or -Infinity. */\n clippedAt: number;\n};\n\ntype Scale = Required<Pick<MeterProps, \"floor\" | \"holdMs\" | \"fallDbPerS\" | \"clipAt\" | \"clipHoldMs\">> & MeterLabels;\n\nconst silent = (): Level => ({\n peakDb: -Infinity,\n rmsDb: -Infinity,\n heldDb: -Infinity,\n heldAt: -Infinity,\n clippedAt: -Infinity,\n});\n\n/**\n * The meter's moving parts outside React: the level, the held tick and the lamp, the frame loop and the tooltip.\n * One is made per mounted meter; it paints into whatever element `attach` gave it.\n */\nfunction createPainter(initial: Scale) {\n let element: HTMLElement | null = null;\n let scale = initial;\n let level = silent();\n let frame: number | undefined;\n let hovered = false;\n let titledAt = -Infinity;\n /** A level came since the tooltip was last written. */\n let stale = false;\n\n /** The tick's level at `now`: the held peak, then falling at the set rate, never below the current peak. */\n const tickAt = (now: number) => {\n const falling = Math.max(0, now - level.heldAt - scale.holdMs);\n const fallen = falling === 0 ? level.heldDb : level.heldDb - (Math.max(0, scale.fallDbPerS) * falling) / 1000;\n return Math.max(level.peakDb, fallen);\n };\n\n const writeTitle = (now: number) => {\n if (element === null) return;\n const clipped = now - level.clippedAt < scale.clipHoldMs;\n element.title = scale.title(level.peakDb, level.rmsDb, clipped);\n titledAt = now;\n stale = false;\n };\n\n /** Draws the level at `now`; says whether anything will still move. */\n const paint = (now: number) => {\n if (element === null) return false;\n const tick = tickAt(now);\n const lit = now - level.clippedAt < scale.clipHoldMs;\n element.style.setProperty(\"--pb-meter-level\", String(meterFraction(level.rmsDb, scale.floor)));\n element.style.setProperty(\"--pb-meter-tick\", String(meterFraction(tick, scale.floor)));\n element.dataset[\"peak\"] = tick > scale.floor ? \"shown\" : \"hidden\";\n element.dataset[\"clipped\"] = String(lit);\n if (hovered && now - titledAt >= meterTitleEveryMs) writeTitle(now);\n // Still moving while the tick is above the current peak and the floor (held, or falling), or the lamp is lit; and,\n // while hovered, until the tooltip has caught up with the last level.\n return (tick > level.peakDb && tick > scale.floor) || lit || (hovered && stale);\n };\n\n const run = () => {\n frame = undefined;\n if (paint(performance.now())) frame = requestAnimationFrame(run);\n };\n\n const wake = () => {\n if (frame === undefined && element !== null) frame = requestAnimationFrame(run);\n };\n\n const stop = () => {\n if (frame !== undefined) cancelAnimationFrame(frame);\n frame = undefined;\n };\n\n return {\n attach(next: HTMLElement | null) {\n element = next;\n if (next === null) stop();\n else wake();\n },\n setScale(next: Scale) {\n const moved =\n next.floor !== scale.floor ||\n next.holdMs !== scale.holdMs ||\n next.fallDbPerS !== scale.fallDbPerS ||\n next.clipHoldMs !== scale.clipHoldMs;\n scale = next;\n if (moved) wake();\n },\n take: ([peak, rms]: readonly [number, number]) => {\n const now = performance.now();\n const peakDb = toDb(peak);\n const tick = tickAt(now);\n level.peakDb = peakDb;\n level.rmsDb = toDb(rms);\n if (peakDb >= tick) {\n level.heldDb = peakDb;\n level.heldAt = now;\n }\n if (peak >= scale.clipAt) level.clippedAt = now;\n stale = true;\n wake();\n },\n reset: () => {\n level = silent();\n stop();\n const now = performance.now();\n paint(now);\n if (hovered) writeTitle(now);\n },\n hover(on: boolean) {\n hovered = on;\n if (on) writeTitle(performance.now());\n },\n };\n}\n\nexport function Meter({\n subscribe,\n read,\n orientation = \"horizontal\",\n floor = defaultMeterScale.floor,\n zones = defaultMeterScale.zones,\n holdMs = defaultMeterScale.holdMs,\n fallDbPerS = defaultMeterScale.fallDbPerS,\n clipAt = defaultMeterScale.clipAt,\n clipHoldMs = defaultMeterScale.clipHoldMs,\n label = \"Level\",\n labels,\n ref,\n className,\n style,\n onPointerEnter,\n onPointerLeave,\n ...rest\n}: MeterProps) {\n const { title } = { ...defaultMeterLabels, ...labels };\n const [painter] = useState(() => createPainter({ floor, holdMs, fallDbPerS, clipAt, clipHoldMs, title }));\n // Every render hands the painter the scale and words; a new scale redraws the level on it.\n useLayoutEffect(() => {\n painter.setScale({ floor, holdMs, fallDbPerS, clipAt, clipHoldMs, title });\n });\n const attach = useCallback(\n (element: HTMLDivElement | null) => {\n painter.attach(element);\n },\n [painter],\n );\n useLiveValue(subscribe, read, painter.take);\n useImperativeHandle(ref, () => ({ reset: painter.reset }), [painter]);\n\n const [mid, hot] = zones;\n const classes = className === undefined ? \"pb-meter\" : `pb-meter ${className}`;\n const zoneStyle = {\n ...style,\n \"--pb-meter-mid-at\": String(meterFraction(mid, floor)),\n \"--pb-meter-hot-at\": String(meterFraction(hot, floor)),\n } as CSSProperties;\n\n return (\n <div\n {...rest}\n ref={attach}\n className={classes}\n role=\"img\"\n aria-label={label}\n data-orientation={orientation}\n data-peak=\"hidden\"\n data-clipped=\"false\"\n style={zoneStyle}\n onPointerEnter={(event) => {\n painter.hover(true);\n onPointerEnter?.(event);\n }}\n onPointerLeave={(event) => {\n painter.hover(false);\n onPointerLeave?.(event);\n }}\n >\n <span className=\"pb-meter-track\" aria-hidden=\"true\">\n <span className=\"pb-meter-bar\" />\n <span className=\"pb-meter-peak\" />\n </span>\n <span className=\"pb-meter-lamp\" aria-hidden=\"true\" />\n </div>\n );\n}\n","// One port of a node (docs/graph.md#portrow): its React Flow handle at the box's edge and its words. NodeBox draws its\n// rows with it; an app drawing a box of its own may use it alone, inside a React Flow node. React Flow's own handle\n// classes stay on the handle, so its connection logic and connectionRadius work as on any handle.\nimport { Handle, Position, useNodeId } from \"@xyflow/react\";\nimport type { ReactNode } from \"react\";\nimport { WarnMark } from \"../../primitives\";\nimport { useConnectHintsValue } from \"../connect-hints/useConnectHints\";\nimport \"./PortRow.css\";\n\n/** Which side of the box a port is on: an input is a target handle on the left edge, an output a source on the right. */\nexport type PortSide = \"input\" | \"output\";\n\n/**\n * What a port shows while a wire is dragged: `origin` the handle the drag began at, `ok` a handle that accepts it,\n * `no` one that refuses it, `null` no drag. An open enum; one it does not know is drawn as `null`.\n */\nexport type PortHint = \"ok\" | \"no\" | \"origin\" | null | (string & {});\n\nexport type PortRowProps = {\n /** The handle id, passed to React Flow's `<Handle id>` unchanged (the app's own scheme). */\n id: string;\n /** `input` (a target handle on the left edge) or `output` (a source handle on the right edge). */\n side: PortSide;\n /** The port's name; a string is also its tooltip. */\n label: ReactNode;\n /** After the label in the muted code face: the port's type. */\n typeLabel?: ReactNode;\n /** While a wire is dragged: `origin`, `ok`, `no`, or `null` for no drag. Given, it wins over `<ConnectHints>`'. */\n hint?: PortHint;\n /** Why the port refuses the wire: the handle's and the row's tooltip while `hint` is `no`. */\n reason?: string;\n /** A problem with the port: a warning mark beside the label, with these as its words. */\n problem?: string;\n /** A slot at the row's inner end, toward the box's centre (a `Meter`). */\n trailing?: ReactNode;\n /** Whether a wire may start or end here; true by default (`<Handle isConnectable>`). */\n connectable?: boolean;\n};\n\nconst knownHints: readonly string[] = [\"ok\", \"no\", \"origin\"];\n\n/** Draws one port: its handle at the edge, its label and type, a problem's mark and a trailing slot. */\nexport function PortRow({\n id,\n side,\n label,\n typeLabel,\n hint: ownHint,\n reason: ownReason,\n problem,\n trailing,\n connectable = true,\n}: PortRowProps) {\n const isInput = side !== \"output\";\n const drag = useConnectHintsValue();\n const nodeId = useNodeId();\n // A hint given as a prop wins; otherwise the drag in progress says, judged once per drag for this handle.\n const fromDrag =\n ownHint === undefined && drag !== null && nodeId !== null\n ? drag.hintFor({ nodeId, handleId: id }, isInput ? \"input\" : \"output\")\n : undefined;\n const hint = fromDrag === undefined ? (ownHint ?? null) : fromDrag.hint;\n const reason = fromDrag === undefined ? ownReason : (fromDrag.reason ?? ownReason);\n const shown = hint !== null && knownHints.includes(hint) ? hint : undefined;\n const refused = shown === \"no\" && reason !== undefined ? reason : undefined;\n return (\n <div\n className=\"pb-port-row\"\n data-side={isInput ? \"input\" : \"output\"}\n data-hint={shown}\n title={refused ?? (typeof label === \"string\" ? label : undefined)}\n >\n <Handle\n id={id}\n type={isInput ? \"target\" : \"source\"}\n position={isInput ? Position.Left : Position.Right}\n isConnectable={connectable}\n className=\"pb-port-handle\"\n data-hint={shown}\n title={refused}\n />\n <span className=\"pb-port-words\">\n <span className=\"pb-port-label\">{label}</span>\n {typeLabel !== undefined && <code className=\"pb-port-type\">{typeLabel}</code>}\n {problem !== undefined && <WarnMark label={problem} title={problem} />}\n </span>\n {trailing !== undefined && <span className=\"pb-port-trailing\">{trailing}</span>}\n </div>\n );\n}\n","// A node's box (docs/graph.md#nodebox): the body of an app's own React Flow node type, a header (title, subtitle, a\n// change's badge and a status slot), a line saying why the node is silent, its ports as PortRows, and a footer. Its\n// sizes come from the --pb-node-* tokens, the same values as the geometry constants an app lays its nodes out with\n// (nodeBoxSize), so a rendered box is the size the layout made room for.\nimport { useNodeId, useUpdateNodeInternals } from \"@xyflow/react\";\nimport { type ComponentPropsWithoutRef, type CSSProperties, type ReactNode, useEffect, useId, useRef } from \"react\";\nimport { Badge } from \"../../primitives\";\nimport { PortRow, type PortRowProps } from \"../port-row\";\nimport type { NodePorts } from \"./geometry\";\nimport \"./NodeBox.css\";\n\n/** A box's stripe down its start edge: an open enum, and one it does not know is drawn in `--pb-line-strong`. */\nexport type NodeBoxTone = \"ok\" | \"warn\" | \"err\" | \"quiet\" | \"off\" | \"accent\" | \"muted\" | (string & {});\n\n/** An edit not yet applied: an open enum, and one it does not know is a plain border with its own string as the word. */\nexport type NodeBoxChange = \"added\" | \"removed\" | \"renamed\" | \"changed\" | (string & {});\n\n/** The box's own words, each replaceable: the change badge's word for each known change. */\nexport interface NodeBoxLabels {\n added: string;\n removed: string;\n renamed: string;\n changed: string;\n}\n\nexport const defaultNodeBoxLabels: NodeBoxLabels = {\n added: \"added\",\n removed: \"removed\",\n renamed: \"renamed\",\n changed: \"changed\",\n};\n\n/** One port of a box: a `PortRow`'s props without `side`, which `NodeBox` sets. */\nexport type PortSpec = Omit<PortRowProps, \"side\">;\n\nexport type NodeBoxProps = Omit<ComponentPropsWithoutRef<\"div\">, \"title\" | \"children\" | \"role\"> & {\n /** The node's name, one line cut with an ellipsis; a string is also the header's tooltip. Names the box's group. */\n title: ReactNode;\n /** The second header line, muted: the node's type. */\n subtitle?: ReactNode;\n /** The stripe down the box's start edge, in the tone's colour; none, or one it does not know, in `--pb-line-strong`. */\n tone?: NodeBoxTone;\n /** A dashed border, the stripe hatched and the words muted. Drawing only: whether its ports connect is the app's. */\n disabled?: boolean;\n /** The border in `--pb-err` and the header on `--pb-err-soft`; the reason goes in `line`. */\n failed?: boolean;\n /** An edit not yet applied: a 2 px border in its tone and a badge with its word; `removed` strikes the title. */\n change?: NodeBoxChange;\n /** Words to replace; the rest keep their defaults. */\n labels?: Partial<NodeBoxLabels>;\n /** A slot at the header's end (a `Pill`). */\n status?: ReactNode;\n /** One row under the header saying why the node is silent; a string is also its tooltip. */\n line?: ReactNode;\n /** The input ports, keyed by `id`. */\n inputs?: readonly PortSpec[];\n /** The output ports, keyed by `id`. */\n outputs?: readonly PortSpec[];\n /** `stacked` (the default: the inputs' rows, then the outputs') or `side-by-side` (two columns). */\n ports?: NodePorts;\n /** A slot: one row at the foot (badges). */\n footer?: ReactNode;\n /** Selected, from React Flow's `NodeProps`: a 2 px outline in the accent. */\n selected?: boolean;\n /** Its width in px; `NODE_WIDTH` by default. */\n width?: number;\n};\n\nconst knownChanges: readonly string[] = [\"added\", \"removed\", \"renamed\", \"changed\"];\n\n/** Draws a node's box; render it inside a React Flow node. */\nexport function NodeBox({\n title,\n subtitle,\n tone,\n disabled = false,\n failed = false,\n change,\n labels,\n status,\n line,\n inputs = [],\n outputs = [],\n ports = \"stacked\",\n footer,\n selected = false,\n width,\n className,\n style,\n ...rest\n}: NodeBoxProps) {\n const titleId = useId();\n const layout = ports === \"side-by-side\" ? \"side-by-side\" : \"stacked\";\n usePortsMeasured(inputs, outputs, layout);\n\n const words = { ...defaultNodeBoxLabels, ...labels };\n const changeWord =\n change === undefined ? undefined : knownChanges.includes(change) ? words[change as keyof NodeBoxLabels] : change;\n const hasPorts = inputs.length > 0 || outputs.length > 0;\n const inputRows = inputs.map((port) => <PortRow key={port.id} {...port} side=\"input\" />);\n const outputRows = outputs.map((port) => <PortRow key={port.id} {...port} side=\"output\" />);\n\n return (\n <div\n {...rest}\n className={className === undefined ? \"pb-node-box\" : `pb-node-box ${className}`}\n role=\"group\"\n aria-labelledby={titleId}\n data-tone={tone}\n data-change={change}\n data-disabled={disabled ? \"\" : undefined}\n data-failed={failed ? \"\" : undefined}\n data-selected={selected ? \"\" : undefined}\n style={width === undefined ? style : ({ ...style, width: `${width}px` } satisfies CSSProperties)}\n >\n <div className=\"pb-node-header\">\n <div className=\"pb-node-heading\">\n <span id={titleId} className=\"pb-node-title\" title={typeof title === \"string\" ? title : undefined}>\n {title}\n </span>\n {subtitle !== undefined && <span className=\"pb-node-subtitle\">{subtitle}</span>}\n </div>\n {changeWord !== undefined && (\n <Badge tone={change ?? \"\"} className=\"pb-node-change\">\n {changeWord}\n </Badge>\n )}\n {status !== undefined && <div className=\"pb-node-status\">{status}</div>}\n </div>\n {line !== undefined && (\n <div className=\"pb-node-line\" title={typeof line === \"string\" ? line : undefined}>\n {line}\n </div>\n )}\n {hasPorts &&\n (layout === \"side-by-side\" ? (\n <div className=\"pb-node-ports\" data-ports=\"side-by-side\">\n <div className=\"pb-node-column\" data-side=\"input\">\n {inputRows}\n </div>\n <div className=\"pb-node-column\" data-side=\"output\">\n {outputRows}\n </div>\n </div>\n ) : (\n <div className=\"pb-node-ports\" data-ports=\"stacked\">\n {inputRows}\n {outputRows}\n </div>\n ))}\n {footer !== undefined && <div className=\"pb-node-footer\">{footer}</div>}\n </div>\n );\n}\n\n/**\n * Asks React Flow to measure the node's handles again when its ordered port ids or their layout change, so a handle\n * added or moved is where a wire meets it. React Flow measures a node's handles itself when the node first renders.\n */\nfunction usePortsMeasured(inputs: readonly PortSpec[], outputs: readonly PortSpec[], layout: string) {\n const nodeId = useNodeId();\n const updateNodeInternals = useUpdateNodeInternals();\n const key = JSON.stringify([layout, inputs.map((port) => port.id), outputs.map((port) => port.id)]);\n const measured = useRef(key);\n useEffect(() => {\n if (measured.current === key) return;\n measured.current = key;\n if (nodeId !== null) updateNodeInternals(nodeId);\n }, [key, nodeId, updateNodeInternals]);\n}\n","// A node box's geometry (docs/graph.md#geometry). An app sizes its nodes before they render (dagre and ELK take\n// sizes), so the sizes are fixed: these constants are what layout code reads, and tokens.css holds the same values as\n// --pb-node-* tokens, which NodeBox and PortRow size themselves from. geometry.test.ts holds each token equal to its\n// constant, and tokens.test.ts fails on a brand that sets one.\n\n/** The default width of a node box, in px; `NodeBox`'s `width` overrides it per node (`--pb-node-width`). */\nexport const NODE_WIDTH = 240;\n/** The header (title and subtitle), with or without a subtitle, in px (`--pb-node-header`). */\nexport const NODE_HEADER = 46;\n/** The `line` row, when there is one, in px (`--pb-node-line`). */\nexport const NODE_LINE = 22;\n/** One port row, in px (`--pb-node-row`). */\nexport const NODE_ROW = 22;\n/** The space above the first port row and below the last, in px (`--pb-node-pad`). */\nexport const NODE_PAD = 8;\n/** The footer, when there is one, in px (`--pb-node-footer`). */\nexport const NODE_FOOTER = 28;\n/** A handle's dot, in px (`--pb-node-handle`). */\nexport const HANDLE_SIZE = 10;\n/** A handle's hit area, centred on the dot, in px (`--pb-node-handle-hit`); 32 px on a touch screen. */\nexport const HANDLE_HIT = 20;\n\n/**\n * How a node box lays out its ports: `stacked` (the inputs' rows, then the outputs') or `side-by-side` (two columns,\n * row n of each on one line). An open enum; one it does not know is stacked.\n */\nexport type NodePorts = \"stacked\" | \"side-by-side\" | (string & {});\n\n/** What decides a node box's size: its port counts, their layout, and whether it has a line and a footer. */\nexport type NodeBoxShape = {\n /** How many input ports. */\n inputs: number;\n /** How many output ports. */\n outputs: number;\n /** How the ports are laid out. */\n ports: NodePorts;\n /** Whether it has a `line` row. */\n line: boolean;\n /** Whether it has a footer. */\n footer: boolean;\n /** Its width in px; `NODE_WIDTH` by default. */\n width?: number;\n};\n\n/** How many port rows a box draws: inputs plus outputs stacked, the larger of the two side by side. */\nexport function nodePortRows(inputs: number, outputs: number, ports: NodePorts): number {\n return ports === \"side-by-side\" ? Math.max(inputs, outputs) : inputs + outputs;\n}\n\n/**\n * A node box's size in px, the one formula layout code sizes nodes with: the header, the line when there is one, the\n * port rows and the padding above and below them when there are ports, and the footer when there is one. The box's\n * 1 px border is inside it; the selection ring is outside.\n */\nexport function nodeBoxSize({ inputs, outputs, ports, line, footer, width = NODE_WIDTH }: NodeBoxShape): {\n width: number;\n height: number;\n} {\n const rows = nodePortRows(Math.max(0, inputs), Math.max(0, outputs), ports);\n const height =\n NODE_HEADER + (line ? NODE_LINE : 0) + (rows > 0 ? 2 * NODE_PAD + rows * NODE_ROW : 0) + (footer ? NODE_FOOTER : 0);\n return { width, height };\n}\n","// A wire (docs/graph.md#wire): an edge type an app registers in edgeTypes, its look from the edge's data. The visible\n// path is React Flow's BaseEdge, so its react-flow__edge-path class and selection stay; the hit path keeps\n// react-flow__edge-interaction and carries the tooltip. The path is rebuilt only when an end moves: the level arrives\n// as --pb-wire-emphasis on the wire's group, so a change of level restyles it without touching the path.\nimport { BaseEdge, type Edge, EdgeLabelRenderer, type EdgeProps, getBezierPath, Position } from \"@xyflow/react\";\nimport { type CSSProperties, memo, type ReactNode, useMemo } from \"react\";\nimport type { PillTone } from \"../../primitives\";\nimport \"./Wire.css\";\n\n/** Pill's tones, the changes, `pending` and `refused`; any other string is drawn in the edge stroke. */\nexport type WireTone = PillTone | \"added\" | \"removed\" | \"changed\" | \"pending\" | \"refused\" | (string & {});\n\n/** A wire's look, as React Flow's edge `data`. */\nexport type WireData = {\n /** The stroke's tone; none, or one it does not know, is React Flow's edge stroke. */\n tone?: WireTone;\n /** The signal's level, 0 to 1 (clamped; not a number is 0): thickness and brightness. None is the plain wire. */\n emphasis?: number;\n /** Dashes: an edit not yet saved. */\n dashed?: boolean;\n /** Dots moving along the wire toward the input; not drawn under reduced motion. */\n flow?: boolean;\n /** An arrowhead at the input end, facing the handle's side. */\n arrow?: boolean;\n /** At the midpoint, on the raised surface; it takes no pointer events. */\n label?: ReactNode;\n /** The wire's tooltip, on its hit path. */\n title?: string;\n};\n\n/** An edge drawn by `Wire`: register it as `edgeTypes={{ wire: Wire }}`. */\nexport type WireEdge = Edge<WireData, \"wire\">;\n\n/** The arrowhead's length along the wire and half its width, in px. */\nconst ARROW_LENGTH = 8;\nconst ARROW_HALF = 4;\n\n/** A level as the wire draws it: 0 to 1, anything not a number 0. */\nfunction emphasisOf(value: unknown): number {\n if (typeof value !== \"number\" || Number.isNaN(value)) return 0;\n return Math.min(1, Math.max(0, value));\n}\n\n/** A triangle with its tip on the handle, pointing into the node from the side the handle is on. */\nfunction arrowPath(x: number, y: number, side: Position): string {\n // The way back from the tip, away from the node.\n const dx = side === Position.Left ? -1 : side === Position.Right ? 1 : 0;\n const dy = side === Position.Top ? -1 : side === Position.Bottom ? 1 : 0;\n const baseX = x + dx * ARROW_LENGTH;\n const baseY = y + dy * ARROW_LENGTH;\n // Perpendicular to the direction, for the base's two corners.\n const px = -dy * ARROW_HALF;\n const py = dx * ARROW_HALF;\n return `M ${x} ${y} L ${baseX + px} ${baseY + py} L ${baseX - px} ${baseY - py} Z`;\n}\n\ntype WireBodyProps = {\n id: string;\n path: string;\n flow: boolean;\n arrow: string | undefined;\n title: string | undefined;\n interactionWidth: number;\n markerStart: string | undefined;\n markerEnd: string | undefined;\n style: CSSProperties | undefined;\n};\n\n/** The paths, which change only when an end, the flow, the arrow or the tooltip does. */\nconst WireBody = memo(function WireBody({\n id,\n path,\n flow,\n arrow,\n title,\n interactionWidth,\n markerStart,\n markerEnd,\n style,\n}: WireBodyProps) {\n return (\n <>\n <BaseEdge\n id={id}\n path={path}\n className=\"pb-wire-path\"\n interactionWidth={0}\n markerStart={markerStart}\n markerEnd={markerEnd}\n style={style}\n />\n {flow && <path d={path} fill=\"none\" className=\"pb-wire-flow\" aria-hidden=\"true\" />}\n {arrow !== undefined && <path d={arrow} className=\"pb-wire-arrow\" aria-hidden=\"true\" />}\n {interactionWidth > 0 && (\n <path\n d={path}\n fill=\"none\"\n strokeOpacity={0}\n strokeWidth={interactionWidth}\n className=\"react-flow__edge-interaction\"\n >\n {title !== undefined && <title>{title}</title>}\n </path>\n )}\n </>\n );\n});\n\n/** Draws a wire between two handles: its tone, level, dashes, flow, arrow, label and tooltip from the edge's data. */\nexport function Wire({\n id,\n sourceX,\n sourceY,\n targetX,\n targetY,\n sourcePosition,\n targetPosition,\n data,\n selected,\n interactionWidth = 20,\n markerStart,\n markerEnd,\n style,\n}: EdgeProps<WireEdge>) {\n const [path, labelX, labelY] = useMemo(\n () => getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition }),\n [sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition],\n );\n const showArrow = data?.arrow === true;\n const arrow = useMemo(\n () => (showArrow ? arrowPath(targetX, targetY, targetPosition) : undefined),\n [showArrow, targetX, targetY, targetPosition],\n );\n const emphasis = data?.emphasis === undefined ? undefined : emphasisOf(data.emphasis);\n const level = emphasis === undefined ? undefined : ({ \"--pb-wire-emphasis\": emphasis } as CSSProperties);\n const label = data?.label;\n return (\n <>\n <g\n className=\"pb-wire\"\n data-tone={data?.tone}\n data-selected={selected === true ? \"\" : undefined}\n data-dashed={data?.dashed === true ? \"\" : undefined}\n data-emphasis={emphasis === undefined ? undefined : \"\"}\n style={level}\n >\n <WireBody\n id={id}\n path={path}\n flow={data?.flow === true}\n arrow={arrow}\n title={data?.title}\n interactionWidth={interactionWidth}\n markerStart={markerStart}\n markerEnd={markerEnd}\n style={style}\n />\n </g>\n {label !== undefined && label !== null && (\n <EdgeLabelRenderer>\n <div\n className=\"pb-wire-label\"\n data-tone={data?.tone}\n style={{ transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)` }}\n >\n {label}\n </div>\n </EdgeLabelRenderer>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;AA4BA,IAAMG,KAAU,MACdC,aAAkB,WAAWA,EAAO,UAAU,SAAS,kBAAkB;AAG3E,SAASC,GAAM,GAAiE;CAC9E,IAAI,oBAAoBC,GAAO;EAC7B,IAAMC,IAAQD,EAAM,eAAe;EACnC,OAAOC,MAAU,KAAA,IAAY,OAAO;GAAE,GAAGA,EAAM;GAAS,GAAGA,EAAM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c,CACrE,GACMsI,IAAYpI,GAAM,UAAU,IAC5BiI,IAAQ3O,QACL8O,IAAYZ,GAAU5H,GAASC,GAASC,CAAc,IAAI,KAAA,GACjE;EAACsI;EAAWxI;EAASC;EAASC;CAAc,CAC9C,GACMuI,IAAWrI,GAAM,aAAa,KAAA,IAAY,KAAA,IAAYuH,GAAWvH,EAAK,QAAQ,GAC9EoB,IAAQiH,MAAa,KAAA,IAAY,KAAA,IAAa,EAAE,sBAAsBA,EAAS,GAC/EpI,IAAQD,GAAM;CACpB,OACE,kBAAA1H,GAAA,EAAA,UAAA,CACE,kBAAC,KAAD;EACE,WAAU;EACV,aAAW0H,GAAM;EACjB,iBAAegG,MAAa,KAAO,KAAK,KAAA;EACxC,eAAahG,GAAM,WAAW,KAAO,KAAK,KAAA;EAC1C,iBAAeqI,MAAa,KAAA,IAAY,KAAA,IAAY;EACpD,OAAOjH;EAEP,UAAA,kBAAC2G,IAAD;GACM;GACE;GACN,MAAM/H,GAAM,SAAS;GACd;GACP,OAAOA,GAAM;GACK;GACL;GACF;GACJ;EACR,CAAA;CACA,CAAA,GACFC,KAAiC,QAChC,kBAACE,GAAD,EAAA,UACE,kBAAC,OAAD;EACE,WAAU;EACV,aAAWH,GAAM;EACjB,OAAO,EAAE,WAAW,mCAAmCV,EAAO,MAAMC,EAAO,KAAK;EAE/E,UAAAU;CACE,CAAA,EACY,CAAA,CAErB,EAAA,CAAA;AAEN"}
@@ -1 +1 @@
1
- .pb-badge{--_pb-badge-ink:var(--pb-muted);--_pb-badge-soft:var(--pb-sunken);box-sizing:border-box;align-items:center;gap:var(--pb-space-2);border-radius:var(--pb-radius-pill);background:var(--_pb-badge-soft);color:var(--_pb-badge-ink);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);white-space:nowrap;border:1px solid;padding:0 6px;font-weight:600;line-height:18px;display:inline-flex}.pb-badge:not([data-variant]){border-color:var(--pb-line)}.pb-badge[data-tone=ok],.pb-badge[data-tone=warn],.pb-badge[data-tone=err],.pb-badge[data-tone=quiet],.pb-badge[data-tone=accent],.pb-badge[data-tone=muted],.pb-badge[data-tone=added],.pb-badge[data-tone=removed],.pb-badge[data-tone=renamed],.pb-badge[data-tone=changed]{border-color:currentColor}.pb-badge[data-tone=ok]{--_pb-badge-ink:var(--pb-ok)}.pb-badge[data-tone=warn]{--_pb-badge-ink:var(--pb-warn);--_pb-badge-soft:var(--pb-warn-soft)}.pb-badge[data-tone=err]{--_pb-badge-ink:var(--pb-err);--_pb-badge-soft:var(--pb-err-soft)}.pb-badge[data-tone=quiet]{--_pb-badge-ink:var(--pb-quiet)}.pb-badge[data-tone=off]{--_pb-badge-ink:var(--pb-off)}.pb-badge[data-tone=accent]{--_pb-badge-ink:var(--pb-accent)}.pb-badge[data-tone=muted]{--_pb-badge-ink:var(--pb-muted)}.pb-badge[data-tone=added]{--_pb-badge-ink:var(--pb-added)}.pb-badge[data-tone=removed]{--_pb-badge-ink:var(--pb-removed)}.pb-badge[data-tone=renamed]{--_pb-badge-ink:var(--pb-renamed)}.pb-badge[data-tone=changed]{--_pb-badge-ink:var(--pb-warn);--_pb-badge-soft:var(--pb-warn-soft)}.pb-badge[data-variant=filled]{border-color:var(--_pb-badge-ink);background:var(--_pb-badge-ink);color:var(--pb-on-strong)}.pb-spinner:not(.pb-spinner-labelled),.pb-spinner-ring{box-sizing:border-box;vertical-align:-.1em;border-radius:var(--pb-radius-pill);width:.8em;height:.8em;animation:pb-spin var(--pb-motion-spin) linear infinite;border:2px solid;border-right-color:#0000;display:inline-block}.pb-spinner-labelled{align-items:center;display:inline-flex}.pb-spinner-label{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@keyframes pb-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.pb-spinner:not(.pb-spinner-labelled),.pb-spinner-ring{animation:none}}.pb-button{justify-content:center;align-items:center;gap:var(--pb-space-2);box-sizing:border-box;min-height:28px;padding:0 var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast), border-color var(--pb-motion-fast), color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;margin:0;line-height:1.2;display:inline-flex;position:relative}.pb-button:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-button:hover:not(:disabled,[aria-busy=true]){background:var(--pb-sunken)}.pb-button[aria-pressed=true]{color:var(--pb-accent);background:var(--pb-sunken)}.pb-button[data-tone=primary]{color:var(--pb-on-strong);background:var(--pb-accent);border-color:var(--pb-accent)}.pb-button[data-tone=primary]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-accent-hover)}.pb-button[data-tone=danger]{color:var(--pb-err)}.pb-button[data-tone=danger]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-err-soft);border-color:var(--pb-err)}.pb-button:disabled{color:var(--pb-muted);background:var(--pb-raised);border-color:var(--pb-line);cursor:default}.pb-button[aria-busy=true]{cursor:progress}.pb-button[data-size=sm]{min-height:var(--pb-row);padding:0 var(--pb-space-2);font-size:var(--pb-text-sm)}.pb-button-content{align-items:center;gap:var(--pb-space-2);display:inline-flex}.pb-button[aria-busy=true]>.pb-button-content{opacity:0}.pb-button>.pb-button-spinner{margin:auto;position:absolute;inset:0}.pb-button-stack{display:inline-grid}.pb-button-stack>.pb-button-content{grid-area:1/1;justify-content:center}.pb-button-stack>[aria-hidden=true]{visibility:hidden}.pb-button-announce{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (hover:none) and (pointer:coarse){.pb-button,.pb-button[data-size=sm]{min-height:36px}}@media (forced-colors:active){.pb-button{border-color:buttontext}.pb-button:disabled{color:graytext;border-color:graytext}}.pb-checkbox{width:16px;height:16px;accent-color:var(--pb-accent);cursor:pointer;flex:none;margin:0}.pb-checkbox:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-checkbox[aria-invalid=true]:not(:focus-visible){outline:1px solid var(--pb-err);outline-offset:1px}.pb-checkbox:disabled{cursor:default}.pb-checkbox-row{align-items:center;gap:var(--pb-space-3);min-height:28px;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);cursor:pointer;-webkit-tap-highlight-color:transparent;display:inline-flex}.pb-checkbox-row[data-disabled]{color:var(--pb-muted);cursor:default}@media (hover:none) and (pointer:coarse){.pb-checkbox{width:20px;height:20px}.pb-checkbox-row{min-height:36px;font-size:16px}}.pb-button.pb-icon-button{background:0 0;border-color:#0000;width:28px;min-width:28px;height:28px;padding:0}.pb-button.pb-icon-button[data-size=sm]{width:var(--pb-row);min-width:var(--pb-row);height:var(--pb-row)}.pb-button.pb-icon-button:hover:not(:disabled,[aria-busy=true]),.pb-button.pb-icon-button[aria-pressed=true]{background:var(--pb-sunken)}.pb-button.pb-icon-button[data-tone=primary]{background:var(--pb-accent);border-color:var(--pb-accent)}.pb-button.pb-icon-button[data-tone=primary]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-accent-hover)}.pb-button.pb-icon-button[data-tone=danger]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-err-soft);border-color:var(--pb-err)}.pb-button.pb-icon-button:disabled{background:0 0;border-color:#0000}.pb-icon-button-glyph{justify-content:center;align-items:center;font-size:1.15em;line-height:1;display:inline-flex}@media (hover:none) and (pointer:coarse){.pb-button.pb-icon-button,.pb-button.pb-icon-button[data-size=sm]{width:36px;min-width:36px;height:36px}}@media (forced-colors:active){.pb-button.pb-icon-button{border-color:#0000}.pb-button.pb-icon-button[aria-pressed=true]{border-color:highlight}}.pb-dialog-scrim{z-index:100;box-sizing:border-box;padding:max(10vh, env(safe-area-inset-top)) max(var(--pb-space-5), env(safe-area-inset-right)) max(var(--pb-space-5), env(safe-area-inset-bottom)) max(var(--pb-space-5), env(safe-area-inset-left));background:var(--pb-scrim);animation:pb-dialog-fade var(--pb-motion-fast) ease-out;justify-content:center;align-items:flex-start;display:flex;position:fixed;inset:0}.pb-dialog{box-sizing:border-box;width:min(520px,100%);max-height:100%;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line);border-radius:var(--pb-radius-box);box-shadow:var(--pb-shadow-lifted);animation:pb-dialog-rise var(--pb-motion-slow) ease-out;flex-direction:column;display:flex}.pb-dialog:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-dialog-head{align-items:center;gap:var(--pb-space-3);padding:var(--pb-space-4) var(--pb-space-4) var(--pb-space-3) var(--pb-space-5);display:flex}.pb-dialog-title{min-width:0;font-size:var(--pb-text-md);flex:auto;margin:0;font-weight:600}.pb-button.pb-dialog-close{color:var(--pb-muted);flex:none}.pb-button.pb-dialog-close:hover{color:var(--pb-text)}.pb-dialog-body{min-height:0;padding:0 var(--pb-space-5) var(--pb-space-5);flex:auto;overflow:auto}.pb-dialog-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}.pb-dialog-actions{justify-content:flex-end;gap:var(--pb-space-3);padding:var(--pb-space-4) var(--pb-space-5);border-top:1px solid var(--pb-line);flex-wrap:wrap;display:flex}@keyframes pb-dialog-fade{0%{opacity:0}}@keyframes pb-dialog-rise{0%{opacity:0;transform:translateY(var(--pb-space-3))}}@media (max-width:599px){.pb-dialog-scrim{padding-top:max(var(--pb-space-5), env(safe-area-inset-top));padding-right:max(var(--pb-space-4), env(safe-area-inset-right));padding-left:max(var(--pb-space-4), env(safe-area-inset-left))}}@media (prefers-reduced-motion:reduce){.pb-dialog-scrim,.pb-dialog{animation:none}}.pb-field{gap:var(--pb-space-2);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);grid-template-columns:minmax(0,1fr);display:grid}.pb-field[data-layout=inline]{column-gap:var(--pb-space-4);grid-template-columns:130px minmax(0,1fr);align-items:baseline}.pb-field-label{color:var(--pb-text)}.pb-field-control{gap:var(--pb-space-2);min-width:0;display:grid}.pb-field-hint{font-size:var(--pb-text-sm);color:var(--pb-muted)}.pb-field-error{font-size:var(--pb-text-sm);color:var(--pb-err)}.pb-key-value{box-sizing:border-box;gap:var(--pb-space-1) var(--pb-space-4);color:var(--pb-text);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);grid-template-columns:max-content minmax(0,1fr);margin:0;display:grid}.pb-key-value-row{display:contents}.pb-key-value dt{color:var(--pb-muted)}.pb-key-value dd{font-variant-numeric:tabular-nums;overflow-wrap:anywhere;min-width:0;margin:0}.pb-key-value-row[data-tone=ok] dd{color:var(--pb-ok)}.pb-key-value-row[data-tone=warn] dd{color:var(--pb-warn)}.pb-key-value-row[data-tone=err] dd{color:var(--pb-err)}.pb-key-value-row[data-tone=quiet] dd{color:var(--pb-quiet)}.pb-key-value-row[data-tone=off] dd{color:var(--pb-off)}.pb-panel{box-sizing:border-box;min-height:0;max-height:100%;color:var(--pb-text);background:var(--pb-raised);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);flex-direction:column;display:flex}.pb-panel-header{align-items:center;gap:var(--pb-space-3);box-sizing:border-box;min-height:var(--pb-bar);padding:var(--pb-space-3) var(--pb-space-4);border-bottom:1px solid var(--pb-line);flex:none;display:flex}.pb-panel-actions{align-items:center;gap:var(--pb-space-2);flex:none;margin-left:auto;display:flex}.pb-panel-title{min-width:0;font-size:var(--pb-text-md);overflow-wrap:anywhere;flex:auto;margin:0;font-weight:600;line-height:1.3}.pb-panel-body{box-sizing:border-box;min-height:0;padding:var(--pb-space-3) var(--pb-space-4);overscroll-behavior:contain;flex:auto;overflow-y:auto}.pb-panel-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}.pb-pill{box-sizing:border-box;align-items:center;gap:var(--pb-space-2);border-radius:var(--pb-radius-pill);background:var(--pb-sunken);color:var(--pb-muted);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);white-space:nowrap;padding:0 7px 0 5px;font-weight:600;line-height:18px;display:inline-flex}.pb-pill-dot{border-radius:var(--pb-radius-pill);background:currentColor;flex:none;width:7px;height:7px}.pb-pill[data-tone=ok]{color:var(--pb-ok)}.pb-pill[data-tone=warn]{color:var(--pb-warn)}.pb-pill[data-tone=err]{color:var(--pb-err)}.pb-pill[data-tone=quiet]{color:var(--pb-quiet)}.pb-pill[data-tone=off]{color:var(--pb-off)}.pb-pill[data-tone=accent]{color:var(--pb-accent)}.pb-pill[data-tone=muted]{color:var(--pb-muted)}.pb-pill-detail{font-family:var(--pb-font-code);font-weight:400}.pb-pill[data-pulse] .pb-pill-dot{animation:pb-pill-pulse var(--pb-motion-pulse) ease-in-out infinite}@keyframes pb-pill-pulse{50%{opacity:.4}}@media (prefers-reduced-motion:reduce){.pb-pill[data-pulse] .pb-pill-dot{animation:none}}@media (forced-colors:active){.pb-pill-dot{forced-color-adjust:none;background:canvastext}}.pb-radio-group{gap:var(--pb-space-2);min-width:0;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);border:0;margin:0;padding:0;display:grid}.pb-radio-group-legend{float:left;width:100%;margin-bottom:var(--pb-space-2);color:var(--pb-text);padding:0}.pb-radio-group-legend[data-hidden]{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;margin:0;position:absolute;overflow:hidden}.pb-radio-group-options{clear:both;flex-direction:column;align-items:flex-start;display:flex}.pb-radio-group[data-layout=inline] .pb-radio-group-options{column-gap:var(--pb-space-5);flex-flow:wrap}.pb-radio-row{align-items:center;gap:var(--pb-space-3);cursor:pointer;-webkit-tap-highlight-color:transparent;min-height:28px;display:inline-flex}.pb-radio-row[data-disabled]{color:var(--pb-muted);cursor:default}.pb-radio{width:16px;height:16px;accent-color:var(--pb-accent);cursor:pointer;flex:none;margin:0}.pb-radio:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-radio-group[aria-invalid=true] .pb-radio:not(:focus-visible){outline:1px solid var(--pb-err);outline-offset:1px}.pb-radio:disabled{cursor:default}.pb-radio-group-hint{font-size:var(--pb-text-sm);color:var(--pb-muted)}.pb-radio-group-error{font-size:var(--pb-text-sm);color:var(--pb-err)}@media (hover:none) and (pointer:coarse){.pb-radio{width:20px;height:20px}.pb-radio-row{min-height:36px;font-size:16px}}.pb-section-title{box-sizing:border-box;align-items:center;gap:var(--pb-space-3);margin:var(--pb-space-3) 0;color:var(--pb-text);font-family:var(--pb-font-ui);display:flex}.pb-section-title-text{min-width:0;font-size:var(--pb-text-md);overflow-wrap:anywhere;flex:auto;margin:0;font-weight:600}.pb-section-title-actions{align-items:center;gap:var(--pb-space-2);flex:none;display:flex}.pb-select{box-sizing:border-box;width:100%;min-height:28px;padding:var(--pb-space-2) var(--pb-space-2);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:border-color var(--pb-motion-fast);margin:0;line-height:1.2}.pb-select[data-font=code]{font-family:var(--pb-font-code)}.pb-select:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-select[aria-invalid=true]{border-color:var(--pb-err)}.pb-select:disabled{color:var(--pb-muted);background:var(--pb-sunken);border-color:var(--pb-line);cursor:default}@media (hover:none) and (pointer:coarse){.pb-select{min-height:36px;font-size:16px}}@media (forced-colors:active){.pb-select{border-color:fieldtext}.pb-select:disabled{border-color:graytext}}.pb-sheet{z-index:10;box-sizing:border-box;width:min(clamp(280px, var(--pb-sheet-width,360px), 560px), calc(100% - 48px));font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border-left:1px solid var(--pb-line);box-shadow:var(--pb-shadow-lifted);animation:pb-sheet-from-right var(--pb-motion-slow) ease-out;flex-direction:column;display:flex;position:absolute;top:0;bottom:0;right:0}.pb-sheet[data-side=bottom]{width:auto;max-height:62%;padding-bottom:env(safe-area-inset-bottom);border-top:1px solid var(--pb-line);border-radius:var(--pb-radius-box) var(--pb-radius-box) 0 0;border-left:none;animation-name:pb-sheet-from-bottom;top:auto;left:0}.pb-sheet-head{align-items:center;gap:var(--pb-space-3);padding:var(--pb-space-3) var(--pb-space-3) var(--pb-space-2) var(--pb-space-4);flex:none;display:flex}.pb-sheet-title{min-width:0;font-size:var(--pb-text-md);flex:auto;margin:0;font-weight:600}.pb-button.pb-sheet-close{color:var(--pb-muted);flex:none}.pb-button.pb-sheet-close:hover{color:var(--pb-text)}.pb-sheet-body{min-height:0;padding:0 var(--pb-space-4) var(--pb-space-3);flex:auto;overflow-y:auto}.pb-sheet-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}@keyframes pb-sheet-from-right{0%{transform:translateX(var(--pb-space-5));opacity:0}}@keyframes pb-sheet-from-bottom{0%{transform:translateY(var(--pb-space-5));opacity:0}}@media (prefers-reduced-motion:reduce){.pb-sheet,.pb-sheet[data-side=bottom]{animation:none}}.pb-splitter{z-index:5;box-sizing:border-box;touch-action:none;transition:background-color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;background:0 0;position:absolute}.pb-splitter[data-orientation=vertical]{cursor:col-resize;width:6px;top:0;bottom:0}.pb-splitter[data-orientation=vertical][data-edge=start]{left:-3px}.pb-splitter[data-orientation=vertical][data-edge=end]{right:-3px}.pb-splitter[data-orientation=horizontal]{cursor:row-resize;height:6px;left:0;right:0}.pb-splitter[data-orientation=horizontal][data-edge=start]{top:-3px}.pb-splitter[data-orientation=horizontal][data-edge=end]{bottom:-3px}.pb-splitter:hover,.pb-splitter:focus-visible,.pb-splitter[data-dragging]{background:var(--pb-accent);outline:none}@media (hover:none) and (pointer:coarse){.pb-splitter:before{content:"";position:absolute}.pb-splitter[data-orientation=vertical]:before{inset:0 -15px}.pb-splitter[data-orientation=horizontal]:before{inset:-15px 0}}@media (forced-colors:active){.pb-splitter:hover,.pb-splitter:focus-visible,.pb-splitter[data-dragging]{background:highlight}}.pb-text-input{box-sizing:border-box;width:100%;min-height:28px;padding:var(--pb-space-2) var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);transition:border-color var(--pb-motion-fast);margin:0;line-height:1.2}.pb-text-input[data-font=code]{font-family:var(--pb-font-code)}.pb-text-input::placeholder{color:var(--pb-muted);opacity:1}.pb-text-input:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-text-input[aria-invalid=true]{border-color:var(--pb-err)}.pb-text-input:disabled,.pb-text-input:read-only{background:var(--pb-sunken)}.pb-text-input:disabled{color:var(--pb-muted);border-color:var(--pb-line);cursor:default}@media (hover:none) and (pointer:coarse){.pb-text-input{min-height:36px;font-size:16px}}@media (forced-colors:active){.pb-text-input{border-color:fieldtext}.pb-text-input:disabled{border-color:graytext}}.pb-theme-switch{align-items:center;gap:var(--pb-space-2);box-sizing:border-box;min-height:28px;padding:0 var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);white-space:nowrap;color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;margin:0;line-height:1.2;display:inline-flex}.pb-theme-switch:hover{background:var(--pb-sunken)}.pb-theme-switch:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-theme-switch-icon{flex:none}@media (max-width:599px){.pb-theme-switch{padding:0 var(--pb-space-2)}.pb-theme-switch-word{display:none}}@media (hover:none) and (pointer:coarse){.pb-theme-switch{justify-content:center;min-width:36px;min-height:36px}}.pb-toolbar{align-items:center;gap:var(--pb-space-2);box-sizing:border-box;flex-wrap:wrap;display:flex}.pb-toolbar[aria-orientation=vertical]{flex-flow:column;align-items:stretch}.pb-toolbar.pb-tool-group{gap:var(--pb-space-1);background:var(--pb-raised);border:1px solid var(--pb-line);border-radius:var(--pb-radius-box);box-shadow:var(--pb-shadow);flex-wrap:nowrap;padding:3px;display:inline-flex}.pb-tool-group button{box-sizing:border-box;width:28px;height:28px;font-family:var(--pb-font-ui);color:var(--pb-text);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast), color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;background:0 0;border:none;justify-content:center;align-items:center;margin:0;padding:0;font-size:15px;line-height:1;display:inline-flex}.pb-tool-group button:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-tool-group button:hover:not(:disabled),.pb-tool-group button[aria-pressed=true]{background:var(--pb-sunken)}.pb-tool-group button[aria-pressed=true]{color:var(--pb-accent)}.pb-tool-group button:disabled{color:var(--pb-muted);cursor:default}@media (hover:none) and (pointer:coarse){.pb-tool-group button,.pb-tool-group .pb-button.pb-icon-button,.pb-tool-group .pb-button.pb-icon-button[data-size=sm]{width:40px;min-width:40px;height:40px}}@media (forced-colors:active){.pb-toolbar.pb-tool-group{border-color:canvastext}.pb-tool-group button[aria-pressed=true]{outline:1px solid highlight}}.pb-warn-mark{box-sizing:border-box;border-radius:var(--pb-radius-pill);background:var(--pb-warn);width:12px;height:12px;color:var(--pb-on-strong);font-family:var(--pb-font-ui);text-align:center;vertical-align:middle;flex:none;font-size:9px;font-weight:700;line-height:12px;display:inline-block}@media (forced-colors:active){.pb-warn-mark{forced-color-adjust:none;color:canvas;background:canvastext}}.pb-warn-mark-text{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}
1
+ .pb-badge{--_pb-badge-ink:var(--pb-muted);--_pb-badge-soft:var(--pb-sunken);box-sizing:border-box;align-items:center;gap:var(--pb-space-2);border-radius:var(--pb-radius-pill);background:var(--_pb-badge-soft);color:var(--_pb-badge-ink);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);white-space:nowrap;border:1px solid;padding:0 6px;font-weight:600;line-height:18px;display:inline-flex}.pb-badge:not([data-variant]){border-color:var(--pb-line)}.pb-badge[data-tone=ok],.pb-badge[data-tone=warn],.pb-badge[data-tone=err],.pb-badge[data-tone=quiet],.pb-badge[data-tone=accent],.pb-badge[data-tone=muted],.pb-badge[data-tone=added],.pb-badge[data-tone=removed],.pb-badge[data-tone=renamed],.pb-badge[data-tone=changed]{border-color:currentColor}.pb-badge[data-tone=ok]{--_pb-badge-ink:var(--pb-ok)}.pb-badge[data-tone=warn]{--_pb-badge-ink:var(--pb-warn);--_pb-badge-soft:var(--pb-warn-soft)}.pb-badge[data-tone=err]{--_pb-badge-ink:var(--pb-err);--_pb-badge-soft:var(--pb-err-soft)}.pb-badge[data-tone=quiet]{--_pb-badge-ink:var(--pb-quiet)}.pb-badge[data-tone=off]{--_pb-badge-ink:var(--pb-off)}.pb-badge[data-tone=accent]{--_pb-badge-ink:var(--pb-accent)}.pb-badge[data-tone=muted]{--_pb-badge-ink:var(--pb-muted)}.pb-badge[data-tone=added]{--_pb-badge-ink:var(--pb-added)}.pb-badge[data-tone=removed]{--_pb-badge-ink:var(--pb-removed)}.pb-badge[data-tone=renamed]{--_pb-badge-ink:var(--pb-renamed)}.pb-badge[data-tone=changed]{--_pb-badge-ink:var(--pb-warn);--_pb-badge-soft:var(--pb-warn-soft)}.pb-badge[data-variant=filled]{border-color:var(--_pb-badge-ink);background:var(--_pb-badge-ink);color:var(--pb-on-strong)}.pb-spinner:not(.pb-spinner-labelled),.pb-spinner-ring{box-sizing:border-box;vertical-align:-.1em;border-radius:var(--pb-radius-pill);width:.8em;height:.8em;animation:pb-spin var(--pb-motion-spin) linear infinite;border:2px solid;border-right-color:#0000;display:inline-block}.pb-spinner-labelled{align-items:center;display:inline-flex}.pb-spinner-label{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@keyframes pb-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.pb-spinner:not(.pb-spinner-labelled),.pb-spinner-ring{animation:none}}.pb-button{justify-content:center;align-items:center;gap:var(--pb-space-2);box-sizing:border-box;min-height:28px;padding:0 var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast), border-color var(--pb-motion-fast), color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;margin:0;line-height:1.2;display:inline-flex;position:relative}.pb-button:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-button:hover:not(:disabled,[aria-busy=true]){background:var(--pb-sunken)}.pb-button[aria-pressed=true]{color:var(--pb-accent);background:var(--pb-sunken)}.pb-button[data-tone=primary]{color:var(--pb-on-strong);background:var(--pb-accent);border-color:var(--pb-accent)}.pb-button[data-tone=primary]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-accent-hover)}.pb-button[data-tone=danger]{color:var(--pb-err)}.pb-button[data-tone=danger]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-err-soft);border-color:var(--pb-err)}.pb-button:disabled{color:var(--pb-muted);background:var(--pb-raised);border-color:var(--pb-line);cursor:default}.pb-button[aria-busy=true]{cursor:progress}.pb-button[data-size=sm]{min-height:var(--pb-row);padding:0 var(--pb-space-2);font-size:var(--pb-text-sm)}.pb-button-content{align-items:center;gap:var(--pb-space-2);display:inline-flex}.pb-button[aria-busy=true]>.pb-button-content{opacity:0}.pb-button>.pb-button-spinner{margin:auto;position:absolute;inset:0}.pb-button-stack{display:inline-grid}.pb-button-stack>.pb-button-content{grid-area:1/1;justify-content:center}.pb-button-stack>[aria-hidden=true]{visibility:hidden}.pb-button-announce{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (hover:none) and (pointer:coarse){.pb-button,.pb-button[data-size=sm]{min-height:36px}}@media (forced-colors:active){.pb-button{border-color:buttontext}.pb-button:disabled{color:graytext;border-color:graytext}}.pb-checkbox{width:16px;height:16px;accent-color:var(--pb-accent);cursor:pointer;flex:none;margin:0}.pb-checkbox:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-checkbox[aria-invalid=true]:not(:focus-visible){outline:1px solid var(--pb-err);outline-offset:1px}.pb-checkbox:disabled{cursor:default}.pb-checkbox-row{align-items:center;gap:var(--pb-space-3);min-height:28px;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);cursor:pointer;-webkit-tap-highlight-color:transparent;display:inline-flex}.pb-checkbox-row[data-disabled]{color:var(--pb-muted);cursor:default}@media (hover:none) and (pointer:coarse){.pb-checkbox{width:20px;height:20px}.pb-checkbox-row{min-height:36px;font-size:16px}}.pb-button.pb-icon-button{background:0 0;border-color:#0000;width:28px;min-width:28px;height:28px;padding:0}.pb-button.pb-icon-button[data-size=sm]{width:var(--pb-row);min-width:var(--pb-row);height:var(--pb-row)}.pb-button.pb-icon-button:hover:not(:disabled,[aria-busy=true]),.pb-button.pb-icon-button[aria-pressed=true]{background:var(--pb-sunken)}.pb-button.pb-icon-button[data-tone=primary]{background:var(--pb-accent);border-color:var(--pb-accent)}.pb-button.pb-icon-button[data-tone=primary]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-accent-hover)}.pb-button.pb-icon-button[data-tone=danger]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-err-soft);border-color:var(--pb-err)}.pb-button.pb-icon-button:disabled{background:0 0;border-color:#0000}.pb-icon-button-glyph{justify-content:center;align-items:center;font-size:1.15em;line-height:1;display:inline-flex}@media (hover:none) and (pointer:coarse){.pb-button.pb-icon-button,.pb-button.pb-icon-button[data-size=sm]{width:36px;min-width:36px;height:36px}}@media (forced-colors:active){.pb-button.pb-icon-button{border-color:#0000}.pb-button.pb-icon-button[aria-pressed=true]{border-color:highlight}}.pb-dialog-scrim{z-index:100;box-sizing:border-box;padding:max(10vh, env(safe-area-inset-top)) max(var(--pb-space-5), env(safe-area-inset-right)) max(var(--pb-space-5), env(safe-area-inset-bottom)) max(var(--pb-space-5), env(safe-area-inset-left));background:var(--pb-scrim);animation:pb-dialog-fade var(--pb-motion-fast) ease-out;justify-content:center;align-items:flex-start;display:flex;position:fixed;inset:0}.pb-dialog{box-sizing:border-box;width:min(520px,100%);max-height:100%;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line);border-radius:var(--pb-radius-box);box-shadow:var(--pb-shadow-lifted);animation:pb-dialog-rise var(--pb-motion-slow) ease-out;flex-direction:column;display:flex}.pb-dialog:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-dialog-head{align-items:center;gap:var(--pb-space-3);padding:var(--pb-space-4) var(--pb-space-4) var(--pb-space-3) var(--pb-space-5);display:flex}.pb-dialog-title{min-width:0;font-size:var(--pb-text-md);flex:auto;margin:0;font-weight:600}.pb-button.pb-dialog-close{color:var(--pb-muted);flex:none}.pb-button.pb-dialog-close:hover{color:var(--pb-text)}.pb-dialog-body{min-height:0;padding:0 var(--pb-space-5) var(--pb-space-5);flex:auto;overflow:auto}.pb-dialog-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}.pb-dialog-actions{justify-content:flex-end;gap:var(--pb-space-3);padding:var(--pb-space-4) var(--pb-space-5);border-top:1px solid var(--pb-line);flex-wrap:wrap;display:flex}@keyframes pb-dialog-fade{0%{opacity:0}}@keyframes pb-dialog-rise{0%{opacity:0;transform:translateY(var(--pb-space-3))}}@media (max-width:599px){.pb-dialog-scrim{padding-top:max(var(--pb-space-5), env(safe-area-inset-top));padding-right:max(var(--pb-space-4), env(safe-area-inset-right));padding-left:max(var(--pb-space-4), env(safe-area-inset-left))}}@media (prefers-reduced-motion:reduce){.pb-dialog-scrim,.pb-dialog{animation:none}}.pb-field{gap:var(--pb-space-2);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);grid-template-columns:minmax(0,1fr);display:grid}.pb-field[data-layout=inline]{column-gap:var(--pb-space-4);grid-template-columns:130px minmax(0,1fr);align-items:baseline}.pb-field-label{color:var(--pb-text)}.pb-field-control{gap:var(--pb-space-2);min-width:0;display:grid}.pb-field-hint{font-size:var(--pb-text-sm);color:var(--pb-muted)}.pb-field-error{font-size:var(--pb-text-sm);color:var(--pb-err)}.pb-key-value{box-sizing:border-box;gap:var(--pb-space-1) var(--pb-space-4);color:var(--pb-text);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);grid-template-columns:max-content minmax(0,1fr);margin:0;display:grid}.pb-key-value-row{display:contents}.pb-key-value dt{color:var(--pb-muted)}.pb-key-value dd{font-variant-numeric:tabular-nums;overflow-wrap:anywhere;min-width:0;margin:0}.pb-key-value-row[data-tone=ok] dd{color:var(--pb-ok)}.pb-key-value-row[data-tone=warn] dd{color:var(--pb-warn)}.pb-key-value-row[data-tone=err] dd{color:var(--pb-err)}.pb-key-value-row[data-tone=quiet] dd{color:var(--pb-quiet)}.pb-key-value-row[data-tone=off] dd{color:var(--pb-off)}.pb-panel{box-sizing:border-box;min-height:0;max-height:100%;color:var(--pb-text);background:var(--pb-raised);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);flex-direction:column;display:flex}.pb-panel-header{align-items:center;gap:var(--pb-space-3);box-sizing:border-box;min-height:var(--pb-bar);padding:var(--pb-space-3) var(--pb-space-4);border-bottom:1px solid var(--pb-line);flex:none;display:flex}.pb-panel-actions{align-items:center;gap:var(--pb-space-2);flex:none;margin-left:auto;display:flex}.pb-panel-title{min-width:0;font-size:var(--pb-text-md);overflow-wrap:anywhere;flex:auto;margin:0;font-weight:600;line-height:1.3}.pb-panel-body{box-sizing:border-box;min-height:0;padding:var(--pb-space-3) var(--pb-space-4);overscroll-behavior:contain;flex:auto;overflow-y:auto}.pb-panel-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}.pb-pill{box-sizing:border-box;align-items:center;gap:var(--pb-space-2);border-radius:var(--pb-radius-pill);background:var(--pb-sunken);color:var(--pb-muted);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);white-space:nowrap;padding:0 7px 0 5px;font-weight:600;line-height:18px;display:inline-flex}.pb-pill-dot{border-radius:var(--pb-radius-pill);background:currentColor;flex:none;width:7px;height:7px}.pb-pill[data-tone=ok]{color:var(--pb-ok)}.pb-pill[data-tone=warn]{color:var(--pb-warn)}.pb-pill[data-tone=err]{color:var(--pb-err)}.pb-pill[data-tone=quiet]{color:var(--pb-quiet)}.pb-pill[data-tone=off]{color:var(--pb-off)}.pb-pill[data-tone=accent]{color:var(--pb-accent)}.pb-pill[data-tone=muted]{color:var(--pb-muted)}.pb-pill-detail{font-family:var(--pb-font-code);font-weight:400}.pb-pill[data-pulse] .pb-pill-dot{animation:pb-pill-pulse var(--pb-motion-pulse) ease-in-out infinite}@keyframes pb-pill-pulse{50%{opacity:.4}}@media (prefers-reduced-motion:reduce){.pb-pill[data-pulse] .pb-pill-dot{animation:none}}@media (forced-colors:active){.pb-pill-dot{forced-color-adjust:none;background:canvastext}}.pb-radio-group{gap:var(--pb-space-2);min-width:0;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);border:0;margin:0;padding:0;display:grid}.pb-radio-group-legend{float:left;width:100%;margin-bottom:var(--pb-space-2);color:var(--pb-text);padding:0}.pb-radio-group-legend[data-hidden]{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;margin:0;position:absolute;overflow:hidden}.pb-radio-group-options{clear:both;flex-direction:column;align-items:flex-start;display:flex}.pb-radio-group[data-layout=inline] .pb-radio-group-options{column-gap:var(--pb-space-5);flex-flow:wrap}.pb-radio-row{align-items:center;gap:var(--pb-space-3);cursor:pointer;-webkit-tap-highlight-color:transparent;min-height:28px;display:inline-flex}.pb-radio-row[data-disabled]{color:var(--pb-muted);cursor:default}.pb-radio{width:16px;height:16px;accent-color:var(--pb-accent);cursor:pointer;flex:none;margin:0}.pb-radio:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-radio-group[aria-invalid=true] .pb-radio:not(:focus-visible){outline:1px solid var(--pb-err);outline-offset:1px}.pb-radio:disabled{cursor:default}.pb-radio-group-hint{font-size:var(--pb-text-sm);color:var(--pb-muted)}.pb-radio-group-error{font-size:var(--pb-text-sm);color:var(--pb-err)}@media (hover:none) and (pointer:coarse){.pb-radio{width:20px;height:20px}.pb-radio-row{min-height:36px;font-size:16px}}.pb-section-title{box-sizing:border-box;align-items:center;gap:var(--pb-space-3);margin:var(--pb-space-3) 0;color:var(--pb-text);font-family:var(--pb-font-ui);display:flex}.pb-section-title-text{min-width:0;font-size:var(--pb-text-md);overflow-wrap:anywhere;flex:auto;margin:0;font-weight:600}.pb-section-title-actions{align-items:center;gap:var(--pb-space-2);flex:none;display:flex}.pb-select{box-sizing:border-box;width:100%;min-height:28px;padding:var(--pb-space-2) var(--pb-space-2);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:border-color var(--pb-motion-fast);margin:0;line-height:1.2}.pb-select[data-font=code]{font-family:var(--pb-font-code)}.pb-select:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-select[aria-invalid=true]{border-color:var(--pb-err)}.pb-select:disabled{color:var(--pb-muted);background:var(--pb-sunken);border-color:var(--pb-line);cursor:default}@media (hover:none) and (pointer:coarse){.pb-select{min-height:36px;font-size:16px}}@media (forced-colors:active){.pb-select{border-color:fieldtext}.pb-select:disabled{border-color:graytext}}.pb-sheet{z-index:10;box-sizing:border-box;width:min(clamp(280px, var(--pb-sheet-width,360px), 560px), calc(100% - 48px));font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border-left:1px solid var(--pb-line);box-shadow:var(--pb-shadow-lifted);animation:pb-sheet-from-right var(--pb-motion-slow) ease-out;flex-direction:column;display:flex;position:absolute;top:0;bottom:0;right:0}.pb-sheet[data-side=bottom]{width:auto;max-height:62%;padding-bottom:env(safe-area-inset-bottom);border-top:1px solid var(--pb-line);border-radius:var(--pb-radius-box) var(--pb-radius-box) 0 0;border-left:none;animation-name:pb-sheet-from-bottom;top:auto;left:0}.pb-sheet-head{align-items:center;gap:var(--pb-space-3);padding:var(--pb-space-3) var(--pb-space-3) var(--pb-space-2) var(--pb-space-4);flex:none;display:flex}.pb-sheet-title{min-width:0;font-size:var(--pb-text-md);flex:auto;margin:0;font-weight:600}.pb-button.pb-sheet-close{color:var(--pb-muted);flex:none}.pb-button.pb-sheet-close:hover{color:var(--pb-text)}.pb-sheet-body{min-height:0;padding:0 var(--pb-space-4) var(--pb-space-3);flex:auto;overflow-y:auto}.pb-sheet-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}@keyframes pb-sheet-from-right{0%{transform:translateX(var(--pb-space-5));opacity:0}}@keyframes pb-sheet-from-bottom{0%{transform:translateY(var(--pb-space-5));opacity:0}}@media (prefers-reduced-motion:reduce){.pb-sheet,.pb-sheet[data-side=bottom]{animation:none}}.pb-splitter{z-index:5;box-sizing:border-box;touch-action:none;transition:background-color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;background:0 0;position:absolute}.pb-splitter[data-orientation=vertical]{cursor:col-resize;width:6px;inset-block:0}.pb-splitter[data-orientation=vertical][data-edge=start]{inset-inline-start:-3px}.pb-splitter[data-orientation=vertical][data-edge=end]{inset-inline-end:-3px}.pb-splitter[data-orientation=horizontal]{cursor:row-resize;height:6px;inset-inline:0}.pb-splitter[data-orientation=horizontal][data-edge=start]{inset-block-start:-3px}.pb-splitter[data-orientation=horizontal][data-edge=end]{inset-block-end:-3px}.pb-splitter:hover,.pb-splitter:focus-visible,.pb-splitter[data-dragging]{background:var(--pb-accent);outline:none}@media (hover:none) and (pointer:coarse){.pb-splitter:before{content:"";position:absolute}.pb-splitter[data-orientation=vertical]:before{inset-block:0;inset-inline:-15px}.pb-splitter[data-orientation=horizontal]:before{inset-block:-15px;inset-inline:0}}@media (forced-colors:active){.pb-splitter:hover,.pb-splitter:focus-visible,.pb-splitter[data-dragging]{background:highlight}}.pb-text-input{box-sizing:border-box;width:100%;min-height:28px;padding:var(--pb-space-2) var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);transition:border-color var(--pb-motion-fast);margin:0;line-height:1.2}.pb-text-input[data-font=code]{font-family:var(--pb-font-code)}.pb-text-input::placeholder{color:var(--pb-muted);opacity:1}.pb-text-input:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-text-input[aria-invalid=true]{border-color:var(--pb-err)}.pb-text-input:disabled,.pb-text-input:read-only{background:var(--pb-sunken)}.pb-text-input:disabled{color:var(--pb-muted);border-color:var(--pb-line);cursor:default}@media (hover:none) and (pointer:coarse){.pb-text-input{min-height:36px;font-size:16px}}@media (forced-colors:active){.pb-text-input{border-color:fieldtext}.pb-text-input:disabled{border-color:graytext}}.pb-theme-switch{align-items:center;gap:var(--pb-space-2);box-sizing:border-box;min-height:28px;padding:0 var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);white-space:nowrap;color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;margin:0;line-height:1.2;display:inline-flex}.pb-theme-switch:hover{background:var(--pb-sunken)}.pb-theme-switch:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-theme-switch-icon{flex:none}@media (max-width:599px){.pb-theme-switch{padding:0 var(--pb-space-2)}.pb-theme-switch-word{display:none}}@media (hover:none) and (pointer:coarse){.pb-theme-switch{justify-content:center;min-width:36px;min-height:36px}}.pb-toolbar{align-items:center;gap:var(--pb-space-2);box-sizing:border-box;flex-wrap:wrap;display:flex}.pb-toolbar[aria-orientation=vertical]{flex-flow:column;align-items:stretch}.pb-toolbar.pb-tool-group{gap:var(--pb-space-1);background:var(--pb-raised);border:1px solid var(--pb-line);border-radius:var(--pb-radius-box);box-shadow:var(--pb-shadow);flex-wrap:nowrap;padding:3px;display:inline-flex}.pb-tool-group button{box-sizing:border-box;width:28px;height:28px;font-family:var(--pb-font-ui);color:var(--pb-text);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast), color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;background:0 0;border:none;justify-content:center;align-items:center;margin:0;padding:0;font-size:15px;line-height:1;display:inline-flex}.pb-tool-group button:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-tool-group button:hover:not(:disabled),.pb-tool-group button[aria-pressed=true]{background:var(--pb-sunken)}.pb-tool-group button[aria-pressed=true]{color:var(--pb-accent)}.pb-tool-group button:disabled{color:var(--pb-muted);cursor:default}@media (hover:none) and (pointer:coarse){.pb-tool-group button,.pb-tool-group .pb-button.pb-icon-button,.pb-tool-group .pb-button.pb-icon-button[data-size=sm]{width:40px;min-width:40px;height:40px}}@media (forced-colors:active){.pb-toolbar.pb-tool-group{border-color:canvastext}.pb-tool-group button[aria-pressed=true]{outline:1px solid highlight}}.pb-warn-mark{box-sizing:border-box;border-radius:var(--pb-radius-pill);background:var(--pb-warn);width:12px;height:12px;color:var(--pb-on-strong);font-family:var(--pb-font-ui);text-align:center;vertical-align:middle;flex:none;font-size:9px;font-weight:700;line-height:12px;display:inline-block}@media (forced-colors:active){.pb-warn-mark{forced-color-adjust:none;color:canvas;background:canvastext}}.pb-warn-mark-text{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}