stateDiagram-N22R6T2Y.mjs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. import {
  2. stateDb_default,
  3. stateDiagram_default,
  4. styles_default
  5. } from "./chunk-SVGOEX7Z.mjs";
  6. import "./chunk-FUIDI54P.mjs";
  7. import "./chunk-Z2VRG6XP.mjs";
  8. import "./chunk-T3KDJ7CM.mjs";
  9. import "./chunk-5CZSE4TR.mjs";
  10. import "./chunk-TINLTEC2.mjs";
  11. import "./chunk-OERGPBFJ.mjs";
  12. import {
  13. utils_default
  14. } from "./chunk-VKXSJROQ.mjs";
  15. import {
  16. __name,
  17. common_default,
  18. configureSvgSize,
  19. getConfig2 as getConfig,
  20. log
  21. } from "./chunk-O2AGWWWV.mjs";
  22. // src/diagrams/state/stateRenderer.js
  23. import { select } from "d3";
  24. import { layout as dagreLayout } from "dagre-d3-es/src/dagre/index.js";
  25. import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
  26. // src/diagrams/state/shapes.js
  27. import { line, curveBasis } from "d3";
  28. // src/diagrams/state/id-cache.js
  29. var idCache = {};
  30. var set = /* @__PURE__ */ __name((key, val) => {
  31. idCache[key] = val;
  32. }, "set");
  33. var get = /* @__PURE__ */ __name((k) => idCache[k], "get");
  34. var keys = /* @__PURE__ */ __name(() => Object.keys(idCache), "keys");
  35. var size = /* @__PURE__ */ __name(() => keys().length, "size");
  36. var id_cache_default = {
  37. get,
  38. set,
  39. keys,
  40. size
  41. };
  42. // src/diagrams/state/shapes.js
  43. var drawStartState = /* @__PURE__ */ __name((g) => g.append("circle").attr("class", "start-state").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit), "drawStartState");
  44. var drawDivider = /* @__PURE__ */ __name((g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig().state.textHeight).attr("class", "divider").attr("x2", getConfig().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider");
  45. var drawSimpleState = /* @__PURE__ */ __name((g, stateDef) => {
  46. const state = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 2 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
  47. const classBox = state.node().getBBox();
  48. g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", classBox.width + 2 * getConfig().state.padding).attr("height", classBox.height + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
  49. return state;
  50. }, "drawSimpleState");
  51. var drawDescrState = /* @__PURE__ */ __name((g, stateDef) => {
  52. const addTspan = /* @__PURE__ */ __name(function(textEl, txt, isFirst2) {
  53. const tSpan = textEl.append("tspan").attr("x", 2 * getConfig().state.padding).text(txt);
  54. if (!isFirst2) {
  55. tSpan.attr("dy", getConfig().state.textHeight);
  56. }
  57. }, "addTspan");
  58. const title = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 1.3 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
  59. const titleBox = title.node().getBBox();
  60. const titleHeight = titleBox.height;
  61. const description = g.append("text").attr("x", getConfig().state.padding).attr(
  62. "y",
  63. titleHeight + getConfig().state.padding * 0.4 + getConfig().state.dividerMargin + getConfig().state.textHeight
  64. ).attr("class", "state-description");
  65. let isFirst = true;
  66. let isSecond = true;
  67. stateDef.descriptions.forEach(function(descr) {
  68. if (!isFirst) {
  69. addTspan(description, descr, isSecond);
  70. isSecond = false;
  71. }
  72. isFirst = false;
  73. });
  74. const descrLine = g.append("line").attr("x1", getConfig().state.padding).attr("y1", getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2).attr("y2", getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2).attr("class", "descr-divider");
  75. const descrBox = description.node().getBBox();
  76. const width = Math.max(descrBox.width, titleBox.width);
  77. descrLine.attr("x2", width + 3 * getConfig().state.padding);
  78. g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", width + 2 * getConfig().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
  79. return g;
  80. }, "drawDescrState");
  81. var addTitleAndBox = /* @__PURE__ */ __name((g, stateDef, altBkg) => {
  82. const pad = getConfig().state.padding;
  83. const dblPad = 2 * getConfig().state.padding;
  84. const orgBox = g.node().getBBox();
  85. const orgWidth = orgBox.width;
  86. const orgX = orgBox.x;
  87. const title = g.append("text").attr("x", 0).attr("y", getConfig().state.titleShift).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
  88. const titleBox = title.node().getBBox();
  89. const titleWidth = titleBox.width + dblPad;
  90. let width = Math.max(titleWidth, orgWidth);
  91. if (width === orgWidth) {
  92. width = width + dblPad;
  93. }
  94. let startX;
  95. const graphBox = g.node().getBBox();
  96. if (stateDef.doc) {
  97. }
  98. startX = orgX - pad;
  99. if (titleWidth > orgWidth) {
  100. startX = (orgWidth - width) / 2 + pad;
  101. }
  102. if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {
  103. startX = orgX - (titleWidth - orgWidth) / 2;
  104. }
  105. const lineY = 1 - getConfig().state.textHeight;
  106. g.insert("rect", ":first-child").attr("x", startX).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width).attr(
  107. "height",
  108. graphBox.height + getConfig().state.textHeight + getConfig().state.titleShift + 1
  109. ).attr("rx", "0");
  110. title.attr("x", startX + pad);
  111. if (titleWidth <= orgWidth) {
  112. title.attr("x", orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);
  113. }
  114. g.insert("rect", ":first-child").attr("x", startX).attr(
  115. "y",
  116. getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
  117. ).attr("width", width).attr("height", getConfig().state.textHeight * 3).attr("rx", getConfig().state.radius);
  118. g.insert("rect", ":first-child").attr("x", startX).attr(
  119. "y",
  120. getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
  121. ).attr("width", width).attr("height", graphBox.height + 3 + 2 * getConfig().state.textHeight).attr("rx", getConfig().state.radius);
  122. return g;
  123. }, "addTitleAndBox");
  124. var drawEndState = /* @__PURE__ */ __name((g) => {
  125. g.append("circle").attr("class", "end-state-outer").attr("r", getConfig().state.sizeUnit + getConfig().state.miniPadding).attr(
  126. "cx",
  127. getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
  128. ).attr(
  129. "cy",
  130. getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
  131. );
  132. return g.append("circle").attr("class", "end-state-inner").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit + 2).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit + 2);
  133. }, "drawEndState");
  134. var drawForkJoinState = /* @__PURE__ */ __name((g, stateDef) => {
  135. let width = getConfig().state.forkWidth;
  136. let height = getConfig().state.forkHeight;
  137. if (stateDef.parentId) {
  138. let tmp = width;
  139. width = height;
  140. height = tmp;
  141. }
  142. return g.append("rect").style("stroke", "black").style("fill", "black").attr("width", width).attr("height", height).attr("x", getConfig().state.padding).attr("y", getConfig().state.padding);
  143. }, "drawForkJoinState");
  144. var _drawLongText = /* @__PURE__ */ __name((_text, x, y, g) => {
  145. let textHeight = 0;
  146. const textElem = g.append("text");
  147. textElem.style("text-anchor", "start");
  148. textElem.attr("class", "noteText");
  149. let text = _text.replace(/\r\n/g, "<br/>");
  150. text = text.replace(/\n/g, "<br/>");
  151. const lines = text.split(common_default.lineBreakRegex);
  152. let tHeight = 1.25 * getConfig().state.noteMargin;
  153. for (const line2 of lines) {
  154. const txt = line2.trim();
  155. if (txt.length > 0) {
  156. const span = textElem.append("tspan");
  157. span.text(txt);
  158. if (tHeight === 0) {
  159. const textBounds = span.node().getBBox();
  160. tHeight += textBounds.height;
  161. }
  162. textHeight += tHeight;
  163. span.attr("x", x + getConfig().state.noteMargin);
  164. span.attr("y", y + textHeight + 1.25 * getConfig().state.noteMargin);
  165. }
  166. }
  167. return { textWidth: textElem.node().getBBox().width, textHeight };
  168. }, "_drawLongText");
  169. var drawNote = /* @__PURE__ */ __name((text, g) => {
  170. g.attr("class", "state-note");
  171. const note = g.append("rect").attr("x", 0).attr("y", getConfig().state.padding);
  172. const rectElem = g.append("g");
  173. const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
  174. note.attr("height", textHeight + 2 * getConfig().state.noteMargin);
  175. note.attr("width", textWidth + getConfig().state.noteMargin * 2);
  176. return note;
  177. }, "drawNote");
  178. var drawState = /* @__PURE__ */ __name(function(elem, stateDef) {
  179. const id = stateDef.id;
  180. const stateInfo = {
  181. id,
  182. label: stateDef.id,
  183. width: 0,
  184. height: 0
  185. };
  186. const g = elem.append("g").attr("id", id).attr("class", "stateGroup");
  187. if (stateDef.type === "start") {
  188. drawStartState(g);
  189. }
  190. if (stateDef.type === "end") {
  191. drawEndState(g);
  192. }
  193. if (stateDef.type === "fork" || stateDef.type === "join") {
  194. drawForkJoinState(g, stateDef);
  195. }
  196. if (stateDef.type === "note") {
  197. drawNote(stateDef.note.text, g);
  198. }
  199. if (stateDef.type === "divider") {
  200. drawDivider(g);
  201. }
  202. if (stateDef.type === "default" && stateDef.descriptions.length === 0) {
  203. drawSimpleState(g, stateDef);
  204. }
  205. if (stateDef.type === "default" && stateDef.descriptions.length > 0) {
  206. drawDescrState(g, stateDef);
  207. }
  208. const stateBox = g.node().getBBox();
  209. stateInfo.width = stateBox.width + 2 * getConfig().state.padding;
  210. stateInfo.height = stateBox.height + 2 * getConfig().state.padding;
  211. id_cache_default.set(id, stateInfo);
  212. return stateInfo;
  213. }, "drawState");
  214. var edgeCount = 0;
  215. var drawEdge = /* @__PURE__ */ __name(function(elem, path, relation) {
  216. const getRelationType = /* @__PURE__ */ __name(function(type) {
  217. switch (type) {
  218. case stateDb_default.relationType.AGGREGATION:
  219. return "aggregation";
  220. case stateDb_default.relationType.EXTENSION:
  221. return "extension";
  222. case stateDb_default.relationType.COMPOSITION:
  223. return "composition";
  224. case stateDb_default.relationType.DEPENDENCY:
  225. return "dependency";
  226. }
  227. }, "getRelationType");
  228. path.points = path.points.filter((p) => !Number.isNaN(p.y));
  229. const lineData = path.points;
  230. const lineFunction = line().x(function(d) {
  231. return d.x;
  232. }).y(function(d) {
  233. return d.y;
  234. }).curve(curveBasis);
  235. const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition");
  236. let url = "";
  237. if (getConfig().state.arrowMarkerAbsolute) {
  238. url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
  239. url = url.replace(/\(/g, "\\(");
  240. url = url.replace(/\)/g, "\\)");
  241. }
  242. svgPath.attr(
  243. "marker-end",
  244. "url(" + url + "#" + getRelationType(stateDb_default.relationType.DEPENDENCY) + "End)"
  245. );
  246. if (relation.title !== void 0) {
  247. const label = elem.append("g").attr("class", "stateLabel");
  248. const { x, y } = utils_default.calcLabelPosition(path.points);
  249. const rows = common_default.getRows(relation.title);
  250. let titleHeight = 0;
  251. const titleRows = [];
  252. let maxWidth = 0;
  253. let minX = 0;
  254. for (let i = 0; i <= rows.length; i++) {
  255. const title = label.append("text").attr("text-anchor", "middle").text(rows[i]).attr("x", x).attr("y", y + titleHeight);
  256. const boundsTmp = title.node().getBBox();
  257. maxWidth = Math.max(maxWidth, boundsTmp.width);
  258. minX = Math.min(minX, boundsTmp.x);
  259. log.info(boundsTmp.x, x, y + titleHeight);
  260. if (titleHeight === 0) {
  261. const titleBox = title.node().getBBox();
  262. titleHeight = titleBox.height;
  263. log.info("Title height", titleHeight, y);
  264. }
  265. titleRows.push(title);
  266. }
  267. let boxHeight = titleHeight * rows.length;
  268. if (rows.length > 1) {
  269. const heightAdj = (rows.length - 1) * titleHeight * 0.5;
  270. titleRows.forEach((title, i) => title.attr("y", y + i * titleHeight - heightAdj));
  271. boxHeight = titleHeight * rows.length;
  272. }
  273. const bounds = label.node().getBBox();
  274. label.insert("rect", ":first-child").attr("class", "box").attr("x", x - maxWidth / 2 - getConfig().state.padding / 2).attr("y", y - boxHeight / 2 - getConfig().state.padding / 2 - 3.5).attr("width", maxWidth + getConfig().state.padding).attr("height", boxHeight + getConfig().state.padding);
  275. log.info(bounds);
  276. }
  277. edgeCount++;
  278. }, "drawEdge");
  279. // src/diagrams/state/stateRenderer.js
  280. var conf;
  281. var transformationLog = {};
  282. var setConf = /* @__PURE__ */ __name(function() {
  283. }, "setConf");
  284. var insertMarkers = /* @__PURE__ */ __name(function(elem) {
  285. elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
  286. }, "insertMarkers");
  287. var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
  288. conf = getConfig().state;
  289. const securityLevel = getConfig().securityLevel;
  290. let sandboxElement;
  291. if (securityLevel === "sandbox") {
  292. sandboxElement = select("#i" + id);
  293. }
  294. const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
  295. const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
  296. log.debug("Rendering diagram " + text);
  297. const diagram2 = root.select(`[id='${id}']`);
  298. insertMarkers(diagram2);
  299. const rootDoc = diagObj.db.getRootDoc();
  300. renderDoc(rootDoc, diagram2, void 0, false, root, doc, diagObj);
  301. const padding = conf.padding;
  302. const bounds = diagram2.node().getBBox();
  303. const width = bounds.width + padding * 2;
  304. const height = bounds.height + padding * 2;
  305. const svgWidth = width * 1.75;
  306. configureSvgSize(diagram2, height, svgWidth, conf.useMaxWidth);
  307. diagram2.attr(
  308. "viewBox",
  309. `${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + " " + height
  310. );
  311. }, "draw");
  312. var getLabelWidth = /* @__PURE__ */ __name((text) => {
  313. return text ? text.length * conf.fontSizeFactor : 1;
  314. }, "getLabelWidth");
  315. var renderDoc = /* @__PURE__ */ __name((doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
  316. const graph = new graphlib.Graph({
  317. compound: true,
  318. multigraph: true
  319. });
  320. let i;
  321. let edgeFreeDoc = true;
  322. for (i = 0; i < doc.length; i++) {
  323. if (doc[i].stmt === "relation") {
  324. edgeFreeDoc = false;
  325. break;
  326. }
  327. }
  328. if (parentId) {
  329. graph.setGraph({
  330. rankdir: "LR",
  331. multigraph: true,
  332. compound: true,
  333. // acyclicer: 'greedy',
  334. ranker: "tight-tree",
  335. ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
  336. nodeSep: edgeFreeDoc ? 1 : 50,
  337. isMultiGraph: true
  338. // ranksep: 5,
  339. // nodesep: 1
  340. });
  341. } else {
  342. graph.setGraph({
  343. rankdir: "TB",
  344. multigraph: true,
  345. compound: true,
  346. // isCompound: true,
  347. // acyclicer: 'greedy',
  348. // ranker: 'longest-path'
  349. ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
  350. nodeSep: edgeFreeDoc ? 1 : 50,
  351. ranker: "tight-tree",
  352. // ranker: 'network-simplex'
  353. isMultiGraph: true
  354. });
  355. }
  356. graph.setDefaultEdgeLabel(function() {
  357. return {};
  358. });
  359. diagObj.db.extract(doc);
  360. const states = diagObj.db.getStates();
  361. const relations = diagObj.db.getRelations();
  362. const keys2 = Object.keys(states);
  363. let first = true;
  364. for (const key of keys2) {
  365. const stateDef = states[key];
  366. if (parentId) {
  367. stateDef.parentId = parentId;
  368. }
  369. let node;
  370. if (stateDef.doc) {
  371. let sub = diagram2.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
  372. node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
  373. if (first) {
  374. sub = addTitleAndBox(sub, stateDef, altBkg);
  375. let boxBounds = sub.node().getBBox();
  376. node.width = boxBounds.width;
  377. node.height = boxBounds.height + conf.padding / 2;
  378. transformationLog[stateDef.id] = { y: conf.compositTitleSize };
  379. } else {
  380. let boxBounds = sub.node().getBBox();
  381. node.width = boxBounds.width;
  382. node.height = boxBounds.height;
  383. }
  384. } else {
  385. node = drawState(diagram2, stateDef, graph);
  386. }
  387. if (stateDef.note) {
  388. const noteDef = {
  389. descriptions: [],
  390. id: stateDef.id + "-note",
  391. note: stateDef.note,
  392. type: "note"
  393. };
  394. const note = drawState(diagram2, noteDef, graph);
  395. if (stateDef.note.position === "left of") {
  396. graph.setNode(node.id + "-note", note);
  397. graph.setNode(node.id, node);
  398. } else {
  399. graph.setNode(node.id, node);
  400. graph.setNode(node.id + "-note", note);
  401. }
  402. graph.setParent(node.id, node.id + "-group");
  403. graph.setParent(node.id + "-note", node.id + "-group");
  404. } else {
  405. graph.setNode(node.id, node);
  406. }
  407. }
  408. log.debug("Count=", graph.nodeCount(), graph);
  409. let cnt = 0;
  410. relations.forEach(function(relation) {
  411. cnt++;
  412. log.debug("Setting edge", relation);
  413. graph.setEdge(
  414. relation.id1,
  415. relation.id2,
  416. {
  417. relation,
  418. width: getLabelWidth(relation.title),
  419. height: conf.labelHeight * common_default.getRows(relation.title).length,
  420. labelpos: "c"
  421. },
  422. "id" + cnt
  423. );
  424. });
  425. dagreLayout(graph);
  426. log.debug("Graph after layout", graph.nodes());
  427. const svgElem = diagram2.node();
  428. graph.nodes().forEach(function(v) {
  429. if (v !== void 0 && graph.node(v) !== void 0) {
  430. log.warn("Node " + v + ": " + JSON.stringify(graph.node(v)));
  431. root.select("#" + svgElem.id + " #" + v).attr(
  432. "transform",
  433. "translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + " )"
  434. );
  435. root.select("#" + svgElem.id + " #" + v).attr("data-x-shift", graph.node(v).x - graph.node(v).width / 2);
  436. const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v + " .divider");
  437. dividers.forEach((divider) => {
  438. const parent = divider.parentElement;
  439. let pWidth = 0;
  440. let pShift = 0;
  441. if (parent) {
  442. if (parent.parentElement) {
  443. pWidth = parent.parentElement.getBBox().width;
  444. }
  445. pShift = parseInt(parent.getAttribute("data-x-shift"), 10);
  446. if (Number.isNaN(pShift)) {
  447. pShift = 0;
  448. }
  449. }
  450. divider.setAttribute("x1", 0 - pShift + 8);
  451. divider.setAttribute("x2", pWidth - pShift - 8);
  452. });
  453. } else {
  454. log.debug("No Node " + v + ": " + JSON.stringify(graph.node(v)));
  455. }
  456. });
  457. let stateBox = svgElem.getBBox();
  458. graph.edges().forEach(function(e) {
  459. if (e !== void 0 && graph.edge(e) !== void 0) {
  460. log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
  461. drawEdge(diagram2, graph.edge(e), graph.edge(e).relation);
  462. }
  463. });
  464. stateBox = svgElem.getBBox();
  465. const stateInfo = {
  466. id: parentId ? parentId : "root",
  467. label: parentId ? parentId : "root",
  468. width: 0,
  469. height: 0
  470. };
  471. stateInfo.width = stateBox.width + 2 * conf.padding;
  472. stateInfo.height = stateBox.height + 2 * conf.padding;
  473. log.debug("Doc rendered", stateInfo, graph);
  474. return stateInfo;
  475. }, "renderDoc");
  476. var stateRenderer_default = {
  477. setConf,
  478. draw
  479. };
  480. // src/diagrams/state/stateDiagram.ts
  481. var diagram = {
  482. parser: stateDiagram_default,
  483. db: stateDb_default,
  484. renderer: stateRenderer_default,
  485. styles: styles_default,
  486. init: /* @__PURE__ */ __name((cnf) => {
  487. if (!cnf.state) {
  488. cnf.state = {};
  489. }
  490. cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
  491. stateDb_default.clear();
  492. }, "init")
  493. };
  494. export {
  495. diagram
  496. };