local-operator-ui 0.9.2 → 0.10.1

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 (51) hide show
  1. package/out/main/index.jsc +0 -0
  2. package/out/preload/index.jsc +0 -0
  3. package/out/renderer/assets/_basePickBy-B5zFlqYH.js +195 -0
  4. package/out/renderer/assets/_baseUniq-BIR69pjE.js +835 -0
  5. package/out/renderer/assets/arc-vi2cZvnf.js +131 -0
  6. package/out/renderer/assets/architectureDiagram-IEHRJDOE-DChvv_dX.js +8653 -0
  7. package/out/renderer/assets/blockDiagram-JOT3LUYC-CEFfNRQ0.js +3585 -0
  8. package/out/renderer/assets/c4Diagram-VJAJSXHY-CMcq-0y4.js +2487 -0
  9. package/out/renderer/assets/channel-DxrUxepG.js +7 -0
  10. package/out/renderer/assets/chunk-4BMEZGHF-CLG9UTTy.js +16 -0
  11. package/out/renderer/assets/chunk-A2AXSNBT-OvwzTsRA.js +1827 -0
  12. package/out/renderer/assets/chunk-AEK57VVT-BNwaQxQ1.js +1953 -0
  13. package/out/renderer/assets/chunk-D6G4REZN-9hk0KigE.js +108 -0
  14. package/out/renderer/assets/chunk-RZ5BOZE2-BAS8OFkl.js +34 -0
  15. package/out/renderer/assets/chunk-XZIHB7SX-BBBrevk8.js +19 -0
  16. package/out/renderer/assets/classDiagram-GIVACNV2-B26ENMdv.js +21 -0
  17. package/out/renderer/assets/classDiagram-v2-COTLJTTW-B26ENMdv.js +21 -0
  18. package/out/renderer/assets/clone-BnNWUSJZ.js +8 -0
  19. package/out/renderer/assets/cytoscape.esm-C0AOj4uS.js +30062 -0
  20. package/out/renderer/assets/dagre-OKDRZEBW-CrmhwUSU.js +695 -0
  21. package/out/renderer/assets/diagram-SSKATNLV-BdqHkj-I.js +304 -0
  22. package/out/renderer/assets/diagram-VNBRO52H-CKrL77xr.js +193 -0
  23. package/out/renderer/assets/erDiagram-Q7BY3M3F-Tt0aLhGI.js +1160 -0
  24. package/out/renderer/assets/flowDiagram-4HSFHLVR-CcH5VigW.js +2324 -0
  25. package/out/renderer/assets/{fonts-Bx8fKQfu.js → fonts-Dt5cFjOU.js} +178 -178
  26. package/out/renderer/assets/ganttDiagram-APWFNJXF-Bi0xeYEe.js +2500 -0
  27. package/out/renderer/assets/gitGraphDiagram-7IBYFJ6S-CGwSvQwC.js +1204 -0
  28. package/out/renderer/assets/graph-Db6INjYz.js +424 -0
  29. package/out/renderer/assets/{index-DtFlp8rf.js → index-Bfd-2Oc6.js} +2 -2
  30. package/out/renderer/assets/{index-Cf8ixUbJ.js → index-CtRI8g3Q.js} +104853 -76337
  31. package/out/renderer/assets/{index-n_d5-ePx.js → index-DiYn4yiw.js} +2 -2
  32. package/out/renderer/assets/{index-0vP6mKPB.css → index-Dtwjgp5_.css} +9 -0
  33. package/out/renderer/assets/infoDiagram-PH2N3AL5-Ge-A0ZLx.js +33 -0
  34. package/out/renderer/assets/{installer-Cn81GyOR.js → installer-lVyomCxI.js} +1 -1
  35. package/out/renderer/assets/journeyDiagram-U35MCT3I-D_NUNOvR.js +1199 -0
  36. package/out/renderer/assets/kanban-definition-NDS4AKOZ-klQOxYYr.js +1046 -0
  37. package/out/renderer/assets/layout-s692bBPh.js +2060 -0
  38. package/out/renderer/assets/mindmap-definition-ALO5MXBD-CTAoaran.js +5836 -0
  39. package/out/renderer/assets/pieDiagram-IB7DONF6-C2fGlnMA.js +239 -0
  40. package/out/renderer/assets/quadrantDiagram-7GDLP6J5-BHT2tkE6.js +1340 -0
  41. package/out/renderer/assets/radar-MK3ICKWK-DgJ2QYDL.js +16935 -0
  42. package/out/renderer/assets/requirementDiagram-KVF5MWMF-PPbRo3RD.js +1163 -0
  43. package/out/renderer/assets/sankeyDiagram-QLVOVGJD-DqyHobM6.js +1201 -0
  44. package/out/renderer/assets/sequenceDiagram-X6HHIX6F-BLS88slX.js +3415 -0
  45. package/out/renderer/assets/stateDiagram-DGXRK772-Dy2hiNJa.js +467 -0
  46. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-DjXWM0hu.js +21 -0
  47. package/out/renderer/assets/timeline-definition-BDJGKUSR-lE2dNCpN.js +1223 -0
  48. package/out/renderer/assets/xychartDiagram-VJFVF3MP-DfYmDcNz.js +1800 -0
  49. package/out/renderer/index.html +5 -5
  50. package/out/renderer/installer.html +2 -2
  51. package/package.json +4 -1
@@ -0,0 +1,1953 @@
1
+ import { g as getDiagramElement, s as setupViewPortForSVG } from "./chunk-RZ5BOZE2-BAS8OFkl.js";
2
+ import { _ as __name, l as log, c as getConfig2, r as render, u as utils_default, ad as generateId, k as common_default, z as clear, a as getAccTitle, b as setAccTitle, g as getAccDescription, s as setAccDescription, q as setDiagramTitle, t as getDiagramTitle } from "./index-CtRI8g3Q.js";
3
+ var parser = function() {
4
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
5
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
6
+ return o2;
7
+ }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 16], $V7 = [1, 17], $V8 = [1, 18], $V9 = [1, 19], $Va = [1, 32], $Vb = [1, 20], $Vc = [1, 21], $Vd = [1, 22], $Ve = [1, 23], $Vf = [1, 24], $Vg = [1, 26], $Vh = [1, 27], $Vi = [1, 28], $Vj = [1, 29], $Vk = [1, 30], $Vl = [1, 31], $Vm = [1, 34], $Vn = [1, 35], $Vo = [1, 36], $Vp = [1, 37], $Vq = [1, 33], $Vr = [1, 4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], $Vs = [1, 4, 5, 14, 15, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], $Vt = [4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54];
8
+ var parser2 = {
9
+ trace: /* @__PURE__ */ __name(function trace() {
10
+ }, "trace"),
11
+ yy: {},
12
+ symbols_: { "error": 2, "start": 3, "SPACE": 4, "NL": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "classDefStatement": 10, "styleStatement": 11, "cssClassStatement": 12, "idStatement": 13, "DESCR": 14, "-->": 15, "HIDE_EMPTY": 16, "scale": 17, "WIDTH": 18, "COMPOSIT_STATE": 19, "STRUCT_START": 20, "STRUCT_STOP": 21, "STATE_DESCR": 22, "AS": 23, "ID": 24, "FORK": 25, "JOIN": 26, "CHOICE": 27, "CONCURRENT": 28, "note": 29, "notePosition": 30, "NOTE_TEXT": 31, "direction": 32, "acc_title": 33, "acc_title_value": 34, "acc_descr": 35, "acc_descr_value": 36, "acc_descr_multiline_value": 37, "classDef": 38, "CLASSDEF_ID": 39, "CLASSDEF_STYLEOPTS": 40, "DEFAULT": 41, "style": 42, "STYLE_IDS": 43, "STYLEDEF_STYLEOPTS": 44, "class": 45, "CLASSENTITY_IDS": 46, "STYLECLASS": 47, "direction_tb": 48, "direction_bt": 49, "direction_rl": 50, "direction_lr": 51, "eol": 52, ";": 53, "EDGE_STATE": 54, "STYLE_SEPARATOR": 55, "left_of": 56, "right_of": 57, "$accept": 0, "$end": 1 },
13
+ terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 14: "DESCR", 15: "-->", 16: "HIDE_EMPTY", 17: "scale", 18: "WIDTH", 19: "COMPOSIT_STATE", 20: "STRUCT_START", 21: "STRUCT_STOP", 22: "STATE_DESCR", 23: "AS", 24: "ID", 25: "FORK", 26: "JOIN", 27: "CHOICE", 28: "CONCURRENT", 29: "note", 31: "NOTE_TEXT", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 38: "classDef", 39: "CLASSDEF_ID", 40: "CLASSDEF_STYLEOPTS", 41: "DEFAULT", 42: "style", 43: "STYLE_IDS", 44: "STYLEDEF_STYLEOPTS", 45: "class", 46: "CLASSENTITY_IDS", 47: "STYLECLASS", 48: "direction_tb", 49: "direction_bt", 50: "direction_rl", 51: "direction_lr", 53: ";", 54: "EDGE_STATE", 55: "STYLE_SEPARATOR", 56: "left_of", 57: "right_of" },
14
+ productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 3], [9, 4], [9, 1], [9, 2], [9, 1], [9, 4], [9, 3], [9, 6], [9, 1], [9, 1], [9, 1], [9, 1], [9, 4], [9, 4], [9, 1], [9, 2], [9, 2], [9, 1], [10, 3], [10, 3], [11, 3], [12, 3], [32, 1], [32, 1], [32, 1], [32, 1], [52, 1], [52, 1], [13, 1], [13, 1], [13, 3], [13, 3], [30, 1], [30, 1]],
15
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
16
+ var $0 = $$.length - 1;
17
+ switch (yystate) {
18
+ case 3:
19
+ yy.setRootDoc($$[$0]);
20
+ return $$[$0];
21
+ case 4:
22
+ this.$ = [];
23
+ break;
24
+ case 5:
25
+ if ($$[$0] != "nl") {
26
+ $$[$0 - 1].push($$[$0]);
27
+ this.$ = $$[$0 - 1];
28
+ }
29
+ break;
30
+ case 6:
31
+ case 7:
32
+ this.$ = $$[$0];
33
+ break;
34
+ case 8:
35
+ this.$ = "nl";
36
+ break;
37
+ case 12:
38
+ this.$ = $$[$0];
39
+ break;
40
+ case 13:
41
+ const stateStmt = $$[$0 - 1];
42
+ stateStmt.description = yy.trimColon($$[$0]);
43
+ this.$ = stateStmt;
44
+ break;
45
+ case 14:
46
+ this.$ = { stmt: "relation", state1: $$[$0 - 2], state2: $$[$0] };
47
+ break;
48
+ case 15:
49
+ const relDescription = yy.trimColon($$[$0]);
50
+ this.$ = { stmt: "relation", state1: $$[$0 - 3], state2: $$[$0 - 1], description: relDescription };
51
+ break;
52
+ case 19:
53
+ this.$ = { stmt: "state", id: $$[$0 - 3], type: "default", description: "", doc: $$[$0 - 1] };
54
+ break;
55
+ case 20:
56
+ var id = $$[$0];
57
+ var description = $$[$0 - 2].trim();
58
+ if ($$[$0].match(":")) {
59
+ var parts = $$[$0].split(":");
60
+ id = parts[0];
61
+ description = [description, parts[1]];
62
+ }
63
+ this.$ = { stmt: "state", id, type: "default", description };
64
+ break;
65
+ case 21:
66
+ this.$ = { stmt: "state", id: $$[$0 - 3], type: "default", description: $$[$0 - 5], doc: $$[$0 - 1] };
67
+ break;
68
+ case 22:
69
+ this.$ = { stmt: "state", id: $$[$0], type: "fork" };
70
+ break;
71
+ case 23:
72
+ this.$ = { stmt: "state", id: $$[$0], type: "join" };
73
+ break;
74
+ case 24:
75
+ this.$ = { stmt: "state", id: $$[$0], type: "choice" };
76
+ break;
77
+ case 25:
78
+ this.$ = { stmt: "state", id: yy.getDividerId(), type: "divider" };
79
+ break;
80
+ case 26:
81
+ this.$ = { stmt: "state", id: $$[$0 - 1].trim(), note: { position: $$[$0 - 2].trim(), text: $$[$0].trim() } };
82
+ break;
83
+ case 29:
84
+ this.$ = $$[$0].trim();
85
+ yy.setAccTitle(this.$);
86
+ break;
87
+ case 30:
88
+ case 31:
89
+ this.$ = $$[$0].trim();
90
+ yy.setAccDescription(this.$);
91
+ break;
92
+ case 32:
93
+ case 33:
94
+ this.$ = { stmt: "classDef", id: $$[$0 - 1].trim(), classes: $$[$0].trim() };
95
+ break;
96
+ case 34:
97
+ this.$ = { stmt: "style", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() };
98
+ break;
99
+ case 35:
100
+ this.$ = { stmt: "applyClass", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() };
101
+ break;
102
+ case 36:
103
+ yy.setDirection("TB");
104
+ this.$ = { stmt: "dir", value: "TB" };
105
+ break;
106
+ case 37:
107
+ yy.setDirection("BT");
108
+ this.$ = { stmt: "dir", value: "BT" };
109
+ break;
110
+ case 38:
111
+ yy.setDirection("RL");
112
+ this.$ = { stmt: "dir", value: "RL" };
113
+ break;
114
+ case 39:
115
+ yy.setDirection("LR");
116
+ this.$ = { stmt: "dir", value: "LR" };
117
+ break;
118
+ case 42:
119
+ case 43:
120
+ this.$ = { stmt: "state", id: $$[$0].trim(), type: "default", description: "" };
121
+ break;
122
+ case 44:
123
+ this.$ = { stmt: "state", id: $$[$0 - 2].trim(), classes: [$$[$0].trim()], type: "default", description: "" };
124
+ break;
125
+ case 45:
126
+ this.$ = { stmt: "state", id: $$[$0 - 2].trim(), classes: [$$[$0].trim()], type: "default", description: "" };
127
+ break;
128
+ }
129
+ }, "anonymous"),
130
+ table: [{ 3: 1, 4: $V0, 5: $V1, 6: $V2 }, { 1: [3] }, { 3: 5, 4: $V0, 5: $V1, 6: $V2 }, { 3: 6, 4: $V0, 5: $V1, 6: $V2 }, o([1, 4, 5, 16, 17, 19, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 42: $Vk, 45: $Vl, 48: $Vm, 49: $Vn, 50: $Vo, 51: $Vp, 54: $Vq }, o($Vr, [2, 5]), { 9: 38, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 42: $Vk, 45: $Vl, 48: $Vm, 49: $Vn, 50: $Vo, 51: $Vp, 54: $Vq }, o($Vr, [2, 7]), o($Vr, [2, 8]), o($Vr, [2, 9]), o($Vr, [2, 10]), o($Vr, [2, 11]), o($Vr, [2, 12], { 14: [1, 39], 15: [1, 40] }), o($Vr, [2, 16]), { 18: [1, 41] }, o($Vr, [2, 18], { 20: [1, 42] }), { 23: [1, 43] }, o($Vr, [2, 22]), o($Vr, [2, 23]), o($Vr, [2, 24]), o($Vr, [2, 25]), { 30: 44, 31: [1, 45], 56: [1, 46], 57: [1, 47] }, o($Vr, [2, 28]), { 34: [1, 48] }, { 36: [1, 49] }, o($Vr, [2, 31]), { 39: [1, 50], 41: [1, 51] }, { 43: [1, 52] }, { 46: [1, 53] }, o($Vs, [2, 42], { 55: [1, 54] }), o($Vs, [2, 43], { 55: [1, 55] }), o($Vr, [2, 36]), o($Vr, [2, 37]), o($Vr, [2, 38]), o($Vr, [2, 39]), o($Vr, [2, 6]), o($Vr, [2, 13]), { 13: 56, 24: $Va, 54: $Vq }, o($Vr, [2, 17]), o($Vt, $V3, { 7: 57 }), { 24: [1, 58] }, { 24: [1, 59] }, { 23: [1, 60] }, { 24: [2, 46] }, { 24: [2, 47] }, o($Vr, [2, 29]), o($Vr, [2, 30]), { 40: [1, 61] }, { 40: [1, 62] }, { 44: [1, 63] }, { 47: [1, 64] }, { 24: [1, 65] }, { 24: [1, 66] }, o($Vr, [2, 14], { 14: [1, 67] }), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 21: [1, 68], 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 42: $Vk, 45: $Vl, 48: $Vm, 49: $Vn, 50: $Vo, 51: $Vp, 54: $Vq }, o($Vr, [2, 20], { 20: [1, 69] }), { 31: [1, 70] }, { 24: [1, 71] }, o($Vr, [2, 32]), o($Vr, [2, 33]), o($Vr, [2, 34]), o($Vr, [2, 35]), o($Vs, [2, 44]), o($Vs, [2, 45]), o($Vr, [2, 15]), o($Vr, [2, 19]), o($Vt, $V3, { 7: 72 }), o($Vr, [2, 26]), o($Vr, [2, 27]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 21: [1, 73], 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 42: $Vk, 45: $Vl, 48: $Vm, 49: $Vn, 50: $Vo, 51: $Vp, 54: $Vq }, o($Vr, [2, 21])],
131
+ defaultActions: { 5: [2, 1], 6: [2, 2], 46: [2, 46], 47: [2, 47] },
132
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
133
+ if (hash.recoverable) {
134
+ this.trace(str);
135
+ } else {
136
+ var error = new Error(str);
137
+ error.hash = hash;
138
+ throw error;
139
+ }
140
+ }, "parseError"),
141
+ parse: /* @__PURE__ */ __name(function parse(input) {
142
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
143
+ var args = lstack.slice.call(arguments, 1);
144
+ var lexer2 = Object.create(this.lexer);
145
+ var sharedState = { yy: {} };
146
+ for (var k in this.yy) {
147
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
148
+ sharedState.yy[k] = this.yy[k];
149
+ }
150
+ }
151
+ lexer2.setInput(input, sharedState.yy);
152
+ sharedState.yy.lexer = lexer2;
153
+ sharedState.yy.parser = this;
154
+ if (typeof lexer2.yylloc == "undefined") {
155
+ lexer2.yylloc = {};
156
+ }
157
+ var yyloc = lexer2.yylloc;
158
+ lstack.push(yyloc);
159
+ var ranges = lexer2.options && lexer2.options.ranges;
160
+ if (typeof sharedState.yy.parseError === "function") {
161
+ this.parseError = sharedState.yy.parseError;
162
+ } else {
163
+ this.parseError = Object.getPrototypeOf(this).parseError;
164
+ }
165
+ function popStack(n) {
166
+ stack.length = stack.length - 2 * n;
167
+ vstack.length = vstack.length - n;
168
+ lstack.length = lstack.length - n;
169
+ }
170
+ __name(popStack, "popStack");
171
+ function lex() {
172
+ var token;
173
+ token = tstack.pop() || lexer2.lex() || EOF;
174
+ if (typeof token !== "number") {
175
+ if (token instanceof Array) {
176
+ tstack = token;
177
+ token = tstack.pop();
178
+ }
179
+ token = self.symbols_[token] || token;
180
+ }
181
+ return token;
182
+ }
183
+ __name(lex, "lex");
184
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
185
+ while (true) {
186
+ state = stack[stack.length - 1];
187
+ if (this.defaultActions[state]) {
188
+ action = this.defaultActions[state];
189
+ } else {
190
+ if (symbol === null || typeof symbol == "undefined") {
191
+ symbol = lex();
192
+ }
193
+ action = table[state] && table[state][symbol];
194
+ }
195
+ if (typeof action === "undefined" || !action.length || !action[0]) {
196
+ var errStr = "";
197
+ expected = [];
198
+ for (p in table[state]) {
199
+ if (this.terminals_[p] && p > TERROR) {
200
+ expected.push("'" + this.terminals_[p] + "'");
201
+ }
202
+ }
203
+ if (lexer2.showPosition) {
204
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
205
+ } else {
206
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
207
+ }
208
+ this.parseError(errStr, {
209
+ text: lexer2.match,
210
+ token: this.terminals_[symbol] || symbol,
211
+ line: lexer2.yylineno,
212
+ loc: yyloc,
213
+ expected
214
+ });
215
+ }
216
+ if (action[0] instanceof Array && action.length > 1) {
217
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
218
+ }
219
+ switch (action[0]) {
220
+ case 1:
221
+ stack.push(symbol);
222
+ vstack.push(lexer2.yytext);
223
+ lstack.push(lexer2.yylloc);
224
+ stack.push(action[1]);
225
+ symbol = null;
226
+ {
227
+ yyleng = lexer2.yyleng;
228
+ yytext = lexer2.yytext;
229
+ yylineno = lexer2.yylineno;
230
+ yyloc = lexer2.yylloc;
231
+ }
232
+ break;
233
+ case 2:
234
+ len = this.productions_[action[1]][1];
235
+ yyval.$ = vstack[vstack.length - len];
236
+ yyval._$ = {
237
+ first_line: lstack[lstack.length - (len || 1)].first_line,
238
+ last_line: lstack[lstack.length - 1].last_line,
239
+ first_column: lstack[lstack.length - (len || 1)].first_column,
240
+ last_column: lstack[lstack.length - 1].last_column
241
+ };
242
+ if (ranges) {
243
+ yyval._$.range = [
244
+ lstack[lstack.length - (len || 1)].range[0],
245
+ lstack[lstack.length - 1].range[1]
246
+ ];
247
+ }
248
+ r = this.performAction.apply(yyval, [
249
+ yytext,
250
+ yyleng,
251
+ yylineno,
252
+ sharedState.yy,
253
+ action[1],
254
+ vstack,
255
+ lstack
256
+ ].concat(args));
257
+ if (typeof r !== "undefined") {
258
+ return r;
259
+ }
260
+ if (len) {
261
+ stack = stack.slice(0, -1 * len * 2);
262
+ vstack = vstack.slice(0, -1 * len);
263
+ lstack = lstack.slice(0, -1 * len);
264
+ }
265
+ stack.push(this.productions_[action[1]][0]);
266
+ vstack.push(yyval.$);
267
+ lstack.push(yyval._$);
268
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
269
+ stack.push(newState);
270
+ break;
271
+ case 3:
272
+ return true;
273
+ }
274
+ }
275
+ return true;
276
+ }, "parse")
277
+ };
278
+ var lexer = /* @__PURE__ */ function() {
279
+ var lexer2 = {
280
+ EOF: 1,
281
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
282
+ if (this.yy.parser) {
283
+ this.yy.parser.parseError(str, hash);
284
+ } else {
285
+ throw new Error(str);
286
+ }
287
+ }, "parseError"),
288
+ // resets the lexer, sets new input
289
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
290
+ this.yy = yy || this.yy || {};
291
+ this._input = input;
292
+ this._more = this._backtrack = this.done = false;
293
+ this.yylineno = this.yyleng = 0;
294
+ this.yytext = this.matched = this.match = "";
295
+ this.conditionStack = ["INITIAL"];
296
+ this.yylloc = {
297
+ first_line: 1,
298
+ first_column: 0,
299
+ last_line: 1,
300
+ last_column: 0
301
+ };
302
+ if (this.options.ranges) {
303
+ this.yylloc.range = [0, 0];
304
+ }
305
+ this.offset = 0;
306
+ return this;
307
+ }, "setInput"),
308
+ // consumes and returns one char from the input
309
+ input: /* @__PURE__ */ __name(function() {
310
+ var ch = this._input[0];
311
+ this.yytext += ch;
312
+ this.yyleng++;
313
+ this.offset++;
314
+ this.match += ch;
315
+ this.matched += ch;
316
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
317
+ if (lines) {
318
+ this.yylineno++;
319
+ this.yylloc.last_line++;
320
+ } else {
321
+ this.yylloc.last_column++;
322
+ }
323
+ if (this.options.ranges) {
324
+ this.yylloc.range[1]++;
325
+ }
326
+ this._input = this._input.slice(1);
327
+ return ch;
328
+ }, "input"),
329
+ // unshifts one char (or a string) into the input
330
+ unput: /* @__PURE__ */ __name(function(ch) {
331
+ var len = ch.length;
332
+ var lines = ch.split(/(?:\r\n?|\n)/g);
333
+ this._input = ch + this._input;
334
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
335
+ this.offset -= len;
336
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
337
+ this.match = this.match.substr(0, this.match.length - 1);
338
+ this.matched = this.matched.substr(0, this.matched.length - 1);
339
+ if (lines.length - 1) {
340
+ this.yylineno -= lines.length - 1;
341
+ }
342
+ var r = this.yylloc.range;
343
+ this.yylloc = {
344
+ first_line: this.yylloc.first_line,
345
+ last_line: this.yylineno + 1,
346
+ first_column: this.yylloc.first_column,
347
+ 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
348
+ };
349
+ if (this.options.ranges) {
350
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
351
+ }
352
+ this.yyleng = this.yytext.length;
353
+ return this;
354
+ }, "unput"),
355
+ // When called from action, caches matched text and appends it on next action
356
+ more: /* @__PURE__ */ __name(function() {
357
+ this._more = true;
358
+ return this;
359
+ }, "more"),
360
+ // 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.
361
+ reject: /* @__PURE__ */ __name(function() {
362
+ if (this.options.backtrack_lexer) {
363
+ this._backtrack = true;
364
+ } else {
365
+ 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(), {
366
+ text: "",
367
+ token: null,
368
+ line: this.yylineno
369
+ });
370
+ }
371
+ return this;
372
+ }, "reject"),
373
+ // retain first n characters of the match
374
+ less: /* @__PURE__ */ __name(function(n) {
375
+ this.unput(this.match.slice(n));
376
+ }, "less"),
377
+ // displays already matched input, i.e. for error messages
378
+ pastInput: /* @__PURE__ */ __name(function() {
379
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
380
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
381
+ }, "pastInput"),
382
+ // displays upcoming input, i.e. for error messages
383
+ upcomingInput: /* @__PURE__ */ __name(function() {
384
+ var next = this.match;
385
+ if (next.length < 20) {
386
+ next += this._input.substr(0, 20 - next.length);
387
+ }
388
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
389
+ }, "upcomingInput"),
390
+ // displays the character position where the lexing error occurred, i.e. for error messages
391
+ showPosition: /* @__PURE__ */ __name(function() {
392
+ var pre = this.pastInput();
393
+ var c = new Array(pre.length + 1).join("-");
394
+ return pre + this.upcomingInput() + "\n" + c + "^";
395
+ }, "showPosition"),
396
+ // test the lexed token: return FALSE when not a match, otherwise return token
397
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
398
+ var token, lines, backup;
399
+ if (this.options.backtrack_lexer) {
400
+ backup = {
401
+ yylineno: this.yylineno,
402
+ yylloc: {
403
+ first_line: this.yylloc.first_line,
404
+ last_line: this.last_line,
405
+ first_column: this.yylloc.first_column,
406
+ last_column: this.yylloc.last_column
407
+ },
408
+ yytext: this.yytext,
409
+ match: this.match,
410
+ matches: this.matches,
411
+ matched: this.matched,
412
+ yyleng: this.yyleng,
413
+ offset: this.offset,
414
+ _more: this._more,
415
+ _input: this._input,
416
+ yy: this.yy,
417
+ conditionStack: this.conditionStack.slice(0),
418
+ done: this.done
419
+ };
420
+ if (this.options.ranges) {
421
+ backup.yylloc.range = this.yylloc.range.slice(0);
422
+ }
423
+ }
424
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
425
+ if (lines) {
426
+ this.yylineno += lines.length;
427
+ }
428
+ this.yylloc = {
429
+ first_line: this.yylloc.last_line,
430
+ last_line: this.yylineno + 1,
431
+ first_column: this.yylloc.last_column,
432
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
433
+ };
434
+ this.yytext += match[0];
435
+ this.match += match[0];
436
+ this.matches = match;
437
+ this.yyleng = this.yytext.length;
438
+ if (this.options.ranges) {
439
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
440
+ }
441
+ this._more = false;
442
+ this._backtrack = false;
443
+ this._input = this._input.slice(match[0].length);
444
+ this.matched += match[0];
445
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
446
+ if (this.done && this._input) {
447
+ this.done = false;
448
+ }
449
+ if (token) {
450
+ return token;
451
+ } else if (this._backtrack) {
452
+ for (var k in backup) {
453
+ this[k] = backup[k];
454
+ }
455
+ return false;
456
+ }
457
+ return false;
458
+ }, "test_match"),
459
+ // return next match in input
460
+ next: /* @__PURE__ */ __name(function() {
461
+ if (this.done) {
462
+ return this.EOF;
463
+ }
464
+ if (!this._input) {
465
+ this.done = true;
466
+ }
467
+ var token, match, tempMatch, index;
468
+ if (!this._more) {
469
+ this.yytext = "";
470
+ this.match = "";
471
+ }
472
+ var rules = this._currentRules();
473
+ for (var i = 0; i < rules.length; i++) {
474
+ tempMatch = this._input.match(this.rules[rules[i]]);
475
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
476
+ match = tempMatch;
477
+ index = i;
478
+ if (this.options.backtrack_lexer) {
479
+ token = this.test_match(tempMatch, rules[i]);
480
+ if (token !== false) {
481
+ return token;
482
+ } else if (this._backtrack) {
483
+ match = false;
484
+ continue;
485
+ } else {
486
+ return false;
487
+ }
488
+ } else if (!this.options.flex) {
489
+ break;
490
+ }
491
+ }
492
+ }
493
+ if (match) {
494
+ token = this.test_match(match, rules[index]);
495
+ if (token !== false) {
496
+ return token;
497
+ }
498
+ return false;
499
+ }
500
+ if (this._input === "") {
501
+ return this.EOF;
502
+ } else {
503
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
504
+ text: "",
505
+ token: null,
506
+ line: this.yylineno
507
+ });
508
+ }
509
+ }, "next"),
510
+ // return next match that has a token
511
+ lex: /* @__PURE__ */ __name(function lex() {
512
+ var r = this.next();
513
+ if (r) {
514
+ return r;
515
+ } else {
516
+ return this.lex();
517
+ }
518
+ }, "lex"),
519
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
520
+ begin: /* @__PURE__ */ __name(function begin(condition) {
521
+ this.conditionStack.push(condition);
522
+ }, "begin"),
523
+ // pop the previously active lexer condition state off the condition stack
524
+ popState: /* @__PURE__ */ __name(function popState() {
525
+ var n = this.conditionStack.length - 1;
526
+ if (n > 0) {
527
+ return this.conditionStack.pop();
528
+ } else {
529
+ return this.conditionStack[0];
530
+ }
531
+ }, "popState"),
532
+ // produce the lexer rule set which is active for the currently active lexer condition state
533
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
534
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
535
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
536
+ } else {
537
+ return this.conditions["INITIAL"].rules;
538
+ }
539
+ }, "_currentRules"),
540
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
541
+ topState: /* @__PURE__ */ __name(function topState(n) {
542
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
543
+ if (n >= 0) {
544
+ return this.conditionStack[n];
545
+ } else {
546
+ return "INITIAL";
547
+ }
548
+ }, "topState"),
549
+ // alias for begin(condition)
550
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
551
+ this.begin(condition);
552
+ }, "pushState"),
553
+ // return the number of states currently on the stack
554
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
555
+ return this.conditionStack.length;
556
+ }, "stateStackSize"),
557
+ options: { "case-insensitive": true },
558
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
559
+ switch ($avoiding_name_collisions) {
560
+ case 0:
561
+ return 41;
562
+ case 1:
563
+ return 48;
564
+ case 2:
565
+ return 49;
566
+ case 3:
567
+ return 50;
568
+ case 4:
569
+ return 51;
570
+ case 5:
571
+ break;
572
+ case 6:
573
+ break;
574
+ case 7:
575
+ return 5;
576
+ case 8:
577
+ break;
578
+ case 9:
579
+ break;
580
+ case 10:
581
+ break;
582
+ case 11:
583
+ break;
584
+ case 12:
585
+ this.pushState("SCALE");
586
+ return 17;
587
+ case 13:
588
+ return 18;
589
+ case 14:
590
+ this.popState();
591
+ break;
592
+ case 15:
593
+ this.begin("acc_title");
594
+ return 33;
595
+ case 16:
596
+ this.popState();
597
+ return "acc_title_value";
598
+ case 17:
599
+ this.begin("acc_descr");
600
+ return 35;
601
+ case 18:
602
+ this.popState();
603
+ return "acc_descr_value";
604
+ case 19:
605
+ this.begin("acc_descr_multiline");
606
+ break;
607
+ case 20:
608
+ this.popState();
609
+ break;
610
+ case 21:
611
+ return "acc_descr_multiline_value";
612
+ case 22:
613
+ this.pushState("CLASSDEF");
614
+ return 38;
615
+ case 23:
616
+ this.popState();
617
+ this.pushState("CLASSDEFID");
618
+ return "DEFAULT_CLASSDEF_ID";
619
+ case 24:
620
+ this.popState();
621
+ this.pushState("CLASSDEFID");
622
+ return 39;
623
+ case 25:
624
+ this.popState();
625
+ return 40;
626
+ case 26:
627
+ this.pushState("CLASS");
628
+ return 45;
629
+ case 27:
630
+ this.popState();
631
+ this.pushState("CLASS_STYLE");
632
+ return 46;
633
+ case 28:
634
+ this.popState();
635
+ return 47;
636
+ case 29:
637
+ this.pushState("STYLE");
638
+ return 42;
639
+ case 30:
640
+ this.popState();
641
+ this.pushState("STYLEDEF_STYLES");
642
+ return 43;
643
+ case 31:
644
+ this.popState();
645
+ return 44;
646
+ case 32:
647
+ this.pushState("SCALE");
648
+ return 17;
649
+ case 33:
650
+ return 18;
651
+ case 34:
652
+ this.popState();
653
+ break;
654
+ case 35:
655
+ this.pushState("STATE");
656
+ break;
657
+ case 36:
658
+ this.popState();
659
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
660
+ return 25;
661
+ case 37:
662
+ this.popState();
663
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
664
+ return 26;
665
+ case 38:
666
+ this.popState();
667
+ yy_.yytext = yy_.yytext.slice(0, -10).trim();
668
+ return 27;
669
+ case 39:
670
+ this.popState();
671
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
672
+ return 25;
673
+ case 40:
674
+ this.popState();
675
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
676
+ return 26;
677
+ case 41:
678
+ this.popState();
679
+ yy_.yytext = yy_.yytext.slice(0, -10).trim();
680
+ return 27;
681
+ case 42:
682
+ return 48;
683
+ case 43:
684
+ return 49;
685
+ case 44:
686
+ return 50;
687
+ case 45:
688
+ return 51;
689
+ case 46:
690
+ this.pushState("STATE_STRING");
691
+ break;
692
+ case 47:
693
+ this.pushState("STATE_ID");
694
+ return "AS";
695
+ case 48:
696
+ this.popState();
697
+ return "ID";
698
+ case 49:
699
+ this.popState();
700
+ break;
701
+ case 50:
702
+ return "STATE_DESCR";
703
+ case 51:
704
+ return 19;
705
+ case 52:
706
+ this.popState();
707
+ break;
708
+ case 53:
709
+ this.popState();
710
+ this.pushState("struct");
711
+ return 20;
712
+ case 54:
713
+ break;
714
+ case 55:
715
+ this.popState();
716
+ return 21;
717
+ case 56:
718
+ break;
719
+ case 57:
720
+ this.begin("NOTE");
721
+ return 29;
722
+ case 58:
723
+ this.popState();
724
+ this.pushState("NOTE_ID");
725
+ return 56;
726
+ case 59:
727
+ this.popState();
728
+ this.pushState("NOTE_ID");
729
+ return 57;
730
+ case 60:
731
+ this.popState();
732
+ this.pushState("FLOATING_NOTE");
733
+ break;
734
+ case 61:
735
+ this.popState();
736
+ this.pushState("FLOATING_NOTE_ID");
737
+ return "AS";
738
+ case 62:
739
+ break;
740
+ case 63:
741
+ return "NOTE_TEXT";
742
+ case 64:
743
+ this.popState();
744
+ return "ID";
745
+ case 65:
746
+ this.popState();
747
+ this.pushState("NOTE_TEXT");
748
+ return 24;
749
+ case 66:
750
+ this.popState();
751
+ yy_.yytext = yy_.yytext.substr(2).trim();
752
+ return 31;
753
+ case 67:
754
+ this.popState();
755
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
756
+ return 31;
757
+ case 68:
758
+ return 6;
759
+ case 69:
760
+ return 6;
761
+ case 70:
762
+ return 16;
763
+ case 71:
764
+ return 54;
765
+ case 72:
766
+ return 24;
767
+ case 73:
768
+ yy_.yytext = yy_.yytext.trim();
769
+ return 14;
770
+ case 74:
771
+ return 15;
772
+ case 75:
773
+ return 28;
774
+ case 76:
775
+ return 55;
776
+ case 77:
777
+ return 5;
778
+ case 78:
779
+ return "INVALID";
780
+ }
781
+ }, "anonymous"),
782
+ rules: [/^(?:default\b)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:classDef\s+)/i, /^(?:DEFAULT\s+)/i, /^(?:\w+\s+)/i, /^(?:[^\n]*)/i, /^(?:class\s+)/i, /^(?:(\w+)+((,\s*\w+)*))/i, /^(?:[^\n]*)/i, /^(?:style\s+)/i, /^(?:[\w,]+\s+)/i, /^(?:[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:state\s+)/i, /^(?:.*<<fork>>)/i, /^(?:.*<<join>>)/i, /^(?:.*<<choice>>)/i, /^(?:.*\[\[fork\]\])/i, /^(?:.*\[\[join\]\])/i, /^(?:.*\[\[choice\]\])/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:["])/i, /^(?:\s*as\s+)/i, /^(?:[^\n\{]*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n\s\{]+)/i, /^(?:\n)/i, /^(?:\{)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:\})/i, /^(?:[\n])/i, /^(?:note\s+)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:")/i, /^(?:\s*as\s*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n]*)/i, /^(?:\s*[^:\n\s\-]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:[\s\S]*?end note\b)/i, /^(?:stateDiagram\s+)/i, /^(?:stateDiagram-v2\s+)/i, /^(?:hide empty description\b)/i, /^(?:\[\*\])/i, /^(?:[^:\n\s\-\{]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:-->)/i, /^(?:--)/i, /^(?::::)/i, /^(?:$)/i, /^(?:.)/i],
783
+ conditions: { "LINE": { "rules": [9, 10], "inclusive": false }, "struct": { "rules": [9, 10, 22, 26, 29, 35, 42, 43, 44, 45, 54, 55, 56, 57, 71, 72, 73, 74, 75], "inclusive": false }, "FLOATING_NOTE_ID": { "rules": [64], "inclusive": false }, "FLOATING_NOTE": { "rules": [61, 62, 63], "inclusive": false }, "NOTE_TEXT": { "rules": [66, 67], "inclusive": false }, "NOTE_ID": { "rules": [65], "inclusive": false }, "NOTE": { "rules": [58, 59, 60], "inclusive": false }, "STYLEDEF_STYLEOPTS": { "rules": [], "inclusive": false }, "STYLEDEF_STYLES": { "rules": [31], "inclusive": false }, "STYLE_IDS": { "rules": [], "inclusive": false }, "STYLE": { "rules": [30], "inclusive": false }, "CLASS_STYLE": { "rules": [28], "inclusive": false }, "CLASS": { "rules": [27], "inclusive": false }, "CLASSDEFID": { "rules": [25], "inclusive": false }, "CLASSDEF": { "rules": [23, 24], "inclusive": false }, "acc_descr_multiline": { "rules": [20, 21], "inclusive": false }, "acc_descr": { "rules": [18], "inclusive": false }, "acc_title": { "rules": [16], "inclusive": false }, "SCALE": { "rules": [13, 14, 33, 34], "inclusive": false }, "ALIAS": { "rules": [], "inclusive": false }, "STATE_ID": { "rules": [48], "inclusive": false }, "STATE_STRING": { "rules": [49, 50], "inclusive": false }, "FORK_STATE": { "rules": [], "inclusive": false }, "STATE": { "rules": [9, 10, 36, 37, 38, 39, 40, 41, 46, 47, 51, 52, 53], "inclusive": false }, "ID": { "rules": [9, 10], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 15, 17, 19, 22, 26, 29, 32, 35, 53, 57, 68, 69, 70, 71, 72, 73, 74, 76, 77, 78], "inclusive": true } }
784
+ };
785
+ return lexer2;
786
+ }();
787
+ parser2.lexer = lexer;
788
+ function Parser() {
789
+ this.yy = {};
790
+ }
791
+ __name(Parser, "Parser");
792
+ Parser.prototype = parser2;
793
+ parser2.Parser = Parser;
794
+ return new Parser();
795
+ }();
796
+ parser.parser = parser;
797
+ var stateDiagram_default = parser;
798
+ var DEFAULT_DIAGRAM_DIRECTION = "TB";
799
+ var DEFAULT_NESTED_DOC_DIR = "TB";
800
+ var STMT_DIRECTION = "dir";
801
+ var STMT_STATE = "state";
802
+ var STMT_RELATION = "relation";
803
+ var STMT_CLASSDEF = "classDef";
804
+ var STMT_STYLEDEF = "style";
805
+ var STMT_APPLYCLASS = "applyClass";
806
+ var DEFAULT_STATE_TYPE = "default";
807
+ var DIVIDER_TYPE = "divider";
808
+ var G_EDGE_STYLE = "fill:none";
809
+ var G_EDGE_ARROWHEADSTYLE = "fill: #333";
810
+ var G_EDGE_LABELPOS = "c";
811
+ var G_EDGE_LABELTYPE = "text";
812
+ var G_EDGE_THICKNESS = "normal";
813
+ var SHAPE_STATE = "rect";
814
+ var SHAPE_STATE_WITH_DESC = "rectWithTitle";
815
+ var SHAPE_START = "stateStart";
816
+ var SHAPE_END = "stateEnd";
817
+ var SHAPE_DIVIDER = "divider";
818
+ var SHAPE_GROUP = "roundedWithTitle";
819
+ var SHAPE_NOTE = "note";
820
+ var SHAPE_NOTEGROUP = "noteGroup";
821
+ var CSS_DIAGRAM = "statediagram";
822
+ var CSS_STATE = "state";
823
+ var CSS_DIAGRAM_STATE = `${CSS_DIAGRAM}-${CSS_STATE}`;
824
+ var CSS_EDGE = "transition";
825
+ var CSS_NOTE = "note";
826
+ var CSS_NOTE_EDGE = "note-edge";
827
+ var CSS_EDGE_NOTE_EDGE = `${CSS_EDGE} ${CSS_NOTE_EDGE}`;
828
+ var CSS_DIAGRAM_NOTE = `${CSS_DIAGRAM}-${CSS_NOTE}`;
829
+ var CSS_CLUSTER = "cluster";
830
+ var CSS_DIAGRAM_CLUSTER = `${CSS_DIAGRAM}-${CSS_CLUSTER}`;
831
+ var CSS_CLUSTER_ALT = "cluster-alt";
832
+ var CSS_DIAGRAM_CLUSTER_ALT = `${CSS_DIAGRAM}-${CSS_CLUSTER_ALT}`;
833
+ var PARENT = "parent";
834
+ var NOTE = "note";
835
+ var DOMID_STATE = "state";
836
+ var DOMID_TYPE_SPACER = "----";
837
+ var NOTE_ID = `${DOMID_TYPE_SPACER}${NOTE}`;
838
+ var PARENT_ID = `${DOMID_TYPE_SPACER}${PARENT}`;
839
+ var getDir = /* @__PURE__ */ __name((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
840
+ if (!parsedItem.doc) {
841
+ return defaultDir;
842
+ }
843
+ let dir = defaultDir;
844
+ for (const parsedItemDoc of parsedItem.doc) {
845
+ if (parsedItemDoc.stmt === "dir") {
846
+ dir = parsedItemDoc.value;
847
+ }
848
+ }
849
+ return dir;
850
+ }, "getDir");
851
+ var getClasses = /* @__PURE__ */ __name(function(text, diagramObj) {
852
+ return diagramObj.db.getClasses();
853
+ }, "getClasses");
854
+ var draw = /* @__PURE__ */ __name(async function(text, id, _version, diag) {
855
+ log.info("REF0:");
856
+ log.info("Drawing state diagram (v2)", id);
857
+ const { securityLevel, state: conf, layout } = getConfig2();
858
+ diag.db.extract(diag.db.getRootDocV2());
859
+ const data4Layout = diag.db.getData();
860
+ const svg = getDiagramElement(id, securityLevel);
861
+ data4Layout.type = diag.type;
862
+ data4Layout.layoutAlgorithm = layout;
863
+ data4Layout.nodeSpacing = conf?.nodeSpacing || 50;
864
+ data4Layout.rankSpacing = conf?.rankSpacing || 50;
865
+ data4Layout.markers = ["barb"];
866
+ data4Layout.diagramId = id;
867
+ await render(data4Layout, svg);
868
+ const padding = 8;
869
+ utils_default.insertTitle(
870
+ svg,
871
+ "statediagramTitleText",
872
+ conf?.titleTopMargin ?? 25,
873
+ diag.db.getDiagramTitle()
874
+ );
875
+ setupViewPortForSVG(svg, padding, CSS_DIAGRAM, conf?.useMaxWidth ?? true);
876
+ }, "draw");
877
+ var stateRenderer_v3_unified_default = {
878
+ getClasses,
879
+ draw,
880
+ getDir
881
+ };
882
+ var nodeDb = /* @__PURE__ */ new Map();
883
+ var graphItemCount = 0;
884
+ function stateDomId(itemId = "", counter = 0, type = "", typeSpacer = DOMID_TYPE_SPACER) {
885
+ const typeStr = type !== null && type.length > 0 ? `${typeSpacer}${type}` : "";
886
+ return `${DOMID_STATE}-${itemId}${typeStr}-${counter}`;
887
+ }
888
+ __name(stateDomId, "stateDomId");
889
+ var setupDoc = /* @__PURE__ */ __name((parentParsedItem, doc, diagramStates, nodes, edges, altFlag, look, classes) => {
890
+ log.trace("items", doc);
891
+ doc.forEach((item) => {
892
+ switch (item.stmt) {
893
+ case STMT_STATE:
894
+ dataFetcher(parentParsedItem, item, diagramStates, nodes, edges, altFlag, look, classes);
895
+ break;
896
+ case DEFAULT_STATE_TYPE:
897
+ dataFetcher(parentParsedItem, item, diagramStates, nodes, edges, altFlag, look, classes);
898
+ break;
899
+ case STMT_RELATION:
900
+ {
901
+ dataFetcher(
902
+ parentParsedItem,
903
+ item.state1,
904
+ diagramStates,
905
+ nodes,
906
+ edges,
907
+ altFlag,
908
+ look,
909
+ classes
910
+ );
911
+ dataFetcher(
912
+ parentParsedItem,
913
+ item.state2,
914
+ diagramStates,
915
+ nodes,
916
+ edges,
917
+ altFlag,
918
+ look,
919
+ classes
920
+ );
921
+ const edgeData = {
922
+ id: "edge" + graphItemCount,
923
+ start: item.state1.id,
924
+ end: item.state2.id,
925
+ arrowhead: "normal",
926
+ arrowTypeEnd: "arrow_barb",
927
+ style: G_EDGE_STYLE,
928
+ labelStyle: "",
929
+ label: common_default.sanitizeText(item.description, getConfig2()),
930
+ arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
931
+ labelpos: G_EDGE_LABELPOS,
932
+ labelType: G_EDGE_LABELTYPE,
933
+ thickness: G_EDGE_THICKNESS,
934
+ classes: CSS_EDGE,
935
+ look
936
+ };
937
+ edges.push(edgeData);
938
+ graphItemCount++;
939
+ }
940
+ break;
941
+ }
942
+ });
943
+ }, "setupDoc");
944
+ var getDir2 = /* @__PURE__ */ __name((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
945
+ let dir = defaultDir;
946
+ if (parsedItem.doc) {
947
+ for (const parsedItemDoc of parsedItem.doc) {
948
+ if (parsedItemDoc.stmt === "dir") {
949
+ dir = parsedItemDoc.value;
950
+ }
951
+ }
952
+ }
953
+ return dir;
954
+ }, "getDir");
955
+ function insertOrUpdateNode(nodes, nodeData, classes) {
956
+ if (!nodeData.id || nodeData.id === "</join></fork>" || nodeData.id === "</choice>") {
957
+ return;
958
+ }
959
+ if (nodeData.cssClasses) {
960
+ if (!Array.isArray(nodeData.cssCompiledStyles)) {
961
+ nodeData.cssCompiledStyles = [];
962
+ }
963
+ nodeData.cssClasses.split(" ").forEach((cssClass) => {
964
+ if (classes.get(cssClass)) {
965
+ const classDef = classes.get(cssClass);
966
+ nodeData.cssCompiledStyles = [...nodeData.cssCompiledStyles, ...classDef.styles];
967
+ }
968
+ });
969
+ }
970
+ const existingNodeData = nodes.find((node) => node.id === nodeData.id);
971
+ if (existingNodeData) {
972
+ Object.assign(existingNodeData, nodeData);
973
+ } else {
974
+ nodes.push(nodeData);
975
+ }
976
+ }
977
+ __name(insertOrUpdateNode, "insertOrUpdateNode");
978
+ function getClassesFromDbInfo(dbInfoItem) {
979
+ return dbInfoItem?.classes?.join(" ") ?? "";
980
+ }
981
+ __name(getClassesFromDbInfo, "getClassesFromDbInfo");
982
+ function getStylesFromDbInfo(dbInfoItem) {
983
+ return dbInfoItem?.styles ?? [];
984
+ }
985
+ __name(getStylesFromDbInfo, "getStylesFromDbInfo");
986
+ var dataFetcher = /* @__PURE__ */ __name((parent, parsedItem, diagramStates, nodes, edges, altFlag, look, classes) => {
987
+ const itemId = parsedItem.id;
988
+ const dbState = diagramStates.get(itemId);
989
+ const classStr = getClassesFromDbInfo(dbState);
990
+ const style = getStylesFromDbInfo(dbState);
991
+ log.info("dataFetcher parsedItem", parsedItem, dbState, style);
992
+ if (itemId !== "root") {
993
+ let shape = SHAPE_STATE;
994
+ if (parsedItem.start === true) {
995
+ shape = SHAPE_START;
996
+ } else if (parsedItem.start === false) {
997
+ shape = SHAPE_END;
998
+ }
999
+ if (parsedItem.type !== DEFAULT_STATE_TYPE) {
1000
+ shape = parsedItem.type;
1001
+ }
1002
+ if (!nodeDb.get(itemId)) {
1003
+ nodeDb.set(itemId, {
1004
+ id: itemId,
1005
+ shape,
1006
+ description: common_default.sanitizeText(itemId, getConfig2()),
1007
+ cssClasses: `${classStr} ${CSS_DIAGRAM_STATE}`,
1008
+ cssStyles: style
1009
+ });
1010
+ }
1011
+ const newNode = nodeDb.get(itemId);
1012
+ if (parsedItem.description) {
1013
+ if (Array.isArray(newNode.description)) {
1014
+ newNode.shape = SHAPE_STATE_WITH_DESC;
1015
+ newNode.description.push(parsedItem.description);
1016
+ } else {
1017
+ if (newNode.description?.length > 0) {
1018
+ newNode.shape = SHAPE_STATE_WITH_DESC;
1019
+ if (newNode.description === itemId) {
1020
+ newNode.description = [parsedItem.description];
1021
+ } else {
1022
+ newNode.description = [newNode.description, parsedItem.description];
1023
+ }
1024
+ } else {
1025
+ newNode.shape = SHAPE_STATE;
1026
+ newNode.description = parsedItem.description;
1027
+ }
1028
+ }
1029
+ newNode.description = common_default.sanitizeTextOrArray(newNode.description, getConfig2());
1030
+ }
1031
+ if (newNode.description?.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) {
1032
+ if (newNode.type === "group") {
1033
+ newNode.shape = SHAPE_GROUP;
1034
+ } else {
1035
+ newNode.shape = SHAPE_STATE;
1036
+ }
1037
+ }
1038
+ if (!newNode.type && parsedItem.doc) {
1039
+ log.info("Setting cluster for XCX", itemId, getDir2(parsedItem));
1040
+ newNode.type = "group";
1041
+ newNode.isGroup = true;
1042
+ newNode.dir = getDir2(parsedItem);
1043
+ newNode.shape = parsedItem.type === DIVIDER_TYPE ? SHAPE_DIVIDER : SHAPE_GROUP;
1044
+ newNode.cssClasses = `${newNode.cssClasses} ${CSS_DIAGRAM_CLUSTER} ${altFlag ? CSS_DIAGRAM_CLUSTER_ALT : ""}`;
1045
+ }
1046
+ const nodeData = {
1047
+ labelStyle: "",
1048
+ shape: newNode.shape,
1049
+ label: newNode.description,
1050
+ cssClasses: newNode.cssClasses,
1051
+ cssCompiledStyles: [],
1052
+ cssStyles: newNode.cssStyles,
1053
+ id: itemId,
1054
+ dir: newNode.dir,
1055
+ domId: stateDomId(itemId, graphItemCount),
1056
+ type: newNode.type,
1057
+ isGroup: newNode.type === "group",
1058
+ padding: 8,
1059
+ rx: 10,
1060
+ ry: 10,
1061
+ look
1062
+ };
1063
+ if (nodeData.shape === SHAPE_DIVIDER) {
1064
+ nodeData.label = "";
1065
+ }
1066
+ if (parent && parent.id !== "root") {
1067
+ log.trace("Setting node ", itemId, " to be child of its parent ", parent.id);
1068
+ nodeData.parentId = parent.id;
1069
+ }
1070
+ nodeData.centerLabel = true;
1071
+ if (parsedItem.note) {
1072
+ const noteData = {
1073
+ labelStyle: "",
1074
+ shape: SHAPE_NOTE,
1075
+ label: parsedItem.note.text,
1076
+ cssClasses: CSS_DIAGRAM_NOTE,
1077
+ // useHtmlLabels: false,
1078
+ cssStyles: [],
1079
+ cssCompilesStyles: [],
1080
+ id: itemId + NOTE_ID + "-" + graphItemCount,
1081
+ domId: stateDomId(itemId, graphItemCount, NOTE),
1082
+ type: newNode.type,
1083
+ isGroup: newNode.type === "group",
1084
+ padding: getConfig2().flowchart.padding,
1085
+ look,
1086
+ position: parsedItem.note.position
1087
+ };
1088
+ const parentNodeId = itemId + PARENT_ID;
1089
+ const groupData = {
1090
+ labelStyle: "",
1091
+ shape: SHAPE_NOTEGROUP,
1092
+ label: parsedItem.note.text,
1093
+ cssClasses: newNode.cssClasses,
1094
+ cssStyles: [],
1095
+ id: itemId + PARENT_ID,
1096
+ domId: stateDomId(itemId, graphItemCount, PARENT),
1097
+ type: "group",
1098
+ isGroup: true,
1099
+ padding: 16,
1100
+ //getConfig().flowchart.padding
1101
+ look,
1102
+ position: parsedItem.note.position
1103
+ };
1104
+ graphItemCount++;
1105
+ groupData.id = parentNodeId;
1106
+ noteData.parentId = parentNodeId;
1107
+ insertOrUpdateNode(nodes, groupData, classes);
1108
+ insertOrUpdateNode(nodes, noteData, classes);
1109
+ insertOrUpdateNode(nodes, nodeData, classes);
1110
+ let from = itemId;
1111
+ let to = noteData.id;
1112
+ if (parsedItem.note.position === "left of") {
1113
+ from = noteData.id;
1114
+ to = itemId;
1115
+ }
1116
+ edges.push({
1117
+ id: from + "-" + to,
1118
+ start: from,
1119
+ end: to,
1120
+ arrowhead: "none",
1121
+ arrowTypeEnd: "",
1122
+ style: G_EDGE_STYLE,
1123
+ labelStyle: "",
1124
+ classes: CSS_EDGE_NOTE_EDGE,
1125
+ arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
1126
+ labelpos: G_EDGE_LABELPOS,
1127
+ labelType: G_EDGE_LABELTYPE,
1128
+ thickness: G_EDGE_THICKNESS,
1129
+ look
1130
+ });
1131
+ } else {
1132
+ insertOrUpdateNode(nodes, nodeData, classes);
1133
+ }
1134
+ }
1135
+ if (parsedItem.doc) {
1136
+ log.trace("Adding nodes children ");
1137
+ setupDoc(parsedItem, parsedItem.doc, diagramStates, nodes, edges, !altFlag, look, classes);
1138
+ }
1139
+ }, "dataFetcher");
1140
+ var reset = /* @__PURE__ */ __name(() => {
1141
+ nodeDb.clear();
1142
+ graphItemCount = 0;
1143
+ }, "reset");
1144
+ var START_NODE = "[*]";
1145
+ var START_TYPE = "start";
1146
+ var END_NODE = START_NODE;
1147
+ var END_TYPE = "end";
1148
+ var COLOR_KEYWORD = "color";
1149
+ var FILL_KEYWORD = "fill";
1150
+ var BG_FILL = "bgFill";
1151
+ var STYLECLASS_SEP = ",";
1152
+ function newClassesList() {
1153
+ return /* @__PURE__ */ new Map();
1154
+ }
1155
+ __name(newClassesList, "newClassesList");
1156
+ var newDoc = /* @__PURE__ */ __name(() => {
1157
+ return {
1158
+ /** @type {{ id1: string, id2: string, relationTitle: string }[]} */
1159
+ relations: [],
1160
+ states: /* @__PURE__ */ new Map(),
1161
+ documents: {}
1162
+ };
1163
+ }, "newDoc");
1164
+ var clone = /* @__PURE__ */ __name((o) => JSON.parse(JSON.stringify(o)), "clone");
1165
+ var StateDB = class {
1166
+ static {
1167
+ __name(this, "StateDB");
1168
+ }
1169
+ /**
1170
+ * @param {1 | 2} version - v1 renderer or v2 renderer.
1171
+ */
1172
+ constructor(version) {
1173
+ this.clear();
1174
+ this.version = version;
1175
+ this.setRootDoc = this.setRootDoc.bind(this);
1176
+ this.getDividerId = this.getDividerId.bind(this);
1177
+ this.setDirection = this.setDirection.bind(this);
1178
+ this.trimColon = this.trimColon.bind(this);
1179
+ }
1180
+ /**
1181
+ * @private
1182
+ * @type {1 | 2}
1183
+ */
1184
+ version;
1185
+ /**
1186
+ * @private
1187
+ * @type {Array}
1188
+ */
1189
+ nodes = [];
1190
+ /**
1191
+ * @private
1192
+ * @type {Array}
1193
+ */
1194
+ edges = [];
1195
+ /**
1196
+ * @private
1197
+ * @type {Array}
1198
+ */
1199
+ rootDoc = [];
1200
+ /**
1201
+ * @private
1202
+ * @type {Map<string, any>}
1203
+ */
1204
+ classes = newClassesList();
1205
+ // style classes defined by a classDef
1206
+ /**
1207
+ * @private
1208
+ * @type {Object}
1209
+ */
1210
+ documents = {
1211
+ root: newDoc()
1212
+ };
1213
+ /**
1214
+ * @private
1215
+ * @type {Object}
1216
+ */
1217
+ currentDocument = this.documents.root;
1218
+ /**
1219
+ * @private
1220
+ * @type {number}
1221
+ */
1222
+ startEndCount = 0;
1223
+ /**
1224
+ * @private
1225
+ * @type {number}
1226
+ */
1227
+ dividerCnt = 0;
1228
+ static relationType = {
1229
+ AGGREGATION: 0,
1230
+ EXTENSION: 1,
1231
+ COMPOSITION: 2,
1232
+ DEPENDENCY: 3
1233
+ };
1234
+ setRootDoc(o) {
1235
+ log.info("Setting root doc", o);
1236
+ this.rootDoc = o;
1237
+ if (this.version === 1) {
1238
+ this.extract(o);
1239
+ } else {
1240
+ this.extract(this.getRootDocV2());
1241
+ }
1242
+ }
1243
+ getRootDoc() {
1244
+ return this.rootDoc;
1245
+ }
1246
+ /**
1247
+ * @private
1248
+ * @param {Object} parent
1249
+ * @param {Object} node
1250
+ * @param {boolean} first
1251
+ */
1252
+ docTranslator(parent, node, first) {
1253
+ if (node.stmt === STMT_RELATION) {
1254
+ this.docTranslator(parent, node.state1, true);
1255
+ this.docTranslator(parent, node.state2, false);
1256
+ } else {
1257
+ if (node.stmt === STMT_STATE) {
1258
+ if (node.id === "[*]") {
1259
+ node.id = first ? parent.id + "_start" : parent.id + "_end";
1260
+ node.start = first;
1261
+ } else {
1262
+ node.id = node.id.trim();
1263
+ }
1264
+ }
1265
+ if (node.doc) {
1266
+ const doc = [];
1267
+ let currentDoc = [];
1268
+ let i;
1269
+ for (i = 0; i < node.doc.length; i++) {
1270
+ if (node.doc[i].type === DIVIDER_TYPE) {
1271
+ const newNode = clone(node.doc[i]);
1272
+ newNode.doc = clone(currentDoc);
1273
+ doc.push(newNode);
1274
+ currentDoc = [];
1275
+ } else {
1276
+ currentDoc.push(node.doc[i]);
1277
+ }
1278
+ }
1279
+ if (doc.length > 0 && currentDoc.length > 0) {
1280
+ const newNode = {
1281
+ stmt: STMT_STATE,
1282
+ id: generateId(),
1283
+ type: "divider",
1284
+ doc: clone(currentDoc)
1285
+ };
1286
+ doc.push(clone(newNode));
1287
+ node.doc = doc;
1288
+ }
1289
+ node.doc.forEach((docNode) => this.docTranslator(node, docNode, true));
1290
+ }
1291
+ }
1292
+ }
1293
+ /**
1294
+ * @private
1295
+ */
1296
+ getRootDocV2() {
1297
+ this.docTranslator({ id: "root" }, { id: "root", doc: this.rootDoc }, true);
1298
+ return { id: "root", doc: this.rootDoc };
1299
+ }
1300
+ /**
1301
+ * Convert all of the statements (stmts) that were parsed into states and relationships.
1302
+ * This is done because a state diagram may have nested sections,
1303
+ * where each section is a 'document' and has its own set of statements.
1304
+ * Ex: the section within a fork has its own statements, and incoming and outgoing statements
1305
+ * refer to the fork as a whole (document).
1306
+ * See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement.
1307
+ * This will push the statement into the list of statements for the current document.
1308
+ * @private
1309
+ * @param _doc
1310
+ */
1311
+ extract(_doc) {
1312
+ let doc;
1313
+ if (_doc.doc) {
1314
+ doc = _doc.doc;
1315
+ } else {
1316
+ doc = _doc;
1317
+ }
1318
+ log.info(doc);
1319
+ this.clear(true);
1320
+ log.info("Extract initial document:", doc);
1321
+ doc.forEach((item) => {
1322
+ log.warn("Statement", item.stmt);
1323
+ switch (item.stmt) {
1324
+ case STMT_STATE:
1325
+ this.addState(
1326
+ item.id.trim(),
1327
+ item.type,
1328
+ item.doc,
1329
+ item.description,
1330
+ item.note,
1331
+ item.classes,
1332
+ item.styles,
1333
+ item.textStyles
1334
+ );
1335
+ break;
1336
+ case STMT_RELATION:
1337
+ this.addRelation(item.state1, item.state2, item.description);
1338
+ break;
1339
+ case STMT_CLASSDEF:
1340
+ this.addStyleClass(item.id.trim(), item.classes);
1341
+ break;
1342
+ case STMT_STYLEDEF:
1343
+ {
1344
+ const ids = item.id.trim().split(",");
1345
+ const styles = item.styleClass.split(",");
1346
+ ids.forEach((id) => {
1347
+ let foundState = this.getState(id);
1348
+ if (foundState === void 0) {
1349
+ const trimmedId = id.trim();
1350
+ this.addState(trimmedId);
1351
+ foundState = this.getState(trimmedId);
1352
+ }
1353
+ foundState.styles = styles.map((s) => s.replace(/;/g, "")?.trim());
1354
+ });
1355
+ }
1356
+ break;
1357
+ case STMT_APPLYCLASS:
1358
+ this.setCssClass(item.id.trim(), item.styleClass);
1359
+ break;
1360
+ }
1361
+ });
1362
+ const diagramStates = this.getStates();
1363
+ const config = getConfig2();
1364
+ const look = config.look;
1365
+ reset();
1366
+ dataFetcher(
1367
+ void 0,
1368
+ this.getRootDocV2(),
1369
+ diagramStates,
1370
+ this.nodes,
1371
+ this.edges,
1372
+ true,
1373
+ look,
1374
+ this.classes
1375
+ );
1376
+ this.nodes.forEach((node) => {
1377
+ if (Array.isArray(node.label)) {
1378
+ node.description = node.label.slice(1);
1379
+ if (node.isGroup && node.description.length > 0) {
1380
+ throw new Error(
1381
+ "Group nodes can only have label. Remove the additional description for node [" + node.id + "]"
1382
+ );
1383
+ }
1384
+ node.label = node.label[0];
1385
+ }
1386
+ });
1387
+ }
1388
+ /**
1389
+ * Function called by parser when a node definition has been found.
1390
+ *
1391
+ * @param {null | string} id
1392
+ * @param {null | string} type
1393
+ * @param {null | string} doc
1394
+ * @param {null | string | string[]} descr - description for the state. Can be a string or a list or strings
1395
+ * @param {null | string} note
1396
+ * @param {null | string | string[]} classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class.
1397
+ * @param {null | string | string[]} styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style.
1398
+ * @param {null | string | string[]} textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style.
1399
+ */
1400
+ addState(id, type = DEFAULT_STATE_TYPE, doc = null, descr = null, note = null, classes = null, styles = null, textStyles = null) {
1401
+ const trimmedId = id?.trim();
1402
+ if (!this.currentDocument.states.has(trimmedId)) {
1403
+ log.info("Adding state ", trimmedId, descr);
1404
+ this.currentDocument.states.set(trimmedId, {
1405
+ id: trimmedId,
1406
+ descriptions: [],
1407
+ type,
1408
+ doc,
1409
+ note,
1410
+ classes: [],
1411
+ styles: [],
1412
+ textStyles: []
1413
+ });
1414
+ } else {
1415
+ if (!this.currentDocument.states.get(trimmedId).doc) {
1416
+ this.currentDocument.states.get(trimmedId).doc = doc;
1417
+ }
1418
+ if (!this.currentDocument.states.get(trimmedId).type) {
1419
+ this.currentDocument.states.get(trimmedId).type = type;
1420
+ }
1421
+ }
1422
+ if (descr) {
1423
+ log.info("Setting state description", trimmedId, descr);
1424
+ if (typeof descr === "string") {
1425
+ this.addDescription(trimmedId, descr.trim());
1426
+ }
1427
+ if (typeof descr === "object") {
1428
+ descr.forEach((des) => this.addDescription(trimmedId, des.trim()));
1429
+ }
1430
+ }
1431
+ if (note) {
1432
+ const doc2 = this.currentDocument.states.get(trimmedId);
1433
+ doc2.note = note;
1434
+ doc2.note.text = common_default.sanitizeText(doc2.note.text, getConfig2());
1435
+ }
1436
+ if (classes) {
1437
+ log.info("Setting state classes", trimmedId, classes);
1438
+ const classesList = typeof classes === "string" ? [classes] : classes;
1439
+ classesList.forEach((cssClass) => this.setCssClass(trimmedId, cssClass.trim()));
1440
+ }
1441
+ if (styles) {
1442
+ log.info("Setting state styles", trimmedId, styles);
1443
+ const stylesList = typeof styles === "string" ? [styles] : styles;
1444
+ stylesList.forEach((style) => this.setStyle(trimmedId, style.trim()));
1445
+ }
1446
+ if (textStyles) {
1447
+ log.info("Setting state styles", trimmedId, styles);
1448
+ const textStylesList = typeof textStyles === "string" ? [textStyles] : textStyles;
1449
+ textStylesList.forEach((textStyle) => this.setTextStyle(trimmedId, textStyle.trim()));
1450
+ }
1451
+ }
1452
+ clear(saveCommon) {
1453
+ this.nodes = [];
1454
+ this.edges = [];
1455
+ this.documents = {
1456
+ root: newDoc()
1457
+ };
1458
+ this.currentDocument = this.documents.root;
1459
+ this.startEndCount = 0;
1460
+ this.classes = newClassesList();
1461
+ if (!saveCommon) {
1462
+ clear();
1463
+ }
1464
+ }
1465
+ getState(id) {
1466
+ return this.currentDocument.states.get(id);
1467
+ }
1468
+ getStates() {
1469
+ return this.currentDocument.states;
1470
+ }
1471
+ logDocuments() {
1472
+ log.info("Documents = ", this.documents);
1473
+ }
1474
+ getRelations() {
1475
+ return this.currentDocument.relations;
1476
+ }
1477
+ /**
1478
+ * If the id is a start node ( [*] ), then return a new id constructed from
1479
+ * the start node name and the current start node count.
1480
+ * else return the given id
1481
+ *
1482
+ * @param {string} id
1483
+ * @returns {string} - the id (original or constructed)
1484
+ * @private
1485
+ */
1486
+ startIdIfNeeded(id = "") {
1487
+ let fixedId = id;
1488
+ if (id === START_NODE) {
1489
+ this.startEndCount++;
1490
+ fixedId = `${START_TYPE}${this.startEndCount}`;
1491
+ }
1492
+ return fixedId;
1493
+ }
1494
+ /**
1495
+ * If the id is a start node ( [*] ), then return the start type ('start')
1496
+ * else return the given type
1497
+ *
1498
+ * @param {string} id
1499
+ * @param {string} type
1500
+ * @returns {string} - the type that should be used
1501
+ * @private
1502
+ */
1503
+ startTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
1504
+ return id === START_NODE ? START_TYPE : type;
1505
+ }
1506
+ /**
1507
+ * If the id is an end node ( [*] ), then return a new id constructed from
1508
+ * the end node name and the current start_end node count.
1509
+ * else return the given id
1510
+ *
1511
+ * @param {string} id
1512
+ * @returns {string} - the id (original or constructed)
1513
+ * @private
1514
+ */
1515
+ endIdIfNeeded(id = "") {
1516
+ let fixedId = id;
1517
+ if (id === END_NODE) {
1518
+ this.startEndCount++;
1519
+ fixedId = `${END_TYPE}${this.startEndCount}`;
1520
+ }
1521
+ return fixedId;
1522
+ }
1523
+ /**
1524
+ * If the id is an end node ( [*] ), then return the end type
1525
+ * else return the given type
1526
+ *
1527
+ * @param {string} id
1528
+ * @param {string} type
1529
+ * @returns {string} - the type that should be used
1530
+ * @private
1531
+ */
1532
+ endTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
1533
+ return id === END_NODE ? END_TYPE : type;
1534
+ }
1535
+ /**
1536
+ *
1537
+ * @param item1
1538
+ * @param item2
1539
+ * @param relationTitle
1540
+ */
1541
+ addRelationObjs(item1, item2, relationTitle) {
1542
+ let id1 = this.startIdIfNeeded(item1.id.trim());
1543
+ let type1 = this.startTypeIfNeeded(item1.id.trim(), item1.type);
1544
+ let id2 = this.startIdIfNeeded(item2.id.trim());
1545
+ let type2 = this.startTypeIfNeeded(item2.id.trim(), item2.type);
1546
+ this.addState(
1547
+ id1,
1548
+ type1,
1549
+ item1.doc,
1550
+ item1.description,
1551
+ item1.note,
1552
+ item1.classes,
1553
+ item1.styles,
1554
+ item1.textStyles
1555
+ );
1556
+ this.addState(
1557
+ id2,
1558
+ type2,
1559
+ item2.doc,
1560
+ item2.description,
1561
+ item2.note,
1562
+ item2.classes,
1563
+ item2.styles,
1564
+ item2.textStyles
1565
+ );
1566
+ this.currentDocument.relations.push({
1567
+ id1,
1568
+ id2,
1569
+ relationTitle: common_default.sanitizeText(relationTitle, getConfig2())
1570
+ });
1571
+ }
1572
+ /**
1573
+ * Add a relation between two items. The items may be full objects or just the string id of a state.
1574
+ *
1575
+ * @param {string | object} item1
1576
+ * @param {string | object} item2
1577
+ * @param {string} title
1578
+ */
1579
+ addRelation(item1, item2, title) {
1580
+ if (typeof item1 === "object") {
1581
+ this.addRelationObjs(item1, item2, title);
1582
+ } else {
1583
+ const id1 = this.startIdIfNeeded(item1.trim());
1584
+ const type1 = this.startTypeIfNeeded(item1);
1585
+ const id2 = this.endIdIfNeeded(item2.trim());
1586
+ const type2 = this.endTypeIfNeeded(item2);
1587
+ this.addState(id1, type1);
1588
+ this.addState(id2, type2);
1589
+ this.currentDocument.relations.push({
1590
+ id1,
1591
+ id2,
1592
+ title: common_default.sanitizeText(title, getConfig2())
1593
+ });
1594
+ }
1595
+ }
1596
+ addDescription(id, descr) {
1597
+ const theState = this.currentDocument.states.get(id);
1598
+ const _descr = descr.startsWith(":") ? descr.replace(":", "").trim() : descr;
1599
+ theState.descriptions.push(common_default.sanitizeText(_descr, getConfig2()));
1600
+ }
1601
+ cleanupLabel(label) {
1602
+ if (label.substring(0, 1) === ":") {
1603
+ return label.substr(2).trim();
1604
+ } else {
1605
+ return label.trim();
1606
+ }
1607
+ }
1608
+ getDividerId() {
1609
+ this.dividerCnt++;
1610
+ return "divider-id-" + this.dividerCnt;
1611
+ }
1612
+ /**
1613
+ * Called when the parser comes across a (style) class definition
1614
+ * @example classDef my-style fill:#f96;
1615
+ *
1616
+ * @param {string} id - the id of this (style) class
1617
+ * @param {string | null} styleAttributes - the string with 1 or more style attributes (each separated by a comma)
1618
+ */
1619
+ addStyleClass(id, styleAttributes = "") {
1620
+ if (!this.classes.has(id)) {
1621
+ this.classes.set(id, { id, styles: [], textStyles: [] });
1622
+ }
1623
+ const foundClass = this.classes.get(id);
1624
+ if (styleAttributes !== void 0 && styleAttributes !== null) {
1625
+ styleAttributes.split(STYLECLASS_SEP).forEach((attrib) => {
1626
+ const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim();
1627
+ if (RegExp(COLOR_KEYWORD).exec(attrib)) {
1628
+ const newStyle1 = fixedAttrib.replace(FILL_KEYWORD, BG_FILL);
1629
+ const newStyle2 = newStyle1.replace(COLOR_KEYWORD, FILL_KEYWORD);
1630
+ foundClass.textStyles.push(newStyle2);
1631
+ }
1632
+ foundClass.styles.push(fixedAttrib);
1633
+ });
1634
+ }
1635
+ }
1636
+ /**
1637
+ * Return all of the style classes
1638
+ * @returns {{} | any | classes}
1639
+ */
1640
+ getClasses() {
1641
+ return this.classes;
1642
+ }
1643
+ /**
1644
+ * Add a (style) class or css class to a state with the given id.
1645
+ * If the state isn't already in the list of known states, add it.
1646
+ * Might be called by parser when a style class or CSS class should be applied to a state
1647
+ *
1648
+ * @param {string | string[]} itemIds The id or a list of ids of the item(s) to apply the css class to
1649
+ * @param {string} cssClassName CSS class name
1650
+ */
1651
+ setCssClass(itemIds, cssClassName) {
1652
+ itemIds.split(",").forEach((id) => {
1653
+ let foundState = this.getState(id);
1654
+ if (foundState === void 0) {
1655
+ const trimmedId = id.trim();
1656
+ this.addState(trimmedId);
1657
+ foundState = this.getState(trimmedId);
1658
+ }
1659
+ foundState.classes.push(cssClassName);
1660
+ });
1661
+ }
1662
+ /**
1663
+ * Add a style to a state with the given id.
1664
+ * @example style stateId fill:#f9f,stroke:#333,stroke-width:4px
1665
+ * where 'style' is the keyword
1666
+ * stateId is the id of a state
1667
+ * the rest of the string is the styleText (all of the attributes to be applied to the state)
1668
+ *
1669
+ * @param itemId The id of item to apply the style to
1670
+ * @param styleText - the text of the attributes for the style
1671
+ */
1672
+ setStyle(itemId, styleText) {
1673
+ const item = this.getState(itemId);
1674
+ if (item !== void 0) {
1675
+ item.styles.push(styleText);
1676
+ }
1677
+ }
1678
+ /**
1679
+ * Add a text style to a state with the given id
1680
+ *
1681
+ * @param itemId The id of item to apply the css class to
1682
+ * @param cssClassName CSS class name
1683
+ */
1684
+ setTextStyle(itemId, cssClassName) {
1685
+ const item = this.getState(itemId);
1686
+ if (item !== void 0) {
1687
+ item.textStyles.push(cssClassName);
1688
+ }
1689
+ }
1690
+ /**
1691
+ * Finds the direction statement in the root document.
1692
+ * @private
1693
+ * @returns {{ value: string } | undefined} - the direction statement if present
1694
+ */
1695
+ getDirectionStatement() {
1696
+ return this.rootDoc.find((doc) => doc.stmt === STMT_DIRECTION);
1697
+ }
1698
+ getDirection() {
1699
+ return this.getDirectionStatement()?.value ?? DEFAULT_DIAGRAM_DIRECTION;
1700
+ }
1701
+ setDirection(dir) {
1702
+ const doc = this.getDirectionStatement();
1703
+ if (doc) {
1704
+ doc.value = dir;
1705
+ } else {
1706
+ this.rootDoc.unshift({ stmt: STMT_DIRECTION, value: dir });
1707
+ }
1708
+ }
1709
+ trimColon(str) {
1710
+ return str && str[0] === ":" ? str.substr(1).trim() : str.trim();
1711
+ }
1712
+ getData() {
1713
+ const config = getConfig2();
1714
+ return {
1715
+ nodes: this.nodes,
1716
+ edges: this.edges,
1717
+ other: {},
1718
+ config,
1719
+ direction: getDir(this.getRootDocV2())
1720
+ };
1721
+ }
1722
+ getConfig() {
1723
+ return getConfig2().state;
1724
+ }
1725
+ getAccTitle = getAccTitle;
1726
+ setAccTitle = setAccTitle;
1727
+ getAccDescription = getAccDescription;
1728
+ setAccDescription = setAccDescription;
1729
+ setDiagramTitle = setDiagramTitle;
1730
+ getDiagramTitle = getDiagramTitle;
1731
+ };
1732
+ var getStyles = /* @__PURE__ */ __name((options) => `
1733
+ defs #statediagram-barbEnd {
1734
+ fill: ${options.transitionColor};
1735
+ stroke: ${options.transitionColor};
1736
+ }
1737
+ g.stateGroup text {
1738
+ fill: ${options.nodeBorder};
1739
+ stroke: none;
1740
+ font-size: 10px;
1741
+ }
1742
+ g.stateGroup text {
1743
+ fill: ${options.textColor};
1744
+ stroke: none;
1745
+ font-size: 10px;
1746
+
1747
+ }
1748
+ g.stateGroup .state-title {
1749
+ font-weight: bolder;
1750
+ fill: ${options.stateLabelColor};
1751
+ }
1752
+
1753
+ g.stateGroup rect {
1754
+ fill: ${options.mainBkg};
1755
+ stroke: ${options.nodeBorder};
1756
+ }
1757
+
1758
+ g.stateGroup line {
1759
+ stroke: ${options.lineColor};
1760
+ stroke-width: 1;
1761
+ }
1762
+
1763
+ .transition {
1764
+ stroke: ${options.transitionColor};
1765
+ stroke-width: 1;
1766
+ fill: none;
1767
+ }
1768
+
1769
+ .stateGroup .composit {
1770
+ fill: ${options.background};
1771
+ border-bottom: 1px
1772
+ }
1773
+
1774
+ .stateGroup .alt-composit {
1775
+ fill: #e0e0e0;
1776
+ border-bottom: 1px
1777
+ }
1778
+
1779
+ .state-note {
1780
+ stroke: ${options.noteBorderColor};
1781
+ fill: ${options.noteBkgColor};
1782
+
1783
+ text {
1784
+ fill: ${options.noteTextColor};
1785
+ stroke: none;
1786
+ font-size: 10px;
1787
+ }
1788
+ }
1789
+
1790
+ .stateLabel .box {
1791
+ stroke: none;
1792
+ stroke-width: 0;
1793
+ fill: ${options.mainBkg};
1794
+ opacity: 0.5;
1795
+ }
1796
+
1797
+ .edgeLabel .label rect {
1798
+ fill: ${options.labelBackgroundColor};
1799
+ opacity: 0.5;
1800
+ }
1801
+ .edgeLabel {
1802
+ background-color: ${options.edgeLabelBackground};
1803
+ p {
1804
+ background-color: ${options.edgeLabelBackground};
1805
+ }
1806
+ rect {
1807
+ opacity: 0.5;
1808
+ background-color: ${options.edgeLabelBackground};
1809
+ fill: ${options.edgeLabelBackground};
1810
+ }
1811
+ text-align: center;
1812
+ }
1813
+ .edgeLabel .label text {
1814
+ fill: ${options.transitionLabelColor || options.tertiaryTextColor};
1815
+ }
1816
+ .label div .edgeLabel {
1817
+ color: ${options.transitionLabelColor || options.tertiaryTextColor};
1818
+ }
1819
+
1820
+ .stateLabel text {
1821
+ fill: ${options.stateLabelColor};
1822
+ font-size: 10px;
1823
+ font-weight: bold;
1824
+ }
1825
+
1826
+ .node circle.state-start {
1827
+ fill: ${options.specialStateColor};
1828
+ stroke: ${options.specialStateColor};
1829
+ }
1830
+
1831
+ .node .fork-join {
1832
+ fill: ${options.specialStateColor};
1833
+ stroke: ${options.specialStateColor};
1834
+ }
1835
+
1836
+ .node circle.state-end {
1837
+ fill: ${options.innerEndBackground};
1838
+ stroke: ${options.background};
1839
+ stroke-width: 1.5
1840
+ }
1841
+ .end-state-inner {
1842
+ fill: ${options.compositeBackground || options.background};
1843
+ // stroke: ${options.background};
1844
+ stroke-width: 1.5
1845
+ }
1846
+
1847
+ .node rect {
1848
+ fill: ${options.stateBkg || options.mainBkg};
1849
+ stroke: ${options.stateBorder || options.nodeBorder};
1850
+ stroke-width: 1px;
1851
+ }
1852
+ .node polygon {
1853
+ fill: ${options.mainBkg};
1854
+ stroke: ${options.stateBorder || options.nodeBorder};;
1855
+ stroke-width: 1px;
1856
+ }
1857
+ #statediagram-barbEnd {
1858
+ fill: ${options.lineColor};
1859
+ }
1860
+
1861
+ .statediagram-cluster rect {
1862
+ fill: ${options.compositeTitleBackground};
1863
+ stroke: ${options.stateBorder || options.nodeBorder};
1864
+ stroke-width: 1px;
1865
+ }
1866
+
1867
+ .cluster-label, .nodeLabel {
1868
+ color: ${options.stateLabelColor};
1869
+ // line-height: 1;
1870
+ }
1871
+
1872
+ .statediagram-cluster rect.outer {
1873
+ rx: 5px;
1874
+ ry: 5px;
1875
+ }
1876
+ .statediagram-state .divider {
1877
+ stroke: ${options.stateBorder || options.nodeBorder};
1878
+ }
1879
+
1880
+ .statediagram-state .title-state {
1881
+ rx: 5px;
1882
+ ry: 5px;
1883
+ }
1884
+ .statediagram-cluster.statediagram-cluster .inner {
1885
+ fill: ${options.compositeBackground || options.background};
1886
+ }
1887
+ .statediagram-cluster.statediagram-cluster-alt .inner {
1888
+ fill: ${options.altBackground ? options.altBackground : "#efefef"};
1889
+ }
1890
+
1891
+ .statediagram-cluster .inner {
1892
+ rx:0;
1893
+ ry:0;
1894
+ }
1895
+
1896
+ .statediagram-state rect.basic {
1897
+ rx: 5px;
1898
+ ry: 5px;
1899
+ }
1900
+ .statediagram-state rect.divider {
1901
+ stroke-dasharray: 10,10;
1902
+ fill: ${options.altBackground ? options.altBackground : "#efefef"};
1903
+ }
1904
+
1905
+ .note-edge {
1906
+ stroke-dasharray: 5;
1907
+ }
1908
+
1909
+ .statediagram-note rect {
1910
+ fill: ${options.noteBkgColor};
1911
+ stroke: ${options.noteBorderColor};
1912
+ stroke-width: 1px;
1913
+ rx: 0;
1914
+ ry: 0;
1915
+ }
1916
+ .statediagram-note rect {
1917
+ fill: ${options.noteBkgColor};
1918
+ stroke: ${options.noteBorderColor};
1919
+ stroke-width: 1px;
1920
+ rx: 0;
1921
+ ry: 0;
1922
+ }
1923
+
1924
+ .statediagram-note text {
1925
+ fill: ${options.noteTextColor};
1926
+ }
1927
+
1928
+ .statediagram-note .nodeLabel {
1929
+ color: ${options.noteTextColor};
1930
+ }
1931
+ .statediagram .edgeLabel {
1932
+ color: red; // ${options.noteTextColor};
1933
+ }
1934
+
1935
+ #dependencyStart, #dependencyEnd {
1936
+ fill: ${options.lineColor};
1937
+ stroke: ${options.lineColor};
1938
+ stroke-width: 1;
1939
+ }
1940
+
1941
+ .statediagramTitleText {
1942
+ text-anchor: middle;
1943
+ font-size: 18px;
1944
+ fill: ${options.textColor};
1945
+ }
1946
+ `, "getStyles");
1947
+ var styles_default = getStyles;
1948
+ export {
1949
+ StateDB as S,
1950
+ stateDiagram_default as a,
1951
+ stateRenderer_v3_unified_default as b,
1952
+ styles_default as s
1953
+ };