UNPKG

mermaid

Version:

Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.

1,110 lines 134 kB
import { g as getAccTitle, t as getDiagramTitle, r as setDiagramTitle, c as getConfig, s as setAccTitle, b as setAccDescription, a as getAccDescription, m as mermaidAPI, v as clear$1, l as log, d as sanitizeText, e as common, B as parseFontSize, E as addFunction, f as assignWithDepth, i as configureSvgSize, u as utils } from "./mermaid-a953d906.js"; import { select, selectAll } from "d3"; import { d as drawRect$1, a as drawBackgroundRect$1, b as drawEmbeddedImage, c as drawImage, e as getTextObj$1, g as getNoteRect$1 } from "./svgDrawCommon-f26cad39.js"; import { sanitizeUrl } from "@braintree/sanitize-url"; import "ts-dedent"; import "dayjs/esm/index.js"; import "dompurify"; import "khroma"; import "lodash-es/memoize.js"; import "stylis"; import "lodash-es/isEmpty.js"; var parser = function() { var o = function(k, v, o2, l) { for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ; return o2; }, $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 5], $V3 = [1, 7], $V4 = [2, 5], $V5 = [1, 15], $V6 = [1, 17], $V7 = [1, 19], $V8 = [1, 21], $V9 = [1, 22], $Va = [1, 23], $Vb = [1, 29], $Vc = [1, 30], $Vd = [1, 31], $Ve = [1, 32], $Vf = [1, 33], $Vg = [1, 34], $Vh = [1, 35], $Vi = [1, 36], $Vj = [1, 37], $Vk = [1, 38], $Vl = [1, 39], $Vm = [1, 40], $Vn = [1, 41], $Vo = [1, 43], $Vp = [1, 44], $Vq = [1, 46], $Vr = [1, 47], $Vs = [1, 48], $Vt = [1, 49], $Vu = [1, 50], $Vv = [1, 51], $Vw = [1, 54], $Vx = [1, 4, 5, 19, 21, 23, 26, 28, 34, 35, 36, 38, 40, 41, 42, 43, 44, 46, 48, 49, 51, 52, 53, 54, 55, 57, 58, 63, 64, 65, 66, 74, 84], $Vy = [4, 5, 21, 55, 57], $Vz = [4, 5, 19, 21, 23, 26, 28, 34, 35, 36, 38, 40, 41, 42, 43, 44, 46, 48, 49, 51, 55, 57, 58, 63, 64, 65, 66, 74, 84], $VA = [4, 5, 19, 21, 23, 26, 28, 34, 35, 36, 38, 40, 41, 42, 43, 44, 46, 48, 49, 51, 54, 55, 57, 58, 63, 64, 65, 66, 74, 84], $VB = [4, 5, 19, 21, 23, 26, 28, 34, 35, 36, 38, 40, 41, 42, 43, 44, 46, 48, 49, 51, 53, 55, 57, 58, 63, 64, 65, 66, 74, 84], $VC = [4, 5, 19, 21, 23, 26, 28, 34, 35, 36, 38, 40, 41, 42, 43, 44, 46, 48, 49, 51, 52, 55, 57, 58, 63, 64, 65, 66, 74, 84], $VD = [72, 73, 74], $VE = [1, 128], $VF = [1, 4, 5, 7, 19, 21, 23, 26, 28, 34, 35, 36, 38, 40, 41, 42, 43, 44, 46, 48, 49, 51, 52, 53, 54, 55, 57, 58, 63, 64, 65, 66, 74, 84]; var parser2 = { trace: function trace() { }, yy: {}, symbols_: { "error": 2, "start": 3, "SPACE": 4, "NEWLINE": 5, "directive": 6, "SD": 7, "document": 8, "line": 9, "statement": 10, "box_section": 11, "box_line": 12, "participant_statement": 13, "openDirective": 14, "typeDirective": 15, "closeDirective": 16, ":": 17, "argDirective": 18, "box": 19, "restOfLine": 20, "end": 21, "signal": 22, "autonumber": 23, "NUM": 24, "off": 25, "activate": 26, "actor": 27, "deactivate": 28, "note_statement": 29, "links_statement": 30, "link_statement": 31, "properties_statement": 32, "details_statement": 33, "title": 34, "legacy_title": 35, "acc_title": 36, "acc_title_value": 37, "acc_descr": 38, "acc_descr_value": 39, "acc_descr_multiline_value": 40, "loop": 41, "rect": 42, "opt": 43, "alt": 44, "else_sections": 45, "par": 46, "par_sections": 47, "par_over": 48, "critical": 49, "option_sections": 50, "break": 51, "option": 52, "and": 53, "else": 54, "participant": 55, "AS": 56, "participant_actor": 57, "note": 58, "placement": 59, "text2": 60, "over": 61, "actor_pair": 62, "links": 63, "link": 64, "properties": 65, "details": 66, "spaceList": 67, ",": 68, "left_of": 69, "right_of": 70, "signaltype": 71, "+": 72, "-": 73, "ACTOR": 74, "SOLID_OPEN_ARROW": 75, "DOTTED_OPEN_ARROW": 76, "SOLID_ARROW": 77, "DOTTED_ARROW": 78, "SOLID_CROSS": 79, "DOTTED_CROSS": 80, "SOLID_POINT": 81, "DOTTED_POINT": 82, "TXT": 83, "open_directive": 84, "type_directive": 85, "arg_directive": 86, "close_directive": 87, "$accept": 0, "$end": 1 }, terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 7: "SD", 17: ":", 19: "box", 20: "restOfLine", 21: "end", 23: "autonumber", 24: "NUM", 25: "off", 26: "activate", 28: "deactivate", 34: "title", 35: "legacy_title", 36: "acc_title", 37: "acc_title_value", 38: "acc_descr", 39: "acc_descr_value", 40: "acc_descr_multiline_value", 41: "loop", 42: "rect", 43: "opt", 44: "alt", 46: "par", 48: "par_over", 49: "critical", 51: "break", 52: "option", 53: "and", 54: "else", 55: "participant", 56: "AS", 57: "participant_actor", 58: "note", 61: "over", 63: "links", 64: "link", 65: "properties", 66: "details", 68: ",", 69: "left_of", 70: "right_of", 72: "+", 73: "-", 74: "ACTOR", 75: "SOLID_OPEN_ARROW", 76: "DOTTED_OPEN_ARROW", 77: "SOLID_ARROW", 78: "DOTTED_ARROW", 79: "SOLID_CROSS", 80: "DOTTED_CROSS", 81: "SOLID_POINT", 82: "DOTTED_POINT", 83: "TXT", 84: "open_directive", 85: "type_directive", 86: "arg_directive", 87: "close_directive" }, productions_: [0, [3, 2], [3, 2], [3, 2], [3, 2], [8, 0], [8, 2], [9, 2], [9, 1], [9, 1], [11, 0], [11, 2], [12, 2], [12, 1], [12, 1], [6, 4], [6, 6], [10, 1], [10, 4], [10, 2], [10, 4], [10, 3], [10, 3], [10, 2], [10, 3], [10, 3], [10, 2], [10, 2], [10, 2], [10, 2], [10, 2], [10, 1], [10, 1], [10, 2], [10, 2], [10, 1], [10, 4], [10, 4], [10, 4], [10, 4], [10, 4], [10, 4], [10, 4], [10, 4], [10, 1], [50, 1], [50, 4], [47, 1], [47, 4], [45, 1], [45, 4], [13, 5], [13, 3], [13, 5], [13, 3], [29, 4], [29, 4], [30, 3], [31, 3], [32, 3], [33, 3], [67, 2], [67, 1], [62, 3], [62, 1], [59, 1], [59, 1], [22, 5], [22, 5], [22, 4], [27, 1], [71, 1], [71, 1], [71, 1], [71, 1], [71, 1], [71, 1], [71, 1], [71, 1], [60, 1], [14, 1], [15, 1], [18, 1], [16, 1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { var $0 = $$.length - 1; switch (yystate) { case 4: yy.apply($$[$0]); return $$[$0]; case 5: case 10: this.$ = []; break; case 6: case 11: $$[$0 - 1].push($$[$0]); this.$ = $$[$0 - 1]; break; case 7: case 8: case 12: case 13: this.$ = $$[$0]; break; case 9: case 14: this.$ = []; break; case 18: $$[$0 - 1].unshift({ type: "boxStart", boxData: yy.parseBoxData($$[$0 - 2]) }); $$[$0 - 1].push({ type: "boxEnd", boxText: $$[$0 - 2] }); this.$ = $$[$0 - 1]; break; case 20: this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 2]), sequenceIndexStep: Number($$[$0 - 1]), sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER }; break; case 21: this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 1]), sequenceIndexStep: 1, sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER }; break; case 22: this.$ = { type: "sequenceIndex", sequenceVisible: false, signalType: yy.LINETYPE.AUTONUMBER }; break; case 23: this.$ = { type: "sequenceIndex", sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER }; break; case 24: this.$ = { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1] }; break; case 25: this.$ = { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 1] }; break; case 31: yy.setDiagramTitle($$[$0].substring(6)); this.$ = $$[$0].substring(6); break; case 32: yy.setDiagramTitle($$[$0].substring(7)); this.$ = $$[$0].substring(7); break; case 33: this.$ = $$[$0].trim(); yy.setAccTitle(this.$); break; case 34: case 35: this.$ = $$[$0].trim(); yy.setAccDescription(this.$); break; case 36: $$[$0 - 1].unshift({ type: "loopStart", loopText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.LOOP_START }); $$[$0 - 1].push({ type: "loopEnd", loopText: $$[$0 - 2], signalType: yy.LINETYPE.LOOP_END }); this.$ = $$[$0 - 1]; break; case 37: $$[$0 - 1].unshift({ type: "rectStart", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_START }); $$[$0 - 1].push({ type: "rectEnd", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_END }); this.$ = $$[$0 - 1]; break; case 38: $$[$0 - 1].unshift({ type: "optStart", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_START }); $$[$0 - 1].push({ type: "optEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_END }); this.$ = $$[$0 - 1]; break; case 39: $$[$0 - 1].unshift({ type: "altStart", altText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.ALT_START }); $$[$0 - 1].push({ type: "altEnd", signalType: yy.LINETYPE.ALT_END }); this.$ = $$[$0 - 1]; break; case 40: $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_START }); $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END }); this.$ = $$[$0 - 1]; break; case 41: $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_OVER_START }); $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END }); this.$ = $$[$0 - 1]; break; case 42: $$[$0 - 1].unshift({ type: "criticalStart", criticalText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.CRITICAL_START }); $$[$0 - 1].push({ type: "criticalEnd", signalType: yy.LINETYPE.CRITICAL_END }); this.$ = $$[$0 - 1]; break; case 43: $$[$0 - 1].unshift({ type: "breakStart", breakText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_START }); $$[$0 - 1].push({ type: "breakEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_END }); this.$ = $$[$0 - 1]; break; case 46: this.$ = $$[$0 - 3].concat([{ type: "option", optionText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.CRITICAL_OPTION }, $$[$0]]); break; case 48: this.$ = $$[$0 - 3].concat([{ type: "and", parText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.PAR_AND }, $$[$0]]); break; case 50: this.$ = $$[$0 - 3].concat([{ type: "else", altText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.ALT_ELSE }, $$[$0]]); break; case 51: $$[$0 - 3].type = "addParticipant"; $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]); this.$ = $$[$0 - 3]; break; case 52: $$[$0 - 1].type = "addParticipant"; this.$ = $$[$0 - 1]; break; case 53: $$[$0 - 3].type = "addActor"; $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]); this.$ = $$[$0 - 3]; break; case 54: $$[$0 - 1].type = "addActor"; this.$ = $$[$0 - 1]; break; case 55: this.$ = [$$[$0 - 1], { type: "addNote", placement: $$[$0 - 2], actor: $$[$0 - 1].actor, text: $$[$0] }]; break; case 56: $$[$0 - 2] = [].concat($$[$0 - 1], $$[$0 - 1]).slice(0, 2); $$[$0 - 2][0] = $$[$0 - 2][0].actor; $$[$0 - 2][1] = $$[$0 - 2][1].actor; this.$ = [$$[$0 - 1], { type: "addNote", placement: yy.PLACEMENT.OVER, actor: $$[$0 - 2].slice(0, 2), text: $$[$0] }]; break; case 57: this.$ = [$$[$0 - 1], { type: "addLinks", actor: $$[$0 - 1].actor, text: $$[$0] }]; break; case 58: this.$ = [$$[$0 - 1], { type: "addALink", actor: $$[$0 - 1].actor, text: $$[$0] }]; break; case 59: this.$ = [$$[$0 - 1], { type: "addProperties", actor: $$[$0 - 1].actor, text: $$[$0] }]; break; case 60: this.$ = [$$[$0 - 1], { type: "addDetails", actor: $$[$0 - 1].actor, text: $$[$0] }]; break; case 63: this.$ = [$$[$0 - 2], $$[$0]]; break; case 64: this.$ = $$[$0]; break; case 65: this.$ = yy.PLACEMENT.LEFTOF; break; case 66: this.$ = yy.PLACEMENT.RIGHTOF; break; case 67: this.$ = [ $$[$0 - 4], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0] }, { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1] } ]; break; case 68: this.$ = [ $$[$0 - 4], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0] }, { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 4] } ]; break; case 69: this.$ = [$$[$0 - 3], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 3].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0] }]; break; case 70: this.$ = { type: "addParticipant", actor: $$[$0] }; break; case 71: this.$ = yy.LINETYPE.SOLID_OPEN; break; case 72: this.$ = yy.LINETYPE.DOTTED_OPEN; break; case 73: this.$ = yy.LINETYPE.SOLID; break; case 74: this.$ = yy.LINETYPE.DOTTED; break; case 75: this.$ = yy.LINETYPE.SOLID_CROSS; break; case 76: this.$ = yy.LINETYPE.DOTTED_CROSS; break; case 77: this.$ = yy.LINETYPE.SOLID_POINT; break; case 78: this.$ = yy.LINETYPE.DOTTED_POINT; break; case 79: this.$ = yy.parseMessage($$[$0].trim().substring(1)); break; case 80: yy.parseDirective("%%{", "open_directive"); break; case 81: yy.parseDirective($$[$0], "type_directive"); break; case 82: $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], "arg_directive"); break; case 83: yy.parseDirective("}%%", "close_directive", "sequence"); break; } }, table: [{ 3: 1, 4: $V0, 5: $V1, 6: 4, 7: $V2, 14: 6, 84: $V3 }, { 1: [3] }, { 3: 8, 4: $V0, 5: $V1, 6: 4, 7: $V2, 14: 6, 84: $V3 }, { 3: 9, 4: $V0, 5: $V1, 6: 4, 7: $V2, 14: 6, 84: $V3 }, { 3: 10, 4: $V0, 5: $V1, 6: 4, 7: $V2, 14: 6, 84: $V3 }, o([1, 4, 5, 19, 23, 26, 28, 34, 35, 36, 38, 40, 41, 42, 43, 44, 46, 48, 49, 51, 55, 57, 58, 63, 64, 65, 66, 74, 84], $V4, { 8: 11 }), { 15: 12, 85: [1, 13] }, { 85: [2, 80] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3] }, { 1: [2, 4], 4: $V5, 5: $V6, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: $V7, 22: 20, 23: $V8, 26: $V9, 27: 45, 28: $Va, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: $Vb, 35: $Vc, 36: $Vd, 38: $Ve, 40: $Vf, 41: $Vg, 42: $Vh, 43: $Vi, 44: $Vj, 46: $Vk, 48: $Vl, 49: $Vm, 51: $Vn, 55: $Vo, 57: $Vp, 58: $Vq, 63: $Vr, 64: $Vs, 65: $Vt, 66: $Vu, 74: $Vv, 84: $V3 }, { 16: 52, 17: [1, 53], 87: $Vw }, o([17, 87], [2, 81]), o($Vx, [2, 6]), { 6: 42, 10: 55, 13: 18, 14: 6, 19: $V7, 22: 20, 23: $V8, 26: $V9, 27: 45, 28: $Va, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: $Vb, 35: $Vc, 36: $Vd, 38: $Ve, 40: $Vf, 41: $Vg, 42: $Vh, 43: $Vi, 44: $Vj, 46: $Vk, 48: $Vl, 49: $Vm, 51: $Vn, 55: $Vo, 57: $Vp, 58: $Vq, 63: $Vr, 64: $Vs, 65: $Vt, 66: $Vu, 74: $Vv, 84: $V3 }, o($Vx, [2, 8]), o($Vx, [2, 9]), o($Vx, [2, 17]), { 20: [1, 56] }, { 5: [1, 57] }, { 5: [1, 60], 24: [1, 58], 25: [1, 59] }, { 27: 61, 74: $Vv }, { 27: 62, 74: $Vv }, { 5: [1, 63] }, { 5: [1, 64] }, { 5: [1, 65] }, { 5: [1, 66] }, { 5: [1, 67] }, o($Vx, [2, 31]), o($Vx, [2, 32]), { 37: [1, 68] }, { 39: [1, 69] }, o($Vx, [2, 35]), { 20: [1, 70] }, { 20: [1, 71] }, { 20: [1, 72] }, { 20: [1, 73] }, { 20: [1, 74] }, { 20: [1, 75] }, { 20: [1, 76] }, { 20: [1, 77] }, o($Vx, [2, 44]), { 27: 78, 74: $Vv }, { 27: 79, 74: $Vv }, { 71: 80, 75: [1, 81], 76: [1, 82], 77: [1, 83], 78: [1, 84], 79: [1, 85], 80: [1, 86], 81: [1, 87], 82: [1, 88] }, { 59: 89, 61: [1, 90], 69: [1, 91], 70: [1, 92] }, { 27: 93, 74: $Vv }, { 27: 94, 74: $Vv }, { 27: 95, 74: $Vv }, { 27: 96, 74: $Vv }, o([5, 56, 68, 75, 76, 77, 78, 79, 80, 81, 82, 83], [2, 70]), { 5: [1, 97] }, { 18: 98, 86: [1, 99] }, { 5: [2, 83] }, o($Vx, [2, 7]), o($Vy, [2, 10], { 11: 100 }), o($Vx, [2, 19]), { 5: [1, 102], 24: [1, 101] }, { 5: [1, 103] }, o($Vx, [2, 23]), { 5: [1, 104] }, { 5: [1, 105] }, o($Vx, [2, 26]), o($Vx, [2, 27]), o($Vx, [2, 28]), o($Vx, [2, 29]), o($Vx, [2, 30]), o($Vx, [2, 33]), o($Vx, [2, 34]), o($Vz, $V4, { 8: 106 }), o($Vz, $V4, { 8: 107 }), o($Vz, $V4, { 8: 108 }), o($VA, $V4, { 45: 109, 8: 110 }), o($VB, $V4, { 47: 111, 8: 112 }), o($VB, $V4, { 8: 112, 47: 113 }), o($VC, $V4, { 50: 114, 8: 115 }), o($Vz, $V4, { 8: 116 }), { 5: [1, 118], 56: [1, 117] }, { 5: [1, 120], 56: [1, 119] }, { 27: 123, 72: [1, 121], 73: [1, 122], 74: $Vv }, o($VD, [2, 71]), o($VD, [2, 72]), o($VD, [2, 73]), o($VD, [2, 74]), o($VD, [2, 75]), o($VD, [2, 76]), o($VD, [2, 77]), o($VD, [2, 78]), { 27: 124, 74: $Vv }, { 27: 126, 62: 125, 74: $Vv }, { 74: [2, 65] }, { 74: [2, 66] }, { 60: 127, 83: $VE }, { 60: 129, 83: $VE }, { 60: 130, 83: $VE }, { 60: 131, 83: $VE }, o($VF, [2, 15]), { 16: 132, 87: $Vw }, { 87: [2, 82] }, { 4: [1, 135], 5: [1, 137], 12: 134, 13: 136, 21: [1, 133], 55: $Vo, 57: $Vp }, { 5: [1, 138] }, o($Vx, [2, 21]), o($Vx, [2, 22]), o($Vx, [2, 24]), o($Vx, [2, 25]), { 4: $V5, 5: $V6, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: $V7, 21: [1, 139], 22: 20, 23: $V8, 26: $V9, 27: 45, 28: $Va, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: $Vb, 35: $Vc, 36: $Vd, 38: $Ve, 40: $Vf, 41: $Vg, 42: $Vh, 43: $Vi, 44: $Vj, 46: $Vk, 48: $Vl, 49: $Vm, 51: $Vn, 55: $Vo, 57: $Vp, 58: $Vq, 63: $Vr, 64: $Vs, 65: $Vt, 66: $Vu, 74: $Vv, 84: $V3 }, { 4: $V5, 5: $V6, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: $V7, 21: [1, 140], 22: 20, 23: $V8, 26: $V9, 27: 45, 28: $Va, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: $Vb, 35: $Vc, 36: $Vd, 38: $Ve, 40: $Vf, 41: $Vg, 42: $Vh, 43: $Vi, 44: $Vj, 46: $Vk, 48: $Vl, 49: $Vm, 51: $Vn, 55: $Vo, 57: $Vp, 58: $Vq, 63: $Vr, 64: $Vs, 65: $Vt, 66: $Vu, 74: $Vv, 84: $V3 }, { 4: $V5, 5: $V6, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: $V7, 21: [1, 141], 22: 20, 23: $V8, 26: $V9, 27: 45, 28: $Va, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: $Vb, 35: $Vc, 36: $Vd, 38: $Ve, 40: $Vf, 41: $Vg, 42: $Vh, 43: $Vi, 44: $Vj, 46: $Vk, 48: $Vl, 49: $Vm, 51: $Vn, 55: $Vo, 57: $Vp, 58: $Vq, 63: $Vr, 64: $Vs, 65: $Vt, 66: $Vu, 74: $Vv, 84: $V3 }, { 21: [1, 142] }, { 4: $V5, 5: $V6, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: $V7, 21: [2, 49], 22: 20, 23: $V8, 26: $V9, 27: 45, 28: $Va, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: $Vb, 35: $Vc, 36: $Vd, 38: $Ve, 40: $Vf, 41: $Vg, 42: $Vh, 43: $Vi, 44: $Vj, 46: $Vk, 48: $Vl, 49: $Vm, 51: $Vn, 54: [1, 143], 55: $Vo, 57: $Vp, 58: $Vq, 63: $Vr, 64: $Vs, 65: $Vt, 66: $Vu, 74: $Vv, 84: $V3 }, { 21: [1, 144] }, { 4: $V5, 5: $V6, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: $V7, 21: [2, 47], 22: 20, 23: $V8, 26: $V9, 27: 45, 28: $Va, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: $Vb, 35: $Vc, 36: $Vd, 38: $Ve, 40: $Vf, 41: $Vg, 42: $Vh, 43: $Vi, 44: $Vj, 46: $Vk, 48: $Vl, 49: $Vm, 51: $Vn, 53: [1, 145], 55: $Vo, 57: $Vp, 58: $Vq, 63: $Vr, 64: $Vs, 65: $Vt, 66: $Vu, 74: $Vv, 84: $V3 }, { 21: [1, 146] }, { 21: [1, 147] }, { 4: $V5, 5: $V6, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: $V7, 21: [2, 45], 22: 20, 23: $V8, 26: $V9, 27: 45, 28: $Va, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: $Vb, 35: $Vc, 36: $Vd, 38: $Ve, 40: $Vf, 41: $Vg, 42: $Vh, 43: $Vi, 44: $Vj, 46: $Vk, 48: $Vl, 49: $Vm, 51: $Vn, 52: [1, 148], 55: $Vo, 57: $Vp, 58: $Vq, 63: $Vr, 64: $Vs, 65: $Vt, 66: $Vu, 74: $Vv, 84: $V3 }, { 4: $V5, 5: $V6, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: $V7, 21: [1, 149], 22: 20, 23: $V8, 26: $V9, 27: 45, 28: $Va, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: $Vb, 35: $Vc, 36: $Vd, 38: $Ve, 40: $Vf, 41: $Vg, 42: $Vh, 43: $Vi, 44: $Vj, 46: $Vk, 48: $Vl, 49: $Vm, 51: $Vn, 55: $Vo, 57: $Vp, 58: $Vq, 63: $Vr, 64: $Vs, 65: $Vt, 66: $Vu, 74: $Vv, 84: $V3 }, { 20: [1, 150] }, o($Vx, [2, 52]), { 20: [1, 151] }, o($Vx, [2, 54]), { 27: 152, 74: $Vv }, { 27: 153, 74: $Vv }, { 60: 154, 83: $VE }, { 60: 155, 83: $VE }, { 60: 156, 83: $VE }, { 68: [1, 157], 83: [2, 64] }, { 5: [2, 57] }, { 5: [2, 79] }, { 5: [2, 58] }, { 5: [2, 59] }, { 5: [2, 60] }, { 5: [1, 158] }, o($Vx, [2, 18]), o($Vy, [2, 11]), { 13: 159, 55: $Vo, 57: $Vp }, o($Vy, [2, 13]), o($Vy, [2, 14]), o($Vx, [2, 20]), o($Vx, [2, 36]), o($Vx, [2, 37]), o($Vx, [2, 38]), o($Vx, [2, 39]), { 20: [1, 160] }, o($Vx, [2, 40]), { 20: [1, 161] }, o($Vx, [2, 41]), o($Vx, [2, 42]), { 20: [1, 162] }, o($Vx, [2, 43]), { 5: [1, 163] }, { 5: [1, 164] }, { 60: 165, 83: $VE }, { 60: 166, 83: $VE }, { 5: [2, 69] }, { 5: [2, 55] }, { 5: [2, 56] }, { 27: 167, 74: $Vv }, o($VF, [2, 16]), o($Vy, [2, 12]), o($VA, $V4, { 8: 110, 45: 168 }), o($VB, $V4, { 8: 112, 47: 169 }), o($VC, $V4, { 8: 115, 50: 170 }), o($Vx, [2, 51]), o($Vx, [2, 53]), { 5: [2, 67] }, { 5: [2, 68] }, { 83: [2, 63] }, { 21: [2, 50] }, { 21: [2, 48] }, { 21: [2, 46] }], defaultActions: { 7: [2, 80], 8: [2, 1], 9: [2, 2], 10: [2, 3], 54: [2, 83], 91: [2, 65], 92: [2, 66], 99: [2, 82], 127: [2, 57], 128: [2, 79], 129: [2, 58], 130: [2, 59], 131: [2, 60], 154: [2, 69], 155: [2, 55], 156: [2, 56], 165: [2, 67], 166: [2, 68], 167: [2, 63], 168: [2, 50], 169: [2, 48], 170: [2, 46] }, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { var error = new Error(str); error.hash = hash; throw error; } }, parse: function parse(input) { var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); var lexer2 = Object.create(this.lexer); var sharedState = { yy: {} }; for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { sharedState.yy[k] = this.yy[k]; } } lexer2.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer2; sharedState.yy.parser = this; if (typeof lexer2.yylloc == "undefined") { lexer2.yylloc = {}; } var yyloc = lexer2.yylloc; lstack.push(yyloc); var ranges = lexer2.options && lexer2.options.ranges; if (typeof sharedState.yy.parseError === "function") { this.parseError = sharedState.yy.parseError; } else { this.parseError = Object.getPrototypeOf(this).parseError; } function lex() { var token; token = tstack.pop() || lexer2.lex() || EOF; if (typeof token !== "number") { if (token instanceof Array) { tstack = token; token = tstack.pop(); } token = self.symbols_[token] || token; } return token; } var symbol, state, action, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == "undefined") { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === "undefined" || !action.length || !action[0]) { var errStr = ""; expected = []; for (p in table[state]) { if (this.terminals_[p] && p > TERROR) { expected.push("'" + this.terminals_[p] + "'"); } } if (lexer2.showPosition) { errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; } else { errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); } this.parseError(errStr, { text: lexer2.match, token: this.terminals_[symbol] || symbol, line: lexer2.yylineno, loc: yyloc, expected }); } if (action[0] instanceof Array && action.length > 1) { throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(lexer2.yytext); lstack.push(lexer2.yylloc); stack.push(action[1]); symbol = null; { yyleng = lexer2.yyleng; yytext = lexer2.yytext; yylineno = lexer2.yylineno; yyloc = lexer2.yylloc; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; if (ranges) { yyval._$.range = [ lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1] ]; } r = this.performAction.apply(yyval, [ yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack ].concat(args)); if (typeof r !== "undefined") { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; } }; var lexer = function() { var lexer2 = { EOF: 1, parseError: function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, // resets the lexer, sets new input setInput: function(input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ""; this.conditionStack = ["INITIAL"]; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; if (this.options.ranges) { this.yylloc.range = [0, 0]; } this.offset = 0; return this; }, // consumes and returns one char from the input input: function() { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) { this.yylloc.range[1]++; } this._input = this._input.slice(1); return ch; }, // unshifts one char (or a string) into the input unput: function(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - 1); this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; } var r = this.yylloc.range; this.yylloc = { first_line: this.yylloc.first_line, last_line: this.yylineno + 1, first_column: this.yylloc.first_column, 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 }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } this.yyleng = this.yytext.length; return this; }, // When called from action, caches matched text and appends it on next action more: function() { this._more = true; return this; }, // 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. reject: function() { if (this.options.backtrack_lexer) { this._backtrack = true; } else { 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(), { text: "", token: null, line: this.yylineno }); } return this; }, // retain first n characters of the match less: function(n) { this.unput(this.match.slice(n)); }, // displays already matched input, i.e. for error messages pastInput: function() { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); }, // displays upcoming input, i.e. for error messages upcomingInput: function() { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20 - next.length); } return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); }, // displays the character position where the lexing error occurred, i.e. for error messages showPosition: function() { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token test_match: function(match, indexed_rule) { var token, lines, backup; if (this.options.backtrack_lexer) { backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; if (this.options.ranges) { backup.yylloc.range = this.yylloc.range.slice(0); } } lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { for (var k in backup) { this[k] = backup[k]; } return false; } return false; }, // return next match in input next: function() { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ""; this.match = ""; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rules[i]); if (token !== false) { return token; } else if (this._backtrack) { match = false; continue; } else { return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rules[index]); if (token !== false) { return token; } return false; } if (this._input === "") { return this.EOF; } else { return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { text: "", token: null, line: this.yylineno }); } }, // return next match that has a token lex: function lex() { var r = this.next(); if (r) { return r; } else { return this.lex(); } }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin: function begin(condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack popState: function popState() { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, // produce the lexer rule set which is active for the currently active lexer condition state _currentRules: function _currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { return this.conditions["INITIAL"].rules; } }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available topState: function topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return "INITIAL"; } }, // alias for begin(condition) pushState: function pushState(condition) { this.begin(condition); }, // return the number of states currently on the stack stateStackSize: function stateStackSize() { return this.conditionStack.length; }, options: { "case-insensitive": true }, performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { switch ($avoiding_name_collisions) { case 0: this.begin("open_directive"); return 84; case 1: this.begin("type_directive"); return 85; case 2: this.popState(); this.begin("arg_directive"); return 17; case 3: this.popState(); this.popState(); return 87; case 4: return 86; case 5: return 5; case 6: break; case 7: break; case 8: break; case 9: break; case 10: break; case 11: return 24; case 12: this.begin("LINE"); return 19; case 13: this.begin("ID"); return 55; case 14: this.begin("ID"); return 57; case 15: yy_.yytext = yy_.yytext.trim(); this.begin("ALIAS"); return 74; case 16: this.popState(); this.popState(); this.begin("LINE"); return 56; case 17: this.popState(); this.popState(); return 5; case 18: this.begin("LINE"); return 41; case 19: this.begin("LINE"); return 42; case 20: this.begin("LINE"); return 43; case 21: this.begin("LINE"); return 44; case 22: this.begin("LINE"); return 54; case 23: this.begin("LINE"); return 46; case 24: this.begin("LINE"); return 48; case 25: this.begin("LINE"); return 53; case 26: this.begin("LINE"); return 49; case 27: this.begin("LINE"); return 52; case 28: this.begin("LINE"); return 51; case 29: this.popState(); return 20; case 30: return 21; case 31: return 69; case 32: return 70; case 33: return 63; case 34: return 64; case 35: return 65; case 36: return 66; case 37: return 61; case 38: return 58; case 39: this.begin("ID"); return 26; case 40: this.begin("ID"); return 28; case 41: return 34; case 42: return 35; case 43: this.begin("acc_title"); return 36; case 44: this.popState(); return "acc_title_value"; case 45: this.begin("acc_descr"); return 38; case 46: this.popState(); return "acc_descr_value"; case 47: this.begin("acc_descr_multiline"); break; case 48: this.popState(); break; case 49: return "acc_descr_multiline_value"; case 50: return 7; case 51: return 23; case 52: return 25; case 53: return 68; case 54: return 5; case 55: yy_.yytext = yy_.yytext.trim(); return 74; case 56: return 77; case 57: return 78; case 58: return 75; case 59: return 76; case 60: return 79; case 61: return 80; case 62: return 81; case 63: return 82; case 64: return 83; case 65: return 72; case 66: return 73; case 67: return 5; case 68: return "INVALID"; } }, rules: [/^(?:%%\{)/i, /^(?:((?:(?!\}%%)[^:.])*))/i, /^(?::)/i, /^(?:\}%%)/i, /^(?:((?:(?!\}%%).|\n)*))/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[0-9]+(?=[ \n]+))/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:[^\->:\n,;]+?([\-]*[^\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i, /^(?:as\b)/i, /^(?:(?:))/i, /^(?:loop\b)/i, /^(?:rect\b)/i, /^(?:opt\b)/i, /^(?:alt\b)/i, /^(?:else\b)/i, /^(?:par\b)/i, /^(?:par_over\b)/i, /^(?:and\b)/i, /^(?:critical\b)/i, /^(?:option\b)/i, /^(?:break\b)/i, /^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i, /^(?:end\b)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:links\b)/i, /^(?:link\b)/i, /^(?:properties\b)/i, /^(?:details\b)/i, /^(?:over\b)/i, /^(?:note\b)/i, /^(?:activate\b)/i, /^(?:deactivate\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:title:\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:sequenceDiagram\b)/i, /^(?:autonumber\b)/i, /^(?:off\b)/i, /^(?:,)/i, /^(?:;)/i, /^(?:[^\+\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\->:\n,;]+)*)/i, /^(?:->>)/i, /^(?:-->>)/i, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?::(?:(?:no)?wrap)?[^#\n;]+)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:$)/i, /^(?:.)/i], conditions: { "acc_descr_multiline": { "rules": [48, 49], "inclusive": false }, "acc_descr": { "rules": [46], "inclusive": false }, "acc_title": { "rules": [44], "inclusive": false }, "open_directive": { "rules": [1, 8], "inclusive": false }, "type_directive": { "rules": [2, 3, 8], "inclusive": false }, "arg_directive": { "rules": [3, 4, 8], "inclusive": false }, "ID": { "rules": [7, 8, 15], "inclusive": false }, "ALIAS": { "rules": [7, 8, 16, 17], "inclusive": false }, "LINE": { "rules": [7, 8, 29], "inclusive": false }, "INITIAL": { "rules": [0, 5, 6, 8, 9, 10, 11, 12, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68], "inclusive": true } } }; return lexer2; }(); parser2.lexer = lexer; function Parser() { this.yy = {}; } Parser.prototype = parser2; parser2.Parser = Parser; return new Parser(); }(); parser.parser = parser; const parser$1 = parser; let prevActor = void 0; let actors = {}; let boxes = []; let messages = []; let sequenceNumbersEnabled = false; let wrapEnabled; let currentBox = void 0; const parseDirective = function(statement, context, type) { mermaidAPI.parseDirective(this, statement, context, type); }; const addBox = function(data) { boxes.push({ name: data.text, wrap: data.wrap === void 0 && autoWrap() || !!data.wrap, fill: data.color, actorKeys: [] }); currentBox = boxes.slice(-1)[0]; }; const addActor = function(id, name, description, type) { let assignedBox = currentBox; const old = actors[id]; if (old) { if (currentBox && old.box && currentBox !== old.box) { throw new Error( "A same participant should only be defined in one Box: " + old.name + " can't be in '" + old.box.name + "' and in '" + currentBox.name + "' at the same time." ); } assignedBox = old.box ? old.box : currentBox; old.box = assignedBox; if (old && name === old.name && description == null) { return; } } if (description == null || description.text == null) { description = { text: name, wrap: null, type }; } if (type == null || description.text == null) { description = { text: name, wrap: null, type }; } actors[id] = { box: assignedBox, name, description: description.text, wrap: description.wrap === void 0 && autoWrap() || !!description.wrap, prevActor, links: {}, properties: {}, actorCnt: null, rectData: null, type: type || "participant" }; if (prevActor && actors[prevActor]) { actors[prevActor].nextActor = id; } if (currentBox) { currentBox.actorKeys.push(id); } prevActor = id; }; const activationCount = (part) => { let i; let count = 0; for (i = 0; i < messages.length; i++) { if (messages[i].type === LINETYPE.ACTIVE_START && messages[i].from.actor === part) { count++; } if (messages[i].type === LINETYPE.ACTIVE_END && messages[i].from.actor === part) { count--; } } return count; }; const addMessage = function(idFrom, idTo, message, answer) { messages.push({ from: idFrom, to: idTo, message: message.text, wrap: message.wrap === void 0 && autoWrap() || !!message.wrap, answer }); }; const addSignal = function(idFrom, idTo, message = { text: void 0, wrap: void 0 }, messageType) { if (messageType === LINETYPE.ACTIVE_END) { const cnt = activationCount(idFrom.actor); if (cnt < 1) { let error = new Error("Trying to inactivate an inactive participant (" + idFrom.actor + ")"); error.hash = { text: "->>-", token: "->>-", line: "1", loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 }, expected: ["'ACTIVE_PARTICIPANT'"] }; throw error; } } messages.push({ from: idFrom, to: idTo, message: message.text, wrap: message.wrap === void 0 && autoWrap() || !!message.wrap, type: messageType }); return true; }; const hasAtLeastOneBox = function() { return boxes.length > 0; }; const hasAtLeastOneBoxWithTitle = function() { return boxes.some((b) => b.name); }; const getMessages = function() { return messages; }; const getBoxes = function() { return boxes; }; const getActors = function() { return actors; }; const getActor = function(id) { return actors[id]; }; const getActorKeys = function() { return Object.keys(actors); }; const enableSequenceNumbers = function() { sequenceNumbersEnabled = true; }; const disableSequenceNumbers = function() { sequenceNumbersEnabled = false; }; const showSequenceNumbers = () => sequenceNumbersEnabled; const setWrap = function(wrapSetting) { wrapEnabled = wrapSetting; }; const autoWrap = () => { if (wrapEnabled !== void 0) { return wrapEnabled; } return getConfig().sequence.wrap; }; const clear = function() { actors = {}; boxes = []; messages = []; sequenceNumbersEnabled = false; clear$1(); }; const parseMessage = function(str) { const _str = str.trim(); const message = { text: _str.replace(/^:?(?:no)?wrap:/, "").trim(), wrap: _str.match(/^:?wrap:/) !== null ? true : _str.match(/^:?nowrap:/) !== null ? false : void 0 }; log.debug("parseMessage:", message); return message; }; const parseBoxData = function(str) { const match = str.match(/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/); let color = match != null && match[1] ? match[1].trim() : "transparent"; let title = match != null && match[2] ? match[2].trim() : void 0; if (window && window.CSS) { if (!window.CSS.supports("color", color)) { color = "transparent"; title = str.trim(); } } else { const style = new Option().style; style.color = color; if (style.color !== color) { color = "transparent"; title = str.trim(); } } const boxData = { color, text: title !== void 0 ? sanitizeText(title.replace(/^:?(?:no)?wrap:/, ""), getConfig()) : void 0, wrap: title !== void 0 ? title.match(/^:?wrap:/) !== null ? true : title.match(/^:?nowrap:/) !== null ? false : void 0 : void 0 }; return boxData; }; const LINETYPE = { SOLID: 0, DOTTED: 1, NOTE: 2, SOLID_CROSS: 3, DOTTED_CROSS: 4, SOLID_OPEN: 5, DOTTED_OPEN: 6, LOOP_START: 10, LOOP_END: 11, ALT_START: 12, ALT_ELSE: 13, ALT_END: 14, OPT_START: 15, OPT_END: 16, ACTIVE_START: 17, ACTIVE_END: 18, PAR_START: 19, PAR_AND: 20, PAR_END: 21, RECT_START: 22, RECT_END: 23, SOLID_POINT: 24, DOTTED_POINT: 25, AUTONUMBER: 26, CRITICAL_START: 27, CRITICAL_OPTION: 28, CRITICAL_END: 29, BREAK_START: 30, BREAK_END: 31, PAR_OVER_START: 32 }; const ARROWTYPE = { FILLED: 0, OPEN: 1 }; const PLACEMENT = { LEFTOF: 0, RIGHTOF: 1, OVER: 2 }; const addNote = function(actor, placement, message) { ({ actor, placement, message: message.text, wrap: message.wrap === void 0 && autoWrap() || !!message.wrap }); const actors2 = [].concat(actor, actor); messages.push({ from: actors2[0], to: actors2[1], message: message.text, wrap: message.wrap === void 0 && autoWrap() || !!message.wrap, type: LINETYPE.NOTE, placement }); }; const addLinks = function(actorId