import { __name, log } from "./chunk-AGHRB4JF.js";
import { evaluate, getConfig2 } from "./chunk-ABZYJK2D.js";
import select_default from "../../../../d3-selection/src/select.js";
import linear_default from "../../../../d3-shape/src/curve/linear.js";
import line_default from "../../../../d3-shape/src/line.js";
import { bumpX, bumpY } from "../../../../d3-shape/src/curve/bump.js";
import basis_default from "../../../../d3-shape/src/curve/basis.js";
import cardinal_default from "../../../../d3-shape/src/curve/cardinal.js";
import catmullRom_default from "../../../../d3-shape/src/curve/catmullRom.js";
import { monotoneX, monotoneY } from "../../../../d3-shape/src/curve/monotone.js";
import natural_default from "../../../../d3-shape/src/curve/natural.js";
import step_default, { stepAfter, stepBefore } from "../../../../d3-shape/src/curve/step.js";
import "../../../../d3/src/index.js";
import { getLineFunctionsWithOffset, markerOffsets, markerOffsets2 } from "./chunk-HN2XXSSU.js";
import { getSubGraphTitleMargins } from "./chunk-CVBHYZKI.js";
import { isLabelStyle, styles2String } from "./chunk-ATLVNIR6.js";
import { utils_default } from "./chunk-S3R3BYOJ.js";
import { createText } from "./chunk-JA3XYJ7Z.js";
import { at } from "../../../../roughjs/bundled/rough.esm.js";
import { createLabel_default } from "./chunk-JZLCHNYA.js";
var addEdgeMarkers = /* @__PURE__ */ __name((e, o, s, c, l, u) => {
	o.arrowTypeStart && addEdgeMarker(e, "start", o.arrowTypeStart, s, c, l, u), o.arrowTypeEnd && addEdgeMarker(e, "end", o.arrowTypeEnd, s, c, l, u);
}, "addEdgeMarkers"), arrowTypesMap = {
	arrow_cross: {
		type: "cross",
		fill: !1
	},
	arrow_point: {
		type: "point",
		fill: !0
	},
	arrow_barb: {
		type: "barb",
		fill: !0
	},
	arrow_circle: {
		type: "circle",
		fill: !1
	},
	aggregation: {
		type: "aggregation",
		fill: !1
	},
	extension: {
		type: "extension",
		fill: !1
	},
	composition: {
		type: "composition",
		fill: !0
	},
	dependency: {
		type: "dependency",
		fill: !0
	},
	lollipop: {
		type: "lollipop",
		fill: !1
	},
	only_one: {
		type: "onlyOne",
		fill: !1
	},
	zero_or_one: {
		type: "zeroOrOne",
		fill: !1
	},
	one_or_more: {
		type: "oneOrMore",
		fill: !1
	},
	zero_or_more: {
		type: "zeroOrMore",
		fill: !1
	},
	requirement_arrow: {
		type: "requirement_arrow",
		fill: !1
	},
	requirement_contains: {
		type: "requirement_contains",
		fill: !1
	}
}, addEdgeMarker = /* @__PURE__ */ __name((e, s, c, l, u, d, f) => {
	let p = arrowTypesMap[c];
	if (!p) {
		log.warn(`Unknown arrow type: ${c}`);
		return;
	}
	let m = `${u}_${d}-${p.type}${s === "start" ? "Start" : "End"}`;
	if (f && f.trim() !== "") {
		let o = `${m}_${f.replace(/[^\dA-Za-z]/g, "_")}`;
		if (!document.getElementById(o)) {
			let e = document.getElementById(m);
			if (e) {
				let s = e.cloneNode(!0);
				s.id = o, s.querySelectorAll("path, circle, line").forEach((e) => {
					e.setAttribute("stroke", f), p.fill && e.setAttribute("fill", f);
				}), e.parentNode?.appendChild(s);
			}
		}
		e.attr(`marker-${s}`, `url(${l}#${o})`);
	} else e.attr(`marker-${s}`, `url(${l}#${m})`);
}, "addEdgeMarker"), edgeLabels = /* @__PURE__ */ new Map(), terminalLabels = /* @__PURE__ */ new Map(), clear = /* @__PURE__ */ __name(() => {
	edgeLabels.clear(), terminalLabels.clear();
}, "clear"), getLabelStyles = /* @__PURE__ */ __name((e) => e ? e.reduce((e, o) => e + ";" + o, "") : "", "getLabelStyles"), insertEdgeLabel = /* @__PURE__ */ __name(async (e, u) => {
	let d = evaluate(getConfig2().flowchart.htmlLabels), { labelStyles: f } = styles2String(u);
	u.labelStyle = f;
	let p = await createText(e, u.label, {
		style: u.labelStyle,
		useHtmlLabels: d,
		addSvgBackground: !0,
		isNode: !1
	});
	log.info("abc82", u, u.labelType);
	let m = e.insert("g").attr("class", "edgeLabel"), h = m.insert("g").attr("class", "label").attr("data-id", u.id);
	h.node().appendChild(p);
	let g = p.getBBox();
	if (d) {
		let e = p.children[0], o = select_default(p);
		g = e.getBoundingClientRect(), o.attr("width", g.width), o.attr("height", g.height);
	}
	h.attr("transform", "translate(" + -g.width / 2 + ", " + -g.height / 2 + ")"), edgeLabels.set(u.id, m), u.width = g.width, u.height = g.height;
	let _;
	if (u.startLabelLeft) {
		let o = await createLabel_default(u.startLabelLeft, getLabelStyles(u.labelStyle)), s = e.insert("g").attr("class", "edgeTerminals"), c = s.insert("g").attr("class", "inner");
		_ = c.node().appendChild(o);
		let l = o.getBBox();
		c.attr("transform", "translate(" + -l.width / 2 + ", " + -l.height / 2 + ")"), terminalLabels.get(u.id) || terminalLabels.set(u.id, {}), terminalLabels.get(u.id).startLeft = s, setTerminalWidth(_, u.startLabelLeft);
	}
	if (u.startLabelRight) {
		let o = await createLabel_default(u.startLabelRight, getLabelStyles(u.labelStyle)), s = e.insert("g").attr("class", "edgeTerminals"), c = s.insert("g").attr("class", "inner");
		_ = s.node().appendChild(o), c.node().appendChild(o);
		let l = o.getBBox();
		c.attr("transform", "translate(" + -l.width / 2 + ", " + -l.height / 2 + ")"), terminalLabels.get(u.id) || terminalLabels.set(u.id, {}), terminalLabels.get(u.id).startRight = s, setTerminalWidth(_, u.startLabelRight);
	}
	if (u.endLabelLeft) {
		let o = await createLabel_default(u.endLabelLeft, getLabelStyles(u.labelStyle)), s = e.insert("g").attr("class", "edgeTerminals"), c = s.insert("g").attr("class", "inner");
		_ = c.node().appendChild(o);
		let l = o.getBBox();
		c.attr("transform", "translate(" + -l.width / 2 + ", " + -l.height / 2 + ")"), s.node().appendChild(o), terminalLabels.get(u.id) || terminalLabels.set(u.id, {}), terminalLabels.get(u.id).endLeft = s, setTerminalWidth(_, u.endLabelLeft);
	}
	if (u.endLabelRight) {
		let o = await createLabel_default(u.endLabelRight, getLabelStyles(u.labelStyle)), s = e.insert("g").attr("class", "edgeTerminals"), c = s.insert("g").attr("class", "inner");
		_ = c.node().appendChild(o);
		let l = o.getBBox();
		c.attr("transform", "translate(" + -l.width / 2 + ", " + -l.height / 2 + ")"), s.node().appendChild(o), terminalLabels.get(u.id) || terminalLabels.set(u.id, {}), terminalLabels.get(u.id).endRight = s, setTerminalWidth(_, u.endLabelRight);
	}
	return p;
}, "insertEdgeLabel");
function setTerminalWidth(e, o) {
	getConfig2().flowchart.htmlLabels && e && (e.style.width = o.length * 9 + "px", e.style.height = "12px");
}
__name(setTerminalWidth, "setTerminalWidth");
var positionEdgeLabel = /* @__PURE__ */ __name((e, s) => {
	log.debug("Moving label abc88 ", e.id, e.label, edgeLabels.get(e.id), s);
	let l = s.updatedPath ? s.updatedPath : s.originalPath, { subGraphTitleTotalMargin: u } = getSubGraphTitleMargins(getConfig2());
	if (e.label) {
		let c = edgeLabels.get(e.id), d = e.x, f = e.y;
		if (l) {
			let c = utils_default.calcLabelPosition(l);
			log.debug("Moving label " + e.label + " from (", d, ",", f, ") to (", c.x, ",", c.y, ") abc88"), s.updatedPath && (d = c.x, f = c.y);
		}
		c.attr("transform", `translate(${d}, ${f + u / 2})`);
	}
	if (e.startLabelLeft) {
		let o = terminalLabels.get(e.id).startLeft, s = e.x, c = e.y;
		if (l) {
			let o = utils_default.calcTerminalLabelPosition(e.arrowTypeStart ? 10 : 0, "start_left", l);
			s = o.x, c = o.y;
		}
		o.attr("transform", `translate(${s}, ${c})`);
	}
	if (e.startLabelRight) {
		let o = terminalLabels.get(e.id).startRight, s = e.x, c = e.y;
		if (l) {
			let o = utils_default.calcTerminalLabelPosition(e.arrowTypeStart ? 10 : 0, "start_right", l);
			s = o.x, c = o.y;
		}
		o.attr("transform", `translate(${s}, ${c})`);
	}
	if (e.endLabelLeft) {
		let o = terminalLabels.get(e.id).endLeft, s = e.x, c = e.y;
		if (l) {
			let o = utils_default.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_left", l);
			s = o.x, c = o.y;
		}
		o.attr("transform", `translate(${s}, ${c})`);
	}
	if (e.endLabelRight) {
		let o = terminalLabels.get(e.id).endRight, s = e.x, c = e.y;
		if (l) {
			let o = utils_default.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_right", l);
			s = o.x, c = o.y;
		}
		o.attr("transform", `translate(${s}, ${c})`);
	}
}, "positionEdgeLabel"), outsideNode = /* @__PURE__ */ __name((e, o) => {
	let s = e.x, c = e.y, l = Math.abs(o.x - s), u = Math.abs(o.y - c), d = e.width / 2, f = e.height / 2;
	return l >= d || u >= f;
}, "outsideNode"), intersection = /* @__PURE__ */ __name((e, s, c) => {
	log.debug(`intersection calc abc89:
  outsidePoint: ${JSON.stringify(s)}
  insidePoint : ${JSON.stringify(c)}
  node        : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);
	let l = e.x, u = e.y, d = Math.abs(l - c.x), f = e.width / 2, p = c.x < s.x ? f - d : f + d, m = e.height / 2, h = Math.abs(s.y - c.y), g = Math.abs(s.x - c.x);
	if (Math.abs(u - s.y) * f > Math.abs(l - s.x) * m) {
		let e = c.y < s.y ? s.y - m - u : u - m - s.y;
		p = g * e / h;
		let l = {
			x: c.x < s.x ? c.x + p : c.x - g + p,
			y: c.y < s.y ? c.y + h - e : c.y - h + e
		};
		return p === 0 && (l.x = s.x, l.y = s.y), g === 0 && (l.x = s.x), h === 0 && (l.y = s.y), log.debug(`abc89 top/bottom calc, Q ${h}, q ${e}, R ${g}, r ${p}`, l), l;
	} else {
		p = c.x < s.x ? s.x - f - l : l - f - s.x;
		let e = h * p / g, u = c.x < s.x ? c.x + g - p : c.x - g + p, d = c.y < s.y ? c.y + e : c.y - e;
		return log.debug(`sides calc abc89, Q ${h}, q ${e}, R ${g}, r ${p}`, {
			_x: u,
			_y: d
		}), p === 0 && (u = s.x, d = s.y), g === 0 && (u = s.x), h === 0 && (d = s.y), {
			x: u,
			y: d
		};
	}
}, "intersection"), cutPathAtIntersect = /* @__PURE__ */ __name((e, s) => {
	log.warn("abc88 cutPathAtIntersect", e, s);
	let c = [], l = e[0], u = !1;
	return e.forEach((e) => {
		if (log.info("abc88 checking point", e, s), !outsideNode(s, e) && !u) {
			let d = intersection(s, l, e);
			log.debug("abc88 inside", e, l, d), log.debug("abc88 intersection", d, s);
			let f = !1;
			c.forEach((e) => {
				f ||= e.x === d.x && e.y === d.y;
			}), c.some((e) => e.x === d.x && e.y === d.y) ? log.warn("abc88 no intersect", d, c) : c.push(d), u = !0;
		} else log.warn("abc88 outside", e, l), l = e, u || c.push(e);
	}), log.debug("returning points", c), c;
}, "cutPathAtIntersect");
function extractCornerPoints(e) {
	let o = [], s = [];
	for (let c = 1; c < e.length - 1; c++) {
		let l = e[c - 1], u = e[c], d = e[c + 1];
		(l.x === u.x && u.y === d.y && Math.abs(u.x - d.x) > 5 && Math.abs(u.y - l.y) > 5 || l.y === u.y && u.x === d.x && Math.abs(u.x - l.x) > 5 && Math.abs(u.y - d.y) > 5) && (o.push(u), s.push(c));
	}
	return {
		cornerPoints: o,
		cornerPointPositions: s
	};
}
__name(extractCornerPoints, "extractCornerPoints");
var findAdjacentPoint = /* @__PURE__ */ __name(function(e, o, s) {
	let c = o.x - e.x, l = o.y - e.y, u = s / Math.sqrt(c * c + l * l);
	return {
		x: o.x - u * c,
		y: o.y - u * l
	};
}, "findAdjacentPoint"), fixCorners = /* @__PURE__ */ __name(function(e) {
	let { cornerPointPositions: s } = extractCornerPoints(e), c = [];
	for (let l = 0; l < e.length; l++) if (s.includes(l)) {
		let s = e[l - 1], u = e[l + 1], d = e[l], f = findAdjacentPoint(s, d, 5), p = findAdjacentPoint(u, d, 5), m = p.x - f.x, h = p.y - f.y;
		c.push(f);
		let g = Math.sqrt(2) * 2, _ = {
			x: d.x,
			y: d.y
		};
		Math.abs(u.x - s.x) > 10 && Math.abs(u.y - s.y) >= 10 ? (log.debug("Corner point fixing", Math.abs(u.x - s.x), Math.abs(u.y - s.y)), _ = d.x === f.x ? {
			x: m < 0 ? f.x - 5 + g : f.x + 5 - g,
			y: h < 0 ? f.y - g : f.y + g
		} : {
			x: m < 0 ? f.x - g : f.x + g,
			y: h < 0 ? f.y - 5 + g : f.y + 5 - g
		}) : log.debug("Corner point skipping fixing", Math.abs(u.x - s.x), Math.abs(u.y - s.y)), c.push(_, p);
	} else c.push(e[l]);
	return c;
}, "fixCorners"), generateDashArray = /* @__PURE__ */ __name((e, o, s) => {
	let c = e - o - s, l = Math.floor(c / 4);
	return `0 ${o} ${Array(l).fill("2 2").join(" ")} ${s}`;
}, "generateDashArray"), insertEdge = /* @__PURE__ */ __name(function(e, s, w, E, O, k, A, j = !1) {
	let { handDrawnSeed: M } = getConfig2(), N = s.points, P = !1, F = O;
	var I = k;
	let L = [];
	for (let e in s.cssCompiledStyles) isLabelStyle(e) || L.push(s.cssCompiledStyles[e]);
	log.debug("UIO intersect check", s.points, I.x, F.x), I.intersect && F.intersect && !j && (N = N.slice(1, s.points.length - 1), N.unshift(F.intersect(N[0])), log.debug("Last point UIO", s.start, "-->", s.end, N[N.length - 1], I, I.intersect(N[N.length - 1])), N.push(I.intersect(N[N.length - 1])));
	let R = btoa(JSON.stringify(N));
	s.toCluster && (log.info("to cluster abc88", w.get(s.toCluster)), N = cutPathAtIntersect(s.points, w.get(s.toCluster).node), P = !0), s.fromCluster && (log.debug("from cluster abc88", w.get(s.fromCluster), JSON.stringify(N, null, 2)), N = cutPathAtIntersect(N.reverse(), w.get(s.fromCluster).node).reverse(), P = !0);
	let z = N.filter((e) => !Number.isNaN(e.y));
	z = fixCorners(z);
	let B = basis_default;
	switch (B = linear_default, s.curve) {
		case "linear":
			B = linear_default;
			break;
		case "basis":
			B = basis_default;
			break;
		case "cardinal":
			B = cardinal_default;
			break;
		case "bumpX":
			B = bumpX;
			break;
		case "bumpY":
			B = bumpY;
			break;
		case "catmullRom":
			B = catmullRom_default;
			break;
		case "monotoneX":
			B = monotoneX;
			break;
		case "monotoneY":
			B = monotoneY;
			break;
		case "natural":
			B = natural_default;
			break;
		case "step":
			B = step_default;
			break;
		case "stepAfter":
			B = stepAfter;
			break;
		case "stepBefore":
			B = stepBefore;
			break;
		default: B = basis_default;
	}
	let { x: V, y: H } = getLineFunctionsWithOffset(s), U = line_default().x(V).y(H).curve(B), W;
	switch (s.thickness) {
		case "normal":
			W = "edge-thickness-normal";
			break;
		case "thick":
			W = "edge-thickness-thick";
			break;
		case "invisible":
			W = "edge-thickness-invisible";
			break;
		default: W = "edge-thickness-normal";
	}
	switch (s.pattern) {
		case "solid":
			W += " edge-pattern-solid";
			break;
		case "dotted":
			W += " edge-pattern-dotted";
			break;
		case "dashed":
			W += " edge-pattern-dashed";
			break;
		default: W += " edge-pattern-solid";
	}
	let G, K = s.curve === "rounded" ? generateRoundedPath(applyMarkerOffsetsToPoints(z, s), 5) : U(z), q = Array.isArray(s.style) ? s.style : [s.style], J = q.find((e) => e?.startsWith("stroke:")), Y = !1;
	if (s.look === "handDrawn") {
		let o = at.svg(e);
		Object.assign([], z);
		let c = o.path(K, {
			roughness: .3,
			seed: M
		});
		W += " transition", G = select_default(c).select("path").attr("id", s.id).attr("class", " " + W + (s.classes ? " " + s.classes : "")).attr("style", q ? q.reduce((e, o) => e + ";" + o, "") : "");
		let u = G.attr("d");
		G.attr("d", u), e.node().appendChild(G.node());
	} else {
		let o = L.join(";"), c = q ? q.reduce((e, o) => e + o + ";", "") : "", l = "";
		s.animate && (l = " edge-animation-fast"), s.animation && (l = " edge-animation-" + s.animation);
		let u = (o ? o + ";" + c + ";" : c) + ";" + (q ? q.reduce((e, o) => e + ";" + o, "") : "");
		G = e.append("path").attr("d", K).attr("id", s.id).attr("class", " " + W + (s.classes ? " " + s.classes : "") + (l ?? "")).attr("style", u), J = u.match(/stroke:([^;]+)/)?.[1], Y = s.animate === !0 || !!s.animation || o.includes("animation");
		let d = G.node(), f = typeof d.getTotalLength == "function" ? d.getTotalLength() : 0, p = markerOffsets2[s.arrowTypeStart] || 0, m = markerOffsets2[s.arrowTypeEnd] || 0;
		if (s.look === "neo" && !Y) {
			let e = `stroke-dasharray: ${s.pattern === "dotted" || s.pattern === "dashed" ? generateDashArray(f, p, m) : `0 ${p} ${f - p - m} ${m}`}; stroke-dashoffset: 0;`;
			G.attr("style", e + G.attr("style"));
		}
	}
	G.attr("data-edge", !0), G.attr("data-et", "edge"), G.attr("data-id", s.id), G.attr("data-points", R), s.showPoints && z.forEach((o) => {
		e.append("circle").style("stroke", "red").style("fill", "red").attr("r", 1).attr("cx", o.x).attr("cy", o.y);
	});
	let X = "";
	(getConfig2().flowchart.arrowMarkerAbsolute || getConfig2().state.arrowMarkerAbsolute) && (X = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, X = X.replace(/\(/g, "\\(").replace(/\)/g, "\\)")), log.info("arrowTypeStart", s.arrowTypeStart), log.info("arrowTypeEnd", s.arrowTypeEnd), addEdgeMarkers(G, s, X, A, E, J);
	let Z = Math.floor(N.length / 2), Q = N[Z];
	utils_default.isLabelCoordinateInPath(Q, G.attr("d")) || (P = !0);
	let $ = {};
	return P && ($.updatedPath = N), $.originalPath = s.points, $;
}, "insertEdge");
function generateRoundedPath(e, o) {
	if (e.length < 2) return "";
	let s = "", c = e.length, l = 1e-5;
	for (let u = 0; u < c; u++) {
		let d = e[u], f = e[u - 1], p = e[u + 1];
		if (u === 0) s += `M${d.x},${d.y}`;
		else if (u === c - 1) s += `L${d.x},${d.y}`;
		else {
			let e = d.x - f.x, c = d.y - f.y, u = p.x - d.x, m = p.y - d.y, h = Math.hypot(e, c), g = Math.hypot(u, m);
			if (h < l || g < l) {
				s += `L${d.x},${d.y}`;
				continue;
			}
			let _ = e / h, v = c / h, y = u / g, b = m / g, x = _ * y + v * b, S = Math.max(-1, Math.min(1, x)), C = Math.acos(S);
			if (C < l || Math.abs(Math.PI - C) < l) {
				s += `L${d.x},${d.y}`;
				continue;
			}
			let w = Math.min(o / Math.sin(C / 2), h / 2, g / 2), T = d.x - _ * w, E = d.y - v * w, D = d.x + y * w, O = d.y + b * w;
			s += `L${T},${E}`, s += `Q${d.x},${d.y} ${D},${O}`;
		}
	}
	return s;
}
__name(generateRoundedPath, "generateRoundedPath");
function calculateDeltaAndAngle(e, o) {
	if (!e || !o) return {
		angle: 0,
		deltaX: 0,
		deltaY: 0
	};
	let s = o.x - e.x, c = o.y - e.y;
	return {
		angle: Math.atan2(c, s),
		deltaX: s,
		deltaY: c
	};
}
__name(calculateDeltaAndAngle, "calculateDeltaAndAngle");
function applyMarkerOffsetsToPoints(e, o) {
	let s = e.map((e) => ({ ...e }));
	if (e.length >= 2 && markerOffsets[o.arrowTypeStart]) {
		let c = markerOffsets[o.arrowTypeStart], l = e[0], u = e[1], { angle: d } = calculateDeltaAndAngle(l, u), f = c * Math.cos(d), p = c * Math.sin(d);
		s[0].x = l.x + f, s[0].y = l.y + p;
	}
	let c = e.length;
	if (c >= 2 && markerOffsets[o.arrowTypeEnd]) {
		let l = markerOffsets[o.arrowTypeEnd], u = e[c - 1], d = e[c - 2], { angle: f } = calculateDeltaAndAngle(d, u), p = l * Math.cos(f), m = l * Math.sin(f);
		s[c - 1].x = u.x - p, s[c - 1].y = u.y - m;
	}
	return s;
}
__name(applyMarkerOffsetsToPoints, "applyMarkerOffsetsToPoints");
var insertMarkers = /* @__PURE__ */ __name((e, o, s, c) => {
	o.forEach((o) => {
		markers[o](e, s, c);
	});
}, "insertMarkers"), markers = {
	extension: /* @__PURE__ */ __name((e, s, c) => {
		log.trace("Making markers for ", c), e.append("defs").append("marker").attr("id", c + "_" + s + "-extensionStart").attr("class", "marker extension " + s).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), e.append("defs").append("marker").attr("id", c + "_" + s + "-extensionEnd").attr("class", "marker extension " + s).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
	}, "extension"),
	composition: /* @__PURE__ */ __name((e, o, s) => {
		e.append("defs").append("marker").attr("id", s + "_" + o + "-compositionStart").attr("class", "marker composition " + o).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", s + "_" + o + "-compositionEnd").attr("class", "marker composition " + o).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
	}, "composition"),
	aggregation: /* @__PURE__ */ __name((e, o, s) => {
		e.append("defs").append("marker").attr("id", s + "_" + o + "-aggregationStart").attr("class", "marker aggregation " + o).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", s + "_" + o + "-aggregationEnd").attr("class", "marker aggregation " + o).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
	}, "aggregation"),
	dependency: /* @__PURE__ */ __name((e, o, s) => {
		e.append("defs").append("marker").attr("id", s + "_" + o + "-dependencyStart").attr("class", "marker dependency " + o).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", s + "_" + o + "-dependencyEnd").attr("class", "marker dependency " + o).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
	}, "dependency"),
	lollipop: /* @__PURE__ */ __name((e, o, s) => {
		e.append("defs").append("marker").attr("id", s + "_" + o + "-lollipopStart").attr("class", "marker lollipop " + o).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6), e.append("defs").append("marker").attr("id", s + "_" + o + "-lollipopEnd").attr("class", "marker lollipop " + o).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
	}, "lollipop"),
	point: /* @__PURE__ */ __name((e, o, s) => {
		e.append("marker").attr("id", s + "_" + o + "-pointEnd").attr("class", "marker " + o).attr("viewBox", "0 0 10 10").attr("refX", 5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 8).attr("markerHeight", 8).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", s + "_" + o + "-pointStart").attr("class", "marker " + o).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 8).attr("markerHeight", 8).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
	}, "point"),
	circle: /* @__PURE__ */ __name((e, o, s) => {
		e.append("marker").attr("id", s + "_" + o + "-circleEnd").attr("class", "marker " + o).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", s + "_" + o + "-circleStart").attr("class", "marker " + o).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
	}, "circle"),
	cross: /* @__PURE__ */ __name((e, o, s) => {
		e.append("marker").attr("id", s + "_" + o + "-crossEnd").attr("class", "marker cross " + o).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", s + "_" + o + "-crossStart").attr("class", "marker cross " + o).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
	}, "cross"),
	barb: /* @__PURE__ */ __name((e, o, s) => {
		e.append("defs").append("marker").attr("id", s + "_" + o + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
	}, "barb"),
	only_one: /* @__PURE__ */ __name((e, o, s) => {
		e.append("defs").append("marker").attr("id", s + "_" + o + "-onlyOneStart").attr("class", "marker onlyOne " + o).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("d", "M9,0 L9,18 M15,0 L15,18"), e.append("defs").append("marker").attr("id", s + "_" + o + "-onlyOneEnd").attr("class", "marker onlyOne " + o).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("d", "M3,0 L3,18 M9,0 L9,18");
	}, "only_one"),
	zero_or_one: /* @__PURE__ */ __name((e, o, s) => {
		let c = e.append("defs").append("marker").attr("id", s + "_" + o + "-zeroOrOneStart").attr("class", "marker zeroOrOne " + o).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
		c.append("circle").attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6), c.append("path").attr("d", "M9,0 L9,18");
		let l = e.append("defs").append("marker").attr("id", s + "_" + o + "-zeroOrOneEnd").attr("class", "marker zeroOrOne " + o).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
		l.append("circle").attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6), l.append("path").attr("d", "M21,0 L21,18");
	}, "zero_or_one"),
	one_or_more: /* @__PURE__ */ __name((e, o, s) => {
		e.append("defs").append("marker").attr("id", s + "_" + o + "-oneOrMoreStart").attr("class", "marker oneOrMore " + o).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"), e.append("defs").append("marker").attr("id", s + "_" + o + "-oneOrMoreEnd").attr("class", "marker oneOrMore " + o).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18");
	}, "one_or_more"),
	zero_or_more: /* @__PURE__ */ __name((e, o, s) => {
		let c = e.append("defs").append("marker").attr("id", s + "_" + o + "-zeroOrMoreStart").attr("class", "marker zeroOrMore " + o).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
		c.append("circle").attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6), c.append("path").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18");
		let l = e.append("defs").append("marker").attr("id", s + "_" + o + "-zeroOrMoreEnd").attr("class", "marker zeroOrMore " + o).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
		l.append("circle").attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6), l.append("path").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
	}, "zero_or_more"),
	requirement_arrow: /* @__PURE__ */ __name((e, o, s) => {
		e.append("defs").append("marker").attr("id", s + "_" + o + "-requirement_arrowEnd").attr("refX", 20).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").append("path").attr("d", "M0,0\n      L20,10\n      M20,10\n      L0,20");
	}, "requirement_arrow"),
	requirement_contains: /* @__PURE__ */ __name((e, o, s) => {
		let c = e.append("defs").append("marker").attr("id", s + "_" + o + "-requirement_containsStart").attr("refX", 0).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").append("g");
		c.append("circle").attr("cx", 10).attr("cy", 10).attr("r", 9).attr("fill", "none"), c.append("line").attr("x1", 1).attr("x2", 19).attr("y1", 10).attr("y2", 10), c.append("line").attr("y1", 1).attr("y2", 19).attr("x1", 10).attr("x2", 10);
	}, "requirement_contains")
}, markers_default = insertMarkers;
export { clear, insertEdge, insertEdgeLabel, markers_default, positionEdgeLabel };
