UNPKG

35.2 kBJavaScriptView Raw
1import { c as Te, s as Ce, g as Fe, b as Me, a as De, l as Ne, E as Pe, j as oe, k as Ye, f as ke } from "./mermaid-9f2aa176.js";
2import { G as Ue } from "./graph-0ee63739.js";
3import { l as Be } from "./layout-fd473db2.js";
4import { l as Qe } from "./line-24d93f1b.js";
5import "./array-2ff2c7a6.js";
6import "./path-428ebac9.js";
7var ce = function() {
8 var e = function(V, i, r, a) {
9 for (r = r || {}, a = V.length; a--; r[V[a]] = i)
10 ;
11 return r;
12 }, t = [1, 3], l = [1, 4], c = [1, 5], u = [1, 6], d = [5, 6, 8, 9, 11, 13, 31, 32, 33, 34, 35, 36, 44, 62, 63], f = [1, 18], h = [2, 7], o = [1, 22], E = [1, 23], R = [1, 24], A = [1, 25], T = [1, 26], N = [1, 27], w = [1, 20], k = [1, 28], x = [1, 29], F = [62, 63], de = [5, 8, 9, 11, 13, 31, 32, 33, 34, 35, 36, 44, 51, 53, 62, 63], fe = [1, 47], pe = [1, 48], ye = [1, 49], _e = [1, 50], Ee = [1, 51], ge = [1, 52], Re = [1, 53], O = [53, 54], M = [1, 64], D = [1, 60], P = [1, 61], Y = [1, 62], U = [1, 63], B = [1, 65], j = [1, 69], z = [1, 70], X = [1, 67], J = [1, 68], m = [5, 8, 9, 11, 13, 31, 32, 33, 34, 35, 36, 44, 62, 63], ie = {
13 trace: function() {
14 },
15 yy: {},
16 symbols_: { error: 2, start: 3, directive: 4, NEWLINE: 5, RD: 6, diagram: 7, EOF: 8, acc_title: 9, acc_title_value: 10, acc_descr: 11, acc_descr_value: 12, acc_descr_multiline_value: 13, requirementDef: 14, elementDef: 15, relationshipDef: 16, requirementType: 17, requirementName: 18, STRUCT_START: 19, requirementBody: 20, ID: 21, COLONSEP: 22, id: 23, TEXT: 24, text: 25, RISK: 26, riskLevel: 27, VERIFYMTHD: 28, verifyType: 29, STRUCT_STOP: 30, REQUIREMENT: 31, FUNCTIONAL_REQUIREMENT: 32, INTERFACE_REQUIREMENT: 33, PERFORMANCE_REQUIREMENT: 34, PHYSICAL_REQUIREMENT: 35, DESIGN_CONSTRAINT: 36, LOW_RISK: 37, MED_RISK: 38, HIGH_RISK: 39, VERIFY_ANALYSIS: 40, VERIFY_DEMONSTRATION: 41, VERIFY_INSPECTION: 42, VERIFY_TEST: 43, ELEMENT: 44, elementName: 45, elementBody: 46, TYPE: 47, type: 48, DOCREF: 49, ref: 50, END_ARROW_L: 51, relationship: 52, LINE: 53, END_ARROW_R: 54, CONTAINS: 55, COPIES: 56, DERIVES: 57, SATISFIES: 58, VERIFIES: 59, REFINES: 60, TRACES: 61, unqString: 62, qString: 63, $accept: 0, $end: 1 },
17 terminals_: { 2: "error", 5: "NEWLINE", 6: "RD", 8: "EOF", 9: "acc_title", 10: "acc_title_value", 11: "acc_descr", 12: "acc_descr_value", 13: "acc_descr_multiline_value", 19: "STRUCT_START", 21: "ID", 22: "COLONSEP", 24: "TEXT", 26: "RISK", 28: "VERIFYMTHD", 30: "STRUCT_STOP", 31: "REQUIREMENT", 32: "FUNCTIONAL_REQUIREMENT", 33: "INTERFACE_REQUIREMENT", 34: "PERFORMANCE_REQUIREMENT", 35: "PHYSICAL_REQUIREMENT", 36: "DESIGN_CONSTRAINT", 37: "LOW_RISK", 38: "MED_RISK", 39: "HIGH_RISK", 40: "VERIFY_ANALYSIS", 41: "VERIFY_DEMONSTRATION", 42: "VERIFY_INSPECTION", 43: "VERIFY_TEST", 44: "ELEMENT", 47: "TYPE", 49: "DOCREF", 51: "END_ARROW_L", 53: "LINE", 54: "END_ARROW_R", 55: "CONTAINS", 56: "COPIES", 57: "DERIVES", 58: "SATISFIES", 59: "VERIFIES", 60: "REFINES", 61: "TRACES", 62: "unqString", 63: "qString" },
18 productions_: [0, [3, 3], [3, 2], [3, 4], [4, 2], [4, 2], [4, 1], [7, 0], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [14, 5], [20, 5], [20, 5], [20, 5], [20, 5], [20, 2], [20, 1], [17, 1], [17, 1], [17, 1], [17, 1], [17, 1], [17, 1], [27, 1], [27, 1], [27, 1], [29, 1], [29, 1], [29, 1], [29, 1], [15, 5], [46, 5], [46, 5], [46, 2], [46, 1], [16, 5], [16, 5], [52, 1], [52, 1], [52, 1], [52, 1], [52, 1], [52, 1], [52, 1], [18, 1], [18, 1], [23, 1], [23, 1], [25, 1], [25, 1], [45, 1], [45, 1], [48, 1], [48, 1], [50, 1], [50, 1]],
19 performAction: function(i, r, a, n, p, s, W) {
20 var _ = s.length - 1;
21 switch (p) {
22 case 4:
23 this.$ = s[_].trim(), n.setAccTitle(this.$);
24 break;
25 case 5:
26 case 6:
27 this.$ = s[_].trim(), n.setAccDescription(this.$);
28 break;
29 case 7:
30 this.$ = [];
31 break;
32 case 13:
33 n.addRequirement(s[_ - 3], s[_ - 4]);
34 break;
35 case 14:
36 n.setNewReqId(s[_ - 2]);
37 break;
38 case 15:
39 n.setNewReqText(s[_ - 2]);
40 break;
41 case 16:
42 n.setNewReqRisk(s[_ - 2]);
43 break;
44 case 17:
45 n.setNewReqVerifyMethod(s[_ - 2]);
46 break;
47 case 20:
48 this.$ = n.RequirementType.REQUIREMENT;
49 break;
50 case 21:
51 this.$ = n.RequirementType.FUNCTIONAL_REQUIREMENT;
52 break;
53 case 22:
54 this.$ = n.RequirementType.INTERFACE_REQUIREMENT;
55 break;
56 case 23:
57 this.$ = n.RequirementType.PERFORMANCE_REQUIREMENT;
58 break;
59 case 24:
60 this.$ = n.RequirementType.PHYSICAL_REQUIREMENT;
61 break;
62 case 25:
63 this.$ = n.RequirementType.DESIGN_CONSTRAINT;
64 break;
65 case 26:
66 this.$ = n.RiskLevel.LOW_RISK;
67 break;
68 case 27:
69 this.$ = n.RiskLevel.MED_RISK;
70 break;
71 case 28:
72 this.$ = n.RiskLevel.HIGH_RISK;
73 break;
74 case 29:
75 this.$ = n.VerifyType.VERIFY_ANALYSIS;
76 break;
77 case 30:
78 this.$ = n.VerifyType.VERIFY_DEMONSTRATION;
79 break;
80 case 31:
81 this.$ = n.VerifyType.VERIFY_INSPECTION;
82 break;
83 case 32:
84 this.$ = n.VerifyType.VERIFY_TEST;
85 break;
86 case 33:
87 n.addElement(s[_ - 3]);
88 break;
89 case 34:
90 n.setNewElementType(s[_ - 2]);
91 break;
92 case 35:
93 n.setNewElementDocRef(s[_ - 2]);
94 break;
95 case 38:
96 n.addRelationship(s[_ - 2], s[_], s[_ - 4]);
97 break;
98 case 39:
99 n.addRelationship(s[_ - 2], s[_ - 4], s[_]);
100 break;
101 case 40:
102 this.$ = n.Relationships.CONTAINS;
103 break;
104 case 41:
105 this.$ = n.Relationships.COPIES;
106 break;
107 case 42:
108 this.$ = n.Relationships.DERIVES;
109 break;
110 case 43:
111 this.$ = n.Relationships.SATISFIES;
112 break;
113 case 44:
114 this.$ = n.Relationships.VERIFIES;
115 break;
116 case 45:
117 this.$ = n.Relationships.REFINES;
118 break;
119 case 46:
120 this.$ = n.Relationships.TRACES;
121 break;
122 }
123 },
124 table: [{ 3: 1, 4: 2, 6: t, 9: l, 11: c, 13: u }, { 1: [3] }, { 3: 8, 4: 2, 5: [1, 7], 6: t, 9: l, 11: c, 13: u }, { 5: [1, 9] }, { 10: [1, 10] }, { 12: [1, 11] }, e(d, [2, 6]), { 3: 12, 4: 2, 6: t, 9: l, 11: c, 13: u }, { 1: [2, 2] }, { 4: 17, 5: f, 7: 13, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, e(d, [2, 4]), e(d, [2, 5]), { 1: [2, 1] }, { 8: [1, 30] }, { 4: 17, 5: f, 7: 31, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, { 4: 17, 5: f, 7: 32, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, { 4: 17, 5: f, 7: 33, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, { 4: 17, 5: f, 7: 34, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, { 4: 17, 5: f, 7: 35, 8: h, 9: l, 11: c, 13: u, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: o, 32: E, 33: R, 34: A, 35: T, 36: N, 44: w, 62: k, 63: x }, { 18: 36, 62: [1, 37], 63: [1, 38] }, { 45: 39, 62: [1, 40], 63: [1, 41] }, { 51: [1, 42], 53: [1, 43] }, e(F, [2, 20]), e(F, [2, 21]), e(F, [2, 22]), e(F, [2, 23]), e(F, [2, 24]), e(F, [2, 25]), e(de, [2, 49]), e(de, [2, 50]), { 1: [2, 3] }, { 8: [2, 8] }, { 8: [2, 9] }, { 8: [2, 10] }, { 8: [2, 11] }, { 8: [2, 12] }, { 19: [1, 44] }, { 19: [2, 47] }, { 19: [2, 48] }, { 19: [1, 45] }, { 19: [2, 53] }, { 19: [2, 54] }, { 52: 46, 55: fe, 56: pe, 57: ye, 58: _e, 59: Ee, 60: ge, 61: Re }, { 52: 54, 55: fe, 56: pe, 57: ye, 58: _e, 59: Ee, 60: ge, 61: Re }, { 5: [1, 55] }, { 5: [1, 56] }, { 53: [1, 57] }, e(O, [2, 40]), e(O, [2, 41]), e(O, [2, 42]), e(O, [2, 43]), e(O, [2, 44]), e(O, [2, 45]), e(O, [2, 46]), { 54: [1, 58] }, { 5: M, 20: 59, 21: D, 24: P, 26: Y, 28: U, 30: B }, { 5: j, 30: z, 46: 66, 47: X, 49: J }, { 23: 71, 62: k, 63: x }, { 23: 72, 62: k, 63: x }, e(m, [2, 13]), { 22: [1, 73] }, { 22: [1, 74] }, { 22: [1, 75] }, { 22: [1, 76] }, { 5: M, 20: 77, 21: D, 24: P, 26: Y, 28: U, 30: B }, e(m, [2, 19]), e(m, [2, 33]), { 22: [1, 78] }, { 22: [1, 79] }, { 5: j, 30: z, 46: 80, 47: X, 49: J }, e(m, [2, 37]), e(m, [2, 38]), e(m, [2, 39]), { 23: 81, 62: k, 63: x }, { 25: 82, 62: [1, 83], 63: [1, 84] }, { 27: 85, 37: [1, 86], 38: [1, 87], 39: [1, 88] }, { 29: 89, 40: [1, 90], 41: [1, 91], 42: [1, 92], 43: [1, 93] }, e(m, [2, 18]), { 48: 94, 62: [1, 95], 63: [1, 96] }, { 50: 97, 62: [1, 98], 63: [1, 99] }, e(m, [2, 36]), { 5: [1, 100] }, { 5: [1, 101] }, { 5: [2, 51] }, { 5: [2, 52] }, { 5: [1, 102] }, { 5: [2, 26] }, { 5: [2, 27] }, { 5: [2, 28] }, { 5: [1, 103] }, { 5: [2, 29] }, { 5: [2, 30] }, { 5: [2, 31] }, { 5: [2, 32] }, { 5: [1, 104] }, { 5: [2, 55] }, { 5: [2, 56] }, { 5: [1, 105] }, { 5: [2, 57] }, { 5: [2, 58] }, { 5: M, 20: 106, 21: D, 24: P, 26: Y, 28: U, 30: B }, { 5: M, 20: 107, 21: D, 24: P, 26: Y, 28: U, 30: B }, { 5: M, 20: 108, 21: D, 24: P, 26: Y, 28: U, 30: B }, { 5: M, 20: 109, 21: D, 24: P, 26: Y, 28: U, 30: B }, { 5: j, 30: z, 46: 110, 47: X, 49: J }, { 5: j, 30: z, 46: 111, 47: X, 49: J }, e(m, [2, 14]), e(m, [2, 15]), e(m, [2, 16]), e(m, [2, 17]), e(m, [2, 34]), e(m, [2, 35])],
125 defaultActions: { 8: [2, 2], 12: [2, 1], 30: [2, 3], 31: [2, 8], 32: [2, 9], 33: [2, 10], 34: [2, 11], 35: [2, 12], 37: [2, 47], 38: [2, 48], 40: [2, 53], 41: [2, 54], 83: [2, 51], 84: [2, 52], 86: [2, 26], 87: [2, 27], 88: [2, 28], 90: [2, 29], 91: [2, 30], 92: [2, 31], 93: [2, 32], 95: [2, 55], 96: [2, 56], 98: [2, 57], 99: [2, 58] },
126 parseError: function(i, r) {
127 if (r.recoverable)
128 this.trace(i);
129 else {
130 var a = new Error(i);
131 throw a.hash = r, a;
132 }
133 },
134 parse: function(i) {
135 var r = this, a = [0], n = [], p = [null], s = [], W = this.table, _ = "", Z = 0, me = 0, Ve = 2, Ie = 1, qe = s.slice.call(arguments, 1), g = Object.create(this.lexer), L = { yy: {} };
136 for (var re in this.yy)
137 Object.prototype.hasOwnProperty.call(this.yy, re) && (L.yy[re] = this.yy[re]);
138 g.setInput(i, L.yy), L.yy.lexer = g, L.yy.parser = this, typeof g.yylloc > "u" && (g.yylloc = {});
139 var se = g.yylloc;
140 s.push(se);
141 var Oe = g.options && g.options.ranges;
142 typeof L.yy.parseError == "function" ? this.parseError = L.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
143 function Le() {
144 var v;
145 return v = n.pop() || g.lex() || Ie, typeof v != "number" && (v instanceof Array && (n = v, v = n.pop()), v = r.symbols_[v] || v), v;
146 }
147 for (var I, C, S, ae, Q = {}, ee, $, be, te; ; ) {
148 if (C = a[a.length - 1], this.defaultActions[C] ? S = this.defaultActions[C] : ((I === null || typeof I > "u") && (I = Le()), S = W[C] && W[C][I]), typeof S > "u" || !S.length || !S[0]) {
149 var le = "";
150 te = [];
151 for (ee in W[C])
152 this.terminals_[ee] && ee > Ve && te.push("'" + this.terminals_[ee] + "'");
153 g.showPosition ? le = "Parse error on line " + (Z + 1) + `:
154` + g.showPosition() + `
155Expecting ` + te.join(", ") + ", got '" + (this.terminals_[I] || I) + "'" : le = "Parse error on line " + (Z + 1) + ": Unexpected " + (I == Ie ? "end of input" : "'" + (this.terminals_[I] || I) + "'"), this.parseError(le, {
156 text: g.match,
157 token: this.terminals_[I] || I,
158 line: g.yylineno,
159 loc: se,
160 expected: te
161 });
162 }
163 if (S[0] instanceof Array && S.length > 1)
164 throw new Error("Parse Error: multiple actions possible at state: " + C + ", token: " + I);
165 switch (S[0]) {
166 case 1:
167 a.push(I), p.push(g.yytext), s.push(g.yylloc), a.push(S[1]), I = null, me = g.yyleng, _ = g.yytext, Z = g.yylineno, se = g.yylloc;
168 break;
169 case 2:
170 if ($ = this.productions_[S[1]][1], Q.$ = p[p.length - $], Q._$ = {
171 first_line: s[s.length - ($ || 1)].first_line,
172 last_line: s[s.length - 1].last_line,
173 first_column: s[s.length - ($ || 1)].first_column,
174 last_column: s[s.length - 1].last_column
175 }, Oe && (Q._$.range = [
176 s[s.length - ($ || 1)].range[0],
177 s[s.length - 1].range[1]
178 ]), ae = this.performAction.apply(Q, [
179 _,
180 me,
181 Z,
182 L.yy,
183 S[1],
184 p,
185 s
186 ].concat(qe)), typeof ae < "u")
187 return ae;
188 $ && (a = a.slice(0, -1 * $ * 2), p = p.slice(0, -1 * $), s = s.slice(0, -1 * $)), a.push(this.productions_[S[1]][0]), p.push(Q.$), s.push(Q._$), be = W[a[a.length - 2]][a[a.length - 1]], a.push(be);
189 break;
190 case 3:
191 return !0;
192 }
193 }
194 return !0;
195 }
196 }, ve = function() {
197 var V = {
198 EOF: 1,
199 parseError: function(r, a) {
200 if (this.yy.parser)
201 this.yy.parser.parseError(r, a);
202 else
203 throw new Error(r);
204 },
205 // resets the lexer, sets new input
206 setInput: function(i, r) {
207 return this.yy = r || this.yy || {}, this._input = i, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
208 first_line: 1,
209 first_column: 0,
210 last_line: 1,
211 last_column: 0
212 }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
213 },
214 // consumes and returns one char from the input
215 input: function() {
216 var i = this._input[0];
217 this.yytext += i, this.yyleng++, this.offset++, this.match += i, this.matched += i;
218 var r = i.match(/(?:\r\n?|\n).*/g);
219 return r ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), i;
220 },
221 // unshifts one char (or a string) into the input
222 unput: function(i) {
223 var r = i.length, a = i.split(/(?:\r\n?|\n)/g);
224 this._input = i + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - r), this.offset -= r;
225 var n = this.match.split(/(?:\r\n?|\n)/g);
226 this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), a.length - 1 && (this.yylineno -= a.length - 1);
227 var p = this.yylloc.range;
228 return this.yylloc = {
229 first_line: this.yylloc.first_line,
230 last_line: this.yylineno + 1,
231 first_column: this.yylloc.first_column,
232 last_column: a ? (a.length === n.length ? this.yylloc.first_column : 0) + n[n.length - a.length].length - a[0].length : this.yylloc.first_column - r
233 }, this.options.ranges && (this.yylloc.range = [p[0], p[0] + this.yyleng - r]), this.yyleng = this.yytext.length, this;
234 },
235 // When called from action, caches matched text and appends it on next action
236 more: function() {
237 return this._more = !0, this;
238 },
239 // 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.
240 reject: function() {
241 if (this.options.backtrack_lexer)
242 this._backtrack = !0;
243 else
244 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).
245` + this.showPosition(), {
246 text: "",
247 token: null,
248 line: this.yylineno
249 });
250 return this;
251 },
252 // retain first n characters of the match
253 less: function(i) {
254 this.unput(this.match.slice(i));
255 },
256 // displays already matched input, i.e. for error messages
257 pastInput: function() {
258 var i = this.matched.substr(0, this.matched.length - this.match.length);
259 return (i.length > 20 ? "..." : "") + i.substr(-20).replace(/\n/g, "");
260 },
261 // displays upcoming input, i.e. for error messages
262 upcomingInput: function() {
263 var i = this.match;
264 return i.length < 20 && (i += this._input.substr(0, 20 - i.length)), (i.substr(0, 20) + (i.length > 20 ? "..." : "")).replace(/\n/g, "");
265 },
266 // displays the character position where the lexing error occurred, i.e. for error messages
267 showPosition: function() {
268 var i = this.pastInput(), r = new Array(i.length + 1).join("-");
269 return i + this.upcomingInput() + `
270` + r + "^";
271 },
272 // test the lexed token: return FALSE when not a match, otherwise return token
273 test_match: function(i, r) {
274 var a, n, p;
275 if (this.options.backtrack_lexer && (p = {
276 yylineno: this.yylineno,
277 yylloc: {
278 first_line: this.yylloc.first_line,
279 last_line: this.last_line,
280 first_column: this.yylloc.first_column,
281 last_column: this.yylloc.last_column
282 },
283 yytext: this.yytext,
284 match: this.match,
285 matches: this.matches,
286 matched: this.matched,
287 yyleng: this.yyleng,
288 offset: this.offset,
289 _more: this._more,
290 _input: this._input,
291 yy: this.yy,
292 conditionStack: this.conditionStack.slice(0),
293 done: this.done
294 }, this.options.ranges && (p.yylloc.range = this.yylloc.range.slice(0))), n = i[0].match(/(?:\r\n?|\n).*/g), n && (this.yylineno += n.length), this.yylloc = {
295 first_line: this.yylloc.last_line,
296 last_line: this.yylineno + 1,
297 first_column: this.yylloc.last_column,
298 last_column: n ? n[n.length - 1].length - n[n.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + i[0].length
299 }, this.yytext += i[0], this.match += i[0], this.matches = i, 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(i[0].length), this.matched += i[0], a = this.performAction.call(this, this.yy, this, r, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), a)
300 return a;
301 if (this._backtrack) {
302 for (var s in p)
303 this[s] = p[s];
304 return !1;
305 }
306 return !1;
307 },
308 // return next match in input
309 next: function() {
310 if (this.done)
311 return this.EOF;
312 this._input || (this.done = !0);
313 var i, r, a, n;
314 this._more || (this.yytext = "", this.match = "");
315 for (var p = this._currentRules(), s = 0; s < p.length; s++)
316 if (a = this._input.match(this.rules[p[s]]), a && (!r || a[0].length > r[0].length)) {
317 if (r = a, n = s, this.options.backtrack_lexer) {
318 if (i = this.test_match(a, p[s]), i !== !1)
319 return i;
320 if (this._backtrack) {
321 r = !1;
322 continue;
323 } else
324 return !1;
325 } else if (!this.options.flex)
326 break;
327 }
328 return r ? (i = this.test_match(r, p[n]), i !== !1 ? i : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
329` + this.showPosition(), {
330 text: "",
331 token: null,
332 line: this.yylineno
333 });
334 },
335 // return next match that has a token
336 lex: function() {
337 var r = this.next();
338 return r || this.lex();
339 },
340 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
341 begin: function(r) {
342 this.conditionStack.push(r);
343 },
344 // pop the previously active lexer condition state off the condition stack
345 popState: function() {
346 var r = this.conditionStack.length - 1;
347 return r > 0 ? this.conditionStack.pop() : this.conditionStack[0];
348 },
349 // produce the lexer rule set which is active for the currently active lexer condition state
350 _currentRules: function() {
351 return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
352 },
353 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
354 topState: function(r) {
355 return r = this.conditionStack.length - 1 - Math.abs(r || 0), r >= 0 ? this.conditionStack[r] : "INITIAL";
356 },
357 // alias for begin(condition)
358 pushState: function(r) {
359 this.begin(r);
360 },
361 // return the number of states currently on the stack
362 stateStackSize: function() {
363 return this.conditionStack.length;
364 },
365 options: { "case-insensitive": !0 },
366 performAction: function(r, a, n, p) {
367 switch (n) {
368 case 0:
369 return "title";
370 case 1:
371 return this.begin("acc_title"), 9;
372 case 2:
373 return this.popState(), "acc_title_value";
374 case 3:
375 return this.begin("acc_descr"), 11;
376 case 4:
377 return this.popState(), "acc_descr_value";
378 case 5:
379 this.begin("acc_descr_multiline");
380 break;
381 case 6:
382 this.popState();
383 break;
384 case 7:
385 return "acc_descr_multiline_value";
386 case 8:
387 return 5;
388 case 9:
389 break;
390 case 10:
391 break;
392 case 11:
393 break;
394 case 12:
395 return 8;
396 case 13:
397 return 6;
398 case 14:
399 return 19;
400 case 15:
401 return 30;
402 case 16:
403 return 22;
404 case 17:
405 return 21;
406 case 18:
407 return 24;
408 case 19:
409 return 26;
410 case 20:
411 return 28;
412 case 21:
413 return 31;
414 case 22:
415 return 32;
416 case 23:
417 return 33;
418 case 24:
419 return 34;
420 case 25:
421 return 35;
422 case 26:
423 return 36;
424 case 27:
425 return 37;
426 case 28:
427 return 38;
428 case 29:
429 return 39;
430 case 30:
431 return 40;
432 case 31:
433 return 41;
434 case 32:
435 return 42;
436 case 33:
437 return 43;
438 case 34:
439 return 44;
440 case 35:
441 return 55;
442 case 36:
443 return 56;
444 case 37:
445 return 57;
446 case 38:
447 return 58;
448 case 39:
449 return 59;
450 case 40:
451 return 60;
452 case 41:
453 return 61;
454 case 42:
455 return 47;
456 case 43:
457 return 49;
458 case 44:
459 return 51;
460 case 45:
461 return 54;
462 case 46:
463 return 53;
464 case 47:
465 this.begin("string");
466 break;
467 case 48:
468 this.popState();
469 break;
470 case 49:
471 return "qString";
472 case 50:
473 return a.yytext = a.yytext.trim(), 62;
474 }
475 },
476 rules: [/^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:(\r?\n)+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:$)/i, /^(?:requirementDiagram\b)/i, /^(?:\{)/i, /^(?:\})/i, /^(?::)/i, /^(?:id\b)/i, /^(?:text\b)/i, /^(?:risk\b)/i, /^(?:verifyMethod\b)/i, /^(?:requirement\b)/i, /^(?:functionalRequirement\b)/i, /^(?:interfaceRequirement\b)/i, /^(?:performanceRequirement\b)/i, /^(?:physicalRequirement\b)/i, /^(?:designConstraint\b)/i, /^(?:low\b)/i, /^(?:medium\b)/i, /^(?:high\b)/i, /^(?:analysis\b)/i, /^(?:demonstration\b)/i, /^(?:inspection\b)/i, /^(?:test\b)/i, /^(?:element\b)/i, /^(?:contains\b)/i, /^(?:copies\b)/i, /^(?:derives\b)/i, /^(?:satisfies\b)/i, /^(?:verifies\b)/i, /^(?:refines\b)/i, /^(?:traces\b)/i, /^(?:type\b)/i, /^(?:docref\b)/i, /^(?:<-)/i, /^(?:->)/i, /^(?:-)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[\w][^\r\n\{\<\>\-\=]*)/i],
477 conditions: { acc_descr_multiline: { rules: [6, 7], inclusive: !1 }, acc_descr: { rules: [4], inclusive: !1 }, acc_title: { rules: [2], inclusive: !1 }, unqString: { rules: [], inclusive: !1 }, token: { rules: [], inclusive: !1 }, string: { rules: [48, 49], inclusive: !1 }, INITIAL: { rules: [0, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 50], inclusive: !0 } }
478 };
479 return V;
480 }();
481 ie.lexer = ve;
482 function ne() {
483 this.yy = {};
484 }
485 return ne.prototype = ie, ie.Parser = ne, new ne();
486}();
487ce.parser = ce;
488const He = ce;
489let ue = [], b = {}, K = {}, q = {}, G = {};
490const We = {
491 REQUIREMENT: "Requirement",
492 FUNCTIONAL_REQUIREMENT: "Functional Requirement",
493 INTERFACE_REQUIREMENT: "Interface Requirement",
494 PERFORMANCE_REQUIREMENT: "Performance Requirement",
495 PHYSICAL_REQUIREMENT: "Physical Requirement",
496 DESIGN_CONSTRAINT: "Design Constraint"
497}, Ke = {
498 LOW_RISK: "Low",
499 MED_RISK: "Medium",
500 HIGH_RISK: "High"
501}, Ge = {
502 VERIFY_ANALYSIS: "Analysis",
503 VERIFY_DEMONSTRATION: "Demonstration",
504 VERIFY_INSPECTION: "Inspection",
505 VERIFY_TEST: "Test"
506}, je = {
507 CONTAINS: "contains",
508 COPIES: "copies",
509 DERIVES: "derives",
510 SATISFIES: "satisfies",
511 VERIFIES: "verifies",
512 REFINES: "refines",
513 TRACES: "traces"
514}, ze = (e, t) => (K[e] === void 0 && (K[e] = {
515 name: e,
516 type: t,
517 id: b.id,
518 text: b.text,
519 risk: b.risk,
520 verifyMethod: b.verifyMethod
521}), b = {}, K[e]), Xe = () => K, Je = (e) => {
522 b !== void 0 && (b.id = e);
523}, Ze = (e) => {
524 b !== void 0 && (b.text = e);
525}, et = (e) => {
526 b !== void 0 && (b.risk = e);
527}, tt = (e) => {
528 b !== void 0 && (b.verifyMethod = e);
529}, it = (e) => (G[e] === void 0 && (G[e] = {
530 name: e,
531 type: q.type,
532 docRef: q.docRef
533}, Ne.info("Added new requirement: ", e)), q = {}, G[e]), nt = () => G, rt = (e) => {
534 q !== void 0 && (q.type = e);
535}, st = (e) => {
536 q !== void 0 && (q.docRef = e);
537}, at = (e, t, l) => {
538 ue.push({
539 type: e,
540 src: t,
541 dst: l
542 });
543}, lt = () => ue, ot = () => {
544 ue = [], b = {}, K = {}, q = {}, G = {}, Pe();
545}, ct = {
546 RequirementType: We,
547 RiskLevel: Ke,
548 VerifyType: Ge,
549 Relationships: je,
550 getConfig: () => Te().req,
551 addRequirement: ze,
552 getRequirements: Xe,
553 setNewReqId: Je,
554 setNewReqText: Ze,
555 setNewReqRisk: et,
556 setNewReqVerifyMethod: tt,
557 setAccTitle: Ce,
558 getAccTitle: Fe,
559 setAccDescription: Me,
560 getAccDescription: De,
561 addElement: it,
562 getElements: nt,
563 setNewElementType: rt,
564 setNewElementDocRef: st,
565 addRelationship: at,
566 getRelationships: lt,
567 clear: ot
568}, ht = (e) => `
569
570 marker {
571 fill: ${e.relationColor};
572 stroke: ${e.relationColor};
573 }
574
575 marker.cross {
576 stroke: ${e.lineColor};
577 }
578
579 svg {
580 font-family: ${e.fontFamily};
581 font-size: ${e.fontSize};
582 }
583
584 .reqBox {
585 fill: ${e.requirementBackground};
586 fill-opacity: 1.0;
587 stroke: ${e.requirementBorderColor};
588 stroke-width: ${e.requirementBorderSize};
589 }
590
591 .reqTitle, .reqLabel{
592 fill: ${e.requirementTextColor};
593 }
594 .reqLabelBox {
595 fill: ${e.relationLabelBackground};
596 fill-opacity: 1.0;
597 }
598
599 .req-title-line {
600 stroke: ${e.requirementBorderColor};
601 stroke-width: ${e.requirementBorderSize};
602 }
603 .relationshipLine {
604 stroke: ${e.relationColor};
605 stroke-width: 1;
606 }
607 .relationshipLabel {
608 fill: ${e.relationLabelColor};
609 }
610
611`, ut = ht, he = {
612 CONTAINS: "contains",
613 ARROW: "arrow"
614}, dt = (e, t) => {
615 let l = e.append("defs").append("marker").attr("id", he.CONTAINS + "_line_ending").attr("refX", 0).attr("refY", t.line_height / 2).attr("markerWidth", t.line_height).attr("markerHeight", t.line_height).attr("orient", "auto").append("g");
616 l.append("circle").attr("cx", t.line_height / 2).attr("cy", t.line_height / 2).attr("r", t.line_height / 2).attr("fill", "none"), l.append("line").attr("x1", 0).attr("x2", t.line_height).attr("y1", t.line_height / 2).attr("y2", t.line_height / 2).attr("stroke-width", 1), l.append("line").attr("y1", 0).attr("y2", t.line_height).attr("x1", t.line_height / 2).attr("x2", t.line_height / 2).attr("stroke-width", 1), e.append("defs").append("marker").attr("id", he.ARROW + "_line_ending").attr("refX", t.line_height).attr("refY", 0.5 * t.line_height).attr("markerWidth", t.line_height).attr("markerHeight", t.line_height).attr("orient", "auto").append("path").attr(
617 "d",
618 `M0,0
619 L${t.line_height},${t.line_height / 2}
620 M${t.line_height},${t.line_height / 2}
621 L0,${t.line_height}`
622 ).attr("stroke-width", 1);
623}, xe = {
624 ReqMarkers: he,
625 insertLineEndings: dt
626};
627let y = {}, Se = 0;
628const Ae = (e, t) => e.insert("rect", "#" + t).attr("class", "req reqBox").attr("x", 0).attr("y", 0).attr("width", y.rect_min_width + "px").attr("height", y.rect_min_height + "px"), we = (e, t, l) => {
629 let c = y.rect_min_width / 2, u = e.append("text").attr("class", "req reqLabel reqTitle").attr("id", t).attr("x", c).attr("y", y.rect_padding).attr("dominant-baseline", "hanging"), d = 0;
630 l.forEach((E) => {
631 d == 0 ? u.append("tspan").attr("text-anchor", "middle").attr("x", y.rect_min_width / 2).attr("dy", 0).text(E) : u.append("tspan").attr("text-anchor", "middle").attr("x", y.rect_min_width / 2).attr("dy", y.line_height * 0.75).text(E), d++;
632 });
633 let f = 1.5 * y.rect_padding, h = d * y.line_height * 0.75, o = f + h;
634 return e.append("line").attr("class", "req-title-line").attr("x1", "0").attr("x2", y.rect_min_width).attr("y1", o).attr("y2", o), {
635 titleNode: u,
636 y: o
637 };
638}, $e = (e, t, l, c) => {
639 let u = e.append("text").attr("class", "req reqLabel").attr("id", t).attr("x", y.rect_padding).attr("y", c).attr("dominant-baseline", "hanging"), d = 0;
640 const f = 30;
641 let h = [];
642 return l.forEach((o) => {
643 let E = o.length;
644 for (; E > f && d < 3; ) {
645 let R = o.substring(0, f);
646 o = o.substring(f, o.length), E = o.length, h[h.length] = R, d++;
647 }
648 if (d == 3) {
649 let R = h[h.length - 1];
650 h[h.length - 1] = R.substring(0, R.length - 4) + "...";
651 } else
652 h[h.length] = o;
653 d = 0;
654 }), h.forEach((o) => {
655 u.append("tspan").attr("x", y.rect_padding).attr("dy", y.line_height).text(o);
656 }), u;
657}, ft = (e, t, l, c) => {
658 const u = t.node().getTotalLength(), d = t.node().getPointAtLength(u * 0.5), f = "rel" + Se;
659 Se++;
660 const o = e.append("text").attr("class", "req relationshipLabel").attr("id", f).attr("x", d.x).attr("y", d.y).attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(c).node().getBBox();
661 e.insert("rect", "#" + f).attr("class", "req reqLabelBox").attr("x", d.x - o.width / 2).attr("y", d.y - o.height / 2).attr("width", o.width).attr("height", o.height).attr("fill", "white").attr("fill-opacity", "85%");
662}, pt = function(e, t, l, c, u) {
663 const d = l.edge(H(t.src), H(t.dst)), f = Qe().x(function(o) {
664 return o.x;
665 }).y(function(o) {
666 return o.y;
667 }), h = e.insert("path", "#" + c).attr("class", "er relationshipLine").attr("d", f(d.points)).attr("fill", "none");
668 t.type == u.db.Relationships.CONTAINS ? h.attr(
669 "marker-start",
670 "url(" + ke.getUrl(y.arrowMarkerAbsolute) + "#" + t.type + "_line_ending)"
671 ) : (h.attr("stroke-dasharray", "10,7"), h.attr(
672 "marker-end",
673 "url(" + ke.getUrl(y.arrowMarkerAbsolute) + "#" + xe.ReqMarkers.ARROW + "_line_ending)"
674 )), ft(e, h, y, `<<${t.type}>>`);
675}, yt = (e, t, l) => {
676 Object.keys(e).forEach((c) => {
677 let u = e[c];
678 c = H(c), Ne.info("Added new requirement: ", c);
679 const d = l.append("g").attr("id", c), f = "req-" + c, h = Ae(d, f);
680 let o = we(d, c + "_title", [
681 `<<${u.type}>>`,
682 `${u.name}`
683 ]);
684 $e(
685 d,
686 c + "_body",
687 [
688 `Id: ${u.id}`,
689 `Text: ${u.text}`,
690 `Risk: ${u.risk}`,
691 `Verification: ${u.verifyMethod}`
692 ],
693 o.y
694 );
695 const E = h.node().getBBox();
696 t.setNode(c, {
697 width: E.width,
698 height: E.height,
699 shape: "rect",
700 id: c
701 });
702 });
703}, _t = (e, t, l) => {
704 Object.keys(e).forEach((c) => {
705 let u = e[c];
706 const d = H(c), f = l.append("g").attr("id", d), h = "element-" + d, o = Ae(f, h);
707 let E = we(f, h + "_title", ["<<Element>>", `${c}`]);
708 $e(
709 f,
710 h + "_body",
711 [`Type: ${u.type || "Not Specified"}`, `Doc Ref: ${u.docRef || "None"}`],
712 E.y
713 );
714 const R = o.node().getBBox();
715 t.setNode(d, {
716 width: R.width,
717 height: R.height,
718 shape: "rect",
719 id: d
720 });
721 });
722}, Et = (e, t) => (e.forEach(function(l) {
723 let c = H(l.src), u = H(l.dst);
724 t.setEdge(c, u, { relationship: l });
725}), e), gt = function(e, t) {
726 t.nodes().forEach(function(l) {
727 l !== void 0 && t.node(l) !== void 0 && (e.select("#" + l), e.select("#" + l).attr(
728 "transform",
729 "translate(" + (t.node(l).x - t.node(l).width / 2) + "," + (t.node(l).y - t.node(l).height / 2) + " )"
730 ));
731 });
732}, H = (e) => e.replace(/\s/g, "").replace(/\./g, "_"), Rt = (e, t, l, c) => {
733 y = Te().requirement;
734 const u = y.securityLevel;
735 let d;
736 u === "sandbox" && (d = oe("#i" + t));
737 const h = (u === "sandbox" ? oe(d.nodes()[0].contentDocument.body) : oe("body")).select(`[id='${t}']`);
738 xe.insertLineEndings(h, y);
739 const o = new Ue({
740 multigraph: !1,
741 compound: !1,
742 directed: !0
743 }).setGraph({
744 rankdir: y.layoutDirection,
745 marginx: 20,
746 marginy: 20,
747 nodesep: 100,
748 edgesep: 100,
749 ranksep: 100
750 }).setDefaultEdgeLabel(function() {
751 return {};
752 });
753 let E = c.db.getRequirements(), R = c.db.getElements(), A = c.db.getRelationships();
754 yt(E, o, h), _t(R, o, h), Et(A, o), Be(o), gt(h, o), A.forEach(function(x) {
755 pt(h, x, o, t, c);
756 });
757 const T = y.rect_padding, N = h.node().getBBox(), w = N.width + T * 2, k = N.height + T * 2;
758 Ye(h, k, w, y.useMaxWidth), h.attr("viewBox", `${N.x - T} ${N.y - T} ${w} ${k}`);
759}, mt = {
760 draw: Rt
761}, xt = {
762 parser: He,
763 db: ct,
764 renderer: mt,
765 styles: ut
766};
767export {
768 xt as diagram
769};
770
\No newline at end of file