1 | import { c as getConfig, s as setAccTitle, g as getAccTitle, a as getAccDescription, b as setAccDescription, z as setDiagramTitle, A as getDiagramTitle, m as mermaidAPI, l as log, f as common, B as clear$2, F as random, G as getConfig$1, j as select, x as utils, H as setupGraphViewbox } from "./mermaid-4b4b971d.js";
|
2 | var parser = function() {
|
3 | var o = function(k, v, o2, l) {
|
4 | for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
|
5 | ;
|
6 | return o2;
|
7 | }, $V0 = [1, 4], $V1 = [1, 7], $V2 = [1, 5], $V3 = [1, 9], $V4 = [1, 6], $V5 = [2, 6], $V6 = [1, 16], $V7 = [6, 8, 14, 20, 22, 24, 25, 27, 29, 32, 37, 40, 50, 55], $V8 = [8, 14, 20, 22, 24, 25, 27, 29, 32, 37, 40], $V9 = [8, 13, 14, 20, 22, 24, 25, 27, 29, 32, 37, 40], $Va = [1, 26], $Vb = [6, 8, 14, 50, 55], $Vc = [8, 14, 55], $Vd = [1, 53], $Ve = [1, 52], $Vf = [8, 14, 30, 33, 35, 38, 55], $Vg = [1, 67], $Vh = [1, 68], $Vi = [1, 69], $Vj = [8, 14, 33, 35, 42, 55];
|
8 | var parser2 = {
|
9 | trace: function trace() {
|
10 | },
|
11 | yy: {},
|
12 | symbols_: { "error": 2, "start": 3, "eol": 4, "directive": 5, "GG": 6, "document": 7, "EOF": 8, ":": 9, "DIR": 10, "options": 11, "body": 12, "OPT": 13, "NL": 14, "line": 15, "statement": 16, "commitStatement": 17, "mergeStatement": 18, "cherryPickStatement": 19, "acc_title": 20, "acc_title_value": 21, "acc_descr": 22, "acc_descr_value": 23, "acc_descr_multiline_value": 24, "section": 25, "branchStatement": 26, "CHECKOUT": 27, "ref": 28, "BRANCH": 29, "ORDER": 30, "NUM": 31, "CHERRY_PICK": 32, "COMMIT_ID": 33, "STR": 34, "COMMIT_TAG": 35, "EMPTYSTR": 36, "MERGE": 37, "COMMIT_TYPE": 38, "commitType": 39, "COMMIT": 40, "commit_arg": 41, "COMMIT_MSG": 42, "NORMAL": 43, "REVERSE": 44, "HIGHLIGHT": 45, "openDirective": 46, "typeDirective": 47, "closeDirective": 48, "argDirective": 49, "open_directive": 50, "type_directive": 51, "arg_directive": 52, "close_directive": 53, "ID": 54, ";": 55, "$accept": 0, "$end": 1 },
|
13 | terminals_: { 2: "error", 6: "GG", 8: "EOF", 9: ":", 10: "DIR", 13: "OPT", 14: "NL", 20: "acc_title", 21: "acc_title_value", 22: "acc_descr", 23: "acc_descr_value", 24: "acc_descr_multiline_value", 25: "section", 27: "CHECKOUT", 29: "BRANCH", 30: "ORDER", 31: "NUM", 32: "CHERRY_PICK", 33: "COMMIT_ID", 34: "STR", 35: "COMMIT_TAG", 36: "EMPTYSTR", 37: "MERGE", 38: "COMMIT_TYPE", 40: "COMMIT", 42: "COMMIT_MSG", 43: "NORMAL", 44: "REVERSE", 45: "HIGHLIGHT", 50: "open_directive", 51: "type_directive", 52: "arg_directive", 53: "close_directive", 54: "ID", 55: ";" },
|
14 | productions_: [0, [3, 2], [3, 2], [3, 3], [3, 4], [3, 5], [7, 0], [7, 2], [11, 2], [11, 1], [12, 0], [12, 2], [15, 2], [15, 1], [16, 1], [16, 1], [16, 1], [16, 2], [16, 2], [16, 1], [16, 1], [16, 1], [16, 2], [26, 2], [26, 4], [19, 3], [19, 5], [19, 5], [19, 5], [19, 5], [18, 2], [18, 4], [18, 4], [18, 4], [18, 6], [18, 6], [18, 6], [18, 6], [18, 6], [18, 6], [18, 8], [18, 8], [18, 8], [18, 8], [18, 8], [18, 8], [17, 2], [17, 3], [17, 3], [17, 5], [17, 5], [17, 3], [17, 5], [17, 5], [17, 5], [17, 5], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 3], [17, 5], [17, 5], [17, 5], [17, 5], [17, 5], [17, 5], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 7], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [17, 9], [41, 0], [41, 1], [39, 1], [39, 1], [39, 1], [5, 3], [5, 5], [46, 1], [47, 1], [49, 1], [48, 1], [28, 1], [28, 1], [4, 1], [4, 1], [4, 1]],
|
15 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
|
16 | var $0 = $$.length - 1;
|
17 | switch (yystate) {
|
18 | case 3:
|
19 | return $$[$0];
|
20 | case 4:
|
21 | return $$[$0 - 1];
|
22 | case 5:
|
23 | yy.setDirection($$[$0 - 3]);
|
24 | return $$[$0 - 1];
|
25 | case 7:
|
26 | yy.setOptions($$[$0 - 1]);
|
27 | this.$ = $$[$0];
|
28 | break;
|
29 | case 8:
|
30 | $$[$0 - 1] += $$[$0];
|
31 | this.$ = $$[$0 - 1];
|
32 | break;
|
33 | case 10:
|
34 | this.$ = [];
|
35 | break;
|
36 | case 11:
|
37 | $$[$0 - 1].push($$[$0]);
|
38 | this.$ = $$[$0 - 1];
|
39 | break;
|
40 | case 12:
|
41 | this.$ = $$[$0 - 1];
|
42 | break;
|
43 | case 17:
|
44 | this.$ = $$[$0].trim();
|
45 | yy.setAccTitle(this.$);
|
46 | break;
|
47 | case 18:
|
48 | case 19:
|
49 | this.$ = $$[$0].trim();
|
50 | yy.setAccDescription(this.$);
|
51 | break;
|
52 | case 20:
|
53 | yy.addSection($$[$0].substr(8));
|
54 | this.$ = $$[$0].substr(8);
|
55 | break;
|
56 | case 22:
|
57 | yy.checkout($$[$0]);
|
58 | break;
|
59 | case 23:
|
60 | yy.branch($$[$0]);
|
61 | break;
|
62 | case 24:
|
63 | yy.branch($$[$0 - 2], $$[$0]);
|
64 | break;
|
65 | case 25:
|
66 | yy.cherryPick($$[$0], "", void 0);
|
67 | break;
|
68 | case 26:
|
69 | yy.cherryPick($$[$0 - 2], "", $$[$0]);
|
70 | break;
|
71 | case 27:
|
72 | case 29:
|
73 | yy.cherryPick($$[$0 - 2], "", "");
|
74 | break;
|
75 | case 28:
|
76 | yy.cherryPick($$[$0], "", $$[$0 - 2]);
|
77 | break;
|
78 | case 30:
|
79 | yy.merge($$[$0], "", "", "");
|
80 | break;
|
81 | case 31:
|
82 | yy.merge($$[$0 - 2], $$[$0], "", "");
|
83 | break;
|
84 | case 32:
|
85 | yy.merge($$[$0 - 2], "", $$[$0], "");
|
86 | break;
|
87 | case 33:
|
88 | yy.merge($$[$0 - 2], "", "", $$[$0]);
|
89 | break;
|
90 | case 34:
|
91 | yy.merge($$[$0 - 4], $$[$0], "", $$[$0 - 2]);
|
92 | break;
|
93 | case 35:
|
94 | yy.merge($$[$0 - 4], "", $$[$0], $$[$0 - 2]);
|
95 | break;
|
96 | case 36:
|
97 | yy.merge($$[$0 - 4], "", $$[$0 - 2], $$[$0]);
|
98 | break;
|
99 | case 37:
|
100 | yy.merge($$[$0 - 4], $$[$0 - 2], $$[$0], "");
|
101 | break;
|
102 | case 38:
|
103 | yy.merge($$[$0 - 4], $$[$0 - 2], "", $$[$0]);
|
104 | break;
|
105 | case 39:
|
106 | yy.merge($$[$0 - 4], $$[$0], $$[$0 - 2], "");
|
107 | break;
|
108 | case 40:
|
109 | yy.merge($$[$0 - 6], $$[$0 - 4], $$[$0 - 2], $$[$0]);
|
110 | break;
|
111 | case 41:
|
112 | yy.merge($$[$0 - 6], $$[$0], $$[$0 - 4], $$[$0 - 2]);
|
113 | break;
|
114 | case 42:
|
115 | yy.merge($$[$0 - 6], $$[$0 - 4], $$[$0], $$[$0 - 2]);
|
116 | break;
|
117 | case 43:
|
118 | yy.merge($$[$0 - 6], $$[$0 - 2], $$[$0 - 4], $$[$0]);
|
119 | break;
|
120 | case 44:
|
121 | yy.merge($$[$0 - 6], $$[$0], $$[$0 - 2], $$[$0 - 4]);
|
122 | break;
|
123 | case 45:
|
124 | yy.merge($$[$0 - 6], $$[$0 - 2], $$[$0], $$[$0 - 4]);
|
125 | break;
|
126 | case 46:
|
127 | yy.commit($$[$0]);
|
128 | break;
|
129 | case 47:
|
130 | yy.commit("", "", yy.commitType.NORMAL, $$[$0]);
|
131 | break;
|
132 | case 48:
|
133 | yy.commit("", "", $$[$0], "");
|
134 | break;
|
135 | case 49:
|
136 | yy.commit("", "", $$[$0], $$[$0 - 2]);
|
137 | break;
|
138 | case 50:
|
139 | yy.commit("", "", $$[$0 - 2], $$[$0]);
|
140 | break;
|
141 | case 51:
|
142 | yy.commit("", $$[$0], yy.commitType.NORMAL, "");
|
143 | break;
|
144 | case 52:
|
145 | yy.commit("", $$[$0 - 2], yy.commitType.NORMAL, $$[$0]);
|
146 | break;
|
147 | case 53:
|
148 | yy.commit("", $$[$0], yy.commitType.NORMAL, $$[$0 - 2]);
|
149 | break;
|
150 | case 54:
|
151 | yy.commit("", $$[$0 - 2], $$[$0], "");
|
152 | break;
|
153 | case 55:
|
154 | yy.commit("", $$[$0], $$[$0 - 2], "");
|
155 | break;
|
156 | case 56:
|
157 | yy.commit("", $$[$0 - 4], $$[$0 - 2], $$[$0]);
|
158 | break;
|
159 | case 57:
|
160 | yy.commit("", $$[$0 - 4], $$[$0], $$[$0 - 2]);
|
161 | break;
|
162 | case 58:
|
163 | yy.commit("", $$[$0 - 2], $$[$0 - 4], $$[$0]);
|
164 | break;
|
165 | case 59:
|
166 | yy.commit("", $$[$0], $$[$0 - 4], $$[$0 - 2]);
|
167 | break;
|
168 | case 60:
|
169 | yy.commit("", $$[$0], $$[$0 - 2], $$[$0 - 4]);
|
170 | break;
|
171 | case 61:
|
172 | yy.commit("", $$[$0 - 2], $$[$0], $$[$0 - 4]);
|
173 | break;
|
174 | case 62:
|
175 | yy.commit($$[$0], "", yy.commitType.NORMAL, "");
|
176 | break;
|
177 | case 63:
|
178 | yy.commit($$[$0], "", yy.commitType.NORMAL, $$[$0 - 2]);
|
179 | break;
|
180 | case 64:
|
181 | yy.commit($$[$0 - 2], "", yy.commitType.NORMAL, $$[$0]);
|
182 | break;
|
183 | case 65:
|
184 | yy.commit($$[$0 - 2], "", $$[$0], "");
|
185 | break;
|
186 | case 66:
|
187 | yy.commit($$[$0], "", $$[$0 - 2], "");
|
188 | break;
|
189 | case 67:
|
190 | yy.commit($$[$0], $$[$0 - 2], yy.commitType.NORMAL, "");
|
191 | break;
|
192 | case 68:
|
193 | yy.commit($$[$0 - 2], $$[$0], yy.commitType.NORMAL, "");
|
194 | break;
|
195 | case 69:
|
196 | yy.commit($$[$0 - 4], "", $$[$0 - 2], $$[$0]);
|
197 | break;
|
198 | case 70:
|
199 | yy.commit($$[$0 - 4], "", $$[$0], $$[$0 - 2]);
|
200 | break;
|
201 | case 71:
|
202 | yy.commit($$[$0 - 2], "", $$[$0 - 4], $$[$0]);
|
203 | break;
|
204 | case 72:
|
205 | yy.commit($$[$0], "", $$[$0 - 4], $$[$0 - 2]);
|
206 | break;
|
207 | case 73:
|
208 | yy.commit($$[$0], "", $$[$0 - 2], $$[$0 - 4]);
|
209 | break;
|
210 | case 74:
|
211 | yy.commit($$[$0 - 2], "", $$[$0], $$[$0 - 4]);
|
212 | break;
|
213 | case 75:
|
214 | yy.commit($$[$0 - 4], $$[$0], $$[$0 - 2], "");
|
215 | break;
|
216 | case 76:
|
217 | yy.commit($$[$0 - 4], $$[$0 - 2], $$[$0], "");
|
218 | break;
|
219 | case 77:
|
220 | yy.commit($$[$0 - 2], $$[$0], $$[$0 - 4], "");
|
221 | break;
|
222 | case 78:
|
223 | yy.commit($$[$0], $$[$0 - 2], $$[$0 - 4], "");
|
224 | break;
|
225 | case 79:
|
226 | yy.commit($$[$0], $$[$0 - 4], $$[$0 - 2], "");
|
227 | break;
|
228 | case 80:
|
229 | yy.commit($$[$0 - 2], $$[$0 - 4], $$[$0], "");
|
230 | break;
|
231 | case 81:
|
232 | yy.commit($$[$0 - 4], $$[$0], yy.commitType.NORMAL, $$[$0 - 2]);
|
233 | break;
|
234 | case 82:
|
235 | yy.commit($$[$0 - 4], $$[$0 - 2], yy.commitType.NORMAL, $$[$0]);
|
236 | break;
|
237 | case 83:
|
238 | yy.commit($$[$0 - 2], $$[$0], yy.commitType.NORMAL, $$[$0 - 4]);
|
239 | break;
|
240 | case 84:
|
241 | yy.commit($$[$0], $$[$0 - 2], yy.commitType.NORMAL, $$[$0 - 4]);
|
242 | break;
|
243 | case 85:
|
244 | yy.commit($$[$0], $$[$0 - 4], yy.commitType.NORMAL, $$[$0 - 2]);
|
245 | break;
|
246 | case 86:
|
247 | yy.commit($$[$0 - 2], $$[$0 - 4], yy.commitType.NORMAL, $$[$0]);
|
248 | break;
|
249 | case 87:
|
250 | yy.commit($$[$0 - 6], $$[$0 - 4], $$[$0 - 2], $$[$0]);
|
251 | break;
|
252 | case 88:
|
253 | yy.commit($$[$0 - 6], $$[$0 - 4], $$[$0], $$[$0 - 2]);
|
254 | break;
|
255 | case 89:
|
256 | yy.commit($$[$0 - 6], $$[$0 - 2], $$[$0 - 4], $$[$0]);
|
257 | break;
|
258 | case 90:
|
259 | yy.commit($$[$0 - 6], $$[$0], $$[$0 - 4], $$[$0 - 2]);
|
260 | break;
|
261 | case 91:
|
262 | yy.commit($$[$0 - 6], $$[$0 - 2], $$[$0], $$[$0 - 4]);
|
263 | break;
|
264 | case 92:
|
265 | yy.commit($$[$0 - 6], $$[$0], $$[$0 - 2], $$[$0 - 4]);
|
266 | break;
|
267 | case 93:
|
268 | yy.commit($$[$0 - 4], $$[$0 - 6], $$[$0 - 2], $$[$0]);
|
269 | break;
|
270 | case 94:
|
271 | yy.commit($$[$0 - 4], $$[$0 - 6], $$[$0], $$[$0 - 2]);
|
272 | break;
|
273 | case 95:
|
274 | yy.commit($$[$0 - 2], $$[$0 - 6], $$[$0 - 4], $$[$0]);
|
275 | break;
|
276 | case 96:
|
277 | yy.commit($$[$0], $$[$0 - 6], $$[$0 - 4], $$[$0 - 2]);
|
278 | break;
|
279 | case 97:
|
280 | yy.commit($$[$0 - 2], $$[$0 - 6], $$[$0], $$[$0 - 4]);
|
281 | break;
|
282 | case 98:
|
283 | yy.commit($$[$0], $$[$0 - 6], $$[$0 - 2], $$[$0 - 4]);
|
284 | break;
|
285 | case 99:
|
286 | yy.commit($$[$0], $$[$0 - 4], $$[$0 - 2], $$[$0 - 6]);
|
287 | break;
|
288 | case 100:
|
289 | yy.commit($$[$0 - 2], $$[$0 - 4], $$[$0], $$[$0 - 6]);
|
290 | break;
|
291 | case 101:
|
292 | yy.commit($$[$0], $$[$0 - 2], $$[$0 - 4], $$[$0 - 6]);
|
293 | break;
|
294 | case 102:
|
295 | yy.commit($$[$0 - 2], $$[$0], $$[$0 - 4], $$[$0 - 6]);
|
296 | break;
|
297 | case 103:
|
298 | yy.commit($$[$0 - 4], $$[$0 - 2], $$[$0], $$[$0 - 6]);
|
299 | break;
|
300 | case 104:
|
301 | yy.commit($$[$0 - 4], $$[$0], $$[$0 - 2], $$[$0 - 6]);
|
302 | break;
|
303 | case 105:
|
304 | yy.commit($$[$0 - 2], $$[$0 - 4], $$[$0 - 6], $$[$0]);
|
305 | break;
|
306 | case 106:
|
307 | yy.commit($$[$0], $$[$0 - 4], $$[$0 - 6], $$[$0 - 2]);
|
308 | break;
|
309 | case 107:
|
310 | yy.commit($$[$0 - 2], $$[$0], $$[$0 - 6], $$[$0 - 4]);
|
311 | break;
|
312 | case 108:
|
313 | yy.commit($$[$0], $$[$0 - 2], $$[$0 - 6], $$[$0 - 4]);
|
314 | break;
|
315 | case 109:
|
316 | yy.commit($$[$0 - 4], $$[$0 - 2], $$[$0 - 6], $$[$0]);
|
317 | break;
|
318 | case 110:
|
319 | yy.commit($$[$0 - 4], $$[$0], $$[$0 - 6], $$[$0 - 2]);
|
320 | break;
|
321 | case 111:
|
322 | this.$ = "";
|
323 | break;
|
324 | case 112:
|
325 | this.$ = $$[$0];
|
326 | break;
|
327 | case 113:
|
328 | this.$ = yy.commitType.NORMAL;
|
329 | break;
|
330 | case 114:
|
331 | this.$ = yy.commitType.REVERSE;
|
332 | break;
|
333 | case 115:
|
334 | this.$ = yy.commitType.HIGHLIGHT;
|
335 | break;
|
336 | case 118:
|
337 | yy.parseDirective("%%{", "open_directive");
|
338 | break;
|
339 | case 119:
|
340 | yy.parseDirective($$[$0], "type_directive");
|
341 | break;
|
342 | case 120:
|
343 | $$[$0] = $$[$0].trim().replace(/'/g, '"');
|
344 | yy.parseDirective($$[$0], "arg_directive");
|
345 | break;
|
346 | case 121:
|
347 | yy.parseDirective("}%%", "close_directive", "gitGraph");
|
348 | break;
|
349 | }
|
350 | },
|
351 | table: [{ 3: 1, 4: 2, 5: 3, 6: $V0, 8: $V1, 14: $V2, 46: 8, 50: $V3, 55: $V4 }, { 1: [3] }, { 3: 10, 4: 2, 5: 3, 6: $V0, 8: $V1, 14: $V2, 46: 8, 50: $V3, 55: $V4 }, { 3: 11, 4: 2, 5: 3, 6: $V0, 8: $V1, 14: $V2, 46: 8, 50: $V3, 55: $V4 }, { 7: 12, 8: $V5, 9: [1, 13], 10: [1, 14], 11: 15, 14: $V6 }, o($V7, [2, 124]), o($V7, [2, 125]), o($V7, [2, 126]), { 47: 17, 51: [1, 18] }, { 51: [2, 118] }, { 1: [2, 1] }, { 1: [2, 2] }, { 8: [1, 19] }, { 7: 20, 8: $V5, 11: 15, 14: $V6 }, { 9: [1, 21] }, o($V8, [2, 10], { 12: 22, 13: [1, 23] }), o($V9, [2, 9]), { 9: [1, 25], 48: 24, 53: $Va }, o([9, 53], [2, 119]), { 1: [2, 3] }, { 8: [1, 27] }, { 7: 28, 8: $V5, 11: 15, 14: $V6 }, { 8: [2, 7], 14: [1, 31], 15: 29, 16: 30, 17: 32, 18: 33, 19: 34, 20: [1, 35], 22: [1, 36], 24: [1, 37], 25: [1, 38], 26: 39, 27: [1, 40], 29: [1, 44], 32: [1, 43], 37: [1, 42], 40: [1, 41] }, o($V9, [2, 8]), o($Vb, [2, 116]), { 49: 45, 52: [1, 46] }, o($Vb, [2, 121]), { 1: [2, 4] }, { 8: [1, 47] }, o($V8, [2, 11]), { 4: 48, 8: $V1, 14: $V2, 55: $V4 }, o($V8, [2, 13]), o($Vc, [2, 14]), o($Vc, [2, 15]), o($Vc, [2, 16]), { 21: [1, 49] }, { 23: [1, 50] }, o($Vc, [2, 19]), o($Vc, [2, 20]), o($Vc, [2, 21]), { 28: 51, 34: $Vd, 54: $Ve }, o($Vc, [2, 111], { 41: 54, 33: [1, 57], 34: [1, 59], 35: [1, 55], 38: [1, 56], 42: [1, 58] }), { 28: 60, 34: $Vd, 54: $Ve }, { 33: [1, 61], 35: [1, 62] }, { 28: 63, 34: $Vd, 54: $Ve }, { 48: 64, 53: $Va }, { 53: [2, 120] }, { 1: [2, 5] }, o($V8, [2, 12]), o($Vc, [2, 17]), o($Vc, [2, 18]), o($Vc, [2, 22]), o($Vf, [2, 122]), o($Vf, [2, 123]), o($Vc, [2, 46]), { 34: [1, 65] }, { 39: 66, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 70] }, { 34: [1, 71] }, o($Vc, [2, 112]), o($Vc, [2, 30], { 33: [1, 72], 35: [1, 74], 38: [1, 73] }), { 34: [1, 75] }, { 34: [1, 76], 36: [1, 77] }, o($Vc, [2, 23], { 30: [1, 78] }), o($Vb, [2, 117]), o($Vc, [2, 47], { 33: [1, 80], 38: [1, 79], 42: [1, 81] }), o($Vc, [2, 48], { 33: [1, 83], 35: [1, 82], 42: [1, 84] }), o($Vj, [2, 113]), o($Vj, [2, 114]), o($Vj, [2, 115]), o($Vc, [2, 51], { 35: [1, 85], 38: [1, 86], 42: [1, 87] }), o($Vc, [2, 62], { 33: [1, 90], 35: [1, 88], 38: [1, 89] }), { 34: [1, 91] }, { 39: 92, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 93] }, o($Vc, [2, 25], { 35: [1, 94] }), { 33: [1, 95] }, { 33: [1, 96] }, { 31: [1, 97] }, { 39: 98, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 99] }, { 34: [1, 100] }, { 34: [1, 101] }, { 34: [1, 102] }, { 34: [1, 103] }, { 34: [1, 104] }, { 39: 105, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 106] }, { 34: [1, 107] }, { 39: 108, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 109] }, o($Vc, [2, 31], { 35: [1, 111], 38: [1, 110] }), o($Vc, [2, 32], { 33: [1, 113], 35: [1, 112] }), o($Vc, [2, 33], { 33: [1, 114], 38: [1, 115] }), { 34: [1, 116], 36: [1, 117] }, { 34: [1, 118] }, { 34: [1, 119] }, o($Vc, [2, 24]), o($Vc, [2, 49], { 33: [1, 120], 42: [1, 121] }), o($Vc, [2, 53], { 38: [1, 122], 42: [1, 123] }), o($Vc, [2, 63], { 33: [1, 125], 38: [1, 124] }), o($Vc, [2, 50], { 33: [1, 126], 42: [1, 127] }), o($Vc, [2, 55], { 35: [1, 128], 42: [1, 129] }), o($Vc, [2, 66], { 33: [1, 131], 35: [1, 130] }), o($Vc, [2, 52], { 38: [1, 132], 42: [1, 133] }), o($Vc, [2, 54], { 35: [1, 134], 42: [1, 135] }), o($Vc, [2, 67], { 35: [1, 137], 38: [1, 136] }), o($Vc, [2, 64], { 33: [1, 139], 38: [1, 138] }), o($Vc, [2, 65], { 33: [1, 141], 35: [1, 140] }), o($Vc, [2, 68], { 35: [1, 143], 38: [1, 142] }), { 39: 144, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 145] }, { 34: [1, 146] }, { 34: [1, 147] }, { 34: [1, 148] }, { 39: 149, 43: $Vg, 44: $Vh, 45: $Vi }, o($Vc, [2, 26]), o($Vc, [2, 27]), o($Vc, [2, 28]), o($Vc, [2, 29]), { 34: [1, 150] }, { 34: [1, 151] }, { 39: 152, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 153] }, { 39: 154, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 155] }, { 34: [1, 156] }, { 34: [1, 157] }, { 34: [1, 158] }, { 34: [1, 159] }, { 34: [1, 160] }, { 34: [1, 161] }, { 39: 162, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 163] }, { 34: [1, 164] }, { 34: [1, 165] }, { 39: 166, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 167] }, { 39: 168, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 169] }, { 34: [1, 170] }, { 34: [1, 171] }, { 39: 172, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 173] }, o($Vc, [2, 37], { 35: [1, 174] }), o($Vc, [2, 38], { 38: [1, 175] }), o($Vc, [2, 36], { 33: [1, 176] }), o($Vc, [2, 39], { 35: [1, 177] }), o($Vc, [2, 34], { 38: [1, 178] }), o($Vc, [2, 35], { 33: [1, 179] }), o($Vc, [2, 60], { 42: [1, 180] }), o($Vc, [2, 73], { 33: [1, 181] }), o($Vc, [2, 61], { 42: [1, 182] }), o($Vc, [2, 84], { 38: [1, 183] }), o($Vc, [2, 74], { 33: [1, 184] }), o($Vc, [2, 83], { 38: [1, 185] }), o($Vc, [2, 59], { 42: [1, 186] }), o($Vc, [2, 72], { 33: [1, 187] }), o($Vc, [2, 58], { 42: [1, 188] }), o($Vc, [2, 78], { 35: [1, 189] }), o($Vc, [2, 71], { 33: [1, 190] }), o($Vc, [2, 77], { 35: [1, 191] }), o($Vc, [2, 57], { 42: [1, 192] }), o($Vc, [2, 85], { 38: [1, 193] }), o($Vc, [2, 56], { 42: [1, 194] }), o($Vc, [2, 79], { 35: [1, 195] }), o($Vc, [2, 80], { 35: [1, 196] }), o($Vc, [2, 86], { 38: [1, 197] }), o($Vc, [2, 70], { 33: [1, 198] }), o($Vc, [2, 81], { 38: [1, 199] }), o($Vc, [2, 69], { 33: [1, 200] }), o($Vc, [2, 75], { 35: [1, 201] }), o($Vc, [2, 76], { 35: [1, 202] }), o($Vc, [2, 82], { 38: [1, 203] }), { 34: [1, 204] }, { 39: 205, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 206] }, { 34: [1, 207] }, { 39: 208, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 209] }, { 34: [1, 210] }, { 34: [1, 211] }, { 34: [1, 212] }, { 39: 213, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 214] }, { 39: 215, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 216] }, { 34: [1, 217] }, { 34: [1, 218] }, { 34: [1, 219] }, { 34: [1, 220] }, { 34: [1, 221] }, { 34: [1, 222] }, { 39: 223, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 224] }, { 34: [1, 225] }, { 34: [1, 226] }, { 39: 227, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 228] }, { 39: 229, 43: $Vg, 44: $Vh, 45: $Vi }, { 34: [1, 230] }, { 34: [1, 231] }, { 34: [1, 232] }, { 39: 233, 43: $Vg, 44: $Vh, 45: $Vi }, o($Vc, [2, 40]), o($Vc, [2, 42]), o($Vc, [2, 41]), o($Vc, [2, 43]), o($Vc, [2, 45]), o($Vc, [2, 44]), o($Vc, [2, 101]), o($Vc, [2, 102]), o($Vc, [2, 99]), o($Vc, [2, 100]), o($Vc, [2, 104]), o($Vc, [2, 103]), o($Vc, [2, 108]), o($Vc, [2, 107]), o($Vc, [2, 106]), o($Vc, [2, 105]), o($Vc, [2, 110]), o($Vc, [2, 109]), o($Vc, [2, 98]), o($Vc, [2, 97]), o($Vc, [2, 96]), o($Vc, [2, 95]), o($Vc, [2, 93]), o($Vc, [2, 94]), o($Vc, [2, 92]), o($Vc, [2, 91]), o($Vc, [2, 90]), o($Vc, [2, 89]), o($Vc, [2, 87]), o($Vc, [2, 88])],
|
352 | defaultActions: { 9: [2, 118], 10: [2, 1], 11: [2, 2], 19: [2, 3], 27: [2, 4], 46: [2, 120], 47: [2, 5] },
|
353 | parseError: function parseError(str, hash) {
|
354 | if (hash.recoverable) {
|
355 | this.trace(str);
|
356 | } else {
|
357 | var error = new Error(str);
|
358 | error.hash = hash;
|
359 | throw error;
|
360 | }
|
361 | },
|
362 | parse: function parse(input) {
|
363 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
|
364 | var args = lstack.slice.call(arguments, 1);
|
365 | var lexer2 = Object.create(this.lexer);
|
366 | var sharedState = { yy: {} };
|
367 | for (var k in this.yy) {
|
368 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
369 | sharedState.yy[k] = this.yy[k];
|
370 | }
|
371 | }
|
372 | lexer2.setInput(input, sharedState.yy);
|
373 | sharedState.yy.lexer = lexer2;
|
374 | sharedState.yy.parser = this;
|
375 | if (typeof lexer2.yylloc == "undefined") {
|
376 | lexer2.yylloc = {};
|
377 | }
|
378 | var yyloc = lexer2.yylloc;
|
379 | lstack.push(yyloc);
|
380 | var ranges = lexer2.options && lexer2.options.ranges;
|
381 | if (typeof sharedState.yy.parseError === "function") {
|
382 | this.parseError = sharedState.yy.parseError;
|
383 | } else {
|
384 | this.parseError = Object.getPrototypeOf(this).parseError;
|
385 | }
|
386 | function lex() {
|
387 | var token;
|
388 | token = tstack.pop() || lexer2.lex() || EOF;
|
389 | if (typeof token !== "number") {
|
390 | if (token instanceof Array) {
|
391 | tstack = token;
|
392 | token = tstack.pop();
|
393 | }
|
394 | token = self.symbols_[token] || token;
|
395 | }
|
396 | return token;
|
397 | }
|
398 | var symbol, state, action, r, yyval = {}, p, len, newState, expected;
|
399 | while (true) {
|
400 | state = stack[stack.length - 1];
|
401 | if (this.defaultActions[state]) {
|
402 | action = this.defaultActions[state];
|
403 | } else {
|
404 | if (symbol === null || typeof symbol == "undefined") {
|
405 | symbol = lex();
|
406 | }
|
407 | action = table[state] && table[state][symbol];
|
408 | }
|
409 | if (typeof action === "undefined" || !action.length || !action[0]) {
|
410 | var errStr = "";
|
411 | expected = [];
|
412 | for (p in table[state]) {
|
413 | if (this.terminals_[p] && p > TERROR) {
|
414 | expected.push("'" + this.terminals_[p] + "'");
|
415 | }
|
416 | }
|
417 | if (lexer2.showPosition) {
|
418 | errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
419 | } else {
|
420 | errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
|
421 | }
|
422 | this.parseError(errStr, {
|
423 | text: lexer2.match,
|
424 | token: this.terminals_[symbol] || symbol,
|
425 | line: lexer2.yylineno,
|
426 | loc: yyloc,
|
427 | expected
|
428 | });
|
429 | }
|
430 | if (action[0] instanceof Array && action.length > 1) {
|
431 | throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
432 | }
|
433 | switch (action[0]) {
|
434 | case 1:
|
435 | stack.push(symbol);
|
436 | vstack.push(lexer2.yytext);
|
437 | lstack.push(lexer2.yylloc);
|
438 | stack.push(action[1]);
|
439 | symbol = null;
|
440 | {
|
441 | yyleng = lexer2.yyleng;
|
442 | yytext = lexer2.yytext;
|
443 | yylineno = lexer2.yylineno;
|
444 | yyloc = lexer2.yylloc;
|
445 | }
|
446 | break;
|
447 | case 2:
|
448 | len = this.productions_[action[1]][1];
|
449 | yyval.$ = vstack[vstack.length - len];
|
450 | yyval._$ = {
|
451 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
452 | last_line: lstack[lstack.length - 1].last_line,
|
453 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
454 | last_column: lstack[lstack.length - 1].last_column
|
455 | };
|
456 | if (ranges) {
|
457 | yyval._$.range = [
|
458 | lstack[lstack.length - (len || 1)].range[0],
|
459 | lstack[lstack.length - 1].range[1]
|
460 | ];
|
461 | }
|
462 | r = this.performAction.apply(yyval, [
|
463 | yytext,
|
464 | yyleng,
|
465 | yylineno,
|
466 | sharedState.yy,
|
467 | action[1],
|
468 | vstack,
|
469 | lstack
|
470 | ].concat(args));
|
471 | if (typeof r !== "undefined") {
|
472 | return r;
|
473 | }
|
474 | if (len) {
|
475 | stack = stack.slice(0, -1 * len * 2);
|
476 | vstack = vstack.slice(0, -1 * len);
|
477 | lstack = lstack.slice(0, -1 * len);
|
478 | }
|
479 | stack.push(this.productions_[action[1]][0]);
|
480 | vstack.push(yyval.$);
|
481 | lstack.push(yyval._$);
|
482 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
483 | stack.push(newState);
|
484 | break;
|
485 | case 3:
|
486 | return true;
|
487 | }
|
488 | }
|
489 | return true;
|
490 | }
|
491 | };
|
492 | var lexer = function() {
|
493 | var lexer2 = {
|
494 | EOF: 1,
|
495 | parseError: function parseError(str, hash) {
|
496 | if (this.yy.parser) {
|
497 | this.yy.parser.parseError(str, hash);
|
498 | } else {
|
499 | throw new Error(str);
|
500 | }
|
501 | },
|
502 |
|
503 | setInput: function(input, yy) {
|
504 | this.yy = yy || this.yy || {};
|
505 | this._input = input;
|
506 | this._more = this._backtrack = this.done = false;
|
507 | this.yylineno = this.yyleng = 0;
|
508 | this.yytext = this.matched = this.match = "";
|
509 | this.conditionStack = ["INITIAL"];
|
510 | this.yylloc = {
|
511 | first_line: 1,
|
512 | first_column: 0,
|
513 | last_line: 1,
|
514 | last_column: 0
|
515 | };
|
516 | if (this.options.ranges) {
|
517 | this.yylloc.range = [0, 0];
|
518 | }
|
519 | this.offset = 0;
|
520 | return this;
|
521 | },
|
522 |
|
523 | input: function() {
|
524 | var ch = this._input[0];
|
525 | this.yytext += ch;
|
526 | this.yyleng++;
|
527 | this.offset++;
|
528 | this.match += ch;
|
529 | this.matched += ch;
|
530 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
531 | if (lines) {
|
532 | this.yylineno++;
|
533 | this.yylloc.last_line++;
|
534 | } else {
|
535 | this.yylloc.last_column++;
|
536 | }
|
537 | if (this.options.ranges) {
|
538 | this.yylloc.range[1]++;
|
539 | }
|
540 | this._input = this._input.slice(1);
|
541 | return ch;
|
542 | },
|
543 |
|
544 | unput: function(ch) {
|
545 | var len = ch.length;
|
546 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
547 | this._input = ch + this._input;
|
548 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
549 | this.offset -= len;
|
550 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
551 | this.match = this.match.substr(0, this.match.length - 1);
|
552 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
553 | if (lines.length - 1) {
|
554 | this.yylineno -= lines.length - 1;
|
555 | }
|
556 | var r = this.yylloc.range;
|
557 | this.yylloc = {
|
558 | first_line: this.yylloc.first_line,
|
559 | last_line: this.yylineno + 1,
|
560 | first_column: this.yylloc.first_column,
|
561 | 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
|
562 | };
|
563 | if (this.options.ranges) {
|
564 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
565 | }
|
566 | this.yyleng = this.yytext.length;
|
567 | return this;
|
568 | },
|
569 |
|
570 | more: function() {
|
571 | this._more = true;
|
572 | return this;
|
573 | },
|
574 |
|
575 | reject: function() {
|
576 | if (this.options.backtrack_lexer) {
|
577 | this._backtrack = true;
|
578 | } else {
|
579 | 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(), {
|
580 | text: "",
|
581 | token: null,
|
582 | line: this.yylineno
|
583 | });
|
584 | }
|
585 | return this;
|
586 | },
|
587 |
|
588 | less: function(n) {
|
589 | this.unput(this.match.slice(n));
|
590 | },
|
591 |
|
592 | pastInput: function() {
|
593 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
594 | return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
|
595 | },
|
596 |
|
597 | upcomingInput: function() {
|
598 | var next = this.match;
|
599 | if (next.length < 20) {
|
600 | next += this._input.substr(0, 20 - next.length);
|
601 | }
|
602 | return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
|
603 | },
|
604 |
|
605 | showPosition: function() {
|
606 | var pre = this.pastInput();
|
607 | var c = new Array(pre.length + 1).join("-");
|
608 | return pre + this.upcomingInput() + "\n" + c + "^";
|
609 | },
|
610 |
|
611 | test_match: function(match, indexed_rule) {
|
612 | var token, lines, backup;
|
613 | if (this.options.backtrack_lexer) {
|
614 | backup = {
|
615 | yylineno: this.yylineno,
|
616 | yylloc: {
|
617 | first_line: this.yylloc.first_line,
|
618 | last_line: this.last_line,
|
619 | first_column: this.yylloc.first_column,
|
620 | last_column: this.yylloc.last_column
|
621 | },
|
622 | yytext: this.yytext,
|
623 | match: this.match,
|
624 | matches: this.matches,
|
625 | matched: this.matched,
|
626 | yyleng: this.yyleng,
|
627 | offset: this.offset,
|
628 | _more: this._more,
|
629 | _input: this._input,
|
630 | yy: this.yy,
|
631 | conditionStack: this.conditionStack.slice(0),
|
632 | done: this.done
|
633 | };
|
634 | if (this.options.ranges) {
|
635 | backup.yylloc.range = this.yylloc.range.slice(0);
|
636 | }
|
637 | }
|
638 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
639 | if (lines) {
|
640 | this.yylineno += lines.length;
|
641 | }
|
642 | this.yylloc = {
|
643 | first_line: this.yylloc.last_line,
|
644 | last_line: this.yylineno + 1,
|
645 | first_column: this.yylloc.last_column,
|
646 | last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
|
647 | };
|
648 | this.yytext += match[0];
|
649 | this.match += match[0];
|
650 | this.matches = match;
|
651 | this.yyleng = this.yytext.length;
|
652 | if (this.options.ranges) {
|
653 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
654 | }
|
655 | this._more = false;
|
656 | this._backtrack = false;
|
657 | this._input = this._input.slice(match[0].length);
|
658 | this.matched += match[0];
|
659 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
660 | if (this.done && this._input) {
|
661 | this.done = false;
|
662 | }
|
663 | if (token) {
|
664 | return token;
|
665 | } else if (this._backtrack) {
|
666 | for (var k in backup) {
|
667 | this[k] = backup[k];
|
668 | }
|
669 | return false;
|
670 | }
|
671 | return false;
|
672 | },
|
673 |
|
674 | next: function() {
|
675 | if (this.done) {
|
676 | return this.EOF;
|
677 | }
|
678 | if (!this._input) {
|
679 | this.done = true;
|
680 | }
|
681 | var token, match, tempMatch, index;
|
682 | if (!this._more) {
|
683 | this.yytext = "";
|
684 | this.match = "";
|
685 | }
|
686 | var rules = this._currentRules();
|
687 | for (var i = 0; i < rules.length; i++) {
|
688 | tempMatch = this._input.match(this.rules[rules[i]]);
|
689 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
690 | match = tempMatch;
|
691 | index = i;
|
692 | if (this.options.backtrack_lexer) {
|
693 | token = this.test_match(tempMatch, rules[i]);
|
694 | if (token !== false) {
|
695 | return token;
|
696 | } else if (this._backtrack) {
|
697 | match = false;
|
698 | continue;
|
699 | } else {
|
700 | return false;
|
701 | }
|
702 | } else if (!this.options.flex) {
|
703 | break;
|
704 | }
|
705 | }
|
706 | }
|
707 | if (match) {
|
708 | token = this.test_match(match, rules[index]);
|
709 | if (token !== false) {
|
710 | return token;
|
711 | }
|
712 | return false;
|
713 | }
|
714 | if (this._input === "") {
|
715 | return this.EOF;
|
716 | } else {
|
717 | return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
|
718 | text: "",
|
719 | token: null,
|
720 | line: this.yylineno
|
721 | });
|
722 | }
|
723 | },
|
724 |
|
725 | lex: function lex() {
|
726 | var r = this.next();
|
727 | if (r) {
|
728 | return r;
|
729 | } else {
|
730 | return this.lex();
|
731 | }
|
732 | },
|
733 |
|
734 | begin: function begin(condition) {
|
735 | this.conditionStack.push(condition);
|
736 | },
|
737 |
|
738 | popState: function popState() {
|
739 | var n = this.conditionStack.length - 1;
|
740 | if (n > 0) {
|
741 | return this.conditionStack.pop();
|
742 | } else {
|
743 | return this.conditionStack[0];
|
744 | }
|
745 | },
|
746 |
|
747 | _currentRules: function _currentRules() {
|
748 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
749 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
750 | } else {
|
751 | return this.conditions["INITIAL"].rules;
|
752 | }
|
753 | },
|
754 |
|
755 | topState: function topState(n) {
|
756 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
757 | if (n >= 0) {
|
758 | return this.conditionStack[n];
|
759 | } else {
|
760 | return "INITIAL";
|
761 | }
|
762 | },
|
763 |
|
764 | pushState: function pushState(condition) {
|
765 | this.begin(condition);
|
766 | },
|
767 |
|
768 | stateStackSize: function stateStackSize() {
|
769 | return this.conditionStack.length;
|
770 | },
|
771 | options: { "case-insensitive": true },
|
772 | performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
|
773 | switch ($avoiding_name_collisions) {
|
774 | case 0:
|
775 | this.begin("open_directive");
|
776 | return 50;
|
777 | case 1:
|
778 | this.begin("type_directive");
|
779 | return 51;
|
780 | case 2:
|
781 | this.popState();
|
782 | this.begin("arg_directive");
|
783 | return 9;
|
784 | case 3:
|
785 | this.popState();
|
786 | this.popState();
|
787 | return 53;
|
788 | case 4:
|
789 | return 52;
|
790 | case 5:
|
791 | this.begin("acc_title");
|
792 | return 20;
|
793 | case 6:
|
794 | this.popState();
|
795 | return "acc_title_value";
|
796 | case 7:
|
797 | this.begin("acc_descr");
|
798 | return 22;
|
799 | case 8:
|
800 | this.popState();
|
801 | return "acc_descr_value";
|
802 | case 9:
|
803 | this.begin("acc_descr_multiline");
|
804 | break;
|
805 | case 10:
|
806 | this.popState();
|
807 | break;
|
808 | case 11:
|
809 | return "acc_descr_multiline_value";
|
810 | case 12:
|
811 | return 14;
|
812 | case 13:
|
813 | break;
|
814 | case 14:
|
815 | break;
|
816 | case 15:
|
817 | return 6;
|
818 | case 16:
|
819 | return 40;
|
820 | case 17:
|
821 | return 33;
|
822 | case 18:
|
823 | return 38;
|
824 | case 19:
|
825 | return 42;
|
826 | case 20:
|
827 | return 43;
|
828 | case 21:
|
829 | return 44;
|
830 | case 22:
|
831 | return 45;
|
832 | case 23:
|
833 | return 35;
|
834 | case 24:
|
835 | return 29;
|
836 | case 25:
|
837 | return 30;
|
838 | case 26:
|
839 | return 37;
|
840 | case 27:
|
841 | return 32;
|
842 | case 28:
|
843 | return 27;
|
844 | case 29:
|
845 | return 10;
|
846 | case 30:
|
847 | return 10;
|
848 | case 31:
|
849 | return 9;
|
850 | case 32:
|
851 | return "CARET";
|
852 | case 33:
|
853 | this.begin("options");
|
854 | break;
|
855 | case 34:
|
856 | this.popState();
|
857 | break;
|
858 | case 35:
|
859 | return 13;
|
860 | case 36:
|
861 | return 36;
|
862 | case 37:
|
863 | this.begin("string");
|
864 | break;
|
865 | case 38:
|
866 | this.popState();
|
867 | break;
|
868 | case 39:
|
869 | return 34;
|
870 | case 40:
|
871 | return 31;
|
872 | case 41:
|
873 | return 54;
|
874 | case 42:
|
875 | return 8;
|
876 | }
|
877 | },
|
878 | rules: [/^(?:%%\{)/i, /^(?:((?:(?!\}%%)[^:.])*))/i, /^(?::)/i, /^(?:\}%%)/i, /^(?:((?:(?!\}%%).|\n)*))/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:(\r?\n)+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:gitGraph\b)/i, /^(?:commit(?=\s|$))/i, /^(?:id:)/i, /^(?:type:)/i, /^(?:msg:)/i, /^(?:NORMAL\b)/i, /^(?:REVERSE\b)/i, /^(?:HIGHLIGHT\b)/i, /^(?:tag:)/i, /^(?:branch(?=\s|$))/i, /^(?:order:)/i, /^(?:merge(?=\s|$))/i, /^(?:cherry-pick(?=\s|$))/i, /^(?:checkout(?=\s|$))/i, /^(?:LR\b)/i, /^(?:BT\b)/i, /^(?::)/i, /^(?:\^)/i, /^(?:options\r?\n)/i, /^(?:[ \r\n\t]+end\b)/i, /^(?:[\s\S]+(?=[ \r\n\t]+end))/i, /^(?:["]["])/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[0-9]+(?=\s|$))/i, /^(?:\w([-\./\w]*[-\w])?)/i, /^(?:$)/i, /^(?:\s+)/i],
|
879 | conditions: { "acc_descr_multiline": { "rules": [10, 11], "inclusive": false }, "acc_descr": { "rules": [8], "inclusive": false }, "acc_title": { "rules": [6], "inclusive": false }, "close_directive": { "rules": [], "inclusive": false }, "arg_directive": { "rules": [3, 4], "inclusive": false }, "type_directive": { "rules": [2, 3], "inclusive": false }, "open_directive": { "rules": [1], "inclusive": false }, "options": { "rules": [34, 35], "inclusive": false }, "string": { "rules": [38, 39], "inclusive": false }, "INITIAL": { "rules": [0, 5, 7, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 36, 37, 40, 41, 42, 43], "inclusive": true } }
|
880 | };
|
881 | return lexer2;
|
882 | }();
|
883 | parser2.lexer = lexer;
|
884 | function Parser() {
|
885 | this.yy = {};
|
886 | }
|
887 | Parser.prototype = parser2;
|
888 | parser2.Parser = Parser;
|
889 | return new Parser();
|
890 | }();
|
891 | parser.parser = parser;
|
892 | const gitGraphParser = parser;
|
893 | let mainBranchName = getConfig().gitGraph.mainBranchName;
|
894 | let mainBranchOrder = getConfig().gitGraph.mainBranchOrder;
|
895 | let commits = {};
|
896 | let head = null;
|
897 | let branchesConfig = {};
|
898 | branchesConfig[mainBranchName] = { name: mainBranchName, order: mainBranchOrder };
|
899 | let branches = {};
|
900 | branches[mainBranchName] = head;
|
901 | let curBranch = mainBranchName;
|
902 | let direction = "LR";
|
903 | let seq = 0;
|
904 | function getId() {
|
905 | return random({ length: 7 });
|
906 | }
|
907 | const parseDirective = function(statement, context, type) {
|
908 | mermaidAPI.parseDirective(this, statement, context, type);
|
909 | };
|
910 | function uniqBy(list, fn) {
|
911 | const recordMap = Object.create(null);
|
912 | return list.reduce((out, item) => {
|
913 | const key = fn(item);
|
914 | if (!recordMap[key]) {
|
915 | recordMap[key] = true;
|
916 | out.push(item);
|
917 | }
|
918 | return out;
|
919 | }, []);
|
920 | }
|
921 | const setDirection = function(dir) {
|
922 | direction = dir;
|
923 | };
|
924 | let options = {};
|
925 | const setOptions = function(rawOptString) {
|
926 | log.debug("options str", rawOptString);
|
927 | rawOptString = rawOptString && rawOptString.trim();
|
928 | rawOptString = rawOptString || "{}";
|
929 | try {
|
930 | options = JSON.parse(rawOptString);
|
931 | } catch (e) {
|
932 | log.error("error while parsing gitGraph options", e.message);
|
933 | }
|
934 | };
|
935 | const getOptions = function() {
|
936 | return options;
|
937 | };
|
938 | const commit = function(msg, id, type, tag) {
|
939 | log.debug("Entering commit:", msg, id, type, tag);
|
940 | id = common.sanitizeText(id, getConfig());
|
941 | msg = common.sanitizeText(msg, getConfig());
|
942 | tag = common.sanitizeText(tag, getConfig());
|
943 | const commit2 = {
|
944 | id: id ? id : seq + "-" + getId(),
|
945 | message: msg,
|
946 | seq: seq++,
|
947 | type: type ? type : commitType$1.NORMAL,
|
948 | tag: tag ? tag : "",
|
949 | parents: head == null ? [] : [head.id],
|
950 | branch: curBranch
|
951 | };
|
952 | head = commit2;
|
953 | commits[commit2.id] = commit2;
|
954 | branches[curBranch] = commit2.id;
|
955 | log.debug("in pushCommit " + commit2.id);
|
956 | };
|
957 | const branch = function(name, order) {
|
958 | name = common.sanitizeText(name, getConfig());
|
959 | if (branches[name] === void 0) {
|
960 | branches[name] = head != null ? head.id : null;
|
961 | branchesConfig[name] = { name, order: order ? parseInt(order, 10) : null };
|
962 | checkout(name);
|
963 | log.debug("in createBranch");
|
964 | } else {
|
965 | let error = new Error(
|
966 | 'Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ' + name + '")'
|
967 | );
|
968 | error.hash = {
|
969 | text: "branch " + name,
|
970 | token: "branch " + name,
|
971 | line: "1",
|
972 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
973 | expected: ['"checkout ' + name + '"']
|
974 | };
|
975 | throw error;
|
976 | }
|
977 | };
|
978 | const merge = function(otherBranch, custom_id, override_type, custom_tag) {
|
979 | otherBranch = common.sanitizeText(otherBranch, getConfig());
|
980 | custom_id = common.sanitizeText(custom_id, getConfig());
|
981 | const currentCommit = commits[branches[curBranch]];
|
982 | const otherCommit = commits[branches[otherBranch]];
|
983 | if (curBranch === otherBranch) {
|
984 | let error = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
|
985 | error.hash = {
|
986 | text: "merge " + otherBranch,
|
987 | token: "merge " + otherBranch,
|
988 | line: "1",
|
989 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
990 | expected: ["branch abc"]
|
991 | };
|
992 | throw error;
|
993 | } else if (currentCommit === void 0 || !currentCommit) {
|
994 | let error = new Error(
|
995 | 'Incorrect usage of "merge". Current branch (' + curBranch + ")has no commits"
|
996 | );
|
997 | error.hash = {
|
998 | text: "merge " + otherBranch,
|
999 | token: "merge " + otherBranch,
|
1000 | line: "1",
|
1001 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
1002 | expected: ["commit"]
|
1003 | };
|
1004 | throw error;
|
1005 | } else if (branches[otherBranch] === void 0) {
|
1006 | let error = new Error(
|
1007 | 'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") does not exist"
|
1008 | );
|
1009 | error.hash = {
|
1010 | text: "merge " + otherBranch,
|
1011 | token: "merge " + otherBranch,
|
1012 | line: "1",
|
1013 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
1014 | expected: ["branch " + otherBranch]
|
1015 | };
|
1016 | throw error;
|
1017 | } else if (otherCommit === void 0 || !otherCommit) {
|
1018 | let error = new Error(
|
1019 | 'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") has no commits"
|
1020 | );
|
1021 | error.hash = {
|
1022 | text: "merge " + otherBranch,
|
1023 | token: "merge " + otherBranch,
|
1024 | line: "1",
|
1025 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
1026 | expected: ['"commit"']
|
1027 | };
|
1028 | throw error;
|
1029 | } else if (currentCommit === otherCommit) {
|
1030 | let error = new Error('Incorrect usage of "merge". Both branches have same head');
|
1031 | error.hash = {
|
1032 | text: "merge " + otherBranch,
|
1033 | token: "merge " + otherBranch,
|
1034 | line: "1",
|
1035 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
1036 | expected: ["branch abc"]
|
1037 | };
|
1038 | throw error;
|
1039 | } else if (custom_id && commits[custom_id] !== void 0) {
|
1040 | let error = new Error(
|
1041 | 'Incorrect usage of "merge". Commit with id:' + custom_id + " already exists, use different custom Id"
|
1042 | );
|
1043 | error.hash = {
|
1044 | text: "merge " + otherBranch + custom_id + override_type + custom_tag,
|
1045 | token: "merge " + otherBranch + custom_id + override_type + custom_tag,
|
1046 | line: "1",
|
1047 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
1048 | expected: [
|
1049 | "merge " + otherBranch + " " + custom_id + "_UNIQUE " + override_type + " " + custom_tag
|
1050 | ]
|
1051 | };
|
1052 | throw error;
|
1053 | }
|
1054 | const commit2 = {
|
1055 | id: custom_id ? custom_id : seq + "-" + getId(),
|
1056 | message: "merged branch " + otherBranch + " into " + curBranch,
|
1057 | seq: seq++,
|
1058 | parents: [head == null ? null : head.id, branches[otherBranch]],
|
1059 | branch: curBranch,
|
1060 | type: commitType$1.MERGE,
|
1061 | customType: override_type,
|
1062 | customId: custom_id ? true : false,
|
1063 | tag: custom_tag ? custom_tag : ""
|
1064 | };
|
1065 | head = commit2;
|
1066 | commits[commit2.id] = commit2;
|
1067 | branches[curBranch] = commit2.id;
|
1068 | log.debug(branches);
|
1069 | log.debug("in mergeBranch");
|
1070 | };
|
1071 | const cherryPick = function(sourceId, targetId, tag) {
|
1072 | log.debug("Entering cherryPick:", sourceId, targetId, tag);
|
1073 | sourceId = common.sanitizeText(sourceId, getConfig());
|
1074 | targetId = common.sanitizeText(targetId, getConfig());
|
1075 | tag = common.sanitizeText(tag, getConfig());
|
1076 | if (!sourceId || commits[sourceId] === void 0) {
|
1077 | let error = new Error(
|
1078 | 'Incorrect usage of "cherryPick". Source commit id should exist and provided'
|
1079 | );
|
1080 | error.hash = {
|
1081 | text: "cherryPick " + sourceId + " " + targetId,
|
1082 | token: "cherryPick " + sourceId + " " + targetId,
|
1083 | line: "1",
|
1084 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
1085 | expected: ["cherry-pick abc"]
|
1086 | };
|
1087 | throw error;
|
1088 | }
|
1089 | let sourceCommit = commits[sourceId];
|
1090 | let sourceCommitBranch = sourceCommit.branch;
|
1091 | if (sourceCommit.type === commitType$1.MERGE) {
|
1092 | let error = new Error(
|
1093 | 'Incorrect usage of "cherryPick". Source commit should not be a merge commit'
|
1094 | );
|
1095 | error.hash = {
|
1096 | text: "cherryPick " + sourceId + " " + targetId,
|
1097 | token: "cherryPick " + sourceId + " " + targetId,
|
1098 | line: "1",
|
1099 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
1100 | expected: ["cherry-pick abc"]
|
1101 | };
|
1102 | throw error;
|
1103 | }
|
1104 | if (!targetId || commits[targetId] === void 0) {
|
1105 | if (sourceCommitBranch === curBranch) {
|
1106 | let error = new Error(
|
1107 | 'Incorrect usage of "cherryPick". Source commit is already on current branch'
|
1108 | );
|
1109 | error.hash = {
|
1110 | text: "cherryPick " + sourceId + " " + targetId,
|
1111 | token: "cherryPick " + sourceId + " " + targetId,
|
1112 | line: "1",
|
1113 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
1114 | expected: ["cherry-pick abc"]
|
1115 | };
|
1116 | throw error;
|
1117 | }
|
1118 | const currentCommit = commits[branches[curBranch]];
|
1119 | if (currentCommit === void 0 || !currentCommit) {
|
1120 | let error = new Error(
|
1121 | 'Incorrect usage of "cherry-pick". Current branch (' + curBranch + ")has no commits"
|
1122 | );
|
1123 | error.hash = {
|
1124 | text: "cherryPick " + sourceId + " " + targetId,
|
1125 | token: "cherryPick " + sourceId + " " + targetId,
|
1126 | line: "1",
|
1127 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
1128 | expected: ["cherry-pick abc"]
|
1129 | };
|
1130 | throw error;
|
1131 | }
|
1132 | const commit2 = {
|
1133 | id: seq + "-" + getId(),
|
1134 | message: "cherry-picked " + sourceCommit + " into " + curBranch,
|
1135 | seq: seq++,
|
1136 | parents: [head == null ? null : head.id, sourceCommit.id],
|
1137 | branch: curBranch,
|
1138 | type: commitType$1.CHERRY_PICK,
|
1139 | tag: tag ?? "cherry-pick:" + sourceCommit.id
|
1140 | };
|
1141 | head = commit2;
|
1142 | commits[commit2.id] = commit2;
|
1143 | branches[curBranch] = commit2.id;
|
1144 | log.debug(branches);
|
1145 | log.debug("in cherryPick");
|
1146 | }
|
1147 | };
|
1148 | const checkout = function(branch2) {
|
1149 | branch2 = common.sanitizeText(branch2, getConfig());
|
1150 | if (branches[branch2] === void 0) {
|
1151 | let error = new Error(
|
1152 | 'Trying to checkout branch which is not yet created. (Help try using "branch ' + branch2 + '")'
|
1153 | );
|
1154 | error.hash = {
|
1155 | text: "checkout " + branch2,
|
1156 | token: "checkout " + branch2,
|
1157 | line: "1",
|
1158 | loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
1159 | expected: ['"branch ' + branch2 + '"']
|
1160 | };
|
1161 | throw error;
|
1162 | } else {
|
1163 | curBranch = branch2;
|
1164 | const id = branches[curBranch];
|
1165 | head = commits[id];
|
1166 | }
|
1167 | };
|
1168 | function upsert(arr, key, newVal) {
|
1169 | const index = arr.indexOf(key);
|
1170 | if (index === -1) {
|
1171 | arr.push(newVal);
|
1172 | } else {
|
1173 | arr.splice(index, 1, newVal);
|
1174 | }
|
1175 | }
|
1176 | function prettyPrintCommitHistory(commitArr) {
|
1177 | const commit2 = commitArr.reduce((out, commit3) => {
|
1178 | if (out.seq > commit3.seq) {
|
1179 | return out;
|
1180 | }
|
1181 | return commit3;
|
1182 | }, commitArr[0]);
|
1183 | let line = "";
|
1184 | commitArr.forEach(function(c) {
|
1185 | if (c === commit2) {
|
1186 | line += " *";
|
1187 | } else {
|
1188 | line += " |";
|
1189 | }
|
1190 | });
|
1191 | const label = [line, commit2.id, commit2.seq];
|
1192 | for (let branch2 in branches) {
|
1193 | if (branches[branch2] === commit2.id) {
|
1194 | label.push(branch2);
|
1195 | }
|
1196 | }
|
1197 | log.debug(label.join(" "));
|
1198 | if (commit2.parents && commit2.parents.length == 2) {
|
1199 | const newCommit = commits[commit2.parents[0]];
|
1200 | upsert(commitArr, commit2, newCommit);
|
1201 | commitArr.push(commits[commit2.parents[1]]);
|
1202 | } else if (commit2.parents.length == 0) {
|
1203 | return;
|
1204 | } else {
|
1205 | const nextCommit = commits[commit2.parents];
|
1206 | upsert(commitArr, commit2, nextCommit);
|
1207 | }
|
1208 | commitArr = uniqBy(commitArr, (c) => c.id);
|
1209 | prettyPrintCommitHistory(commitArr);
|
1210 | }
|
1211 | const prettyPrint = function() {
|
1212 | log.debug(commits);
|
1213 | const node = getCommitsArray()[0];
|
1214 | prettyPrintCommitHistory([node]);
|
1215 | };
|
1216 | const clear$1 = function() {
|
1217 | commits = {};
|
1218 | head = null;
|
1219 | let mainBranch = getConfig().gitGraph.mainBranchName;
|
1220 | let mainBranchOrder2 = getConfig().gitGraph.mainBranchOrder;
|
1221 | branches = {};
|
1222 | branches[mainBranch] = null;
|
1223 | branchesConfig = {};
|
1224 | branchesConfig[mainBranch] = { name: mainBranch, order: mainBranchOrder2 };
|
1225 | curBranch = mainBranch;
|
1226 | seq = 0;
|
1227 | clear$2();
|
1228 | };
|
1229 | const getBranchesAsObjArray = function() {
|
1230 | const branchesArray = Object.values(branchesConfig).map((branchConfig, i) => {
|
1231 | if (branchConfig.order !== null) {
|
1232 | return branchConfig;
|
1233 | }
|
1234 | return {
|
1235 | ...branchConfig,
|
1236 | order: parseFloat(`0.${i}`, 10)
|
1237 | };
|
1238 | }).sort((a, b) => a.order - b.order).map(({ name }) => ({ name }));
|
1239 | return branchesArray;
|
1240 | };
|
1241 | const getBranches = function() {
|
1242 | return branches;
|
1243 | };
|
1244 | const getCommits = function() {
|
1245 | return commits;
|
1246 | };
|
1247 | const getCommitsArray = function() {
|
1248 | const commitArr = Object.keys(commits).map(function(key) {
|
1249 | return commits[key];
|
1250 | });
|
1251 | commitArr.forEach(function(o) {
|
1252 | log.debug(o.id);
|
1253 | });
|
1254 | commitArr.sort((a, b) => a.seq - b.seq);
|
1255 | return commitArr;
|
1256 | };
|
1257 | const getCurrentBranch = function() {
|
1258 | return curBranch;
|
1259 | };
|
1260 | const getDirection = function() {
|
1261 | return direction;
|
1262 | };
|
1263 | const getHead = function() {
|
1264 | return head;
|
1265 | };
|
1266 | const commitType$1 = {
|
1267 | NORMAL: 0,
|
1268 | REVERSE: 1,
|
1269 | HIGHLIGHT: 2,
|
1270 | MERGE: 3,
|
1271 | CHERRY_PICK: 4
|
1272 | };
|
1273 | const gitGraphDb = {
|
1274 | parseDirective,
|
1275 | getConfig: () => getConfig().gitGraph,
|
1276 | setDirection,
|
1277 | setOptions,
|
1278 | getOptions,
|
1279 | commit,
|
1280 | branch,
|
1281 | merge,
|
1282 | cherryPick,
|
1283 | checkout,
|
1284 |
|
1285 | prettyPrint,
|
1286 | clear: clear$1,
|
1287 | getBranchesAsObjArray,
|
1288 | getBranches,
|
1289 | getCommits,
|
1290 | getCommitsArray,
|
1291 | getCurrentBranch,
|
1292 | getDirection,
|
1293 | getHead,
|
1294 | setAccTitle,
|
1295 | getAccTitle,
|
1296 | getAccDescription,
|
1297 | setAccDescription,
|
1298 | setDiagramTitle,
|
1299 | getDiagramTitle,
|
1300 | commitType: commitType$1
|
1301 | };
|
1302 | let allCommitsDict = {};
|
1303 | const commitType = {
|
1304 | NORMAL: 0,
|
1305 | REVERSE: 1,
|
1306 | HIGHLIGHT: 2,
|
1307 | MERGE: 3,
|
1308 | CHERRY_PICK: 4
|
1309 | };
|
1310 | const THEME_COLOR_LIMIT = 8;
|
1311 | let branchPos = {};
|
1312 | let commitPos = {};
|
1313 | let lanes = [];
|
1314 | let maxPos = 0;
|
1315 | const clear = () => {
|
1316 | branchPos = {};
|
1317 | commitPos = {};
|
1318 | allCommitsDict = {};
|
1319 | maxPos = 0;
|
1320 | lanes = [];
|
1321 | };
|
1322 | const drawText = (txt) => {
|
1323 | const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
1324 | let rows = [];
|
1325 | if (typeof txt === "string") {
|
1326 | rows = txt.split(/\\n|\n|<br\s*\/?>/gi);
|
1327 | } else if (Array.isArray(txt)) {
|
1328 | rows = txt;
|
1329 | } else {
|
1330 | rows = [];
|
1331 | }
|
1332 | for (const row of rows) {
|
1333 | const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
1334 | tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
1335 | tspan.setAttribute("dy", "1em");
|
1336 | tspan.setAttribute("x", "0");
|
1337 | tspan.setAttribute("class", "row");
|
1338 | tspan.textContent = row.trim();
|
1339 | svgLabel.appendChild(tspan);
|
1340 | }
|
1341 | return svgLabel;
|
1342 | };
|
1343 | const drawCommits = (svg, commits2, modifyGraph) => {
|
1344 | const gitGraphConfig = getConfig$1().gitGraph;
|
1345 | const gBullets = svg.append("g").attr("class", "commit-bullets");
|
1346 | const gLabels = svg.append("g").attr("class", "commit-labels");
|
1347 | let pos = 0;
|
1348 | const keys = Object.keys(commits2);
|
1349 | const sortedKeys = keys.sort((a, b) => {
|
1350 | return commits2[a].seq - commits2[b].seq;
|
1351 | });
|
1352 | sortedKeys.forEach((key) => {
|
1353 | const commit2 = commits2[key];
|
1354 | const y = branchPos[commit2.branch].pos;
|
1355 | const x = pos + 10;
|
1356 | if (modifyGraph) {
|
1357 | let typeClass;
|
1358 | let commitSymbolType = commit2.customType !== void 0 && commit2.customType !== "" ? commit2.customType : commit2.type;
|
1359 | switch (commitSymbolType) {
|
1360 | case commitType.NORMAL:
|
1361 | typeClass = "commit-normal";
|
1362 | break;
|
1363 | case commitType.REVERSE:
|
1364 | typeClass = "commit-reverse";
|
1365 | break;
|
1366 | case commitType.HIGHLIGHT:
|
1367 | typeClass = "commit-highlight";
|
1368 | break;
|
1369 | case commitType.MERGE:
|
1370 | typeClass = "commit-merge";
|
1371 | break;
|
1372 | case commitType.CHERRY_PICK:
|
1373 | typeClass = "commit-cherry-pick";
|
1374 | break;
|
1375 | default:
|
1376 | typeClass = "commit-normal";
|
1377 | }
|
1378 | if (commitSymbolType === commitType.HIGHLIGHT) {
|
1379 | const circle = gBullets.append("rect");
|
1380 | circle.attr("x", x - 10);
|
1381 | circle.attr("y", y - 10);
|
1382 | circle.attr("height", 20);
|
1383 | circle.attr("width", 20);
|
1384 | circle.attr(
|
1385 | "class",
|
1386 | `commit ${commit2.id} commit-highlight${branchPos[commit2.branch].index % THEME_COLOR_LIMIT} ${typeClass}-outer`
|
1387 | );
|
1388 | gBullets.append("rect").attr("x", x - 6).attr("y", y - 6).attr("height", 12).attr("width", 12).attr(
|
1389 | "class",
|
1390 | `commit ${commit2.id} commit${branchPos[commit2.branch].index % THEME_COLOR_LIMIT} ${typeClass}-inner`
|
1391 | );
|
1392 | } else if (commitSymbolType === commitType.CHERRY_PICK) {
|
1393 | gBullets.append("circle").attr("cx", x).attr("cy", y).attr("r", 10).attr("class", `commit ${commit2.id} ${typeClass}`);
|
1394 | gBullets.append("circle").attr("cx", x - 3).attr("cy", y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
1395 | gBullets.append("circle").attr("cx", x + 3).attr("cy", y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
1396 | gBullets.append("line").attr("x1", x + 3).attr("y1", y + 1).attr("x2", x).attr("y2", y - 5).attr("stroke", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
1397 | gBullets.append("line").attr("x1", x - 3).attr("y1", y + 1).attr("x2", x).attr("y2", y - 5).attr("stroke", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
1398 | } else {
|
1399 | const circle = gBullets.append("circle");
|
1400 | circle.attr("cx", x);
|
1401 | circle.attr("cy", y);
|
1402 | circle.attr("r", commit2.type === commitType.MERGE ? 9 : 10);
|
1403 | circle.attr(
|
1404 | "class",
|
1405 | `commit ${commit2.id} commit${branchPos[commit2.branch].index % THEME_COLOR_LIMIT}`
|
1406 | );
|
1407 | if (commitSymbolType === commitType.MERGE) {
|
1408 | const circle2 = gBullets.append("circle");
|
1409 | circle2.attr("cx", x);
|
1410 | circle2.attr("cy", y);
|
1411 | circle2.attr("r", 6);
|
1412 | circle2.attr(
|
1413 | "class",
|
1414 | `commit ${typeClass} ${commit2.id} commit${branchPos[commit2.branch].index % THEME_COLOR_LIMIT}`
|
1415 | );
|
1416 | }
|
1417 | if (commitSymbolType === commitType.REVERSE) {
|
1418 | const cross = gBullets.append("path");
|
1419 | cross.attr("d", `M ${x - 5},${y - 5}L${x + 5},${y + 5}M${x - 5},${y + 5}L${x + 5},${y - 5}`).attr(
|
1420 | "class",
|
1421 | `commit ${typeClass} ${commit2.id} commit${branchPos[commit2.branch].index % THEME_COLOR_LIMIT}`
|
1422 | );
|
1423 | }
|
1424 | }
|
1425 | }
|
1426 | commitPos[commit2.id] = { x: pos + 10, y };
|
1427 | if (modifyGraph) {
|
1428 | const px = 4;
|
1429 | const py = 2;
|
1430 | if (commit2.type !== commitType.CHERRY_PICK && (commit2.customId && commit2.type === commitType.MERGE || commit2.type !== commitType.MERGE) && gitGraphConfig.showCommitLabel) {
|
1431 | const wrapper = gLabels.append("g");
|
1432 | const labelBkg = wrapper.insert("rect").attr("class", "commit-label-bkg");
|
1433 | const text = wrapper.append("text").attr("x", pos).attr("y", y + 25).attr("class", "commit-label").text(commit2.id);
|
1434 | let bbox = text.node().getBBox();
|
1435 | labelBkg.attr("x", pos + 10 - bbox.width / 2 - py).attr("y", y + 13.5).attr("width", bbox.width + 2 * py).attr("height", bbox.height + 2 * py);
|
1436 | text.attr("x", pos + 10 - bbox.width / 2);
|
1437 | if (gitGraphConfig.rotateCommitLabel) {
|
1438 | let r_x = -7.5 - (bbox.width + 10) / 25 * 9.5;
|
1439 | let r_y = 10 + bbox.width / 25 * 8.5;
|
1440 | wrapper.attr(
|
1441 | "transform",
|
1442 | "translate(" + r_x + ", " + r_y + ") rotate(-45, " + pos + ", " + y + ")"
|
1443 | );
|
1444 | }
|
1445 | }
|
1446 | if (commit2.tag) {
|
1447 | const rect = gLabels.insert("polygon");
|
1448 | const hole = gLabels.append("circle");
|
1449 | const tag = gLabels.append("text").attr("y", y - 16).attr("class", "tag-label").text(commit2.tag);
|
1450 | let tagBbox = tag.node().getBBox();
|
1451 | tag.attr("x", pos + 10 - tagBbox.width / 2);
|
1452 | const h2 = tagBbox.height / 2;
|
1453 | const ly = y - 19.2;
|
1454 | rect.attr("class", "tag-label-bkg").attr(
|
1455 | "points",
|
1456 | `
|
1457 | ${pos - tagBbox.width / 2 - px / 2},${ly + py}
|
1458 | ${pos - tagBbox.width / 2 - px / 2},${ly - py}
|
1459 | ${pos + 10 - tagBbox.width / 2 - px},${ly - h2 - py}
|
1460 | ${pos + 10 + tagBbox.width / 2 + px},${ly - h2 - py}
|
1461 | ${pos + 10 + tagBbox.width / 2 + px},${ly + h2 + py}
|
1462 | ${pos + 10 - tagBbox.width / 2 - px},${ly + h2 + py}`
|
1463 | );
|
1464 | hole.attr("cx", pos - tagBbox.width / 2 + px / 2).attr("cy", ly).attr("r", 1.5).attr("class", "tag-hole");
|
1465 | }
|
1466 | }
|
1467 | pos += 50;
|
1468 | if (pos > maxPos) {
|
1469 | maxPos = pos;
|
1470 | }
|
1471 | });
|
1472 | };
|
1473 | const hasOverlappingCommits = (commit1, commit2, allCommits) => {
|
1474 | const keys = Object.keys(allCommits);
|
1475 | const overlappingComits = keys.filter((key) => {
|
1476 | return allCommits[key].branch === commit2.branch && allCommits[key].seq > commit1.seq && allCommits[key].seq < commit2.seq;
|
1477 | });
|
1478 | return overlappingComits.length > 0;
|
1479 | };
|
1480 | const findLane = (y1, y2, depth = 0) => {
|
1481 | const candidate = y1 + Math.abs(y1 - y2) / 2;
|
1482 | if (depth > 5) {
|
1483 | return candidate;
|
1484 | }
|
1485 | let ok = lanes.every((lane) => Math.abs(lane - candidate) >= 10);
|
1486 | if (ok) {
|
1487 | lanes.push(candidate);
|
1488 | return candidate;
|
1489 | }
|
1490 | const diff = Math.abs(y1 - y2);
|
1491 | return findLane(y1, y2 - diff / 5, depth + 1);
|
1492 | };
|
1493 | const drawArrow = (svg, commit1, commit2, allCommits) => {
|
1494 | const p1 = commitPos[commit1.id];
|
1495 | const p2 = commitPos[commit2.id];
|
1496 | const overlappingCommits = hasOverlappingCommits(commit1, commit2, allCommits);
|
1497 | let arc = "";
|
1498 | let arc2 = "";
|
1499 | let radius = 0;
|
1500 | let offset = 0;
|
1501 | let colorClassNum = branchPos[commit2.branch].index;
|
1502 | let lineDef;
|
1503 | if (overlappingCommits) {
|
1504 | arc = "A 10 10, 0, 0, 0,";
|
1505 | arc2 = "A 10 10, 0, 0, 1,";
|
1506 | radius = 10;
|
1507 | offset = 10;
|
1508 | colorClassNum = branchPos[commit2.branch].index;
|
1509 | const lineY = p1.y < p2.y ? findLane(p1.y, p2.y) : findLane(p2.y, p1.y);
|
1510 | if (p1.y < p2.y) {
|
1511 | lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY - radius} ${arc} ${p1.x + offset} ${lineY} L ${p2.x - radius} ${lineY} ${arc2} ${p2.x} ${lineY + offset} L ${p2.x} ${p2.y}`;
|
1512 | } else {
|
1513 | lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY + radius} ${arc2} ${p1.x + offset} ${lineY} L ${p2.x - radius} ${lineY} ${arc} ${p2.x} ${lineY - offset} L ${p2.x} ${p2.y}`;
|
1514 | }
|
1515 | } else {
|
1516 | if (p1.y < p2.y) {
|
1517 | arc = "A 20 20, 0, 0, 0,";
|
1518 | radius = 20;
|
1519 | offset = 20;
|
1520 | colorClassNum = branchPos[commit2.branch].index;
|
1521 | lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
1522 | }
|
1523 | if (p1.y > p2.y) {
|
1524 | arc = "A 20 20, 0, 0, 0,";
|
1525 | radius = 20;
|
1526 | offset = 20;
|
1527 | colorClassNum = branchPos[commit1.branch].index;
|
1528 | lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
|
1529 | }
|
1530 | if (p1.y === p2.y) {
|
1531 | colorClassNum = branchPos[commit1.branch].index;
|
1532 | lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
1533 | }
|
1534 | }
|
1535 | svg.append("path").attr("d", lineDef).attr("class", "arrow arrow" + colorClassNum % THEME_COLOR_LIMIT);
|
1536 | };
|
1537 | const drawArrows = (svg, commits2) => {
|
1538 | const gArrows = svg.append("g").attr("class", "commit-arrows");
|
1539 | Object.keys(commits2).forEach((key) => {
|
1540 | const commit2 = commits2[key];
|
1541 | if (commit2.parents && commit2.parents.length > 0) {
|
1542 | commit2.parents.forEach((parent) => {
|
1543 | drawArrow(gArrows, commits2[parent], commit2, commits2);
|
1544 | });
|
1545 | }
|
1546 | });
|
1547 | };
|
1548 | const drawBranches = (svg, branches2) => {
|
1549 | const gitGraphConfig = getConfig$1().gitGraph;
|
1550 | const g = svg.append("g");
|
1551 | branches2.forEach((branch2, index) => {
|
1552 | const adjustIndexForTheme = index % THEME_COLOR_LIMIT;
|
1553 | const pos = branchPos[branch2.name].pos;
|
1554 | const line = g.append("line");
|
1555 | line.attr("x1", 0);
|
1556 | line.attr("y1", pos);
|
1557 | line.attr("x2", maxPos);
|
1558 | line.attr("y2", pos);
|
1559 | line.attr("class", "branch branch" + adjustIndexForTheme);
|
1560 | lanes.push(pos);
|
1561 | let name = branch2.name;
|
1562 | const labelElement = drawText(name);
|
1563 | const bkg = g.insert("rect");
|
1564 | const branchLabel = g.insert("g").attr("class", "branchLabel");
|
1565 | const label = branchLabel.insert("g").attr("class", "label branch-label" + adjustIndexForTheme);
|
1566 | label.node().appendChild(labelElement);
|
1567 | let bbox = labelElement.getBBox();
|
1568 | bkg.attr("class", "branchLabelBkg label" + adjustIndexForTheme).attr("rx", 4).attr("ry", 4).attr("x", -bbox.width - 4 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0)).attr("y", -bbox.height / 2 + 8).attr("width", bbox.width + 18).attr("height", bbox.height + 4);
|
1569 | label.attr(
|
1570 | "transform",
|
1571 | "translate(" + (-bbox.width - 14 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0)) + ", " + (pos - bbox.height / 2 - 1) + ")"
|
1572 | );
|
1573 | bkg.attr("transform", "translate(-19, " + (pos - bbox.height / 2) + ")");
|
1574 | });
|
1575 | };
|
1576 | const draw = function(txt, id, ver, diagObj) {
|
1577 | clear();
|
1578 | const conf = getConfig$1();
|
1579 | const gitGraphConfig = conf.gitGraph;
|
1580 | log.debug("in gitgraph renderer", txt + "\n", "id:", id, ver);
|
1581 | allCommitsDict = diagObj.db.getCommits();
|
1582 | const branches2 = diagObj.db.getBranchesAsObjArray();
|
1583 | let pos = 0;
|
1584 | branches2.forEach((branch2, index) => {
|
1585 | branchPos[branch2.name] = { pos, index };
|
1586 | pos += 50 + (gitGraphConfig.rotateCommitLabel ? 40 : 0);
|
1587 | });
|
1588 | const diagram2 = select(`[id="${id}"]`);
|
1589 | drawCommits(diagram2, allCommitsDict, false);
|
1590 | if (gitGraphConfig.showBranches) {
|
1591 | drawBranches(diagram2, branches2);
|
1592 | }
|
1593 | drawArrows(diagram2, allCommitsDict);
|
1594 | drawCommits(diagram2, allCommitsDict, true);
|
1595 | utils.insertTitle(
|
1596 | diagram2,
|
1597 | "gitTitleText",
|
1598 | gitGraphConfig.titleTopMargin,
|
1599 | diagObj.db.getDiagramTitle()
|
1600 | );
|
1601 | setupGraphViewbox(
|
1602 | void 0,
|
1603 | diagram2,
|
1604 | gitGraphConfig.diagramPadding,
|
1605 | gitGraphConfig.useMaxWidth ?? conf.useMaxWidth
|
1606 | );
|
1607 | };
|
1608 | const gitGraphRenderer = {
|
1609 | draw
|
1610 | };
|
1611 | const getStyles = (options2) => `
|
1612 | .commit-id,
|
1613 | .commit-msg,
|
1614 | .branch-label {
|
1615 | fill: lightgrey;
|
1616 | color: lightgrey;
|
1617 | font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
1618 | font-family: var(--mermaid-font-family);
|
1619 | }
|
1620 | ${[0, 1, 2, 3, 4, 5, 6, 7].map(
|
1621 | (i) => `
|
1622 | .branch-label${i} { fill: ${options2["gitBranchLabel" + i]}; }
|
1623 | .commit${i} { stroke: ${options2["git" + i]}; fill: ${options2["git" + i]}; }
|
1624 | .commit-highlight${i} { stroke: ${options2["gitInv" + i]}; fill: ${options2["gitInv" + i]}; }
|
1625 | .label${i} { fill: ${options2["git" + i]}; }
|
1626 | .arrow${i} { stroke: ${options2["git" + i]}; }
|
1627 | `
|
1628 | ).join("\n")}
|
1629 |
|
1630 | .branch {
|
1631 | stroke-width: 1;
|
1632 | stroke: ${options2.lineColor};
|
1633 | stroke-dasharray: 2;
|
1634 | }
|
1635 | .commit-label { font-size: ${options2.commitLabelFontSize}; fill: ${options2.commitLabelColor};}
|
1636 | .commit-label-bkg { font-size: ${options2.commitLabelFontSize}; fill: ${options2.commitLabelBackground}; opacity: 0.5; }
|
1637 | .tag-label { font-size: ${options2.tagLabelFontSize}; fill: ${options2.tagLabelColor};}
|
1638 | .tag-label-bkg { fill: ${options2.tagLabelBackground}; stroke: ${options2.tagLabelBorder}; }
|
1639 | .tag-hole { fill: ${options2.textColor}; }
|
1640 |
|
1641 | .commit-merge {
|
1642 | stroke: ${options2.primaryColor};
|
1643 | fill: ${options2.primaryColor};
|
1644 | }
|
1645 | .commit-reverse {
|
1646 | stroke: ${options2.primaryColor};
|
1647 | fill: ${options2.primaryColor};
|
1648 | stroke-width: 3;
|
1649 | }
|
1650 | .commit-highlight-outer {
|
1651 | }
|
1652 | .commit-highlight-inner {
|
1653 | stroke: ${options2.primaryColor};
|
1654 | fill: ${options2.primaryColor};
|
1655 | }
|
1656 |
|
1657 | .arrow { stroke-width: 8; stroke-linecap: round; fill: none}
|
1658 | .gitTitleText {
|
1659 | text-anchor: middle;
|
1660 | font-size: 18px;
|
1661 | fill: ${options2.textColor};
|
1662 | }
|
1663 | `;
|
1664 | const gitGraphStyles = getStyles;
|
1665 | const diagram = {
|
1666 | parser: gitGraphParser,
|
1667 | db: gitGraphDb,
|
1668 | renderer: gitGraphRenderer,
|
1669 | styles: gitGraphStyles
|
1670 | };
|
1671 | export {
|
1672 | diagram
|
1673 | };
|
1674 |
|
\ | No newline at end of file |