@sourcegraph/amp 0.0.1749585689-g82b91d → 0.0.1749614780-g9a56bd
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.
- package/dist/amp.js +3 -3
- package/dist/architectureDiagram-RWNHDUBN-1v8WgxdD.js +4635 -0
- package/dist/blockDiagram-XZSR5OGQ-XFBYN-jB.js +2243 -0
- package/dist/c4Diagram-6R2MQUNL-B0L0pltn.js +1587 -0
- package/dist/chunk-COUQ6RZ3-qd4eG6tc.js +17852 -0
- package/dist/chunk-CRQPXCKQ-yjI467Bq.js +65 -0
- package/dist/chunk-EFPBJHX4-DdHmqd0M.js +1378 -0
- package/dist/chunk-EOAU2GW5-CpRNAcjo.js +253 -0
- package/dist/chunk-IHYUGLNO-DJcRQIf7.js +1365 -0
- package/dist/chunk-K2ZEYYM2-CbqHhUqy.js +9 -0
- package/dist/chunk-Q7VUVKE6-gBSSbdjU.js +24 -0
- package/dist/chunk-T2M37SMK-Br8mK30k.js +1411 -0
- package/dist/chunk-TGZYFRKZ-BYBLXoJz.js +1331 -0
- package/dist/chunk-YJGJQOYZ-BGiSkWF0.js +19 -0
- package/dist/classDiagram-LB37KKQG-DhFsEyDS.js +17 -0
- package/dist/classDiagram-v2-KFQJBC22-DhFsEyDS.js +17 -0
- package/dist/{client-C1WG2nEf.js → client-D-YAg8x6.js} +6 -6
- package/dist/{console-DK0gDzNQ.js → console-CoE5Qzyz.js} +41106 -22971
- package/dist/create_file.node-Co0Uh1F3.js +21 -0
- package/dist/dagre-CMTPJJKG-UDPzd9Iy.js +446 -0
- package/dist/diagram-BIPOGRU5-B7TV59-n.js +128 -0
- package/dist/diagram-YF4VECWA-LsAZsciQ.js +219 -0
- package/dist/{edit_file.node-BH524GkF.js → edit_file.node-CmTZeBc2.js} +11 -11
- package/dist/erDiagram-AK44R45H-BWpeEu7D.js +843 -0
- package/dist/{executable-5cBRGrsC.js → executable-BE7tfoX5.js} +1 -1
- package/dist/{files-CybxYgbE.js → files-DqpRf5q4.js} +10 -10
- package/dist/flowDiagram-XARHJDSH-DzpV02UB.js +1618 -0
- package/dist/ganttDiagram-H5QQZTZ5-C0BhJTzn.js +1605 -0
- package/dist/gitGraphDiagram-XHLTLO3W-0EiOmv44.js +701 -0
- package/dist/{glob.node-C6HbLuPt.js → glob.node-DNei8bFS.js} +11 -11
- package/dist/{index-C2wo7rRZ.js → index-BcjxaWOc.js} +31 -31
- package/dist/infoDiagram-TP2HPDHO-CQX5a0Fc.js +24 -0
- package/dist/journeyDiagram-VHRN44N3-C82dEe4G.js +809 -0
- package/dist/kanban-definition-K5J3OUUV-xilJcrom.js +718 -0
- package/dist/katex-5N2NCDMP-CAsrnb6_.js +11703 -0
- package/dist/{list_directory.node-ZQscizpi.js → list_directory.node-CMiNNbXP.js} +1 -1
- package/dist/{load-profile-BbmyxO_7.js → load-profile-Cg8XaTx6.js} +1 -1
- package/dist/{main-CiUaVPC2.js → main-CtwgALCc.js} +23 -16
- package/dist/mindmap-definition-TI5ONXTW-BNaRba4R.js +3221 -0
- package/dist/{node-VrazB_nQ.js → node-Bfma_T75.js} +58 -58
- package/dist/{node-DvmQAW7h.js → node-BtG1o_DD.js} +2 -2
- package/dist/{node-GgocwWwI.js → node-CZJC9BSF.js} +3 -3
- package/dist/{node-Cpbjmhrj.js → node-Cp3D7_hw.js} +71 -71
- package/dist/{node-CiFAW-F3.js → node-Ctw1i0nl.js} +12 -12
- package/dist/{node-CgVq0JJ9.js → node-D1zxOCuN.js} +1 -1
- package/dist/pieDiagram-FPR3CNQC-_30_tQz0.js +120 -0
- package/dist/quadrantDiagram-RLP5YTJ2-CTD43GTk.js +1028 -0
- package/dist/radar-MK3ICKWK-55CS4JTO-afihMdR4.js +14398 -0
- package/dist/{read_file.node-CIdAFiJ6.js → read_file.node-QZ0VCmB2.js} +1 -1
- package/dist/requirementDiagram-P5NVWGNK-Sd2_6g8e.js +853 -0
- package/dist/sankeyDiagram-C6NZRJHT-D1EcCYaw.js +864 -0
- package/dist/sequenceDiagram-6SLVIXKN-CghQTpGf.js +2283 -0
- package/dist/stateDiagram-WI5ZVJ5I-Bv21MlSK.js +272 -0
- package/dist/stateDiagram-v2-KVDSFUFK-BgP0D8xL.js +17 -0
- package/dist/{stdio-D9HyubOc.js → stdio-yXWLIEvb.js} +8 -8
- package/dist/storybook.js +7 -7
- package/dist/timeline-definition-65575674-BUqRZdJ-.js +800 -0
- package/dist/{undo_edit.node-VYuTxRwd.js → undo_edit.node-BkletvTZ.js} +5 -5
- package/dist/xychartDiagram-674MFTBU-DjBabATx.js +1291 -0
- package/package.json +1 -1
- package/dist/create_file.node-DtVTaHj5.js +0 -21
@@ -0,0 +1,1411 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
import { g as se, s as ie } from "./chunk-Q7VUVKE6-gBSSbdjU.js";
|
3
|
+
import { _ as u, A as b, y as C, R as re, S as ae, aL as ne, L as V, Z as le, w as oe, x as ce, v as he, u as ue, T as de, U as fe } from "./console-CoE5Qzyz.js";
|
4
|
+
var mt = function() {
|
5
|
+
var t = /* @__PURE__ */ u(function(w, l, c, a) {
|
6
|
+
for (c = c || {}, a = w.length; a--; c[w[a]] = l) ;
|
7
|
+
return c;
|
8
|
+
}, "o"), e = [1, 2], o = [1, 3], r = [1, 4], d = [2, 4], i = [1, 9], p = [1, 11], g = [1, 16], n = [1, 17], T = [1, 18], m = [1, 19], R = [1, 32], A = [1, 20], f = [1, 21], x = [1, 22], L = [1, 23], P = [1, 24], B = [1, 26], O = [1, 27], N = [1, 28], q = [1, 29], Z = [1, 30], Q = [1, 31], tt = [1, 34], et = [1, 35], st = [1, 36], it = [1, 37], j = [1, 33], S = [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], rt = [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], Ct = [4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], ft = {
|
9
|
+
trace: /* @__PURE__ */ u(function() {
|
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__ */ u(function(l, c, a, y, _, s, H) {
|
16
|
+
var h = s.length - 1;
|
17
|
+
switch (_) {
|
18
|
+
case 3:
|
19
|
+
return y.setRootDoc(s[h]), s[h];
|
20
|
+
case 4:
|
21
|
+
this.$ = [];
|
22
|
+
break;
|
23
|
+
case 5:
|
24
|
+
s[h] != "nl" && (s[h - 1].push(s[h]), this.$ = s[h - 1]);
|
25
|
+
break;
|
26
|
+
case 6:
|
27
|
+
case 7:
|
28
|
+
this.$ = s[h];
|
29
|
+
break;
|
30
|
+
case 8:
|
31
|
+
this.$ = "nl";
|
32
|
+
break;
|
33
|
+
case 12:
|
34
|
+
this.$ = s[h];
|
35
|
+
break;
|
36
|
+
case 13:
|
37
|
+
const z = s[h - 1];
|
38
|
+
z.description = y.trimColon(s[h]), this.$ = z;
|
39
|
+
break;
|
40
|
+
case 14:
|
41
|
+
this.$ = { stmt: "relation", state1: s[h - 2], state2: s[h] };
|
42
|
+
break;
|
43
|
+
case 15:
|
44
|
+
const pt = y.trimColon(s[h]);
|
45
|
+
this.$ = { stmt: "relation", state1: s[h - 3], state2: s[h - 1], description: pt };
|
46
|
+
break;
|
47
|
+
case 19:
|
48
|
+
this.$ = { stmt: "state", id: s[h - 3], type: "default", description: "", doc: s[h - 1] };
|
49
|
+
break;
|
50
|
+
case 20:
|
51
|
+
var G = s[h], M = s[h - 2].trim();
|
52
|
+
if (s[h].match(":")) {
|
53
|
+
var nt = s[h].split(":");
|
54
|
+
G = nt[0], M = [M, nt[1]];
|
55
|
+
}
|
56
|
+
this.$ = { stmt: "state", id: G, type: "default", description: M };
|
57
|
+
break;
|
58
|
+
case 21:
|
59
|
+
this.$ = { stmt: "state", id: s[h - 3], type: "default", description: s[h - 5], doc: s[h - 1] };
|
60
|
+
break;
|
61
|
+
case 22:
|
62
|
+
this.$ = { stmt: "state", id: s[h], type: "fork" };
|
63
|
+
break;
|
64
|
+
case 23:
|
65
|
+
this.$ = { stmt: "state", id: s[h], type: "join" };
|
66
|
+
break;
|
67
|
+
case 24:
|
68
|
+
this.$ = { stmt: "state", id: s[h], type: "choice" };
|
69
|
+
break;
|
70
|
+
case 25:
|
71
|
+
this.$ = { stmt: "state", id: y.getDividerId(), type: "divider" };
|
72
|
+
break;
|
73
|
+
case 26:
|
74
|
+
this.$ = { stmt: "state", id: s[h - 1].trim(), note: { position: s[h - 2].trim(), text: s[h].trim() } };
|
75
|
+
break;
|
76
|
+
case 29:
|
77
|
+
this.$ = s[h].trim(), y.setAccTitle(this.$);
|
78
|
+
break;
|
79
|
+
case 30:
|
80
|
+
case 31:
|
81
|
+
this.$ = s[h].trim(), y.setAccDescription(this.$);
|
82
|
+
break;
|
83
|
+
case 32:
|
84
|
+
case 33:
|
85
|
+
this.$ = { stmt: "classDef", id: s[h - 1].trim(), classes: s[h].trim() };
|
86
|
+
break;
|
87
|
+
case 34:
|
88
|
+
this.$ = { stmt: "style", id: s[h - 1].trim(), styleClass: s[h].trim() };
|
89
|
+
break;
|
90
|
+
case 35:
|
91
|
+
this.$ = { stmt: "applyClass", id: s[h - 1].trim(), styleClass: s[h].trim() };
|
92
|
+
break;
|
93
|
+
case 36:
|
94
|
+
y.setDirection("TB"), this.$ = { stmt: "dir", value: "TB" };
|
95
|
+
break;
|
96
|
+
case 37:
|
97
|
+
y.setDirection("BT"), this.$ = { stmt: "dir", value: "BT" };
|
98
|
+
break;
|
99
|
+
case 38:
|
100
|
+
y.setDirection("RL"), this.$ = { stmt: "dir", value: "RL" };
|
101
|
+
break;
|
102
|
+
case 39:
|
103
|
+
y.setDirection("LR"), this.$ = { stmt: "dir", value: "LR" };
|
104
|
+
break;
|
105
|
+
case 42:
|
106
|
+
case 43:
|
107
|
+
this.$ = { stmt: "state", id: s[h].trim(), type: "default", description: "" };
|
108
|
+
break;
|
109
|
+
case 44:
|
110
|
+
this.$ = { stmt: "state", id: s[h - 2].trim(), classes: [s[h].trim()], type: "default", description: "" };
|
111
|
+
break;
|
112
|
+
case 45:
|
113
|
+
this.$ = { stmt: "state", id: s[h - 2].trim(), classes: [s[h].trim()], type: "default", description: "" };
|
114
|
+
break;
|
115
|
+
}
|
116
|
+
}, "anonymous"),
|
117
|
+
table: [{ 3: 1, 4: e, 5: o, 6: r }, { 1: [3] }, { 3: 5, 4: e, 5: o, 6: r }, { 3: 6, 4: e, 5: o, 6: r }, t([1, 4, 5, 16, 17, 19, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], d, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: i, 5: p, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: g, 17: n, 19: T, 22: m, 24: R, 25: A, 26: f, 27: x, 28: L, 29: P, 32: 25, 33: B, 35: O, 37: N, 38: q, 42: Z, 45: Q, 48: tt, 49: et, 50: st, 51: it, 54: j }, t(S, [2, 5]), { 9: 38, 10: 12, 11: 13, 12: 14, 13: 15, 16: g, 17: n, 19: T, 22: m, 24: R, 25: A, 26: f, 27: x, 28: L, 29: P, 32: 25, 33: B, 35: O, 37: N, 38: q, 42: Z, 45: Q, 48: tt, 49: et, 50: st, 51: it, 54: j }, t(S, [2, 7]), t(S, [2, 8]), t(S, [2, 9]), t(S, [2, 10]), t(S, [2, 11]), t(S, [2, 12], { 14: [1, 39], 15: [1, 40] }), t(S, [2, 16]), { 18: [1, 41] }, t(S, [2, 18], { 20: [1, 42] }), { 23: [1, 43] }, t(S, [2, 22]), t(S, [2, 23]), t(S, [2, 24]), t(S, [2, 25]), { 30: 44, 31: [1, 45], 56: [1, 46], 57: [1, 47] }, t(S, [2, 28]), { 34: [1, 48] }, { 36: [1, 49] }, t(S, [2, 31]), { 39: [1, 50], 41: [1, 51] }, { 43: [1, 52] }, { 46: [1, 53] }, t(rt, [2, 42], { 55: [1, 54] }), t(rt, [2, 43], { 55: [1, 55] }), t(S, [2, 36]), t(S, [2, 37]), t(S, [2, 38]), t(S, [2, 39]), t(S, [2, 6]), t(S, [2, 13]), { 13: 56, 24: R, 54: j }, t(S, [2, 17]), t(Ct, d, { 7: 57 }), { 24: [1, 58] }, { 24: [1, 59] }, { 23: [1, 60] }, { 24: [2, 46] }, { 24: [2, 47] }, t(S, [2, 29]), t(S, [2, 30]), { 40: [1, 61] }, { 40: [1, 62] }, { 44: [1, 63] }, { 47: [1, 64] }, { 24: [1, 65] }, { 24: [1, 66] }, t(S, [2, 14], { 14: [1, 67] }), { 4: i, 5: p, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: g, 17: n, 19: T, 21: [1, 68], 22: m, 24: R, 25: A, 26: f, 27: x, 28: L, 29: P, 32: 25, 33: B, 35: O, 37: N, 38: q, 42: Z, 45: Q, 48: tt, 49: et, 50: st, 51: it, 54: j }, t(S, [2, 20], { 20: [1, 69] }), { 31: [1, 70] }, { 24: [1, 71] }, t(S, [2, 32]), t(S, [2, 33]), t(S, [2, 34]), t(S, [2, 35]), t(rt, [2, 44]), t(rt, [2, 45]), t(S, [2, 15]), t(S, [2, 19]), t(Ct, d, { 7: 72 }), t(S, [2, 26]), t(S, [2, 27]), { 4: i, 5: p, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: g, 17: n, 19: T, 21: [1, 73], 22: m, 24: R, 25: A, 26: f, 27: x, 28: L, 29: P, 32: 25, 33: B, 35: O, 37: N, 38: q, 42: Z, 45: Q, 48: tt, 49: et, 50: st, 51: it, 54: j }, t(S, [2, 21])],
|
118
|
+
defaultActions: { 5: [2, 1], 6: [2, 2], 46: [2, 46], 47: [2, 47] },
|
119
|
+
parseError: /* @__PURE__ */ u(function(l, c) {
|
120
|
+
if (c.recoverable)
|
121
|
+
this.trace(l);
|
122
|
+
else {
|
123
|
+
var a = new Error(l);
|
124
|
+
throw a.hash = c, a;
|
125
|
+
}
|
126
|
+
}, "parseError"),
|
127
|
+
parse: /* @__PURE__ */ u(function(l) {
|
128
|
+
var c = this, a = [0], y = [], _ = [null], s = [], H = this.table, h = "", G = 0, M = 0, nt = 2, z = 1, pt = s.slice.call(arguments, 1), E = Object.create(this.lexer), Y = { yy: {} };
|
129
|
+
for (var St in this.yy)
|
130
|
+
Object.prototype.hasOwnProperty.call(this.yy, St) && (Y.yy[St] = this.yy[St]);
|
131
|
+
E.setInput(l, Y.yy), Y.yy.lexer = E, Y.yy.parser = this, typeof E.yylloc > "u" && (E.yylloc = {});
|
132
|
+
var yt = E.yylloc;
|
133
|
+
s.push(yt);
|
134
|
+
var te = E.options && E.options.ranges;
|
135
|
+
typeof Y.yy.parseError == "function" ? this.parseError = Y.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
|
136
|
+
function ee(v) {
|
137
|
+
a.length = a.length - 2 * v, _.length = _.length - v, s.length = s.length - v;
|
138
|
+
}
|
139
|
+
u(ee, "popStack");
|
140
|
+
function xt() {
|
141
|
+
var v;
|
142
|
+
return v = y.pop() || E.lex() || z, typeof v != "number" && (v instanceof Array && (y = v, v = y.pop()), v = c.symbols_[v] || v), v;
|
143
|
+
}
|
144
|
+
u(xt, "lex");
|
145
|
+
for (var D, F, k, gt, U = {}, lt, I, At, ot; ; ) {
|
146
|
+
if (F = a[a.length - 1], this.defaultActions[F] ? k = this.defaultActions[F] : ((D === null || typeof D > "u") && (D = xt()), k = H[F] && H[F][D]), typeof k > "u" || !k.length || !k[0]) {
|
147
|
+
var Tt = "";
|
148
|
+
ot = [];
|
149
|
+
for (lt in H[F])
|
150
|
+
this.terminals_[lt] && lt > nt && ot.push("'" + this.terminals_[lt] + "'");
|
151
|
+
E.showPosition ? Tt = "Parse error on line " + (G + 1) + `:
|
152
|
+
` + E.showPosition() + `
|
153
|
+
Expecting ` + ot.join(", ") + ", got '" + (this.terminals_[D] || D) + "'" : Tt = "Parse error on line " + (G + 1) + ": Unexpected " + (D == z ? "end of input" : "'" + (this.terminals_[D] || D) + "'"), this.parseError(Tt, {
|
154
|
+
text: E.match,
|
155
|
+
token: this.terminals_[D] || D,
|
156
|
+
line: E.yylineno,
|
157
|
+
loc: yt,
|
158
|
+
expected: ot
|
159
|
+
});
|
160
|
+
}
|
161
|
+
if (k[0] instanceof Array && k.length > 1)
|
162
|
+
throw new Error("Parse Error: multiple actions possible at state: " + F + ", token: " + D);
|
163
|
+
switch (k[0]) {
|
164
|
+
case 1:
|
165
|
+
a.push(D), _.push(E.yytext), s.push(E.yylloc), a.push(k[1]), D = null, M = E.yyleng, h = E.yytext, G = E.yylineno, yt = E.yylloc;
|
166
|
+
break;
|
167
|
+
case 2:
|
168
|
+
if (I = this.productions_[k[1]][1], U.$ = _[_.length - I], U._$ = {
|
169
|
+
first_line: s[s.length - (I || 1)].first_line,
|
170
|
+
last_line: s[s.length - 1].last_line,
|
171
|
+
first_column: s[s.length - (I || 1)].first_column,
|
172
|
+
last_column: s[s.length - 1].last_column
|
173
|
+
}, te && (U._$.range = [
|
174
|
+
s[s.length - (I || 1)].range[0],
|
175
|
+
s[s.length - 1].range[1]
|
176
|
+
]), gt = this.performAction.apply(U, [
|
177
|
+
h,
|
178
|
+
M,
|
179
|
+
G,
|
180
|
+
Y.yy,
|
181
|
+
k[1],
|
182
|
+
_,
|
183
|
+
s
|
184
|
+
].concat(pt)), typeof gt < "u")
|
185
|
+
return gt;
|
186
|
+
I && (a = a.slice(0, -1 * I * 2), _ = _.slice(0, -1 * I), s = s.slice(0, -1 * I)), a.push(this.productions_[k[1]][0]), _.push(U.$), s.push(U._$), At = H[a[a.length - 2]][a[a.length - 1]], a.push(At);
|
187
|
+
break;
|
188
|
+
case 3:
|
189
|
+
return !0;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
return !0;
|
193
|
+
}, "parse")
|
194
|
+
}, Qt = /* @__PURE__ */ function() {
|
195
|
+
var w = {
|
196
|
+
EOF: 1,
|
197
|
+
parseError: /* @__PURE__ */ u(function(c, a) {
|
198
|
+
if (this.yy.parser)
|
199
|
+
this.yy.parser.parseError(c, a);
|
200
|
+
else
|
201
|
+
throw new Error(c);
|
202
|
+
}, "parseError"),
|
203
|
+
// resets the lexer, sets new input
|
204
|
+
setInput: /* @__PURE__ */ u(function(l, c) {
|
205
|
+
return this.yy = c || this.yy || {}, this._input = l, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
|
206
|
+
first_line: 1,
|
207
|
+
first_column: 0,
|
208
|
+
last_line: 1,
|
209
|
+
last_column: 0
|
210
|
+
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
|
211
|
+
}, "setInput"),
|
212
|
+
// consumes and returns one char from the input
|
213
|
+
input: /* @__PURE__ */ u(function() {
|
214
|
+
var l = this._input[0];
|
215
|
+
this.yytext += l, this.yyleng++, this.offset++, this.match += l, this.matched += l;
|
216
|
+
var c = l.match(/(?:\r\n?|\n).*/g);
|
217
|
+
return c ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), l;
|
218
|
+
}, "input"),
|
219
|
+
// unshifts one char (or a string) into the input
|
220
|
+
unput: /* @__PURE__ */ u(function(l) {
|
221
|
+
var c = l.length, a = l.split(/(?:\r\n?|\n)/g);
|
222
|
+
this._input = l + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - c), this.offset -= c;
|
223
|
+
var y = this.match.split(/(?:\r\n?|\n)/g);
|
224
|
+
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), a.length - 1 && (this.yylineno -= a.length - 1);
|
225
|
+
var _ = this.yylloc.range;
|
226
|
+
return this.yylloc = {
|
227
|
+
first_line: this.yylloc.first_line,
|
228
|
+
last_line: this.yylineno + 1,
|
229
|
+
first_column: this.yylloc.first_column,
|
230
|
+
last_column: a ? (a.length === y.length ? this.yylloc.first_column : 0) + y[y.length - a.length].length - a[0].length : this.yylloc.first_column - c
|
231
|
+
}, this.options.ranges && (this.yylloc.range = [_[0], _[0] + this.yyleng - c]), this.yyleng = this.yytext.length, this;
|
232
|
+
}, "unput"),
|
233
|
+
// When called from action, caches matched text and appends it on next action
|
234
|
+
more: /* @__PURE__ */ u(function() {
|
235
|
+
return this._more = !0, this;
|
236
|
+
}, "more"),
|
237
|
+
// 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.
|
238
|
+
reject: /* @__PURE__ */ u(function() {
|
239
|
+
if (this.options.backtrack_lexer)
|
240
|
+
this._backtrack = !0;
|
241
|
+
else
|
242
|
+
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).
|
243
|
+
` + this.showPosition(), {
|
244
|
+
text: "",
|
245
|
+
token: null,
|
246
|
+
line: this.yylineno
|
247
|
+
});
|
248
|
+
return this;
|
249
|
+
}, "reject"),
|
250
|
+
// retain first n characters of the match
|
251
|
+
less: /* @__PURE__ */ u(function(l) {
|
252
|
+
this.unput(this.match.slice(l));
|
253
|
+
}, "less"),
|
254
|
+
// displays already matched input, i.e. for error messages
|
255
|
+
pastInput: /* @__PURE__ */ u(function() {
|
256
|
+
var l = this.matched.substr(0, this.matched.length - this.match.length);
|
257
|
+
return (l.length > 20 ? "..." : "") + l.substr(-20).replace(/\n/g, "");
|
258
|
+
}, "pastInput"),
|
259
|
+
// displays upcoming input, i.e. for error messages
|
260
|
+
upcomingInput: /* @__PURE__ */ u(function() {
|
261
|
+
var l = this.match;
|
262
|
+
return l.length < 20 && (l += this._input.substr(0, 20 - l.length)), (l.substr(0, 20) + (l.length > 20 ? "..." : "")).replace(/\n/g, "");
|
263
|
+
}, "upcomingInput"),
|
264
|
+
// displays the character position where the lexing error occurred, i.e. for error messages
|
265
|
+
showPosition: /* @__PURE__ */ u(function() {
|
266
|
+
var l = this.pastInput(), c = new Array(l.length + 1).join("-");
|
267
|
+
return l + this.upcomingInput() + `
|
268
|
+
` + c + "^";
|
269
|
+
}, "showPosition"),
|
270
|
+
// test the lexed token: return FALSE when not a match, otherwise return token
|
271
|
+
test_match: /* @__PURE__ */ u(function(l, c) {
|
272
|
+
var a, y, _;
|
273
|
+
if (this.options.backtrack_lexer && (_ = {
|
274
|
+
yylineno: this.yylineno,
|
275
|
+
yylloc: {
|
276
|
+
first_line: this.yylloc.first_line,
|
277
|
+
last_line: this.last_line,
|
278
|
+
first_column: this.yylloc.first_column,
|
279
|
+
last_column: this.yylloc.last_column
|
280
|
+
},
|
281
|
+
yytext: this.yytext,
|
282
|
+
match: this.match,
|
283
|
+
matches: this.matches,
|
284
|
+
matched: this.matched,
|
285
|
+
yyleng: this.yyleng,
|
286
|
+
offset: this.offset,
|
287
|
+
_more: this._more,
|
288
|
+
_input: this._input,
|
289
|
+
yy: this.yy,
|
290
|
+
conditionStack: this.conditionStack.slice(0),
|
291
|
+
done: this.done
|
292
|
+
}, this.options.ranges && (_.yylloc.range = this.yylloc.range.slice(0))), y = l[0].match(/(?:\r\n?|\n).*/g), y && (this.yylineno += y.length), this.yylloc = {
|
293
|
+
first_line: this.yylloc.last_line,
|
294
|
+
last_line: this.yylineno + 1,
|
295
|
+
first_column: this.yylloc.last_column,
|
296
|
+
last_column: y ? y[y.length - 1].length - y[y.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + l[0].length
|
297
|
+
}, this.yytext += l[0], this.match += l[0], this.matches = l, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(l[0].length), this.matched += l[0], a = this.performAction.call(this, this.yy, this, c, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), a)
|
298
|
+
return a;
|
299
|
+
if (this._backtrack) {
|
300
|
+
for (var s in _)
|
301
|
+
this[s] = _[s];
|
302
|
+
return !1;
|
303
|
+
}
|
304
|
+
return !1;
|
305
|
+
}, "test_match"),
|
306
|
+
// return next match in input
|
307
|
+
next: /* @__PURE__ */ u(function() {
|
308
|
+
if (this.done)
|
309
|
+
return this.EOF;
|
310
|
+
this._input || (this.done = !0);
|
311
|
+
var l, c, a, y;
|
312
|
+
this._more || (this.yytext = "", this.match = "");
|
313
|
+
for (var _ = this._currentRules(), s = 0; s < _.length; s++)
|
314
|
+
if (a = this._input.match(this.rules[_[s]]), a && (!c || a[0].length > c[0].length)) {
|
315
|
+
if (c = a, y = s, this.options.backtrack_lexer) {
|
316
|
+
if (l = this.test_match(a, _[s]), l !== !1)
|
317
|
+
return l;
|
318
|
+
if (this._backtrack) {
|
319
|
+
c = !1;
|
320
|
+
continue;
|
321
|
+
} else
|
322
|
+
return !1;
|
323
|
+
} else if (!this.options.flex)
|
324
|
+
break;
|
325
|
+
}
|
326
|
+
return c ? (l = this.test_match(c, _[y]), l !== !1 ? l : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
|
327
|
+
` + this.showPosition(), {
|
328
|
+
text: "",
|
329
|
+
token: null,
|
330
|
+
line: this.yylineno
|
331
|
+
});
|
332
|
+
}, "next"),
|
333
|
+
// return next match that has a token
|
334
|
+
lex: /* @__PURE__ */ u(function() {
|
335
|
+
var c = this.next();
|
336
|
+
return c || this.lex();
|
337
|
+
}, "lex"),
|
338
|
+
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
339
|
+
begin: /* @__PURE__ */ u(function(c) {
|
340
|
+
this.conditionStack.push(c);
|
341
|
+
}, "begin"),
|
342
|
+
// pop the previously active lexer condition state off the condition stack
|
343
|
+
popState: /* @__PURE__ */ u(function() {
|
344
|
+
var c = this.conditionStack.length - 1;
|
345
|
+
return c > 0 ? this.conditionStack.pop() : this.conditionStack[0];
|
346
|
+
}, "popState"),
|
347
|
+
// produce the lexer rule set which is active for the currently active lexer condition state
|
348
|
+
_currentRules: /* @__PURE__ */ u(function() {
|
349
|
+
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
|
350
|
+
}, "_currentRules"),
|
351
|
+
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
352
|
+
topState: /* @__PURE__ */ u(function(c) {
|
353
|
+
return c = this.conditionStack.length - 1 - Math.abs(c || 0), c >= 0 ? this.conditionStack[c] : "INITIAL";
|
354
|
+
}, "topState"),
|
355
|
+
// alias for begin(condition)
|
356
|
+
pushState: /* @__PURE__ */ u(function(c) {
|
357
|
+
this.begin(c);
|
358
|
+
}, "pushState"),
|
359
|
+
// return the number of states currently on the stack
|
360
|
+
stateStackSize: /* @__PURE__ */ u(function() {
|
361
|
+
return this.conditionStack.length;
|
362
|
+
}, "stateStackSize"),
|
363
|
+
options: { "case-insensitive": !0 },
|
364
|
+
performAction: /* @__PURE__ */ u(function(c, a, y, _) {
|
365
|
+
switch (y) {
|
366
|
+
case 0:
|
367
|
+
return 41;
|
368
|
+
case 1:
|
369
|
+
return 48;
|
370
|
+
case 2:
|
371
|
+
return 49;
|
372
|
+
case 3:
|
373
|
+
return 50;
|
374
|
+
case 4:
|
375
|
+
return 51;
|
376
|
+
case 5:
|
377
|
+
break;
|
378
|
+
case 6:
|
379
|
+
break;
|
380
|
+
case 7:
|
381
|
+
return 5;
|
382
|
+
case 8:
|
383
|
+
break;
|
384
|
+
case 9:
|
385
|
+
break;
|
386
|
+
case 10:
|
387
|
+
break;
|
388
|
+
case 11:
|
389
|
+
break;
|
390
|
+
case 12:
|
391
|
+
return this.pushState("SCALE"), 17;
|
392
|
+
case 13:
|
393
|
+
return 18;
|
394
|
+
case 14:
|
395
|
+
this.popState();
|
396
|
+
break;
|
397
|
+
case 15:
|
398
|
+
return this.begin("acc_title"), 33;
|
399
|
+
case 16:
|
400
|
+
return this.popState(), "acc_title_value";
|
401
|
+
case 17:
|
402
|
+
return this.begin("acc_descr"), 35;
|
403
|
+
case 18:
|
404
|
+
return this.popState(), "acc_descr_value";
|
405
|
+
case 19:
|
406
|
+
this.begin("acc_descr_multiline");
|
407
|
+
break;
|
408
|
+
case 20:
|
409
|
+
this.popState();
|
410
|
+
break;
|
411
|
+
case 21:
|
412
|
+
return "acc_descr_multiline_value";
|
413
|
+
case 22:
|
414
|
+
return this.pushState("CLASSDEF"), 38;
|
415
|
+
case 23:
|
416
|
+
return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
|
417
|
+
case 24:
|
418
|
+
return this.popState(), this.pushState("CLASSDEFID"), 39;
|
419
|
+
case 25:
|
420
|
+
return this.popState(), 40;
|
421
|
+
case 26:
|
422
|
+
return this.pushState("CLASS"), 45;
|
423
|
+
case 27:
|
424
|
+
return this.popState(), this.pushState("CLASS_STYLE"), 46;
|
425
|
+
case 28:
|
426
|
+
return this.popState(), 47;
|
427
|
+
case 29:
|
428
|
+
return this.pushState("STYLE"), 42;
|
429
|
+
case 30:
|
430
|
+
return this.popState(), this.pushState("STYLEDEF_STYLES"), 43;
|
431
|
+
case 31:
|
432
|
+
return this.popState(), 44;
|
433
|
+
case 32:
|
434
|
+
return this.pushState("SCALE"), 17;
|
435
|
+
case 33:
|
436
|
+
return 18;
|
437
|
+
case 34:
|
438
|
+
this.popState();
|
439
|
+
break;
|
440
|
+
case 35:
|
441
|
+
this.pushState("STATE");
|
442
|
+
break;
|
443
|
+
case 36:
|
444
|
+
return this.popState(), a.yytext = a.yytext.slice(0, -8).trim(), 25;
|
445
|
+
case 37:
|
446
|
+
return this.popState(), a.yytext = a.yytext.slice(0, -8).trim(), 26;
|
447
|
+
case 38:
|
448
|
+
return this.popState(), a.yytext = a.yytext.slice(0, -10).trim(), 27;
|
449
|
+
case 39:
|
450
|
+
return this.popState(), a.yytext = a.yytext.slice(0, -8).trim(), 25;
|
451
|
+
case 40:
|
452
|
+
return this.popState(), a.yytext = a.yytext.slice(0, -8).trim(), 26;
|
453
|
+
case 41:
|
454
|
+
return this.popState(), a.yytext = a.yytext.slice(0, -10).trim(), 27;
|
455
|
+
case 42:
|
456
|
+
return 48;
|
457
|
+
case 43:
|
458
|
+
return 49;
|
459
|
+
case 44:
|
460
|
+
return 50;
|
461
|
+
case 45:
|
462
|
+
return 51;
|
463
|
+
case 46:
|
464
|
+
this.pushState("STATE_STRING");
|
465
|
+
break;
|
466
|
+
case 47:
|
467
|
+
return this.pushState("STATE_ID"), "AS";
|
468
|
+
case 48:
|
469
|
+
return this.popState(), "ID";
|
470
|
+
case 49:
|
471
|
+
this.popState();
|
472
|
+
break;
|
473
|
+
case 50:
|
474
|
+
return "STATE_DESCR";
|
475
|
+
case 51:
|
476
|
+
return 19;
|
477
|
+
case 52:
|
478
|
+
this.popState();
|
479
|
+
break;
|
480
|
+
case 53:
|
481
|
+
return this.popState(), this.pushState("struct"), 20;
|
482
|
+
case 54:
|
483
|
+
break;
|
484
|
+
case 55:
|
485
|
+
return this.popState(), 21;
|
486
|
+
case 56:
|
487
|
+
break;
|
488
|
+
case 57:
|
489
|
+
return this.begin("NOTE"), 29;
|
490
|
+
case 58:
|
491
|
+
return this.popState(), this.pushState("NOTE_ID"), 56;
|
492
|
+
case 59:
|
493
|
+
return this.popState(), this.pushState("NOTE_ID"), 57;
|
494
|
+
case 60:
|
495
|
+
this.popState(), this.pushState("FLOATING_NOTE");
|
496
|
+
break;
|
497
|
+
case 61:
|
498
|
+
return this.popState(), this.pushState("FLOATING_NOTE_ID"), "AS";
|
499
|
+
case 62:
|
500
|
+
break;
|
501
|
+
case 63:
|
502
|
+
return "NOTE_TEXT";
|
503
|
+
case 64:
|
504
|
+
return this.popState(), "ID";
|
505
|
+
case 65:
|
506
|
+
return this.popState(), this.pushState("NOTE_TEXT"), 24;
|
507
|
+
case 66:
|
508
|
+
return this.popState(), a.yytext = a.yytext.substr(2).trim(), 31;
|
509
|
+
case 67:
|
510
|
+
return this.popState(), a.yytext = a.yytext.slice(0, -8).trim(), 31;
|
511
|
+
case 68:
|
512
|
+
return 6;
|
513
|
+
case 69:
|
514
|
+
return 6;
|
515
|
+
case 70:
|
516
|
+
return 16;
|
517
|
+
case 71:
|
518
|
+
return 54;
|
519
|
+
case 72:
|
520
|
+
return 24;
|
521
|
+
case 73:
|
522
|
+
return a.yytext = a.yytext.trim(), 14;
|
523
|
+
case 74:
|
524
|
+
return 15;
|
525
|
+
case 75:
|
526
|
+
return 28;
|
527
|
+
case 76:
|
528
|
+
return 55;
|
529
|
+
case 77:
|
530
|
+
return 5;
|
531
|
+
case 78:
|
532
|
+
return "INVALID";
|
533
|
+
}
|
534
|
+
}, "anonymous"),
|
535
|
+
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],
|
536
|
+
conditions: { LINE: { rules: [9, 10], inclusive: !1 }, struct: { rules: [9, 10, 22, 26, 29, 35, 42, 43, 44, 45, 54, 55, 56, 57, 71, 72, 73, 74, 75], inclusive: !1 }, FLOATING_NOTE_ID: { rules: [64], inclusive: !1 }, FLOATING_NOTE: { rules: [61, 62, 63], inclusive: !1 }, NOTE_TEXT: { rules: [66, 67], inclusive: !1 }, NOTE_ID: { rules: [65], inclusive: !1 }, NOTE: { rules: [58, 59, 60], inclusive: !1 }, STYLEDEF_STYLEOPTS: { rules: [], inclusive: !1 }, STYLEDEF_STYLES: { rules: [31], inclusive: !1 }, STYLE_IDS: { rules: [], inclusive: !1 }, STYLE: { rules: [30], inclusive: !1 }, CLASS_STYLE: { rules: [28], inclusive: !1 }, CLASS: { rules: [27], inclusive: !1 }, CLASSDEFID: { rules: [25], inclusive: !1 }, CLASSDEF: { rules: [23, 24], inclusive: !1 }, acc_descr_multiline: { rules: [20, 21], inclusive: !1 }, acc_descr: { rules: [18], inclusive: !1 }, acc_title: { rules: [16], inclusive: !1 }, SCALE: { rules: [13, 14, 33, 34], inclusive: !1 }, ALIAS: { rules: [], inclusive: !1 }, STATE_ID: { rules: [48], inclusive: !1 }, STATE_STRING: { rules: [49, 50], inclusive: !1 }, FORK_STATE: { rules: [], inclusive: !1 }, STATE: { rules: [9, 10, 36, 37, 38, 39, 40, 41, 46, 47, 51, 52, 53], inclusive: !1 }, ID: { rules: [9, 10], inclusive: !1 }, 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: !0 } }
|
537
|
+
};
|
538
|
+
return w;
|
539
|
+
}();
|
540
|
+
ft.lexer = Qt;
|
541
|
+
function at() {
|
542
|
+
this.yy = {};
|
543
|
+
}
|
544
|
+
return u(at, "Parser"), at.prototype = ft, ft.Parser = at, new at();
|
545
|
+
}();
|
546
|
+
mt.parser = mt;
|
547
|
+
var Ue = mt, pe = "TB", Ft = "TB", Lt = "dir", ht = "state", bt = "relation", Se = "classDef", ye = "style", ge = "applyClass", K = "default", Vt = "divider", Mt = "fill:none", Ut = "fill: #333", jt = "c", Ht = "text", zt = "normal", _t = "rect", Et = "rectWithTitle", Te = "stateStart", _e = "stateEnd", It = "divider", Rt = "roundedWithTitle", Ee = "note", me = "noteGroup", J = "statediagram", be = "state", De = `${J}-${be}`, Wt = "transition", ve = "note", ke = "note-edge", Ce = `${Wt} ${ke}`, xe = `${J}-${ve}`, Ae = "cluster", Le = `${J}-${Ae}`, Ie = "cluster-alt", Re = `${J}-${Ie}`, Xt = "parent", Kt = "note", Oe = "state", kt = "----", Ne = `${kt}${Kt}`, Ot = `${kt}${Xt}`, Jt = /* @__PURE__ */ u((t, e = Ft) => {
|
548
|
+
if (!t.doc)
|
549
|
+
return e;
|
550
|
+
let o = e;
|
551
|
+
for (const r of t.doc)
|
552
|
+
r.stmt === "dir" && (o = r.value);
|
553
|
+
return o;
|
554
|
+
}, "getDir"), we = /* @__PURE__ */ u(function(t, e) {
|
555
|
+
return e.db.getClasses();
|
556
|
+
}, "getClasses"), $e = /* @__PURE__ */ u(async function(t, e, o, r) {
|
557
|
+
b.info("REF0:"), b.info("Drawing state diagram (v2)", e);
|
558
|
+
const { securityLevel: d, state: i, layout: p } = C();
|
559
|
+
r.db.extract(r.db.getRootDocV2());
|
560
|
+
const g = r.db.getData(), n = se(e, d);
|
561
|
+
g.type = r.type, g.layoutAlgorithm = p, g.nodeSpacing = i?.nodeSpacing || 50, g.rankSpacing = i?.rankSpacing || 50, g.markers = ["barb"], g.diagramId = e, await re(g, n);
|
562
|
+
const T = 8;
|
563
|
+
ae.insertTitle(
|
564
|
+
n,
|
565
|
+
"statediagramTitleText",
|
566
|
+
i?.titleTopMargin ?? 25,
|
567
|
+
r.db.getDiagramTitle()
|
568
|
+
), ie(n, T, J, i?.useMaxWidth ?? !0);
|
569
|
+
}, "draw"), je = {
|
570
|
+
getClasses: we,
|
571
|
+
draw: $e,
|
572
|
+
getDir: Jt
|
573
|
+
}, ut = /* @__PURE__ */ new Map(), $ = 0;
|
574
|
+
function dt(t = "", e = 0, o = "", r = kt) {
|
575
|
+
const d = o !== null && o.length > 0 ? `${r}${o}` : "";
|
576
|
+
return `${Oe}-${t}${d}-${e}`;
|
577
|
+
}
|
578
|
+
u(dt, "stateDomId");
|
579
|
+
var Pe = /* @__PURE__ */ u((t, e, o, r, d, i, p, g) => {
|
580
|
+
b.trace("items", e), e.forEach((n) => {
|
581
|
+
switch (n.stmt) {
|
582
|
+
case ht:
|
583
|
+
X(t, n, o, r, d, i, p, g);
|
584
|
+
break;
|
585
|
+
case K:
|
586
|
+
X(t, n, o, r, d, i, p, g);
|
587
|
+
break;
|
588
|
+
case bt:
|
589
|
+
{
|
590
|
+
X(
|
591
|
+
t,
|
592
|
+
n.state1,
|
593
|
+
o,
|
594
|
+
r,
|
595
|
+
d,
|
596
|
+
i,
|
597
|
+
p,
|
598
|
+
g
|
599
|
+
), X(
|
600
|
+
t,
|
601
|
+
n.state2,
|
602
|
+
o,
|
603
|
+
r,
|
604
|
+
d,
|
605
|
+
i,
|
606
|
+
p,
|
607
|
+
g
|
608
|
+
);
|
609
|
+
const T = {
|
610
|
+
id: "edge" + $,
|
611
|
+
start: n.state1.id,
|
612
|
+
end: n.state2.id,
|
613
|
+
arrowhead: "normal",
|
614
|
+
arrowTypeEnd: "arrow_barb",
|
615
|
+
style: Mt,
|
616
|
+
labelStyle: "",
|
617
|
+
label: V.sanitizeText(n.description, C()),
|
618
|
+
arrowheadStyle: Ut,
|
619
|
+
labelpos: jt,
|
620
|
+
labelType: Ht,
|
621
|
+
thickness: zt,
|
622
|
+
classes: Wt,
|
623
|
+
look: p
|
624
|
+
};
|
625
|
+
d.push(T), $++;
|
626
|
+
}
|
627
|
+
break;
|
628
|
+
}
|
629
|
+
});
|
630
|
+
}, "setupDoc"), Nt = /* @__PURE__ */ u((t, e = Ft) => {
|
631
|
+
let o = e;
|
632
|
+
if (t.doc)
|
633
|
+
for (const r of t.doc)
|
634
|
+
r.stmt === "dir" && (o = r.value);
|
635
|
+
return o;
|
636
|
+
}, "getDir");
|
637
|
+
function W(t, e, o) {
|
638
|
+
if (!e.id || e.id === "</join></fork>" || e.id === "</choice>")
|
639
|
+
return;
|
640
|
+
e.cssClasses && (Array.isArray(e.cssCompiledStyles) || (e.cssCompiledStyles = []), e.cssClasses.split(" ").forEach((d) => {
|
641
|
+
if (o.get(d)) {
|
642
|
+
const i = o.get(d);
|
643
|
+
e.cssCompiledStyles = [...e.cssCompiledStyles, ...i.styles];
|
644
|
+
}
|
645
|
+
}));
|
646
|
+
const r = t.find((d) => d.id === e.id);
|
647
|
+
r ? Object.assign(r, e) : t.push(e);
|
648
|
+
}
|
649
|
+
u(W, "insertOrUpdateNode");
|
650
|
+
function qt(t) {
|
651
|
+
return t?.classes?.join(" ") ?? "";
|
652
|
+
}
|
653
|
+
u(qt, "getClassesFromDbInfo");
|
654
|
+
function Zt(t) {
|
655
|
+
return t?.styles ?? [];
|
656
|
+
}
|
657
|
+
u(Zt, "getStylesFromDbInfo");
|
658
|
+
var X = /* @__PURE__ */ u((t, e, o, r, d, i, p, g) => {
|
659
|
+
const n = e.id, T = o.get(n), m = qt(T), R = Zt(T);
|
660
|
+
if (b.info("dataFetcher parsedItem", e, T, R), n !== "root") {
|
661
|
+
let A = _t;
|
662
|
+
e.start === !0 ? A = Te : e.start === !1 && (A = _e), e.type !== K && (A = e.type), ut.get(n) || ut.set(n, {
|
663
|
+
id: n,
|
664
|
+
shape: A,
|
665
|
+
description: V.sanitizeText(n, C()),
|
666
|
+
cssClasses: `${m} ${De}`,
|
667
|
+
cssStyles: R
|
668
|
+
});
|
669
|
+
const f = ut.get(n);
|
670
|
+
e.description && (Array.isArray(f.description) ? (f.shape = Et, f.description.push(e.description)) : f.description?.length > 0 ? (f.shape = Et, f.description === n ? f.description = [e.description] : f.description = [f.description, e.description]) : (f.shape = _t, f.description = e.description), f.description = V.sanitizeTextOrArray(f.description, C())), f.description?.length === 1 && f.shape === Et && (f.type === "group" ? f.shape = Rt : f.shape = _t), !f.type && e.doc && (b.info("Setting cluster for XCX", n, Nt(e)), f.type = "group", f.isGroup = !0, f.dir = Nt(e), f.shape = e.type === Vt ? It : Rt, f.cssClasses = `${f.cssClasses} ${Le} ${i ? Re : ""}`);
|
671
|
+
const x = {
|
672
|
+
labelStyle: "",
|
673
|
+
shape: f.shape,
|
674
|
+
label: f.description,
|
675
|
+
cssClasses: f.cssClasses,
|
676
|
+
cssCompiledStyles: [],
|
677
|
+
cssStyles: f.cssStyles,
|
678
|
+
id: n,
|
679
|
+
dir: f.dir,
|
680
|
+
domId: dt(n, $),
|
681
|
+
type: f.type,
|
682
|
+
isGroup: f.type === "group",
|
683
|
+
padding: 8,
|
684
|
+
rx: 10,
|
685
|
+
ry: 10,
|
686
|
+
look: p
|
687
|
+
};
|
688
|
+
if (x.shape === It && (x.label = ""), t && t.id !== "root" && (b.trace("Setting node ", n, " to be child of its parent ", t.id), x.parentId = t.id), x.centerLabel = !0, e.note) {
|
689
|
+
const L = {
|
690
|
+
labelStyle: "",
|
691
|
+
shape: Ee,
|
692
|
+
label: e.note.text,
|
693
|
+
cssClasses: xe,
|
694
|
+
// useHtmlLabels: false,
|
695
|
+
cssStyles: [],
|
696
|
+
cssCompilesStyles: [],
|
697
|
+
id: n + Ne + "-" + $,
|
698
|
+
domId: dt(n, $, Kt),
|
699
|
+
type: f.type,
|
700
|
+
isGroup: f.type === "group",
|
701
|
+
padding: C().flowchart.padding,
|
702
|
+
look: p,
|
703
|
+
position: e.note.position
|
704
|
+
}, P = n + Ot, B = {
|
705
|
+
labelStyle: "",
|
706
|
+
shape: me,
|
707
|
+
label: e.note.text,
|
708
|
+
cssClasses: f.cssClasses,
|
709
|
+
cssStyles: [],
|
710
|
+
id: n + Ot,
|
711
|
+
domId: dt(n, $, Xt),
|
712
|
+
type: "group",
|
713
|
+
isGroup: !0,
|
714
|
+
padding: 16,
|
715
|
+
//getConfig().flowchart.padding
|
716
|
+
look: p,
|
717
|
+
position: e.note.position
|
718
|
+
};
|
719
|
+
$++, B.id = P, L.parentId = P, W(r, B, g), W(r, L, g), W(r, x, g);
|
720
|
+
let O = n, N = L.id;
|
721
|
+
e.note.position === "left of" && (O = L.id, N = n), d.push({
|
722
|
+
id: O + "-" + N,
|
723
|
+
start: O,
|
724
|
+
end: N,
|
725
|
+
arrowhead: "none",
|
726
|
+
arrowTypeEnd: "",
|
727
|
+
style: Mt,
|
728
|
+
labelStyle: "",
|
729
|
+
classes: Ce,
|
730
|
+
arrowheadStyle: Ut,
|
731
|
+
labelpos: jt,
|
732
|
+
labelType: Ht,
|
733
|
+
thickness: zt,
|
734
|
+
look: p
|
735
|
+
});
|
736
|
+
} else
|
737
|
+
W(r, x, g);
|
738
|
+
}
|
739
|
+
e.doc && (b.trace("Adding nodes children "), Pe(e, e.doc, o, r, d, !i, p, g));
|
740
|
+
}, "dataFetcher"), Be = /* @__PURE__ */ u(() => {
|
741
|
+
ut.clear(), $ = 0;
|
742
|
+
}, "reset"), Dt = "[*]", wt = "start", $t = Dt, Pt = "end", Bt = "color", Gt = "fill", Ge = "bgFill", Ye = ",";
|
743
|
+
function vt() {
|
744
|
+
return /* @__PURE__ */ new Map();
|
745
|
+
}
|
746
|
+
u(vt, "newClassesList");
|
747
|
+
var Yt = /* @__PURE__ */ u(() => ({
|
748
|
+
/** @type {{ id1: string, id2: string, relationTitle: string }[]} */
|
749
|
+
relations: [],
|
750
|
+
states: /* @__PURE__ */ new Map(),
|
751
|
+
documents: {}
|
752
|
+
}), "newDoc"), ct = /* @__PURE__ */ u((t) => JSON.parse(JSON.stringify(t)), "clone"), He = class {
|
753
|
+
static {
|
754
|
+
u(this, "StateDB");
|
755
|
+
}
|
756
|
+
/**
|
757
|
+
* @param {1 | 2} version - v1 renderer or v2 renderer.
|
758
|
+
*/
|
759
|
+
constructor(t) {
|
760
|
+
this.clear(), this.version = t, this.setRootDoc = this.setRootDoc.bind(this), this.getDividerId = this.getDividerId.bind(this), this.setDirection = this.setDirection.bind(this), this.trimColon = this.trimColon.bind(this);
|
761
|
+
}
|
762
|
+
/**
|
763
|
+
* @private
|
764
|
+
* @type {1 | 2}
|
765
|
+
*/
|
766
|
+
version;
|
767
|
+
/**
|
768
|
+
* @private
|
769
|
+
* @type {Array}
|
770
|
+
*/
|
771
|
+
nodes = [];
|
772
|
+
/**
|
773
|
+
* @private
|
774
|
+
* @type {Array}
|
775
|
+
*/
|
776
|
+
edges = [];
|
777
|
+
/**
|
778
|
+
* @private
|
779
|
+
* @type {Array}
|
780
|
+
*/
|
781
|
+
rootDoc = [];
|
782
|
+
/**
|
783
|
+
* @private
|
784
|
+
* @type {Map<string, any>}
|
785
|
+
*/
|
786
|
+
classes = vt();
|
787
|
+
// style classes defined by a classDef
|
788
|
+
/**
|
789
|
+
* @private
|
790
|
+
* @type {Object}
|
791
|
+
*/
|
792
|
+
documents = {
|
793
|
+
root: Yt()
|
794
|
+
};
|
795
|
+
/**
|
796
|
+
* @private
|
797
|
+
* @type {Object}
|
798
|
+
*/
|
799
|
+
currentDocument = this.documents.root;
|
800
|
+
/**
|
801
|
+
* @private
|
802
|
+
* @type {number}
|
803
|
+
*/
|
804
|
+
startEndCount = 0;
|
805
|
+
/**
|
806
|
+
* @private
|
807
|
+
* @type {number}
|
808
|
+
*/
|
809
|
+
dividerCnt = 0;
|
810
|
+
static relationType = {
|
811
|
+
AGGREGATION: 0,
|
812
|
+
EXTENSION: 1,
|
813
|
+
COMPOSITION: 2,
|
814
|
+
DEPENDENCY: 3
|
815
|
+
};
|
816
|
+
setRootDoc(t) {
|
817
|
+
b.info("Setting root doc", t), this.rootDoc = t, this.version === 1 ? this.extract(t) : this.extract(this.getRootDocV2());
|
818
|
+
}
|
819
|
+
getRootDoc() {
|
820
|
+
return this.rootDoc;
|
821
|
+
}
|
822
|
+
/**
|
823
|
+
* @private
|
824
|
+
* @param {Object} parent
|
825
|
+
* @param {Object} node
|
826
|
+
* @param {boolean} first
|
827
|
+
*/
|
828
|
+
docTranslator(t, e, o) {
|
829
|
+
if (e.stmt === bt)
|
830
|
+
this.docTranslator(t, e.state1, !0), this.docTranslator(t, e.state2, !1);
|
831
|
+
else if (e.stmt === ht && (e.id === "[*]" ? (e.id = o ? t.id + "_start" : t.id + "_end", e.start = o) : e.id = e.id.trim()), e.doc) {
|
832
|
+
const r = [];
|
833
|
+
let d = [], i;
|
834
|
+
for (i = 0; i < e.doc.length; i++)
|
835
|
+
if (e.doc[i].type === Vt) {
|
836
|
+
const p = ct(e.doc[i]);
|
837
|
+
p.doc = ct(d), r.push(p), d = [];
|
838
|
+
} else
|
839
|
+
d.push(e.doc[i]);
|
840
|
+
if (r.length > 0 && d.length > 0) {
|
841
|
+
const p = {
|
842
|
+
stmt: ht,
|
843
|
+
id: ne(),
|
844
|
+
type: "divider",
|
845
|
+
doc: ct(d)
|
846
|
+
};
|
847
|
+
r.push(ct(p)), e.doc = r;
|
848
|
+
}
|
849
|
+
e.doc.forEach((p) => this.docTranslator(e, p, !0));
|
850
|
+
}
|
851
|
+
}
|
852
|
+
/**
|
853
|
+
* @private
|
854
|
+
*/
|
855
|
+
getRootDocV2() {
|
856
|
+
return this.docTranslator({ id: "root" }, { id: "root", doc: this.rootDoc }, !0), { id: "root", doc: this.rootDoc };
|
857
|
+
}
|
858
|
+
/**
|
859
|
+
* Convert all of the statements (stmts) that were parsed into states and relationships.
|
860
|
+
* This is done because a state diagram may have nested sections,
|
861
|
+
* where each section is a 'document' and has its own set of statements.
|
862
|
+
* Ex: the section within a fork has its own statements, and incoming and outgoing statements
|
863
|
+
* refer to the fork as a whole (document).
|
864
|
+
* See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement.
|
865
|
+
* This will push the statement into the list of statements for the current document.
|
866
|
+
* @private
|
867
|
+
* @param _doc
|
868
|
+
*/
|
869
|
+
extract(t) {
|
870
|
+
let e;
|
871
|
+
t.doc ? e = t.doc : e = t, b.info(e), this.clear(!0), b.info("Extract initial document:", e), e.forEach((i) => {
|
872
|
+
switch (b.warn("Statement", i.stmt), i.stmt) {
|
873
|
+
case ht:
|
874
|
+
this.addState(
|
875
|
+
i.id.trim(),
|
876
|
+
i.type,
|
877
|
+
i.doc,
|
878
|
+
i.description,
|
879
|
+
i.note,
|
880
|
+
i.classes,
|
881
|
+
i.styles,
|
882
|
+
i.textStyles
|
883
|
+
);
|
884
|
+
break;
|
885
|
+
case bt:
|
886
|
+
this.addRelation(i.state1, i.state2, i.description);
|
887
|
+
break;
|
888
|
+
case Se:
|
889
|
+
this.addStyleClass(i.id.trim(), i.classes);
|
890
|
+
break;
|
891
|
+
case ye:
|
892
|
+
{
|
893
|
+
const p = i.id.trim().split(","), g = i.styleClass.split(",");
|
894
|
+
p.forEach((n) => {
|
895
|
+
let T = this.getState(n);
|
896
|
+
if (T === void 0) {
|
897
|
+
const m = n.trim();
|
898
|
+
this.addState(m), T = this.getState(m);
|
899
|
+
}
|
900
|
+
T.styles = g.map((m) => m.replace(/;/g, "")?.trim());
|
901
|
+
});
|
902
|
+
}
|
903
|
+
break;
|
904
|
+
case ge:
|
905
|
+
this.setCssClass(i.id.trim(), i.styleClass);
|
906
|
+
break;
|
907
|
+
}
|
908
|
+
});
|
909
|
+
const o = this.getStates(), d = C().look;
|
910
|
+
Be(), X(
|
911
|
+
void 0,
|
912
|
+
this.getRootDocV2(),
|
913
|
+
o,
|
914
|
+
this.nodes,
|
915
|
+
this.edges,
|
916
|
+
!0,
|
917
|
+
d,
|
918
|
+
this.classes
|
919
|
+
), this.nodes.forEach((i) => {
|
920
|
+
if (Array.isArray(i.label)) {
|
921
|
+
if (i.description = i.label.slice(1), i.isGroup && i.description.length > 0)
|
922
|
+
throw new Error(
|
923
|
+
"Group nodes can only have label. Remove the additional description for node [" + i.id + "]"
|
924
|
+
);
|
925
|
+
i.label = i.label[0];
|
926
|
+
}
|
927
|
+
});
|
928
|
+
}
|
929
|
+
/**
|
930
|
+
* Function called by parser when a node definition has been found.
|
931
|
+
*
|
932
|
+
* @param {null | string} id
|
933
|
+
* @param {null | string} type
|
934
|
+
* @param {null | string} doc
|
935
|
+
* @param {null | string | string[]} descr - description for the state. Can be a string or a list or strings
|
936
|
+
* @param {null | string} note
|
937
|
+
* @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.
|
938
|
+
* @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.
|
939
|
+
* @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.
|
940
|
+
*/
|
941
|
+
addState(t, e = K, o = null, r = null, d = null, i = null, p = null, g = null) {
|
942
|
+
const n = t?.trim();
|
943
|
+
if (this.currentDocument.states.has(n) ? (this.currentDocument.states.get(n).doc || (this.currentDocument.states.get(n).doc = o), this.currentDocument.states.get(n).type || (this.currentDocument.states.get(n).type = e)) : (b.info("Adding state ", n, r), this.currentDocument.states.set(n, {
|
944
|
+
id: n,
|
945
|
+
descriptions: [],
|
946
|
+
type: e,
|
947
|
+
doc: o,
|
948
|
+
note: d,
|
949
|
+
classes: [],
|
950
|
+
styles: [],
|
951
|
+
textStyles: []
|
952
|
+
})), r && (b.info("Setting state description", n, r), typeof r == "string" && this.addDescription(n, r.trim()), typeof r == "object" && r.forEach((T) => this.addDescription(n, T.trim()))), d) {
|
953
|
+
const T = this.currentDocument.states.get(n);
|
954
|
+
T.note = d, T.note.text = V.sanitizeText(T.note.text, C());
|
955
|
+
}
|
956
|
+
i && (b.info("Setting state classes", n, i), (typeof i == "string" ? [i] : i).forEach((m) => this.setCssClass(n, m.trim()))), p && (b.info("Setting state styles", n, p), (typeof p == "string" ? [p] : p).forEach((m) => this.setStyle(n, m.trim()))), g && (b.info("Setting state styles", n, p), (typeof g == "string" ? [g] : g).forEach((m) => this.setTextStyle(n, m.trim())));
|
957
|
+
}
|
958
|
+
clear(t) {
|
959
|
+
this.nodes = [], this.edges = [], this.documents = {
|
960
|
+
root: Yt()
|
961
|
+
}, this.currentDocument = this.documents.root, this.startEndCount = 0, this.classes = vt(), t || le();
|
962
|
+
}
|
963
|
+
getState(t) {
|
964
|
+
return this.currentDocument.states.get(t);
|
965
|
+
}
|
966
|
+
getStates() {
|
967
|
+
return this.currentDocument.states;
|
968
|
+
}
|
969
|
+
logDocuments() {
|
970
|
+
b.info("Documents = ", this.documents);
|
971
|
+
}
|
972
|
+
getRelations() {
|
973
|
+
return this.currentDocument.relations;
|
974
|
+
}
|
975
|
+
/**
|
976
|
+
* If the id is a start node ( [*] ), then return a new id constructed from
|
977
|
+
* the start node name and the current start node count.
|
978
|
+
* else return the given id
|
979
|
+
*
|
980
|
+
* @param {string} id
|
981
|
+
* @returns {string} - the id (original or constructed)
|
982
|
+
* @private
|
983
|
+
*/
|
984
|
+
startIdIfNeeded(t = "") {
|
985
|
+
let e = t;
|
986
|
+
return t === Dt && (this.startEndCount++, e = `${wt}${this.startEndCount}`), e;
|
987
|
+
}
|
988
|
+
/**
|
989
|
+
* If the id is a start node ( [*] ), then return the start type ('start')
|
990
|
+
* else return the given type
|
991
|
+
*
|
992
|
+
* @param {string} id
|
993
|
+
* @param {string} type
|
994
|
+
* @returns {string} - the type that should be used
|
995
|
+
* @private
|
996
|
+
*/
|
997
|
+
startTypeIfNeeded(t = "", e = K) {
|
998
|
+
return t === Dt ? wt : e;
|
999
|
+
}
|
1000
|
+
/**
|
1001
|
+
* If the id is an end node ( [*] ), then return a new id constructed from
|
1002
|
+
* the end node name and the current start_end node count.
|
1003
|
+
* else return the given id
|
1004
|
+
*
|
1005
|
+
* @param {string} id
|
1006
|
+
* @returns {string} - the id (original or constructed)
|
1007
|
+
* @private
|
1008
|
+
*/
|
1009
|
+
endIdIfNeeded(t = "") {
|
1010
|
+
let e = t;
|
1011
|
+
return t === $t && (this.startEndCount++, e = `${Pt}${this.startEndCount}`), e;
|
1012
|
+
}
|
1013
|
+
/**
|
1014
|
+
* If the id is an end node ( [*] ), then return the end type
|
1015
|
+
* else return the given type
|
1016
|
+
*
|
1017
|
+
* @param {string} id
|
1018
|
+
* @param {string} type
|
1019
|
+
* @returns {string} - the type that should be used
|
1020
|
+
* @private
|
1021
|
+
*/
|
1022
|
+
endTypeIfNeeded(t = "", e = K) {
|
1023
|
+
return t === $t ? Pt : e;
|
1024
|
+
}
|
1025
|
+
/**
|
1026
|
+
*
|
1027
|
+
* @param item1
|
1028
|
+
* @param item2
|
1029
|
+
* @param relationTitle
|
1030
|
+
*/
|
1031
|
+
addRelationObjs(t, e, o) {
|
1032
|
+
let r = this.startIdIfNeeded(t.id.trim()), d = this.startTypeIfNeeded(t.id.trim(), t.type), i = this.startIdIfNeeded(e.id.trim()), p = this.startTypeIfNeeded(e.id.trim(), e.type);
|
1033
|
+
this.addState(
|
1034
|
+
r,
|
1035
|
+
d,
|
1036
|
+
t.doc,
|
1037
|
+
t.description,
|
1038
|
+
t.note,
|
1039
|
+
t.classes,
|
1040
|
+
t.styles,
|
1041
|
+
t.textStyles
|
1042
|
+
), this.addState(
|
1043
|
+
i,
|
1044
|
+
p,
|
1045
|
+
e.doc,
|
1046
|
+
e.description,
|
1047
|
+
e.note,
|
1048
|
+
e.classes,
|
1049
|
+
e.styles,
|
1050
|
+
e.textStyles
|
1051
|
+
), this.currentDocument.relations.push({
|
1052
|
+
id1: r,
|
1053
|
+
id2: i,
|
1054
|
+
relationTitle: V.sanitizeText(o, C())
|
1055
|
+
});
|
1056
|
+
}
|
1057
|
+
/**
|
1058
|
+
* Add a relation between two items. The items may be full objects or just the string id of a state.
|
1059
|
+
*
|
1060
|
+
* @param {string | object} item1
|
1061
|
+
* @param {string | object} item2
|
1062
|
+
* @param {string} title
|
1063
|
+
*/
|
1064
|
+
addRelation(t, e, o) {
|
1065
|
+
if (typeof t == "object")
|
1066
|
+
this.addRelationObjs(t, e, o);
|
1067
|
+
else {
|
1068
|
+
const r = this.startIdIfNeeded(t.trim()), d = this.startTypeIfNeeded(t), i = this.endIdIfNeeded(e.trim()), p = this.endTypeIfNeeded(e);
|
1069
|
+
this.addState(r, d), this.addState(i, p), this.currentDocument.relations.push({
|
1070
|
+
id1: r,
|
1071
|
+
id2: i,
|
1072
|
+
title: V.sanitizeText(o, C())
|
1073
|
+
});
|
1074
|
+
}
|
1075
|
+
}
|
1076
|
+
addDescription(t, e) {
|
1077
|
+
const o = this.currentDocument.states.get(t), r = e.startsWith(":") ? e.replace(":", "").trim() : e;
|
1078
|
+
o.descriptions.push(V.sanitizeText(r, C()));
|
1079
|
+
}
|
1080
|
+
cleanupLabel(t) {
|
1081
|
+
return t.substring(0, 1) === ":" ? t.substr(2).trim() : t.trim();
|
1082
|
+
}
|
1083
|
+
getDividerId() {
|
1084
|
+
return this.dividerCnt++, "divider-id-" + this.dividerCnt;
|
1085
|
+
}
|
1086
|
+
/**
|
1087
|
+
* Called when the parser comes across a (style) class definition
|
1088
|
+
* @example classDef my-style fill:#f96;
|
1089
|
+
*
|
1090
|
+
* @param {string} id - the id of this (style) class
|
1091
|
+
* @param {string | null} styleAttributes - the string with 1 or more style attributes (each separated by a comma)
|
1092
|
+
*/
|
1093
|
+
addStyleClass(t, e = "") {
|
1094
|
+
this.classes.has(t) || this.classes.set(t, { id: t, styles: [], textStyles: [] });
|
1095
|
+
const o = this.classes.get(t);
|
1096
|
+
e?.split(Ye).forEach((r) => {
|
1097
|
+
const d = r.replace(/([^;]*);/, "$1").trim();
|
1098
|
+
if (RegExp(Bt).exec(r)) {
|
1099
|
+
const p = d.replace(Gt, Ge).replace(Bt, Gt);
|
1100
|
+
o.textStyles.push(p);
|
1101
|
+
}
|
1102
|
+
o.styles.push(d);
|
1103
|
+
});
|
1104
|
+
}
|
1105
|
+
/**
|
1106
|
+
* Return all of the style classes
|
1107
|
+
* @returns {{} | any | classes}
|
1108
|
+
*/
|
1109
|
+
getClasses() {
|
1110
|
+
return this.classes;
|
1111
|
+
}
|
1112
|
+
/**
|
1113
|
+
* Add a (style) class or css class to a state with the given id.
|
1114
|
+
* If the state isn't already in the list of known states, add it.
|
1115
|
+
* Might be called by parser when a style class or CSS class should be applied to a state
|
1116
|
+
*
|
1117
|
+
* @param {string | string[]} itemIds The id or a list of ids of the item(s) to apply the css class to
|
1118
|
+
* @param {string} cssClassName CSS class name
|
1119
|
+
*/
|
1120
|
+
setCssClass(t, e) {
|
1121
|
+
t.split(",").forEach((o) => {
|
1122
|
+
let r = this.getState(o);
|
1123
|
+
if (r === void 0) {
|
1124
|
+
const d = o.trim();
|
1125
|
+
this.addState(d), r = this.getState(d);
|
1126
|
+
}
|
1127
|
+
r.classes.push(e);
|
1128
|
+
});
|
1129
|
+
}
|
1130
|
+
/**
|
1131
|
+
* Add a style to a state with the given id.
|
1132
|
+
* @example style stateId fill:#f9f,stroke:#333,stroke-width:4px
|
1133
|
+
* where 'style' is the keyword
|
1134
|
+
* stateId is the id of a state
|
1135
|
+
* the rest of the string is the styleText (all of the attributes to be applied to the state)
|
1136
|
+
*
|
1137
|
+
* @param itemId The id of item to apply the style to
|
1138
|
+
* @param styleText - the text of the attributes for the style
|
1139
|
+
*/
|
1140
|
+
setStyle(t, e) {
|
1141
|
+
const o = this.getState(t);
|
1142
|
+
o !== void 0 && o.styles.push(e);
|
1143
|
+
}
|
1144
|
+
/**
|
1145
|
+
* Add a text style to a state with the given id
|
1146
|
+
*
|
1147
|
+
* @param itemId The id of item to apply the css class to
|
1148
|
+
* @param cssClassName CSS class name
|
1149
|
+
*/
|
1150
|
+
setTextStyle(t, e) {
|
1151
|
+
const o = this.getState(t);
|
1152
|
+
o !== void 0 && o.textStyles.push(e);
|
1153
|
+
}
|
1154
|
+
/**
|
1155
|
+
* Finds the direction statement in the root document.
|
1156
|
+
* @private
|
1157
|
+
* @returns {{ value: string } | undefined} - the direction statement if present
|
1158
|
+
*/
|
1159
|
+
getDirectionStatement() {
|
1160
|
+
return this.rootDoc.find((t) => t.stmt === Lt);
|
1161
|
+
}
|
1162
|
+
getDirection() {
|
1163
|
+
return this.getDirectionStatement()?.value ?? pe;
|
1164
|
+
}
|
1165
|
+
setDirection(t) {
|
1166
|
+
const e = this.getDirectionStatement();
|
1167
|
+
e ? e.value = t : this.rootDoc.unshift({ stmt: Lt, value: t });
|
1168
|
+
}
|
1169
|
+
trimColon(t) {
|
1170
|
+
return t && t[0] === ":" ? t.substr(1).trim() : t.trim();
|
1171
|
+
}
|
1172
|
+
getData() {
|
1173
|
+
const t = C();
|
1174
|
+
return {
|
1175
|
+
nodes: this.nodes,
|
1176
|
+
edges: this.edges,
|
1177
|
+
other: {},
|
1178
|
+
config: t,
|
1179
|
+
direction: Jt(this.getRootDocV2())
|
1180
|
+
};
|
1181
|
+
}
|
1182
|
+
getConfig() {
|
1183
|
+
return C().state;
|
1184
|
+
}
|
1185
|
+
getAccTitle = oe;
|
1186
|
+
setAccTitle = ce;
|
1187
|
+
getAccDescription = he;
|
1188
|
+
setAccDescription = ue;
|
1189
|
+
setDiagramTitle = de;
|
1190
|
+
getDiagramTitle = fe;
|
1191
|
+
}, Fe = /* @__PURE__ */ u((t) => `
|
1192
|
+
defs #statediagram-barbEnd {
|
1193
|
+
fill: ${t.transitionColor};
|
1194
|
+
stroke: ${t.transitionColor};
|
1195
|
+
}
|
1196
|
+
g.stateGroup text {
|
1197
|
+
fill: ${t.nodeBorder};
|
1198
|
+
stroke: none;
|
1199
|
+
font-size: 10px;
|
1200
|
+
}
|
1201
|
+
g.stateGroup text {
|
1202
|
+
fill: ${t.textColor};
|
1203
|
+
stroke: none;
|
1204
|
+
font-size: 10px;
|
1205
|
+
|
1206
|
+
}
|
1207
|
+
g.stateGroup .state-title {
|
1208
|
+
font-weight: bolder;
|
1209
|
+
fill: ${t.stateLabelColor};
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
g.stateGroup rect {
|
1213
|
+
fill: ${t.mainBkg};
|
1214
|
+
stroke: ${t.nodeBorder};
|
1215
|
+
}
|
1216
|
+
|
1217
|
+
g.stateGroup line {
|
1218
|
+
stroke: ${t.lineColor};
|
1219
|
+
stroke-width: 1;
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
.transition {
|
1223
|
+
stroke: ${t.transitionColor};
|
1224
|
+
stroke-width: 1;
|
1225
|
+
fill: none;
|
1226
|
+
}
|
1227
|
+
|
1228
|
+
.stateGroup .composit {
|
1229
|
+
fill: ${t.background};
|
1230
|
+
border-bottom: 1px
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
.stateGroup .alt-composit {
|
1234
|
+
fill: #e0e0e0;
|
1235
|
+
border-bottom: 1px
|
1236
|
+
}
|
1237
|
+
|
1238
|
+
.state-note {
|
1239
|
+
stroke: ${t.noteBorderColor};
|
1240
|
+
fill: ${t.noteBkgColor};
|
1241
|
+
|
1242
|
+
text {
|
1243
|
+
fill: ${t.noteTextColor};
|
1244
|
+
stroke: none;
|
1245
|
+
font-size: 10px;
|
1246
|
+
}
|
1247
|
+
}
|
1248
|
+
|
1249
|
+
.stateLabel .box {
|
1250
|
+
stroke: none;
|
1251
|
+
stroke-width: 0;
|
1252
|
+
fill: ${t.mainBkg};
|
1253
|
+
opacity: 0.5;
|
1254
|
+
}
|
1255
|
+
|
1256
|
+
.edgeLabel .label rect {
|
1257
|
+
fill: ${t.labelBackgroundColor};
|
1258
|
+
opacity: 0.5;
|
1259
|
+
}
|
1260
|
+
.edgeLabel {
|
1261
|
+
background-color: ${t.edgeLabelBackground};
|
1262
|
+
p {
|
1263
|
+
background-color: ${t.edgeLabelBackground};
|
1264
|
+
}
|
1265
|
+
rect {
|
1266
|
+
opacity: 0.5;
|
1267
|
+
background-color: ${t.edgeLabelBackground};
|
1268
|
+
fill: ${t.edgeLabelBackground};
|
1269
|
+
}
|
1270
|
+
text-align: center;
|
1271
|
+
}
|
1272
|
+
.edgeLabel .label text {
|
1273
|
+
fill: ${t.transitionLabelColor || t.tertiaryTextColor};
|
1274
|
+
}
|
1275
|
+
.label div .edgeLabel {
|
1276
|
+
color: ${t.transitionLabelColor || t.tertiaryTextColor};
|
1277
|
+
}
|
1278
|
+
|
1279
|
+
.stateLabel text {
|
1280
|
+
fill: ${t.stateLabelColor};
|
1281
|
+
font-size: 10px;
|
1282
|
+
font-weight: bold;
|
1283
|
+
}
|
1284
|
+
|
1285
|
+
.node circle.state-start {
|
1286
|
+
fill: ${t.specialStateColor};
|
1287
|
+
stroke: ${t.specialStateColor};
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
.node .fork-join {
|
1291
|
+
fill: ${t.specialStateColor};
|
1292
|
+
stroke: ${t.specialStateColor};
|
1293
|
+
}
|
1294
|
+
|
1295
|
+
.node circle.state-end {
|
1296
|
+
fill: ${t.innerEndBackground};
|
1297
|
+
stroke: ${t.background};
|
1298
|
+
stroke-width: 1.5
|
1299
|
+
}
|
1300
|
+
.end-state-inner {
|
1301
|
+
fill: ${t.compositeBackground || t.background};
|
1302
|
+
// stroke: ${t.background};
|
1303
|
+
stroke-width: 1.5
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
.node rect {
|
1307
|
+
fill: ${t.stateBkg || t.mainBkg};
|
1308
|
+
stroke: ${t.stateBorder || t.nodeBorder};
|
1309
|
+
stroke-width: 1px;
|
1310
|
+
}
|
1311
|
+
.node polygon {
|
1312
|
+
fill: ${t.mainBkg};
|
1313
|
+
stroke: ${t.stateBorder || t.nodeBorder};;
|
1314
|
+
stroke-width: 1px;
|
1315
|
+
}
|
1316
|
+
#statediagram-barbEnd {
|
1317
|
+
fill: ${t.lineColor};
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
.statediagram-cluster rect {
|
1321
|
+
fill: ${t.compositeTitleBackground};
|
1322
|
+
stroke: ${t.stateBorder || t.nodeBorder};
|
1323
|
+
stroke-width: 1px;
|
1324
|
+
}
|
1325
|
+
|
1326
|
+
.cluster-label, .nodeLabel {
|
1327
|
+
color: ${t.stateLabelColor};
|
1328
|
+
// line-height: 1;
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
.statediagram-cluster rect.outer {
|
1332
|
+
rx: 5px;
|
1333
|
+
ry: 5px;
|
1334
|
+
}
|
1335
|
+
.statediagram-state .divider {
|
1336
|
+
stroke: ${t.stateBorder || t.nodeBorder};
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
.statediagram-state .title-state {
|
1340
|
+
rx: 5px;
|
1341
|
+
ry: 5px;
|
1342
|
+
}
|
1343
|
+
.statediagram-cluster.statediagram-cluster .inner {
|
1344
|
+
fill: ${t.compositeBackground || t.background};
|
1345
|
+
}
|
1346
|
+
.statediagram-cluster.statediagram-cluster-alt .inner {
|
1347
|
+
fill: ${t.altBackground ? t.altBackground : "#efefef"};
|
1348
|
+
}
|
1349
|
+
|
1350
|
+
.statediagram-cluster .inner {
|
1351
|
+
rx:0;
|
1352
|
+
ry:0;
|
1353
|
+
}
|
1354
|
+
|
1355
|
+
.statediagram-state rect.basic {
|
1356
|
+
rx: 5px;
|
1357
|
+
ry: 5px;
|
1358
|
+
}
|
1359
|
+
.statediagram-state rect.divider {
|
1360
|
+
stroke-dasharray: 10,10;
|
1361
|
+
fill: ${t.altBackground ? t.altBackground : "#efefef"};
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
.note-edge {
|
1365
|
+
stroke-dasharray: 5;
|
1366
|
+
}
|
1367
|
+
|
1368
|
+
.statediagram-note rect {
|
1369
|
+
fill: ${t.noteBkgColor};
|
1370
|
+
stroke: ${t.noteBorderColor};
|
1371
|
+
stroke-width: 1px;
|
1372
|
+
rx: 0;
|
1373
|
+
ry: 0;
|
1374
|
+
}
|
1375
|
+
.statediagram-note rect {
|
1376
|
+
fill: ${t.noteBkgColor};
|
1377
|
+
stroke: ${t.noteBorderColor};
|
1378
|
+
stroke-width: 1px;
|
1379
|
+
rx: 0;
|
1380
|
+
ry: 0;
|
1381
|
+
}
|
1382
|
+
|
1383
|
+
.statediagram-note text {
|
1384
|
+
fill: ${t.noteTextColor};
|
1385
|
+
}
|
1386
|
+
|
1387
|
+
.statediagram-note .nodeLabel {
|
1388
|
+
color: ${t.noteTextColor};
|
1389
|
+
}
|
1390
|
+
.statediagram .edgeLabel {
|
1391
|
+
color: red; // ${t.noteTextColor};
|
1392
|
+
}
|
1393
|
+
|
1394
|
+
#dependencyStart, #dependencyEnd {
|
1395
|
+
fill: ${t.lineColor};
|
1396
|
+
stroke: ${t.lineColor};
|
1397
|
+
stroke-width: 1;
|
1398
|
+
}
|
1399
|
+
|
1400
|
+
.statediagramTitleText {
|
1401
|
+
text-anchor: middle;
|
1402
|
+
font-size: 18px;
|
1403
|
+
fill: ${t.textColor};
|
1404
|
+
}
|
1405
|
+
`, "getStyles"), ze = Fe;
|
1406
|
+
export {
|
1407
|
+
He as S,
|
1408
|
+
Ue as a,
|
1409
|
+
je as b,
|
1410
|
+
ze as s
|
1411
|
+
};
|