import { __name, log } from "./chunk-AGHRB4JF.js";
import { common_default, getConfig } from "./chunk-ABZYJK2D.js";
import { interpolateToCurve } from "./chunk-S3R3BYOJ.js";
import { insertCluster, insertNode, labelHelper } from "./chunk-JZLCHNYA.js";
import { insertEdge, insertEdgeLabel, markers_default, positionEdgeLabel } from "./chunk-QXUST7PY.js";
var internalHelpers = {
	common: common_default,
	getConfig,
	insertCluster,
	insertEdge,
	insertEdgeLabel,
	insertMarkers: markers_default,
	insertNode,
	interpolateToCurve,
	labelHelper,
	log,
	positionEdgeLabel
}, layoutAlgorithms = {}, registerLayoutLoaders = /* @__PURE__ */ __name((e) => {
	for (let h of e) layoutAlgorithms[h.name] = h;
}, "registerLayoutLoaders");
(/* @__PURE__ */ __name(() => {
	registerLayoutLoaders([{
		name: "dagre",
		loader: /* @__PURE__ */ __name(async () => await import("./dagre-6UL2VRFP.js"), "loader")
	}, ...[{
		name: "cose-bilkent",
		loader: /* @__PURE__ */ __name(async () => await import("./cose-bilkent-S5V4N54A.js"), "loader")
	}]]);
}, "registerDefaultLayoutLoaders"))();
var render = /* @__PURE__ */ __name(async (e, h) => {
	if (!(e.layoutAlgorithm in layoutAlgorithms)) throw Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);
	let g = layoutAlgorithms[e.layoutAlgorithm];
	return (await g.loader()).render(e, h, internalHelpers, { algorithm: g.algorithm });
}, "render"), getRegisteredLayoutAlgorithm = /* @__PURE__ */ __name((e = "", { fallback: g = "dagre" } = {}) => {
	if (e in layoutAlgorithms) return e;
	if (g in layoutAlgorithms) return log.warn(`Layout algorithm ${e} is not registered. Using ${g} as fallback.`), g;
	throw Error(`Both layout algorithms ${e} and ${g} are not registered.`);
}, "getRegisteredLayoutAlgorithm");
export { getRegisteredLayoutAlgorithm, registerLayoutLoaders, render };
