whipped 0.8.1 → 0.9.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 (86) hide show
  1. package/dist/cli.js +1294 -259
  2. package/dist/mcp-server.js +150 -2
  3. package/dist/migrations/014_companion_sessions.sql +34 -0
  4. package/dist/migrations/015_companion_worktree_mode.sql +45 -0
  5. package/dist/migrations/016_companion_plans.sql +22 -0
  6. package/dist/migrations/017_companion_saved_plans.sql +23 -0
  7. package/dist/migrations/018_generalize_plan_session_ref.sql +29 -0
  8. package/dist/migrations/019_rename_plan_to_canvas.sql +20 -0
  9. package/dist/web-ui/assets/abnfDiagram-VRR7QNED-RwOyl_Kz.js +119 -0
  10. package/dist/web-ui/assets/arc-DmDBHE0H.js +131 -0
  11. package/dist/web-ui/assets/architectureDiagram-ZJ3FMSHR-RTwadm6J.js +8821 -0
  12. package/dist/web-ui/assets/blockDiagram-677ZJIJ3-Dvv5uMUE.js +3801 -0
  13. package/dist/web-ui/assets/c4Diagram-LMCZKHZV-bvr9R9cD.js +2479 -0
  14. package/dist/web-ui/assets/channel-BGhlETgZ.js +7 -0
  15. package/dist/web-ui/assets/chunk-2Q5K7J3B-BRq-Qbau.js +17 -0
  16. package/dist/web-ui/assets/chunk-32BRIVSS-Dy1BUZGx.js +116 -0
  17. package/dist/web-ui/assets/chunk-5VM5RSS4-DCUiIwIc.js +19 -0
  18. package/dist/web-ui/assets/chunk-EX3LRPZG-Cg_Vtzwz.js +1996 -0
  19. package/dist/web-ui/assets/chunk-JWPE2WC7-BW4n_ZhH.js +17 -0
  20. package/dist/web-ui/assets/chunk-MOJQB5TN-BykRa615.js +855 -0
  21. package/dist/web-ui/assets/chunk-RYQCIY6F-D4F7oV1d.js +476 -0
  22. package/dist/web-ui/assets/chunk-V7JOEXUC-DD4mm30h.js +2022 -0
  23. package/dist/web-ui/assets/chunk-VR4S4FIN-Fgvcluvk.js +25 -0
  24. package/dist/web-ui/assets/chunk-XXDRQBXY-C4FVmO5r.js +13 -0
  25. package/dist/web-ui/assets/classDiagram-OUVF2IWQ-DD4KIYF1.js +24 -0
  26. package/dist/web-ui/assets/classDiagram-v2-EOCWNBFH-DD4KIYF1.js +24 -0
  27. package/dist/web-ui/assets/cose-bilkent-JH36ORCC-ekFwvYt9.js +4943 -0
  28. package/dist/web-ui/assets/cynefin-VYW2F7L2-DTNV7gvQ.js +31527 -0
  29. package/dist/web-ui/assets/cynefinDiagram-TSTJHNR4-koYialeC.js +454 -0
  30. package/dist/web-ui/assets/cytoscape.esm-CaQ7Fomf.js +30346 -0
  31. package/dist/web-ui/assets/dagre-VKFMJZFB-Do43FV3o.js +526 -0
  32. package/dist/web-ui/assets/defaultLocale-B2RvLBDe.js +206 -0
  33. package/dist/web-ui/assets/diagram-FQU43EPY-D0STdny6.js +636 -0
  34. package/dist/web-ui/assets/diagram-G47NLZAW-D9g6BdZT.js +858 -0
  35. package/dist/web-ui/assets/diagram-NH7WQ7WH-zLW6CAmi.js +212 -0
  36. package/dist/web-ui/assets/diagram-OA4YK3LP-CA5tvsYw.js +492 -0
  37. package/dist/web-ui/assets/diagram-WEI45ONY-CLmYUHR0.js +309 -0
  38. package/dist/web-ui/assets/ebnfDiagram-CCIWWBDH-KkHubBI6.js +139 -0
  39. package/dist/web-ui/assets/erDiagram-Q63AITRT-BJna2u1n.js +1238 -0
  40. package/dist/web-ui/assets/flowDiagram-23GEKE2U-DVJKalah.js +2353 -0
  41. package/dist/web-ui/assets/ganttDiagram-NO4QXBWP-D9HwNV4u.js +3733 -0
  42. package/dist/web-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  43. package/dist/web-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  44. package/dist/web-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  45. package/dist/web-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  46. package/dist/web-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
  47. package/dist/web-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
  48. package/dist/web-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
  49. package/dist/web-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
  50. package/dist/web-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
  51. package/dist/web-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
  52. package/dist/web-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  53. package/dist/web-ui/assets/gitGraphDiagram-IHSO6WYX-B7wnoO0J.js +1385 -0
  54. package/dist/web-ui/assets/graph-BMLV0goG.js +2042 -0
  55. package/dist/web-ui/assets/{index-CRXPsGTP.css → index-DPjATOCj.css} +800 -1207
  56. package/dist/web-ui/assets/{index-BMFVAmy4.js → index-DZ7I8r_C.js} +41392 -39594
  57. package/dist/web-ui/assets/infoDiagram-FWYZ7A6U-BY6XoiF8.js +32 -0
  58. package/dist/web-ui/assets/init-ZxktEp_H.js +16 -0
  59. package/dist/web-ui/assets/ishikawaDiagram-FXEZZL3T-BaZVnO8j.js +967 -0
  60. package/dist/web-ui/assets/journeyDiagram-5HDEW3XC-CUA6DUAQ.js +1256 -0
  61. package/dist/web-ui/assets/kanban-definition-HUTT4EX6-5W5tiWrd.js +1055 -0
  62. package/dist/web-ui/assets/katex-CqNtglxf.js +14499 -0
  63. package/dist/web-ui/assets/layout-BNmRhaUB.js +2359 -0
  64. package/dist/web-ui/assets/linear-CfvGIyDE.js +340 -0
  65. package/dist/web-ui/assets/map-BEO0Bu8q.js +298 -0
  66. package/dist/web-ui/assets/mermaid.core-BRk3IzY2.js +26639 -0
  67. package/dist/web-ui/assets/mindmap-definition-LN4V7U3C-2GmLg6ou.js +1183 -0
  68. package/dist/web-ui/assets/ordinal-DSZU4PqD.js +76 -0
  69. package/dist/web-ui/assets/pegDiagram-2B236MQR-gTEdrkJg.js +127 -0
  70. package/dist/web-ui/assets/pieDiagram-ENE6RG2P-CYXjIhqC.js +318 -0
  71. package/dist/web-ui/assets/quadrantDiagram-ABIIQ3AL-BStRZxwf.js +1341 -0
  72. package/dist/web-ui/assets/railroadDiagram-RFXS5EU6-btveDRG2.js +93 -0
  73. package/dist/web-ui/assets/requirementDiagram-TGXJPOKE-Cy_155rE.js +1205 -0
  74. package/dist/web-ui/assets/sankeyDiagram-HTMAVEWB-Chtvw3_G.js +1264 -0
  75. package/dist/web-ui/assets/sequenceDiagram-DBY2YBRQ-DDuMVEX1.js +4523 -0
  76. package/dist/web-ui/assets/sizeCapture-X5ZJPWSS-Bylf0o6J.js +64 -0
  77. package/dist/web-ui/assets/stateDiagram-2N3HPSRC-DIzLeR5G.js +453 -0
  78. package/dist/web-ui/assets/stateDiagram-v2-6OUMAXLB-zG_WjT1-.js +23 -0
  79. package/dist/web-ui/assets/swimlanes-5IMT3BWC-TKaCmVta.js +8575 -0
  80. package/dist/web-ui/assets/swimlanesDiagram-G3AALYLV-C5eB3qqS.js +21 -0
  81. package/dist/web-ui/assets/timeline-definition-FHXFAJF6-CC5Ujpcu.js +1606 -0
  82. package/dist/web-ui/assets/vennDiagram-L72KCM5P-DUSVXSYT.js +2523 -0
  83. package/dist/web-ui/assets/wardleyDiagram-EHGQE667-CoP9xn89.js +978 -0
  84. package/dist/web-ui/assets/xychartDiagram-FW5EYKEG-B9FqP_kk.js +1972 -0
  85. package/dist/web-ui/index.html +2 -2
  86. package/package.json +1 -1
@@ -0,0 +1,1183 @@
1
+ var _a;
2
+ import { g as getDiagramElement } from "./chunk-XXDRQBXY-C4FVmO5r.js";
3
+ import { s as setupViewPortForSVG } from "./chunk-VR4S4FIN-Fgvcluvk.js";
4
+ import { _ as __name, l as log, u as getRegisteredLayoutAlgorithm, v as render, y as getConfig, B as defaultConfig_default, c as getConfig2, i as sanitizeText, b6 as getUserDefinedConfig, T as isDark, U as lighten, V as darken } from "./mermaid.core-BRk3IzY2.js";
5
+ import "./index-DZ7I8r_C.js";
6
+ const byteToHex = [];
7
+ for (let i = 0; i < 256; ++i) {
8
+ byteToHex.push((i + 256).toString(16).slice(1));
9
+ }
10
+ function unsafeStringify(arr, offset = 0) {
11
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
12
+ }
13
+ const rnds8 = new Uint8Array(16);
14
+ function rng() {
15
+ return crypto.getRandomValues(rnds8);
16
+ }
17
+ function v4(options, buf, offset) {
18
+ if (crypto.randomUUID) {
19
+ return crypto.randomUUID();
20
+ }
21
+ return _v4(options);
22
+ }
23
+ function _v4(options, buf, offset) {
24
+ var _a2;
25
+ options = options || {};
26
+ const rnds = options.random ?? ((_a2 = options.rng) == null ? void 0 : _a2.call(options)) ?? rng();
27
+ if (rnds.length < 16) {
28
+ throw new Error("Random bytes length must be >= 16");
29
+ }
30
+ rnds[6] = rnds[6] & 15 | 64;
31
+ rnds[8] = rnds[8] & 63 | 128;
32
+ return unsafeStringify(rnds);
33
+ }
34
+ var parser = (function() {
35
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
36
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
37
+ return o2;
38
+ }, "o"), $V0 = [1, 4], $V1 = [1, 13], $V2 = [1, 12], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 20], $V6 = [1, 19], $V7 = [6, 7, 8], $V8 = [1, 26], $V9 = [1, 24], $Va = [1, 25], $Vb = [6, 7, 11], $Vc = [1, 6, 13, 15, 16, 19, 22], $Vd = [1, 33], $Ve = [1, 34], $Vf = [1, 6, 7, 11, 13, 15, 16, 19, 22];
39
+ var parser2 = {
40
+ trace: /* @__PURE__ */ __name(function trace() {
41
+ }, "trace"),
42
+ yy: {},
43
+ symbols_: { "error": 2, "start": 3, "mindMap": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "MINDMAP": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "node": 14, "ICON": 15, "CLASS": 16, "nodeWithId": 17, "nodeWithoutId": 18, "NODE_DSTART": 19, "NODE_DESCR": 20, "NODE_DEND": 21, "NODE_ID": 22, "$accept": 0, "$end": 1 },
44
+ terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "MINDMAP", 11: "EOF", 13: "SPACELIST", 15: "ICON", 16: "CLASS", 19: "NODE_DSTART", 20: "NODE_DESCR", 21: "NODE_DEND", 22: "NODE_ID" },
45
+ productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [18, 3], [17, 1], [17, 4]],
46
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
47
+ var $0 = $$.length - 1;
48
+ switch (yystate) {
49
+ case 6:
50
+ case 7:
51
+ return yy;
52
+ case 8:
53
+ yy.getLogger().trace("Stop NL ");
54
+ break;
55
+ case 9:
56
+ yy.getLogger().trace("Stop EOF ");
57
+ break;
58
+ case 11:
59
+ yy.getLogger().trace("Stop NL2 ");
60
+ break;
61
+ case 12:
62
+ yy.getLogger().trace("Stop EOF2 ");
63
+ break;
64
+ case 15:
65
+ yy.getLogger().info("Node: ", $$[$0].id);
66
+ yy.addNode($$[$0 - 1].length, $$[$0].id, $$[$0].descr, $$[$0].type);
67
+ break;
68
+ case 16:
69
+ yy.getLogger().trace("Icon: ", $$[$0]);
70
+ yy.decorateNode({ icon: $$[$0] });
71
+ break;
72
+ case 17:
73
+ case 21:
74
+ yy.decorateNode({ class: $$[$0] });
75
+ break;
76
+ case 18:
77
+ yy.getLogger().trace("SPACELIST");
78
+ break;
79
+ case 19:
80
+ yy.getLogger().trace("Node: ", $$[$0].id);
81
+ yy.addNode(0, $$[$0].id, $$[$0].descr, $$[$0].type);
82
+ break;
83
+ case 20:
84
+ yy.decorateNode({ icon: $$[$0] });
85
+ break;
86
+ case 25:
87
+ yy.getLogger().trace("node found ..", $$[$0 - 2]);
88
+ this.$ = { id: $$[$0 - 1], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) };
89
+ break;
90
+ case 26:
91
+ this.$ = { id: $$[$0], descr: $$[$0], type: yy.nodeType.DEFAULT };
92
+ break;
93
+ case 27:
94
+ yy.getLogger().trace("node found ..", $$[$0 - 3]);
95
+ this.$ = { id: $$[$0 - 3], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) };
96
+ break;
97
+ }
98
+ }, "anonymous"),
99
+ table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o($V7, [2, 3]), { 1: [2, 2] }, o($V7, [2, 4]), o($V7, [2, 5]), { 1: [2, 6], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V1, 9: 22, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V8, 7: $V9, 10: 23, 11: $Va }, o($Vb, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: $V5, 22: $V6 }), o($Vb, [2, 18]), o($Vb, [2, 19]), o($Vb, [2, 20]), o($Vb, [2, 21]), o($Vb, [2, 23]), o($Vb, [2, 24]), o($Vb, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: $V8, 7: $V9, 10: 32, 11: $Va }, { 1: [2, 7], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o($Vc, [2, 14], { 7: $Vd, 11: $Ve }), o($Vf, [2, 8]), o($Vf, [2, 9]), o($Vf, [2, 10]), o($Vb, [2, 15]), o($Vb, [2, 16]), o($Vb, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, o($Vc, [2, 13], { 7: $Vd, 11: $Ve }), o($Vf, [2, 11]), o($Vf, [2, 12]), { 21: [1, 37] }, o($Vb, [2, 25]), o($Vb, [2, 27])],
100
+ defaultActions: { 2: [2, 1], 6: [2, 2] },
101
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
102
+ if (hash.recoverable) {
103
+ this.trace(str);
104
+ } else {
105
+ var error = new Error(str);
106
+ error.hash = hash;
107
+ throw error;
108
+ }
109
+ }, "parseError"),
110
+ parse: /* @__PURE__ */ __name(function parse(input) {
111
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
112
+ var args = lstack.slice.call(arguments, 1);
113
+ var lexer2 = Object.create(this.lexer);
114
+ var sharedState = { yy: {} };
115
+ for (var k in this.yy) {
116
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
117
+ sharedState.yy[k] = this.yy[k];
118
+ }
119
+ }
120
+ lexer2.setInput(input, sharedState.yy);
121
+ sharedState.yy.lexer = lexer2;
122
+ sharedState.yy.parser = this;
123
+ if (typeof lexer2.yylloc == "undefined") {
124
+ lexer2.yylloc = {};
125
+ }
126
+ var yyloc = lexer2.yylloc;
127
+ lstack.push(yyloc);
128
+ var ranges = lexer2.options && lexer2.options.ranges;
129
+ if (typeof sharedState.yy.parseError === "function") {
130
+ this.parseError = sharedState.yy.parseError;
131
+ } else {
132
+ this.parseError = Object.getPrototypeOf(this).parseError;
133
+ }
134
+ function popStack(n) {
135
+ stack.length = stack.length - 2 * n;
136
+ vstack.length = vstack.length - n;
137
+ lstack.length = lstack.length - n;
138
+ }
139
+ __name(popStack, "popStack");
140
+ function lex() {
141
+ var token;
142
+ token = tstack.pop() || lexer2.lex() || EOF;
143
+ if (typeof token !== "number") {
144
+ if (token instanceof Array) {
145
+ tstack = token;
146
+ token = tstack.pop();
147
+ }
148
+ token = self.symbols_[token] || token;
149
+ }
150
+ return token;
151
+ }
152
+ __name(lex, "lex");
153
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
154
+ while (true) {
155
+ state = stack[stack.length - 1];
156
+ if (this.defaultActions[state]) {
157
+ action = this.defaultActions[state];
158
+ } else {
159
+ if (symbol === null || typeof symbol == "undefined") {
160
+ symbol = lex();
161
+ }
162
+ action = table[state] && table[state][symbol];
163
+ }
164
+ if (typeof action === "undefined" || !action.length || !action[0]) {
165
+ var errStr = "";
166
+ expected = [];
167
+ for (p in table[state]) {
168
+ if (this.terminals_[p] && p > TERROR) {
169
+ expected.push("'" + this.terminals_[p] + "'");
170
+ }
171
+ }
172
+ if (lexer2.showPosition) {
173
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
174
+ } else {
175
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
176
+ }
177
+ this.parseError(errStr, {
178
+ text: lexer2.match,
179
+ token: this.terminals_[symbol] || symbol,
180
+ line: lexer2.yylineno,
181
+ loc: yyloc,
182
+ expected
183
+ });
184
+ }
185
+ if (action[0] instanceof Array && action.length > 1) {
186
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
187
+ }
188
+ switch (action[0]) {
189
+ case 1:
190
+ stack.push(symbol);
191
+ vstack.push(lexer2.yytext);
192
+ lstack.push(lexer2.yylloc);
193
+ stack.push(action[1]);
194
+ symbol = null;
195
+ {
196
+ yyleng = lexer2.yyleng;
197
+ yytext = lexer2.yytext;
198
+ yylineno = lexer2.yylineno;
199
+ yyloc = lexer2.yylloc;
200
+ }
201
+ break;
202
+ case 2:
203
+ len = this.productions_[action[1]][1];
204
+ yyval.$ = vstack[vstack.length - len];
205
+ yyval._$ = {
206
+ first_line: lstack[lstack.length - (len || 1)].first_line,
207
+ last_line: lstack[lstack.length - 1].last_line,
208
+ first_column: lstack[lstack.length - (len || 1)].first_column,
209
+ last_column: lstack[lstack.length - 1].last_column
210
+ };
211
+ if (ranges) {
212
+ yyval._$.range = [
213
+ lstack[lstack.length - (len || 1)].range[0],
214
+ lstack[lstack.length - 1].range[1]
215
+ ];
216
+ }
217
+ r = this.performAction.apply(yyval, [
218
+ yytext,
219
+ yyleng,
220
+ yylineno,
221
+ sharedState.yy,
222
+ action[1],
223
+ vstack,
224
+ lstack
225
+ ].concat(args));
226
+ if (typeof r !== "undefined") {
227
+ return r;
228
+ }
229
+ if (len) {
230
+ stack = stack.slice(0, -1 * len * 2);
231
+ vstack = vstack.slice(0, -1 * len);
232
+ lstack = lstack.slice(0, -1 * len);
233
+ }
234
+ stack.push(this.productions_[action[1]][0]);
235
+ vstack.push(yyval.$);
236
+ lstack.push(yyval._$);
237
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
238
+ stack.push(newState);
239
+ break;
240
+ case 3:
241
+ return true;
242
+ }
243
+ }
244
+ return true;
245
+ }, "parse")
246
+ };
247
+ var lexer = /* @__PURE__ */ (function() {
248
+ var lexer2 = {
249
+ EOF: 1,
250
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
251
+ if (this.yy.parser) {
252
+ this.yy.parser.parseError(str, hash);
253
+ } else {
254
+ throw new Error(str);
255
+ }
256
+ }, "parseError"),
257
+ // resets the lexer, sets new input
258
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
259
+ this.yy = yy || this.yy || {};
260
+ this._input = input;
261
+ this._more = this._backtrack = this.done = false;
262
+ this.yylineno = this.yyleng = 0;
263
+ this.yytext = this.matched = this.match = "";
264
+ this.conditionStack = ["INITIAL"];
265
+ this.yylloc = {
266
+ first_line: 1,
267
+ first_column: 0,
268
+ last_line: 1,
269
+ last_column: 0
270
+ };
271
+ if (this.options.ranges) {
272
+ this.yylloc.range = [0, 0];
273
+ }
274
+ this.offset = 0;
275
+ return this;
276
+ }, "setInput"),
277
+ // consumes and returns one char from the input
278
+ input: /* @__PURE__ */ __name(function() {
279
+ var ch = this._input[0];
280
+ this.yytext += ch;
281
+ this.yyleng++;
282
+ this.offset++;
283
+ this.match += ch;
284
+ this.matched += ch;
285
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
286
+ if (lines) {
287
+ this.yylineno++;
288
+ this.yylloc.last_line++;
289
+ } else {
290
+ this.yylloc.last_column++;
291
+ }
292
+ if (this.options.ranges) {
293
+ this.yylloc.range[1]++;
294
+ }
295
+ this._input = this._input.slice(1);
296
+ return ch;
297
+ }, "input"),
298
+ // unshifts one char (or a string) into the input
299
+ unput: /* @__PURE__ */ __name(function(ch) {
300
+ var len = ch.length;
301
+ var lines = ch.split(/(?:\r\n?|\n)/g);
302
+ this._input = ch + this._input;
303
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
304
+ this.offset -= len;
305
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
306
+ this.match = this.match.substr(0, this.match.length - 1);
307
+ this.matched = this.matched.substr(0, this.matched.length - 1);
308
+ if (lines.length - 1) {
309
+ this.yylineno -= lines.length - 1;
310
+ }
311
+ var r = this.yylloc.range;
312
+ this.yylloc = {
313
+ first_line: this.yylloc.first_line,
314
+ last_line: this.yylineno + 1,
315
+ first_column: this.yylloc.first_column,
316
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
317
+ };
318
+ if (this.options.ranges) {
319
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
320
+ }
321
+ this.yyleng = this.yytext.length;
322
+ return this;
323
+ }, "unput"),
324
+ // When called from action, caches matched text and appends it on next action
325
+ more: /* @__PURE__ */ __name(function() {
326
+ this._more = true;
327
+ return this;
328
+ }, "more"),
329
+ // 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.
330
+ reject: /* @__PURE__ */ __name(function() {
331
+ if (this.options.backtrack_lexer) {
332
+ this._backtrack = true;
333
+ } else {
334
+ 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).\n" + this.showPosition(), {
335
+ text: "",
336
+ token: null,
337
+ line: this.yylineno
338
+ });
339
+ }
340
+ return this;
341
+ }, "reject"),
342
+ // retain first n characters of the match
343
+ less: /* @__PURE__ */ __name(function(n) {
344
+ this.unput(this.match.slice(n));
345
+ }, "less"),
346
+ // displays already matched input, i.e. for error messages
347
+ pastInput: /* @__PURE__ */ __name(function() {
348
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
349
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
350
+ }, "pastInput"),
351
+ // displays upcoming input, i.e. for error messages
352
+ upcomingInput: /* @__PURE__ */ __name(function() {
353
+ var next = this.match;
354
+ if (next.length < 20) {
355
+ next += this._input.substr(0, 20 - next.length);
356
+ }
357
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
358
+ }, "upcomingInput"),
359
+ // displays the character position where the lexing error occurred, i.e. for error messages
360
+ showPosition: /* @__PURE__ */ __name(function() {
361
+ var pre = this.pastInput();
362
+ var c = new Array(pre.length + 1).join("-");
363
+ return pre + this.upcomingInput() + "\n" + c + "^";
364
+ }, "showPosition"),
365
+ // test the lexed token: return FALSE when not a match, otherwise return token
366
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
367
+ var token, lines, backup;
368
+ if (this.options.backtrack_lexer) {
369
+ backup = {
370
+ yylineno: this.yylineno,
371
+ yylloc: {
372
+ first_line: this.yylloc.first_line,
373
+ last_line: this.last_line,
374
+ first_column: this.yylloc.first_column,
375
+ last_column: this.yylloc.last_column
376
+ },
377
+ yytext: this.yytext,
378
+ match: this.match,
379
+ matches: this.matches,
380
+ matched: this.matched,
381
+ yyleng: this.yyleng,
382
+ offset: this.offset,
383
+ _more: this._more,
384
+ _input: this._input,
385
+ yy: this.yy,
386
+ conditionStack: this.conditionStack.slice(0),
387
+ done: this.done
388
+ };
389
+ if (this.options.ranges) {
390
+ backup.yylloc.range = this.yylloc.range.slice(0);
391
+ }
392
+ }
393
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
394
+ if (lines) {
395
+ this.yylineno += lines.length;
396
+ }
397
+ this.yylloc = {
398
+ first_line: this.yylloc.last_line,
399
+ last_line: this.yylineno + 1,
400
+ first_column: this.yylloc.last_column,
401
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
402
+ };
403
+ this.yytext += match[0];
404
+ this.match += match[0];
405
+ this.matches = match;
406
+ this.yyleng = this.yytext.length;
407
+ if (this.options.ranges) {
408
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
409
+ }
410
+ this._more = false;
411
+ this._backtrack = false;
412
+ this._input = this._input.slice(match[0].length);
413
+ this.matched += match[0];
414
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
415
+ if (this.done && this._input) {
416
+ this.done = false;
417
+ }
418
+ if (token) {
419
+ return token;
420
+ } else if (this._backtrack) {
421
+ for (var k in backup) {
422
+ this[k] = backup[k];
423
+ }
424
+ return false;
425
+ }
426
+ return false;
427
+ }, "test_match"),
428
+ // return next match in input
429
+ next: /* @__PURE__ */ __name(function() {
430
+ if (this.done) {
431
+ return this.EOF;
432
+ }
433
+ if (!this._input) {
434
+ this.done = true;
435
+ }
436
+ var token, match, tempMatch, index;
437
+ if (!this._more) {
438
+ this.yytext = "";
439
+ this.match = "";
440
+ }
441
+ var rules = this._currentRules();
442
+ for (var i = 0; i < rules.length; i++) {
443
+ tempMatch = this._input.match(this.rules[rules[i]]);
444
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
445
+ match = tempMatch;
446
+ index = i;
447
+ if (this.options.backtrack_lexer) {
448
+ token = this.test_match(tempMatch, rules[i]);
449
+ if (token !== false) {
450
+ return token;
451
+ } else if (this._backtrack) {
452
+ match = false;
453
+ continue;
454
+ } else {
455
+ return false;
456
+ }
457
+ } else if (!this.options.flex) {
458
+ break;
459
+ }
460
+ }
461
+ }
462
+ if (match) {
463
+ token = this.test_match(match, rules[index]);
464
+ if (token !== false) {
465
+ return token;
466
+ }
467
+ return false;
468
+ }
469
+ if (this._input === "") {
470
+ return this.EOF;
471
+ } else {
472
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
473
+ text: "",
474
+ token: null,
475
+ line: this.yylineno
476
+ });
477
+ }
478
+ }, "next"),
479
+ // return next match that has a token
480
+ lex: /* @__PURE__ */ __name(function lex() {
481
+ var r = this.next();
482
+ if (r) {
483
+ return r;
484
+ } else {
485
+ return this.lex();
486
+ }
487
+ }, "lex"),
488
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
489
+ begin: /* @__PURE__ */ __name(function begin(condition) {
490
+ this.conditionStack.push(condition);
491
+ }, "begin"),
492
+ // pop the previously active lexer condition state off the condition stack
493
+ popState: /* @__PURE__ */ __name(function popState() {
494
+ var n = this.conditionStack.length - 1;
495
+ if (n > 0) {
496
+ return this.conditionStack.pop();
497
+ } else {
498
+ return this.conditionStack[0];
499
+ }
500
+ }, "popState"),
501
+ // produce the lexer rule set which is active for the currently active lexer condition state
502
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
503
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
504
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
505
+ } else {
506
+ return this.conditions["INITIAL"].rules;
507
+ }
508
+ }, "_currentRules"),
509
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
510
+ topState: /* @__PURE__ */ __name(function topState(n) {
511
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
512
+ if (n >= 0) {
513
+ return this.conditionStack[n];
514
+ } else {
515
+ return "INITIAL";
516
+ }
517
+ }, "topState"),
518
+ // alias for begin(condition)
519
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
520
+ this.begin(condition);
521
+ }, "pushState"),
522
+ // return the number of states currently on the stack
523
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
524
+ return this.conditionStack.length;
525
+ }, "stateStackSize"),
526
+ options: { "case-insensitive": true },
527
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
528
+ switch ($avoiding_name_collisions) {
529
+ case 0:
530
+ yy.getLogger().trace("Found comment", yy_.yytext);
531
+ return 6;
532
+ case 1:
533
+ return 8;
534
+ case 2:
535
+ this.begin("CLASS");
536
+ break;
537
+ case 3:
538
+ this.popState();
539
+ return 16;
540
+ case 4:
541
+ this.popState();
542
+ break;
543
+ case 5:
544
+ yy.getLogger().trace("Begin icon");
545
+ this.begin("ICON");
546
+ break;
547
+ case 6:
548
+ yy.getLogger().trace("SPACELINE");
549
+ return 6;
550
+ case 7:
551
+ return 7;
552
+ case 8:
553
+ return 15;
554
+ case 9:
555
+ yy.getLogger().trace("end icon");
556
+ this.popState();
557
+ break;
558
+ case 10:
559
+ yy.getLogger().trace("Exploding node");
560
+ this.begin("NODE");
561
+ return 19;
562
+ case 11:
563
+ yy.getLogger().trace("Cloud");
564
+ this.begin("NODE");
565
+ return 19;
566
+ case 12:
567
+ yy.getLogger().trace("Explosion Bang");
568
+ this.begin("NODE");
569
+ return 19;
570
+ case 13:
571
+ yy.getLogger().trace("Cloud Bang");
572
+ this.begin("NODE");
573
+ return 19;
574
+ case 14:
575
+ this.begin("NODE");
576
+ return 19;
577
+ case 15:
578
+ this.begin("NODE");
579
+ return 19;
580
+ case 16:
581
+ this.begin("NODE");
582
+ return 19;
583
+ case 17:
584
+ this.begin("NODE");
585
+ return 19;
586
+ case 18:
587
+ return 13;
588
+ case 19:
589
+ return 22;
590
+ case 20:
591
+ return 11;
592
+ case 21:
593
+ this.begin("NSTR2");
594
+ break;
595
+ case 22:
596
+ return "NODE_DESCR";
597
+ case 23:
598
+ this.popState();
599
+ break;
600
+ case 24:
601
+ yy.getLogger().trace("Starting NSTR");
602
+ this.begin("NSTR");
603
+ break;
604
+ case 25:
605
+ yy.getLogger().trace("description:", yy_.yytext);
606
+ return "NODE_DESCR";
607
+ case 26:
608
+ this.popState();
609
+ break;
610
+ case 27:
611
+ this.popState();
612
+ yy.getLogger().trace("node end ))");
613
+ return "NODE_DEND";
614
+ case 28:
615
+ this.popState();
616
+ yy.getLogger().trace("node end )");
617
+ return "NODE_DEND";
618
+ case 29:
619
+ this.popState();
620
+ yy.getLogger().trace("node end ...", yy_.yytext);
621
+ return "NODE_DEND";
622
+ case 30:
623
+ this.popState();
624
+ yy.getLogger().trace("node end ((");
625
+ return "NODE_DEND";
626
+ case 31:
627
+ this.popState();
628
+ yy.getLogger().trace("node end (-");
629
+ return "NODE_DEND";
630
+ case 32:
631
+ this.popState();
632
+ yy.getLogger().trace("node end (-");
633
+ return "NODE_DEND";
634
+ case 33:
635
+ this.popState();
636
+ yy.getLogger().trace("node end ((");
637
+ return "NODE_DEND";
638
+ case 34:
639
+ this.popState();
640
+ yy.getLogger().trace("node end ((");
641
+ return "NODE_DEND";
642
+ case 35:
643
+ yy.getLogger().trace("Long description:", yy_.yytext);
644
+ return 20;
645
+ case 36:
646
+ yy.getLogger().trace("Long description:", yy_.yytext);
647
+ return 20;
648
+ }
649
+ }, "anonymous"),
650
+ rules: [/^(?:\s*%%.*)/i, /^(?:mindmap\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\)\{\}]+)/i, /^(?:$)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i],
651
+ conditions: { "CLASS": { "rules": [3, 4], "inclusive": false }, "ICON": { "rules": [8, 9], "inclusive": false }, "NSTR2": { "rules": [22, 23], "inclusive": false }, "NSTR": { "rules": [25, 26], "inclusive": false }, "NODE": { "rules": [21, 24, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], "inclusive": true } }
652
+ };
653
+ return lexer2;
654
+ })();
655
+ parser2.lexer = lexer;
656
+ function Parser() {
657
+ this.yy = {};
658
+ }
659
+ __name(Parser, "Parser");
660
+ Parser.prototype = parser2;
661
+ parser2.Parser = Parser;
662
+ return new Parser();
663
+ })();
664
+ parser.parser = parser;
665
+ var mindmap_default = parser;
666
+ var MAX_SECTIONS = 12;
667
+ var nodeType = {
668
+ DEFAULT: 0,
669
+ NO_BORDER: 0,
670
+ ROUNDED_RECT: 1,
671
+ RECT: 2,
672
+ CIRCLE: 3,
673
+ CLOUD: 4,
674
+ BANG: 5,
675
+ HEXAGON: 6
676
+ };
677
+ var MindmapDB = (_a = class {
678
+ constructor() {
679
+ this.nodes = [];
680
+ this.count = 0;
681
+ this.elements = {};
682
+ this.getLogger = this.getLogger.bind(this);
683
+ this.nodeType = nodeType;
684
+ this.clear();
685
+ this.getType = this.getType.bind(this);
686
+ this.getElementById = this.getElementById.bind(this);
687
+ this.getParent = this.getParent.bind(this);
688
+ this.getMindmap = this.getMindmap.bind(this);
689
+ this.addNode = this.addNode.bind(this);
690
+ this.decorateNode = this.decorateNode.bind(this);
691
+ }
692
+ clear() {
693
+ this.nodes = [];
694
+ this.count = 0;
695
+ this.elements = {};
696
+ this.baseLevel = void 0;
697
+ }
698
+ getParent(level) {
699
+ for (let i = this.nodes.length - 1; i >= 0; i--) {
700
+ if (this.nodes[i].level < level) {
701
+ return this.nodes[i];
702
+ }
703
+ }
704
+ return null;
705
+ }
706
+ getMindmap() {
707
+ return this.nodes.length > 0 ? this.nodes[0] : null;
708
+ }
709
+ addNode(level, id, descr, type) {
710
+ var _a2, _b;
711
+ log.info("addNode", level, id, descr, type);
712
+ let isRoot = false;
713
+ if (this.nodes.length === 0) {
714
+ this.baseLevel = level;
715
+ level = 0;
716
+ isRoot = true;
717
+ } else if (this.baseLevel !== void 0) {
718
+ level = level - this.baseLevel;
719
+ isRoot = false;
720
+ }
721
+ const conf = getConfig2();
722
+ let padding = ((_a2 = conf.mindmap) == null ? void 0 : _a2.padding) ?? defaultConfig_default.mindmap.padding;
723
+ switch (type) {
724
+ case this.nodeType.ROUNDED_RECT:
725
+ case this.nodeType.RECT:
726
+ case this.nodeType.HEXAGON:
727
+ padding *= 2;
728
+ break;
729
+ }
730
+ const node = {
731
+ id: this.count++,
732
+ nodeId: sanitizeText(id, conf),
733
+ level,
734
+ descr: sanitizeText(descr, conf),
735
+ type,
736
+ children: [],
737
+ width: ((_b = conf.mindmap) == null ? void 0 : _b.maxNodeWidth) ?? defaultConfig_default.mindmap.maxNodeWidth,
738
+ padding,
739
+ isRoot
740
+ };
741
+ const parent = this.getParent(level);
742
+ if (parent) {
743
+ parent.children.push(node);
744
+ this.nodes.push(node);
745
+ } else {
746
+ if (isRoot) {
747
+ this.nodes.push(node);
748
+ } else {
749
+ throw new Error(
750
+ `There can be only one root. No parent could be found for ("${node.descr}")`
751
+ );
752
+ }
753
+ }
754
+ }
755
+ getType(startStr, endStr) {
756
+ log.debug("In get type", startStr, endStr);
757
+ switch (startStr) {
758
+ case "[":
759
+ return this.nodeType.RECT;
760
+ case "(":
761
+ return endStr === ")" ? this.nodeType.ROUNDED_RECT : this.nodeType.CLOUD;
762
+ case "((":
763
+ return this.nodeType.CIRCLE;
764
+ case ")":
765
+ return this.nodeType.CLOUD;
766
+ case "))":
767
+ return this.nodeType.BANG;
768
+ case "{{":
769
+ return this.nodeType.HEXAGON;
770
+ default:
771
+ return this.nodeType.DEFAULT;
772
+ }
773
+ }
774
+ setElementForId(id, element) {
775
+ this.elements[id] = element;
776
+ }
777
+ getElementById(id) {
778
+ return this.elements[id];
779
+ }
780
+ decorateNode(decoration) {
781
+ if (!decoration) {
782
+ return;
783
+ }
784
+ const config = getConfig2();
785
+ const node = this.nodes[this.nodes.length - 1];
786
+ if (decoration.icon) {
787
+ node.icon = sanitizeText(decoration.icon, config);
788
+ }
789
+ if (decoration.class) {
790
+ node.class = sanitizeText(decoration.class, config);
791
+ }
792
+ }
793
+ type2Str(type) {
794
+ switch (type) {
795
+ case this.nodeType.DEFAULT:
796
+ return "no-border";
797
+ case this.nodeType.RECT:
798
+ return "rect";
799
+ case this.nodeType.ROUNDED_RECT:
800
+ return "rounded-rect";
801
+ case this.nodeType.CIRCLE:
802
+ return "circle";
803
+ case this.nodeType.CLOUD:
804
+ return "cloud";
805
+ case this.nodeType.BANG:
806
+ return "bang";
807
+ case this.nodeType.HEXAGON:
808
+ return "hexgon";
809
+ // cspell: disable-line
810
+ default:
811
+ return "no-border";
812
+ }
813
+ }
814
+ /**
815
+ * Assign section numbers to nodes based on their position relative to root
816
+ * @param node - The mindmap node to process
817
+ * @param sectionNumber - The section number to assign (undefined for root)
818
+ */
819
+ assignSections(node, sectionNumber) {
820
+ if (node.level === 0) {
821
+ node.section = void 0;
822
+ } else {
823
+ node.section = sectionNumber;
824
+ }
825
+ if (node.children) {
826
+ for (const [index, child] of node.children.entries()) {
827
+ const childSectionNumber = node.level === 0 ? index % (MAX_SECTIONS - 1) : sectionNumber;
828
+ this.assignSections(child, childSectionNumber);
829
+ }
830
+ }
831
+ }
832
+ /**
833
+ * Convert mindmap tree structure to flat array of nodes
834
+ * @param node - The mindmap node to process
835
+ * @param processedNodes - Array to collect processed nodes
836
+ */
837
+ flattenNodes(node, processedNodes) {
838
+ const conf = getConfig2();
839
+ const cssClasses = ["mindmap-node"];
840
+ if (node.isRoot === true) {
841
+ cssClasses.push("section-root", "section--1");
842
+ } else if (node.section !== void 0) {
843
+ cssClasses.push(`section-${node.section}`);
844
+ }
845
+ if (node.class) {
846
+ cssClasses.push(node.class);
847
+ }
848
+ const classes = cssClasses.join(" ");
849
+ const getShapeFromType = /* @__PURE__ */ __name((type) => {
850
+ var _a2;
851
+ const theme = ((_a2 = conf.theme) == null ? void 0 : _a2.toLowerCase()) ?? "";
852
+ const isReduxTheme = theme.includes("redux");
853
+ switch (type) {
854
+ case nodeType.CIRCLE:
855
+ return "mindmapCircle";
856
+ case nodeType.RECT:
857
+ return "rect";
858
+ case nodeType.ROUNDED_RECT:
859
+ return "rounded";
860
+ case nodeType.CLOUD:
861
+ return "cloud";
862
+ case nodeType.BANG:
863
+ return "bang";
864
+ case nodeType.HEXAGON:
865
+ return "hexagon";
866
+ case nodeType.DEFAULT:
867
+ return isReduxTheme ? "rounded" : "defaultMindmapNode";
868
+ case nodeType.NO_BORDER:
869
+ default:
870
+ return "rect";
871
+ }
872
+ }, "getShapeFromType");
873
+ const processedNode = {
874
+ id: node.id.toString(),
875
+ domId: "node_" + node.id.toString(),
876
+ label: node.descr,
877
+ labelType: "markdown",
878
+ isGroup: false,
879
+ shape: getShapeFromType(node.type),
880
+ width: node.width,
881
+ height: node.height ?? 0,
882
+ padding: node.padding,
883
+ cssClasses: classes,
884
+ cssStyles: [],
885
+ look: conf.look,
886
+ icon: node.icon,
887
+ x: node.x,
888
+ y: node.y,
889
+ // Mindmap-specific properties
890
+ level: node.level,
891
+ nodeId: node.nodeId,
892
+ type: node.type,
893
+ section: node.section
894
+ };
895
+ processedNodes.push(processedNode);
896
+ if (node.children) {
897
+ for (const child of node.children) {
898
+ this.flattenNodes(child, processedNodes);
899
+ }
900
+ }
901
+ }
902
+ /**
903
+ * Generate edges from parent-child relationships in mindmap tree
904
+ * @param node - The mindmap node to process
905
+ * @param edges - Array to collect edges
906
+ */
907
+ generateEdges(node, edges) {
908
+ if (!node.children) {
909
+ return;
910
+ }
911
+ const conf = getConfig2();
912
+ for (const child of node.children) {
913
+ let edgeClasses = "edge";
914
+ if (child.section !== void 0) {
915
+ edgeClasses += ` section-edge-${child.section}`;
916
+ }
917
+ const edgeDepth = node.level + 1;
918
+ edgeClasses += ` edge-depth-${edgeDepth}`;
919
+ const edge = {
920
+ id: `edge_${node.id}_${child.id}`,
921
+ start: node.id.toString(),
922
+ end: child.id.toString(),
923
+ type: "normal",
924
+ curve: "basis",
925
+ thickness: "normal",
926
+ look: conf.look,
927
+ classes: edgeClasses,
928
+ // Store mindmap-specific data
929
+ depth: node.level,
930
+ section: child.section
931
+ };
932
+ edges.push(edge);
933
+ this.generateEdges(child, edges);
934
+ }
935
+ }
936
+ /**
937
+ * Get structured data for layout algorithms
938
+ * Following the pattern established by ER diagrams
939
+ * @returns Structured data containing nodes, edges, and config
940
+ */
941
+ getData() {
942
+ const mindmapRoot = this.getMindmap();
943
+ const config = getConfig2();
944
+ const userDefinedConfig = getUserDefinedConfig();
945
+ const hasUserDefinedLayout = userDefinedConfig.layout !== void 0;
946
+ const finalConfig = config;
947
+ if (!hasUserDefinedLayout) {
948
+ finalConfig.layout = "cose-bilkent";
949
+ }
950
+ if (!mindmapRoot) {
951
+ return {
952
+ nodes: [],
953
+ edges: [],
954
+ config: finalConfig
955
+ };
956
+ }
957
+ log.debug("getData: mindmapRoot", mindmapRoot, config);
958
+ this.assignSections(mindmapRoot);
959
+ const processedNodes = [];
960
+ const processedEdges = [];
961
+ this.flattenNodes(mindmapRoot, processedNodes);
962
+ this.generateEdges(mindmapRoot, processedEdges);
963
+ log.debug(
964
+ `getData: processed ${processedNodes.length} nodes and ${processedEdges.length} edges`
965
+ );
966
+ const shapes = /* @__PURE__ */ new Map();
967
+ for (const node of processedNodes) {
968
+ shapes.set(node.id, {
969
+ shape: node.shape,
970
+ width: node.width,
971
+ height: node.height,
972
+ padding: node.padding
973
+ });
974
+ }
975
+ return {
976
+ nodes: processedNodes,
977
+ edges: processedEdges,
978
+ config: finalConfig,
979
+ // Store the root node for mindmap-specific layout algorithms
980
+ rootNode: mindmapRoot,
981
+ // Properties required by dagre layout algorithm
982
+ markers: ["point"],
983
+ // Mindmaps don't use markers
984
+ direction: "TB",
985
+ // Top-to-bottom direction for mindmaps
986
+ nodeSpacing: 50,
987
+ // Default spacing between nodes
988
+ rankSpacing: 50,
989
+ // Default spacing between ranks
990
+ // Add shapes for ELK compatibility
991
+ shapes: Object.fromEntries(shapes),
992
+ // Additional properties that layout algorithms might expect
993
+ type: "mindmap",
994
+ diagramId: "mindmap-" + v4()
995
+ };
996
+ }
997
+ // Expose logger to grammar
998
+ getLogger() {
999
+ return log;
1000
+ }
1001
+ }, __name(_a, "MindmapDB"), _a);
1002
+ var draw = /* @__PURE__ */ __name(async (text, id, _version, diagObj) => {
1003
+ var _a2, _b;
1004
+ log.debug("Rendering mindmap diagram\n" + text);
1005
+ const db = diagObj.db;
1006
+ const data4Layout = db.getData();
1007
+ const svg = getDiagramElement(id, data4Layout.config.securityLevel);
1008
+ data4Layout.type = diagObj.type;
1009
+ data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(data4Layout.config.layout, {
1010
+ fallback: "cose-bilkent"
1011
+ });
1012
+ data4Layout.diagramId = id;
1013
+ const mm = db.getMindmap();
1014
+ if (!mm) {
1015
+ return;
1016
+ }
1017
+ data4Layout.nodes.forEach((node) => {
1018
+ if (node.shape === "rounded") {
1019
+ node.radius = 15;
1020
+ node.taper = 15;
1021
+ node.stroke = "none";
1022
+ node.width = 0;
1023
+ node.padding = 15;
1024
+ } else if (node.shape === "circle") {
1025
+ node.padding = 10;
1026
+ } else if (node.shape === "rect") {
1027
+ node.width = 0;
1028
+ node.padding = 10;
1029
+ } else if (node.shape === "hexagon") {
1030
+ node.width = 0;
1031
+ node.height = 0;
1032
+ }
1033
+ });
1034
+ await render(data4Layout, svg);
1035
+ const { themeVariables } = getConfig();
1036
+ const { useGradient, gradientStart, gradientStop } = themeVariables;
1037
+ if (useGradient && gradientStart && gradientStop) {
1038
+ const svgId = svg.attr("id");
1039
+ const gradient = svg.append("defs").append("linearGradient").attr("id", `${svgId}-gradient`).attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
1040
+ gradient.append("stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1);
1041
+ gradient.append("stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1);
1042
+ }
1043
+ setupViewPortForSVG(
1044
+ svg,
1045
+ ((_a2 = data4Layout.config.mindmap) == null ? void 0 : _a2.padding) ?? defaultConfig_default.mindmap.padding,
1046
+ "mindmapDiagram",
1047
+ ((_b = data4Layout.config.mindmap) == null ? void 0 : _b.useMaxWidth) ?? defaultConfig_default.mindmap.useMaxWidth
1048
+ );
1049
+ }, "draw");
1050
+ var mindmapRenderer_default = {
1051
+ draw
1052
+ };
1053
+ var genSections = /* @__PURE__ */ __name((options) => {
1054
+ const { theme, look } = options;
1055
+ let sections = "";
1056
+ for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
1057
+ options["lineColor" + i] = options["lineColor" + i] || options["cScaleInv" + i];
1058
+ if (isDark(options["lineColor" + i])) {
1059
+ options["lineColor" + i] = lighten(options["lineColor" + i], 20);
1060
+ } else {
1061
+ options["lineColor" + i] = darken(options["lineColor" + i], 20);
1062
+ }
1063
+ }
1064
+ for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
1065
+ const sw = "" + (look === "neo" ? Math.max(10 - (i - 1) * 2, 2) : 17 - 3 * i);
1066
+ sections += `
1067
+ .section-${i - 1} rect, .section-${i - 1} path, .section-${i - 1} circle, .section-${i - 1} polygon, .section-${i - 1} path {
1068
+ fill: ${options["cScale" + i]};
1069
+ }
1070
+ .section-${i - 1} text {
1071
+ fill: ${options["cScaleLabel" + i]};
1072
+ }
1073
+ .section-${i - 1} span {
1074
+ color: ${options["cScaleLabel" + i]};
1075
+ }
1076
+ .node-icon-${i - 1} {
1077
+ font-size: 40px;
1078
+ color: ${options["cScaleLabel" + i]};
1079
+ }
1080
+ .section-edge-${i - 1}{
1081
+ stroke: ${options["cScale" + i]};
1082
+ }
1083
+ .edge-depth-${i - 1}{
1084
+ stroke-width: ${sw};
1085
+ }
1086
+ .section-${i - 1} line {
1087
+ stroke: ${options["cScaleInv" + i]} ;
1088
+ stroke-width: 3;
1089
+ }
1090
+
1091
+ .disabled, .disabled circle, .disabled text {
1092
+ fill: lightgray;
1093
+ }
1094
+ .disabled text {
1095
+ fill: #efefef;
1096
+ }
1097
+ [data-look="neo"].mindmap-node.section-${i - 1} rect, [data-look="neo"].mindmap-node.section-${i - 1} path, [data-look="neo"].mindmap-node.section-${i - 1} circle, [data-look="neo"].mindmap-node.section-${i - 1} polygon {
1098
+ fill: ${theme === "redux" || theme === "redux-dark" || theme === "neutral" ? options.mainBkg : options["cScale" + i]};
1099
+ stroke: ${theme === "redux" || theme === "redux-dark" ? options.nodeBorder : options["cScale" + i]};
1100
+ stroke-width: ${options.strokeWidth ?? 2}px;
1101
+ }
1102
+ [data-look="neo"].section-edge-${i - 1}{
1103
+ stroke: ${(theme == null ? void 0 : theme.includes("redux")) || theme === "neo-dark" ? options.nodeBorder : options["cScale" + i]};
1104
+ }
1105
+ [data-look="neo"].mindmap-node.section-${i - 1} text {
1106
+ fill: ${theme === "redux" || theme === "redux-dark" ? options.nodeBorder : options["cScaleLabel" + (theme === "neutral" ? 1 : i)]};
1107
+ }
1108
+ `;
1109
+ }
1110
+ return sections;
1111
+ }, "genSections");
1112
+ var genGradient = /* @__PURE__ */ __name((THEME_COLOR_LIMIT, svgId, mainBkg) => {
1113
+ let sections = "";
1114
+ for (let i = 0; i < THEME_COLOR_LIMIT; i++) {
1115
+ sections += `
1116
+ [data-look="neo"].mindmap-node.section-${i - 1} rect, [data-look="neo"].mindmap-node.section-${i - 1} path, [data-look="neo"].mindmap-node.section-${i - 1} circle, [data-look="neo"].mindmap-node.section-${i - 1} polygon {
1117
+ stroke: url(${svgId}-gradient);
1118
+ fill: ${mainBkg};
1119
+ }
1120
+ .section-${i - 1} line {
1121
+ stroke-width: 0;
1122
+ }`;
1123
+ }
1124
+ return sections;
1125
+ }, "genGradient");
1126
+ var getStyles = /* @__PURE__ */ __name((options) => {
1127
+ const { theme } = options;
1128
+ const svgId = options.svgId;
1129
+ const scopedDropShadow = options.dropShadow ? options.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none";
1130
+ return `
1131
+ .edge {
1132
+ stroke-width: 3;
1133
+ }
1134
+ ${genSections(options)}
1135
+ .section-root rect, .section-root path, .section-root circle, .section-root polygon {
1136
+ fill: ${options.git0};
1137
+ }
1138
+ .section-root text {
1139
+ fill: ${options.gitBranchLabel0};
1140
+ }
1141
+ .section-root span {
1142
+ color: ${(theme == null ? void 0 : theme.includes("redux")) ? options.nodeBorder : options.gitBranchLabel0};
1143
+ }
1144
+ .icon-container {
1145
+ height:100%;
1146
+ display: flex;
1147
+ justify-content: center;
1148
+ align-items: center;
1149
+ }
1150
+ .edge {
1151
+ fill: none;
1152
+ }
1153
+ .mindmap-node-label {
1154
+ dy: 1em;
1155
+ alignment-baseline: middle;
1156
+ text-anchor: middle;
1157
+ dominant-baseline: middle;
1158
+ text-align: center;
1159
+ }
1160
+ [data-look="neo"].mindmap-node {
1161
+ filter: ${scopedDropShadow};
1162
+ }
1163
+ [data-look="neo"].mindmap-node.section-root rect, [data-look="neo"].mindmap-node.section-root path, [data-look="neo"].mindmap-node.section-root circle, [data-look="neo"].mindmap-node.section-root polygon {
1164
+ fill: ${(theme == null ? void 0 : theme.includes("redux")) ? options.mainBkg : options.git0};
1165
+ }
1166
+ [data-look="neo"].mindmap-node.section-root .text-inner-tspan {
1167
+ fill: ${(theme == null ? void 0 : theme.includes("redux")) ? options.nodeBorder : options["cScaleLabel" + (theme === "neutral" ? 1 : 0)]};
1168
+ }
1169
+ ${options.useGradient && svgId && options.mainBkg ? genGradient(options.THEME_COLOR_LIMIT, svgId, options.mainBkg) : ""}
1170
+ `;
1171
+ }, "getStyles");
1172
+ var styles_default = getStyles;
1173
+ var diagram = {
1174
+ get db() {
1175
+ return new MindmapDB();
1176
+ },
1177
+ renderer: mindmapRenderer_default,
1178
+ parser: mindmap_default,
1179
+ styles: styles_default
1180
+ };
1181
+ export {
1182
+ diagram
1183
+ };