You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2104 lines
102 KiB
JavaScript
2104 lines
102 KiB
JavaScript
2 years ago
|
import { g as me, A as we, z as _e, c as lt, s as te, b as ke, a as Pe, m as Le, B as Ie, l as K, d as It, e as ee, f as _, S as ne, $ as Ne, a0 as ve, h as Ae, j as Lt, k as Se, x as C } from "./mermaid-8ea29a40.js";
|
||
|
import { d as Me, a as Re, b as De, c as Ve, e as zt, g as Nt } from "./svgDrawCommon-daf0bec5.js";
|
||
|
import { s as Ce } from "./selectAll-92b901d1.js";
|
||
|
var Bt = function() {
|
||
|
var t = function(ot, b, k, L) {
|
||
|
for (k = k || {}, L = ot.length; L--; k[ot[L]] = b)
|
||
|
;
|
||
|
return k;
|
||
|
}, e = [1, 2], r = [1, 3], n = [1, 5], i = [1, 7], s = [2, 5], c = [1, 15], l = [1, 17], u = [1, 19], d = [1, 21], T = [1, 22], y = [1, 23], p = [1, 29], x = [1, 30], m = [1, 31], I = [1, 32], A = [1, 33], M = [1, 34], N = [1, 35], Y = [1, 36], V = [1, 37], H = [1, 38], G = [1, 39], W = [1, 40], O = [1, 41], X = [1, 43], F = [1, 44], q = [1, 46], U = [1, 47], J = [1, 48], Z = [1, 49], w = [1, 50], E = [1, 51], j = [1, 54], P = [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], v = [4, 5, 21, 55, 57], wt = [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], Gt = [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], St = [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], Xt = [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], rt = [72, 73, 74], nt = [1, 128], Jt = [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], Mt = {
|
||
|
trace: function() {
|
||
|
},
|
||
|
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(b, k, L, g, S, o, yt) {
|
||
|
var h = o.length - 1;
|
||
|
switch (S) {
|
||
|
case 4:
|
||
|
return g.apply(o[h]), o[h];
|
||
|
case 5:
|
||
|
case 10:
|
||
|
this.$ = [];
|
||
|
break;
|
||
|
case 6:
|
||
|
case 11:
|
||
|
o[h - 1].push(o[h]), this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 7:
|
||
|
case 8:
|
||
|
case 12:
|
||
|
case 13:
|
||
|
this.$ = o[h];
|
||
|
break;
|
||
|
case 9:
|
||
|
case 14:
|
||
|
this.$ = [];
|
||
|
break;
|
||
|
case 18:
|
||
|
o[h - 1].unshift({ type: "boxStart", boxData: g.parseBoxData(o[h - 2]) }), o[h - 1].push({ type: "boxEnd", boxText: o[h - 2] }), this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 20:
|
||
|
this.$ = { type: "sequenceIndex", sequenceIndex: Number(o[h - 2]), sequenceIndexStep: Number(o[h - 1]), sequenceVisible: !0, signalType: g.LINETYPE.AUTONUMBER };
|
||
|
break;
|
||
|
case 21:
|
||
|
this.$ = { type: "sequenceIndex", sequenceIndex: Number(o[h - 1]), sequenceIndexStep: 1, sequenceVisible: !0, signalType: g.LINETYPE.AUTONUMBER };
|
||
|
break;
|
||
|
case 22:
|
||
|
this.$ = { type: "sequenceIndex", sequenceVisible: !1, signalType: g.LINETYPE.AUTONUMBER };
|
||
|
break;
|
||
|
case 23:
|
||
|
this.$ = { type: "sequenceIndex", sequenceVisible: !0, signalType: g.LINETYPE.AUTONUMBER };
|
||
|
break;
|
||
|
case 24:
|
||
|
this.$ = { type: "activeStart", signalType: g.LINETYPE.ACTIVE_START, actor: o[h - 1] };
|
||
|
break;
|
||
|
case 25:
|
||
|
this.$ = { type: "activeEnd", signalType: g.LINETYPE.ACTIVE_END, actor: o[h - 1] };
|
||
|
break;
|
||
|
case 31:
|
||
|
g.setDiagramTitle(o[h].substring(6)), this.$ = o[h].substring(6);
|
||
|
break;
|
||
|
case 32:
|
||
|
g.setDiagramTitle(o[h].substring(7)), this.$ = o[h].substring(7);
|
||
|
break;
|
||
|
case 33:
|
||
|
this.$ = o[h].trim(), g.setAccTitle(this.$);
|
||
|
break;
|
||
|
case 34:
|
||
|
case 35:
|
||
|
this.$ = o[h].trim(), g.setAccDescription(this.$);
|
||
|
break;
|
||
|
case 36:
|
||
|
o[h - 1].unshift({ type: "loopStart", loopText: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.LOOP_START }), o[h - 1].push({ type: "loopEnd", loopText: o[h - 2], signalType: g.LINETYPE.LOOP_END }), this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 37:
|
||
|
o[h - 1].unshift({ type: "rectStart", color: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.RECT_START }), o[h - 1].push({ type: "rectEnd", color: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.RECT_END }), this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 38:
|
||
|
o[h - 1].unshift({ type: "optStart", optText: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.OPT_START }), o[h - 1].push({ type: "optEnd", optText: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.OPT_END }), this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 39:
|
||
|
o[h - 1].unshift({ type: "altStart", altText: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.ALT_START }), o[h - 1].push({ type: "altEnd", signalType: g.LINETYPE.ALT_END }), this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 40:
|
||
|
o[h - 1].unshift({ type: "parStart", parText: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.PAR_START }), o[h - 1].push({ type: "parEnd", signalType: g.LINETYPE.PAR_END }), this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 41:
|
||
|
o[h - 1].unshift({ type: "parStart", parText: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.PAR_OVER_START }), o[h - 1].push({ type: "parEnd", signalType: g.LINETYPE.PAR_END }), this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 42:
|
||
|
o[h - 1].unshift({ type: "criticalStart", criticalText: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.CRITICAL_START }), o[h - 1].push({ type: "criticalEnd", signalType: g.LINETYPE.CRITICAL_END }), this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 43:
|
||
|
o[h - 1].unshift({ type: "breakStart", breakText: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.BREAK_START }), o[h - 1].push({ type: "breakEnd", optText: g.parseMessage(o[h - 2]), signalType: g.LINETYPE.BREAK_END }), this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 46:
|
||
|
this.$ = o[h - 3].concat([{ type: "option", optionText: g.parseMessage(o[h - 1]), signalType: g.LINETYPE.CRITICAL_OPTION }, o[h]]);
|
||
|
break;
|
||
|
case 48:
|
||
|
this.$ = o[h - 3].concat([{ type: "and", parText: g.parseMessage(o[h - 1]), signalType: g.LINETYPE.PAR_AND }, o[h]]);
|
||
|
break;
|
||
|
case 50:
|
||
|
this.$ = o[h - 3].concat([{ type: "else", altText: g.parseMessage(o[h - 1]), signalType: g.LINETYPE.ALT_ELSE }, o[h]]);
|
||
|
break;
|
||
|
case 51:
|
||
|
o[h - 3].type = "addParticipant", o[h - 3].description = g.parseMessage(o[h - 1]), this.$ = o[h - 3];
|
||
|
break;
|
||
|
case 52:
|
||
|
o[h - 1].type = "addParticipant", this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 53:
|
||
|
o[h - 3].type = "addActor", o[h - 3].description = g.parseMessage(o[h - 1]), this.$ = o[h - 3];
|
||
|
break;
|
||
|
case 54:
|
||
|
o[h - 1].type = "addActor", this.$ = o[h - 1];
|
||
|
break;
|
||
|
case 55:
|
||
|
this.$ = [o[h - 1], { type: "addNote", placement: o[h - 2], actor: o[h - 1].actor, text: o[h] }];
|
||
|
break;
|
||
|
case 56:
|
||
|
o[h - 2] = [].concat(o[h - 1], o[h - 1]).slice(0, 2), o[h - 2][0] = o[h - 2][0].actor, o[h - 2][1] = o[h - 2][1].actor, this.$ = [o[h - 1], { type: "addNote", placement: g.PLACEMENT.OVER, actor: o[h - 2].slice(0, 2), text: o[h] }];
|
||
|
break;
|
||
|
case 57:
|
||
|
this.$ = [o[h - 1], { type: "addLinks", actor: o[h - 1].actor, text: o[h] }];
|
||
|
break;
|
||
|
case 58:
|
||
|
this.$ = [o[h - 1], { type: "addALink", actor: o[h - 1].actor, text: o[h] }];
|
||
|
break;
|
||
|
case 59:
|
||
|
this.$ = [o[h - 1], { type: "addProperties", actor: o[h - 1].actor, text: o[h] }];
|
||
|
break;
|
||
|
case 60:
|
||
|
this.$ = [o[h - 1], { type: "addDetails", actor: o[h - 1].actor, text: o[h] }];
|
||
|
break;
|
||
|
case 63:
|
||
|
this.$ = [o[h - 2], o[h]];
|
||
|
break;
|
||
|
case 64:
|
||
|
this.$ = o[h];
|
||
|
break;
|
||
|
case 65:
|
||
|
this.$ = g.PLACEMENT.LEFTOF;
|
||
|
break;
|
||
|
case 66:
|
||
|
this.$ = g.PLACEMENT.RIGHTOF;
|
||
|
break;
|
||
|
case 67:
|
||
|
this.$ = [
|
||
|
o[h - 4],
|
||
|
o[h - 1],
|
||
|
{ type: "addMessage", from: o[h - 4].actor, to: o[h - 1].actor, signalType: o[h - 3], msg: o[h] },
|
||
|
{ type: "activeStart", signalType: g.LINETYPE.ACTIVE_START, actor: o[h - 1] }
|
||
|
];
|
||
|
break;
|
||
|
case 68:
|
||
|
this.$ = [
|
||
|
o[h - 4],
|
||
|
o[h - 1],
|
||
|
{ type: "addMessage", from: o[h - 4].actor, to: o[h - 1].actor, signalType: o[h - 3], msg: o[h] },
|
||
|
{ type: "activeEnd", signalType: g.LINETYPE.ACTIVE_END, actor: o[h - 4] }
|
||
|
];
|
||
|
break;
|
||
|
case 69:
|
||
|
this.$ = [o[h - 3], o[h - 1], { type: "addMessage", from: o[h - 3].actor, to: o[h - 1].actor, signalType: o[h - 2], msg: o[h] }];
|
||
|
break;
|
||
|
case 70:
|
||
|
this.$ = { type: "addParticipant", actor: o[h] };
|
||
|
break;
|
||
|
case 71:
|
||
|
this.$ = g.LINETYPE.SOLID_OPEN;
|
||
|
break;
|
||
|
case 72:
|
||
|
this.$ = g.LINETYPE.DOTTED_OPEN;
|
||
|
break;
|
||
|
case 73:
|
||
|
this.$ = g.LINETYPE.SOLID;
|
||
|
break;
|
||
|
case 74:
|
||
|
this.$ = g.LINETYPE.DOTTED;
|
||
|
break;
|
||
|
case 75:
|
||
|
this.$ = g.LINETYPE.SOLID_CROSS;
|
||
|
break;
|
||
|
case 76:
|
||
|
this.$ = g.LINETYPE.DOTTED_CROSS;
|
||
|
break;
|
||
|
case 77:
|
||
|
this.$ = g.LINETYPE.SOLID_POINT;
|
||
|
break;
|
||
|
case 78:
|
||
|
this.$ = g.LINETYPE.DOTTED_POINT;
|
||
|
break;
|
||
|
case 79:
|
||
|
this.$ = g.parseMessage(o[h].trim().substring(1));
|
||
|
break;
|
||
|
case 80:
|
||
|
g.parseDirective("%%{", "open_directive");
|
||
|
break;
|
||
|
case 81:
|
||
|
g.parseDirective(o[h], "type_directive");
|
||
|
break;
|
||
|
case 82:
|
||
|
o[h] = o[h].trim().replace(/'/g, '"'), g.parseDirective(o[h], "arg_directive");
|
||
|
break;
|
||
|
case 83:
|
||
|
g.parseDirective("}%%", "close_directive", "sequence");
|
||
|
break;
|
||
|
}
|
||
|
},
|
||
|
table: [{ 3: 1, 4: e, 5: r, 6: 4, 7: n, 14: 6, 84: i }, { 1: [3] }, { 3: 8, 4: e, 5: r, 6: 4, 7: n, 14: 6, 84: i }, { 3: 9, 4: e, 5: r, 6: 4, 7: n, 14: 6, 84: i }, { 3: 10, 4: e, 5: r, 6: 4, 7: n, 14: 6, 84: i }, t([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], s, { 8: 11 }), { 15: 12, 85: [1, 13] }, { 85: [2, 80] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3] }, { 1: [2, 4], 4: c, 5: l, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: u, 22: 20, 23: d, 26: T, 27: 45, 28: y, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: p, 35: x, 36: m, 38: I, 40: A, 41: M, 42: N, 43: Y, 44: V, 46: H, 48: G, 49: W, 51: O, 55: X, 57: F, 58: q, 63: U, 64: J, 65: Z, 66: w, 74: E, 84: i }, { 16: 52, 17: [1, 53], 87: j }, t([17, 87], [2, 81]), t(P, [2, 6]), { 6: 42, 10: 55, 13: 18, 14: 6, 19: u, 22: 20, 23: d, 26: T, 27: 45, 28: y, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: p, 35: x, 36: m, 38: I, 40: A, 41: M, 42: N, 43: Y, 44: V, 46: H, 48: G, 49: W, 51: O, 55: X, 57: F, 58: q, 63: U, 64: J, 65: Z, 66: w, 74: E, 84: i }, t(P, [2, 8]), t(P, [2, 9]), t(P, [2, 17]), { 20: [1, 56] }, { 5: [1, 57] }, { 5: [1, 60], 24: [1, 58], 25: [1, 59] }, { 27: 61, 74: E }, { 27: 62, 74: E }, { 5: [1, 63] }, { 5: [1, 64] }, { 5: [1, 65] }, { 5: [1, 66] }, { 5: [1, 67] }, t(P, [2, 31]), t(P, [2, 32]), { 37: [1, 68] }, { 39: [1, 69] }, t(P, [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] }, t(P, [2, 44]), { 27: 78, 74: E }, { 27: 79, 74: E }, { 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: E }, { 27: 94, 74: E }, { 27: 95, 74: E }, { 27: 96, 74: E }, t([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] }, t(P, [2, 7]), t(v, [2, 10], { 11: 100 }), t(P, [2, 19]), { 5: [1, 102], 24: [1, 101] }, { 5: [1, 103] }, t(P, [2, 23]), { 5: [1, 104] }, { 5: [1, 105] }, t(P, [2, 26]), t(P, [2, 27]), t(P, [2, 28]), t(P, [2, 29]), t(P, [2, 30]), t(P, [2, 33]), t(P, [2, 34]), t(wt, s, { 8: 106 }), t(wt, s, { 8: 107 }), t(wt, s, { 8: 108 }), t(Gt, s, { 45: 109, 8: 110 }), t(St, s, { 47: 111, 8: 112 }), t(St, s, { 8: 112, 47: 113 }), t(Xt, s, { 50: 114, 8: 115 }), t(wt, s, { 8: 116 }), { 5: [1, 118], 56: [1, 117] }, { 5: [1, 120], 56: [1, 119] }, { 27: 123, 72: [1, 121], 73: [1, 122], 74: E }, t(rt, [2, 71]), t(rt, [2, 72]), t(rt, [2, 73]), t(rt, [2, 74]), t(rt, [2, 75]), t(rt, [2, 76]), t(rt, [2, 77]), t(rt, [2, 78]), { 27: 124, 74: E }, { 27: 126, 62: 125, 74: E }, { 74: [2, 65] }, { 74: [2, 66] }, { 60: 127, 83: nt }, { 60: 129, 83: nt }, { 60: 130, 83: nt }, { 60: 131, 83: nt }, t(Jt, [2, 15]), { 16: 132, 87: j }, { 87: [2, 82] }, { 4: [1, 135], 5: [1, 137], 12: 134, 13: 136, 21: [1, 133], 55: X, 57: F }, { 5: [1, 138] }, t(P, [2, 21]), t(P, [2, 22]), t(P, [2, 24]), t(P, [2, 25]), { 4: c, 5: l, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: u, 21: [1, 139], 22: 20, 23: d, 26: T, 27: 45, 28: y, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: p, 35: x, 36: m, 38: I, 40: A, 41: M, 42: N, 43: Y, 44: V, 46: H, 48: G, 49: W, 51: O, 55: X, 57: F, 58: q, 63: U, 64: J, 65: Z, 66: w, 74: E, 84: i }, { 4: c, 5: l, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: u, 21: [1, 140], 22: 20, 23: d, 26: T, 27: 45, 28: y, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: p, 35: x, 36: m, 38: I, 40: A, 41: M, 42: N, 43: Y, 44: V, 46: H, 48: G, 49: W, 51: O, 55: X, 57: F, 58: q, 63: U, 64: J, 65: Z, 66: w, 74: E, 84: i }, { 4: c, 5: l, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: u, 21: [1, 141], 22: 20, 23: d, 26: T, 27: 45, 28: y, 29: 24, 30: 25, 31: 26, 32: 27, 33: 28, 34: p, 35: x, 36: m, 38: I, 40: A, 41: M, 42: N, 43: Y, 44: V, 46: H, 48: G, 49: W, 51: O, 55: X, 57: F, 58: q, 63: U, 64: J, 65: Z, 66: w, 74: E, 84: i }, { 21: [1, 142] }, { 4: c, 5: l, 6: 42, 9: 14, 10: 16, 13: 18, 14: 6, 19: u, 21: [2, 49], 22: 20, 23: d, 26: T, 27: 45, 28: y, 29: 24, 30: 25, 31: 26, 32: 2
|
||
|
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(b, k) {
|
||
|
if (k.recoverable)
|
||
|
this.trace(b);
|
||
|
else {
|
||
|
var L = new Error(b);
|
||
|
throw L.hash = k, L;
|
||
|
}
|
||
|
},
|
||
|
parse: function(b) {
|
||
|
var k = this, L = [0], g = [], S = [null], o = [], yt = this.table, h = "", _t = 0, Zt = 0, Te = 2, Qt = 1, ye = o.slice.call(arguments, 1), B = Object.create(this.lexer), ht = { yy: {} };
|
||
|
for (var Dt in this.yy)
|
||
|
Object.prototype.hasOwnProperty.call(this.yy, Dt) && (ht.yy[Dt] = this.yy[Dt]);
|
||
|
B.setInput(b, ht.yy), ht.yy.lexer = B, ht.yy.parser = this, typeof B.yylloc > "u" && (B.yylloc = {});
|
||
|
var Vt = B.yylloc;
|
||
|
o.push(Vt);
|
||
|
var Ee = B.options && B.options.ranges;
|
||
|
typeof ht.yy.parseError == "function" ? this.parseError = ht.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
|
||
|
function be() {
|
||
|
var st;
|
||
|
return st = g.pop() || B.lex() || Qt, typeof st != "number" && (st instanceof Array && (g = st, st = g.pop()), st = k.symbols_[st] || st), st;
|
||
|
}
|
||
|
for (var z, dt, Q, Ct, ft = {}, kt, it, jt, Pt; ; ) {
|
||
|
if (dt = L[L.length - 1], this.defaultActions[dt] ? Q = this.defaultActions[dt] : ((z === null || typeof z > "u") && (z = be()), Q = yt[dt] && yt[dt][z]), typeof Q > "u" || !Q.length || !Q[0]) {
|
||
|
var Ot = "";
|
||
|
Pt = [];
|
||
|
for (kt in yt[dt])
|
||
|
this.terminals_[kt] && kt > Te && Pt.push("'" + this.terminals_[kt] + "'");
|
||
|
B.showPosition ? Ot = "Parse error on line " + (_t + 1) + `:
|
||
|
` + B.showPosition() + `
|
||
|
Expecting ` + Pt.join(", ") + ", got '" + (this.terminals_[z] || z) + "'" : Ot = "Parse error on line " + (_t + 1) + ": Unexpected " + (z == Qt ? "end of input" : "'" + (this.terminals_[z] || z) + "'"), this.parseError(Ot, {
|
||
|
text: B.match,
|
||
|
token: this.terminals_[z] || z,
|
||
|
line: B.yylineno,
|
||
|
loc: Vt,
|
||
|
expected: Pt
|
||
|
});
|
||
|
}
|
||
|
if (Q[0] instanceof Array && Q.length > 1)
|
||
|
throw new Error("Parse Error: multiple actions possible at state: " + dt + ", token: " + z);
|
||
|
switch (Q[0]) {
|
||
|
case 1:
|
||
|
L.push(z), S.push(B.yytext), o.push(B.yylloc), L.push(Q[1]), z = null, Zt = B.yyleng, h = B.yytext, _t = B.yylineno, Vt = B.yylloc;
|
||
|
break;
|
||
|
case 2:
|
||
|
if (it = this.productions_[Q[1]][1], ft.$ = S[S.length - it], ft._$ = {
|
||
|
first_line: o[o.length - (it || 1)].first_line,
|
||
|
last_line: o[o.length - 1].last_line,
|
||
|
first_column: o[o.length - (it || 1)].first_column,
|
||
|
last_column: o[o.length - 1].last_column
|
||
|
}, Ee && (ft._$.range = [
|
||
|
o[o.length - (it || 1)].range[0],
|
||
|
o[o.length - 1].range[1]
|
||
|
]), Ct = this.performAction.apply(ft, [
|
||
|
h,
|
||
|
Zt,
|
||
|
_t,
|
||
|
ht.yy,
|
||
|
Q[1],
|
||
|
S,
|
||
|
o
|
||
|
].concat(ye)), typeof Ct < "u")
|
||
|
return Ct;
|
||
|
it && (L = L.slice(0, -1 * it * 2), S = S.slice(0, -1 * it), o = o.slice(0, -1 * it)), L.push(this.productions_[Q[1]][0]), S.push(ft.$), o.push(ft._$), jt = yt[L[L.length - 2]][L[L.length - 1]], L.push(jt);
|
||
|
break;
|
||
|
case 3:
|
||
|
return !0;
|
||
|
}
|
||
|
}
|
||
|
return !0;
|
||
|
}
|
||
|
}, xe = function() {
|
||
|
var ot = {
|
||
|
EOF: 1,
|
||
|
parseError: function(k, L) {
|
||
|
if (this.yy.parser)
|
||
|
this.yy.parser.parseError(k, L);
|
||
|
else
|
||
|
throw new Error(k);
|
||
|
},
|
||
|
// resets the lexer, sets new input
|
||
|
setInput: function(b, k) {
|
||
|
return this.yy = k || this.yy || {}, this._input = b, this._more = this._backtrack = this.done = !1, 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
|
||
|
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
|
||
|
},
|
||
|
// consumes and returns one char from the input
|
||
|
input: function() {
|
||
|
var b = this._input[0];
|
||
|
this.yytext += b, this.yyleng++, this.offset++, this.match += b, this.matched += b;
|
||
|
var k = b.match(/(?:\r\n?|\n).*/g);
|
||
|
return k ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), b;
|
||
|
},
|
||
|
// unshifts one char (or a string) into the input
|
||
|
unput: function(b) {
|
||
|
var k = b.length, L = b.split(/(?:\r\n?|\n)/g);
|
||
|
this._input = b + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - k), this.offset -= k;
|
||
|
var g = 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), L.length - 1 && (this.yylineno -= L.length - 1);
|
||
|
var S = this.yylloc.range;
|
||
|
return this.yylloc = {
|
||
|
first_line: this.yylloc.first_line,
|
||
|
last_line: this.yylineno + 1,
|
||
|
first_column: this.yylloc.first_column,
|
||
|
last_column: L ? (L.length === g.length ? this.yylloc.first_column : 0) + g[g.length - L.length].length - L[0].length : this.yylloc.first_column - k
|
||
|
}, this.options.ranges && (this.yylloc.range = [S[0], S[0] + this.yyleng - k]), this.yyleng = this.yytext.length, this;
|
||
|
},
|
||
|
// When called from action, caches matched text and appends it on next action
|
||
|
more: function() {
|
||
|
return this._more = !0, 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 = !0;
|
||
|
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).
|
||
|
` + this.showPosition(), {
|
||
|
text: "",
|
||
|
token: null,
|
||
|
line: this.yylineno
|
||
|
});
|
||
|
return this;
|
||
|
},
|
||
|
// retain first n characters of the match
|
||
|
less: function(b) {
|
||
|
this.unput(this.match.slice(b));
|
||
|
},
|
||
|
// displays already matched input, i.e. for error messages
|
||
|
pastInput: function() {
|
||
|
var b = this.matched.substr(0, this.matched.length - this.match.length);
|
||
|
return (b.length > 20 ? "..." : "") + b.substr(-20).replace(/\n/g, "");
|
||
|
},
|
||
|
// displays upcoming input, i.e. for error messages
|
||
|
upcomingInput: function() {
|
||
|
var b = this.match;
|
||
|
return b.length < 20 && (b += this._input.substr(0, 20 - b.length)), (b.substr(0, 20) + (b.length > 20 ? "..." : "")).replace(/\n/g, "");
|
||
|
},
|
||
|
// displays the character position where the lexing error occurred, i.e. for error messages
|
||
|
showPosition: function() {
|
||
|
var b = this.pastInput(), k = new Array(b.length + 1).join("-");
|
||
|
return b + this.upcomingInput() + `
|
||
|
` + k + "^";
|
||
|
},
|
||
|
// test the lexed token: return FALSE when not a match, otherwise return token
|
||
|
test_match: function(b, k) {
|
||
|
var L, g, S;
|
||
|
if (this.options.backtrack_lexer && (S = {
|
||
|
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
|
||
|
}, this.options.ranges && (S.yylloc.range = this.yylloc.range.slice(0))), g = b[0].match(/(?:\r\n?|\n).*/g), g && (this.yylineno += g.length), this.yylloc = {
|
||
|
first_line: this.yylloc.last_line,
|
||
|
last_line: this.yylineno + 1,
|
||
|
first_column: this.yylloc.last_column,
|
||
|
last_column: g ? g[g.length - 1].length - g[g.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + b[0].length
|
||
|
}, this.yytext += b[0], this.match += b[0], this.matches = b, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(b[0].length), this.matched += b[0], L = this.performAction.call(this, this.yy, this, k, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), L)
|
||
|
return L;
|
||
|
if (this._backtrack) {
|
||
|
for (var o in S)
|
||
|
this[o] = S[o];
|
||
|
return !1;
|
||
|
}
|
||
|
return !1;
|
||
|
},
|
||
|
// return next match in input
|
||
|
next: function() {
|
||
|
if (this.done)
|
||
|
return this.EOF;
|
||
|
this._input || (this.done = !0);
|
||
|
var b, k, L, g;
|
||
|
this._more || (this.yytext = "", this.match = "");
|
||
|
for (var S = this._currentRules(), o = 0; o < S.length; o++)
|
||
|
if (L = this._input.match(this.rules[S[o]]), L && (!k || L[0].length > k[0].length)) {
|
||
|
if (k = L, g = o, this.options.backtrack_lexer) {
|
||
|
if (b = this.test_match(L, S[o]), b !== !1)
|
||
|
return b;
|
||
|
if (this._backtrack) {
|
||
|
k = !1;
|
||
|
continue;
|
||
|
} else
|
||
|
return !1;
|
||
|
} else if (!this.options.flex)
|
||
|
break;
|
||
|
}
|
||
|
return k ? (b = this.test_match(k, S[g]), b !== !1 ? b : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
|
||
|
` + this.showPosition(), {
|
||
|
text: "",
|
||
|
token: null,
|
||
|
line: this.yylineno
|
||
|
});
|
||
|
},
|
||
|
// return next match that has a token
|
||
|
lex: function() {
|
||
|
var k = this.next();
|
||
|
return k || this.lex();
|
||
|
},
|
||
|
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
||
|
begin: function(k) {
|
||
|
this.conditionStack.push(k);
|
||
|
},
|
||
|
// pop the previously active lexer condition state off the condition stack
|
||
|
popState: function() {
|
||
|
var k = this.conditionStack.length - 1;
|
||
|
return k > 0 ? this.conditionStack.pop() : this.conditionStack[0];
|
||
|
},
|
||
|
// produce the lexer rule set which is active for the currently active lexer condition state
|
||
|
_currentRules: function() {
|
||
|
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : 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(k) {
|
||
|
return k = this.conditionStack.length - 1 - Math.abs(k || 0), k >= 0 ? this.conditionStack[k] : "INITIAL";
|
||
|
},
|
||
|
// alias for begin(condition)
|
||
|
pushState: function(k) {
|
||
|
this.begin(k);
|
||
|
},
|
||
|
// return the number of states currently on the stack
|
||
|
stateStackSize: function() {
|
||
|
return this.conditionStack.length;
|
||
|
},
|
||
|
options: { "case-insensitive": !0 },
|
||
|
performAction: function(k, L, g, S) {
|
||
|
switch (g) {
|
||
|
case 0:
|
||
|
return this.begin("open_directive"), 84;
|
||
|
case 1:
|
||
|
return this.begin("type_directive"), 85;
|
||
|
case 2:
|
||
|
return this.popState(), this.begin("arg_directive"), 17;
|
||
|
case 3:
|
||
|
return this.popState(), this.popState(), 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:
|
||
|
return this.begin("LINE"), 19;
|
||
|
case 13:
|
||
|
return this.begin("ID"), 55;
|
||
|
case 14:
|
||
|
return this.begin("ID"), 57;
|
||
|
case 15:
|
||
|
return L.yytext = L.yytext.trim(), this.begin("ALIAS"), 74;
|
||
|
case 16:
|
||
|
return this.popState(), this.popState(), this.begin("LINE"), 56;
|
||
|
case 17:
|
||
|
return this.popState(), this.popState(), 5;
|
||
|
case 18:
|
||
|
return this.begin("LINE"), 41;
|
||
|
case 19:
|
||
|
return this.begin("LINE"), 42;
|
||
|
case 20:
|
||
|
return this.begin("LINE"), 43;
|
||
|
case 21:
|
||
|
return this.begin("LINE"), 44;
|
||
|
case 22:
|
||
|
return this.begin("LINE"), 54;
|
||
|
case 23:
|
||
|
return this.begin("LINE"), 46;
|
||
|
case 24:
|
||
|
return this.begin("LINE"), 48;
|
||
|
case 25:
|
||
|
return this.begin("LINE"), 53;
|
||
|
case 26:
|
||
|
return this.begin("LINE"), 49;
|
||
|
case 27:
|
||
|
return this.begin("LINE"), 52;
|
||
|
case 28:
|
||
|
return this.begin("LINE"), 51;
|
||
|
case 29:
|
||
|
return this.popState(), 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:
|
||
|
return this.begin("ID"), 26;
|
||
|
case 40:
|
||
|
return this.begin("ID"), 28;
|
||
|
case 41:
|
||
|
return 34;
|
||
|
case 42:
|
||
|
return 35;
|
||
|
case 43:
|
||
|
return this.begin("acc_title"), 36;
|
||
|
case 44:
|
||
|
return this.popState(), "acc_title_value";
|
||
|
case 45:
|
||
|
return this.begin("acc_descr"), 38;
|
||
|
case 46:
|
||
|
return this.popState(), "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:
|
||
|
return L.yytext = L.yytext.trim(), 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: !1 }, acc_descr: { rules: [46], inclusive: !1 }, acc_title: { rules: [44], inclusive: !1 }, open_directive: { rules: [1, 8], inclusive: !1 }, type_directive: { rules: [2, 3, 8], inclusive: !1 }, arg_directive: { rules: [3, 4, 8], inclusive: !1 }, ID: { rules: [7, 8, 15], inclusive: !1 }, ALIAS: { rules: [7, 8, 16, 17], inclusive: !1 }, LINE: { rules: [7, 8, 29], inclusive: !1 }, 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: !0 } }
|
||
|
};
|
||
|
return ot;
|
||
|
}();
|
||
|
Mt.lexer = xe;
|
||
|
function Rt() {
|
||
|
this.yy = {};
|
||
|
}
|
||
|
return Rt.prototype = Mt, Mt.Parser = Rt, new Rt();
|
||
|
}();
|
||
|
Bt.parser = Bt;
|
||
|
const Oe = Bt;
|
||
|
let Et, ct = {}, xt = [], $ = [], vt = !1, Yt, at;
|
||
|
const Be = function(t, e, r) {
|
||
|
Le.parseDirective(this, t, e, r);
|
||
|
}, Ye = function(t) {
|
||
|
xt.push({
|
||
|
name: t.text,
|
||
|
wrap: t.wrap === void 0 && ut() || !!t.wrap,
|
||
|
fill: t.color,
|
||
|
actorKeys: []
|
||
|
}), at = xt.slice(-1)[0];
|
||
|
}, Ft = function(t, e, r, n) {
|
||
|
let i = at;
|
||
|
const s = ct[t];
|
||
|
if (s) {
|
||
|
if (at && s.box && at !== s.box)
|
||
|
throw new Error(
|
||
|
"A same participant should only be defined in one Box: " + s.name + " can't be in '" + s.box.name + "' and in '" + at.name + "' at the same time."
|
||
|
);
|
||
|
if (i = s.box ? s.box : at, s.box = i, s && e === s.name && r == null)
|
||
|
return;
|
||
|
}
|
||
|
(r == null || r.text == null) && (r = { text: e, wrap: null, type: n }), (n == null || r.text == null) && (r = { text: e, wrap: null, type: n }), ct[t] = {
|
||
|
box: i,
|
||
|
name: e,
|
||
|
description: r.text,
|
||
|
wrap: r.wrap === void 0 && ut() || !!r.wrap,
|
||
|
prevActor: Et,
|
||
|
links: {},
|
||
|
properties: {},
|
||
|
actorCnt: null,
|
||
|
rectData: null,
|
||
|
type: n || "participant"
|
||
|
}, Et && ct[Et] && (ct[Et].nextActor = t), at && at.actorKeys.push(t), Et = t;
|
||
|
}, Fe = (t) => {
|
||
|
let e, r = 0;
|
||
|
for (e = 0; e < $.length; e++)
|
||
|
$[e].type === bt.ACTIVE_START && $[e].from.actor === t && r++, $[e].type === bt.ACTIVE_END && $[e].from.actor === t && r--;
|
||
|
return r;
|
||
|
}, We = function(t, e, r, n) {
|
||
|
$.push({
|
||
|
from: t,
|
||
|
to: e,
|
||
|
message: r.text,
|
||
|
wrap: r.wrap === void 0 && ut() || !!r.wrap,
|
||
|
answer: n
|
||
|
});
|
||
|
}, R = function(t, e, r = { text: void 0, wrap: void 0 }, n) {
|
||
|
if (n === bt.ACTIVE_END && Fe(t.actor) < 1) {
|
||
|
let s = new Error("Trying to inactivate an inactive participant (" + t.actor + ")");
|
||
|
throw s.hash = {
|
||
|
text: "->>-",
|
||
|
token: "->>-",
|
||
|
line: "1",
|
||
|
loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
||
|
expected: ["'ACTIVE_PARTICIPANT'"]
|
||
|
}, s;
|
||
|
}
|
||
|
return $.push({
|
||
|
from: t,
|
||
|
to: e,
|
||
|
message: r.text,
|
||
|
wrap: r.wrap === void 0 && ut() || !!r.wrap,
|
||
|
type: n
|
||
|
}), !0;
|
||
|
}, qe = function() {
|
||
|
return xt.length > 0;
|
||
|
}, ze = function() {
|
||
|
return xt.some((t) => t.name);
|
||
|
}, He = function() {
|
||
|
return $;
|
||
|
}, Ue = function() {
|
||
|
return xt;
|
||
|
}, Ke = function() {
|
||
|
return ct;
|
||
|
}, mt = function(t) {
|
||
|
return ct[t];
|
||
|
}, Ge = function() {
|
||
|
return Object.keys(ct);
|
||
|
}, Xe = function() {
|
||
|
vt = !0;
|
||
|
}, Je = function() {
|
||
|
vt = !1;
|
||
|
}, Ze = () => vt, Qe = function(t) {
|
||
|
Yt = t;
|
||
|
}, ut = () => Yt !== void 0 ? Yt : lt().sequence.wrap, je = function() {
|
||
|
ct = {}, xt = [], $ = [], vt = !1, Ie();
|
||
|
}, $e = function(t) {
|
||
|
const e = t.trim(), r = {
|
||
|
text: e.replace(/^:?(?:no)?wrap:/, "").trim(),
|
||
|
wrap: e.match(/^:?wrap:/) !== null ? !0 : e.match(/^:?nowrap:/) !== null ? !1 : void 0
|
||
|
};
|
||
|
return K.debug("parseMessage:", r), r;
|
||
|
}, t0 = function(t) {
|
||
|
const e = t.match(/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/);
|
||
|
let r = e != null && e[1] ? e[1].trim() : "transparent", n = e != null && e[2] ? e[2].trim() : void 0;
|
||
|
if (window && window.CSS)
|
||
|
window.CSS.supports("color", r) || (r = "transparent", n = t.trim());
|
||
|
else {
|
||
|
const s = new Option().style;
|
||
|
s.color = r, s.color !== r && (r = "transparent", n = t.trim());
|
||
|
}
|
||
|
return {
|
||
|
color: r,
|
||
|
text: n !== void 0 ? It(n.replace(/^:?(?:no)?wrap:/, ""), lt()) : void 0,
|
||
|
wrap: n !== void 0 ? n.match(/^:?wrap:/) !== null ? !0 : n.match(/^:?nowrap:/) !== null ? !1 : void 0 : void 0
|
||
|
};
|
||
|
}, bt = {
|
||
|
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
|
||
|
}, e0 = {
|
||
|
FILLED: 0,
|
||
|
OPEN: 1
|
||
|
}, n0 = {
|
||
|
LEFTOF: 0,
|
||
|
RIGHTOF: 1,
|
||
|
OVER: 2
|
||
|
}, ie = function(t, e, r) {
|
||
|
r.text, r.wrap === void 0 && ut() || r.wrap;
|
||
|
const n = [].concat(t, t);
|
||
|
$.push({
|
||
|
from: n[0],
|
||
|
to: n[1],
|
||
|
message: r.text,
|
||
|
wrap: r.wrap === void 0 && ut() || !!r.wrap,
|
||
|
type: bt.NOTE,
|
||
|
placement: e
|
||
|
});
|
||
|
}, se = function(t, e) {
|
||
|
const r = mt(t);
|
||
|
try {
|
||
|
let n = It(e.text, lt());
|
||
|
n = n.replace(/&/g, "&"), n = n.replace(/=/g, "=");
|
||
|
const i = JSON.parse(n);
|
||
|
Ht(r, i);
|
||
|
} catch (n) {
|
||
|
K.error("error while parsing actor link text", n);
|
||
|
}
|
||
|
}, i0 = function(t, e) {
|
||
|
const r = mt(t);
|
||
|
try {
|
||
|
const c = {};
|
||
|
let l = It(e.text, lt());
|
||
|
var n = l.indexOf("@");
|
||
|
l = l.replace(/&/g, "&"), l = l.replace(/=/g, "=");
|
||
|
var i = l.slice(0, n - 1).trim(), s = l.slice(n + 1).trim();
|
||
|
c[i] = s, Ht(r, c);
|
||
|
} catch (c) {
|
||
|
K.error("error while parsing actor link text", c);
|
||
|
}
|
||
|
};
|
||
|
function Ht(t, e) {
|
||
|
if (t.links == null)
|
||
|
t.links = e;
|
||
|
else
|
||
|
for (let r in e)
|
||
|
t.links[r] = e[r];
|
||
|
}
|
||
|
const ae = function(t, e) {
|
||
|
const r = mt(t);
|
||
|
try {
|
||
|
let n = It(e.text, lt());
|
||
|
const i = JSON.parse(n);
|
||
|
re(r, i);
|
||
|
} catch (n) {
|
||
|
K.error("error while parsing actor properties text", n);
|
||
|
}
|
||
|
};
|
||
|
function re(t, e) {
|
||
|
if (t.properties == null)
|
||
|
t.properties = e;
|
||
|
else
|
||
|
for (let r in e)
|
||
|
t.properties[r] = e[r];
|
||
|
}
|
||
|
function s0() {
|
||
|
at = void 0;
|
||
|
}
|
||
|
const oe = function(t, e) {
|
||
|
const r = mt(t), n = document.getElementById(e.text);
|
||
|
try {
|
||
|
const i = n.innerHTML, s = JSON.parse(i);
|
||
|
s.properties && re(r, s.properties), s.links && Ht(r, s.links);
|
||
|
} catch (i) {
|
||
|
K.error("error while parsing actor details text", i);
|
||
|
}
|
||
|
}, a0 = function(t, e) {
|
||
|
if (t !== void 0 && t.properties !== void 0)
|
||
|
return t.properties[e];
|
||
|
}, ce = function(t) {
|
||
|
if (Array.isArray(t))
|
||
|
t.forEach(function(e) {
|
||
|
ce(e);
|
||
|
});
|
||
|
else
|
||
|
switch (t.type) {
|
||
|
case "sequenceIndex":
|
||
|
$.push({
|
||
|
from: void 0,
|
||
|
to: void 0,
|
||
|
message: {
|
||
|
start: t.sequenceIndex,
|
||
|
step: t.sequenceIndexStep,
|
||
|
visible: t.sequenceVisible
|
||
|
},
|
||
|
wrap: !1,
|
||
|
type: t.signalType
|
||
|
});
|
||
|
break;
|
||
|
case "addParticipant":
|
||
|
Ft(t.actor, t.actor, t.description, "participant");
|
||
|
break;
|
||
|
case "addActor":
|
||
|
Ft(t.actor, t.actor, t.description, "actor");
|
||
|
break;
|
||
|
case "activeStart":
|
||
|
R(t.actor, void 0, void 0, t.signalType);
|
||
|
break;
|
||
|
case "activeEnd":
|
||
|
R(t.actor, void 0, void 0, t.signalType);
|
||
|
break;
|
||
|
case "addNote":
|
||
|
ie(t.actor, t.placement, t.text);
|
||
|
break;
|
||
|
case "addLinks":
|
||
|
se(t.actor, t.text);
|
||
|
break;
|
||
|
case "addALink":
|
||
|
i0(t.actor, t.text);
|
||
|
break;
|
||
|
case "addProperties":
|
||
|
ae(t.actor, t.text);
|
||
|
break;
|
||
|
case "addDetails":
|
||
|
oe(t.actor, t.text);
|
||
|
break;
|
||
|
case "addMessage":
|
||
|
R(t.from, t.to, t.msg, t.signalType);
|
||
|
break;
|
||
|
case "boxStart":
|
||
|
Ye(t.boxData);
|
||
|
break;
|
||
|
case "boxEnd":
|
||
|
s0();
|
||
|
break;
|
||
|
case "loopStart":
|
||
|
R(void 0, void 0, t.loopText, t.signalType);
|
||
|
break;
|
||
|
case "loopEnd":
|
||
|
R(void 0, void 0, void 0, t.signalType);
|
||
|
break;
|
||
|
case "rectStart":
|
||
|
R(void 0, void 0, t.color, t.signalType);
|
||
|
break;
|
||
|
case "rectEnd":
|
||
|
R(void 0, void 0, void 0, t.signalType);
|
||
|
break;
|
||
|
case "optStart":
|
||
|
R(void 0, void 0, t.optText, t.signalType);
|
||
|
break;
|
||
|
case "optEnd":
|
||
|
R(void 0, void 0, void 0, t.signalType);
|
||
|
break;
|
||
|
case "altStart":
|
||
|
R(void 0, void 0, t.altText, t.signalType);
|
||
|
break;
|
||
|
case "else":
|
||
|
R(void 0, void 0, t.altText, t.signalType);
|
||
|
break;
|
||
|
case "altEnd":
|
||
|
R(void 0, void 0, void 0, t.signalType);
|
||
|
break;
|
||
|
case "setAccTitle":
|
||
|
te(t.text);
|
||
|
break;
|
||
|
case "parStart":
|
||
|
R(void 0, void 0, t.parText, t.signalType);
|
||
|
break;
|
||
|
case "and":
|
||
|
R(void 0, void 0, t.parText, t.signalType);
|
||
|
break;
|
||
|
case "parEnd":
|
||
|
R(void 0, void 0, void 0, t.signalType);
|
||
|
break;
|
||
|
case "criticalStart":
|
||
|
R(void 0, void 0, t.criticalText, t.signalType);
|
||
|
break;
|
||
|
case "option":
|
||
|
R(void 0, void 0, t.optionText, t.signalType);
|
||
|
break;
|
||
|
case "criticalEnd":
|
||
|
R(void 0, void 0, void 0, t.signalType);
|
||
|
break;
|
||
|
case "breakStart":
|
||
|
R(void 0, void 0, t.breakText, t.signalType);
|
||
|
break;
|
||
|
case "breakEnd":
|
||
|
R(void 0, void 0, void 0, t.signalType);
|
||
|
break;
|
||
|
}
|
||
|
}, r0 = {
|
||
|
addActor: Ft,
|
||
|
addMessage: We,
|
||
|
addSignal: R,
|
||
|
addLinks: se,
|
||
|
addDetails: oe,
|
||
|
addProperties: ae,
|
||
|
autoWrap: ut,
|
||
|
setWrap: Qe,
|
||
|
enableSequenceNumbers: Xe,
|
||
|
disableSequenceNumbers: Je,
|
||
|
showSequenceNumbers: Ze,
|
||
|
getMessages: He,
|
||
|
getActors: Ke,
|
||
|
getActor: mt,
|
||
|
getActorKeys: Ge,
|
||
|
getActorProperty: a0,
|
||
|
getAccTitle: me,
|
||
|
getBoxes: Ue,
|
||
|
getDiagramTitle: we,
|
||
|
setDiagramTitle: _e,
|
||
|
parseDirective: Be,
|
||
|
getConfig: () => lt().sequence,
|
||
|
clear: je,
|
||
|
parseMessage: $e,
|
||
|
parseBoxData: t0,
|
||
|
LINETYPE: bt,
|
||
|
ARROWTYPE: e0,
|
||
|
PLACEMENT: n0,
|
||
|
addNote: ie,
|
||
|
setAccTitle: te,
|
||
|
apply: ce,
|
||
|
setAccDescription: ke,
|
||
|
getAccDescription: Pe,
|
||
|
hasAtLeastOneBox: qe,
|
||
|
hasAtLeastOneBoxWithTitle: ze
|
||
|
}, o0 = (t) => `.actor {
|
||
|
stroke: ${t.actorBorder};
|
||
|
fill: ${t.actorBkg};
|
||
|
}
|
||
|
|
||
|
text.actor > tspan {
|
||
|
fill: ${t.actorTextColor};
|
||
|
stroke: none;
|
||
|
}
|
||
|
|
||
|
.actor-line {
|
||
|
stroke: ${t.actorLineColor};
|
||
|
}
|
||
|
|
||
|
.messageLine0 {
|
||
|
stroke-width: 1.5;
|
||
|
stroke-dasharray: none;
|
||
|
stroke: ${t.signalColor};
|
||
|
}
|
||
|
|
||
|
.messageLine1 {
|
||
|
stroke-width: 1.5;
|
||
|
stroke-dasharray: 2, 2;
|
||
|
stroke: ${t.signalColor};
|
||
|
}
|
||
|
|
||
|
#arrowhead path {
|
||
|
fill: ${t.signalColor};
|
||
|
stroke: ${t.signalColor};
|
||
|
}
|
||
|
|
||
|
.sequenceNumber {
|
||
|
fill: ${t.sequenceNumberColor};
|
||
|
}
|
||
|
|
||
|
#sequencenumber {
|
||
|
fill: ${t.signalColor};
|
||
|
}
|
||
|
|
||
|
#crosshead path {
|
||
|
fill: ${t.signalColor};
|
||
|
stroke: ${t.signalColor};
|
||
|
}
|
||
|
|
||
|
.messageText {
|
||
|
fill: ${t.signalTextColor};
|
||
|
stroke: none;
|
||
|
}
|
||
|
|
||
|
.labelBox {
|
||
|
stroke: ${t.labelBoxBorderColor};
|
||
|
fill: ${t.labelBoxBkgColor};
|
||
|
}
|
||
|
|
||
|
.labelText, .labelText > tspan {
|
||
|
fill: ${t.labelTextColor};
|
||
|
stroke: none;
|
||
|
}
|
||
|
|
||
|
.loopText, .loopText > tspan {
|
||
|
fill: ${t.loopTextColor};
|
||
|
stroke: none;
|
||
|
}
|
||
|
|
||
|
.loopLine {
|
||
|
stroke-width: 2px;
|
||
|
stroke-dasharray: 2, 2;
|
||
|
stroke: ${t.labelBoxBorderColor};
|
||
|
fill: ${t.labelBoxBorderColor};
|
||
|
}
|
||
|
|
||
|
.note {
|
||
|
//stroke: #decc93;
|
||
|
stroke: ${t.noteBorderColor};
|
||
|
fill: ${t.noteBkgColor};
|
||
|
}
|
||
|
|
||
|
.noteText, .noteText > tspan {
|
||
|
fill: ${t.noteTextColor};
|
||
|
stroke: none;
|
||
|
}
|
||
|
|
||
|
.activation0 {
|
||
|
fill: ${t.activationBkgColor};
|
||
|
stroke: ${t.activationBorderColor};
|
||
|
}
|
||
|
|
||
|
.activation1 {
|
||
|
fill: ${t.activationBkgColor};
|
||
|
stroke: ${t.activationBorderColor};
|
||
|
}
|
||
|
|
||
|
.activation2 {
|
||
|
fill: ${t.activationBkgColor};
|
||
|
stroke: ${t.activationBorderColor};
|
||
|
}
|
||
|
|
||
|
.actorPopupMenu {
|
||
|
position: absolute;
|
||
|
}
|
||
|
|
||
|
.actorPopupMenuPanel {
|
||
|
position: absolute;
|
||
|
fill: ${t.actorBkg};
|
||
|
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||
|
filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
|
||
|
}
|
||
|
.actor-man line {
|
||
|
stroke: ${t.actorBorder};
|
||
|
fill: ${t.actorBkg};
|
||
|
}
|
||
|
.actor-man circle, line {
|
||
|
stroke: ${t.actorBorder};
|
||
|
fill: ${t.actorBkg};
|
||
|
stroke-width: 2px;
|
||
|
}
|
||
|
`, c0 = o0, Ut = function(t, e) {
|
||
|
return Me(t, e);
|
||
|
}, le = (t, e) => {
|
||
|
Ne(() => {
|
||
|
const r = document.querySelectorAll(t);
|
||
|
r.length !== 0 && (r[0].addEventListener("mouseover", function() {
|
||
|
u0("actor" + e + "_popup");
|
||
|
}), r[0].addEventListener("mouseout", function() {
|
||
|
p0("actor" + e + "_popup");
|
||
|
}));
|
||
|
});
|
||
|
}, l0 = function(t, e, r, n, i) {
|
||
|
if (e.links === void 0 || e.links === null || Object.keys(e.links).length === 0)
|
||
|
return { height: 0, width: 0 };
|
||
|
const s = e.links, c = e.actorCnt, l = e.rectData;
|
||
|
var u = "none";
|
||
|
i && (u = "block !important");
|
||
|
const d = t.append("g");
|
||
|
d.attr("id", "actor" + c + "_popup"), d.attr("class", "actorPopupMenu"), d.attr("display", u), le("#actor" + c + "_popup", c);
|
||
|
var T = "";
|
||
|
l.class !== void 0 && (T = " " + l.class);
|
||
|
let y = l.width > r ? l.width : r;
|
||
|
const p = d.append("rect");
|
||
|
if (p.attr("class", "actorPopupMenuPanel" + T), p.attr("x", l.x), p.attr("y", l.height), p.attr("fill", l.fill), p.attr("stroke", l.stroke), p.attr("width", y), p.attr("height", l.height), p.attr("rx", l.rx), p.attr("ry", l.ry), s != null) {
|
||
|
var x = 20;
|
||
|
for (let A in s) {
|
||
|
var m = d.append("a"), I = ee(s[A]);
|
||
|
m.attr("xlink:href", I), m.attr("target", "_blank"), v0(n)(
|
||
|
A,
|
||
|
m,
|
||
|
l.x + 10,
|
||
|
l.height + x,
|
||
|
y,
|
||
|
20,
|
||
|
{ class: "actor" },
|
||
|
n
|
||
|
), x += 30;
|
||
|
}
|
||
|
}
|
||
|
return p.attr("height", x), { height: l.height + x, width: y };
|
||
|
}, h0 = function(t) {
|
||
|
return "var pu = document.getElementById('" + t + "'); if (pu != null) { pu.style.display = 'block'; }";
|
||
|
}, d0 = function(t) {
|
||
|
return "var pu = document.getElementById('" + t + "'); if (pu != null) { pu.style.display = 'none'; }";
|
||
|
}, u0 = function(t) {
|
||
|
var e = document.getElementById(t);
|
||
|
e != null && (e.style.display = "block");
|
||
|
}, p0 = function(t) {
|
||
|
var e = document.getElementById(t);
|
||
|
e != null && (e.style.display = "none");
|
||
|
}, Tt = function(t, e) {
|
||
|
let r = 0, n = 0;
|
||
|
const i = e.text.split(_.lineBreakRegex), [s, c] = ne(e.fontSize);
|
||
|
let l = [], u = 0, d = () => e.y;
|
||
|
if (e.valign !== void 0 && e.textMargin !== void 0 && e.textMargin > 0)
|
||
|
switch (e.valign) {
|
||
|
case "top":
|
||
|
case "start":
|
||
|
d = () => Math.round(e.y + e.textMargin);
|
||
|
break;
|
||
|
case "middle":
|
||
|
case "center":
|
||
|
d = () => Math.round(e.y + (r + n + e.textMargin) / 2);
|
||
|
break;
|
||
|
case "bottom":
|
||
|
case "end":
|
||
|
d = () => Math.round(
|
||
|
e.y + (r + n + 2 * e.textMargin) - e.textMargin
|
||
|
);
|
||
|
break;
|
||
|
}
|
||
|
if (e.anchor !== void 0 && e.textMargin !== void 0 && e.width !== void 0)
|
||
|
switch (e.anchor) {
|
||
|
case "left":
|
||
|
case "start":
|
||
|
e.x = Math.round(e.x + e.textMargin), e.anchor = "start", e.dominantBaseline = "middle", e.alignmentBaseline = "middle";
|
||
|
break;
|
||
|
case "middle":
|
||
|
case "center":
|
||
|
e.x = Math.round(e.x + e.width / 2), e.anchor = "middle", e.dominantBaseline = "middle", e.alignmentBaseline = "middle";
|
||
|
break;
|
||
|
case "right":
|
||
|
case "end":
|
||
|
e.x = Math.round(e.x + e.width - e.textMargin), e.anchor = "end", e.dominantBaseline = "middle", e.alignmentBaseline = "middle";
|
||
|
break;
|
||
|
}
|
||
|
for (let [T, y] of i.entries()) {
|
||
|
e.textMargin !== void 0 && e.textMargin === 0 && s !== void 0 && (u = T * s);
|
||
|
const p = t.append("text");
|
||
|
p.attr("x", e.x), p.attr("y", d()), e.anchor !== void 0 && p.attr("text-anchor", e.anchor).attr("dominant-baseline", e.dominantBaseline).attr("alignment-baseline", e.alignmentBaseline), e.fontFamily !== void 0 && p.style("font-family", e.fontFamily), c !== void 0 && p.style("font-size", c), e.fontWeight !== void 0 && p.style("font-weight", e.fontWeight), e.fill !== void 0 && p.attr("fill", e.fill), e.class !== void 0 && p.attr("class", e.class), e.dy !== void 0 ? p.attr("dy", e.dy) : u !== 0 && p.attr("dy", u);
|
||
|
const x = y || ve;
|
||
|
if (e.tspan) {
|
||
|
const m = p.append("tspan");
|
||
|
m.attr("x", e.x), e.fill !== void 0 && m.attr("fill", e.fill), m.text(x);
|
||
|
} else
|
||
|
p.text(x);
|
||
|
e.valign !== void 0 && e.textMargin !== void 0 && e.textMargin > 0 && (n += (p._groups || p)[0][0].getBBox().height, r = n), l.push(p);
|
||
|
}
|
||
|
return l;
|
||
|
}, he = function(t, e) {
|
||
|
function r(i, s, c, l, u) {
|
||
|
return i + "," + s + " " + (i + c) + "," + s + " " + (i + c) + "," + (s + l - u) + " " + (i + c - u * 1.2) + "," + (s + l) + " " + i + "," + (s + l);
|
||
|
}
|
||
|
const n = t.append("polygon");
|
||
|
return n.attr("points", r(e.x, e.y, e.width, e.height, 7)), n.attr("class", "labelBox"), e.y = e.y + e.height / 2, Tt(t, e), n;
|
||
|
};
|
||
|
let et = -1;
|
||
|
const de = (t, e) => {
|
||
|
t.selectAll && t.selectAll(".actor-line").attr("class", "200").attr("y2", e - 55);
|
||
|
}, f0 = function(t, e, r, n) {
|
||
|
const i = e.x + e.width / 2, s = e.y + 5, c = t.append("g");
|
||
|
var l = c;
|
||
|
n || (et++, l.append("line").attr("id", "actor" + et).attr("x1", i).attr("y1", s).attr("x2", i).attr("y2", 2e3).attr("class", "actor-line").attr("stroke-width", "0.5px").attr("stroke", "#999"), l = c.append("g"), e.actorCnt = et, e.links != null && (l.attr("id", "root-" + et), le("#root-" + et, et)));
|
||
|
const u = Nt();
|
||
|
var d = "actor";
|
||
|
e.properties != null && e.properties.class ? d = e.properties.class : u.fill = "#eaeaea", u.x = e.x, u.y = e.y, u.width = e.width, u.height = e.height, u.class = d, u.rx = 3, u.ry = 3;
|
||
|
const T = Ut(l, u);
|
||
|
if (e.rectData = u, e.properties != null && e.properties.icon) {
|
||
|
const p = e.properties.icon.trim();
|
||
|
p.charAt(0) === "@" ? De(l, u.x + u.width - 20, u.y + 10, p.substr(1)) : Ve(l, u.x + u.width - 20, u.y + 10, p);
|
||
|
}
|
||
|
Kt(r)(
|
||
|
e.description,
|
||
|
l,
|
||
|
u.x,
|
||
|
u.y,
|
||
|
u.width,
|
||
|
u.height,
|
||
|
{ class: "actor" },
|
||
|
r
|
||
|
);
|
||
|
let y = e.height;
|
||
|
if (T.node) {
|
||
|
const p = T.node().getBBox();
|
||
|
e.height = p.height, y = p.height;
|
||
|
}
|
||
|
return y;
|
||
|
}, g0 = function(t, e, r, n) {
|
||
|
const i = e.x + e.width / 2, s = e.y + 80;
|
||
|
n || (et++, t.append("line").attr("id", "actor" + et).attr("x1", i).attr("y1", s).attr("x2", i).attr("y2", 2e3).attr("class", "actor-line").attr("stroke-width", "0.5px").attr("stroke", "#999"));
|
||
|
const c = t.append("g");
|
||
|
c.attr("class", "actor-man");
|
||
|
const l = Nt();
|
||
|
l.x = e.x, l.y = e.y, l.fill = "#eaeaea", l.width = e.width, l.height = e.height, l.class = "actor", l.rx = 3, l.ry = 3, c.append("line").attr("id", "actor-man-torso" + et).attr("x1", i).attr("y1", e.y + 25).attr("x2", i).attr("y2", e.y + 45), c.append("line").attr("id", "actor-man-arms" + et).attr("x1", i - 18).attr("y1", e.y + 33).attr("x2", i + 18).attr("y2", e.y + 33), c.append("line").attr("x1", i - 18).attr("y1", e.y + 60).attr("x2", i).attr("y2", e.y + 45), c.append("line").attr("x1", i).attr("y1", e.y + 45).attr("x2", i + 16).attr("y2", e.y + 60);
|
||
|
const u = c.append("circle");
|
||
|
u.attr("cx", e.x + e.width / 2), u.attr("cy", e.y + 10), u.attr("r", 15), u.attr("width", e.width), u.attr("height", e.height);
|
||
|
const d = c.node().getBBox();
|
||
|
return e.height = d.height, Kt(r)(
|
||
|
e.description,
|
||
|
c,
|
||
|
l.x,
|
||
|
l.y + 35,
|
||
|
l.width,
|
||
|
l.height,
|
||
|
{ class: "actor" },
|
||
|
r
|
||
|
), e.height;
|
||
|
}, x0 = function(t, e, r, n) {
|
||
|
switch (e.type) {
|
||
|
case "actor":
|
||
|
return g0(t, e, r, n);
|
||
|
case "participant":
|
||
|
return f0(t, e, r, n);
|
||
|
}
|
||
|
}, T0 = function(t, e, r) {
|
||
|
const i = t.append("g");
|
||
|
ue(i, e), e.name && Kt(r)(
|
||
|
e.name,
|
||
|
i,
|
||
|
e.x,
|
||
|
e.y + (e.textMaxHeight || 0) / 2,
|
||
|
e.width,
|
||
|
0,
|
||
|
{ class: "text" },
|
||
|
r
|
||
|
), i.lower();
|
||
|
}, y0 = function(t) {
|
||
|
return t.append("g");
|
||
|
}, E0 = function(t, e, r, n, i) {
|
||
|
const s = Nt(), c = e.anchored;
|
||
|
s.x = e.startx, s.y = e.starty, s.class = "activation" + i % 3, s.width = e.stopx - e.startx, s.height = r - e.starty, Ut(c, s);
|
||
|
}, b0 = function(t, e, r, n) {
|
||
|
const {
|
||
|
boxMargin: i,
|
||
|
boxTextMargin: s,
|
||
|
labelBoxHeight: c,
|
||
|
labelBoxWidth: l,
|
||
|
messageFontFamily: u,
|
||
|
messageFontSize: d,
|
||
|
messageFontWeight: T
|
||
|
} = n, y = t.append("g"), p = function(I, A, M, N) {
|
||
|
return y.append("line").attr("x1", I).attr("y1", A).attr("x2", M).attr("y2", N).attr("class", "loopLine");
|
||
|
};
|
||
|
p(e.startx, e.starty, e.stopx, e.starty), p(e.stopx, e.starty, e.stopx, e.stopy), p(e.startx, e.stopy, e.stopx, e.stopy), p(e.startx, e.starty, e.startx, e.stopy), e.sections !== void 0 && e.sections.forEach(function(I) {
|
||
|
p(e.startx, I.y, e.stopx, I.y).style(
|
||
|
"stroke-dasharray",
|
||
|
"3, 3"
|
||
|
);
|
||
|
});
|
||
|
let x = zt();
|
||
|
x.text = r, x.x = e.startx, x.y = e.starty, x.fontFamily = u, x.fontSize = d, x.fontWeight = T, x.anchor = "middle", x.valign = "middle", x.tspan = !1, x.width = l || 50, x.height = c || 20, x.textMargin = s, x.class = "labelText", he(y, x), x = pe(), x.text = e.title, x.x = e.startx + l / 2 + (e.stopx - e.startx) / 2, x.y = e.starty + i + s, x.anchor = "middle", x.valign = "middle", x.textMargin = s, x.class = "loopText", x.fontFamily = u, x.fontSize = d, x.fontWeight = T, x.wrap = !0;
|
||
|
let m = Tt(y, x);
|
||
|
return e.sectionTitles !== void 0 && e.sectionTitles.forEach(function(I, A) {
|
||
|
if (I.message) {
|
||
|
x.text = I.message, x.x = e.startx + (e.stopx - e.startx) / 2, x.y = e.sections[A].y + i + s, x.class = "loopText", x.anchor = "middle", x.valign = "middle", x.tspan = !1, x.fontFamily = u, x.fontSize = d, x.fontWeight = T, x.wrap = e.wrap, m = Tt(y, x);
|
||
|
let M = Math.round(
|
||
|
m.map((N) => (N._groups || N)[0][0].getBBox().height).reduce((N, Y) => N + Y)
|
||
|
);
|
||
|
e.sections[A].height += M - (i + s);
|
||
|
}
|
||
|
}), e.height = Math.round(e.stopy - e.starty), y;
|
||
|
}, ue = function(t, e) {
|
||
|
Re(t, e);
|
||
|
}, m0 = function(t) {
|
||
|
t.append("defs").append("symbol").attr("id", "database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
|
||
|
"d",
|
||
|
"M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152
|
||
|
);
|
||
|
}, w0 = function(t) {
|
||
|
t.append("defs").append("symbol").attr("id", "computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
|
||
|
"d",
|
||
|
"M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z"
|
||
|
);
|
||
|
}, _0 = function(t) {
|
||
|
t.append("defs").append("symbol").attr("id", "clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
|
||
|
"d",
|
||
|
"M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z"
|
||
|
);
|
||
|
}, k0 = function(t) {
|
||
|
t.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z");
|
||
|
}, P0 = function(t) {
|
||
|
t.append("defs").append("marker").attr("id", "filled-head").attr("refX", 18).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
|
||
|
}, L0 = function(t) {
|
||
|
t.append("defs").append("marker").attr("id", "sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6);
|
||
|
}, I0 = function(t) {
|
||
|
t.append("defs").append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 5).append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1pt").attr("d", "M 1,2 L 6,7 M 6,2 L 1,7");
|
||
|
}, pe = function() {
|
||
|
return {
|
||
|
x: 0,
|
||
|
y: 0,
|
||
|
fill: void 0,
|
||
|
anchor: void 0,
|
||
|
style: "#666",
|
||
|
width: void 0,
|
||
|
height: void 0,
|
||
|
textMargin: 0,
|
||
|
rx: 0,
|
||
|
ry: 0,
|
||
|
tspan: !0,
|
||
|
valign: void 0
|
||
|
};
|
||
|
}, N0 = function() {
|
||
|
return {
|
||
|
x: 0,
|
||
|
y: 0,
|
||
|
fill: "#EDF2AE",
|
||
|
stroke: "#666",
|
||
|
width: 100,
|
||
|
anchor: "start",
|
||
|
height: 100,
|
||
|
rx: 0,
|
||
|
ry: 0
|
||
|
};
|
||
|
}, Kt = function() {
|
||
|
function t(i, s, c, l, u, d, T) {
|
||
|
const y = s.append("text").attr("x", c + u / 2).attr("y", l + d / 2 + 5).style("text-anchor", "middle").text(i);
|
||
|
n(y, T);
|
||
|
}
|
||
|
function e(i, s, c, l, u, d, T, y) {
|
||
|
const { actorFontSize: p, actorFontFamily: x, actorFontWeight: m } = y, [I, A] = ne(p), M = i.split(_.lineBreakRegex);
|
||
|
for (let N = 0; N < M.length; N++) {
|
||
|
const Y = N * I - I * (M.length - 1) / 2, V = s.append("text").attr("x", c + u / 2).attr("y", l).style("text-anchor", "middle").style("font-size", A).style("font-weight", m).style("font-family", x);
|
||
|
V.append("tspan").attr("x", c + u / 2).attr("dy", Y).text(M[N]), V.attr("y", l + d / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), n(V, T);
|
||
|
}
|
||
|
}
|
||
|
function r(i, s, c, l, u, d, T, y) {
|
||
|
const p = s.append("switch"), m = p.append("foreignObject").attr("x", c).attr("y", l).attr("width", u).attr("height", d).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
|
||
|
m.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(i), e(i, p, c, l, u, d, T, y), n(m, T);
|
||
|
}
|
||
|
function n(i, s) {
|
||
|
for (const c in s)
|
||
|
s.hasOwnProperty(c) && i.attr(c, s[c]);
|
||
|
}
|
||
|
return function(i) {
|
||
|
return i.textPlacement === "fo" ? r : i.textPlacement === "old" ? t : e;
|
||
|
};
|
||
|
}(), v0 = function() {
|
||
|
function t(i, s, c, l, u, d, T) {
|
||
|
const y = s.append("text").attr("x", c).attr("y", l).style("text-anchor", "start").text(i);
|
||
|
n(y, T);
|
||
|
}
|
||
|
function e(i, s, c, l, u, d, T, y) {
|
||
|
const { actorFontSize: p, actorFontFamily: x, actorFontWeight: m } = y, I = i.split(_.lineBreakRegex);
|
||
|
for (let A = 0; A < I.length; A++) {
|
||
|
const M = A * p - p * (I.length - 1) / 2, N = s.append("text").attr("x", c).attr("y", l).style("text-anchor", "start").style("font-size", p).style("font-weight", m).style("font-family", x);
|
||
|
N.append("tspan").attr("x", c).attr("dy", M).text(I[A]), N.attr("y", l + d / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), n(N, T);
|
||
|
}
|
||
|
}
|
||
|
function r(i, s, c, l, u, d, T, y) {
|
||
|
const p = s.append("switch"), m = p.append("foreignObject").attr("x", c).attr("y", l).attr("width", u).attr("height", d).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
|
||
|
m.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(i), e(i, p, c, l, u, d, T, y), n(m, T);
|
||
|
}
|
||
|
function n(i, s) {
|
||
|
for (const c in s)
|
||
|
s.hasOwnProperty(c) && i.attr(c, s[c]);
|
||
|
}
|
||
|
return function(i) {
|
||
|
return i.textPlacement === "fo" ? r : i.textPlacement === "old" ? t : e;
|
||
|
};
|
||
|
}(), D = {
|
||
|
drawRect: Ut,
|
||
|
drawText: Tt,
|
||
|
drawLabel: he,
|
||
|
drawActor: x0,
|
||
|
drawBox: T0,
|
||
|
drawPopup: l0,
|
||
|
anchorElement: y0,
|
||
|
drawActivation: E0,
|
||
|
drawLoop: b0,
|
||
|
drawBackgroundRect: ue,
|
||
|
insertArrowHead: k0,
|
||
|
insertArrowFilledHead: P0,
|
||
|
insertSequenceNumber: L0,
|
||
|
insertArrowCrossHead: I0,
|
||
|
insertDatabaseIcon: m0,
|
||
|
insertComputerIcon: w0,
|
||
|
insertClockIcon: _0,
|
||
|
getTextObj: pe,
|
||
|
getNoteRect: N0,
|
||
|
popupMenu: h0,
|
||
|
popdownMenu: d0,
|
||
|
fixLifeLineHeights: de,
|
||
|
sanitizeUrl: ee
|
||
|
};
|
||
|
let a = {};
|
||
|
const f = {
|
||
|
data: {
|
||
|
startx: void 0,
|
||
|
stopx: void 0,
|
||
|
starty: void 0,
|
||
|
stopy: void 0
|
||
|
},
|
||
|
verticalPos: 0,
|
||
|
sequenceItems: [],
|
||
|
activations: [],
|
||
|
models: {
|
||
|
getHeight: function() {
|
||
|
return Math.max.apply(
|
||
|
null,
|
||
|
this.actors.length === 0 ? [0] : this.actors.map((t) => t.height || 0)
|
||
|
) + (this.loops.length === 0 ? 0 : this.loops.map((t) => t.height || 0).reduce((t, e) => t + e)) + (this.messages.length === 0 ? 0 : this.messages.map((t) => t.height || 0).reduce((t, e) => t + e)) + (this.notes.length === 0 ? 0 : this.notes.map((t) => t.height || 0).reduce((t, e) => t + e));
|
||
|
},
|
||
|
clear: function() {
|
||
|
this.actors = [], this.boxes = [], this.loops = [], this.messages = [], this.notes = [];
|
||
|
},
|
||
|
addBox: function(t) {
|
||
|
this.boxes.push(t);
|
||
|
},
|
||
|
addActor: function(t) {
|
||
|
this.actors.push(t);
|
||
|
},
|
||
|
addLoop: function(t) {
|
||
|
this.loops.push(t);
|
||
|
},
|
||
|
addMessage: function(t) {
|
||
|
this.messages.push(t);
|
||
|
},
|
||
|
addNote: function(t) {
|
||
|
this.notes.push(t);
|
||
|
},
|
||
|
lastActor: function() {
|
||
|
return this.actors[this.actors.length - 1];
|
||
|
},
|
||
|
lastLoop: function() {
|
||
|
return this.loops[this.loops.length - 1];
|
||
|
},
|
||
|
lastMessage: function() {
|
||
|
return this.messages[this.messages.length - 1];
|
||
|
},
|
||
|
lastNote: function() {
|
||
|
return this.notes[this.notes.length - 1];
|
||
|
},
|
||
|
actors: [],
|
||
|
boxes: [],
|
||
|
loops: [],
|
||
|
messages: [],
|
||
|
notes: []
|
||
|
},
|
||
|
init: function() {
|
||
|
this.sequenceItems = [], this.activations = [], this.models.clear(), this.data = {
|
||
|
startx: void 0,
|
||
|
stopx: void 0,
|
||
|
starty: void 0,
|
||
|
stopy: void 0
|
||
|
}, this.verticalPos = 0, ge(lt());
|
||
|
},
|
||
|
updateVal: function(t, e, r, n) {
|
||
|
t[e] === void 0 ? t[e] = r : t[e] = n(r, t[e]);
|
||
|
},
|
||
|
updateBounds: function(t, e, r, n) {
|
||
|
const i = this;
|
||
|
let s = 0;
|
||
|
function c(l) {
|
||
|
return function(d) {
|
||
|
s++;
|
||
|
const T = i.sequenceItems.length - s + 1;
|
||
|
i.updateVal(d, "starty", e - T * a.boxMargin, Math.min), i.updateVal(d, "stopy", n + T * a.boxMargin, Math.max), i.updateVal(f.data, "startx", t - T * a.boxMargin, Math.min), i.updateVal(f.data, "stopx", r + T * a.boxMargin, Math.max), l !== "activation" && (i.updateVal(d, "startx", t - T * a.boxMargin, Math.min), i.updateVal(d, "stopx", r + T * a.boxMargin, Math.max), i.updateVal(f.data, "starty", e - T * a.boxMargin, Math.min), i.updateVal(f.data, "stopy", n + T * a.boxMargin, Math.max));
|
||
|
};
|
||
|
}
|
||
|
this.sequenceItems.forEach(c()), this.activations.forEach(c("activation"));
|
||
|
},
|
||
|
insert: function(t, e, r, n) {
|
||
|
const i = _.getMin(t, r), s = _.getMax(t, r), c = _.getMin(e, n), l = _.getMax(e, n);
|
||
|
this.updateVal(f.data, "startx", i, Math.min), this.updateVal(f.data, "starty", c, Math.min), this.updateVal(f.data, "stopx", s, Math.max), this.updateVal(f.data, "stopy", l, Math.max), this.updateBounds(i, c, s, l);
|
||
|
},
|
||
|
newActivation: function(t, e, r) {
|
||
|
const n = r[t.from.actor], i = At(t.from.actor).length || 0, s = n.x + n.width / 2 + (i - 1) * a.activationWidth / 2;
|
||
|
this.activations.push({
|
||
|
startx: s,
|
||
|
starty: this.verticalPos + 2,
|
||
|
stopx: s + a.activationWidth,
|
||
|
stopy: void 0,
|
||
|
actor: t.from.actor,
|
||
|
anchored: D.anchorElement(e)
|
||
|
});
|
||
|
},
|
||
|
endActivation: function(t) {
|
||
|
const e = this.activations.map(function(r) {
|
||
|
return r.actor;
|
||
|
}).lastIndexOf(t.from.actor);
|
||
|
return this.activations.splice(e, 1)[0];
|
||
|
},
|
||
|
createLoop: function(t = { message: void 0, wrap: !1, width: void 0 }, e) {
|
||
|
return {
|
||
|
startx: void 0,
|
||
|
starty: this.verticalPos,
|
||
|
stopx: void 0,
|
||
|
stopy: void 0,
|
||
|
title: t.message,
|
||
|
wrap: t.wrap,
|
||
|
width: t.width,
|
||
|
height: 0,
|
||
|
fill: e
|
||
|
};
|
||
|
},
|
||
|
newLoop: function(t = { message: void 0, wrap: !1, width: void 0 }, e) {
|
||
|
this.sequenceItems.push(this.createLoop(t, e));
|
||
|
},
|
||
|
endLoop: function() {
|
||
|
return this.sequenceItems.pop();
|
||
|
},
|
||
|
isLoopOverlap: function() {
|
||
|
return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : !1;
|
||
|
},
|
||
|
addSectionToLoop: function(t) {
|
||
|
const e = this.sequenceItems.pop();
|
||
|
e.sections = e.sections || [], e.sectionTitles = e.sectionTitles || [], e.sections.push({ y: f.getVerticalPos(), height: 0 }), e.sectionTitles.push(t), this.sequenceItems.push(e);
|
||
|
},
|
||
|
saveVerticalPos: function() {
|
||
|
this.isLoopOverlap() && (this.savedVerticalPos = this.verticalPos);
|
||
|
},
|
||
|
resetVerticalPos: function() {
|
||
|
this.isLoopOverlap() && (this.verticalPos = this.savedVerticalPos);
|
||
|
},
|
||
|
bumpVerticalPos: function(t) {
|
||
|
this.verticalPos = this.verticalPos + t, this.data.stopy = _.getMax(this.data.stopy, this.verticalPos);
|
||
|
},
|
||
|
getVerticalPos: function() {
|
||
|
return this.verticalPos;
|
||
|
},
|
||
|
getBounds: function() {
|
||
|
return { bounds: this.data, models: this.models };
|
||
|
}
|
||
|
}, A0 = function(t, e) {
|
||
|
f.bumpVerticalPos(a.boxMargin), e.height = a.boxMargin, e.starty = f.getVerticalPos();
|
||
|
const r = Nt();
|
||
|
r.x = e.startx, r.y = e.starty, r.width = e.width || a.width, r.class = "note";
|
||
|
const n = t.append("g"), i = D.drawRect(n, r), s = zt();
|
||
|
s.x = e.startx, s.y = e.starty, s.width = r.width, s.dy = "1em", s.text = e.message, s.class = "noteText", s.fontFamily = a.noteFontFamily, s.fontSize = a.noteFontSize, s.fontWeight = a.noteFontWeight, s.anchor = a.noteAlign, s.textMargin = a.noteMargin, s.valign = "center";
|
||
|
const c = Tt(n, s), l = Math.round(
|
||
|
c.map((u) => (u._groups || u)[0][0].getBBox().height).reduce((u, d) => u + d)
|
||
|
);
|
||
|
i.attr("height", l + 2 * a.noteMargin), e.height += l + 2 * a.noteMargin, f.bumpVerticalPos(l + 2 * a.noteMargin), e.stopy = e.starty + l + 2 * a.noteMargin, e.stopx = e.startx + r.width, f.insert(e.startx, e.starty, e.stopx, e.stopy), f.models.addNote(e);
|
||
|
}, pt = (t) => ({
|
||
|
fontFamily: t.messageFontFamily,
|
||
|
fontSize: t.messageFontSize,
|
||
|
fontWeight: t.messageFontWeight
|
||
|
}), gt = (t) => ({
|
||
|
fontFamily: t.noteFontFamily,
|
||
|
fontSize: t.noteFontSize,
|
||
|
fontWeight: t.noteFontWeight
|
||
|
}), Wt = (t) => ({
|
||
|
fontFamily: t.actorFontFamily,
|
||
|
fontSize: t.actorFontSize,
|
||
|
fontWeight: t.actorFontWeight
|
||
|
});
|
||
|
function S0(t, e) {
|
||
|
f.bumpVerticalPos(10);
|
||
|
const { startx: r, stopx: n, message: i } = e, s = _.splitBreaks(i).length, c = C.calculateTextDimensions(i, pt(a)), l = c.height / s;
|
||
|
e.height += l, f.bumpVerticalPos(l);
|
||
|
let u, d = c.height - 10;
|
||
|
const T = c.width;
|
||
|
if (r === n) {
|
||
|
u = f.getVerticalPos() + d, a.rightAngles || (d += a.boxMargin, u = f.getVerticalPos() + d), d += 30;
|
||
|
const y = _.getMax(T / 2, a.width / 2);
|
||
|
f.insert(
|
||
|
r - y,
|
||
|
f.getVerticalPos() - 10 + d,
|
||
|
n + y,
|
||
|
f.getVerticalPos() + 30 + d
|
||
|
);
|
||
|
} else
|
||
|
d += a.boxMargin, u = f.getVerticalPos() + d, f.insert(r, u - 10, n, u);
|
||
|
return f.bumpVerticalPos(d), e.height += d, e.stopy = e.starty + e.height, f.insert(e.fromBounds, e.starty, e.toBounds, e.stopy), u;
|
||
|
}
|
||
|
const M0 = function(t, e, r, n) {
|
||
|
const { startx: i, stopx: s, starty: c, message: l, type: u, sequenceIndex: d, sequenceVisible: T } = e, y = C.calculateTextDimensions(l, pt(a)), p = zt();
|
||
|
p.x = i, p.y = c + 10, p.width = s - i, p.class = "messageText", p.dy = "1em", p.text = l, p.fontFamily = a.messageFontFamily, p.fontSize = a.messageFontSize, p.fontWeight = a.messageFontWeight, p.anchor = a.messageAlign, p.valign = "center", p.textMargin = a.wrapPadding, p.tspan = !1, Tt(t, p);
|
||
|
const x = y.width;
|
||
|
let m;
|
||
|
i === s ? a.rightAngles ? m = t.append("path").attr(
|
||
|
"d",
|
||
|
`M ${i},${r} H ${i + _.getMax(a.width / 2, x / 2)} V ${r + 25} H ${i}`
|
||
|
) : m = t.append("path").attr(
|
||
|
"d",
|
||
|
"M " + i + "," + r + " C " + (i + 60) + "," + (r - 10) + " " + (i + 60) + "," + (r + 30) + " " + i + "," + (r + 20)
|
||
|
) : (m = t.append("line"), m.attr("x1", i), m.attr("y1", r), m.attr("x2", s), m.attr("y2", r)), u === n.db.LINETYPE.DOTTED || u === n.db.LINETYPE.DOTTED_CROSS || u === n.db.LINETYPE.DOTTED_POINT || u === n.db.LINETYPE.DOTTED_OPEN ? (m.style("stroke-dasharray", "3, 3"), m.attr("class", "messageLine1")) : m.attr("class", "messageLine0");
|
||
|
let I = "";
|
||
|
a.arrowMarkerAbsolute && (I = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, I = I.replace(/\(/g, "\\("), I = I.replace(/\)/g, "\\)")), m.attr("stroke-width", 2), m.attr("stroke", "none"), m.style("fill", "none"), (u === n.db.LINETYPE.SOLID || u === n.db.LINETYPE.DOTTED) && m.attr("marker-end", "url(" + I + "#arrowhead)"), (u === n.db.LINETYPE.SOLID_POINT || u === n.db.LINETYPE.DOTTED_POINT) && m.attr("marker-end", "url(" + I + "#filled-head)"), (u === n.db.LINETYPE.SOLID_CROSS || u === n.db.LINETYPE.DOTTED_CROSS) && m.attr("marker-end", "url(" + I + "#crosshead)"), (T || a.showSequenceNumbers) && (m.attr("marker-start", "url(" + I + "#sequencenumber)"), t.append("text").attr("x", i).attr("y", r + 4).attr("font-family", "sans-serif").attr("font-size", "12px").attr("text-anchor", "middle").attr("class", "sequenceNumber").text(d));
|
||
|
}, qt = function(t, e, r, n, i, s, c) {
|
||
|
if (i.hideUnusedParticipants === !0) {
|
||
|
const y = /* @__PURE__ */ new Set();
|
||
|
s.forEach((p) => {
|
||
|
y.add(p.from), y.add(p.to);
|
||
|
}), r = r.filter((p) => y.has(p));
|
||
|
}
|
||
|
let l = 0, u = 0, d = 0, T;
|
||
|
for (const y of r) {
|
||
|
const p = e[y], x = p.box;
|
||
|
T && T != x && (c || f.models.addBox(T), u += a.boxMargin + T.margin), x && x != T && (c || (x.x = l + u, x.y = n), u += x.margin), p.width = p.width || a.width, p.height = _.getMax(p.height || a.height, a.height), p.margin = p.margin || a.actorMargin, p.x = l + u, p.y = f.getVerticalPos();
|
||
|
const m = D.drawActor(t, p, a, c);
|
||
|
d = _.getMax(d, m), f.insert(p.x, n, p.x + p.width, p.height), l += p.width + u, p.box && (p.box.width = l + x.margin - p.box.x), u = p.margin, T = p.box, f.models.addActor(p);
|
||
|
}
|
||
|
T && !c && f.models.addBox(T), f.bumpVerticalPos(d);
|
||
|
}, fe = function(t, e, r, n) {
|
||
|
let i = 0, s = 0;
|
||
|
for (const c of r) {
|
||
|
const l = e[c], u = V0(l), d = D.drawPopup(
|
||
|
t,
|
||
|
l,
|
||
|
u,
|
||
|
a,
|
||
|
a.forceMenus,
|
||
|
n
|
||
|
);
|
||
|
d.height > i && (i = d.height), d.width + l.x > s && (s = d.width + l.x);
|
||
|
}
|
||
|
return { maxHeight: i, maxWidth: s };
|
||
|
}, ge = function(t) {
|
||
|
Ae(a, t), t.fontFamily && (a.actorFontFamily = a.noteFontFamily = a.messageFontFamily = t.fontFamily), t.fontSize && (a.actorFontSize = a.noteFontSize = a.messageFontSize = t.fontSize), t.fontWeight && (a.actorFontWeight = a.noteFontWeight = a.messageFontWeight = t.fontWeight);
|
||
|
}, At = function(t) {
|
||
|
return f.activations.filter(function(e) {
|
||
|
return e.actor === t;
|
||
|
});
|
||
|
}, $t = function(t, e) {
|
||
|
const r = e[t], n = At(t), i = n.reduce(function(c, l) {
|
||
|
return _.getMin(c, l.startx);
|
||
|
}, r.x + r.width / 2), s = n.reduce(function(c, l) {
|
||
|
return _.getMax(c, l.stopx);
|
||
|
}, r.x + r.width / 2);
|
||
|
return [i, s];
|
||
|
};
|
||
|
function tt(t, e, r, n, i) {
|
||
|
f.bumpVerticalPos(r);
|
||
|
let s = n;
|
||
|
if (e.id && e.message && t[e.id]) {
|
||
|
const c = t[e.id].width, l = pt(a);
|
||
|
e.message = C.wrapLabel(`[${e.message}]`, c - 2 * a.wrapPadding, l), e.width = c, e.wrap = !0;
|
||
|
const u = C.calculateTextDimensions(e.message, l), d = _.getMax(u.height, a.labelBoxHeight);
|
||
|
s = n + d, K.debug(`${d} - ${e.message}`);
|
||
|
}
|
||
|
i(e), f.bumpVerticalPos(s);
|
||
|
}
|
||
|
const R0 = function(t, e, r, n) {
|
||
|
const { securityLevel: i, sequence: s } = lt();
|
||
|
a = s, n.db.clear(), n.parser.parse(t);
|
||
|
let c;
|
||
|
i === "sandbox" && (c = Lt("#i" + e));
|
||
|
const l = i === "sandbox" ? Lt(c.nodes()[0].contentDocument.body) : Lt("body"), u = i === "sandbox" ? c.nodes()[0].contentDocument : document;
|
||
|
f.init(), K.debug(n.db);
|
||
|
const d = i === "sandbox" ? l.select(`[id="${e}"]`) : Lt(`[id="${e}"]`), T = n.db.getActors(), y = n.db.getBoxes(), p = n.db.getActorKeys(), x = n.db.getMessages(), m = n.db.getDiagramTitle(), I = n.db.hasAtLeastOneBox(), A = n.db.hasAtLeastOneBoxWithTitle(), M = D0(T, x, n);
|
||
|
a.height = C0(T, M, y), D.insertComputerIcon(d), D.insertDatabaseIcon(d), D.insertClockIcon(d), I && (f.bumpVerticalPos(a.boxMargin), A && f.bumpVerticalPos(y[0].textMaxHeight)), qt(d, T, p, 0, a, x, !1);
|
||
|
const N = Y0(x, T, M, n);
|
||
|
D.insertArrowHead(d), D.insertArrowCrossHead(d), D.insertArrowFilledHead(d), D.insertSequenceNumber(d);
|
||
|
function Y(w, E) {
|
||
|
const j = f.endActivation(w);
|
||
|
j.starty + 18 > E && (j.starty = E - 6, E += 12), D.drawActivation(
|
||
|
d,
|
||
|
j,
|
||
|
E,
|
||
|
a,
|
||
|
At(w.from.actor).length
|
||
|
), f.insert(j.startx, E - 10, j.stopx, E);
|
||
|
}
|
||
|
let V = 1, H = 1;
|
||
|
const G = [];
|
||
|
x.forEach(function(w) {
|
||
|
let E, j, P;
|
||
|
switch (w.type) {
|
||
|
case n.db.LINETYPE.NOTE:
|
||
|
f.resetVerticalPos(), j = w.noteModel, A0(d, j);
|
||
|
break;
|
||
|
case n.db.LINETYPE.ACTIVE_START:
|
||
|
f.newActivation(w, d, T);
|
||
|
break;
|
||
|
case n.db.LINETYPE.ACTIVE_END:
|
||
|
Y(w, f.getVerticalPos());
|
||
|
break;
|
||
|
case n.db.LINETYPE.LOOP_START:
|
||
|
tt(
|
||
|
N,
|
||
|
w,
|
||
|
a.boxMargin,
|
||
|
a.boxMargin + a.boxTextMargin,
|
||
|
(v) => f.newLoop(v)
|
||
|
);
|
||
|
break;
|
||
|
case n.db.LINETYPE.LOOP_END:
|
||
|
E = f.endLoop(), D.drawLoop(d, E, "loop", a), f.bumpVerticalPos(E.stopy - f.getVerticalPos()), f.models.addLoop(E);
|
||
|
break;
|
||
|
case n.db.LINETYPE.RECT_START:
|
||
|
tt(
|
||
|
N,
|
||
|
w,
|
||
|
a.boxMargin,
|
||
|
a.boxMargin,
|
||
|
(v) => f.newLoop(void 0, v.message)
|
||
|
);
|
||
|
break;
|
||
|
case n.db.LINETYPE.RECT_END:
|
||
|
E = f.endLoop(), D.drawBackgroundRect(d, E), f.models.addLoop(E), f.bumpVerticalPos(E.stopy - f.getVerticalPos());
|
||
|
break;
|
||
|
case n.db.LINETYPE.OPT_START:
|
||
|
tt(
|
||
|
N,
|
||
|
w,
|
||
|
a.boxMargin,
|
||
|
a.boxMargin + a.boxTextMargin,
|
||
|
(v) => f.newLoop(v)
|
||
|
);
|
||
|
break;
|
||
|
case n.db.LINETYPE.OPT_END:
|
||
|
E = f.endLoop(), D.drawLoop(d, E, "opt", a), f.bumpVerticalPos(E.stopy - f.getVerticalPos()), f.models.addLoop(E);
|
||
|
break;
|
||
|
case n.db.LINETYPE.ALT_START:
|
||
|
tt(
|
||
|
N,
|
||
|
w,
|
||
|
a.boxMargin,
|
||
|
a.boxMargin + a.boxTextMargin,
|
||
|
(v) => f.newLoop(v)
|
||
|
);
|
||
|
break;
|
||
|
case n.db.LINETYPE.ALT_ELSE:
|
||
|
tt(
|
||
|
N,
|
||
|
w,
|
||
|
a.boxMargin + a.boxTextMargin,
|
||
|
a.boxMargin,
|
||
|
(v) => f.addSectionToLoop(v)
|
||
|
);
|
||
|
break;
|
||
|
case n.db.LINETYPE.ALT_END:
|
||
|
E = f.endLoop(), D.drawLoop(d, E, "alt", a), f.bumpVerticalPos(E.stopy - f.getVerticalPos()), f.models.addLoop(E);
|
||
|
break;
|
||
|
case n.db.LINETYPE.PAR_START:
|
||
|
case n.db.LINETYPE.PAR_OVER_START:
|
||
|
tt(
|
||
|
N,
|
||
|
w,
|
||
|
a.boxMargin,
|
||
|
a.boxMargin + a.boxTextMargin,
|
||
|
(v) => f.newLoop(v)
|
||
|
), f.saveVerticalPos();
|
||
|
break;
|
||
|
case n.db.LINETYPE.PAR_AND:
|
||
|
tt(
|
||
|
N,
|
||
|
w,
|
||
|
a.boxMargin + a.boxTextMargin,
|
||
|
a.boxMargin,
|
||
|
(v) => f.addSectionToLoop(v)
|
||
|
);
|
||
|
break;
|
||
|
case n.db.LINETYPE.PAR_END:
|
||
|
E = f.endLoop(), D.drawLoop(d, E, "par", a), f.bumpVerticalPos(E.stopy - f.getVerticalPos()), f.models.addLoop(E);
|
||
|
break;
|
||
|
case n.db.LINETYPE.AUTONUMBER:
|
||
|
V = w.message.start || V, H = w.message.step || H, w.message.visible ? n.db.enableSequenceNumbers() : n.db.disableSequenceNumbers();
|
||
|
break;
|
||
|
case n.db.LINETYPE.CRITICAL_START:
|
||
|
tt(
|
||
|
N,
|
||
|
w,
|
||
|
a.boxMargin,
|
||
|
a.boxMargin + a.boxTextMargin,
|
||
|
(v) => f.newLoop(v)
|
||
|
);
|
||
|
break;
|
||
|
case n.db.LINETYPE.CRITICAL_OPTION:
|
||
|
tt(
|
||
|
N,
|
||
|
w,
|
||
|
a.boxMargin + a.boxTextMargin,
|
||
|
a.boxMargin,
|
||
|
(v) => f.addSectionToLoop(v)
|
||
|
);
|
||
|
break;
|
||
|
case n.db.LINETYPE.CRITICAL_END:
|
||
|
E = f.endLoop(), D.drawLoop(d, E, "critical", a), f.bumpVerticalPos(E.stopy - f.getVerticalPos()), f.models.addLoop(E);
|
||
|
break;
|
||
|
case n.db.LINETYPE.BREAK_START:
|
||
|
tt(
|
||
|
N,
|
||
|
w,
|
||
|
a.boxMargin,
|
||
|
a.boxMargin + a.boxTextMargin,
|
||
|
(v) => f.newLoop(v)
|
||
|
);
|
||
|
break;
|
||
|
case n.db.LINETYPE.BREAK_END:
|
||
|
E = f.endLoop(), D.drawLoop(d, E, "break", a), f.bumpVerticalPos(E.stopy - f.getVerticalPos()), f.models.addLoop(E);
|
||
|
break;
|
||
|
default:
|
||
|
try {
|
||
|
f.resetVerticalPos(), P = w.msgModel, P.starty = f.getVerticalPos(), P.sequenceIndex = V, P.sequenceVisible = n.db.showSequenceNumbers();
|
||
|
const v = S0(d, P);
|
||
|
G.push({ messageModel: P, lineStartY: v }), f.models.addMessage(P);
|
||
|
} catch (v) {
|
||
|
K.error("error while drawing message", v);
|
||
|
}
|
||
|
}
|
||
|
[
|
||
|
n.db.LINETYPE.SOLID_OPEN,
|
||
|
n.db.LINETYPE.DOTTED_OPEN,
|
||
|
n.db.LINETYPE.SOLID,
|
||
|
n.db.LINETYPE.DOTTED,
|
||
|
n.db.LINETYPE.SOLID_CROSS,
|
||
|
n.db.LINETYPE.DOTTED_CROSS,
|
||
|
n.db.LINETYPE.SOLID_POINT,
|
||
|
n.db.LINETYPE.DOTTED_POINT
|
||
|
].includes(w.type) && (V = V + H);
|
||
|
}), G.forEach((w) => M0(d, w.messageModel, w.lineStartY, n)), a.mirrorActors && (f.bumpVerticalPos(a.boxMargin * 2), qt(d, T, p, f.getVerticalPos(), a, x, !0), f.bumpVerticalPos(a.boxMargin), de(d, f.getVerticalPos())), f.models.boxes.forEach(function(w) {
|
||
|
w.height = f.getVerticalPos() - w.y, f.insert(w.x, w.y, w.x + w.width, w.height), w.startx = w.x, w.starty = w.y, w.stopx = w.startx + w.width, w.stopy = w.starty + w.height, w.stroke = "rgb(0,0,0, 0.5)", D.drawBox(d, w, a);
|
||
|
}), I && f.bumpVerticalPos(a.boxMargin);
|
||
|
const W = fe(d, T, p, u), { bounds: O } = f.getBounds();
|
||
|
K.debug("For line height fix Querying: #" + e + " .actor-line"), Ce("#" + e + " .actor-line").attr("y2", O.stopy);
|
||
|
let F = O.stopy - O.starty;
|
||
|
F < W.maxHeight && (F = W.maxHeight);
|
||
|
let q = F + 2 * a.diagramMarginY;
|
||
|
a.mirrorActors && (q = q - a.boxMargin + a.bottomMarginAdj);
|
||
|
let U = O.stopx - O.startx;
|
||
|
U < W.maxWidth && (U = W.maxWidth);
|
||
|
const J = U + 2 * a.diagramMarginX;
|
||
|
m && d.append("text").text(m).attr("x", (O.stopx - O.startx) / 2 - 2 * a.diagramMarginX).attr("y", -25), Se(d, q, J, a.useMaxWidth);
|
||
|
const Z = m ? 40 : 0;
|
||
|
d.attr(
|
||
|
"viewBox",
|
||
|
O.startx - a.diagramMarginX + " -" + (a.diagramMarginY + Z) + " " + J + " " + (q + Z)
|
||
|
), K.debug("models:", f.models);
|
||
|
};
|
||
|
function D0(t, e, r) {
|
||
|
const n = {};
|
||
|
return e.forEach(function(i) {
|
||
|
if (t[i.to] && t[i.from]) {
|
||
|
const s = t[i.to];
|
||
|
if (i.placement === r.db.PLACEMENT.LEFTOF && !s.prevActor || i.placement === r.db.PLACEMENT.RIGHTOF && !s.nextActor)
|
||
|
return;
|
||
|
const c = i.placement !== void 0, l = !c, u = c ? gt(a) : pt(a), d = i.wrap ? C.wrapLabel(i.message, a.width - 2 * a.wrapPadding, u) : i.message, y = C.calculateTextDimensions(d, u).width + 2 * a.wrapPadding;
|
||
|
l && i.from === s.nextActor ? n[i.to] = _.getMax(
|
||
|
n[i.to] || 0,
|
||
|
y
|
||
|
) : l && i.from === s.prevActor ? n[i.from] = _.getMax(
|
||
|
n[i.from] || 0,
|
||
|
y
|
||
|
) : l && i.from === i.to ? (n[i.from] = _.getMax(
|
||
|
n[i.from] || 0,
|
||
|
y / 2
|
||
|
), n[i.to] = _.getMax(
|
||
|
n[i.to] || 0,
|
||
|
y / 2
|
||
|
)) : i.placement === r.db.PLACEMENT.RIGHTOF ? n[i.from] = _.getMax(
|
||
|
n[i.from] || 0,
|
||
|
y
|
||
|
) : i.placement === r.db.PLACEMENT.LEFTOF ? n[s.prevActor] = _.getMax(
|
||
|
n[s.prevActor] || 0,
|
||
|
y
|
||
|
) : i.placement === r.db.PLACEMENT.OVER && (s.prevActor && (n[s.prevActor] = _.getMax(
|
||
|
n[s.prevActor] || 0,
|
||
|
y / 2
|
||
|
)), s.nextActor && (n[i.from] = _.getMax(
|
||
|
n[i.from] || 0,
|
||
|
y / 2
|
||
|
)));
|
||
|
}
|
||
|
}), K.debug("maxMessageWidthPerActor:", n), n;
|
||
|
}
|
||
|
const V0 = function(t) {
|
||
|
let e = 0;
|
||
|
const r = Wt(a);
|
||
|
for (const n in t.links) {
|
||
|
const s = C.calculateTextDimensions(n, r).width + 2 * a.wrapPadding + 2 * a.boxMargin;
|
||
|
e < s && (e = s);
|
||
|
}
|
||
|
return e;
|
||
|
};
|
||
|
function C0(t, e, r) {
|
||
|
let n = 0;
|
||
|
Object.keys(t).forEach((s) => {
|
||
|
const c = t[s];
|
||
|
c.wrap && (c.description = C.wrapLabel(
|
||
|
c.description,
|
||
|
a.width - 2 * a.wrapPadding,
|
||
|
Wt(a)
|
||
|
));
|
||
|
const l = C.calculateTextDimensions(c.description, Wt(a));
|
||
|
c.width = c.wrap ? a.width : _.getMax(a.width, l.width + 2 * a.wrapPadding), c.height = c.wrap ? _.getMax(l.height, a.height) : a.height, n = _.getMax(n, c.height);
|
||
|
});
|
||
|
for (const s in e) {
|
||
|
const c = t[s];
|
||
|
if (!c)
|
||
|
continue;
|
||
|
const l = t[c.nextActor];
|
||
|
if (!l) {
|
||
|
const y = e[s] + a.actorMargin - c.width / 2;
|
||
|
c.margin = _.getMax(y, a.actorMargin);
|
||
|
continue;
|
||
|
}
|
||
|
const d = e[s] + a.actorMargin - c.width / 2 - l.width / 2;
|
||
|
c.margin = _.getMax(d, a.actorMargin);
|
||
|
}
|
||
|
let i = 0;
|
||
|
return r.forEach((s) => {
|
||
|
const c = pt(a);
|
||
|
let l = s.actorKeys.reduce((T, y) => T += t[y].width + (t[y].margin || 0), 0);
|
||
|
l -= 2 * a.boxTextMargin, s.wrap && (s.name = C.wrapLabel(s.name, l - 2 * a.wrapPadding, c));
|
||
|
const u = C.calculateTextDimensions(s.name, c);
|
||
|
i = _.getMax(u.height, i);
|
||
|
const d = _.getMax(l, u.width + 2 * a.wrapPadding);
|
||
|
if (s.margin = a.boxTextMargin, l < d) {
|
||
|
const T = (d - l) / 2;
|
||
|
s.margin += T;
|
||
|
}
|
||
|
}), r.forEach((s) => s.textMaxHeight = i), _.getMax(n, a.height);
|
||
|
}
|
||
|
const O0 = function(t, e, r) {
|
||
|
const n = e[t.from].x, i = e[t.to].x, s = t.wrap && t.message;
|
||
|
let c = C.calculateTextDimensions(
|
||
|
s ? C.wrapLabel(t.message, a.width, gt(a)) : t.message,
|
||
|
gt(a)
|
||
|
);
|
||
|
const l = {
|
||
|
width: s ? a.width : _.getMax(a.width, c.width + 2 * a.noteMargin),
|
||
|
height: 0,
|
||
|
startx: e[t.from].x,
|
||
|
stopx: 0,
|
||
|
starty: 0,
|
||
|
stopy: 0,
|
||
|
message: t.message
|
||
|
};
|
||
|
return t.placement === r.db.PLACEMENT.RIGHTOF ? (l.width = s ? _.getMax(a.width, c.width) : _.getMax(
|
||
|
e[t.from].width / 2 + e[t.to].width / 2,
|
||
|
c.width + 2 * a.noteMargin
|
||
|
), l.startx = n + (e[t.from].width + a.actorMargin) / 2) : t.placement === r.db.PLACEMENT.LEFTOF ? (l.width = s ? _.getMax(a.width, c.width + 2 * a.noteMargin) : _.getMax(
|
||
|
e[t.from].width / 2 + e[t.to].width / 2,
|
||
|
c.width + 2 * a.noteMargin
|
||
|
), l.startx = n - l.width + (e[t.from].width - a.actorMargin) / 2) : t.to === t.from ? (c = C.calculateTextDimensions(
|
||
|
s ? C.wrapLabel(
|
||
|
t.message,
|
||
|
_.getMax(a.width, e[t.from].width),
|
||
|
gt(a)
|
||
|
) : t.message,
|
||
|
gt(a)
|
||
|
), l.width = s ? _.getMax(a.width, e[t.from].width) : _.getMax(
|
||
|
e[t.from].width,
|
||
|
a.width,
|
||
|
c.width + 2 * a.noteMargin
|
||
|
), l.startx = n + (e[t.from].width - l.width) / 2) : (l.width = Math.abs(n + e[t.from].width / 2 - (i + e[t.to].width / 2)) + a.actorMargin, l.startx = n < i ? n + e[t.from].width / 2 - a.actorMargin / 2 : i + e[t.to].width / 2 - a.actorMargin / 2), s && (l.message = C.wrapLabel(
|
||
|
t.message,
|
||
|
l.width - 2 * a.wrapPadding,
|
||
|
gt(a)
|
||
|
)), K.debug(
|
||
|
`NM:[${l.startx},${l.stopx},${l.starty},${l.stopy}:${l.width},${l.height}=${t.message}]`
|
||
|
), l;
|
||
|
}, B0 = function(t, e, r) {
|
||
|
let n = !1;
|
||
|
if ([
|
||
|
r.db.LINETYPE.SOLID_OPEN,
|
||
|
r.db.LINETYPE.DOTTED_OPEN,
|
||
|
r.db.LINETYPE.SOLID,
|
||
|
r.db.LINETYPE.DOTTED,
|
||
|
r.db.LINETYPE.SOLID_CROSS,
|
||
|
r.db.LINETYPE.DOTTED_CROSS,
|
||
|
r.db.LINETYPE.SOLID_POINT,
|
||
|
r.db.LINETYPE.DOTTED_POINT
|
||
|
].includes(t.type) && (n = !0), !n)
|
||
|
return {};
|
||
|
const i = $t(t.from, e), s = $t(t.to, e), c = i[0] <= s[0] ? 1 : 0, l = i[0] < s[0] ? 0 : 1, u = [...i, ...s], d = Math.abs(s[l] - i[c]);
|
||
|
t.wrap && t.message && (t.message = C.wrapLabel(
|
||
|
t.message,
|
||
|
_.getMax(d + 2 * a.wrapPadding, a.width),
|
||
|
pt(a)
|
||
|
));
|
||
|
const T = C.calculateTextDimensions(t.message, pt(a));
|
||
|
return {
|
||
|
width: _.getMax(
|
||
|
t.wrap ? 0 : T.width + 2 * a.wrapPadding,
|
||
|
d + 2 * a.wrapPadding,
|
||
|
a.width
|
||
|
),
|
||
|
height: 0,
|
||
|
startx: i[c],
|
||
|
stopx: s[l],
|
||
|
starty: 0,
|
||
|
stopy: 0,
|
||
|
message: t.message,
|
||
|
type: t.type,
|
||
|
wrap: t.wrap,
|
||
|
fromBounds: Math.min.apply(null, u),
|
||
|
toBounds: Math.max.apply(null, u)
|
||
|
};
|
||
|
}, Y0 = function(t, e, r, n) {
|
||
|
const i = {}, s = [];
|
||
|
let c, l, u;
|
||
|
return t.forEach(function(d) {
|
||
|
switch (d.id = C.random({ length: 10 }), d.type) {
|
||
|
case n.db.LINETYPE.LOOP_START:
|
||
|
case n.db.LINETYPE.ALT_START:
|
||
|
case n.db.LINETYPE.OPT_START:
|
||
|
case n.db.LINETYPE.PAR_START:
|
||
|
case n.db.LINETYPE.PAR_OVER_START:
|
||
|
case n.db.LINETYPE.CRITICAL_START:
|
||
|
case n.db.LINETYPE.BREAK_START:
|
||
|
s.push({
|
||
|
id: d.id,
|
||
|
msg: d.message,
|
||
|
from: Number.MAX_SAFE_INTEGER,
|
||
|
to: Number.MIN_SAFE_INTEGER,
|
||
|
width: 0
|
||
|
});
|
||
|
break;
|
||
|
case n.db.LINETYPE.ALT_ELSE:
|
||
|
case n.db.LINETYPE.PAR_AND:
|
||
|
case n.db.LINETYPE.CRITICAL_OPTION:
|
||
|
d.message && (c = s.pop(), i[c.id] = c, i[d.id] = c, s.push(c));
|
||
|
break;
|
||
|
case n.db.LINETYPE.LOOP_END:
|
||
|
case n.db.LINETYPE.ALT_END:
|
||
|
case n.db.LINETYPE.OPT_END:
|
||
|
case n.db.LINETYPE.PAR_END:
|
||
|
case n.db.LINETYPE.CRITICAL_END:
|
||
|
case n.db.LINETYPE.BREAK_END:
|
||
|
c = s.pop(), i[c.id] = c;
|
||
|
break;
|
||
|
case n.db.LINETYPE.ACTIVE_START:
|
||
|
{
|
||
|
const y = e[d.from ? d.from.actor : d.to.actor], p = At(d.from ? d.from.actor : d.to.actor).length, x = y.x + y.width / 2 + (p - 1) * a.activationWidth / 2, m = {
|
||
|
startx: x,
|
||
|
stopx: x + a.activationWidth,
|
||
|
actor: d.from.actor,
|
||
|
enabled: !0
|
||
|
};
|
||
|
f.activations.push(m);
|
||
|
}
|
||
|
break;
|
||
|
case n.db.LINETYPE.ACTIVE_END:
|
||
|
{
|
||
|
const y = f.activations.map((p) => p.actor).lastIndexOf(d.from.actor);
|
||
|
delete f.activations.splice(y, 1)[0];
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
d.placement !== void 0 ? (l = O0(d, e, n), d.noteModel = l, s.forEach((y) => {
|
||
|
c = y, c.from = _.getMin(c.from, l.startx), c.to = _.getMax(c.to, l.startx + l.width), c.width = _.getMax(c.width, Math.abs(c.from - c.to)) - a.labelBoxWidth;
|
||
|
})) : (u = B0(d, e, n), d.msgModel = u, u.startx && u.stopx && s.length > 0 && s.forEach((y) => {
|
||
|
if (c = y, u.startx === u.stopx) {
|
||
|
const p = e[d.from], x = e[d.to];
|
||
|
c.from = _.getMin(
|
||
|
p.x - u.width / 2,
|
||
|
p.x - p.width / 2,
|
||
|
c.from
|
||
|
), c.to = _.getMax(
|
||
|
x.x + u.width / 2,
|
||
|
x.x + p.width / 2,
|
||
|
c.to
|
||
|
), c.width = _.getMax(c.width, Math.abs(c.to - c.from)) - a.labelBoxWidth;
|
||
|
} else
|
||
|
c.from = _.getMin(u.startx, c.from), c.to = _.getMax(u.stopx, c.to), c.width = _.getMax(c.width, u.width) - a.labelBoxWidth;
|
||
|
}));
|
||
|
}), f.activations = [], K.debug("Loop type widths:", i), i;
|
||
|
}, F0 = {
|
||
|
bounds: f,
|
||
|
drawActors: qt,
|
||
|
drawActorsPopup: fe,
|
||
|
setConf: ge,
|
||
|
draw: R0
|
||
|
}, H0 = {
|
||
|
parser: Oe,
|
||
|
db: r0,
|
||
|
renderer: F0,
|
||
|
styles: c0
|
||
|
};
|
||
|
export {
|
||
|
H0 as diagram
|
||
|
};
|