markdown-flow-ui
Version:
A React UI library for rendering markdown with interactive flow components, typewriter effects, and plugin support
985 lines • 117 kB
JavaScript
import { a as xe, b as Yt, g as At, d as Te, c as Ee, e as ye } from "./chunk-OMD6QJNC-DNXdLSou.mjs";
import { I as be } from "./chunk-FHKO5MBM-kwlUmBRi.mjs";
import { _ as u, n as me, c as $, d as Lt, l as G, j as Qt, e as we, f as ve, k as v, b as Gt, s as Ie, p as Le, a as _e, g as Pe, q as Ae, y as ke, i as _t, u as Y, L as ot, M as bt, N as Zt, Z as Ne, O as Se, P as jt, E as Ct } from "./index-pooOtYuy.mjs";
var Ot = (function() {
var e = /* @__PURE__ */ u(function(ht, w, I, P) {
for (I = I || {}, P = ht.length; P--; I[ht[P]] = w) ;
return I;
}, "o"), t = [1, 2], c = [1, 3], s = [1, 4], a = [2, 4], i = [1, 9], n = [1, 11], h = [1, 13], d = [1, 14], r = [1, 16], f = [1, 17], y = [1, 18], g = [1, 24], T = [1, 25], m = [1, 26], L = [1, 27], A = [1, 28], C = [1, 29], S = [1, 30], B = [1, 31], D = [1, 32], F = [1, 33], q = [1, 34], X = [1, 35], tt = [1, 36], z = [1, 37], H = [1, 38], W = [1, 39], M = [1, 41], J = [1, 42], U = [1, 43], Q = [1, 44], et = [1, 45], N = [1, 46], E = [1, 4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 48, 49, 50, 52, 53, 54, 59, 60, 61, 62, 70], _ = [4, 5, 16, 50, 52, 53], Z = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 54, 59, 60, 61, 62, 70], at = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 49, 50, 52, 53, 54, 59, 60, 61, 62, 70], k = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 48, 50, 52, 53, 54, 59, 60, 61, 62, 70], qt = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 50, 52, 53, 54, 59, 60, 61, 62, 70], it = [68, 69, 70], ct = [1, 122], Nt = {
trace: /* @__PURE__ */ u(function() {
}, "trace"),
yy: {},
symbols_: { error: 2, start: 3, SPACE: 4, NEWLINE: 5, SD: 6, document: 7, line: 8, statement: 9, box_section: 10, box_line: 11, participant_statement: 12, create: 13, box: 14, restOfLine: 15, end: 16, signal: 17, autonumber: 18, NUM: 19, off: 20, activate: 21, actor: 22, deactivate: 23, note_statement: 24, links_statement: 25, link_statement: 26, properties_statement: 27, details_statement: 28, title: 29, legacy_title: 30, acc_title: 31, acc_title_value: 32, acc_descr: 33, acc_descr_value: 34, acc_descr_multiline_value: 35, loop: 36, rect: 37, opt: 38, alt: 39, else_sections: 40, par: 41, par_sections: 42, par_over: 43, critical: 44, option_sections: 45, break: 46, option: 47, and: 48, else: 49, participant: 50, AS: 51, participant_actor: 52, destroy: 53, note: 54, placement: 55, text2: 56, over: 57, actor_pair: 58, links: 59, link: 60, properties: 61, details: 62, spaceList: 63, ",": 64, left_of: 65, right_of: 66, signaltype: 67, "+": 68, "-": 69, ACTOR: 70, SOLID_OPEN_ARROW: 71, DOTTED_OPEN_ARROW: 72, SOLID_ARROW: 73, BIDIRECTIONAL_SOLID_ARROW: 74, DOTTED_ARROW: 75, BIDIRECTIONAL_DOTTED_ARROW: 76, SOLID_CROSS: 77, DOTTED_CROSS: 78, SOLID_POINT: 79, DOTTED_POINT: 80, TXT: 81, $accept: 0, $end: 1 },
terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 13: "create", 14: "box", 15: "restOfLine", 16: "end", 18: "autonumber", 19: "NUM", 20: "off", 21: "activate", 23: "deactivate", 29: "title", 30: "legacy_title", 31: "acc_title", 32: "acc_title_value", 33: "acc_descr", 34: "acc_descr_value", 35: "acc_descr_multiline_value", 36: "loop", 37: "rect", 38: "opt", 39: "alt", 41: "par", 43: "par_over", 44: "critical", 46: "break", 47: "option", 48: "and", 49: "else", 50: "participant", 51: "AS", 52: "participant_actor", 53: "destroy", 54: "note", 57: "over", 59: "links", 60: "link", 61: "properties", 62: "details", 64: ",", 65: "left_of", 66: "right_of", 68: "+", 69: "-", 70: "ACTOR", 71: "SOLID_OPEN_ARROW", 72: "DOTTED_OPEN_ARROW", 73: "SOLID_ARROW", 74: "BIDIRECTIONAL_SOLID_ARROW", 75: "DOTTED_ARROW", 76: "BIDIRECTIONAL_DOTTED_ARROW", 77: "SOLID_CROSS", 78: "DOTTED_CROSS", 79: "SOLID_POINT", 80: "DOTTED_POINT", 81: "TXT" },
productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [10, 0], [10, 2], [11, 2], [11, 1], [11, 1], [9, 1], [9, 2], [9, 4], [9, 2], [9, 4], [9, 3], [9, 3], [9, 2], [9, 3], [9, 3], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [45, 1], [45, 4], [42, 1], [42, 4], [40, 1], [40, 4], [12, 5], [12, 3], [12, 5], [12, 3], [12, 3], [24, 4], [24, 4], [25, 3], [26, 3], [27, 3], [28, 3], [63, 2], [63, 1], [58, 3], [58, 1], [55, 1], [55, 1], [17, 5], [17, 5], [17, 4], [22, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [56, 1]],
performAction: /* @__PURE__ */ u(function(w, I, P, b, R, l, yt) {
var p = l.length - 1;
switch (R) {
case 3:
return b.apply(l[p]), l[p];
case 4:
case 9:
this.$ = [];
break;
case 5:
case 10:
l[p - 1].push(l[p]), this.$ = l[p - 1];
break;
case 6:
case 7:
case 11:
case 12:
this.$ = l[p];
break;
case 8:
case 13:
this.$ = [];
break;
case 15:
l[p].type = "createParticipant", this.$ = l[p];
break;
case 16:
l[p - 1].unshift({ type: "boxStart", boxData: b.parseBoxData(l[p - 2]) }), l[p - 1].push({ type: "boxEnd", boxText: l[p - 2] }), this.$ = l[p - 1];
break;
case 18:
this.$ = { type: "sequenceIndex", sequenceIndex: Number(l[p - 2]), sequenceIndexStep: Number(l[p - 1]), sequenceVisible: !0, signalType: b.LINETYPE.AUTONUMBER };
break;
case 19:
this.$ = { type: "sequenceIndex", sequenceIndex: Number(l[p - 1]), sequenceIndexStep: 1, sequenceVisible: !0, signalType: b.LINETYPE.AUTONUMBER };
break;
case 20:
this.$ = { type: "sequenceIndex", sequenceVisible: !1, signalType: b.LINETYPE.AUTONUMBER };
break;
case 21:
this.$ = { type: "sequenceIndex", sequenceVisible: !0, signalType: b.LINETYPE.AUTONUMBER };
break;
case 22:
this.$ = { type: "activeStart", signalType: b.LINETYPE.ACTIVE_START, actor: l[p - 1].actor };
break;
case 23:
this.$ = { type: "activeEnd", signalType: b.LINETYPE.ACTIVE_END, actor: l[p - 1].actor };
break;
case 29:
b.setDiagramTitle(l[p].substring(6)), this.$ = l[p].substring(6);
break;
case 30:
b.setDiagramTitle(l[p].substring(7)), this.$ = l[p].substring(7);
break;
case 31:
this.$ = l[p].trim(), b.setAccTitle(this.$);
break;
case 32:
case 33:
this.$ = l[p].trim(), b.setAccDescription(this.$);
break;
case 34:
l[p - 1].unshift({ type: "loopStart", loopText: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.LOOP_START }), l[p - 1].push({ type: "loopEnd", loopText: l[p - 2], signalType: b.LINETYPE.LOOP_END }), this.$ = l[p - 1];
break;
case 35:
l[p - 1].unshift({ type: "rectStart", color: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.RECT_START }), l[p - 1].push({ type: "rectEnd", color: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.RECT_END }), this.$ = l[p - 1];
break;
case 36:
l[p - 1].unshift({ type: "optStart", optText: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.OPT_START }), l[p - 1].push({ type: "optEnd", optText: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.OPT_END }), this.$ = l[p - 1];
break;
case 37:
l[p - 1].unshift({ type: "altStart", altText: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.ALT_START }), l[p - 1].push({ type: "altEnd", signalType: b.LINETYPE.ALT_END }), this.$ = l[p - 1];
break;
case 38:
l[p - 1].unshift({ type: "parStart", parText: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.PAR_START }), l[p - 1].push({ type: "parEnd", signalType: b.LINETYPE.PAR_END }), this.$ = l[p - 1];
break;
case 39:
l[p - 1].unshift({ type: "parStart", parText: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.PAR_OVER_START }), l[p - 1].push({ type: "parEnd", signalType: b.LINETYPE.PAR_END }), this.$ = l[p - 1];
break;
case 40:
l[p - 1].unshift({ type: "criticalStart", criticalText: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.CRITICAL_START }), l[p - 1].push({ type: "criticalEnd", signalType: b.LINETYPE.CRITICAL_END }), this.$ = l[p - 1];
break;
case 41:
l[p - 1].unshift({ type: "breakStart", breakText: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.BREAK_START }), l[p - 1].push({ type: "breakEnd", optText: b.parseMessage(l[p - 2]), signalType: b.LINETYPE.BREAK_END }), this.$ = l[p - 1];
break;
case 43:
this.$ = l[p - 3].concat([{ type: "option", optionText: b.parseMessage(l[p - 1]), signalType: b.LINETYPE.CRITICAL_OPTION }, l[p]]);
break;
case 45:
this.$ = l[p - 3].concat([{ type: "and", parText: b.parseMessage(l[p - 1]), signalType: b.LINETYPE.PAR_AND }, l[p]]);
break;
case 47:
this.$ = l[p - 3].concat([{ type: "else", altText: b.parseMessage(l[p - 1]), signalType: b.LINETYPE.ALT_ELSE }, l[p]]);
break;
case 48:
l[p - 3].draw = "participant", l[p - 3].type = "addParticipant", l[p - 3].description = b.parseMessage(l[p - 1]), this.$ = l[p - 3];
break;
case 49:
l[p - 1].draw = "participant", l[p - 1].type = "addParticipant", this.$ = l[p - 1];
break;
case 50:
l[p - 3].draw = "actor", l[p - 3].type = "addParticipant", l[p - 3].description = b.parseMessage(l[p - 1]), this.$ = l[p - 3];
break;
case 51:
l[p - 1].draw = "actor", l[p - 1].type = "addParticipant", this.$ = l[p - 1];
break;
case 52:
l[p - 1].type = "destroyParticipant", this.$ = l[p - 1];
break;
case 53:
this.$ = [l[p - 1], { type: "addNote", placement: l[p - 2], actor: l[p - 1].actor, text: l[p] }];
break;
case 54:
l[p - 2] = [].concat(l[p - 1], l[p - 1]).slice(0, 2), l[p - 2][0] = l[p - 2][0].actor, l[p - 2][1] = l[p - 2][1].actor, this.$ = [l[p - 1], { type: "addNote", placement: b.PLACEMENT.OVER, actor: l[p - 2].slice(0, 2), text: l[p] }];
break;
case 55:
this.$ = [l[p - 1], { type: "addLinks", actor: l[p - 1].actor, text: l[p] }];
break;
case 56:
this.$ = [l[p - 1], { type: "addALink", actor: l[p - 1].actor, text: l[p] }];
break;
case 57:
this.$ = [l[p - 1], { type: "addProperties", actor: l[p - 1].actor, text: l[p] }];
break;
case 58:
this.$ = [l[p - 1], { type: "addDetails", actor: l[p - 1].actor, text: l[p] }];
break;
case 61:
this.$ = [l[p - 2], l[p]];
break;
case 62:
this.$ = l[p];
break;
case 63:
this.$ = b.PLACEMENT.LEFTOF;
break;
case 64:
this.$ = b.PLACEMENT.RIGHTOF;
break;
case 65:
this.$ = [
l[p - 4],
l[p - 1],
{ type: "addMessage", from: l[p - 4].actor, to: l[p - 1].actor, signalType: l[p - 3], msg: l[p], activate: !0 },
{ type: "activeStart", signalType: b.LINETYPE.ACTIVE_START, actor: l[p - 1].actor }
];
break;
case 66:
this.$ = [
l[p - 4],
l[p - 1],
{ type: "addMessage", from: l[p - 4].actor, to: l[p - 1].actor, signalType: l[p - 3], msg: l[p] },
{ type: "activeEnd", signalType: b.LINETYPE.ACTIVE_END, actor: l[p - 4].actor }
];
break;
case 67:
this.$ = [l[p - 3], l[p - 1], { type: "addMessage", from: l[p - 3].actor, to: l[p - 1].actor, signalType: l[p - 2], msg: l[p] }];
break;
case 68:
this.$ = { type: "addParticipant", actor: l[p] };
break;
case 69:
this.$ = b.LINETYPE.SOLID_OPEN;
break;
case 70:
this.$ = b.LINETYPE.DOTTED_OPEN;
break;
case 71:
this.$ = b.LINETYPE.SOLID;
break;
case 72:
this.$ = b.LINETYPE.BIDIRECTIONAL_SOLID;
break;
case 73:
this.$ = b.LINETYPE.DOTTED;
break;
case 74:
this.$ = b.LINETYPE.BIDIRECTIONAL_DOTTED;
break;
case 75:
this.$ = b.LINETYPE.SOLID_CROSS;
break;
case 76:
this.$ = b.LINETYPE.DOTTED_CROSS;
break;
case 77:
this.$ = b.LINETYPE.SOLID_POINT;
break;
case 78:
this.$ = b.LINETYPE.DOTTED_POINT;
break;
case 79:
this.$ = b.parseMessage(l[p].trim().substring(1));
break;
}
}, "anonymous"),
table: [{ 3: 1, 4: t, 5: c, 6: s }, { 1: [3] }, { 3: 5, 4: t, 5: c, 6: s }, { 3: 6, 4: t, 5: c, 6: s }, e([1, 4, 5, 13, 14, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 54, 59, 60, 61, 62, 70], a, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: i, 5: n, 8: 8, 9: 10, 12: 12, 13: h, 14: d, 17: 15, 18: r, 21: f, 22: 40, 23: y, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: g, 30: T, 31: m, 33: L, 35: A, 36: C, 37: S, 38: B, 39: D, 41: F, 43: q, 44: X, 46: tt, 50: z, 52: H, 53: W, 54: M, 59: J, 60: U, 61: Q, 62: et, 70: N }, e(E, [2, 5]), { 9: 47, 12: 12, 13: h, 14: d, 17: 15, 18: r, 21: f, 22: 40, 23: y, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: g, 30: T, 31: m, 33: L, 35: A, 36: C, 37: S, 38: B, 39: D, 41: F, 43: q, 44: X, 46: tt, 50: z, 52: H, 53: W, 54: M, 59: J, 60: U, 61: Q, 62: et, 70: N }, e(E, [2, 7]), e(E, [2, 8]), e(E, [2, 14]), { 12: 48, 50: z, 52: H, 53: W }, { 15: [1, 49] }, { 5: [1, 50] }, { 5: [1, 53], 19: [1, 51], 20: [1, 52] }, { 22: 54, 70: N }, { 22: 55, 70: N }, { 5: [1, 56] }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, e(E, [2, 29]), e(E, [2, 30]), { 32: [1, 61] }, { 34: [1, 62] }, e(E, [2, 33]), { 15: [1, 63] }, { 15: [1, 64] }, { 15: [1, 65] }, { 15: [1, 66] }, { 15: [1, 67] }, { 15: [1, 68] }, { 15: [1, 69] }, { 15: [1, 70] }, { 22: 71, 70: N }, { 22: 72, 70: N }, { 22: 73, 70: N }, { 67: 74, 71: [1, 75], 72: [1, 76], 73: [1, 77], 74: [1, 78], 75: [1, 79], 76: [1, 80], 77: [1, 81], 78: [1, 82], 79: [1, 83], 80: [1, 84] }, { 55: 85, 57: [1, 86], 65: [1, 87], 66: [1, 88] }, { 22: 89, 70: N }, { 22: 90, 70: N }, { 22: 91, 70: N }, { 22: 92, 70: N }, e([5, 51, 64, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81], [2, 68]), e(E, [2, 6]), e(E, [2, 15]), e(_, [2, 9], { 10: 93 }), e(E, [2, 17]), { 5: [1, 95], 19: [1, 94] }, { 5: [1, 96] }, e(E, [2, 21]), { 5: [1, 97] }, { 5: [1, 98] }, e(E, [2, 24]), e(E, [2, 25]), e(E, [2, 26]), e(E, [2, 27]), e(E, [2, 28]), e(E, [2, 31]), e(E, [2, 32]), e(Z, a, { 7: 99 }), e(Z, a, { 7: 100 }), e(Z, a, { 7: 101 }), e(at, a, { 40: 102, 7: 103 }), e(k, a, { 42: 104, 7: 105 }), e(k, a, { 7: 105, 42: 106 }), e(qt, a, { 45: 107, 7: 108 }), e(Z, a, { 7: 109 }), { 5: [1, 111], 51: [1, 110] }, { 5: [1, 113], 51: [1, 112] }, { 5: [1, 114] }, { 22: 117, 68: [1, 115], 69: [1, 116], 70: N }, e(it, [2, 69]), e(it, [2, 70]), e(it, [2, 71]), e(it, [2, 72]), e(it, [2, 73]), e(it, [2, 74]), e(it, [2, 75]), e(it, [2, 76]), e(it, [2, 77]), e(it, [2, 78]), { 22: 118, 70: N }, { 22: 120, 58: 119, 70: N }, { 70: [2, 63] }, { 70: [2, 64] }, { 56: 121, 81: ct }, { 56: 123, 81: ct }, { 56: 124, 81: ct }, { 56: 125, 81: ct }, { 4: [1, 128], 5: [1, 130], 11: 127, 12: 129, 16: [1, 126], 50: z, 52: H, 53: W }, { 5: [1, 131] }, e(E, [2, 19]), e(E, [2, 20]), e(E, [2, 22]), e(E, [2, 23]), { 4: i, 5: n, 8: 8, 9: 10, 12: 12, 13: h, 14: d, 16: [1, 132], 17: 15, 18: r, 21: f, 22: 40, 23: y, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: g, 30: T, 31: m, 33: L, 35: A, 36: C, 37: S, 38: B, 39: D, 41: F, 43: q, 44: X, 46: tt, 50: z, 52: H, 53: W, 54: M, 59: J, 60: U, 61: Q, 62: et, 70: N }, { 4: i, 5: n, 8: 8, 9: 10, 12: 12, 13: h, 14: d, 16: [1, 133], 17: 15, 18: r, 21: f, 22: 40, 23: y, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: g, 30: T, 31: m, 33: L, 35: A, 36: C, 37: S, 38: B, 39: D, 41: F, 43: q, 44: X, 46: tt, 50: z, 52: H, 53: W, 54: M, 59: J, 60: U, 61: Q, 62: et, 70: N }, { 4: i, 5: n, 8: 8, 9: 10, 12: 12, 13: h, 14: d, 16: [1, 134], 17: 15, 18: r, 21: f, 22: 40, 23: y, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: g, 30: T, 31: m, 33: L, 35: A, 36: C, 37: S, 38: B, 39: D, 41: F, 43: q, 44: X, 46: tt, 50: z, 52: H, 53: W, 54: M, 59: J, 60: U, 61: Q, 62: et, 70: N }, { 16: [1, 135] }, { 4: i, 5: n, 8: 8, 9: 10, 12: 12, 13: h, 14: d, 16: [2, 46], 17: 15, 18: r, 21: f, 22: 40, 23: y, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: g, 30: T, 31: m, 33: L, 35: A, 36: C, 37: S, 38: B, 39: D, 41: F, 43: q, 44: X, 46: tt, 49: [1, 136], 50: z, 52: H, 53: W, 54: M, 59: J, 60: U, 61: Q, 62: et, 70: N }, { 16: [1, 137] }, { 4: i, 5: n, 8: 8, 9: 10, 12: 12, 13: h, 14: d, 16: [2, 44], 17: 15, 18: r, 21: f, 22: 40, 23: y, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: g, 30: T, 31: m, 33: L, 35: A, 36: C, 37: S, 38: B, 39: D, 41: F, 43: q, 44: X, 46: tt, 48: [1, 138], 50: z, 52: H, 53: W, 54: M, 59: J, 60: U, 61: Q, 62: et, 70: N }, { 16: [1, 139] }, { 16: [1, 140] }, { 4: i, 5: n, 8: 8, 9: 10, 12: 12, 13: h, 14: d, 16: [2, 42], 17: 15, 18: r, 21: f, 22: 40, 23: y, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: g, 30: T, 31: m, 33: L, 35: A, 36: C, 37: S, 38: B, 39: D, 41: F, 43: q, 44: X, 46: tt, 47: [1, 141], 50: z, 52: H, 53: W, 54: M, 59: J, 60: U, 61: Q, 62: et, 70: N }, { 4: i, 5: n, 8: 8, 9: 10, 12: 12, 13: h, 14: d, 16: [1, 142], 17: 15, 18: r, 21: f, 22: 40, 23: y, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: g, 30: T, 31: m, 33: L, 35: A, 36: C, 37: S, 38: B, 39: D, 41: F, 43: q, 44: X, 46: tt, 50: z, 52: H, 53: W, 54: M, 59: J, 60: U, 61: Q, 62: et, 70: N }, { 15: [1, 143] }, e(E, [2, 49]), { 15: [1, 144] }, e(E, [2, 51]), e(E, [2, 52]), { 22: 145, 70: N }, { 22: 146, 70: N }, { 56: 147, 81: ct }, { 56: 148, 81: ct }, { 56: 149, 81: ct }, { 64: [1, 150], 81: [2, 62] }, { 5: [2, 55] }, { 5: [2, 79] }, { 5: [2, 56] }, { 5: [2, 57] }, { 5: [2, 58] }, e(E, [2, 16]), e(_, [2, 10]), { 12: 151, 50: z, 52: H, 53: W }, e(_, [2, 12]), e(_, [2, 13]), e(E, [2, 18]), e(E, [2, 34]), e(E, [2, 35]), e(E, [2, 36]), e(E, [2, 37]), { 15: [1, 152] }, e(E, [2, 38]), { 15: [1, 153] }, e(E, [2, 39]), e(E, [2, 40]), { 15: [1, 154] }, e(E, [2, 41]), { 5: [1, 155] }, { 5: [1, 156] }, { 56: 157, 81: ct }, { 56: 158, 81: ct }, { 5: [2, 67] }, { 5: [2, 53] }, { 5: [2, 54] }, { 22: 159, 70: N }, e(_, [2, 11]), e(at, a, { 7: 103, 40: 160 }), e(k, a, { 7: 105, 42: 161 }), e(qt, a, { 7: 108, 45: 162 }), e(E, [2, 48]), e(E, [2, 50]), { 5: [2, 65] }, { 5: [2, 66] }, { 81: [2, 61] }, { 16: [2, 47] }, { 16: [2, 45] }, { 16: [2, 43] }],
defaultActions: { 5: [2, 1], 6: [2, 2], 87: [2, 63], 88: [2, 64], 121: [2, 55], 122: [2, 79], 123: [2, 56], 124: [2, 57], 125: [2, 58], 147: [2, 67], 148: [2, 53], 149: [2, 54], 157: [2, 65], 158: [2, 66], 159: [2, 61], 160: [2, 47], 161: [2, 45], 162: [2, 43] },
parseError: /* @__PURE__ */ u(function(w, I) {
if (I.recoverable)
this.trace(w);
else {
var P = new Error(w);
throw P.hash = I, P;
}
}, "parseError"),
parse: /* @__PURE__ */ u(function(w) {
var I = this, P = [0], b = [], R = [null], l = [], yt = this.table, p = "", wt = 0, zt = 0, pe = 2, Ht = 1, ue = l.slice.call(arguments, 1), V = Object.create(this.lexer), dt = { yy: {} };
for (var St in this.yy)
Object.prototype.hasOwnProperty.call(this.yy, St) && (dt.yy[St] = this.yy[St]);
V.setInput(w, dt.yy), dt.yy.lexer = V, dt.yy.parser = this, typeof V.yylloc > "u" && (V.yylloc = {});
var Mt = V.yylloc;
l.push(Mt);
var ge = V.options && V.options.ranges;
typeof dt.yy.parseError == "function" ? this.parseError = dt.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
function fe(j) {
P.length = P.length - 2 * j, R.length = R.length - j, l.length = l.length - j;
}
u(fe, "popStack");
function Ut() {
var j;
return j = b.pop() || V.lex() || Ht, typeof j != "number" && (j instanceof Array && (b = j, j = b.pop()), j = I.symbols_[j] || j), j;
}
u(Ut, "lex");
for (var K, pt, st, Rt, ft = {}, vt, lt, Kt, It; ; ) {
if (pt = P[P.length - 1], this.defaultActions[pt] ? st = this.defaultActions[pt] : ((K === null || typeof K > "u") && (K = Ut()), st = yt[pt] && yt[pt][K]), typeof st > "u" || !st.length || !st[0]) {
var Dt = "";
It = [];
for (vt in yt[pt])
this.terminals_[vt] && vt > pe && It.push("'" + this.terminals_[vt] + "'");
V.showPosition ? Dt = "Parse error on line " + (wt + 1) + `:
` + V.showPosition() + `
Expecting ` + It.join(", ") + ", got '" + (this.terminals_[K] || K) + "'" : Dt = "Parse error on line " + (wt + 1) + ": Unexpected " + (K == Ht ? "end of input" : "'" + (this.terminals_[K] || K) + "'"), this.parseError(Dt, {
text: V.match,
token: this.terminals_[K] || K,
line: V.yylineno,
loc: Mt,
expected: It
});
}
if (st[0] instanceof Array && st.length > 1)
throw new Error("Parse Error: multiple actions possible at state: " + pt + ", token: " + K);
switch (st[0]) {
case 1:
P.push(K), R.push(V.yytext), l.push(V.yylloc), P.push(st[1]), K = null, zt = V.yyleng, p = V.yytext, wt = V.yylineno, Mt = V.yylloc;
break;
case 2:
if (lt = this.productions_[st[1]][1], ft.$ = R[R.length - lt], ft._$ = {
first_line: l[l.length - (lt || 1)].first_line,
last_line: l[l.length - 1].last_line,
first_column: l[l.length - (lt || 1)].first_column,
last_column: l[l.length - 1].last_column
}, ge && (ft._$.range = [
l[l.length - (lt || 1)].range[0],
l[l.length - 1].range[1]
]), Rt = this.performAction.apply(ft, [
p,
zt,
wt,
dt.yy,
st[1],
R,
l
].concat(ue)), typeof Rt < "u")
return Rt;
lt && (P = P.slice(0, -1 * lt * 2), R = R.slice(0, -1 * lt), l = l.slice(0, -1 * lt)), P.push(this.productions_[st[1]][0]), R.push(ft.$), l.push(ft._$), Kt = yt[P[P.length - 2]][P[P.length - 1]], P.push(Kt);
break;
case 3:
return !0;
}
}
return !0;
}, "parse")
}, de = /* @__PURE__ */ (function() {
var ht = {
EOF: 1,
parseError: /* @__PURE__ */ u(function(I, P) {
if (this.yy.parser)
this.yy.parser.parseError(I, P);
else
throw new Error(I);
}, "parseError"),
// resets the lexer, sets new input
setInput: /* @__PURE__ */ u(function(w, I) {
return this.yy = I || this.yy || {}, this._input = w, 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;
}, "setInput"),
// consumes and returns one char from the input
input: /* @__PURE__ */ u(function() {
var w = this._input[0];
this.yytext += w, this.yyleng++, this.offset++, this.match += w, this.matched += w;
var I = w.match(/(?:\r\n?|\n).*/g);
return I ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), w;
}, "input"),
// unshifts one char (or a string) into the input
unput: /* @__PURE__ */ u(function(w) {
var I = w.length, P = w.split(/(?:\r\n?|\n)/g);
this._input = w + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - I), this.offset -= I;
var b = 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), P.length - 1 && (this.yylineno -= P.length - 1);
var R = 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: P ? (P.length === b.length ? this.yylloc.first_column : 0) + b[b.length - P.length].length - P[0].length : this.yylloc.first_column - I
}, this.options.ranges && (this.yylloc.range = [R[0], R[0] + this.yyleng - I]), this.yyleng = this.yytext.length, this;
}, "unput"),
// When called from action, caches matched text and appends it on next action
more: /* @__PURE__ */ u(function() {
return this._more = !0, this;
}, "more"),
// 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: /* @__PURE__ */ u(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;
}, "reject"),
// retain first n characters of the match
less: /* @__PURE__ */ u(function(w) {
this.unput(this.match.slice(w));
}, "less"),
// displays already matched input, i.e. for error messages
pastInput: /* @__PURE__ */ u(function() {
var w = this.matched.substr(0, this.matched.length - this.match.length);
return (w.length > 20 ? "..." : "") + w.substr(-20).replace(/\n/g, "");
}, "pastInput"),
// displays upcoming input, i.e. for error messages
upcomingInput: /* @__PURE__ */ u(function() {
var w = this.match;
return w.length < 20 && (w += this._input.substr(0, 20 - w.length)), (w.substr(0, 20) + (w.length > 20 ? "..." : "")).replace(/\n/g, "");
}, "upcomingInput"),
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: /* @__PURE__ */ u(function() {
var w = this.pastInput(), I = new Array(w.length + 1).join("-");
return w + this.upcomingInput() + `
` + I + "^";
}, "showPosition"),
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: /* @__PURE__ */ u(function(w, I) {
var P, b, R;
if (this.options.backtrack_lexer && (R = {
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 && (R.yylloc.range = this.yylloc.range.slice(0))), b = w[0].match(/(?:\r\n?|\n).*/g), b && (this.yylineno += b.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: b ? b[b.length - 1].length - b[b.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + w[0].length
}, this.yytext += w[0], this.match += w[0], this.matches = w, 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(w[0].length), this.matched += w[0], P = this.performAction.call(this, this.yy, this, I, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), P)
return P;
if (this._backtrack) {
for (var l in R)
this[l] = R[l];
return !1;
}
return !1;
}, "test_match"),
// return next match in input
next: /* @__PURE__ */ u(function() {
if (this.done)
return this.EOF;
this._input || (this.done = !0);
var w, I, P, b;
this._more || (this.yytext = "", this.match = "");
for (var R = this._currentRules(), l = 0; l < R.length; l++)
if (P = this._input.match(this.rules[R[l]]), P && (!I || P[0].length > I[0].length)) {
if (I = P, b = l, this.options.backtrack_lexer) {
if (w = this.test_match(P, R[l]), w !== !1)
return w;
if (this._backtrack) {
I = !1;
continue;
} else
return !1;
} else if (!this.options.flex)
break;
}
return I ? (w = this.test_match(I, R[b]), w !== !1 ? w : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}, "next"),
// return next match that has a token
lex: /* @__PURE__ */ u(function() {
var I = this.next();
return I || this.lex();
}, "lex"),
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: /* @__PURE__ */ u(function(I) {
this.conditionStack.push(I);
}, "begin"),
// pop the previously active lexer condition state off the condition stack
popState: /* @__PURE__ */ u(function() {
var I = this.conditionStack.length - 1;
return I > 0 ? this.conditionStack.pop() : this.conditionStack[0];
}, "popState"),
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: /* @__PURE__ */ u(function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
}, "_currentRules"),
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: /* @__PURE__ */ u(function(I) {
return I = this.conditionStack.length - 1 - Math.abs(I || 0), I >= 0 ? this.conditionStack[I] : "INITIAL";
}, "topState"),
// alias for begin(condition)
pushState: /* @__PURE__ */ u(function(I) {
this.begin(I);
}, "pushState"),
// return the number of states currently on the stack
stateStackSize: /* @__PURE__ */ u(function() {
return this.conditionStack.length;
}, "stateStackSize"),
options: { "case-insensitive": !0 },
performAction: /* @__PURE__ */ u(function(I, P, b, R) {
switch (b) {
case 0:
return 5;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
return 19;
case 7:
return this.begin("LINE"), 14;
case 8:
return this.begin("ID"), 50;
case 9:
return this.begin("ID"), 52;
case 10:
return 13;
case 11:
return this.begin("ID"), 53;
case 12:
return P.yytext = P.yytext.trim(), this.begin("ALIAS"), 70;
case 13:
return this.popState(), this.popState(), this.begin("LINE"), 51;
case 14:
return this.popState(), this.popState(), 5;
case 15:
return this.begin("LINE"), 36;
case 16:
return this.begin("LINE"), 37;
case 17:
return this.begin("LINE"), 38;
case 18:
return this.begin("LINE"), 39;
case 19:
return this.begin("LINE"), 49;
case 20:
return this.begin("LINE"), 41;
case 21:
return this.begin("LINE"), 43;
case 22:
return this.begin("LINE"), 48;
case 23:
return this.begin("LINE"), 44;
case 24:
return this.begin("LINE"), 47;
case 25:
return this.begin("LINE"), 46;
case 26:
return this.popState(), 15;
case 27:
return 16;
case 28:
return 65;
case 29:
return 66;
case 30:
return 59;
case 31:
return 60;
case 32:
return 61;
case 33:
return 62;
case 34:
return 57;
case 35:
return 54;
case 36:
return this.begin("ID"), 21;
case 37:
return this.begin("ID"), 23;
case 38:
return 29;
case 39:
return 30;
case 40:
return this.begin("acc_title"), 31;
case 41:
return this.popState(), "acc_title_value";
case 42:
return this.begin("acc_descr"), 33;
case 43:
return this.popState(), "acc_descr_value";
case 44:
this.begin("acc_descr_multiline");
break;
case 45:
this.popState();
break;
case 46:
return "acc_descr_multiline_value";
case 47:
return 6;
case 48:
return 18;
case 49:
return 20;
case 50:
return 64;
case 51:
return 5;
case 52:
return P.yytext = P.yytext.trim(), 70;
case 53:
return 73;
case 54:
return 74;
case 55:
return 75;
case 56:
return 76;
case 57:
return 71;
case 58:
return 72;
case 59:
return 77;
case 60:
return 78;
case 61:
return 79;
case 62:
return 80;
case 63:
return 81;
case 64:
return 81;
case 65:
return 68;
case 66:
return 69;
case 67:
return 5;
case 68:
return "INVALID";
}
}, "anonymous"),
rules: [/^(?:[\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, /^(?:create\b)/i, /^(?:destroy\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, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?::(?:(?:no)?wrap)?[^#\n;]*)/i, /^(?::)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:$)/i, /^(?:.)/i],
conditions: { acc_descr_multiline: { rules: [45, 46], inclusive: !1 }, acc_descr: { rules: [43], inclusive: !1 }, acc_title: { rules: [41], inclusive: !1 }, ID: { rules: [2, 3, 12], inclusive: !1 }, ALIAS: { rules: [2, 3, 13, 14], inclusive: !1 }, LINE: { rules: [2, 3, 26], inclusive: !1 }, INITIAL: { rules: [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 44, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68], inclusive: !0 } }
};
return ht;
})();
Nt.lexer = de;
function mt() {
this.yy = {};
}
return u(mt, "Parser"), mt.prototype = Nt, Nt.Parser = mt, new mt();
})();
Ot.parser = Ot;
var Me = Ot, Re = {
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,
BIDIRECTIONAL_SOLID: 33,
BIDIRECTIONAL_DOTTED: 34
}, De = {
FILLED: 0,
OPEN: 1
}, Ce = {
LEFTOF: 0,
RIGHTOF: 1,
OVER: 2
}, Tt, Oe = (Tt = class {
constructor() {
this.state = new be(() => ({
prevActor: void 0,
actors: /* @__PURE__ */ new Map(),
createdActors: /* @__PURE__ */ new Map(),
destroyedActors: /* @__PURE__ */ new Map(),
boxes: [],
messages: [],
notes: [],
sequenceNumbersEnabled: !1,
wrapEnabled: void 0,
currentBox: void 0,
lastCreated: void 0,
lastDestroyed: void 0
})), this.setAccTitle = Gt, this.setAccDescription = Ie, this.setDiagramTitle = Le, this.getAccTitle = _e, this.getAccDescription = Pe, this.getDiagramTitle = Ae, this.apply = this.apply.bind(this), this.parseBoxData = this.parseBoxData.bind(this), this.parseMessage = this.parseMessage.bind(this), this.clear(), this.setWrap($().wrap), this.LINETYPE = Re, this.ARROWTYPE = De, this.PLACEMENT = Ce;
}
addBox(t) {
this.state.records.boxes.push({
name: t.text,
wrap: t.wrap ?? this.autoWrap(),
fill: t.color,
actorKeys: []
}), this.state.records.currentBox = this.state.records.boxes.slice(-1)[0];
}
addActor(t, c, s, a) {
let i = this.state.records.currentBox;
const n = this.state.records.actors.get(t);
if (n) {
if (this.state.records.currentBox && n.box && this.state.records.currentBox !== n.box)
throw new Error(
`A same participant should only be defined in one Box: ${n.name} can't be in '${n.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`
);
if (i = n.box ? n.box : this.state.records.currentBox, n.box = i, n && c === n.name && s == null)
return;
}
if (s?.text == null && (s = { text: c, type: a }), (a == null || s.text == null) && (s = { text: c, type: a }), this.state.records.actors.set(t, {
box: i,
name: c,
description: s.text,
wrap: s.wrap ?? this.autoWrap(),
prevActor: this.state.records.prevActor,
links: {},
properties: {},
actorCnt: null,
rectData: null,
type: a ?? "participant"
}), this.state.records.prevActor) {
const h = this.state.records.actors.get(this.state.records.prevActor);
h && (h.nextActor = t);
}
this.state.records.currentBox && this.state.records.currentBox.actorKeys.push(t), this.state.records.prevActor = t;
}
activationCount(t) {
let c, s = 0;
if (!t)
return 0;
for (c = 0; c < this.state.records.messages.length; c++)
this.state.records.messages[c].type === this.LINETYPE.ACTIVE_START && this.state.records.messages[c].from === t && s++, this.state.records.messages[c].type === this.LINETYPE.ACTIVE_END && this.state.records.messages[c].from === t && s--;
return s;
}
addMessage(t, c, s, a) {
this.state.records.messages.push({
id: this.state.records.messages.length.toString(),
from: t,
to: c,
message: s.text,
wrap: s.wrap ?? this.autoWrap(),
answer: a
});
}
addSignal(t, c, s, a, i = !1) {
if (a === this.LINETYPE.ACTIVE_END && this.activationCount(t ?? "") < 1) {
const h = new Error("Trying to inactivate an inactive participant (" + t + ")");
throw h.hash = {
text: "->>-",
token: "->>-",
line: "1",
loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
expected: ["'ACTIVE_PARTICIPANT'"]
}, h;
}
return this.state.records.messages.push({
id: this.state.records.messages.length.toString(),
from: t,
to: c,
message: s?.text ?? "",
wrap: s?.wrap ?? this.autoWrap(),
type: a,
activate: i
}), !0;
}
hasAtLeastOneBox() {
return this.state.records.boxes.length > 0;
}
hasAtLeastOneBoxWithTitle() {
return this.state.records.boxes.some((t) => t.name);
}
getMessages() {
return this.state.records.messages;
}
getBoxes() {
return this.state.records.boxes;
}
getActors() {
return this.state.records.actors;
}
getCreatedActors() {
return this.state.records.createdActors;
}
getDestroyedActors() {
return this.state.records.destroyedActors;
}
getActor(t) {
return this.state.records.actors.get(t);
}
getActorKeys() {
return [...this.state.records.actors.keys()];
}
enableSequenceNumbers() {
this.state.records.sequenceNumbersEnabled = !0;
}
disableSequenceNumbers() {
this.state.records.sequenceNumbersEnabled = !1;
}
showSequenceNumbers() {
return this.state.records.sequenceNumbersEnabled;
}
setWrap(t) {
this.state.records.wrapEnabled = t;
}
extractWrap(t) {
if (t === void 0)
return {};
t = t.trim();
const c = /^:?wrap:/.exec(t) !== null ? !0 : /^:?nowrap:/.exec(t) !== null ? !1 : void 0;
return { cleanedText: (c === void 0 ? t : t.replace(/^:?(?:no)?wrap:/, "")).trim(), wrap: c };
}
autoWrap() {
return this.state.records.wrapEnabled !== void 0 ? this.state.records.wrapEnabled : $().sequence?.wrap ?? !1;
}
clear() {
this.state.reset(), ke();
}
parseMessage(t) {
const c = t.trim(), { wrap: s, cleanedText: a } = this.extractWrap(c), i = {
text: a,
wrap: s
};
return G.debug(`parseMessage: ${JSON.stringify(i)}`), i;
}
// We expect the box statement to be color first then description
// The color can be rgb,rgba,hsl,hsla, or css code names #hex codes are not supported for now because of the way the char # is handled
// We extract first segment as color, the rest of the line is considered as text
parseBoxData(t) {
const c = /^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(t);
let s = c?.[1] ? c[1].trim() : "transparent", a = c?.[2] ? c[2].trim() : void 0;
if (window?.CSS)
window.CSS.supports("color", s) || (s = "transparent", a = t.trim());
else {
const h = new Option().style;
h.color = s, h.color !== s && (s = "transparent", a = t.trim());
}
const { wrap: i, cleanedText: n } = this.extractWrap(a);
return {
text: n ? _t(n, $()) : void 0,
color: s,
wrap: i
};
}
addNote(t, c, s) {
const a = {
actor: t,
placement: c,
message: s.text,
wrap: s.wrap ?? this.autoWrap()
}, i = [].concat(t, t);
this.state.records.notes.push(a), this.state.records.messages.push({
id: this.state.records.messages.length.toString(),
from: i[0],
to: i[1],
message: s.text,
wrap: s.wrap ?? this.autoWrap(),
type: this.LINETYPE.NOTE,
placement: c
});
}
addLinks(t, c) {
const s = this.getActor(t);
try {
let a = _t(c.text, $());
a = a.replace(/=/g, "="), a = a.replace(/&/g, "&");
const i = JSON.parse(a);
this.insertLinks(s, i);
} catch (a) {
G.error("error while parsing actor link text", a);
}
}
addALink(t, c) {
const s = this.getActor(t);
try {
const a = {};
let i = _t(c.text, $());
const n = i.indexOf("@");
i = i.replace(/=/g, "="), i = i.replace(/&/g, "&");
const h = i.slice(0, n - 1).trim(), d = i.slice(n + 1).trim();
a[h] = d, this.insertLinks(s, a);
} catch (a) {
G.error("error while parsing actor link text", a);
}
}
insertLinks(t, c) {
if (t.links == null)
t.links = c;
else
for (const s in c)
t.links[s] = c[s];
}
addProperties(t, c) {
const s = this.getActor(t);
try {
const a = _t(c.text, $()), i = JSON.parse(a);
this.insertProperties(s, i);
} catch (a) {
G.error("error while parsing actor properties text", a);
}
}
insertProperties(t, c) {
if (t.properties == null)
t.properties = c;
else
for (const s in c)
t.properties[s] = c[s];
}
boxEnd() {
this.state.records.currentBox = void 0;
}
addDetails(t, c) {
const s = this.getActor(t), a = document.getElementById(c.text);
try {
const i = a.innerHTML, n = JSON.parse(i);
n.properties && this.insertProperties(s, n.properties), n.links && this.insertLinks(s, n.links);
} catch (i) {
G.error("error while parsing actor details text", i);
}
}
getActorProperty(t, c) {
if (t?.properties !== void 0)
return t.properties[c];
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents
apply(t) {
if (Array.isArray(t))
t.forEach((c) => {
this.apply(c);
});
else
switch (t.type) {
case "sequenceIndex":
this.state.records.messages.push({
id: this.state.records.messages.length.toString(),
from: void 0,
to: void 0,
message: {
start: t.sequenceIndex,
step: t.sequenceIndexStep,
visible: t.sequenceVisible
},
wrap: !1,
type: t.signalType
});
break;
case "addParticipant":
this.addActor(t.actor, t.actor, t.description, t.draw);
break;
case "createParticipant":
if (this.state.records.actors.has(t.actor))
throw new Error(
"It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior"
);
this.state.records.lastCreated = t.actor, this.addActor(t.actor, t.actor, t.description, t.draw), this.state.records.createdActors.set(t.actor, this.state.records.messages.length);
break;
case "destroyParticipant":
this.state.records.lastDestroyed = t.actor, this.state.records.destroyedActors.set(t.actor, this.state.records.messages.length);
break;
case "activeStart":
this.addSignal(t.actor, void 0, void 0, t.signalType);
break;
case "activeEnd":
this.addSignal(t.actor, void 0, void 0, t.signalType);
break;
case "addNote":
this.addNote(t.actor, t.placement, t.text);
break;
case "addLinks":
this.addLinks(t.actor, t.text);
break;
case "addALink":
this.addALink(t.actor, t.text);
break;
case "addProperties":
this.addProperties(t.actor, t.text);
break;
case "addDetails":
this.addDetails(t.actor, t.text);
break;
case "addMessage":
if (this.state.records.lastCreated) {
if (t.to !== this.state.records.lastCreated)
throw new Error(
"The created participant " + this.state.records.lastCreated.name + " does not have an associated creating message after its declaration. Please check the sequence diagram."
);
this.state.records.lastCreated = void 0;
} else if (this.state.records.lastDestroyed) {
if (t.to !== this.state.records.lastDestroyed && t.from !== this.state.records.lastDestroyed)
throw new Error(
"The destroyed participant " + this.state.records.lastDestroyed.name + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
);
this.state.records.lastDestroyed = void 0;
}
this.addSignal(t.from, t.to, t.msg, t.signalType, t.activate);
break;
case "boxStart":
this.addBox(t.boxData);
break;
case "boxEnd":
this.boxEnd();
break;
case "loopStart":
this.addSignal(void 0, void 0, t.loopText, t.signalType);
break;
case "loopEnd":
this.addSigna