@yiyi_zhang/reactflow-ui 0.3.0 → 0.5.0-beta.0

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 (110) hide show
  1. package/README.md +61 -22
  2. package/dist/AiWorkflowIDE.d.ts +217 -0
  3. package/dist/WorkflowIDE.d.ts +22 -3
  4. package/dist/ai-BJwQZcGK.js +15168 -0
  5. package/dist/ai.d.ts +30 -0
  6. package/dist/arc-BUGZGgtu.js +83 -0
  7. package/dist/architectureDiagram-3BPJPVTR-ZcgvTwSO.js +4692 -0
  8. package/dist/blockDiagram-GPEHLZMM-DtVtOBbH.js +2418 -0
  9. package/dist/c4Diagram-AAUBKEIU-tBS5Rcvm.js +1577 -0
  10. package/dist/channel-CURI9jmI.js +5 -0
  11. package/dist/chunk-2J33WTMH-D7gashNz.js +19 -0
  12. package/dist/chunk-4BX2VUAB-DE3VjyiZ.js +8 -0
  13. package/dist/chunk-55IACEB6-GYZ_m2MY.js +8 -0
  14. package/dist/chunk-727SXJPM-D4WVyvOg.js +1528 -0
  15. package/dist/chunk-AQP2D5EJ-Os2Uwqya.js +1387 -0
  16. package/dist/chunk-FMBD7UC4-B3CSVzS4.js +19 -0
  17. package/dist/chunk-ND2GUHAM-CNj_s1aK.js +68 -0
  18. package/dist/chunk-QZHKN3VN-DoV8iUKo.js +15 -0
  19. package/dist/classDiagram-4FO5ZUOK-Dr9C18x4.js +16 -0
  20. package/dist/classDiagram-v2-Q7XG4LA2-Dr9C18x4.js +16 -0
  21. package/dist/components/AiNative/AgentTimeline.d.ts +18 -0
  22. package/dist/components/AiNative/AiCommandCenter.d.ts +40 -0
  23. package/dist/components/AiNative/AiConfigPanel.d.ts +9 -0
  24. package/dist/components/AiNative/BusinessCanvas.d.ts +15 -0
  25. package/dist/components/AiNative/CanvasPreview.d.ts +16 -0
  26. package/dist/components/AiNative/ClarificationCard.d.ts +9 -0
  27. package/dist/components/AiNative/FailureSummaryCard.d.ts +20 -0
  28. package/dist/components/AiNative/LibraryPanel.d.ts +9 -0
  29. package/dist/components/AiNative/MermaidBlock.d.ts +6 -0
  30. package/dist/components/AiNative/PlanCard.d.ts +15 -0
  31. package/dist/components/AiNative/ProposalPreviewCard.d.ts +21 -0
  32. package/dist/components/AiNative/RecommendationCard.d.ts +10 -0
  33. package/dist/components/AiNative/RepairCard.d.ts +17 -0
  34. package/dist/components/AiNative/ReviewBar.d.ts +21 -0
  35. package/dist/components/AiNative/WorkflowRunCard.d.ts +14 -0
  36. package/dist/components/Controls/ModeSlider.d.ts +2 -0
  37. package/dist/components/ExecutionSummaryPanel.d.ts +4 -0
  38. package/dist/components/WorkflowRunPanel.d.ts +12 -0
  39. package/dist/components/nodes/NodeWrapper.d.ts +2 -1
  40. package/dist/cose-bilkent-S5V4N54A-CgQlI-io.js +2609 -0
  41. package/dist/cytoscape.esm-kVAWcYoG.js +18755 -0
  42. package/dist/dagre-BM42HDAG-CFMIuOmS.js +445 -0
  43. package/dist/defaultLocale-BgPVtth8.js +171 -0
  44. package/dist/diagram-2AECGRRQ-C5jZp2YX.js +217 -0
  45. package/dist/diagram-5GNKFQAL-DRUVcHpp.js +123 -0
  46. package/dist/diagram-KO2AKTUF-BOl4aaej.js +461 -0
  47. package/dist/diagram-LMA3HP47-ZeckPR2Q.js +142 -0
  48. package/dist/diagram-OG6HWLK6-qUWeLfa-.js +528 -0
  49. package/dist/erDiagram-TEJ5UH35-Bw_CWS13.js +899 -0
  50. package/dist/flowDiagram-I6XJVG4X-D3xEvQA-.js +1628 -0
  51. package/dist/ganttDiagram-6RSMTGT7-D8GvenY3.js +2707 -0
  52. package/dist/gitGraphDiagram-PVQCEYII-BWrN_HOm.js +815 -0
  53. package/dist/graph-BRoPeNF3.js +1545 -0
  54. package/dist/hooks/useNodeExecution.d.ts +1 -1
  55. package/dist/hooks/useNodeLayout.d.ts +1 -1
  56. package/dist/index.d.ts +3 -2
  57. package/dist/infoDiagram-5YYISTIA-Da8FG5tB.js +24 -0
  58. package/dist/init-DjUOC4st.js +16 -0
  59. package/dist/ishikawaDiagram-YF4QCWOH-Bg2_mKEc.js +621 -0
  60. package/dist/journeyDiagram-JHISSGLW-sFIxGfua.js +834 -0
  61. package/dist/kanban-definition-UN3LZRKU-CGmopzHd.js +724 -0
  62. package/dist/katex-DoRnZ_sp.js +11682 -0
  63. package/dist/layout-D9EpM4Fg.js +1728 -0
  64. package/dist/linear-BA49eco4.js +259 -0
  65. package/dist/mermaid.core-XSpZEAKP.js +16137 -0
  66. package/dist/mindmap-definition-RKZ34NQL-Bqf76QGB.js +827 -0
  67. package/dist/ordinal-B6-f3MAq.js +61 -0
  68. package/dist/pieDiagram-4H26LBE5-hHiP8HzL.js +163 -0
  69. package/dist/quadrantDiagram-W4KKPZXB-DSccwH8B.js +1024 -0
  70. package/dist/reactflow-ui-ai.es.js +12 -0
  71. package/dist/reactflow-ui.css +1 -1
  72. package/dist/reactflow-ui.es.js +8198 -7039
  73. package/dist/reactflow-ui.umd.js +52 -17
  74. package/dist/requirementDiagram-4Y6WPE33-DIpyoYZ_.js +882 -0
  75. package/dist/sankeyDiagram-5OEKKPKP-DsaPqq8D.js +847 -0
  76. package/dist/sequenceDiagram-3UESZ5HK-BNg7orie.js +2891 -0
  77. package/dist/services/ai/agentRunner.d.ts +51 -0
  78. package/dist/services/ai/contextEngine.d.ts +83 -0
  79. package/dist/services/ai/draftPersistence.d.ts +22 -0
  80. package/dist/services/ai/errorMessages.d.ts +16 -0
  81. package/dist/services/ai/intentClassifier.d.ts +17 -0
  82. package/dist/services/ai/protocolAdapter.d.ts +114 -0
  83. package/dist/services/ai/ruleEngine.d.ts +57 -0
  84. package/dist/services/ai/schemaRegistry.d.ts +51 -0
  85. package/dist/services/ai/systemPrompt.d.ts +30 -0
  86. package/dist/services/ai/toolDefs.d.ts +9 -0
  87. package/dist/services/ai/toolExecutor.d.ts +83 -0
  88. package/dist/services/ai/toolRegistry.d.ts +38 -0
  89. package/dist/services/ai/transport.d.ts +58 -0
  90. package/dist/services/aiService.d.ts +27 -5
  91. package/dist/stateDiagram-AJRCARHV-Rv1mSmnJ.js +263 -0
  92. package/dist/stateDiagram-v2-BHNVJYJU-BME16k02.js +16 -0
  93. package/dist/store/aiStore.d.ts +199 -0
  94. package/dist/store/ideStoresContext.d.ts +39 -0
  95. package/dist/store/libraryStore.d.ts +25 -0
  96. package/dist/timeline-definition-PNZ67QCA-CmmzdVk-.js +1055 -0
  97. package/dist/types/aiEvents.d.ts +38 -0
  98. package/dist/types/conductor.d.ts +23 -2
  99. package/dist/types/workflow.d.ts +36 -0
  100. package/dist/types/workflowLibrary.d.ts +27 -0
  101. package/dist/utils/executionAnalyzer.d.ts +32 -0
  102. package/dist/utils/nodeMeta.d.ts +6 -0
  103. package/dist/utils/proposalPreview.d.ts +19 -0
  104. package/dist/utils/taskTypeMeta.d.ts +18 -0
  105. package/dist/utils/workflowToMermaid.d.ts +7 -0
  106. package/dist/vennDiagram-CIIHVFJN-BQt00w9Q.js +1557 -0
  107. package/dist/wardley-L42UT6IY-D7b2ujEZ.js +22512 -0
  108. package/dist/wardleyDiagram-YWT4CUSO-LZpiODGN.js +675 -0
  109. package/dist/xychartDiagram-2RQKCTM6-BpJlv_mc.js +1342 -0
  110. package/package.json +14 -4
@@ -0,0 +1,2418 @@
1
+ import { g as pe } from "./chunk-FMBD7UC4-B3CSVzS4.js";
2
+ import { an as fe, ao as Ut, ap as xe, aq as ye, ar as be, as as we, at as me, au as Se, av as Le, aw as ke, ax as ve, ay as Ee, az as _e, aA as Te, aB as De, aC as Be, aD as Ne, aE as Ie, aF as Ce, aG as Oe, aH as Re, aI as Ae, aJ as ze, aK as Me, aL as Pe, _ as d, D as at, d as D, e as Fe, l as k, z as We, B as Ye, c as A, aM as He, R as Ke, S as Ue, O as Xe, aN as P, aO as vt, aP as $, aQ as Ve, u as tt, k as je, aR as Ge, i as Ot, aS as Rt, aT as Ze } from "./mermaid.core-XSpZEAKP.js";
3
+ import { G as qe } from "./graph-BRoPeNF3.js";
4
+ import { c as Je } from "./channel-CURI9jmI.js";
5
+ function Qe(e) {
6
+ return Array.isArray(e);
7
+ }
8
+ function $e(e) {
9
+ if (fe(e)) return e;
10
+ const t = Ut(e);
11
+ if (!tr(e)) return {};
12
+ if (Qe(e)) {
13
+ const s = Array.from(e);
14
+ return e.length > 0 && typeof e[0] == "string" && Object.hasOwn(e, "index") && (s.index = e.index, s.input = e.input), s;
15
+ }
16
+ if (xe(e)) {
17
+ const s = e, i = s.constructor;
18
+ return new i(s.buffer, s.byteOffset, s.length);
19
+ }
20
+ if (t === "[object ArrayBuffer]") return new ArrayBuffer(e.byteLength);
21
+ if (t === "[object DataView]") {
22
+ const s = e, i = s.buffer, c = s.byteOffset, r = s.byteLength, n = new ArrayBuffer(r), l = new Uint8Array(i, c, r);
23
+ return new Uint8Array(n).set(l), new DataView(n);
24
+ }
25
+ if (t === "[object Boolean]" || t === "[object Number]" || t === "[object String]") {
26
+ const s = e.constructor, i = new s(e.valueOf());
27
+ return t === "[object String]" ? rr(i, e) : yt(i, e), i;
28
+ }
29
+ if (t === "[object Date]") return new Date(Number(e));
30
+ if (t === "[object RegExp]") {
31
+ const s = e, i = new RegExp(s.source, s.flags);
32
+ return i.lastIndex = s.lastIndex, i;
33
+ }
34
+ if (t === "[object Symbol]") return Object(Symbol.prototype.valueOf.call(e));
35
+ if (t === "[object Map]") {
36
+ const s = e, i = /* @__PURE__ */ new Map();
37
+ return s.forEach((c, r) => {
38
+ i.set(r, c);
39
+ }), i;
40
+ }
41
+ if (t === "[object Set]") {
42
+ const s = e, i = /* @__PURE__ */ new Set();
43
+ return s.forEach((c) => {
44
+ i.add(c);
45
+ }), i;
46
+ }
47
+ if (t === "[object Arguments]") {
48
+ const s = e, i = {};
49
+ return yt(i, s), i.length = s.length, i[Symbol.iterator] = s[Symbol.iterator], i;
50
+ }
51
+ const a = {};
52
+ return ar(a, e), yt(a, e), er(a, e), a;
53
+ }
54
+ function tr(e) {
55
+ switch (Ut(e)) {
56
+ case Pe:
57
+ case Me:
58
+ case ze:
59
+ case Ae:
60
+ case Re:
61
+ case Oe:
62
+ case Ce:
63
+ case Ie:
64
+ case Ne:
65
+ case Be:
66
+ case De:
67
+ case Te:
68
+ case _e:
69
+ case Ee:
70
+ case ve:
71
+ case ke:
72
+ case Le:
73
+ case Se:
74
+ case me:
75
+ case we:
76
+ case be:
77
+ case ye:
78
+ return !0;
79
+ default:
80
+ return !1;
81
+ }
82
+ }
83
+ function yt(e, t) {
84
+ for (const a in t) Object.hasOwn(t, a) && (e[a] = t[a]);
85
+ }
86
+ function er(e, t) {
87
+ const a = Object.getOwnPropertySymbols(t);
88
+ for (let s = 0; s < a.length; s++) {
89
+ const i = a[s];
90
+ Object.prototype.propertyIsEnumerable.call(t, i) && (e[i] = t[i]);
91
+ }
92
+ }
93
+ function rr(e, t) {
94
+ const a = t.valueOf().length;
95
+ for (const s in t) Object.hasOwn(t, s) && (Number.isNaN(Number(s)) || Number(s) >= a) && (e[s] = t[s]);
96
+ }
97
+ function ar(e, t) {
98
+ const a = Object.getPrototypeOf(t);
99
+ a !== null && typeof t.constructor == "function" && Object.setPrototypeOf(e, a);
100
+ }
101
+ var wt = (function() {
102
+ var e = /* @__PURE__ */ d(function(T, m, u, y) {
103
+ for (u = u || {}, y = T.length; y--; u[T[y]] = m) ;
104
+ return u;
105
+ }, "o"), t = [1, 15], a = [1, 7], s = [1, 13], i = [1, 14], c = [1, 19], r = [1, 16], n = [1, 17], l = [1, 18], g = [8, 30], o = [8, 10, 21, 28, 29, 30, 31, 39, 43, 46], p = [1, 23], b = [1, 24], x = [8, 10, 15, 16, 21, 28, 29, 30, 31, 39, 43, 46], w = [8, 10, 15, 16, 21, 27, 28, 29, 30, 31, 39, 43, 46], v = [1, 49], S = {
106
+ trace: /* @__PURE__ */ d(function() {
107
+ }, "trace"),
108
+ yy: {},
109
+ symbols_: { error: 2, spaceLines: 3, SPACELINE: 4, NL: 5, separator: 6, SPACE: 7, EOF: 8, start: 9, BLOCK_DIAGRAM_KEY: 10, document: 11, stop: 12, statement: 13, link: 14, LINK: 15, START_LINK: 16, LINK_LABEL: 17, STR: 18, nodeStatement: 19, columnsStatement: 20, SPACE_BLOCK: 21, blockStatement: 22, classDefStatement: 23, cssClassStatement: 24, styleStatement: 25, node: 26, SIZE: 27, COLUMNS: 28, "id-block": 29, end: 30, NODE_ID: 31, nodeShapeNLabel: 32, dirList: 33, DIR: 34, NODE_DSTART: 35, NODE_DEND: 36, BLOCK_ARROW_START: 37, BLOCK_ARROW_END: 38, classDef: 39, CLASSDEF_ID: 40, CLASSDEF_STYLEOPTS: 41, DEFAULT: 42, class: 43, CLASSENTITY_IDS: 44, STYLECLASS: 45, style: 46, STYLE_ENTITY_IDS: 47, STYLE_DEFINITION_DATA: 48, $accept: 0, $end: 1 },
110
+ terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "NODE_ID", 34: "DIR", 35: "NODE_DSTART", 36: "NODE_DEND", 37: "BLOCK_ARROW_START", 38: "BLOCK_ARROW_END", 39: "classDef", 40: "CLASSDEF_ID", 41: "CLASSDEF_STYLEOPTS", 42: "DEFAULT", 43: "class", 44: "CLASSENTITY_IDS", 45: "STYLECLASS", 46: "style", 47: "STYLE_ENTITY_IDS", 48: "STYLE_DEFINITION_DATA" },
111
+ productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [33, 1], [33, 2], [32, 3], [32, 4], [23, 3], [23, 3], [24, 3], [25, 3]],
112
+ performAction: /* @__PURE__ */ d(function(m, u, y, L, E, h, W) {
113
+ var f = h.length - 1;
114
+ switch (E) {
115
+ case 4:
116
+ L.getLogger().debug("Rule: separator (NL) ");
117
+ break;
118
+ case 5:
119
+ L.getLogger().debug("Rule: separator (Space) ");
120
+ break;
121
+ case 6:
122
+ L.getLogger().debug("Rule: separator (EOF) ");
123
+ break;
124
+ case 7:
125
+ L.getLogger().debug("Rule: hierarchy: ", h[f - 1]), L.setHierarchy(h[f - 1]);
126
+ break;
127
+ case 8:
128
+ L.getLogger().debug("Stop NL ");
129
+ break;
130
+ case 9:
131
+ L.getLogger().debug("Stop EOF ");
132
+ break;
133
+ case 10:
134
+ L.getLogger().debug("Stop NL2 ");
135
+ break;
136
+ case 11:
137
+ L.getLogger().debug("Stop EOF2 ");
138
+ break;
139
+ case 12:
140
+ L.getLogger().debug("Rule: statement: ", h[f]), typeof h[f].length == "number" ? this.$ = h[f] : this.$ = [h[f]];
141
+ break;
142
+ case 13:
143
+ L.getLogger().debug("Rule: statement #2: ", h[f - 1]), this.$ = [h[f - 1]].concat(h[f]);
144
+ break;
145
+ case 14:
146
+ L.getLogger().debug("Rule: link: ", h[f], m), this.$ = { edgeTypeStr: h[f], label: "" };
147
+ break;
148
+ case 15:
149
+ L.getLogger().debug("Rule: LABEL link: ", h[f - 3], h[f - 1], h[f]), this.$ = { edgeTypeStr: h[f], label: h[f - 1] };
150
+ break;
151
+ case 18:
152
+ const O = parseInt(h[f]), q = L.generateId();
153
+ this.$ = { id: q, type: "space", label: "", width: O, children: [] };
154
+ break;
155
+ case 23:
156
+ L.getLogger().debug("Rule: (nodeStatement link node) ", h[f - 2], h[f - 1], h[f], " typestr: ", h[f - 1].edgeTypeStr);
157
+ const j = L.edgeStrToEdgeData(h[f - 1].edgeTypeStr), st = L.edgeStrToEdgeStartData(h[f - 1].edgeTypeStr), dt = L.edgeStrToThickness(h[f - 1].edgeTypeStr), R = L.edgeStrToPattern(h[f - 1].edgeTypeStr);
158
+ this.$ = [
159
+ { id: h[f - 2].id, label: h[f - 2].label, type: h[f - 2].type, directions: h[f - 2].directions },
160
+ { id: h[f - 2].id + "-" + h[f].id, start: h[f - 2].id, end: h[f].id, label: h[f - 1].label, type: "edge", thickness: dt, pattern: R, directions: h[f].directions, arrowTypeEnd: j, arrowTypeStart: st },
161
+ { id: h[f].id, label: h[f].label, type: L.typeStr2Type(h[f].typeStr), directions: h[f].directions }
162
+ ];
163
+ break;
164
+ case 24:
165
+ L.getLogger().debug("Rule: nodeStatement (abc88 node size) ", h[f - 1], h[f]), this.$ = { id: h[f - 1].id, label: h[f - 1].label, type: L.typeStr2Type(h[f - 1].typeStr), directions: h[f - 1].directions, widthInColumns: parseInt(h[f], 10) };
166
+ break;
167
+ case 25:
168
+ L.getLogger().debug("Rule: nodeStatement (node) ", h[f]), this.$ = { id: h[f].id, label: h[f].label, type: L.typeStr2Type(h[f].typeStr), directions: h[f].directions, widthInColumns: 1 };
169
+ break;
170
+ case 26:
171
+ L.getLogger().debug("APA123", this ? this : "na"), L.getLogger().debug("COLUMNS: ", h[f]), this.$ = { type: "column-setting", columns: h[f] === "auto" ? -1 : parseInt(h[f]) };
172
+ break;
173
+ case 27:
174
+ L.getLogger().debug("Rule: id-block statement : ", h[f - 2], h[f - 1]), L.generateId(), this.$ = { ...h[f - 2], type: "composite", children: h[f - 1] };
175
+ break;
176
+ case 28:
177
+ L.getLogger().debug("Rule: blockStatement : ", h[f - 2], h[f - 1], h[f]);
178
+ const G = L.generateId();
179
+ this.$ = { id: G, type: "composite", label: "", children: h[f - 1] };
180
+ break;
181
+ case 29:
182
+ L.getLogger().debug("Rule: node (NODE_ID separator): ", h[f]), this.$ = { id: h[f] };
183
+ break;
184
+ case 30:
185
+ L.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", h[f - 1], h[f]), this.$ = { id: h[f - 1], label: h[f].label, typeStr: h[f].typeStr, directions: h[f].directions };
186
+ break;
187
+ case 31:
188
+ L.getLogger().debug("Rule: dirList: ", h[f]), this.$ = [h[f]];
189
+ break;
190
+ case 32:
191
+ L.getLogger().debug("Rule: dirList: ", h[f - 1], h[f]), this.$ = [h[f - 1]].concat(h[f]);
192
+ break;
193
+ case 33:
194
+ L.getLogger().debug("Rule: nodeShapeNLabel: ", h[f - 2], h[f - 1], h[f]), this.$ = { typeStr: h[f - 2] + h[f], label: h[f - 1] };
195
+ break;
196
+ case 34:
197
+ L.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", h[f - 3], h[f - 2], " #3:", h[f - 1], h[f]), this.$ = { typeStr: h[f - 3] + h[f], label: h[f - 2], directions: h[f - 1] };
198
+ break;
199
+ case 35:
200
+ case 36:
201
+ this.$ = { type: "classDef", id: h[f - 1].trim(), css: h[f].trim() };
202
+ break;
203
+ case 37:
204
+ this.$ = { type: "applyClass", id: h[f - 1].trim(), styleClass: h[f].trim() };
205
+ break;
206
+ case 38:
207
+ this.$ = { type: "applyStyles", id: h[f - 1].trim(), stylesStr: h[f].trim() };
208
+ break;
209
+ }
210
+ }, "anonymous"),
211
+ table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 10: t, 11: 3, 13: 4, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: s, 29: i, 31: c, 39: r, 43: n, 46: l }, { 8: [1, 20] }, e(g, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 10: t, 21: a, 28: s, 29: i, 31: c, 39: r, 43: n, 46: l }), e(o, [2, 16], { 14: 22, 15: p, 16: b }), e(o, [2, 17]), e(o, [2, 18]), e(o, [2, 19]), e(o, [2, 20]), e(o, [2, 21]), e(o, [2, 22]), e(x, [2, 25], { 27: [1, 25] }), e(o, [2, 26]), { 19: 26, 26: 12, 31: c }, { 10: t, 11: 27, 13: 4, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: s, 29: i, 31: c, 39: r, 43: n, 46: l }, { 40: [1, 28], 42: [1, 29] }, { 44: [1, 30] }, { 47: [1, 31] }, e(w, [2, 29], { 32: 32, 35: [1, 33], 37: [1, 34] }), { 1: [2, 7] }, e(g, [2, 13]), { 26: 35, 31: c }, { 31: [2, 14] }, { 17: [1, 36] }, e(x, [2, 24]), { 10: t, 11: 37, 13: 4, 14: 22, 15: p, 16: b, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: s, 29: i, 31: c, 39: r, 43: n, 46: l }, { 30: [1, 38] }, { 41: [1, 39] }, { 41: [1, 40] }, { 45: [1, 41] }, { 48: [1, 42] }, e(w, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, e(x, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, e(o, [2, 28]), e(o, [2, 35]), e(o, [2, 36]), e(o, [2, 37]), e(o, [2, 38]), { 36: [1, 47] }, { 33: 48, 34: v }, { 15: [1, 50] }, e(o, [2, 27]), e(w, [2, 33]), { 38: [1, 51] }, { 33: 52, 34: v, 38: [2, 31] }, { 31: [2, 15] }, e(w, [2, 34]), { 38: [2, 32] }],
212
+ defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
213
+ parseError: /* @__PURE__ */ d(function(m, u) {
214
+ if (u.recoverable)
215
+ this.trace(m);
216
+ else {
217
+ var y = new Error(m);
218
+ throw y.hash = u, y;
219
+ }
220
+ }, "parseError"),
221
+ parse: /* @__PURE__ */ d(function(m) {
222
+ var u = this, y = [0], L = [], E = [null], h = [], W = this.table, f = "", O = 0, q = 0, j = 2, st = 1, dt = h.slice.call(arguments, 1), R = Object.create(this.lexer), G = { yy: {} };
223
+ for (var ut in this.yy)
224
+ Object.prototype.hasOwnProperty.call(this.yy, ut) && (G.yy[ut] = this.yy[ut]);
225
+ R.setInput(m, G.yy), G.yy.lexer = R, G.yy.parser = this, typeof R.yylloc > "u" && (R.yylloc = {});
226
+ var pt = R.yylloc;
227
+ h.push(pt);
228
+ var de = R.options && R.options.ranges;
229
+ typeof G.yy.parseError == "function" ? this.parseError = G.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
230
+ function ue(Y) {
231
+ y.length = y.length - 2 * Y, E.length = E.length - Y, h.length = h.length - Y;
232
+ }
233
+ d(ue, "popStack");
234
+ function It() {
235
+ var Y;
236
+ return Y = L.pop() || R.lex() || st, typeof Y != "number" && (Y instanceof Array && (L = Y, Y = L.pop()), Y = u.symbols_[Y] || Y), Y;
237
+ }
238
+ d(It, "lex");
239
+ for (var F, J, K, ft, Q = {}, it, Z, Ct, nt; ; ) {
240
+ if (J = y[y.length - 1], this.defaultActions[J] ? K = this.defaultActions[J] : ((F === null || typeof F > "u") && (F = It()), K = W[J] && W[J][F]), typeof K > "u" || !K.length || !K[0]) {
241
+ var xt = "";
242
+ nt = [];
243
+ for (it in W[J])
244
+ this.terminals_[it] && it > j && nt.push("'" + this.terminals_[it] + "'");
245
+ R.showPosition ? xt = "Parse error on line " + (O + 1) + `:
246
+ ` + R.showPosition() + `
247
+ Expecting ` + nt.join(", ") + ", got '" + (this.terminals_[F] || F) + "'" : xt = "Parse error on line " + (O + 1) + ": Unexpected " + (F == st ? "end of input" : "'" + (this.terminals_[F] || F) + "'"), this.parseError(xt, {
248
+ text: R.match,
249
+ token: this.terminals_[F] || F,
250
+ line: R.yylineno,
251
+ loc: pt,
252
+ expected: nt
253
+ });
254
+ }
255
+ if (K[0] instanceof Array && K.length > 1)
256
+ throw new Error("Parse Error: multiple actions possible at state: " + J + ", token: " + F);
257
+ switch (K[0]) {
258
+ case 1:
259
+ y.push(F), E.push(R.yytext), h.push(R.yylloc), y.push(K[1]), F = null, q = R.yyleng, f = R.yytext, O = R.yylineno, pt = R.yylloc;
260
+ break;
261
+ case 2:
262
+ if (Z = this.productions_[K[1]][1], Q.$ = E[E.length - Z], Q._$ = {
263
+ first_line: h[h.length - (Z || 1)].first_line,
264
+ last_line: h[h.length - 1].last_line,
265
+ first_column: h[h.length - (Z || 1)].first_column,
266
+ last_column: h[h.length - 1].last_column
267
+ }, de && (Q._$.range = [
268
+ h[h.length - (Z || 1)].range[0],
269
+ h[h.length - 1].range[1]
270
+ ]), ft = this.performAction.apply(Q, [
271
+ f,
272
+ q,
273
+ O,
274
+ G.yy,
275
+ K[1],
276
+ E,
277
+ h
278
+ ].concat(dt)), typeof ft < "u")
279
+ return ft;
280
+ Z && (y = y.slice(0, -1 * Z * 2), E = E.slice(0, -1 * Z), h = h.slice(0, -1 * Z)), y.push(this.productions_[K[1]][0]), E.push(Q.$), h.push(Q._$), Ct = W[y[y.length - 2]][y[y.length - 1]], y.push(Ct);
281
+ break;
282
+ case 3:
283
+ return !0;
284
+ }
285
+ }
286
+ return !0;
287
+ }, "parse")
288
+ }, _ = /* @__PURE__ */ (function() {
289
+ var T = {
290
+ EOF: 1,
291
+ parseError: /* @__PURE__ */ d(function(u, y) {
292
+ if (this.yy.parser)
293
+ this.yy.parser.parseError(u, y);
294
+ else
295
+ throw new Error(u);
296
+ }, "parseError"),
297
+ // resets the lexer, sets new input
298
+ setInput: /* @__PURE__ */ d(function(m, u) {
299
+ return this.yy = u || this.yy || {}, this._input = m, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
300
+ first_line: 1,
301
+ first_column: 0,
302
+ last_line: 1,
303
+ last_column: 0
304
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
305
+ }, "setInput"),
306
+ // consumes and returns one char from the input
307
+ input: /* @__PURE__ */ d(function() {
308
+ var m = this._input[0];
309
+ this.yytext += m, this.yyleng++, this.offset++, this.match += m, this.matched += m;
310
+ var u = m.match(/(?:\r\n?|\n).*/g);
311
+ return u ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), m;
312
+ }, "input"),
313
+ // unshifts one char (or a string) into the input
314
+ unput: /* @__PURE__ */ d(function(m) {
315
+ var u = m.length, y = m.split(/(?:\r\n?|\n)/g);
316
+ this._input = m + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - u), this.offset -= u;
317
+ var L = this.match.split(/(?:\r\n?|\n)/g);
318
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), y.length - 1 && (this.yylineno -= y.length - 1);
319
+ var E = this.yylloc.range;
320
+ return this.yylloc = {
321
+ first_line: this.yylloc.first_line,
322
+ last_line: this.yylineno + 1,
323
+ first_column: this.yylloc.first_column,
324
+ last_column: y ? (y.length === L.length ? this.yylloc.first_column : 0) + L[L.length - y.length].length - y[0].length : this.yylloc.first_column - u
325
+ }, this.options.ranges && (this.yylloc.range = [E[0], E[0] + this.yyleng - u]), this.yyleng = this.yytext.length, this;
326
+ }, "unput"),
327
+ // When called from action, caches matched text and appends it on next action
328
+ more: /* @__PURE__ */ d(function() {
329
+ return this._more = !0, this;
330
+ }, "more"),
331
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
332
+ reject: /* @__PURE__ */ d(function() {
333
+ if (this.options.backtrack_lexer)
334
+ this._backtrack = !0;
335
+ else
336
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
337
+ ` + this.showPosition(), {
338
+ text: "",
339
+ token: null,
340
+ line: this.yylineno
341
+ });
342
+ return this;
343
+ }, "reject"),
344
+ // retain first n characters of the match
345
+ less: /* @__PURE__ */ d(function(m) {
346
+ this.unput(this.match.slice(m));
347
+ }, "less"),
348
+ // displays already matched input, i.e. for error messages
349
+ pastInput: /* @__PURE__ */ d(function() {
350
+ var m = this.matched.substr(0, this.matched.length - this.match.length);
351
+ return (m.length > 20 ? "..." : "") + m.substr(-20).replace(/\n/g, "");
352
+ }, "pastInput"),
353
+ // displays upcoming input, i.e. for error messages
354
+ upcomingInput: /* @__PURE__ */ d(function() {
355
+ var m = this.match;
356
+ return m.length < 20 && (m += this._input.substr(0, 20 - m.length)), (m.substr(0, 20) + (m.length > 20 ? "..." : "")).replace(/\n/g, "");
357
+ }, "upcomingInput"),
358
+ // displays the character position where the lexing error occurred, i.e. for error messages
359
+ showPosition: /* @__PURE__ */ d(function() {
360
+ var m = this.pastInput(), u = new Array(m.length + 1).join("-");
361
+ return m + this.upcomingInput() + `
362
+ ` + u + "^";
363
+ }, "showPosition"),
364
+ // test the lexed token: return FALSE when not a match, otherwise return token
365
+ test_match: /* @__PURE__ */ d(function(m, u) {
366
+ var y, L, E;
367
+ if (this.options.backtrack_lexer && (E = {
368
+ yylineno: this.yylineno,
369
+ yylloc: {
370
+ first_line: this.yylloc.first_line,
371
+ last_line: this.last_line,
372
+ first_column: this.yylloc.first_column,
373
+ last_column: this.yylloc.last_column
374
+ },
375
+ yytext: this.yytext,
376
+ match: this.match,
377
+ matches: this.matches,
378
+ matched: this.matched,
379
+ yyleng: this.yyleng,
380
+ offset: this.offset,
381
+ _more: this._more,
382
+ _input: this._input,
383
+ yy: this.yy,
384
+ conditionStack: this.conditionStack.slice(0),
385
+ done: this.done
386
+ }, this.options.ranges && (E.yylloc.range = this.yylloc.range.slice(0))), L = m[0].match(/(?:\r\n?|\n).*/g), L && (this.yylineno += L.length), this.yylloc = {
387
+ first_line: this.yylloc.last_line,
388
+ last_line: this.yylineno + 1,
389
+ first_column: this.yylloc.last_column,
390
+ last_column: L ? L[L.length - 1].length - L[L.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + m[0].length
391
+ }, this.yytext += m[0], this.match += m[0], this.matches = m, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(m[0].length), this.matched += m[0], y = this.performAction.call(this, this.yy, this, u, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), y)
392
+ return y;
393
+ if (this._backtrack) {
394
+ for (var h in E)
395
+ this[h] = E[h];
396
+ return !1;
397
+ }
398
+ return !1;
399
+ }, "test_match"),
400
+ // return next match in input
401
+ next: /* @__PURE__ */ d(function() {
402
+ if (this.done)
403
+ return this.EOF;
404
+ this._input || (this.done = !0);
405
+ var m, u, y, L;
406
+ this._more || (this.yytext = "", this.match = "");
407
+ for (var E = this._currentRules(), h = 0; h < E.length; h++)
408
+ if (y = this._input.match(this.rules[E[h]]), y && (!u || y[0].length > u[0].length)) {
409
+ if (u = y, L = h, this.options.backtrack_lexer) {
410
+ if (m = this.test_match(y, E[h]), m !== !1)
411
+ return m;
412
+ if (this._backtrack) {
413
+ u = !1;
414
+ continue;
415
+ } else
416
+ return !1;
417
+ } else if (!this.options.flex)
418
+ break;
419
+ }
420
+ return u ? (m = this.test_match(u, E[L]), m !== !1 ? m : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
421
+ ` + this.showPosition(), {
422
+ text: "",
423
+ token: null,
424
+ line: this.yylineno
425
+ });
426
+ }, "next"),
427
+ // return next match that has a token
428
+ lex: /* @__PURE__ */ d(function() {
429
+ var u = this.next();
430
+ return u || this.lex();
431
+ }, "lex"),
432
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
433
+ begin: /* @__PURE__ */ d(function(u) {
434
+ this.conditionStack.push(u);
435
+ }, "begin"),
436
+ // pop the previously active lexer condition state off the condition stack
437
+ popState: /* @__PURE__ */ d(function() {
438
+ var u = this.conditionStack.length - 1;
439
+ return u > 0 ? this.conditionStack.pop() : this.conditionStack[0];
440
+ }, "popState"),
441
+ // produce the lexer rule set which is active for the currently active lexer condition state
442
+ _currentRules: /* @__PURE__ */ d(function() {
443
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
444
+ }, "_currentRules"),
445
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
446
+ topState: /* @__PURE__ */ d(function(u) {
447
+ return u = this.conditionStack.length - 1 - Math.abs(u || 0), u >= 0 ? this.conditionStack[u] : "INITIAL";
448
+ }, "topState"),
449
+ // alias for begin(condition)
450
+ pushState: /* @__PURE__ */ d(function(u) {
451
+ this.begin(u);
452
+ }, "pushState"),
453
+ // return the number of states currently on the stack
454
+ stateStackSize: /* @__PURE__ */ d(function() {
455
+ return this.conditionStack.length;
456
+ }, "stateStackSize"),
457
+ options: {},
458
+ performAction: /* @__PURE__ */ d(function(u, y, L, E) {
459
+ switch (L) {
460
+ case 0:
461
+ return u.getLogger().debug("Found block-beta"), 10;
462
+ case 1:
463
+ return u.getLogger().debug("Found id-block"), 29;
464
+ case 2:
465
+ return u.getLogger().debug("Found block"), 10;
466
+ case 3:
467
+ u.getLogger().debug(".", y.yytext);
468
+ break;
469
+ case 4:
470
+ u.getLogger().debug("_", y.yytext);
471
+ break;
472
+ case 5:
473
+ return 5;
474
+ case 6:
475
+ return y.yytext = -1, 28;
476
+ case 7:
477
+ return y.yytext = y.yytext.replace(/columns\s+/, ""), u.getLogger().debug("COLUMNS (LEX)", y.yytext), 28;
478
+ case 8:
479
+ this.pushState("md_string");
480
+ break;
481
+ case 9:
482
+ return "MD_STR";
483
+ case 10:
484
+ this.popState();
485
+ break;
486
+ case 11:
487
+ this.pushState("string");
488
+ break;
489
+ case 12:
490
+ u.getLogger().debug("LEX: POPPING STR:", y.yytext), this.popState();
491
+ break;
492
+ case 13:
493
+ return u.getLogger().debug("LEX: STR end:", y.yytext), "STR";
494
+ case 14:
495
+ return y.yytext = y.yytext.replace(/space\:/, ""), u.getLogger().debug("SPACE NUM (LEX)", y.yytext), 21;
496
+ case 15:
497
+ return y.yytext = "1", u.getLogger().debug("COLUMNS (LEX)", y.yytext), 21;
498
+ case 16:
499
+ return 42;
500
+ case 17:
501
+ return "LINKSTYLE";
502
+ case 18:
503
+ return "INTERPOLATE";
504
+ case 19:
505
+ return this.pushState("CLASSDEF"), 39;
506
+ case 20:
507
+ return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
508
+ case 21:
509
+ return this.popState(), this.pushState("CLASSDEFID"), 40;
510
+ case 22:
511
+ return this.popState(), 41;
512
+ case 23:
513
+ return this.pushState("CLASS"), 43;
514
+ case 24:
515
+ return this.popState(), this.pushState("CLASS_STYLE"), 44;
516
+ case 25:
517
+ return this.popState(), 45;
518
+ case 26:
519
+ return this.pushState("STYLE_STMNT"), 46;
520
+ case 27:
521
+ return this.popState(), this.pushState("STYLE_DEFINITION"), 47;
522
+ case 28:
523
+ return this.popState(), 48;
524
+ case 29:
525
+ return this.pushState("acc_title"), "acc_title";
526
+ case 30:
527
+ return this.popState(), "acc_title_value";
528
+ case 31:
529
+ return this.pushState("acc_descr"), "acc_descr";
530
+ case 32:
531
+ return this.popState(), "acc_descr_value";
532
+ case 33:
533
+ this.pushState("acc_descr_multiline");
534
+ break;
535
+ case 34:
536
+ this.popState();
537
+ break;
538
+ case 35:
539
+ return "acc_descr_multiline_value";
540
+ case 36:
541
+ return 30;
542
+ case 37:
543
+ return this.popState(), u.getLogger().debug("Lex: (("), "NODE_DEND";
544
+ case 38:
545
+ return this.popState(), u.getLogger().debug("Lex: (("), "NODE_DEND";
546
+ case 39:
547
+ return this.popState(), u.getLogger().debug("Lex: ))"), "NODE_DEND";
548
+ case 40:
549
+ return this.popState(), u.getLogger().debug("Lex: (("), "NODE_DEND";
550
+ case 41:
551
+ return this.popState(), u.getLogger().debug("Lex: (("), "NODE_DEND";
552
+ case 42:
553
+ return this.popState(), u.getLogger().debug("Lex: (-"), "NODE_DEND";
554
+ case 43:
555
+ return this.popState(), u.getLogger().debug("Lex: -)"), "NODE_DEND";
556
+ case 44:
557
+ return this.popState(), u.getLogger().debug("Lex: (("), "NODE_DEND";
558
+ case 45:
559
+ return this.popState(), u.getLogger().debug("Lex: ]]"), "NODE_DEND";
560
+ case 46:
561
+ return this.popState(), u.getLogger().debug("Lex: ("), "NODE_DEND";
562
+ case 47:
563
+ return this.popState(), u.getLogger().debug("Lex: ])"), "NODE_DEND";
564
+ case 48:
565
+ return this.popState(), u.getLogger().debug("Lex: /]"), "NODE_DEND";
566
+ case 49:
567
+ return this.popState(), u.getLogger().debug("Lex: /]"), "NODE_DEND";
568
+ case 50:
569
+ return this.popState(), u.getLogger().debug("Lex: )]"), "NODE_DEND";
570
+ case 51:
571
+ return this.popState(), u.getLogger().debug("Lex: )"), "NODE_DEND";
572
+ case 52:
573
+ return this.popState(), u.getLogger().debug("Lex: ]>"), "NODE_DEND";
574
+ case 53:
575
+ return this.popState(), u.getLogger().debug("Lex: ]"), "NODE_DEND";
576
+ case 54:
577
+ return u.getLogger().debug("Lexa: -)"), this.pushState("NODE"), 35;
578
+ case 55:
579
+ return u.getLogger().debug("Lexa: (-"), this.pushState("NODE"), 35;
580
+ case 56:
581
+ return u.getLogger().debug("Lexa: ))"), this.pushState("NODE"), 35;
582
+ case 57:
583
+ return u.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
584
+ case 58:
585
+ return u.getLogger().debug("Lex: ((("), this.pushState("NODE"), 35;
586
+ case 59:
587
+ return u.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
588
+ case 60:
589
+ return u.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
590
+ case 61:
591
+ return u.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
592
+ case 62:
593
+ return u.getLogger().debug("Lexc: >"), this.pushState("NODE"), 35;
594
+ case 63:
595
+ return u.getLogger().debug("Lexa: (["), this.pushState("NODE"), 35;
596
+ case 64:
597
+ return u.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
598
+ case 65:
599
+ return this.pushState("NODE"), 35;
600
+ case 66:
601
+ return this.pushState("NODE"), 35;
602
+ case 67:
603
+ return this.pushState("NODE"), 35;
604
+ case 68:
605
+ return this.pushState("NODE"), 35;
606
+ case 69:
607
+ return this.pushState("NODE"), 35;
608
+ case 70:
609
+ return this.pushState("NODE"), 35;
610
+ case 71:
611
+ return this.pushState("NODE"), 35;
612
+ case 72:
613
+ return u.getLogger().debug("Lexa: ["), this.pushState("NODE"), 35;
614
+ case 73:
615
+ return this.pushState("BLOCK_ARROW"), u.getLogger().debug("LEX ARR START"), 37;
616
+ case 74:
617
+ return u.getLogger().debug("Lex: NODE_ID", y.yytext), 31;
618
+ case 75:
619
+ return u.getLogger().debug("Lex: EOF", y.yytext), 8;
620
+ case 76:
621
+ this.pushState("md_string");
622
+ break;
623
+ case 77:
624
+ this.pushState("md_string");
625
+ break;
626
+ case 78:
627
+ return "NODE_DESCR";
628
+ case 79:
629
+ this.popState();
630
+ break;
631
+ case 80:
632
+ u.getLogger().debug("Lex: Starting string"), this.pushState("string");
633
+ break;
634
+ case 81:
635
+ u.getLogger().debug("LEX ARR: Starting string"), this.pushState("string");
636
+ break;
637
+ case 82:
638
+ return u.getLogger().debug("LEX: NODE_DESCR:", y.yytext), "NODE_DESCR";
639
+ case 83:
640
+ u.getLogger().debug("LEX POPPING"), this.popState();
641
+ break;
642
+ case 84:
643
+ u.getLogger().debug("Lex: =>BAE"), this.pushState("ARROW_DIR");
644
+ break;
645
+ case 85:
646
+ return y.yytext = y.yytext.replace(/^,\s*/, ""), u.getLogger().debug("Lex (right): dir:", y.yytext), "DIR";
647
+ case 86:
648
+ return y.yytext = y.yytext.replace(/^,\s*/, ""), u.getLogger().debug("Lex (left):", y.yytext), "DIR";
649
+ case 87:
650
+ return y.yytext = y.yytext.replace(/^,\s*/, ""), u.getLogger().debug("Lex (x):", y.yytext), "DIR";
651
+ case 88:
652
+ return y.yytext = y.yytext.replace(/^,\s*/, ""), u.getLogger().debug("Lex (y):", y.yytext), "DIR";
653
+ case 89:
654
+ return y.yytext = y.yytext.replace(/^,\s*/, ""), u.getLogger().debug("Lex (up):", y.yytext), "DIR";
655
+ case 90:
656
+ return y.yytext = y.yytext.replace(/^,\s*/, ""), u.getLogger().debug("Lex (down):", y.yytext), "DIR";
657
+ case 91:
658
+ return y.yytext = "]>", u.getLogger().debug("Lex (ARROW_DIR end):", y.yytext), this.popState(), this.popState(), "BLOCK_ARROW_END";
659
+ case 92:
660
+ return u.getLogger().debug("Lex: LINK", "#" + y.yytext + "#"), 15;
661
+ case 93:
662
+ return u.getLogger().debug("Lex: LINK", y.yytext), 15;
663
+ case 94:
664
+ return u.getLogger().debug("Lex: LINK", y.yytext), 15;
665
+ case 95:
666
+ return u.getLogger().debug("Lex: LINK", y.yytext), 15;
667
+ case 96:
668
+ return u.getLogger().debug("Lex: START_LINK", y.yytext), this.pushState("LLABEL"), 16;
669
+ case 97:
670
+ return u.getLogger().debug("Lex: START_LINK", y.yytext), this.pushState("LLABEL"), 16;
671
+ case 98:
672
+ return u.getLogger().debug("Lex: START_LINK", y.yytext), this.pushState("LLABEL"), 16;
673
+ case 99:
674
+ this.pushState("md_string");
675
+ break;
676
+ case 100:
677
+ return u.getLogger().debug("Lex: Starting string"), this.pushState("string"), "LINK_LABEL";
678
+ case 101:
679
+ return this.popState(), u.getLogger().debug("Lex: LINK", "#" + y.yytext + "#"), 15;
680
+ case 102:
681
+ return this.popState(), u.getLogger().debug("Lex: LINK", y.yytext), 15;
682
+ case 103:
683
+ return this.popState(), u.getLogger().debug("Lex: LINK", y.yytext), 15;
684
+ case 104:
685
+ return u.getLogger().debug("Lex: COLON", y.yytext), y.yytext = y.yytext.slice(1), 27;
686
+ }
687
+ }, "anonymous"),
688
+ rules: [/^(?:block-beta\b)/, /^(?:block:)/, /^(?:block\b)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/],
689
+ conditions: { STYLE_DEFINITION: { rules: [28], inclusive: !1 }, STYLE_STMNT: { rules: [27], inclusive: !1 }, CLASSDEFID: { rules: [22], inclusive: !1 }, CLASSDEF: { rules: [20, 21], inclusive: !1 }, CLASS_STYLE: { rules: [25], inclusive: !1 }, CLASS: { rules: [24], inclusive: !1 }, LLABEL: { rules: [99, 100, 101, 102, 103], inclusive: !1 }, ARROW_DIR: { rules: [85, 86, 87, 88, 89, 90, 91], inclusive: !1 }, BLOCK_ARROW: { rules: [76, 81, 84], inclusive: !1 }, NODE: { rules: [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 77, 80], inclusive: !1 }, md_string: { rules: [9, 10, 78, 79], inclusive: !1 }, space: { rules: [], inclusive: !1 }, string: { rules: [12, 13, 82, 83], inclusive: !1 }, acc_descr_multiline: { rules: [34, 35], inclusive: !1 }, acc_descr: { rules: [32], inclusive: !1 }, acc_title: { rules: [30], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 14, 15, 16, 17, 18, 19, 23, 26, 29, 31, 33, 36, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 92, 93, 94, 95, 96, 97, 98, 104], inclusive: !0 } }
690
+ };
691
+ return T;
692
+ })();
693
+ S.lexer = _;
694
+ function I() {
695
+ this.yy = {};
696
+ }
697
+ return d(I, "Parser"), I.prototype = S, S.Parser = I, new I();
698
+ })();
699
+ wt.parser = wt;
700
+ var sr = wt, X = /* @__PURE__ */ new Map(), Et = [], mt = /* @__PURE__ */ new Map(), At = "color", zt = "fill", ir = "bgFill", Xt = ",", nr = A(), lt = /* @__PURE__ */ new Map(), _t = "", cr = /* @__PURE__ */ d((e) => je.sanitizeText(e, nr), "sanitizeText"), lr = /* @__PURE__ */ d(function(e, t = "") {
701
+ let a = lt.get(e);
702
+ a || (a = { id: e, styles: [], textStyles: [] }, lt.set(e, a)), t?.split(Xt).forEach((s) => {
703
+ const i = s.replace(/([^;]*);/, "$1").trim();
704
+ if (RegExp(At).exec(s)) {
705
+ const r = i.replace(zt, ir).replace(At, zt);
706
+ a.textStyles.push(r);
707
+ }
708
+ a.styles.push(i);
709
+ });
710
+ }, "addStyleClass"), or = /* @__PURE__ */ d(function(e, t = "") {
711
+ const a = X.get(e);
712
+ t != null && (a.styles = t.split(Xt));
713
+ }, "addStyle2Node"), hr = /* @__PURE__ */ d(function(e, t) {
714
+ e.split(",").forEach(function(a) {
715
+ let s = X.get(a);
716
+ if (s === void 0) {
717
+ const i = a.trim();
718
+ s = { id: i, type: "na", children: [] }, X.set(i, s);
719
+ }
720
+ s.classes || (s.classes = []), s.classes.push(t);
721
+ });
722
+ }, "setCssClass"), Vt = /* @__PURE__ */ d((e, t) => {
723
+ const a = e.flat(), s = [], c = a.find((r) => r?.type === "column-setting")?.columns ?? -1;
724
+ for (const r of a) {
725
+ if (typeof c == "number" && c > 0 && r.type !== "column-setting" && typeof r.widthInColumns == "number" && r.widthInColumns > c && k.warn(
726
+ `Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${c}`
727
+ ), r.label && (r.label = cr(r.label)), r.type === "classDef") {
728
+ lr(r.id, r.css);
729
+ continue;
730
+ }
731
+ if (r.type === "applyClass") {
732
+ hr(r.id, r?.styleClass ?? "");
733
+ continue;
734
+ }
735
+ if (r.type === "applyStyles") {
736
+ r?.stylesStr && or(r.id, r?.stylesStr);
737
+ continue;
738
+ }
739
+ if (r.type === "column-setting")
740
+ t.columns = r.columns ?? -1;
741
+ else if (r.type === "edge") {
742
+ const n = (mt.get(r.id) ?? 0) + 1;
743
+ mt.set(r.id, n), r.id = n + "-" + r.id, Et.push(r);
744
+ } else {
745
+ r.label || (r.type === "composite" ? r.label = "" : r.label = r.id);
746
+ const n = X.get(r.id);
747
+ if (n === void 0 ? X.set(r.id, r) : (r.type !== "na" && (n.type = r.type), r.label !== r.id && (n.label = r.label)), r.children && Vt(r.children, r), r.type === "space") {
748
+ const l = r.width ?? 1;
749
+ for (let g = 0; g < l; g++) {
750
+ const o = $e(r);
751
+ o.id = o.id + "-" + g, X.set(o.id, o), s.push(o);
752
+ }
753
+ } else n === void 0 && s.push(r);
754
+ }
755
+ }
756
+ t.children = s;
757
+ }, "populateBlockDatabase"), Tt = [], rt = { id: "root", type: "composite", children: [], columns: -1 }, gr = /* @__PURE__ */ d(() => {
758
+ k.debug("Clear called"), We(), rt = { id: "root", type: "composite", children: [], columns: -1 }, X = /* @__PURE__ */ new Map([["root", rt]]), Tt = [], lt = /* @__PURE__ */ new Map(), Et = [], mt = /* @__PURE__ */ new Map(), _t = "";
759
+ }, "clear");
760
+ function jt(e) {
761
+ switch (k.debug("typeStr2Type", e), e) {
762
+ case "[]":
763
+ return "square";
764
+ case "()":
765
+ return k.debug("we have a round"), "round";
766
+ case "(())":
767
+ return "circle";
768
+ case ">]":
769
+ return "rect_left_inv_arrow";
770
+ case "{}":
771
+ return "diamond";
772
+ case "{{}}":
773
+ return "hexagon";
774
+ case "([])":
775
+ return "stadium";
776
+ case "[[]]":
777
+ return "subroutine";
778
+ case "[()]":
779
+ return "cylinder";
780
+ case "((()))":
781
+ return "doublecircle";
782
+ case "[//]":
783
+ return "lean_right";
784
+ case "[\\\\]":
785
+ return "lean_left";
786
+ case "[/\\]":
787
+ return "trapezoid";
788
+ case "[\\/]":
789
+ return "inv_trapezoid";
790
+ case "<[]>":
791
+ return "block_arrow";
792
+ default:
793
+ return "na";
794
+ }
795
+ }
796
+ d(jt, "typeStr2Type");
797
+ function Gt(e) {
798
+ return k.debug("typeStr2Type", e), e === "==" ? "thick" : "normal";
799
+ }
800
+ d(Gt, "edgeTypeStr2Type");
801
+ function Zt(e) {
802
+ switch (e.trim().slice(-1)) {
803
+ case "x":
804
+ return "arrow_cross";
805
+ case "o":
806
+ return "arrow_circle";
807
+ case ">":
808
+ return "arrow_point";
809
+ default:
810
+ return "";
811
+ }
812
+ }
813
+ d(Zt, "edgeStrToEdgeData");
814
+ function qt(e) {
815
+ switch (e.trim().charAt(0)) {
816
+ case "x":
817
+ return "arrow_cross";
818
+ case "o":
819
+ return "arrow_circle";
820
+ case "<":
821
+ return "arrow_point";
822
+ default:
823
+ return "arrow_open";
824
+ }
825
+ }
826
+ d(qt, "edgeStrToEdgeStartData");
827
+ function Jt(e) {
828
+ return e.includes("==") ? "thick" : "normal";
829
+ }
830
+ d(Jt, "edgeStrToThickness");
831
+ function Qt(e) {
832
+ return e.includes(".-") ? "dotted" : "solid";
833
+ }
834
+ d(Qt, "edgeStrToPattern");
835
+ var Mt = 0, dr = /* @__PURE__ */ d(() => (Mt++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + Mt), "generateId"), ur = /* @__PURE__ */ d((e) => {
836
+ rt.children = e, Vt(e, rt), Tt = rt.children;
837
+ }, "setHierarchy"), pr = /* @__PURE__ */ d((e) => {
838
+ const t = X.get(e);
839
+ return t ? t.columns ? t.columns : t.children ? t.children.length : -1 : -1;
840
+ }, "getColumns"), fr = /* @__PURE__ */ d(() => [...X.values()], "getBlocksFlat"), xr = /* @__PURE__ */ d(() => Tt || [], "getBlocks"), yr = /* @__PURE__ */ d(() => Et, "getEdges"), br = /* @__PURE__ */ d((e) => X.get(e), "getBlock"), wr = /* @__PURE__ */ d((e) => {
841
+ X.set(e.id, e);
842
+ }, "setBlock"), mr = /* @__PURE__ */ d((e) => {
843
+ _t = e;
844
+ }, "setDiagramId"), Sr = /* @__PURE__ */ d(() => _t, "getDiagramId"), Lr = /* @__PURE__ */ d(() => k, "getLogger"), kr = /* @__PURE__ */ d(function() {
845
+ return lt;
846
+ }, "getClasses"), vr = {
847
+ getConfig: /* @__PURE__ */ d(() => at().block, "getConfig"),
848
+ typeStr2Type: jt,
849
+ edgeTypeStr2Type: Gt,
850
+ edgeStrToEdgeData: Zt,
851
+ edgeStrToEdgeStartData: qt,
852
+ edgeStrToThickness: Jt,
853
+ edgeStrToPattern: Qt,
854
+ getLogger: Lr,
855
+ getBlocksFlat: fr,
856
+ getBlocks: xr,
857
+ getEdges: yr,
858
+ setHierarchy: ur,
859
+ getBlock: br,
860
+ setBlock: wr,
861
+ getColumns: pr,
862
+ getClasses: kr,
863
+ clear: gr,
864
+ generateId: dr,
865
+ setDiagramId: mr,
866
+ getDiagramId: Sr
867
+ }, Er = vr, bt = /* @__PURE__ */ d((e, t) => {
868
+ const a = Je, s = a(e, "r"), i = a(e, "g"), c = a(e, "b");
869
+ return Ye(s, i, c, t);
870
+ }, "fade"), _r = /* @__PURE__ */ d((e) => `.label {
871
+ font-family: ${e.fontFamily};
872
+ color: ${e.nodeTextColor || e.textColor};
873
+ }
874
+ .cluster-label text {
875
+ fill: ${e.titleColor};
876
+ }
877
+ .cluster-label span,p {
878
+ color: ${e.titleColor};
879
+ }
880
+
881
+
882
+
883
+ .label text,span,p {
884
+ fill: ${e.nodeTextColor || e.textColor};
885
+ color: ${e.nodeTextColor || e.textColor};
886
+ }
887
+
888
+ .node rect,
889
+ .node circle,
890
+ .node ellipse,
891
+ .node polygon,
892
+ .node path {
893
+ fill: ${e.mainBkg};
894
+ stroke: ${e.nodeBorder};
895
+ stroke-width: 1px;
896
+ }
897
+ .flowchart-label text {
898
+ text-anchor: middle;
899
+ }
900
+ // .flowchart-label .text-outer-tspan {
901
+ // text-anchor: middle;
902
+ // }
903
+ // .flowchart-label .text-inner-tspan {
904
+ // text-anchor: start;
905
+ // }
906
+
907
+ .node .label {
908
+ text-align: center;
909
+ }
910
+ .node.clickable {
911
+ cursor: pointer;
912
+ }
913
+
914
+ .arrowheadPath {
915
+ fill: ${e.arrowheadColor};
916
+ }
917
+
918
+ .edgePath .path {
919
+ stroke: ${e.lineColor};
920
+ stroke-width: 2.0px;
921
+ }
922
+
923
+ .flowchart-link {
924
+ stroke: ${e.lineColor};
925
+ fill: none;
926
+ }
927
+
928
+ .edgeLabel {
929
+ background-color: ${e.edgeLabelBackground};
930
+ /*
931
+ * This is for backward compatibility with existing code that didn't
932
+ * add a \`<p>\` around edge labels.
933
+ *
934
+ * TODO: We should probably remove this in a future release.
935
+ */
936
+ p {
937
+ margin: 0;
938
+ padding: 0;
939
+ display: inline;
940
+ }
941
+ rect {
942
+ opacity: 0.5;
943
+ background-color: ${e.edgeLabelBackground};
944
+ fill: ${e.edgeLabelBackground};
945
+ }
946
+ text-align: center;
947
+ }
948
+
949
+ /* For html labels only */
950
+ .labelBkg {
951
+ background-color: ${e.edgeLabelBackground};
952
+ }
953
+
954
+ .node .cluster {
955
+ // fill: ${bt(e.mainBkg, 0.5)};
956
+ fill: ${bt(e.clusterBkg, 0.5)};
957
+ stroke: ${bt(e.clusterBorder, 0.2)};
958
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
959
+ stroke-width: 1px;
960
+ }
961
+
962
+ .cluster text {
963
+ fill: ${e.titleColor};
964
+ }
965
+
966
+ .cluster span,p {
967
+ color: ${e.titleColor};
968
+ }
969
+ /* .cluster div {
970
+ color: ${e.titleColor};
971
+ } */
972
+
973
+ div.mermaidTooltip {
974
+ position: absolute;
975
+ text-align: center;
976
+ max-width: 200px;
977
+ padding: 2px;
978
+ font-family: ${e.fontFamily};
979
+ font-size: 12px;
980
+ background: ${e.tertiaryColor};
981
+ border: 1px solid ${e.border2};
982
+ border-radius: 2px;
983
+ pointer-events: none;
984
+ z-index: 100;
985
+ }
986
+
987
+ .flowchartTitleText {
988
+ text-anchor: middle;
989
+ font-size: 18px;
990
+ fill: ${e.textColor};
991
+ }
992
+ ${pe()}
993
+ `, "getStyles"), Tr = _r, Dr = /* @__PURE__ */ d((e, t, a, s) => {
994
+ t.forEach((i) => {
995
+ Pr[i](e, a, s);
996
+ });
997
+ }, "insertMarkers"), Br = /* @__PURE__ */ d((e, t, a) => {
998
+ k.trace("Making markers for ", a), e.append("defs").append("marker").attr("id", a + "_" + t + "-extensionStart").attr("class", "marker extension " + t).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", a + "_" + t + "-extensionEnd").attr("class", "marker extension " + t).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");
999
+ }, "extension"), Nr = /* @__PURE__ */ d((e, t, a) => {
1000
+ e.append("defs").append("marker").attr("id", a + "_" + t + "-compositionStart").attr("class", "marker composition " + t).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", a + "_" + t + "-compositionEnd").attr("class", "marker composition " + t).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");
1001
+ }, "composition"), Ir = /* @__PURE__ */ d((e, t, a) => {
1002
+ e.append("defs").append("marker").attr("id", a + "_" + t + "-aggregationStart").attr("class", "marker aggregation " + t).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", a + "_" + t + "-aggregationEnd").attr("class", "marker aggregation " + t).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");
1003
+ }, "aggregation"), Cr = /* @__PURE__ */ d((e, t, a) => {
1004
+ e.append("defs").append("marker").attr("id", a + "_" + t + "-dependencyStart").attr("class", "marker dependency " + t).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", a + "_" + t + "-dependencyEnd").attr("class", "marker dependency " + t).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");
1005
+ }, "dependency"), Or = /* @__PURE__ */ d((e, t, a) => {
1006
+ e.append("defs").append("marker").attr("id", a + "_" + t + "-lollipopStart").attr("class", "marker lollipop " + t).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", a + "_" + t + "-lollipopEnd").attr("class", "marker lollipop " + t).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);
1007
+ }, "lollipop"), Rr = /* @__PURE__ */ d((e, t, a) => {
1008
+ e.append("marker").attr("id", a + "_" + t + "-pointEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).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", a + "_" + t + "-pointStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).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");
1009
+ }, "point"), Ar = /* @__PURE__ */ d((e, t, a) => {
1010
+ e.append("marker").attr("id", a + "_" + t + "-circleEnd").attr("class", "marker " + t).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", a + "_" + t + "-circleStart").attr("class", "marker " + t).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");
1011
+ }, "circle"), zr = /* @__PURE__ */ d((e, t, a) => {
1012
+ e.append("marker").attr("id", a + "_" + t + "-crossEnd").attr("class", "marker cross " + t).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", a + "_" + t + "-crossStart").attr("class", "marker cross " + t).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");
1013
+ }, "cross"), Mr = /* @__PURE__ */ d((e, t, a) => {
1014
+ e.append("defs").append("marker").attr("id", a + "_" + t + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
1015
+ }, "barb"), Pr = {
1016
+ extension: Br,
1017
+ composition: Nr,
1018
+ aggregation: Ir,
1019
+ dependency: Cr,
1020
+ lollipop: Or,
1021
+ point: Rr,
1022
+ circle: Ar,
1023
+ cross: zr,
1024
+ barb: Mr
1025
+ }, Fr = Dr, C = A()?.block?.padding ?? 8;
1026
+ function St(e, t) {
1027
+ if (e === 0 || !Number.isInteger(e))
1028
+ throw new Error("Columns must be an integer !== 0.");
1029
+ if (t < 0 || !Number.isInteger(t))
1030
+ throw new Error("Position must be a non-negative integer." + t);
1031
+ if (e < 0)
1032
+ return { px: t, py: 0 };
1033
+ if (e === 1)
1034
+ return { px: 0, py: t };
1035
+ const a = t % e, s = Math.floor(t / e);
1036
+ return { px: a, py: s };
1037
+ }
1038
+ d(St, "calculateBlockPosition");
1039
+ var Wr = /* @__PURE__ */ d((e) => {
1040
+ let t = 0, a = 0;
1041
+ for (const s of e.children) {
1042
+ const { width: i, height: c, x: r, y: n } = s.size ?? { width: 0, height: 0, x: 0, y: 0 };
1043
+ if (k.debug(
1044
+ "getMaxChildSize abc95 child:",
1045
+ s.id,
1046
+ "width:",
1047
+ i,
1048
+ "height:",
1049
+ c,
1050
+ "x:",
1051
+ r,
1052
+ "y:",
1053
+ n,
1054
+ s.type
1055
+ ), s.type === "space")
1056
+ continue;
1057
+ const l = i / (s.widthInColumns ?? 1);
1058
+ l > t && (t = l), c > a && (a = c);
1059
+ }
1060
+ return { width: t, height: a };
1061
+ }, "getMaxChildSize");
1062
+ function ot(e, t, a = 0, s = 0) {
1063
+ k.debug(
1064
+ "setBlockSizes abc95 (start)",
1065
+ e.id,
1066
+ e?.size?.x,
1067
+ "block width =",
1068
+ e?.size,
1069
+ "siblingWidth",
1070
+ a
1071
+ ), e?.size?.width || (e.size = {
1072
+ width: a,
1073
+ height: s,
1074
+ x: 0,
1075
+ y: 0
1076
+ });
1077
+ let i = 0, c = 0;
1078
+ if (e.children?.length > 0) {
1079
+ for (const x of e.children)
1080
+ ot(x, t);
1081
+ const r = Wr(e);
1082
+ i = r.width, c = r.height, k.debug("setBlockSizes abc95 maxWidth of", e.id, ":s children is ", i, c);
1083
+ for (const x of e.children)
1084
+ x.size && (k.debug(
1085
+ `abc95 Setting size of children of ${e.id} id=${x.id} ${i} ${c} ${JSON.stringify(x.size)}`
1086
+ ), x.size.width = i * (x.widthInColumns ?? 1) + C * ((x.widthInColumns ?? 1) - 1), x.size.height = c, x.size.x = 0, x.size.y = 0, k.debug(
1087
+ `abc95 updating size of ${e.id} children child:${x.id} maxWidth:${i} maxHeight:${c}`
1088
+ ));
1089
+ for (const x of e.children)
1090
+ ot(x, t, i, c);
1091
+ const n = e.columns ?? -1;
1092
+ let l = 0;
1093
+ for (const x of e.children)
1094
+ l += x.widthInColumns ?? 1;
1095
+ let g = e.children.length;
1096
+ n > 0 && n < l && (g = n);
1097
+ const o = Math.ceil(l / g);
1098
+ let p = g * (i + C) + C, b = o * (c + C) + C;
1099
+ if (p < a) {
1100
+ k.debug(
1101
+ `Detected to small sibling: abc95 ${e.id} siblingWidth ${a} siblingHeight ${s} width ${p}`
1102
+ ), p = a, b = s;
1103
+ const x = (a - g * C - C) / g, w = (s - o * C - C) / o;
1104
+ k.debug("Size indata abc88", e.id, "childWidth", x, "maxWidth", i), k.debug("Size indata abc88", e.id, "childHeight", w, "maxHeight", c), k.debug("Size indata abc88 xSize", g, "padding", C);
1105
+ for (const v of e.children)
1106
+ v.size && (v.size.width = x, v.size.height = w, v.size.x = 0, v.size.y = 0);
1107
+ }
1108
+ if (k.debug(
1109
+ `abc95 (finale calc) ${e.id} xSize ${g} ySize ${o} columns ${n}${e.children.length} width=${Math.max(p, e.size?.width || 0)}`
1110
+ ), p < (e?.size?.width || 0)) {
1111
+ p = e?.size?.width || 0;
1112
+ const x = n > 0 ? Math.min(e.children.length, n) : e.children.length;
1113
+ if (x > 0) {
1114
+ const w = (p - x * C - C) / x;
1115
+ k.debug("abc95 (growing to fit) width", e.id, p, e.size?.width, w);
1116
+ for (const v of e.children)
1117
+ v.size && (v.size.width = w);
1118
+ }
1119
+ }
1120
+ e.size = {
1121
+ width: p,
1122
+ height: b,
1123
+ x: 0,
1124
+ y: 0
1125
+ };
1126
+ }
1127
+ k.debug(
1128
+ "setBlockSizes abc94 (done)",
1129
+ e.id,
1130
+ e?.size?.x,
1131
+ e?.size?.width,
1132
+ e?.size?.y,
1133
+ e?.size?.height
1134
+ );
1135
+ }
1136
+ d(ot, "setBlockSizes");
1137
+ function Dt(e, t) {
1138
+ k.debug(
1139
+ `abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`
1140
+ );
1141
+ const a = e.columns ?? -1;
1142
+ if (k.debug("layoutBlocks columns abc95", e.id, "=>", a, e), e.children && // find max width of children
1143
+ e.children.length > 0) {
1144
+ const s = e?.children[0]?.size?.width ?? 0, i = e.children.length * s + (e.children.length - 1) * C;
1145
+ k.debug("widthOfChildren 88", i, "posX");
1146
+ const c = /* @__PURE__ */ new Map();
1147
+ {
1148
+ let o = 0;
1149
+ for (const p of e.children) {
1150
+ if (!p.size)
1151
+ continue;
1152
+ const { py: b } = St(a, o), x = c.get(b) ?? 0;
1153
+ p.size.height > x && c.set(b, p.size.height);
1154
+ let w = p?.widthInColumns ?? 1;
1155
+ a > 0 && (w = Math.min(w, a - o % a)), o += w;
1156
+ }
1157
+ }
1158
+ const r = /* @__PURE__ */ new Map();
1159
+ {
1160
+ let o = 0;
1161
+ const p = [...c.keys()].sort((b, x) => b - x);
1162
+ for (const b of p)
1163
+ r.set(b, o), o += (c.get(b) ?? 0) + C;
1164
+ }
1165
+ let n = 0;
1166
+ k.debug("abc91 block?.size?.x", e.id, e?.size?.x);
1167
+ let l = e?.size?.x ? e?.size?.x + (-e?.size?.width / 2 || 0) : -C, g = 0;
1168
+ for (const o of e.children) {
1169
+ const p = e;
1170
+ if (!o.size)
1171
+ continue;
1172
+ const { width: b, height: x } = o.size, { px: w, py: v } = St(a, n);
1173
+ if (v != g && (g = v, l = e?.size?.x ? e?.size?.x + (-e?.size?.width / 2 || 0) : -C, k.debug("New row in layout for block", e.id, " and child ", o.id, g)), k.debug(
1174
+ `abc89 layout blocks (child) id: ${o.id} Pos: ${n} (px, py) ${w},${v} (${p?.size?.x},${p?.size?.y}) parent: ${p.id} width: ${b}${C}`
1175
+ ), p.size) {
1176
+ const _ = b / 2;
1177
+ o.size.x = l + C + _, k.debug(
1178
+ `abc91 layout blocks (calc) px, pyid:${o.id} startingPos=X${l} new startingPosX${o.size.x} ${_} padding=${C} width=${b} halfWidth=${_} => x:${o.size.x} y:${o.size.y} ${o.widthInColumns} (width * (child?.w || 1)) / 2 ${b * (o?.widthInColumns ?? 1) / 2}`
1179
+ ), l = o.size.x + _;
1180
+ const I = r.get(v) ?? 0, T = c.get(v) ?? x;
1181
+ o.size.y = p.size.y - p.size.height / 2 + I + T / 2 + C, k.debug(
1182
+ `abc88 layout blocks (calc) px, pyid:${o.id}startingPosX${l}${C}${_}=>x:${o.size.x}y:${o.size.y}${o.widthInColumns}(width * (child?.w || 1)) / 2${b * (o?.widthInColumns ?? 1) / 2}`
1183
+ );
1184
+ }
1185
+ o.children && Dt(o);
1186
+ let S = o?.widthInColumns ?? 1;
1187
+ a > 0 && (S = Math.min(S, a - n % a)), n += S, k.debug("abc88 columnsPos", o, n);
1188
+ }
1189
+ }
1190
+ k.debug(
1191
+ `layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`
1192
+ );
1193
+ }
1194
+ d(Dt, "layoutBlocks");
1195
+ function Bt(e, { minX: t, minY: a, maxX: s, maxY: i } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
1196
+ if (e.size && e.id !== "root") {
1197
+ const { x: c, y: r, width: n, height: l } = e.size;
1198
+ c - n / 2 < t && (t = c - n / 2), r - l / 2 < a && (a = r - l / 2), c + n / 2 > s && (s = c + n / 2), r + l / 2 > i && (i = r + l / 2);
1199
+ }
1200
+ if (e.children)
1201
+ for (const c of e.children)
1202
+ ({ minX: t, minY: a, maxX: s, maxY: i } = Bt(c, { minX: t, minY: a, maxX: s, maxY: i }));
1203
+ return { minX: t, minY: a, maxX: s, maxY: i };
1204
+ }
1205
+ d(Bt, "findBounds");
1206
+ function $t(e) {
1207
+ const t = e.getBlock("root");
1208
+ if (!t)
1209
+ return;
1210
+ ot(t, e, 0, 0), Dt(t), k.debug("getBlocks", JSON.stringify(t, null, 2));
1211
+ const { minX: a, minY: s, maxX: i, maxY: c } = Bt(t), r = c - s, n = i - a;
1212
+ return { x: a, y: s, width: n, height: r };
1213
+ }
1214
+ d($t, "layout");
1215
+ var Yr = /* @__PURE__ */ d(async (e, t, a, s = !1, i = !1) => {
1216
+ let c = t || "";
1217
+ typeof c == "object" && (c = c[0]);
1218
+ const r = A(), n = P(r);
1219
+ return await vt(
1220
+ e,
1221
+ c,
1222
+ {
1223
+ style: a,
1224
+ isTitle: s,
1225
+ useHtmlLabels: n,
1226
+ markdown: !1,
1227
+ isNode: i,
1228
+ width: Number.POSITIVE_INFINITY
1229
+ },
1230
+ r
1231
+ );
1232
+ }, "createLabel"), U = Yr, Hr = /* @__PURE__ */ d((e, t, a, s, i) => {
1233
+ t.arrowTypeStart && Pt(e, "start", t.arrowTypeStart, a, s, i), t.arrowTypeEnd && Pt(e, "end", t.arrowTypeEnd, a, s, i);
1234
+ }, "addEdgeMarkers"), Kr = {
1235
+ arrow_cross: "cross",
1236
+ arrow_point: "point",
1237
+ arrow_barb: "barb",
1238
+ arrow_circle: "circle",
1239
+ aggregation: "aggregation",
1240
+ extension: "extension",
1241
+ composition: "composition",
1242
+ dependency: "dependency",
1243
+ lollipop: "lollipop"
1244
+ }, Pt = /* @__PURE__ */ d((e, t, a, s, i, c) => {
1245
+ const r = Kr[a];
1246
+ if (!r) {
1247
+ k.warn(`Unknown arrow type: ${a}`);
1248
+ return;
1249
+ }
1250
+ const n = t === "start" ? "Start" : "End";
1251
+ e.attr(`marker-${t}`, `url(${s}#${i}_${c}-${r}${n})`);
1252
+ }, "addEdgeMarker"), Lt = {}, M = {}, Ur = /* @__PURE__ */ d(async (e, t) => {
1253
+ const a = A(), s = P(a), i = e.insert("g").attr("class", "edgeLabel"), c = i.insert("g").attr("class", "label"), r = t.labelType === "markdown", n = await vt(
1254
+ e,
1255
+ t.label,
1256
+ {
1257
+ style: t.labelStyle,
1258
+ useHtmlLabels: s,
1259
+ // TODO: The old code only set addSvgBackground when using markdown, but
1260
+ // this function is only used by block diagrams which never use markdown.
1261
+ addSvgBackground: r,
1262
+ isNode: !1,
1263
+ markdown: r,
1264
+ // If using markdown, wrap using default width
1265
+ width: r ? void 0 : Number.POSITIVE_INFINITY
1266
+ },
1267
+ a
1268
+ );
1269
+ c.node().appendChild(n);
1270
+ let l = n.getBBox(), g = l;
1271
+ if (s) {
1272
+ const p = n.children[0], b = D(n);
1273
+ l = p.getBoundingClientRect(), g = l, b.attr("width", l.width), b.attr("height", l.height);
1274
+ } else {
1275
+ const p = D(n).select("text").node();
1276
+ p && typeof p.getBBox == "function" && (g = p.getBBox());
1277
+ }
1278
+ c.attr("transform", $(g, s)), Lt[t.id] = i, t.width = l.width, t.height = l.height;
1279
+ let o;
1280
+ if (t.startLabelLeft) {
1281
+ const p = e.insert("g").attr("class", "edgeTerminals"), b = p.insert("g").attr("class", "inner"), x = await U(b, t.startLabelLeft, t.labelStyle);
1282
+ o = x;
1283
+ let w = x.getBBox();
1284
+ if (s) {
1285
+ const v = x.children[0], S = D(x);
1286
+ w = v.getBoundingClientRect(), S.attr("width", w.width), S.attr("height", w.height);
1287
+ }
1288
+ b.attr("transform", $(w, s)), M[t.id] || (M[t.id] = {}), M[t.id].startLeft = p, et(o, t.startLabelLeft);
1289
+ }
1290
+ if (t.startLabelRight) {
1291
+ const p = e.insert("g").attr("class", "edgeTerminals"), b = p.insert("g").attr("class", "inner"), x = await U(b, t.startLabelRight, t.labelStyle);
1292
+ o = x;
1293
+ let w = x.getBBox();
1294
+ if (s) {
1295
+ const v = x.children[0], S = D(x);
1296
+ w = v.getBoundingClientRect(), S.attr("width", w.width), S.attr("height", w.height);
1297
+ }
1298
+ b.attr("transform", $(w, s)), M[t.id] || (M[t.id] = {}), M[t.id].startRight = p, et(o, t.startLabelRight);
1299
+ }
1300
+ if (t.endLabelLeft) {
1301
+ const p = e.insert("g").attr("class", "edgeTerminals"), b = p.insert("g").attr("class", "inner"), x = await U(p, t.endLabelLeft, t.labelStyle);
1302
+ o = x;
1303
+ let w = x.getBBox();
1304
+ if (s) {
1305
+ const v = x.children[0], S = D(x);
1306
+ w = v.getBoundingClientRect(), S.attr("width", w.width), S.attr("height", w.height);
1307
+ }
1308
+ b.attr("transform", $(w, s)), M[t.id] || (M[t.id] = {}), M[t.id].endLeft = p, et(o, t.endLabelLeft);
1309
+ }
1310
+ if (t.endLabelRight) {
1311
+ const p = e.insert("g").attr("class", "edgeTerminals"), b = p.insert("g").attr("class", "inner"), x = await U(
1312
+ p,
1313
+ t.endLabelRight,
1314
+ t.labelStyle
1315
+ );
1316
+ o = x;
1317
+ let w = x.getBBox();
1318
+ if (s) {
1319
+ const v = x.children[0], S = D(x);
1320
+ w = v.getBoundingClientRect(), S.attr("width", w.width), S.attr("height", w.height);
1321
+ }
1322
+ b.attr("transform", $(w, s)), M[t.id] || (M[t.id] = {}), M[t.id].endRight = p, et(o, t.endLabelRight);
1323
+ }
1324
+ return n;
1325
+ }, "insertEdgeLabel");
1326
+ function et(e, t) {
1327
+ P(A()) && e && (e.style.width = t.length * 9 + "px", e.style.height = "12px");
1328
+ }
1329
+ d(et, "setTerminalWidth");
1330
+ var Xr = /* @__PURE__ */ d((e, t) => {
1331
+ k.debug("Moving label abc88 ", e.id, e.label, Lt[e.id], t);
1332
+ let a = t.updatedPath ? t.updatedPath : t.originalPath;
1333
+ const s = A(), { subGraphTitleTotalMargin: i } = Ve(s);
1334
+ if (e.label) {
1335
+ const c = Lt[e.id];
1336
+ let r = e.x, n = e.y;
1337
+ if (a) {
1338
+ const l = tt.calcLabelPosition(a);
1339
+ k.debug(
1340
+ "Moving label " + e.label + " from (",
1341
+ r,
1342
+ ",",
1343
+ n,
1344
+ ") to (",
1345
+ l.x,
1346
+ ",",
1347
+ l.y,
1348
+ ") abc88"
1349
+ ), t.updatedPath && (r = l.x, n = l.y);
1350
+ }
1351
+ c.attr("transform", `translate(${r}, ${n + i / 2})`);
1352
+ }
1353
+ if (e.startLabelLeft) {
1354
+ const c = M[e.id].startLeft;
1355
+ let r = e.x, n = e.y;
1356
+ if (a) {
1357
+ const l = tt.calcTerminalLabelPosition(e.arrowTypeStart ? 10 : 0, "start_left", a);
1358
+ r = l.x, n = l.y;
1359
+ }
1360
+ c.attr("transform", `translate(${r}, ${n})`);
1361
+ }
1362
+ if (e.startLabelRight) {
1363
+ const c = M[e.id].startRight;
1364
+ let r = e.x, n = e.y;
1365
+ if (a) {
1366
+ const l = tt.calcTerminalLabelPosition(
1367
+ e.arrowTypeStart ? 10 : 0,
1368
+ "start_right",
1369
+ a
1370
+ );
1371
+ r = l.x, n = l.y;
1372
+ }
1373
+ c.attr("transform", `translate(${r}, ${n})`);
1374
+ }
1375
+ if (e.endLabelLeft) {
1376
+ const c = M[e.id].endLeft;
1377
+ let r = e.x, n = e.y;
1378
+ if (a) {
1379
+ const l = tt.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_left", a);
1380
+ r = l.x, n = l.y;
1381
+ }
1382
+ c.attr("transform", `translate(${r}, ${n})`);
1383
+ }
1384
+ if (e.endLabelRight) {
1385
+ const c = M[e.id].endRight;
1386
+ let r = e.x, n = e.y;
1387
+ if (a) {
1388
+ const l = tt.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_right", a);
1389
+ r = l.x, n = l.y;
1390
+ }
1391
+ c.attr("transform", `translate(${r}, ${n})`);
1392
+ }
1393
+ }, "positionEdgeLabel"), Vr = /* @__PURE__ */ d((e, t) => {
1394
+ const a = e.x, s = e.y, i = Math.abs(t.x - a), c = Math.abs(t.y - s), r = e.width / 2, n = e.height / 2;
1395
+ return i >= r || c >= n;
1396
+ }, "outsideNode"), jr = /* @__PURE__ */ d((e, t, a) => {
1397
+ k.debug(`intersection calc abc89:
1398
+ outsidePoint: ${JSON.stringify(t)}
1399
+ insidePoint : ${JSON.stringify(a)}
1400
+ node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);
1401
+ const s = e.x, i = e.y, c = Math.abs(s - a.x), r = e.width / 2;
1402
+ let n = a.x < t.x ? r - c : r + c;
1403
+ const l = e.height / 2, g = Math.abs(t.y - a.y), o = Math.abs(t.x - a.x);
1404
+ if (Math.abs(i - t.y) * r > Math.abs(s - t.x) * l) {
1405
+ let p = a.y < t.y ? t.y - l - i : i - l - t.y;
1406
+ n = o * p / g;
1407
+ const b = {
1408
+ x: a.x < t.x ? a.x + n : a.x - o + n,
1409
+ y: a.y < t.y ? a.y + g - p : a.y - g + p
1410
+ };
1411
+ return n === 0 && (b.x = t.x, b.y = t.y), o === 0 && (b.x = t.x), g === 0 && (b.y = t.y), k.debug(`abc89 topp/bott calc, Q ${g}, q ${p}, R ${o}, r ${n}`, b), b;
1412
+ } else {
1413
+ a.x < t.x ? n = t.x - r - s : n = s - r - t.x;
1414
+ let p = g * n / o, b = a.x < t.x ? a.x + o - n : a.x - o + n, x = a.y < t.y ? a.y + p : a.y - p;
1415
+ return k.debug(`sides calc abc89, Q ${g}, q ${p}, R ${o}, r ${n}`, { _x: b, _y: x }), n === 0 && (b = t.x, x = t.y), o === 0 && (b = t.x), g === 0 && (x = t.y), { x: b, y: x };
1416
+ }
1417
+ }, "intersection"), Ft = /* @__PURE__ */ d((e, t) => {
1418
+ k.debug("abc88 cutPathAtIntersect", e, t);
1419
+ let a = [], s = e[0], i = !1;
1420
+ return e.forEach((c) => {
1421
+ if (!Vr(t, c) && !i) {
1422
+ const r = jr(t, s, c);
1423
+ let n = !1;
1424
+ a.forEach((l) => {
1425
+ n = n || l.x === r.x && l.y === r.y;
1426
+ }), a.some((l) => l.x === r.x && l.y === r.y) || a.push(r), i = !0;
1427
+ } else
1428
+ s = c, i || a.push(c);
1429
+ }), a;
1430
+ }, "cutPathAtIntersect"), Gr = /* @__PURE__ */ d(function(e, t, a, s, i, c, r) {
1431
+ let n = a.points;
1432
+ k.debug("abc88 InsertEdge: edge=", a, "e=", t);
1433
+ let l = !1;
1434
+ const g = c.node(t.v);
1435
+ var o = c.node(t.w);
1436
+ o?.intersect && g?.intersect && (n = n.slice(1, a.points.length - 1), n.unshift(g.intersect(n[0])), n.push(o.intersect(n[n.length - 1]))), a.toCluster && (k.debug("to cluster abc88", s[a.toCluster]), n = Ft(a.points, s[a.toCluster].node), l = !0), a.fromCluster && (k.debug("from cluster abc88", s[a.fromCluster]), n = Ft(n.reverse(), s[a.fromCluster].node).reverse(), l = !0);
1437
+ const p = n.filter((m) => !Number.isNaN(m.y));
1438
+ let b = Ue;
1439
+ a.curve && (i === "graph" || i === "flowchart") && (b = a.curve);
1440
+ const { x, y: w } = He(a), v = Ke().x(x).y(w).curve(b);
1441
+ let S;
1442
+ switch (a.thickness) {
1443
+ case "normal":
1444
+ S = "edge-thickness-normal";
1445
+ break;
1446
+ case "thick":
1447
+ S = "edge-thickness-thick";
1448
+ break;
1449
+ case "invisible":
1450
+ S = "edge-thickness-thick";
1451
+ break;
1452
+ default:
1453
+ S = "";
1454
+ }
1455
+ switch (a.pattern) {
1456
+ case "solid":
1457
+ S += " edge-pattern-solid";
1458
+ break;
1459
+ case "dotted":
1460
+ S += " edge-pattern-dotted";
1461
+ break;
1462
+ case "dashed":
1463
+ S += " edge-pattern-dashed";
1464
+ break;
1465
+ }
1466
+ const _ = e.append("path").attr("d", v(p)).attr("id", a.id).attr("class", " " + S + (a.classes ? " " + a.classes : "")).attr("style", a.style);
1467
+ let I = "";
1468
+ (A().flowchart.arrowMarkerAbsolute || A().state.arrowMarkerAbsolute) && (I = Xe(!0)), Hr(_, a, I, r, i);
1469
+ let T = {};
1470
+ return l && (T.updatedPath = n), T.originalPath = a.points, T;
1471
+ }, "insertEdge"), Zr = /* @__PURE__ */ d((e) => {
1472
+ const t = /* @__PURE__ */ new Set();
1473
+ for (const a of e)
1474
+ switch (a) {
1475
+ case "x":
1476
+ t.add("right"), t.add("left");
1477
+ break;
1478
+ case "y":
1479
+ t.add("up"), t.add("down");
1480
+ break;
1481
+ default:
1482
+ t.add(a);
1483
+ break;
1484
+ }
1485
+ return t;
1486
+ }, "expandAndDeduplicateDirections"), qr = /* @__PURE__ */ d((e, t, a, s) => {
1487
+ const i = Zr(e), c = 2, r = t.height + 2 * a.padding, n = r / c, l = s ?? t.width + 2 * n + a.padding, g = a.padding / 2;
1488
+ return i.has("right") && i.has("left") && i.has("up") && i.has("down") ? [
1489
+ // Bottom
1490
+ { x: 0, y: 0 },
1491
+ { x: n, y: 0 },
1492
+ { x: l / 2, y: 2 * g },
1493
+ { x: l - n, y: 0 },
1494
+ { x: l, y: 0 },
1495
+ // Right
1496
+ { x: l, y: -r / 3 },
1497
+ { x: l + 2 * g, y: -r / 2 },
1498
+ { x: l, y: -2 * r / 3 },
1499
+ { x: l, y: -r },
1500
+ // Top
1501
+ { x: l - n, y: -r },
1502
+ { x: l / 2, y: -r - 2 * g },
1503
+ { x: n, y: -r },
1504
+ // Left
1505
+ { x: 0, y: -r },
1506
+ { x: 0, y: -2 * r / 3 },
1507
+ { x: -2 * g, y: -r / 2 },
1508
+ { x: 0, y: -r / 3 }
1509
+ ] : i.has("right") && i.has("left") && i.has("up") ? [
1510
+ { x: n, y: 0 },
1511
+ { x: l - n, y: 0 },
1512
+ { x: l, y: -r / 2 },
1513
+ { x: l - n, y: -r },
1514
+ { x: n, y: -r },
1515
+ { x: 0, y: -r / 2 }
1516
+ ] : i.has("right") && i.has("left") && i.has("down") ? [
1517
+ { x: 0, y: 0 },
1518
+ { x: n, y: -r },
1519
+ { x: l - n, y: -r },
1520
+ { x: l, y: 0 }
1521
+ ] : i.has("right") && i.has("up") && i.has("down") ? [
1522
+ { x: 0, y: 0 },
1523
+ { x: l, y: -n },
1524
+ { x: l, y: -r + n },
1525
+ { x: 0, y: -r }
1526
+ ] : i.has("left") && i.has("up") && i.has("down") ? [
1527
+ { x: l, y: 0 },
1528
+ { x: 0, y: -n },
1529
+ { x: 0, y: -r + n },
1530
+ { x: l, y: -r }
1531
+ ] : i.has("right") && i.has("left") ? [
1532
+ { x: n, y: 0 },
1533
+ { x: n, y: -g },
1534
+ { x: l - n, y: -g },
1535
+ { x: l - n, y: 0 },
1536
+ { x: l, y: -r / 2 },
1537
+ { x: l - n, y: -r },
1538
+ { x: l - n, y: -r + g },
1539
+ { x: n, y: -r + g },
1540
+ { x: n, y: -r },
1541
+ { x: 0, y: -r / 2 }
1542
+ ] : i.has("up") && i.has("down") ? [
1543
+ // Bottom center
1544
+ { x: l / 2, y: 0 },
1545
+ // Left pont of bottom arrow
1546
+ { x: 0, y: -g },
1547
+ { x: n, y: -g },
1548
+ // Left top over vertical section
1549
+ { x: n, y: -r + g },
1550
+ { x: 0, y: -r + g },
1551
+ // Top of arrow
1552
+ { x: l / 2, y: -r },
1553
+ { x: l, y: -r + g },
1554
+ // Top of right vertical bar
1555
+ { x: l - n, y: -r + g },
1556
+ { x: l - n, y: -g },
1557
+ { x: l, y: -g }
1558
+ ] : i.has("right") && i.has("up") ? [
1559
+ { x: 0, y: 0 },
1560
+ { x: l, y: -n },
1561
+ { x: 0, y: -r }
1562
+ ] : i.has("right") && i.has("down") ? [
1563
+ { x: 0, y: 0 },
1564
+ { x: l, y: 0 },
1565
+ { x: 0, y: -r }
1566
+ ] : i.has("left") && i.has("up") ? [
1567
+ { x: l, y: 0 },
1568
+ { x: 0, y: -n },
1569
+ { x: l, y: -r }
1570
+ ] : i.has("left") && i.has("down") ? [
1571
+ { x: l, y: 0 },
1572
+ { x: 0, y: 0 },
1573
+ { x: l, y: -r }
1574
+ ] : i.has("right") ? [
1575
+ { x: n, y: -g },
1576
+ { x: n, y: -g },
1577
+ { x: l - n, y: -g },
1578
+ { x: l - n, y: 0 },
1579
+ { x: l, y: -r / 2 },
1580
+ { x: l - n, y: -r },
1581
+ { x: l - n, y: -r + g },
1582
+ // top left corner of arrow
1583
+ { x: n, y: -r + g },
1584
+ { x: n, y: -r + g }
1585
+ ] : i.has("left") ? [
1586
+ { x: n, y: 0 },
1587
+ { x: n, y: -g },
1588
+ // Two points, the right corners
1589
+ { x: l - n, y: -g },
1590
+ { x: l - n, y: -r + g },
1591
+ { x: n, y: -r + g },
1592
+ { x: n, y: -r },
1593
+ { x: 0, y: -r / 2 }
1594
+ ] : i.has("up") ? [
1595
+ // Bottom center
1596
+ { x: n, y: -g },
1597
+ // Left top over vertical section
1598
+ { x: n, y: -r + g },
1599
+ { x: 0, y: -r + g },
1600
+ // Top of arrow
1601
+ { x: l / 2, y: -r },
1602
+ { x: l, y: -r + g },
1603
+ // Top of right vertical bar
1604
+ { x: l - n, y: -r + g },
1605
+ { x: l - n, y: -g }
1606
+ ] : i.has("down") ? [
1607
+ // Bottom center
1608
+ { x: l / 2, y: 0 },
1609
+ // Left pont of bottom arrow
1610
+ { x: 0, y: -g },
1611
+ { x: n, y: -g },
1612
+ // Left top over vertical section
1613
+ { x: n, y: -r + g },
1614
+ { x: l - n, y: -r + g },
1615
+ { x: l - n, y: -g },
1616
+ { x: l, y: -g }
1617
+ ] : [{ x: 0, y: 0 }];
1618
+ }, "getArrowPoints");
1619
+ function te(e, t) {
1620
+ return e.intersect(t);
1621
+ }
1622
+ d(te, "intersectNode");
1623
+ var Jr = te;
1624
+ function ee(e, t, a, s) {
1625
+ var i = e.x, c = e.y, r = i - s.x, n = c - s.y, l = Math.sqrt(t * t * n * n + a * a * r * r), g = Math.abs(t * a * r / l);
1626
+ s.x < i && (g = -g);
1627
+ var o = Math.abs(t * a * n / l);
1628
+ return s.y < c && (o = -o), { x: i + g, y: c + o };
1629
+ }
1630
+ d(ee, "intersectEllipse");
1631
+ var re = ee;
1632
+ function ae(e, t, a) {
1633
+ return re(e, t, t, a);
1634
+ }
1635
+ d(ae, "intersectCircle");
1636
+ var Qr = ae;
1637
+ function se(e, t, a, s) {
1638
+ var i, c, r, n, l, g, o, p, b, x, w, v, S, _, I;
1639
+ if (i = t.y - e.y, r = e.x - t.x, l = t.x * e.y - e.x * t.y, b = i * a.x + r * a.y + l, x = i * s.x + r * s.y + l, !(b !== 0 && x !== 0 && kt(b, x)) && (c = s.y - a.y, n = a.x - s.x, g = s.x * a.y - a.x * s.y, o = c * e.x + n * e.y + g, p = c * t.x + n * t.y + g, !(o !== 0 && p !== 0 && kt(o, p)) && (w = i * n - c * r, w !== 0)))
1640
+ return v = Math.abs(w / 2), S = r * g - n * l, _ = S < 0 ? (S - v) / w : (S + v) / w, S = c * l - i * g, I = S < 0 ? (S - v) / w : (S + v) / w, { x: _, y: I };
1641
+ }
1642
+ d(se, "intersectLine");
1643
+ function kt(e, t) {
1644
+ return e * t > 0;
1645
+ }
1646
+ d(kt, "sameSign");
1647
+ var $r = se, ta = ie;
1648
+ function ie(e, t, a) {
1649
+ var s = e.x, i = e.y, c = [], r = Number.POSITIVE_INFINITY, n = Number.POSITIVE_INFINITY;
1650
+ typeof t.forEach == "function" ? t.forEach(function(w) {
1651
+ r = Math.min(r, w.x), n = Math.min(n, w.y);
1652
+ }) : (r = Math.min(r, t.x), n = Math.min(n, t.y));
1653
+ for (var l = s - e.width / 2 - r, g = i - e.height / 2 - n, o = 0; o < t.length; o++) {
1654
+ var p = t[o], b = t[o < t.length - 1 ? o + 1 : 0], x = $r(
1655
+ e,
1656
+ a,
1657
+ { x: l + p.x, y: g + p.y },
1658
+ { x: l + b.x, y: g + b.y }
1659
+ );
1660
+ x && c.push(x);
1661
+ }
1662
+ return c.length ? (c.length > 1 && c.sort(function(w, v) {
1663
+ var S = w.x - a.x, _ = w.y - a.y, I = Math.sqrt(S * S + _ * _), T = v.x - a.x, m = v.y - a.y, u = Math.sqrt(T * T + m * m);
1664
+ return I < u ? -1 : I === u ? 0 : 1;
1665
+ }), c[0]) : e;
1666
+ }
1667
+ d(ie, "intersectPolygon");
1668
+ var ea = /* @__PURE__ */ d((e, t) => {
1669
+ var a = e.x, s = e.y, i = t.x - a, c = t.y - s, r = e.width / 2, n = e.height / 2, l, g;
1670
+ return Math.abs(c) * r > Math.abs(i) * n ? (c < 0 && (n = -n), l = c === 0 ? 0 : n * i / c, g = n) : (i < 0 && (r = -r), l = r, g = i === 0 ? 0 : r * c / i), { x: a + l, y: s + g };
1671
+ }, "intersectRect"), ra = ea, B = {
1672
+ node: Jr,
1673
+ circle: Qr,
1674
+ ellipse: re,
1675
+ polygon: ta,
1676
+ rect: ra
1677
+ }, z = /* @__PURE__ */ d(async (e, t, a, s) => {
1678
+ const i = A();
1679
+ let c;
1680
+ const r = t.useHtmlLabels || P(i);
1681
+ a ? c = a : c = "node default";
1682
+ const n = e.insert("g").attr("class", c).attr("id", t.domId || t.id), l = n.insert("g").attr("class", "label").attr("style", t.labelStyle);
1683
+ let g;
1684
+ t.labelText === void 0 ? g = "" : g = typeof t.labelText == "string" ? t.labelText : t.labelText[0];
1685
+ let o;
1686
+ t.labelType === "markdown" ? o = vt(
1687
+ l,
1688
+ Ot(Rt(g), i),
1689
+ {
1690
+ useHtmlLabels: r,
1691
+ width: t.width || i.flowchart.wrappingWidth,
1692
+ classes: "markdown-node-label"
1693
+ },
1694
+ i
1695
+ ) : o = await U(
1696
+ l,
1697
+ Ot(Rt(g), i),
1698
+ t.labelStyle,
1699
+ !1,
1700
+ s
1701
+ );
1702
+ let p = o.getBBox();
1703
+ const b = t.padding / 2;
1704
+ if (P(i)) {
1705
+ const x = o.children[0], w = D(o);
1706
+ await Ze(x, g), p = x.getBoundingClientRect(), w.attr("width", p.width), w.attr("height", p.height);
1707
+ }
1708
+ return r ? l.attr("transform", "translate(" + -p.width / 2 + ", " + -p.height / 2 + ")") : l.attr("transform", "translate(0, " + -p.height / 2 + ")"), t.centerLabel && l.attr("transform", "translate(" + -p.width / 2 + ", " + -p.height / 2 + ")"), l.insert("rect", ":first-child"), { shapeSvg: n, bbox: p, halfPadding: b, label: l };
1709
+ }, "labelHelper"), N = /* @__PURE__ */ d((e, t) => {
1710
+ const a = t.node().getBBox();
1711
+ e.width = a.width, e.height = a.height;
1712
+ }, "updateNodeBounds");
1713
+ function V(e, t, a, s) {
1714
+ return e.insert("polygon", ":first-child").attr(
1715
+ "points",
1716
+ s.map(function(i) {
1717
+ return i.x + "," + i.y;
1718
+ }).join(" ")
1719
+ ).attr("class", "label-container").attr("transform", "translate(" + -t / 2 + "," + a / 2 + ")");
1720
+ }
1721
+ d(V, "insertPolygonShape");
1722
+ var aa = /* @__PURE__ */ d(async (e, t) => {
1723
+ t.useHtmlLabels || P(A()) || (t.centerLabel = !0);
1724
+ const { shapeSvg: s, bbox: i, halfPadding: c } = await z(
1725
+ e,
1726
+ t,
1727
+ "node " + t.classes,
1728
+ !0
1729
+ );
1730
+ k.info("Classes = ", t.classes);
1731
+ const r = s.insert("rect", ":first-child");
1732
+ return r.attr("rx", t.rx).attr("ry", t.ry).attr("x", -i.width / 2 - c).attr("y", -i.height / 2 - c).attr("width", i.width + t.padding).attr("height", i.height + t.padding), N(t, r), t.intersect = function(n) {
1733
+ return B.rect(t, n);
1734
+ }, s;
1735
+ }, "note"), sa = aa, Wt = /* @__PURE__ */ d((e) => e ? " " + e : "", "formatClass"), H = /* @__PURE__ */ d((e, t) => `${t || "node default"}${Wt(e.classes)} ${Wt(
1736
+ e.class
1737
+ )}`, "getClassesFromNode"), Yt = /* @__PURE__ */ d(async (e, t) => {
1738
+ const { shapeSvg: a, bbox: s } = await z(
1739
+ e,
1740
+ t,
1741
+ H(t, void 0),
1742
+ !0
1743
+ ), i = s.width + t.padding, c = s.height + t.padding, r = i + c, n = [
1744
+ { x: r / 2, y: 0 },
1745
+ { x: r, y: -r / 2 },
1746
+ { x: r / 2, y: -r },
1747
+ { x: 0, y: -r / 2 }
1748
+ ];
1749
+ k.info("Question main (Circle)");
1750
+ const l = V(a, r, r, n);
1751
+ return l.attr("style", t.style), N(t, l), t.intersect = function(g) {
1752
+ return k.warn("Intersect called"), B.polygon(t, n, g);
1753
+ }, a;
1754
+ }, "question"), ia = /* @__PURE__ */ d((e, t) => {
1755
+ const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), s = 28, i = [
1756
+ { x: 0, y: s / 2 },
1757
+ { x: s / 2, y: 0 },
1758
+ { x: 0, y: -s / 2 },
1759
+ { x: -s / 2, y: 0 }
1760
+ ];
1761
+ return a.insert("polygon", ":first-child").attr(
1762
+ "points",
1763
+ i.map(function(r) {
1764
+ return r.x + "," + r.y;
1765
+ }).join(" ")
1766
+ ).attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28), t.width = 28, t.height = 28, t.intersect = function(r) {
1767
+ return B.circle(t, 14, r);
1768
+ }, a;
1769
+ }, "choice"), na = /* @__PURE__ */ d(async (e, t) => {
1770
+ const { shapeSvg: a, bbox: s } = await z(
1771
+ e,
1772
+ t,
1773
+ H(t, void 0),
1774
+ !0
1775
+ ), i = 4, c = t.positioned ? t.height : s.height + t.padding, r = c / i, n = t.positioned ? t.width : s.width + 2 * r + t.padding, l = [
1776
+ { x: r, y: 0 },
1777
+ { x: n - r, y: 0 },
1778
+ { x: n, y: -c / 2 },
1779
+ { x: n - r, y: -c },
1780
+ { x: r, y: -c },
1781
+ { x: 0, y: -c / 2 }
1782
+ ], g = V(a, n, c, l);
1783
+ return g.attr("style", t.style), N(t, g), t.intersect = function(o) {
1784
+ return B.polygon(t, l, o);
1785
+ }, a;
1786
+ }, "hexagon"), ca = /* @__PURE__ */ d(async (e, t) => {
1787
+ const { shapeSvg: a, bbox: s } = await z(e, t, void 0, !0), i = 2, c = s.height + 2 * t.padding, r = c / i, n = s.width + 2 * r + t.padding, g = t.positioned && (t.widthInColumns ?? 1) > 1 && t.width > n ? t.width : n, o = qr(t.directions, s, t, g), p = V(a, g, c, o);
1788
+ return p.attr("style", t.style), N(t, p), t.intersect = function(b) {
1789
+ return B.polygon(t, o, b);
1790
+ }, a;
1791
+ }, "block_arrow"), la = /* @__PURE__ */ d(async (e, t) => {
1792
+ const { shapeSvg: a, bbox: s } = await z(
1793
+ e,
1794
+ t,
1795
+ H(t, void 0),
1796
+ !0
1797
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
1798
+ { x: -c / 2, y: 0 },
1799
+ { x: i, y: 0 },
1800
+ { x: i, y: -c },
1801
+ { x: -c / 2, y: -c },
1802
+ { x: 0, y: -c / 2 }
1803
+ ];
1804
+ return V(a, i, c, r).attr("style", t.style), t.width = i + c, t.height = c, t.intersect = function(l) {
1805
+ return B.polygon(t, r, l);
1806
+ }, a;
1807
+ }, "rect_left_inv_arrow"), oa = /* @__PURE__ */ d(async (e, t) => {
1808
+ const { shapeSvg: a, bbox: s } = await z(e, t, H(t), !0), i = s.width + t.padding, c = s.height + t.padding, r = [
1809
+ { x: -2 * c / 6, y: 0 },
1810
+ { x: i - c / 6, y: 0 },
1811
+ { x: i + 2 * c / 6, y: -c },
1812
+ { x: c / 6, y: -c }
1813
+ ], n = V(a, i, c, r);
1814
+ return n.attr("style", t.style), N(t, n), t.intersect = function(l) {
1815
+ return B.polygon(t, r, l);
1816
+ }, a;
1817
+ }, "lean_right"), ha = /* @__PURE__ */ d(async (e, t) => {
1818
+ const { shapeSvg: a, bbox: s } = await z(
1819
+ e,
1820
+ t,
1821
+ H(t, void 0),
1822
+ !0
1823
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
1824
+ { x: 2 * c / 6, y: 0 },
1825
+ { x: i + c / 6, y: 0 },
1826
+ { x: i - 2 * c / 6, y: -c },
1827
+ { x: -c / 6, y: -c }
1828
+ ], n = V(a, i, c, r);
1829
+ return n.attr("style", t.style), N(t, n), t.intersect = function(l) {
1830
+ return B.polygon(t, r, l);
1831
+ }, a;
1832
+ }, "lean_left"), ga = /* @__PURE__ */ d(async (e, t) => {
1833
+ const { shapeSvg: a, bbox: s } = await z(
1834
+ e,
1835
+ t,
1836
+ H(t, void 0),
1837
+ !0
1838
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
1839
+ { x: -2 * c / 6, y: 0 },
1840
+ { x: i + 2 * c / 6, y: 0 },
1841
+ { x: i - c / 6, y: -c },
1842
+ { x: c / 6, y: -c }
1843
+ ], n = V(a, i, c, r);
1844
+ return n.attr("style", t.style), N(t, n), t.intersect = function(l) {
1845
+ return B.polygon(t, r, l);
1846
+ }, a;
1847
+ }, "trapezoid"), da = /* @__PURE__ */ d(async (e, t) => {
1848
+ const { shapeSvg: a, bbox: s } = await z(
1849
+ e,
1850
+ t,
1851
+ H(t, void 0),
1852
+ !0
1853
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
1854
+ { x: c / 6, y: 0 },
1855
+ { x: i - c / 6, y: 0 },
1856
+ { x: i + 2 * c / 6, y: -c },
1857
+ { x: -2 * c / 6, y: -c }
1858
+ ], n = V(a, i, c, r);
1859
+ return n.attr("style", t.style), N(t, n), t.intersect = function(l) {
1860
+ return B.polygon(t, r, l);
1861
+ }, a;
1862
+ }, "inv_trapezoid"), ua = /* @__PURE__ */ d(async (e, t) => {
1863
+ const { shapeSvg: a, bbox: s } = await z(
1864
+ e,
1865
+ t,
1866
+ H(t, void 0),
1867
+ !0
1868
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
1869
+ { x: 0, y: 0 },
1870
+ { x: i + c / 2, y: 0 },
1871
+ { x: i, y: -c / 2 },
1872
+ { x: i + c / 2, y: -c },
1873
+ { x: 0, y: -c }
1874
+ ], n = V(a, i, c, r);
1875
+ return n.attr("style", t.style), N(t, n), t.intersect = function(l) {
1876
+ return B.polygon(t, r, l);
1877
+ }, a;
1878
+ }, "rect_right_inv_arrow"), pa = /* @__PURE__ */ d(async (e, t) => {
1879
+ const { shapeSvg: a, bbox: s } = await z(
1880
+ e,
1881
+ t,
1882
+ H(t, void 0),
1883
+ !0
1884
+ ), i = s.width + t.padding, c = i / 2, r = c / (2.5 + i / 50), n = s.height + r + t.padding, l = "M 0," + r + " a " + c + "," + r + " 0,0,0 " + i + " 0 a " + c + "," + r + " 0,0,0 " + -i + " 0 l 0," + n + " a " + c + "," + r + " 0,0,0 " + i + " 0 l 0," + -n, g = a.attr("label-offset-y", r).insert("path", ":first-child").attr("style", t.style).attr("d", l).attr("transform", "translate(" + -i / 2 + "," + -(n / 2 + r) + ")");
1885
+ return N(t, g), t.intersect = function(o) {
1886
+ const p = B.rect(t, o), b = p.x - t.x;
1887
+ if (c != 0 && (Math.abs(b) < t.width / 2 || Math.abs(b) == t.width / 2 && Math.abs(p.y - t.y) > t.height / 2 - r)) {
1888
+ let x = r * r * (1 - b * b / (c * c));
1889
+ x != 0 && (x = Math.sqrt(x)), x = r - x, o.y - t.y > 0 && (x = -x), p.y += x;
1890
+ }
1891
+ return p;
1892
+ }, a;
1893
+ }, "cylinder"), fa = /* @__PURE__ */ d(async (e, t) => {
1894
+ const { shapeSvg: a, bbox: s, halfPadding: i } = await z(
1895
+ e,
1896
+ t,
1897
+ "node " + t.classes + " " + t.class,
1898
+ !0
1899
+ ), c = a.insert("rect", ":first-child"), r = t.positioned ? t.width : s.width + t.padding, n = t.positioned ? t.height : s.height + t.padding, l = t.positioned ? -r / 2 : -s.width / 2 - i, g = t.positioned ? -n / 2 : -s.height / 2 - i;
1900
+ if (c.attr("class", "basic label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", l).attr("y", g).attr("width", r).attr("height", n), t.props) {
1901
+ const o = new Set(Object.keys(t.props));
1902
+ t.props.borders && (ht(c, t.props.borders, r, n), o.delete("borders")), o.forEach((p) => {
1903
+ k.warn(`Unknown node property ${p}`);
1904
+ });
1905
+ }
1906
+ return N(t, c), t.intersect = function(o) {
1907
+ return B.rect(t, o);
1908
+ }, a;
1909
+ }, "rect"), xa = /* @__PURE__ */ d(async (e, t) => {
1910
+ const { shapeSvg: a, bbox: s, halfPadding: i } = await z(
1911
+ e,
1912
+ t,
1913
+ "node " + t.classes,
1914
+ !0
1915
+ ), c = a.insert("rect", ":first-child"), r = t.positioned ? t.width : s.width + t.padding, n = t.positioned ? t.height : s.height + t.padding, l = t.positioned ? -r / 2 : -s.width / 2 - i, g = t.positioned ? -n / 2 : -s.height / 2 - i;
1916
+ if (c.attr("class", "basic cluster composite label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", l).attr("y", g).attr("width", r).attr("height", n), t.props) {
1917
+ const o = new Set(Object.keys(t.props));
1918
+ t.props.borders && (ht(c, t.props.borders, r, n), o.delete("borders")), o.forEach((p) => {
1919
+ k.warn(`Unknown node property ${p}`);
1920
+ });
1921
+ }
1922
+ return N(t, c), t.intersect = function(o) {
1923
+ return B.rect(t, o);
1924
+ }, a;
1925
+ }, "composite"), ya = /* @__PURE__ */ d(async (e, t) => {
1926
+ const { shapeSvg: a } = await z(e, t, "label", !0);
1927
+ k.trace("Classes = ", t.class);
1928
+ const s = a.insert("rect", ":first-child"), i = 0, c = 0;
1929
+ if (s.attr("width", i).attr("height", c), a.attr("class", "label edgeLabel"), t.props) {
1930
+ const r = new Set(Object.keys(t.props));
1931
+ t.props.borders && (ht(s, t.props.borders, i, c), r.delete("borders")), r.forEach((n) => {
1932
+ k.warn(`Unknown node property ${n}`);
1933
+ });
1934
+ }
1935
+ return N(t, s), t.intersect = function(r) {
1936
+ return B.rect(t, r);
1937
+ }, a;
1938
+ }, "labelRect");
1939
+ function ht(e, t, a, s) {
1940
+ const i = [], c = /* @__PURE__ */ d((n) => {
1941
+ i.push(n, 0);
1942
+ }, "addBorder"), r = /* @__PURE__ */ d((n) => {
1943
+ i.push(0, n);
1944
+ }, "skipBorder");
1945
+ t.includes("t") ? (k.debug("add top border"), c(a)) : r(a), t.includes("r") ? (k.debug("add right border"), c(s)) : r(s), t.includes("b") ? (k.debug("add bottom border"), c(a)) : r(a), t.includes("l") ? (k.debug("add left border"), c(s)) : r(s), e.attr("stroke-dasharray", i.join(" "));
1946
+ }
1947
+ d(ht, "applyNodePropertyBorders");
1948
+ var ba = /* @__PURE__ */ d(async (e, t) => {
1949
+ let a;
1950
+ t.classes ? a = "node " + t.classes : a = "node default";
1951
+ const s = e.insert("g").attr("class", a).attr("id", t.domId || t.id), i = s.insert("rect", ":first-child"), c = s.insert("line"), r = s.insert("g").attr("class", "label"), n = t.labelText.flat ? t.labelText.flat() : t.labelText;
1952
+ let l = "";
1953
+ typeof n == "object" ? l = n[0] : l = n, k.info("Label text abc79", l, n, typeof n == "object");
1954
+ const g = await U(r, l, t.labelStyle, !0, !0);
1955
+ let o = { width: 0, height: 0 };
1956
+ if (P(A())) {
1957
+ const v = g.children[0], S = D(g);
1958
+ o = v.getBoundingClientRect(), S.attr("width", o.width), S.attr("height", o.height);
1959
+ }
1960
+ k.info("Text 2", n);
1961
+ const p = n.slice(1, n.length);
1962
+ let b = g.getBBox();
1963
+ const x = await U(
1964
+ r,
1965
+ p.join ? p.join("<br/>") : p,
1966
+ t.labelStyle,
1967
+ !0,
1968
+ !0
1969
+ );
1970
+ if (P(A())) {
1971
+ const v = x.children[0], S = D(x);
1972
+ o = v.getBoundingClientRect(), S.attr("width", o.width), S.attr("height", o.height);
1973
+ }
1974
+ const w = t.padding / 2;
1975
+ return D(x).attr(
1976
+ "transform",
1977
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
1978
+ (o.width > b.width ? 0 : (b.width - o.width) / 2) + ", " + (b.height + w + 5) + ")"
1979
+ ), D(g).attr(
1980
+ "transform",
1981
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
1982
+ (o.width < b.width ? 0 : -(b.width - o.width) / 2) + ", 0)"
1983
+ ), o = r.node().getBBox(), r.attr(
1984
+ "transform",
1985
+ "translate(" + -o.width / 2 + ", " + (-o.height / 2 - w + 3) + ")"
1986
+ ), i.attr("class", "outer title-state").attr("x", -o.width / 2 - w).attr("y", -o.height / 2 - w).attr("width", o.width + t.padding).attr("height", o.height + t.padding), c.attr("class", "divider").attr("x1", -o.width / 2 - w).attr("x2", o.width / 2 + w).attr("y1", -o.height / 2 - w + b.height + w).attr("y2", -o.height / 2 - w + b.height + w), N(t, i), t.intersect = function(v) {
1987
+ return B.rect(t, v);
1988
+ }, s;
1989
+ }, "rectWithTitle"), wa = /* @__PURE__ */ d(async (e, t) => {
1990
+ const { shapeSvg: a, bbox: s } = await z(
1991
+ e,
1992
+ t,
1993
+ H(t, void 0),
1994
+ !0
1995
+ ), i = s.height + t.padding, c = s.width + i / 4 + t.padding, r = a.insert("rect", ":first-child").attr("style", t.style).attr("rx", i / 2).attr("ry", i / 2).attr("x", -c / 2).attr("y", -i / 2).attr("width", c).attr("height", i);
1996
+ return N(t, r), t.intersect = function(n) {
1997
+ return B.rect(t, n);
1998
+ }, a;
1999
+ }, "stadium"), ma = /* @__PURE__ */ d(async (e, t) => {
2000
+ const { shapeSvg: a, bbox: s, halfPadding: i } = await z(
2001
+ e,
2002
+ t,
2003
+ H(t, void 0),
2004
+ !0
2005
+ ), c = a.insert("circle", ":first-child");
2006
+ return c.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", s.width / 2 + i).attr("width", s.width + t.padding).attr("height", s.height + t.padding), k.info("Circle main"), N(t, c), t.intersect = function(r) {
2007
+ return k.info("Circle intersect", t, s.width / 2 + i, r), B.circle(t, s.width / 2 + i, r);
2008
+ }, a;
2009
+ }, "circle"), Sa = /* @__PURE__ */ d(async (e, t) => {
2010
+ const { shapeSvg: a, bbox: s, halfPadding: i } = await z(
2011
+ e,
2012
+ t,
2013
+ H(t, void 0),
2014
+ !0
2015
+ ), c = 5, r = a.insert("g", ":first-child"), n = r.insert("circle"), l = r.insert("circle");
2016
+ return r.attr("class", t.class), n.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", s.width / 2 + i + c).attr("width", s.width + t.padding + c * 2).attr("height", s.height + t.padding + c * 2), l.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", s.width / 2 + i).attr("width", s.width + t.padding).attr("height", s.height + t.padding), k.info("DoubleCircle main"), N(t, n), t.intersect = function(g) {
2017
+ return k.info("DoubleCircle intersect", t, s.width / 2 + i + c, g), B.circle(t, s.width / 2 + i + c, g);
2018
+ }, a;
2019
+ }, "doublecircle"), La = /* @__PURE__ */ d(async (e, t) => {
2020
+ const { shapeSvg: a, bbox: s } = await z(
2021
+ e,
2022
+ t,
2023
+ H(t, void 0),
2024
+ !0
2025
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
2026
+ { x: 0, y: 0 },
2027
+ { x: i, y: 0 },
2028
+ { x: i, y: -c },
2029
+ { x: 0, y: -c },
2030
+ { x: 0, y: 0 },
2031
+ { x: -8, y: 0 },
2032
+ { x: i + 8, y: 0 },
2033
+ { x: i + 8, y: -c },
2034
+ { x: -8, y: -c },
2035
+ { x: -8, y: 0 }
2036
+ ], n = V(a, i, c, r);
2037
+ return n.attr("style", t.style), N(t, n), t.intersect = function(l) {
2038
+ return B.polygon(t, r, l);
2039
+ }, a;
2040
+ }, "subroutine"), ka = /* @__PURE__ */ d((e, t) => {
2041
+ const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), s = a.insert("circle", ":first-child");
2042
+ return s.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), N(t, s), t.intersect = function(i) {
2043
+ return B.circle(t, 7, i);
2044
+ }, a;
2045
+ }, "start"), Ht = /* @__PURE__ */ d((e, t, a) => {
2046
+ const s = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id);
2047
+ let i = 70, c = 10;
2048
+ a === "LR" && (i = 10, c = 70);
2049
+ const r = s.append("rect").attr("x", -1 * i / 2).attr("y", -1 * c / 2).attr("width", i).attr("height", c).attr("class", "fork-join");
2050
+ return N(t, r), t.height = t.height + t.padding / 2, t.width = t.width + t.padding / 2, t.intersect = function(n) {
2051
+ return B.rect(t, n);
2052
+ }, s;
2053
+ }, "forkJoin"), va = /* @__PURE__ */ d((e, t) => {
2054
+ const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), s = a.insert("circle", ":first-child"), i = a.insert("circle", ":first-child");
2055
+ return i.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), s.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10), N(t, i), t.intersect = function(c) {
2056
+ return B.circle(t, 7, c);
2057
+ }, a;
2058
+ }, "end"), Ea = /* @__PURE__ */ d(async (e, t) => {
2059
+ const a = t.padding / 2, s = 4, i = 8;
2060
+ let c;
2061
+ t.classes ? c = "node " + t.classes : c = "node default";
2062
+ const r = e.insert("g").attr("class", c).attr("id", t.domId || t.id), n = r.insert("rect", ":first-child"), l = r.insert("line"), g = r.insert("line");
2063
+ let o = 0, p = s;
2064
+ const b = r.insert("g").attr("class", "label");
2065
+ let x = 0;
2066
+ const w = t.classData.annotations?.[0], v = t.classData.annotations[0] ? "«" + t.classData.annotations[0] + "»" : "", S = await U(
2067
+ b,
2068
+ v,
2069
+ t.labelStyle,
2070
+ !0,
2071
+ !0
2072
+ );
2073
+ let _ = S.getBBox();
2074
+ if (P(A())) {
2075
+ const E = S.children[0], h = D(S);
2076
+ _ = E.getBoundingClientRect(), h.attr("width", _.width), h.attr("height", _.height);
2077
+ }
2078
+ t.classData.annotations[0] && (p += _.height + s, o += _.width);
2079
+ let I = t.classData.label;
2080
+ t.classData.type !== void 0 && t.classData.type !== "" && (P(A()) ? I += "&lt;" + t.classData.type + "&gt;" : I += "<" + t.classData.type + ">");
2081
+ const T = await U(
2082
+ b,
2083
+ I,
2084
+ t.labelStyle,
2085
+ !0,
2086
+ !0
2087
+ );
2088
+ D(T).attr("class", "classTitle");
2089
+ let m = T.getBBox();
2090
+ if (P(A())) {
2091
+ const E = T.children[0], h = D(T);
2092
+ m = E.getBoundingClientRect(), h.attr("width", m.width), h.attr("height", m.height);
2093
+ }
2094
+ p += m.height + s, m.width > o && (o = m.width);
2095
+ const u = [];
2096
+ t.classData.members.forEach(async (E) => {
2097
+ const h = E.getDisplayDetails();
2098
+ let W = h.displayText;
2099
+ P(A()) && (W = W.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
2100
+ const f = await U(
2101
+ b,
2102
+ W,
2103
+ h.cssStyle ? h.cssStyle : t.labelStyle,
2104
+ !0,
2105
+ !0
2106
+ );
2107
+ let O = f.getBBox();
2108
+ if (P(A())) {
2109
+ const q = f.children[0], j = D(f);
2110
+ O = q.getBoundingClientRect(), j.attr("width", O.width), j.attr("height", O.height);
2111
+ }
2112
+ O.width > o && (o = O.width), p += O.height + s, u.push(f);
2113
+ }), p += i;
2114
+ const y = [];
2115
+ if (t.classData.methods.forEach(async (E) => {
2116
+ const h = E.getDisplayDetails();
2117
+ let W = h.displayText;
2118
+ P(A()) && (W = W.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
2119
+ const f = await U(
2120
+ b,
2121
+ W,
2122
+ h.cssStyle ? h.cssStyle : t.labelStyle,
2123
+ !0,
2124
+ !0
2125
+ );
2126
+ let O = f.getBBox();
2127
+ if (P(A())) {
2128
+ const q = f.children[0], j = D(f);
2129
+ O = q.getBoundingClientRect(), j.attr("width", O.width), j.attr("height", O.height);
2130
+ }
2131
+ O.width > o && (o = O.width), p += O.height + s, y.push(f);
2132
+ }), p += i, w) {
2133
+ let E = (o - _.width) / 2;
2134
+ D(S).attr(
2135
+ "transform",
2136
+ "translate( " + (-1 * o / 2 + E) + ", " + -1 * p / 2 + ")"
2137
+ ), x = _.height + s;
2138
+ }
2139
+ let L = (o - m.width) / 2;
2140
+ return D(T).attr(
2141
+ "transform",
2142
+ "translate( " + (-1 * o / 2 + L) + ", " + (-1 * p / 2 + x) + ")"
2143
+ ), x += m.height + s, l.attr("class", "divider").attr("x1", -o / 2 - a).attr("x2", o / 2 + a).attr("y1", -p / 2 - a + i + x).attr("y2", -p / 2 - a + i + x), x += i, u.forEach((E) => {
2144
+ D(E).attr(
2145
+ "transform",
2146
+ "translate( " + -o / 2 + ", " + (-1 * p / 2 + x + i / 2) + ")"
2147
+ );
2148
+ const h = E?.getBBox();
2149
+ x += (h?.height ?? 0) + s;
2150
+ }), x += i, g.attr("class", "divider").attr("x1", -o / 2 - a).attr("x2", o / 2 + a).attr("y1", -p / 2 - a + i + x).attr("y2", -p / 2 - a + i + x), x += i, y.forEach((E) => {
2151
+ D(E).attr(
2152
+ "transform",
2153
+ "translate( " + -o / 2 + ", " + (-1 * p / 2 + x) + ")"
2154
+ );
2155
+ const h = E?.getBBox();
2156
+ x += (h?.height ?? 0) + s;
2157
+ }), n.attr("style", t.style).attr("class", "outer title-state").attr("x", -o / 2 - a).attr("y", -(p / 2) - a).attr("width", o + t.padding).attr("height", p + t.padding), N(t, n), t.intersect = function(E) {
2158
+ return B.rect(t, E);
2159
+ }, r;
2160
+ }, "class_box"), Kt = {
2161
+ rhombus: Yt,
2162
+ composite: xa,
2163
+ question: Yt,
2164
+ rect: fa,
2165
+ labelRect: ya,
2166
+ rectWithTitle: ba,
2167
+ choice: ia,
2168
+ circle: ma,
2169
+ doublecircle: Sa,
2170
+ stadium: wa,
2171
+ hexagon: na,
2172
+ block_arrow: ca,
2173
+ rect_left_inv_arrow: la,
2174
+ lean_right: oa,
2175
+ lean_left: ha,
2176
+ trapezoid: ga,
2177
+ inv_trapezoid: da,
2178
+ rect_right_inv_arrow: ua,
2179
+ cylinder: pa,
2180
+ start: ka,
2181
+ end: va,
2182
+ note: sa,
2183
+ subroutine: La,
2184
+ fork: Ht,
2185
+ join: Ht,
2186
+ class_box: Ea
2187
+ }, ct = {}, ne = /* @__PURE__ */ d(async (e, t, a) => {
2188
+ let s, i;
2189
+ if (t.link) {
2190
+ let c;
2191
+ A().securityLevel === "sandbox" ? c = "_top" : t.linkTarget && (c = t.linkTarget || "_blank"), s = e.insert("svg:a").attr("xlink:href", t.link).attr("target", c), i = await Kt[t.shape](s, t, a);
2192
+ } else
2193
+ i = await Kt[t.shape](e, t, a), s = i;
2194
+ return t.tooltip && i.attr("title", t.tooltip), t.class && i.attr("class", "node default " + t.class), ct[t.id] = s, t.haveCallback && ct[t.id].attr("class", ct[t.id].attr("class") + " clickable"), s;
2195
+ }, "insertNode"), _a = /* @__PURE__ */ d((e) => {
2196
+ const t = ct[e.id];
2197
+ k.trace(
2198
+ "Transforming node",
2199
+ e.diff,
2200
+ e,
2201
+ "translate(" + (e.x - e.width / 2 - 5) + ", " + e.width / 2 + ")"
2202
+ );
2203
+ const a = 8, s = e.diff || 0;
2204
+ return e.clusterNode ? t.attr(
2205
+ "transform",
2206
+ "translate(" + (e.x + s - e.width / 2) + ", " + (e.y - e.height / 2 - a) + ")"
2207
+ ) : t.attr("transform", "translate(" + e.x + ", " + e.y + ")"), s;
2208
+ }, "positionNode");
2209
+ function Nt(e, t, a = !1) {
2210
+ const s = e;
2211
+ let i = "default";
2212
+ (s?.classes?.length || 0) > 0 && (i = (s?.classes ?? []).join(" ")), i = i + " flowchart-label";
2213
+ let c = 0, r = "", n;
2214
+ switch (s.type) {
2215
+ case "round":
2216
+ c = 5, r = "rect";
2217
+ break;
2218
+ case "composite":
2219
+ c = 0, r = "composite", n = 0;
2220
+ break;
2221
+ case "square":
2222
+ r = "rect";
2223
+ break;
2224
+ case "diamond":
2225
+ r = "question";
2226
+ break;
2227
+ case "hexagon":
2228
+ r = "hexagon";
2229
+ break;
2230
+ case "block_arrow":
2231
+ r = "block_arrow";
2232
+ break;
2233
+ case "odd":
2234
+ r = "rect_left_inv_arrow";
2235
+ break;
2236
+ case "lean_right":
2237
+ r = "lean_right";
2238
+ break;
2239
+ case "lean_left":
2240
+ r = "lean_left";
2241
+ break;
2242
+ case "trapezoid":
2243
+ r = "trapezoid";
2244
+ break;
2245
+ case "inv_trapezoid":
2246
+ r = "inv_trapezoid";
2247
+ break;
2248
+ case "rect_left_inv_arrow":
2249
+ r = "rect_left_inv_arrow";
2250
+ break;
2251
+ case "circle":
2252
+ r = "circle";
2253
+ break;
2254
+ case "ellipse":
2255
+ r = "ellipse";
2256
+ break;
2257
+ case "stadium":
2258
+ r = "stadium";
2259
+ break;
2260
+ case "subroutine":
2261
+ r = "subroutine";
2262
+ break;
2263
+ case "cylinder":
2264
+ r = "cylinder";
2265
+ break;
2266
+ case "group":
2267
+ r = "rect";
2268
+ break;
2269
+ case "doublecircle":
2270
+ r = "doublecircle";
2271
+ break;
2272
+ default:
2273
+ r = "rect";
2274
+ }
2275
+ const l = Ge(s?.styles ?? []), g = s.label, o = s.size ?? { width: 0, height: 0, x: 0, y: 0 }, p = t.getDiagramId();
2276
+ return {
2277
+ labelStyle: l.labelStyle,
2278
+ shape: r,
2279
+ labelText: g,
2280
+ rx: c,
2281
+ ry: c,
2282
+ class: i,
2283
+ style: l.style,
2284
+ id: s.id,
2285
+ domId: p ? `${p}-${s.id}` : s.id,
2286
+ directions: s.directions,
2287
+ width: o.width,
2288
+ height: o.height,
2289
+ x: o.x,
2290
+ y: o.y,
2291
+ positioned: a,
2292
+ intersect: void 0,
2293
+ type: s.type,
2294
+ padding: n ?? at()?.block?.padding ?? 0,
2295
+ widthInColumns: s.widthInColumns ?? 1
2296
+ };
2297
+ }
2298
+ d(Nt, "getNodeFromBlock");
2299
+ async function ce(e, t, a) {
2300
+ const s = Nt(t, a, !1);
2301
+ if (s.type === "group")
2302
+ return;
2303
+ const i = at(), c = await ne(e, s, { config: i }), r = c.node().getBBox(), n = a.getBlock(s.id);
2304
+ n.size = { width: r.width, height: r.height, x: 0, y: 0, node: c }, a.setBlock(n), c.remove();
2305
+ }
2306
+ d(ce, "calculateBlockSize");
2307
+ async function le(e, t, a) {
2308
+ const s = Nt(t, a, !0);
2309
+ if (a.getBlock(s.id).type !== "space") {
2310
+ const c = at();
2311
+ await ne(e, s, { config: c }), t.intersect = s?.intersect, _a(s);
2312
+ }
2313
+ }
2314
+ d(le, "insertBlockPositioned");
2315
+ async function gt(e, t, a, s) {
2316
+ for (const i of t)
2317
+ await s(e, i, a), i.children && await gt(e, i.children, a, s);
2318
+ }
2319
+ d(gt, "performOperations");
2320
+ async function oe(e, t, a) {
2321
+ await gt(e, t, a, ce);
2322
+ }
2323
+ d(oe, "calculateBlockSizes");
2324
+ async function he(e, t, a) {
2325
+ await gt(e, t, a, le);
2326
+ }
2327
+ d(he, "insertBlocks");
2328
+ async function ge(e, t, a, s, i) {
2329
+ const c = new qe({
2330
+ multigraph: !0,
2331
+ compound: !0
2332
+ });
2333
+ c.setGraph({
2334
+ rankdir: "TB",
2335
+ nodesep: 10,
2336
+ ranksep: 10,
2337
+ marginx: 8,
2338
+ marginy: 8
2339
+ });
2340
+ for (const r of a)
2341
+ r.size && c.setNode(r.id, {
2342
+ width: r.size.width,
2343
+ height: r.size.height,
2344
+ intersect: r.intersect
2345
+ });
2346
+ for (const r of t)
2347
+ if (r.start && r.end) {
2348
+ const n = s.getBlock(r.start), l = s.getBlock(r.end);
2349
+ if (n?.size && l?.size) {
2350
+ const g = n.size, o = l.size, p = [
2351
+ { x: g.x, y: g.y },
2352
+ { x: g.x + (o.x - g.x) / 2, y: g.y + (o.y - g.y) / 2 },
2353
+ { x: o.x, y: o.y }
2354
+ ], b = i ? `${i}-${r.id}` : r.id, x = r.thickness === "thick" ? "edge-thickness-thick" : "edge-thickness-normal", w = r.pattern === "dotted" ? "edge-pattern-dotted" : "edge-pattern-solid", v = `${x} ${w} flowchart-link LS-a1 LE-b1`;
2355
+ Gr(
2356
+ e,
2357
+ { v: r.start, w: r.end, name: b },
2358
+ {
2359
+ ...r,
2360
+ id: b,
2361
+ arrowTypeEnd: r.arrowTypeEnd,
2362
+ arrowTypeStart: r.arrowTypeStart,
2363
+ points: p,
2364
+ classes: v
2365
+ },
2366
+ void 0,
2367
+ "block",
2368
+ c,
2369
+ i
2370
+ ), r.label && (await Ur(e, {
2371
+ ...r,
2372
+ label: r.label,
2373
+ labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
2374
+ arrowTypeEnd: r.arrowTypeEnd,
2375
+ arrowTypeStart: r.arrowTypeStart,
2376
+ points: p,
2377
+ classes: v
2378
+ }), Xr(
2379
+ { ...r, x: p[1].x, y: p[1].y },
2380
+ {
2381
+ originalPath: p
2382
+ }
2383
+ ));
2384
+ }
2385
+ }
2386
+ }
2387
+ d(ge, "insertEdges");
2388
+ var Ta = /* @__PURE__ */ d(function(e, t) {
2389
+ return t.db.getClasses();
2390
+ }, "getClasses"), Da = /* @__PURE__ */ d(async function(e, t, a, s) {
2391
+ const { securityLevel: i, block: c } = at(), r = s.db;
2392
+ r.setDiagramId(t);
2393
+ let n;
2394
+ i === "sandbox" && (n = D("#i" + t));
2395
+ const l = i === "sandbox" ? D(n.nodes()[0].contentDocument.body) : D("body"), g = i === "sandbox" ? l.select(`[id="${t}"]`) : D(`[id="${t}"]`);
2396
+ Fr(g, ["point", "circle", "cross"], s.type, t);
2397
+ const p = r.getBlocks(), b = r.getBlocksFlat(), x = r.getEdges(), w = g.insert("g").attr("class", "block");
2398
+ await oe(w, p, r);
2399
+ const v = $t(r);
2400
+ if (await he(w, p, r), await ge(w, x, b, r, t), v) {
2401
+ const S = v, _ = Math.max(1, Math.round(0.125 * (S.width / S.height))), I = S.height + _ + 10, T = S.width + 10, { useMaxWidth: m } = c;
2402
+ Fe(g, I, T, !!m), k.debug("Here Bounds", v, S), g.attr(
2403
+ "viewBox",
2404
+ `${S.x - 5} ${S.y - 5} ${S.width + 10} ${S.height + 10}`
2405
+ );
2406
+ }
2407
+ }, "draw"), Ba = {
2408
+ draw: Da,
2409
+ getClasses: Ta
2410
+ }, Ra = {
2411
+ parser: sr,
2412
+ db: Er,
2413
+ renderer: Ba,
2414
+ styles: Tr
2415
+ };
2416
+ export {
2417
+ Ra as diagram
2418
+ };