@infinilabs/ai-chat 0.0.1 → 0.0.2

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 (116) hide show
  1. package/README.md +10 -1
  2. package/dist/{_baseUniq-BQcAhV7E.js → _baseUniq-BFn6cCm9.js} +1 -1
  3. package/dist/_baseUniq-nfJyj2zU.cjs +151 -0
  4. package/dist/arc-BWSMkwk2.cjs +130 -0
  5. package/dist/{arc-2jwvQ2TN.js → arc-DODeX7B9.js} +1 -1
  6. package/dist/{architecture-U656AL7Q-WuSilpZW.js → architecture-U656AL7Q-B4C0nw6C.js} +1 -1
  7. package/dist/architecture-U656AL7Q-CVURQXwt.cjs +5 -0
  8. package/dist/architectureDiagram-VXUJARFQ-2UbdzpNz.cjs +8681 -0
  9. package/dist/{architectureDiagram-VXUJARFQ-D6SKNy5z.js → architectureDiagram-VXUJARFQ-NCVmzKuE.js} +3 -3
  10. package/dist/blockDiagram-VD42YOAC-B3yCPK1N.cjs +3606 -0
  11. package/dist/{blockDiagram-VD42YOAC-Ct2DD8jj.js → blockDiagram-VD42YOAC-C4FsmQfk.js} +5 -5
  12. package/dist/{c4Diagram-YG6GDRKO-B7wBU4mz.js → c4Diagram-YG6GDRKO-ATyoKzFV.js} +2 -2
  13. package/dist/c4Diagram-YG6GDRKO-COwVcHWj.cjs +2481 -0
  14. package/dist/channel-2Y73gsu9.cjs +6 -0
  15. package/dist/{channel-BRREX19f.js → channel-oB8MffQV.js} +1 -1
  16. package/dist/chunk-4BX2VUAB-C3diNHZw.cjs +15 -0
  17. package/dist/{chunk-4BX2VUAB-BnghU1_v.js → chunk-4BX2VUAB-sd2zFBFz.js} +1 -1
  18. package/dist/{chunk-55IACEB6-Dduk-DEL.js → chunk-55IACEB6-6ohTnYE3.js} +1 -1
  19. package/dist/chunk-55IACEB6-T-CzlJke.cjs +12 -0
  20. package/dist/chunk-B4BG7PRW-B1zqG62l.cjs +1825 -0
  21. package/dist/{chunk-B4BG7PRW-DeHw-z-x.js → chunk-B4BG7PRW-E1dti26Y.js} +4 -4
  22. package/dist/chunk-DI55MBZ5-Dk0kfYBV.cjs +1914 -0
  23. package/dist/{chunk-DI55MBZ5-GTHMAr0M.js → chunk-DI55MBZ5-DpHw-vMw.js} +3 -3
  24. package/dist/{chunk-FMBD7UC4-Bchh4_3W.js → chunk-FMBD7UC4-B1vXpasq.js} +1 -1
  25. package/dist/chunk-FMBD7UC4-CShN9-qf.cjs +18 -0
  26. package/dist/{chunk-QN33PNHL-H6S-NYp0.js → chunk-QN33PNHL-Cw7FG91D.js} +1 -1
  27. package/dist/chunk-QN33PNHL-DJi1fhak.cjs +23 -0
  28. package/dist/{chunk-QZHKN3VN-DdcyNnvM.js → chunk-QZHKN3VN-BweiBR9P.js} +1 -1
  29. package/dist/chunk-QZHKN3VN-DfUW_gDw.cjs +16 -0
  30. package/dist/chunk-TZMSLE5B-DY2Kbag4.cjs +107 -0
  31. package/dist/{chunk-TZMSLE5B-C7te_j4V.js → chunk-TZMSLE5B-ZQ2Esoix.js} +1 -1
  32. package/dist/{classDiagram-2ON5EDUG-CNkHY_Y7.js → classDiagram-2ON5EDUG-D2tIbkjc.js} +2 -2
  33. package/dist/classDiagram-2ON5EDUG-DRhRmkUb.cjs +19 -0
  34. package/dist/{classDiagram-v2-WZHVMYZB-CNkHY_Y7.js → classDiagram-v2-WZHVMYZB-D2tIbkjc.js} +2 -2
  35. package/dist/classDiagram-v2-WZHVMYZB-DRhRmkUb.cjs +19 -0
  36. package/dist/clone-BMkj3yun.cjs +7 -0
  37. package/dist/{clone-DnOD7gQ4.js → clone-ChHXIoR6.js} +1 -1
  38. package/dist/cose-bilkent-S5V4N54A-BXnWH5Od.cjs +4942 -0
  39. package/dist/{cose-bilkent-S5V4N54A-2EKtTYth.js → cose-bilkent-S5V4N54A-D15BmpCb.js} +1 -1
  40. package/dist/cytoscape.esm-D8IBYQeQ.cjs +30238 -0
  41. package/dist/dagre-6UL2VRFP-DGQ6TW_g.cjs +693 -0
  42. package/dist/{dagre-6UL2VRFP-oJLNDO4O.js → dagre-6UL2VRFP-WmhUYWg8.js} +5 -5
  43. package/dist/defaultLocale-DwYGIg9G.cjs +203 -0
  44. package/dist/{diagram-PSM6KHXK-DhMgmu9h.js → diagram-PSM6KHXK-DSfHBoUT.js} +4 -4
  45. package/dist/diagram-PSM6KHXK-J4qyGeN7.cjs +845 -0
  46. package/dist/diagram-QEK2KX5R-D96wT5cH.cjs +300 -0
  47. package/dist/{diagram-QEK2KX5R-pB1vUeno.js → diagram-QEK2KX5R-I_nyexpY.js} +3 -3
  48. package/dist/diagram-S2PKOQOG-BC_WyKEe.cjs +210 -0
  49. package/dist/{diagram-S2PKOQOG-HTooIr24.js → diagram-S2PKOQOG-aooXSMNo.js} +3 -3
  50. package/dist/erDiagram-Q2GNP2WA-DQ8Lquay.cjs +1158 -0
  51. package/dist/{erDiagram-Q2GNP2WA-CCaN2EHf.js → erDiagram-Q2GNP2WA-DWF8e6EL.js} +4 -4
  52. package/dist/{flowDiagram-NV44I4VS-CG0erQtl.js → flowDiagram-NV44I4VS-CM9c4F1o.js} +5 -5
  53. package/dist/flowDiagram-NV44I4VS-DpYNkyM2.cjs +2331 -0
  54. package/dist/{ganttDiagram-JELNMOA3-D3rSLJec.js → ganttDiagram-JELNMOA3-CAsoD6rZ.js} +2 -2
  55. package/dist/ganttDiagram-JELNMOA3-DfKahpj4.cjs +3679 -0
  56. package/dist/{gitGraph-F6HP7TQM-BDWdXs6A.js → gitGraph-F6HP7TQM-BX2fz4_i.js} +1 -1
  57. package/dist/gitGraph-F6HP7TQM-DRkGg4T1.cjs +5 -0
  58. package/dist/{gitGraphDiagram-NY62KEGX-Ip-PiLDb.js → gitGraphDiagram-NY62KEGX-PXpI94u6.js} +4 -4
  59. package/dist/gitGraphDiagram-NY62KEGX-YhnKpooH.cjs +1203 -0
  60. package/dist/{graph-wCViE1vL.js → graph-BvxpI7Xc.js} +2 -2
  61. package/dist/graph-CI_TWBSn.cjs +595 -0
  62. package/dist/index-BctLGjTK.cjs +120500 -0
  63. package/dist/{index-BQvQI7yA.js → index-CjSgoo1P.js} +103324 -100141
  64. package/dist/index.cjs +19 -0
  65. package/dist/index.js +13 -1
  66. package/dist/info-NVLQJR56-BGbTE7dw.cjs +5 -0
  67. package/dist/info-NVLQJR56-DRxIh-N8.js +5 -0
  68. package/dist/infoDiagram-WHAUD3N6-BB2Bnbnh.cjs +31 -0
  69. package/dist/{infoDiagram-WHAUD3N6-BbVs4x8y.js → infoDiagram-WHAUD3N6-D_RrgwxS.js} +2 -2
  70. package/dist/init-DevvdK2U.cjs +15 -0
  71. package/dist/{journeyDiagram-XKPGCS4Q-Cz9ox9GA.js → journeyDiagram-XKPGCS4Q-BJjXlMIj.js} +4 -4
  72. package/dist/journeyDiagram-XKPGCS4Q-BcBLsfI9.cjs +1254 -0
  73. package/dist/{kanban-definition-3W4ZIXB7-ChdUHO5f.js → kanban-definition-3W4ZIXB7-0wwNBZ93.js} +2 -2
  74. package/dist/kanban-definition-3W4ZIXB7-CaY0q4j9.cjs +1047 -0
  75. package/dist/katex-BhpYeT3b.cjs +14523 -0
  76. package/dist/{layout-BaZPdTGN.js → layout-CcghncRv.js} +4 -4
  77. package/dist/layout-CvwzED_C.cjs +2182 -0
  78. package/dist/linear-CYow-mAK.cjs +339 -0
  79. package/dist/{linear-D_RX7hM-.js → linear-D_gKQzVp.js} +1 -1
  80. package/dist/mermaid-parser.core-CzmkR-3i.cjs +18703 -0
  81. package/dist/{mermaid-parser.core-_sn6A3wB.js → mermaid-parser.core-DCMDT-Cp.js} +10 -10
  82. package/dist/{min-BxeM4Drj.js → min-BBp7Smma.js} +2 -2
  83. package/dist/min-Gu1I_bJ9.cjs +40 -0
  84. package/dist/mindmap-definition-VGOIOE7T-D16Pp1u5.cjs +1126 -0
  85. package/dist/{mindmap-definition-VGOIOE7T-BkjJibdi.js → mindmap-definition-VGOIOE7T-PjSLRtz4.js} +3 -3
  86. package/dist/ordinal-D7sQNqXZ.cjs +75 -0
  87. package/dist/{packet-BFZMPI3H-D3RtU0mc.js → packet-BFZMPI3H-BvdogPiS.js} +1 -1
  88. package/dist/packet-BFZMPI3H-C7pOHUWY.cjs +5 -0
  89. package/dist/pie-7BOR55EZ-D-DxSHbP.cjs +5 -0
  90. package/dist/pie-7BOR55EZ-DEWJe4Xn.js +5 -0
  91. package/dist/{pieDiagram-ADFJNKIX-2Yr1gkth.js → pieDiagram-ADFJNKIX-CoDddKZl.js} +4 -4
  92. package/dist/pieDiagram-ADFJNKIX-DjN4DU9l.cjs +237 -0
  93. package/dist/{quadrantDiagram-AYHSOK5B-CjicpXRv.js → quadrantDiagram-AYHSOK5B-BZOg0JMm.js} +2 -2
  94. package/dist/quadrantDiagram-AYHSOK5B-DXjTSOL4.cjs +1335 -0
  95. package/dist/radar-NHE76QYJ-BrnDXy9q.cjs +5 -0
  96. package/dist/{radar-NHE76QYJ-CL0tHnUP.js → radar-NHE76QYJ-C2WmPmJ4.js} +1 -1
  97. package/dist/{requirementDiagram-UZGBJVZJ-DBnhlfjR.js → requirementDiagram-UZGBJVZJ-CCW1O1xH.js} +3 -3
  98. package/dist/requirementDiagram-UZGBJVZJ-e5F3-dDI.cjs +1161 -0
  99. package/dist/{sankeyDiagram-TZEHDZUN-B2FErKCa.js → sankeyDiagram-TZEHDZUN-BaGzCxTp.js} +1 -1
  100. package/dist/sankeyDiagram-TZEHDZUN-DtIvOvVI.cjs +1193 -0
  101. package/dist/sequenceDiagram-WL72ISMW-0vFhYnxn.cjs +3874 -0
  102. package/dist/{sequenceDiagram-WL72ISMW-BkNTlRlB.js → sequenceDiagram-WL72ISMW-DL3B7U56.js} +3 -3
  103. package/dist/stateDiagram-FKZM4ZOC-CXW608BR.cjs +447 -0
  104. package/dist/{stateDiagram-FKZM4ZOC-CAAFQtS9.js → stateDiagram-FKZM4ZOC-Ddw6HxPD.js} +4 -4
  105. package/dist/{stateDiagram-v2-4FDKWEC3-lF6kUebI.js → stateDiagram-v2-4FDKWEC3-DZCkQKmp.js} +2 -2
  106. package/dist/stateDiagram-v2-4FDKWEC3-DefWUbvq.cjs +19 -0
  107. package/dist/timeline-definition-IT6M3QCI-C3TfA9lE.cjs +1222 -0
  108. package/dist/{timeline-definition-IT6M3QCI-CQgMFEPA.js → timeline-definition-IT6M3QCI-DiS88lUo.js} +2 -2
  109. package/dist/treemap-KMMF4GRG-Bl-H6j2c.cjs +5 -0
  110. package/dist/{treemap-KMMF4GRG-B0Mc-u8X.js → treemap-KMMF4GRG-DGGr_R9A.js} +1 -1
  111. package/dist/{xychartDiagram-PRI3JC2R-Cee7LdLr.js → xychartDiagram-PRI3JC2R-BrOwRjfF.js} +2 -2
  112. package/dist/xychartDiagram-PRI3JC2R-CM06DttH.cjs +1886 -0
  113. package/package.json +17 -5
  114. package/dist/index.css +0 -3334
  115. package/dist/info-NVLQJR56-pJlVBPs6.js +0 -5
  116. package/dist/pie-7BOR55EZ-xH--CiaM.js +0 -5
@@ -1,7 +1,7 @@
1
1
  var _a;
2
- import { a as drawBackgroundRect, b as getTextObj, g as getNoteRect, d as drawRect, c as drawEmbeddedImage, e as drawImage } from "./chunk-TZMSLE5B-C7te_j4V.js";
3
- import { _ as __name, n as setConfig2, c as getConfig2, d as select, l as log, j as distExports, e as configureSvgSize, f as assignWithDepth_default, k as common_default, b as setAccTitle, s as setAccDescription, p as setDiagramTitle, a as getAccTitle, g as getAccDescription, q as getDiagramTitle, t as load, J as JSON_SCHEMA, y as clear, i as sanitizeText, u as utils_default, L as hasKatex, M as calculateMathMLDimensions, N as parseFontSize, Z as ZERO_WIDTH_SPACE, O as getUrl, P as renderKatexSanitized, E as getConfig } from "./index-BQvQI7yA.js";
4
- import { I as ImperativeState } from "./chunk-QZHKN3VN-DdcyNnvM.js";
2
+ import { a as drawBackgroundRect, b as getTextObj, g as getNoteRect, d as drawRect, c as drawEmbeddedImage, e as drawImage } from "./chunk-TZMSLE5B-ZQ2Esoix.js";
3
+ import { _ as __name, n as setConfig2, c as getConfig2, d as select, l as log, j as distExports, e as configureSvgSize, f as assignWithDepth_default, k as common_default, b as setAccTitle, s as setAccDescription, p as setDiagramTitle, a as getAccTitle, g as getAccDescription, q as getDiagramTitle, t as load, J as JSON_SCHEMA, y as clear, i as sanitizeText, u as utils_default, L as hasKatex, M as calculateMathMLDimensions, N as parseFontSize, Z as ZERO_WIDTH_SPACE, O as getUrl, P as renderKatexSanitized, E as getConfig } from "./index-CjSgoo1P.js";
4
+ import { I as ImperativeState } from "./chunk-QZHKN3VN-BweiBR9P.js";
5
5
  var parser = (function() {
6
6
  var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
7
7
  for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
@@ -0,0 +1,447 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const chunkDI55MBZ5 = require("./chunk-DI55MBZ5-Dk0kfYBV.cjs");
4
+ const index = require("./index-BctLGjTK.cjs");
5
+ const graph = require("./graph-CI_TWBSn.cjs");
6
+ const layout = require("./layout-CvwzED_C.cjs");
7
+ var drawStartState = /* @__PURE__ */ index.__name((g) => g.append("circle").attr("class", "start-state").attr("r", index.getConfig2().state.sizeUnit).attr("cx", index.getConfig2().state.padding + index.getConfig2().state.sizeUnit).attr("cy", index.getConfig2().state.padding + index.getConfig2().state.sizeUnit), "drawStartState");
8
+ var drawDivider = /* @__PURE__ */ index.__name((g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", index.getConfig2().state.textHeight).attr("class", "divider").attr("x2", index.getConfig2().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider");
9
+ var drawSimpleState = /* @__PURE__ */ index.__name((g, stateDef) => {
10
+ const state = g.append("text").attr("x", 2 * index.getConfig2().state.padding).attr("y", index.getConfig2().state.textHeight + 2 * index.getConfig2().state.padding).attr("font-size", index.getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id);
11
+ const classBox = state.node().getBBox();
12
+ g.insert("rect", ":first-child").attr("x", index.getConfig2().state.padding).attr("y", index.getConfig2().state.padding).attr("width", classBox.width + 2 * index.getConfig2().state.padding).attr("height", classBox.height + 2 * index.getConfig2().state.padding).attr("rx", index.getConfig2().state.radius);
13
+ return state;
14
+ }, "drawSimpleState");
15
+ var drawDescrState = /* @__PURE__ */ index.__name((g, stateDef) => {
16
+ const addTspan = /* @__PURE__ */ index.__name(function(textEl, txt, isFirst2) {
17
+ const tSpan = textEl.append("tspan").attr("x", 2 * index.getConfig2().state.padding).text(txt);
18
+ if (!isFirst2) {
19
+ tSpan.attr("dy", index.getConfig2().state.textHeight);
20
+ }
21
+ }, "addTspan");
22
+ const title = g.append("text").attr("x", 2 * index.getConfig2().state.padding).attr("y", index.getConfig2().state.textHeight + 1.3 * index.getConfig2().state.padding).attr("font-size", index.getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
23
+ const titleBox = title.node().getBBox();
24
+ const titleHeight = titleBox.height;
25
+ const description = g.append("text").attr("x", index.getConfig2().state.padding).attr(
26
+ "y",
27
+ titleHeight + index.getConfig2().state.padding * 0.4 + index.getConfig2().state.dividerMargin + index.getConfig2().state.textHeight
28
+ ).attr("class", "state-description");
29
+ let isFirst = true;
30
+ let isSecond = true;
31
+ stateDef.descriptions.forEach(function(descr) {
32
+ if (!isFirst) {
33
+ addTspan(description, descr, isSecond);
34
+ isSecond = false;
35
+ }
36
+ isFirst = false;
37
+ });
38
+ const descrLine = g.append("line").attr("x1", index.getConfig2().state.padding).attr("y1", index.getConfig2().state.padding + titleHeight + index.getConfig2().state.dividerMargin / 2).attr("y2", index.getConfig2().state.padding + titleHeight + index.getConfig2().state.dividerMargin / 2).attr("class", "descr-divider");
39
+ const descrBox = description.node().getBBox();
40
+ const width = Math.max(descrBox.width, titleBox.width);
41
+ descrLine.attr("x2", width + 3 * index.getConfig2().state.padding);
42
+ g.insert("rect", ":first-child").attr("x", index.getConfig2().state.padding).attr("y", index.getConfig2().state.padding).attr("width", width + 2 * index.getConfig2().state.padding).attr("height", descrBox.height + titleHeight + 2 * index.getConfig2().state.padding).attr("rx", index.getConfig2().state.radius);
43
+ return g;
44
+ }, "drawDescrState");
45
+ var addTitleAndBox = /* @__PURE__ */ index.__name((g, stateDef, altBkg) => {
46
+ const pad = index.getConfig2().state.padding;
47
+ const dblPad = 2 * index.getConfig2().state.padding;
48
+ const orgBox = g.node().getBBox();
49
+ const orgWidth = orgBox.width;
50
+ const orgX = orgBox.x;
51
+ const title = g.append("text").attr("x", 0).attr("y", index.getConfig2().state.titleShift).attr("font-size", index.getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id);
52
+ const titleBox = title.node().getBBox();
53
+ const titleWidth = titleBox.width + dblPad;
54
+ let width = Math.max(titleWidth, orgWidth);
55
+ if (width === orgWidth) {
56
+ width = width + dblPad;
57
+ }
58
+ let startX;
59
+ const graphBox = g.node().getBBox();
60
+ if (stateDef.doc) ;
61
+ startX = orgX - pad;
62
+ if (titleWidth > orgWidth) {
63
+ startX = (orgWidth - width) / 2 + pad;
64
+ }
65
+ if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {
66
+ startX = orgX - (titleWidth - orgWidth) / 2;
67
+ }
68
+ const lineY = 1 - index.getConfig2().state.textHeight;
69
+ g.insert("rect", ":first-child").attr("x", startX).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width).attr(
70
+ "height",
71
+ graphBox.height + index.getConfig2().state.textHeight + index.getConfig2().state.titleShift + 1
72
+ ).attr("rx", "0");
73
+ title.attr("x", startX + pad);
74
+ if (titleWidth <= orgWidth) {
75
+ title.attr("x", orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);
76
+ }
77
+ g.insert("rect", ":first-child").attr("x", startX).attr(
78
+ "y",
79
+ index.getConfig2().state.titleShift - index.getConfig2().state.textHeight - index.getConfig2().state.padding
80
+ ).attr("width", width).attr("height", index.getConfig2().state.textHeight * 3).attr("rx", index.getConfig2().state.radius);
81
+ g.insert("rect", ":first-child").attr("x", startX).attr(
82
+ "y",
83
+ index.getConfig2().state.titleShift - index.getConfig2().state.textHeight - index.getConfig2().state.padding
84
+ ).attr("width", width).attr("height", graphBox.height + 3 + 2 * index.getConfig2().state.textHeight).attr("rx", index.getConfig2().state.radius);
85
+ return g;
86
+ }, "addTitleAndBox");
87
+ var drawEndState = /* @__PURE__ */ index.__name((g) => {
88
+ g.append("circle").attr("class", "end-state-outer").attr("r", index.getConfig2().state.sizeUnit + index.getConfig2().state.miniPadding).attr(
89
+ "cx",
90
+ index.getConfig2().state.padding + index.getConfig2().state.sizeUnit + index.getConfig2().state.miniPadding
91
+ ).attr(
92
+ "cy",
93
+ index.getConfig2().state.padding + index.getConfig2().state.sizeUnit + index.getConfig2().state.miniPadding
94
+ );
95
+ return g.append("circle").attr("class", "end-state-inner").attr("r", index.getConfig2().state.sizeUnit).attr("cx", index.getConfig2().state.padding + index.getConfig2().state.sizeUnit + 2).attr("cy", index.getConfig2().state.padding + index.getConfig2().state.sizeUnit + 2);
96
+ }, "drawEndState");
97
+ var drawForkJoinState = /* @__PURE__ */ index.__name((g, stateDef) => {
98
+ let width = index.getConfig2().state.forkWidth;
99
+ let height = index.getConfig2().state.forkHeight;
100
+ if (stateDef.parentId) {
101
+ let tmp = width;
102
+ width = height;
103
+ height = tmp;
104
+ }
105
+ return g.append("rect").style("stroke", "black").style("fill", "black").attr("width", width).attr("height", height).attr("x", index.getConfig2().state.padding).attr("y", index.getConfig2().state.padding);
106
+ }, "drawForkJoinState");
107
+ var _drawLongText = /* @__PURE__ */ index.__name((_text, x, y, g) => {
108
+ let textHeight = 0;
109
+ const textElem = g.append("text");
110
+ textElem.style("text-anchor", "start");
111
+ textElem.attr("class", "noteText");
112
+ let text = _text.replace(/\r\n/g, "<br/>");
113
+ text = text.replace(/\n/g, "<br/>");
114
+ const lines = text.split(index.common_default.lineBreakRegex);
115
+ let tHeight = 1.25 * index.getConfig2().state.noteMargin;
116
+ for (const line2 of lines) {
117
+ const txt = line2.trim();
118
+ if (txt.length > 0) {
119
+ const span = textElem.append("tspan");
120
+ span.text(txt);
121
+ if (tHeight === 0) {
122
+ const textBounds = span.node().getBBox();
123
+ tHeight += textBounds.height;
124
+ }
125
+ textHeight += tHeight;
126
+ span.attr("x", x + index.getConfig2().state.noteMargin);
127
+ span.attr("y", y + textHeight + 1.25 * index.getConfig2().state.noteMargin);
128
+ }
129
+ }
130
+ return { textWidth: textElem.node().getBBox().width, textHeight };
131
+ }, "_drawLongText");
132
+ var drawNote = /* @__PURE__ */ index.__name((text, g) => {
133
+ g.attr("class", "state-note");
134
+ const note = g.append("rect").attr("x", 0).attr("y", index.getConfig2().state.padding);
135
+ const rectElem = g.append("g");
136
+ const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
137
+ note.attr("height", textHeight + 2 * index.getConfig2().state.noteMargin);
138
+ note.attr("width", textWidth + index.getConfig2().state.noteMargin * 2);
139
+ return note;
140
+ }, "drawNote");
141
+ var drawState = /* @__PURE__ */ index.__name(function(elem, stateDef) {
142
+ const id = stateDef.id;
143
+ const stateInfo = {
144
+ id,
145
+ label: stateDef.id,
146
+ width: 0,
147
+ height: 0
148
+ };
149
+ const g = elem.append("g").attr("id", id).attr("class", "stateGroup");
150
+ if (stateDef.type === "start") {
151
+ drawStartState(g);
152
+ }
153
+ if (stateDef.type === "end") {
154
+ drawEndState(g);
155
+ }
156
+ if (stateDef.type === "fork" || stateDef.type === "join") {
157
+ drawForkJoinState(g, stateDef);
158
+ }
159
+ if (stateDef.type === "note") {
160
+ drawNote(stateDef.note.text, g);
161
+ }
162
+ if (stateDef.type === "divider") {
163
+ drawDivider(g);
164
+ }
165
+ if (stateDef.type === "default" && stateDef.descriptions.length === 0) {
166
+ drawSimpleState(g, stateDef);
167
+ }
168
+ if (stateDef.type === "default" && stateDef.descriptions.length > 0) {
169
+ drawDescrState(g, stateDef);
170
+ }
171
+ const stateBox = g.node().getBBox();
172
+ stateInfo.width = stateBox.width + 2 * index.getConfig2().state.padding;
173
+ stateInfo.height = stateBox.height + 2 * index.getConfig2().state.padding;
174
+ return stateInfo;
175
+ }, "drawState");
176
+ var edgeCount = 0;
177
+ var drawEdge = /* @__PURE__ */ index.__name(function(elem, path, relation) {
178
+ const getRelationType = /* @__PURE__ */ index.__name(function(type) {
179
+ switch (type) {
180
+ case chunkDI55MBZ5.StateDB.relationType.AGGREGATION:
181
+ return "aggregation";
182
+ case chunkDI55MBZ5.StateDB.relationType.EXTENSION:
183
+ return "extension";
184
+ case chunkDI55MBZ5.StateDB.relationType.COMPOSITION:
185
+ return "composition";
186
+ case chunkDI55MBZ5.StateDB.relationType.DEPENDENCY:
187
+ return "dependency";
188
+ }
189
+ }, "getRelationType");
190
+ path.points = path.points.filter((p) => !Number.isNaN(p.y));
191
+ const lineData = path.points;
192
+ const lineFunction = index.line().x(function(d) {
193
+ return d.x;
194
+ }).y(function(d) {
195
+ return d.y;
196
+ }).curve(index.curveBasis);
197
+ const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition");
198
+ let url = "";
199
+ if (index.getConfig2().state.arrowMarkerAbsolute) {
200
+ url = index.getUrl(true);
201
+ }
202
+ svgPath.attr(
203
+ "marker-end",
204
+ "url(" + url + "#" + getRelationType(chunkDI55MBZ5.StateDB.relationType.DEPENDENCY) + "End)"
205
+ );
206
+ if (relation.title !== void 0) {
207
+ const label = elem.append("g").attr("class", "stateLabel");
208
+ const { x, y } = index.utils_default.calcLabelPosition(path.points);
209
+ const rows = index.common_default.getRows(relation.title);
210
+ let titleHeight = 0;
211
+ const titleRows = [];
212
+ let maxWidth = 0;
213
+ let minX = 0;
214
+ for (let i = 0; i <= rows.length; i++) {
215
+ const title = label.append("text").attr("text-anchor", "middle").text(rows[i]).attr("x", x).attr("y", y + titleHeight);
216
+ const boundsTmp = title.node().getBBox();
217
+ maxWidth = Math.max(maxWidth, boundsTmp.width);
218
+ minX = Math.min(minX, boundsTmp.x);
219
+ index.log.info(boundsTmp.x, x, y + titleHeight);
220
+ if (titleHeight === 0) {
221
+ const titleBox = title.node().getBBox();
222
+ titleHeight = titleBox.height;
223
+ index.log.info("Title height", titleHeight, y);
224
+ }
225
+ titleRows.push(title);
226
+ }
227
+ let boxHeight = titleHeight * rows.length;
228
+ if (rows.length > 1) {
229
+ const heightAdj = (rows.length - 1) * titleHeight * 0.5;
230
+ titleRows.forEach((title, i) => title.attr("y", y + i * titleHeight - heightAdj));
231
+ boxHeight = titleHeight * rows.length;
232
+ }
233
+ const bounds = label.node().getBBox();
234
+ label.insert("rect", ":first-child").attr("class", "box").attr("x", x - maxWidth / 2 - index.getConfig2().state.padding / 2).attr("y", y - boxHeight / 2 - index.getConfig2().state.padding / 2 - 3.5).attr("width", maxWidth + index.getConfig2().state.padding).attr("height", boxHeight + index.getConfig2().state.padding);
235
+ index.log.info(bounds);
236
+ }
237
+ edgeCount++;
238
+ }, "drawEdge");
239
+ var conf;
240
+ var transformationLog = {};
241
+ var setConf = /* @__PURE__ */ index.__name(function() {
242
+ }, "setConf");
243
+ var insertMarkers = /* @__PURE__ */ index.__name(function(elem) {
244
+ 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");
245
+ }, "insertMarkers");
246
+ var draw = /* @__PURE__ */ index.__name(function(text, id, _version, diagObj) {
247
+ conf = index.getConfig2().state;
248
+ const securityLevel = index.getConfig2().securityLevel;
249
+ let sandboxElement;
250
+ if (securityLevel === "sandbox") {
251
+ sandboxElement = index.select("#i" + id);
252
+ }
253
+ const root = securityLevel === "sandbox" ? index.select(sandboxElement.nodes()[0].contentDocument.body) : index.select("body");
254
+ const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
255
+ index.log.debug("Rendering diagram " + text);
256
+ const diagram2 = root.select(`[id='${id}']`);
257
+ insertMarkers(diagram2);
258
+ const rootDoc = diagObj.db.getRootDoc();
259
+ renderDoc(rootDoc, diagram2, void 0, false, root, doc, diagObj);
260
+ const padding = conf.padding;
261
+ const bounds = diagram2.node().getBBox();
262
+ const width = bounds.width + padding * 2;
263
+ const height = bounds.height + padding * 2;
264
+ const svgWidth = width * 1.75;
265
+ index.configureSvgSize(diagram2, height, svgWidth, conf.useMaxWidth);
266
+ diagram2.attr(
267
+ "viewBox",
268
+ `${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + " " + height
269
+ );
270
+ }, "draw");
271
+ var getLabelWidth = /* @__PURE__ */ index.__name((text) => {
272
+ return text ? text.length * conf.fontSizeFactor : 1;
273
+ }, "getLabelWidth");
274
+ var renderDoc = /* @__PURE__ */ index.__name((doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
275
+ const graph$1 = new graph.Graph({
276
+ compound: true,
277
+ multigraph: true
278
+ });
279
+ let i;
280
+ let edgeFreeDoc = true;
281
+ for (i = 0; i < doc.length; i++) {
282
+ if (doc[i].stmt === "relation") {
283
+ edgeFreeDoc = false;
284
+ break;
285
+ }
286
+ }
287
+ if (parentId) {
288
+ graph$1.setGraph({
289
+ rankdir: "LR",
290
+ multigraph: true,
291
+ compound: true,
292
+ // acyclicer: 'greedy',
293
+ ranker: "tight-tree",
294
+ ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
295
+ nodeSep: edgeFreeDoc ? 1 : 50,
296
+ isMultiGraph: true
297
+ // ranksep: 5,
298
+ // nodesep: 1
299
+ });
300
+ } else {
301
+ graph$1.setGraph({
302
+ rankdir: "TB",
303
+ multigraph: true,
304
+ compound: true,
305
+ // isCompound: true,
306
+ // acyclicer: 'greedy',
307
+ // ranker: 'longest-path'
308
+ ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
309
+ nodeSep: edgeFreeDoc ? 1 : 50,
310
+ ranker: "tight-tree",
311
+ // ranker: 'network-simplex'
312
+ isMultiGraph: true
313
+ });
314
+ }
315
+ graph$1.setDefaultEdgeLabel(function() {
316
+ return {};
317
+ });
318
+ const states = diagObj.db.getStates();
319
+ const relations = diagObj.db.getRelations();
320
+ const keys = Object.keys(states);
321
+ for (const key of keys) {
322
+ const stateDef = states[key];
323
+ if (parentId) {
324
+ stateDef.parentId = parentId;
325
+ }
326
+ let node;
327
+ if (stateDef.doc) {
328
+ let sub = diagram2.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
329
+ node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
330
+ {
331
+ sub = addTitleAndBox(sub, stateDef, altBkg);
332
+ let boxBounds = sub.node().getBBox();
333
+ node.width = boxBounds.width;
334
+ node.height = boxBounds.height + conf.padding / 2;
335
+ transformationLog[stateDef.id] = { y: conf.compositTitleSize };
336
+ }
337
+ } else {
338
+ node = drawState(diagram2, stateDef, graph$1);
339
+ }
340
+ if (stateDef.note) {
341
+ const noteDef = {
342
+ descriptions: [],
343
+ id: stateDef.id + "-note",
344
+ note: stateDef.note,
345
+ type: "note"
346
+ };
347
+ const note = drawState(diagram2, noteDef, graph$1);
348
+ if (stateDef.note.position === "left of") {
349
+ graph$1.setNode(node.id + "-note", note);
350
+ graph$1.setNode(node.id, node);
351
+ } else {
352
+ graph$1.setNode(node.id, node);
353
+ graph$1.setNode(node.id + "-note", note);
354
+ }
355
+ graph$1.setParent(node.id, node.id + "-group");
356
+ graph$1.setParent(node.id + "-note", node.id + "-group");
357
+ } else {
358
+ graph$1.setNode(node.id, node);
359
+ }
360
+ }
361
+ index.log.debug("Count=", graph$1.nodeCount(), graph$1);
362
+ let cnt = 0;
363
+ relations.forEach(function(relation) {
364
+ cnt++;
365
+ index.log.debug("Setting edge", relation);
366
+ graph$1.setEdge(
367
+ relation.id1,
368
+ relation.id2,
369
+ {
370
+ relation,
371
+ width: getLabelWidth(relation.title),
372
+ height: conf.labelHeight * index.common_default.getRows(relation.title).length,
373
+ labelpos: "c"
374
+ },
375
+ "id" + cnt
376
+ );
377
+ });
378
+ layout.layout(graph$1);
379
+ index.log.debug("Graph after layout", graph$1.nodes());
380
+ const svgElem = diagram2.node();
381
+ graph$1.nodes().forEach(function(v) {
382
+ if (v !== void 0 && graph$1.node(v) !== void 0) {
383
+ index.log.warn("Node " + v + ": " + JSON.stringify(graph$1.node(v)));
384
+ root.select("#" + svgElem.id + " #" + v).attr(
385
+ "transform",
386
+ "translate(" + (graph$1.node(v).x - graph$1.node(v).width / 2) + "," + (graph$1.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph$1.node(v).height / 2) + " )"
387
+ );
388
+ root.select("#" + svgElem.id + " #" + v).attr("data-x-shift", graph$1.node(v).x - graph$1.node(v).width / 2);
389
+ const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v + " .divider");
390
+ dividers.forEach((divider) => {
391
+ const parent = divider.parentElement;
392
+ let pWidth = 0;
393
+ let pShift = 0;
394
+ if (parent) {
395
+ if (parent.parentElement) {
396
+ pWidth = parent.parentElement.getBBox().width;
397
+ }
398
+ pShift = parseInt(parent.getAttribute("data-x-shift"), 10);
399
+ if (Number.isNaN(pShift)) {
400
+ pShift = 0;
401
+ }
402
+ }
403
+ divider.setAttribute("x1", 0 - pShift + 8);
404
+ divider.setAttribute("x2", pWidth - pShift - 8);
405
+ });
406
+ } else {
407
+ index.log.debug("No Node " + v + ": " + JSON.stringify(graph$1.node(v)));
408
+ }
409
+ });
410
+ let stateBox = svgElem.getBBox();
411
+ graph$1.edges().forEach(function(e) {
412
+ if (e !== void 0 && graph$1.edge(e) !== void 0) {
413
+ index.log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph$1.edge(e)));
414
+ drawEdge(diagram2, graph$1.edge(e), graph$1.edge(e).relation);
415
+ }
416
+ });
417
+ stateBox = svgElem.getBBox();
418
+ const stateInfo = {
419
+ id: parentId ? parentId : "root",
420
+ label: parentId ? parentId : "root",
421
+ width: 0,
422
+ height: 0
423
+ };
424
+ stateInfo.width = stateBox.width + 2 * conf.padding;
425
+ stateInfo.height = stateBox.height + 2 * conf.padding;
426
+ index.log.debug("Doc rendered", stateInfo, graph$1);
427
+ return stateInfo;
428
+ }, "renderDoc");
429
+ var stateRenderer_default = {
430
+ setConf,
431
+ draw
432
+ };
433
+ var diagram = {
434
+ parser: chunkDI55MBZ5.stateDiagram_default,
435
+ get db() {
436
+ return new chunkDI55MBZ5.StateDB(1);
437
+ },
438
+ renderer: stateRenderer_default,
439
+ styles: chunkDI55MBZ5.styles_default,
440
+ init: /* @__PURE__ */ index.__name((cnf) => {
441
+ if (!cnf.state) {
442
+ cnf.state = {};
443
+ }
444
+ cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
445
+ }, "init")
446
+ };
447
+ exports.diagram = diagram;
@@ -1,7 +1,7 @@
1
- import { s as styles_default, a as stateDiagram_default, S as StateDB } from "./chunk-DI55MBZ5-GTHMAr0M.js";
2
- import { _ as __name, c as getConfig2, d as select, l as log, e as configureSvgSize, k as common_default, R as line, S as curveBasis, O as getUrl, u as utils_default } from "./index-BQvQI7yA.js";
3
- import { G as Graph } from "./graph-wCViE1vL.js";
4
- import { l as layout } from "./layout-BaZPdTGN.js";
1
+ import { s as styles_default, a as stateDiagram_default, S as StateDB } from "./chunk-DI55MBZ5-DpHw-vMw.js";
2
+ import { _ as __name, c as getConfig2, d as select, l as log, e as configureSvgSize, k as common_default, R as line, S as curveBasis, O as getUrl, u as utils_default } from "./index-CjSgoo1P.js";
3
+ import { G as Graph } from "./graph-BvxpI7Xc.js";
4
+ import { l as layout } from "./layout-CcghncRv.js";
5
5
  var drawStartState = /* @__PURE__ */ __name((g) => g.append("circle").attr("class", "start-state").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit), "drawStartState");
6
6
  var drawDivider = /* @__PURE__ */ __name((g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig2().state.textHeight).attr("class", "divider").attr("x2", getConfig2().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider");
7
7
  var drawSimpleState = /* @__PURE__ */ __name((g, stateDef) => {
@@ -1,5 +1,5 @@
1
- import { s as styles_default, b as stateRenderer_v3_unified_default, a as stateDiagram_default, S as StateDB } from "./chunk-DI55MBZ5-GTHMAr0M.js";
2
- import { _ as __name } from "./index-BQvQI7yA.js";
1
+ import { s as styles_default, b as stateRenderer_v3_unified_default, a as stateDiagram_default, S as StateDB } from "./chunk-DI55MBZ5-DpHw-vMw.js";
2
+ import { _ as __name } from "./index-CjSgoo1P.js";
3
3
  var diagram = {
4
4
  parser: stateDiagram_default,
5
5
  get db() {
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const chunkDI55MBZ5 = require("./chunk-DI55MBZ5-Dk0kfYBV.cjs");
4
+ const index = require("./index-BctLGjTK.cjs");
5
+ var diagram = {
6
+ parser: chunkDI55MBZ5.stateDiagram_default,
7
+ get db() {
8
+ return new chunkDI55MBZ5.StateDB(2);
9
+ },
10
+ renderer: chunkDI55MBZ5.stateRenderer_v3_unified_default,
11
+ styles: chunkDI55MBZ5.styles_default,
12
+ init: /* @__PURE__ */ index.__name((cnf) => {
13
+ if (!cnf.state) {
14
+ cnf.state = {};
15
+ }
16
+ cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
17
+ }, "init")
18
+ };
19
+ exports.diagram = diagram;