import { I as VisualGraph, f as Graph } from "../types-BAEQTwK_.mjs"; import { LayoutOptions } from "./index.mjs"; import { ElkNode } from "elkjs/lib/elk-api"; //#region src/layout/elk.d.ts /** Minimal interface an injected ELK instance must satisfy. */ interface ElkLike { layout(graph: ElkNode): Promise; } interface ElkLayoutOptions extends LayoutOptions { /** * ELK algorithm. Common choices: `'layered'` (default), `'mrtree'`, * `'force'`, `'stress'`, `'radial'`, `'rectpacking'`. */ algorithm?: string; /** * Raw ELK layout options, spread onto the root last (override everything). * See https://eclipse.dev/elk/reference/options.html */ layoutOptions?: Record; /** * Injected ELK instance — e.g. one constructed with a web worker factory. * Defaults to `new ELK()` (in-process). */ elk?: ElkLike; } /** * Lay out a graph with ELK (via `elkjs`, an optional peer dependency). * Pure: returns a new {@link VisualGraph} with node positions/sizes, routed * edge `points`, and computed edge label rects (edge `x`/`y`/`width`/`height`). * Hierarchy (`parentId`) and ports are first-class — ELK is the engine of * choice for compound and port-aware graphs. Child node coordinates are * relative to their parent (matching xyflow's convention). * * @example * ```ts * import { getElkLayout } from '@statelyai/graph/layout/elk'; * * const laidOut = await getElkLayout(graph, { * algorithm: 'layered', * measure: (node) => measureText(node.label), * }); * ``` */ declare function getElkLayout(graph: Graph | VisualGraph, options?: ElkLayoutOptions): Promise; //#endregion export { ElkLayoutOptions, ElkLike, getElkLayout };