1 | import { l as log, A as selectSvgElement, i as configureSvgSize } from "./mermaid-6dc72991.js";
|
2 | import "ts-dedent";
|
3 | import "dayjs";
|
4 | import "@braintree/sanitize-url";
|
5 | import "d3";
|
6 | import "dompurify";
|
7 | import "khroma";
|
8 | import "lodash-es/memoize.js";
|
9 | import "lodash-es/merge.js";
|
10 | import "stylis";
|
11 | import "lodash-es/isEmpty.js";
|
12 | var parser = function() {
|
13 | var o = function(k, v, o2, l) {
|
14 | for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
|
15 | ;
|
16 | return o2;
|
17 | }, $V0 = [6, 9, 10];
|
18 | var parser2 = {
|
19 | trace: function trace() {
|
20 | },
|
21 | yy: {},
|
22 | symbols_: { "error": 2, "start": 3, "info": 4, "document": 5, "EOF": 6, "line": 7, "statement": 8, "NL": 9, "showInfo": 10, "$accept": 0, "$end": 1 },
|
23 | terminals_: { 2: "error", 4: "info", 6: "EOF", 9: "NL", 10: "showInfo" },
|
24 | productions_: [0, [3, 3], [5, 0], [5, 2], [7, 1], [7, 1], [8, 1]],
|
25 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
|
26 | $$.length - 1;
|
27 | switch (yystate) {
|
28 | case 1:
|
29 | return yy;
|
30 | case 4:
|
31 | break;
|
32 | case 6:
|
33 | yy.setInfo(true);
|
34 | break;
|
35 | }
|
36 | },
|
37 | table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: 6, 9: [1, 7], 10: [1, 8] }, { 1: [2, 1] }, o($V0, [2, 3]), o($V0, [2, 4]), o($V0, [2, 5]), o($V0, [2, 6])],
|
38 | defaultActions: { 4: [2, 1] },
|
39 | parseError: function parseError(str, hash) {
|
40 | if (hash.recoverable) {
|
41 | this.trace(str);
|
42 | } else {
|
43 | var error = new Error(str);
|
44 | error.hash = hash;
|
45 | throw error;
|
46 | }
|
47 | },
|
48 | parse: function parse(input) {
|
49 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
|
50 | var args = lstack.slice.call(arguments, 1);
|
51 | var lexer2 = Object.create(this.lexer);
|
52 | var sharedState = { yy: {} };
|
53 | for (var k in this.yy) {
|
54 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
55 | sharedState.yy[k] = this.yy[k];
|
56 | }
|
57 | }
|
58 | lexer2.setInput(input, sharedState.yy);
|
59 | sharedState.yy.lexer = lexer2;
|
60 | sharedState.yy.parser = this;
|
61 | if (typeof lexer2.yylloc == "undefined") {
|
62 | lexer2.yylloc = {};
|
63 | }
|
64 | var yyloc = lexer2.yylloc;
|
65 | lstack.push(yyloc);
|
66 | var ranges = lexer2.options && lexer2.options.ranges;
|
67 | if (typeof sharedState.yy.parseError === "function") {
|
68 | this.parseError = sharedState.yy.parseError;
|
69 | } else {
|
70 | this.parseError = Object.getPrototypeOf(this).parseError;
|
71 | }
|
72 | function lex() {
|
73 | var token;
|
74 | token = tstack.pop() || lexer2.lex() || EOF;
|
75 | if (typeof token !== "number") {
|
76 | if (token instanceof Array) {
|
77 | tstack = token;
|
78 | token = tstack.pop();
|
79 | }
|
80 | token = self.symbols_[token] || token;
|
81 | }
|
82 | return token;
|
83 | }
|
84 | var symbol, state, action, r, yyval = {}, p, len, newState, expected;
|
85 | while (true) {
|
86 | state = stack[stack.length - 1];
|
87 | if (this.defaultActions[state]) {
|
88 | action = this.defaultActions[state];
|
89 | } else {
|
90 | if (symbol === null || typeof symbol == "undefined") {
|
91 | symbol = lex();
|
92 | }
|
93 | action = table[state] && table[state][symbol];
|
94 | }
|
95 | if (typeof action === "undefined" || !action.length || !action[0]) {
|
96 | var errStr = "";
|
97 | expected = [];
|
98 | for (p in table[state]) {
|
99 | if (this.terminals_[p] && p > TERROR) {
|
100 | expected.push("'" + this.terminals_[p] + "'");
|
101 | }
|
102 | }
|
103 | if (lexer2.showPosition) {
|
104 | errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
105 | } else {
|
106 | errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
|
107 | }
|
108 | this.parseError(errStr, {
|
109 | text: lexer2.match,
|
110 | token: this.terminals_[symbol] || symbol,
|
111 | line: lexer2.yylineno,
|
112 | loc: yyloc,
|
113 | expected
|
114 | });
|
115 | }
|
116 | if (action[0] instanceof Array && action.length > 1) {
|
117 | throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
118 | }
|
119 | switch (action[0]) {
|
120 | case 1:
|
121 | stack.push(symbol);
|
122 | vstack.push(lexer2.yytext);
|
123 | lstack.push(lexer2.yylloc);
|
124 | stack.push(action[1]);
|
125 | symbol = null;
|
126 | {
|
127 | yyleng = lexer2.yyleng;
|
128 | yytext = lexer2.yytext;
|
129 | yylineno = lexer2.yylineno;
|
130 | yyloc = lexer2.yylloc;
|
131 | }
|
132 | break;
|
133 | case 2:
|
134 | len = this.productions_[action[1]][1];
|
135 | yyval.$ = vstack[vstack.length - len];
|
136 | yyval._$ = {
|
137 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
138 | last_line: lstack[lstack.length - 1].last_line,
|
139 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
140 | last_column: lstack[lstack.length - 1].last_column
|
141 | };
|
142 | if (ranges) {
|
143 | yyval._$.range = [
|
144 | lstack[lstack.length - (len || 1)].range[0],
|
145 | lstack[lstack.length - 1].range[1]
|
146 | ];
|
147 | }
|
148 | r = this.performAction.apply(yyval, [
|
149 | yytext,
|
150 | yyleng,
|
151 | yylineno,
|
152 | sharedState.yy,
|
153 | action[1],
|
154 | vstack,
|
155 | lstack
|
156 | ].concat(args));
|
157 | if (typeof r !== "undefined") {
|
158 | return r;
|
159 | }
|
160 | if (len) {
|
161 | stack = stack.slice(0, -1 * len * 2);
|
162 | vstack = vstack.slice(0, -1 * len);
|
163 | lstack = lstack.slice(0, -1 * len);
|
164 | }
|
165 | stack.push(this.productions_[action[1]][0]);
|
166 | vstack.push(yyval.$);
|
167 | lstack.push(yyval._$);
|
168 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
169 | stack.push(newState);
|
170 | break;
|
171 | case 3:
|
172 | return true;
|
173 | }
|
174 | }
|
175 | return true;
|
176 | }
|
177 | };
|
178 | var lexer = function() {
|
179 | var lexer2 = {
|
180 | EOF: 1,
|
181 | parseError: function parseError(str, hash) {
|
182 | if (this.yy.parser) {
|
183 | this.yy.parser.parseError(str, hash);
|
184 | } else {
|
185 | throw new Error(str);
|
186 | }
|
187 | },
|
188 |
|
189 | setInput: function(input, yy) {
|
190 | this.yy = yy || this.yy || {};
|
191 | this._input = input;
|
192 | this._more = this._backtrack = this.done = false;
|
193 | this.yylineno = this.yyleng = 0;
|
194 | this.yytext = this.matched = this.match = "";
|
195 | this.conditionStack = ["INITIAL"];
|
196 | this.yylloc = {
|
197 | first_line: 1,
|
198 | first_column: 0,
|
199 | last_line: 1,
|
200 | last_column: 0
|
201 | };
|
202 | if (this.options.ranges) {
|
203 | this.yylloc.range = [0, 0];
|
204 | }
|
205 | this.offset = 0;
|
206 | return this;
|
207 | },
|
208 |
|
209 | input: function() {
|
210 | var ch = this._input[0];
|
211 | this.yytext += ch;
|
212 | this.yyleng++;
|
213 | this.offset++;
|
214 | this.match += ch;
|
215 | this.matched += ch;
|
216 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
217 | if (lines) {
|
218 | this.yylineno++;
|
219 | this.yylloc.last_line++;
|
220 | } else {
|
221 | this.yylloc.last_column++;
|
222 | }
|
223 | if (this.options.ranges) {
|
224 | this.yylloc.range[1]++;
|
225 | }
|
226 | this._input = this._input.slice(1);
|
227 | return ch;
|
228 | },
|
229 |
|
230 | unput: function(ch) {
|
231 | var len = ch.length;
|
232 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
233 | this._input = ch + this._input;
|
234 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
235 | this.offset -= len;
|
236 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
237 | this.match = this.match.substr(0, this.match.length - 1);
|
238 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
239 | if (lines.length - 1) {
|
240 | this.yylineno -= lines.length - 1;
|
241 | }
|
242 | var r = this.yylloc.range;
|
243 | this.yylloc = {
|
244 | first_line: this.yylloc.first_line,
|
245 | last_line: this.yylineno + 1,
|
246 | first_column: this.yylloc.first_column,
|
247 | 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
|
248 | };
|
249 | if (this.options.ranges) {
|
250 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
251 | }
|
252 | this.yyleng = this.yytext.length;
|
253 | return this;
|
254 | },
|
255 |
|
256 | more: function() {
|
257 | this._more = true;
|
258 | return this;
|
259 | },
|
260 |
|
261 | reject: function() {
|
262 | if (this.options.backtrack_lexer) {
|
263 | this._backtrack = true;
|
264 | } else {
|
265 | 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(), {
|
266 | text: "",
|
267 | token: null,
|
268 | line: this.yylineno
|
269 | });
|
270 | }
|
271 | return this;
|
272 | },
|
273 |
|
274 | less: function(n) {
|
275 | this.unput(this.match.slice(n));
|
276 | },
|
277 |
|
278 | pastInput: function() {
|
279 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
280 | return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
|
281 | },
|
282 |
|
283 | upcomingInput: function() {
|
284 | var next = this.match;
|
285 | if (next.length < 20) {
|
286 | next += this._input.substr(0, 20 - next.length);
|
287 | }
|
288 | return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
|
289 | },
|
290 |
|
291 | showPosition: function() {
|
292 | var pre = this.pastInput();
|
293 | var c = new Array(pre.length + 1).join("-");
|
294 | return pre + this.upcomingInput() + "\n" + c + "^";
|
295 | },
|
296 |
|
297 | test_match: function(match, indexed_rule) {
|
298 | var token, lines, backup;
|
299 | if (this.options.backtrack_lexer) {
|
300 | backup = {
|
301 | yylineno: this.yylineno,
|
302 | yylloc: {
|
303 | first_line: this.yylloc.first_line,
|
304 | last_line: this.last_line,
|
305 | first_column: this.yylloc.first_column,
|
306 | last_column: this.yylloc.last_column
|
307 | },
|
308 | yytext: this.yytext,
|
309 | match: this.match,
|
310 | matches: this.matches,
|
311 | matched: this.matched,
|
312 | yyleng: this.yyleng,
|
313 | offset: this.offset,
|
314 | _more: this._more,
|
315 | _input: this._input,
|
316 | yy: this.yy,
|
317 | conditionStack: this.conditionStack.slice(0),
|
318 | done: this.done
|
319 | };
|
320 | if (this.options.ranges) {
|
321 | backup.yylloc.range = this.yylloc.range.slice(0);
|
322 | }
|
323 | }
|
324 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
325 | if (lines) {
|
326 | this.yylineno += lines.length;
|
327 | }
|
328 | this.yylloc = {
|
329 | first_line: this.yylloc.last_line,
|
330 | last_line: this.yylineno + 1,
|
331 | first_column: this.yylloc.last_column,
|
332 | last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
|
333 | };
|
334 | this.yytext += match[0];
|
335 | this.match += match[0];
|
336 | this.matches = match;
|
337 | this.yyleng = this.yytext.length;
|
338 | if (this.options.ranges) {
|
339 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
340 | }
|
341 | this._more = false;
|
342 | this._backtrack = false;
|
343 | this._input = this._input.slice(match[0].length);
|
344 | this.matched += match[0];
|
345 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
346 | if (this.done && this._input) {
|
347 | this.done = false;
|
348 | }
|
349 | if (token) {
|
350 | return token;
|
351 | } else if (this._backtrack) {
|
352 | for (var k in backup) {
|
353 | this[k] = backup[k];
|
354 | }
|
355 | return false;
|
356 | }
|
357 | return false;
|
358 | },
|
359 |
|
360 | next: function() {
|
361 | if (this.done) {
|
362 | return this.EOF;
|
363 | }
|
364 | if (!this._input) {
|
365 | this.done = true;
|
366 | }
|
367 | var token, match, tempMatch, index;
|
368 | if (!this._more) {
|
369 | this.yytext = "";
|
370 | this.match = "";
|
371 | }
|
372 | var rules = this._currentRules();
|
373 | for (var i = 0; i < rules.length; i++) {
|
374 | tempMatch = this._input.match(this.rules[rules[i]]);
|
375 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
376 | match = tempMatch;
|
377 | index = i;
|
378 | if (this.options.backtrack_lexer) {
|
379 | token = this.test_match(tempMatch, rules[i]);
|
380 | if (token !== false) {
|
381 | return token;
|
382 | } else if (this._backtrack) {
|
383 | match = false;
|
384 | continue;
|
385 | } else {
|
386 | return false;
|
387 | }
|
388 | } else if (!this.options.flex) {
|
389 | break;
|
390 | }
|
391 | }
|
392 | }
|
393 | if (match) {
|
394 | token = this.test_match(match, rules[index]);
|
395 | if (token !== false) {
|
396 | return token;
|
397 | }
|
398 | return false;
|
399 | }
|
400 | if (this._input === "") {
|
401 | return this.EOF;
|
402 | } else {
|
403 | return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
|
404 | text: "",
|
405 | token: null,
|
406 | line: this.yylineno
|
407 | });
|
408 | }
|
409 | },
|
410 |
|
411 | lex: function lex() {
|
412 | var r = this.next();
|
413 | if (r) {
|
414 | return r;
|
415 | } else {
|
416 | return this.lex();
|
417 | }
|
418 | },
|
419 |
|
420 | begin: function begin(condition) {
|
421 | this.conditionStack.push(condition);
|
422 | },
|
423 |
|
424 | popState: function popState() {
|
425 | var n = this.conditionStack.length - 1;
|
426 | if (n > 0) {
|
427 | return this.conditionStack.pop();
|
428 | } else {
|
429 | return this.conditionStack[0];
|
430 | }
|
431 | },
|
432 |
|
433 | _currentRules: function _currentRules() {
|
434 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
435 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
436 | } else {
|
437 | return this.conditions["INITIAL"].rules;
|
438 | }
|
439 | },
|
440 |
|
441 | topState: function topState(n) {
|
442 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
443 | if (n >= 0) {
|
444 | return this.conditionStack[n];
|
445 | } else {
|
446 | return "INITIAL";
|
447 | }
|
448 | },
|
449 |
|
450 | pushState: function pushState(condition) {
|
451 | this.begin(condition);
|
452 | },
|
453 |
|
454 | stateStackSize: function stateStackSize() {
|
455 | return this.conditionStack.length;
|
456 | },
|
457 | options: { "case-insensitive": true },
|
458 | performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
|
459 | switch ($avoiding_name_collisions) {
|
460 | case 0:
|
461 | return 4;
|
462 | case 1:
|
463 | return 9;
|
464 | case 2:
|
465 | return "space";
|
466 | case 3:
|
467 | return 10;
|
468 | case 4:
|
469 | return 6;
|
470 | case 5:
|
471 | return "TXT";
|
472 | }
|
473 | },
|
474 | rules: [/^(?:info\b)/i, /^(?:[\s\n\r]+)/i, /^(?:[\s]+)/i, /^(?:showInfo\b)/i, /^(?:$)/i, /^(?:.)/i],
|
475 | conditions: { "INITIAL": { "rules": [0, 1, 2, 3, 4, 5], "inclusive": true } }
|
476 | };
|
477 | return lexer2;
|
478 | }();
|
479 | parser2.lexer = lexer;
|
480 | function Parser() {
|
481 | this.yy = {};
|
482 | }
|
483 | Parser.prototype = parser2;
|
484 | parser2.Parser = Parser;
|
485 | return new Parser();
|
486 | }();
|
487 | parser.parser = parser;
|
488 | const parser$1 = parser;
|
489 | const DEFAULT_INFO_DB = {
|
490 | info: false
|
491 | };
|
492 | let info = DEFAULT_INFO_DB.info;
|
493 | const setInfo = (toggle) => {
|
494 | info = toggle;
|
495 | };
|
496 | const getInfo = () => info;
|
497 | const clear = () => {
|
498 | info = DEFAULT_INFO_DB.info;
|
499 | };
|
500 | const db = {
|
501 | clear,
|
502 | setInfo,
|
503 | getInfo
|
504 | };
|
505 | const draw = (text, id, version) => {
|
506 | log.debug("rendering info diagram\n" + text);
|
507 | const svg = selectSvgElement(id);
|
508 | configureSvgSize(svg, 100, 400, true);
|
509 | const group = svg.append("g");
|
510 | group.append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${version}`);
|
511 | };
|
512 | const renderer = { draw };
|
513 | const diagram = {
|
514 | parser: parser$1,
|
515 | db,
|
516 | renderer
|
517 | };
|
518 | export {
|
519 | diagram
|
520 | };
|