UNPKG

43.9 kBJavaScriptView Raw
1import { c as V, s as xt, g as Rt, b as Ot, a as bt, z as Nt, A as Tt, m as At, l as et, B as Mt, j as st, x as vt, k as Dt, D as wt, E as It } from "./mermaid-9357f3d0.js";
2import { G as St, l as Lt } from "./layout-816c0a3e.js";
3import { l as Bt } from "./line-a77fdd5a.js";
4import "./array-2ff2c7a6.js";
5import "./constant-2fe7eae5.js";
6var ct = function() {
7 var t = function(M, a, l, d) {
8 for (l = l || {}, d = M.length; d--; l[M[d]] = a)
9 ;
10 return l;
11 }, r = [1, 2], e = [1, 5], n = [6, 9, 11, 23, 25, 27, 29, 30, 31, 52], s = [1, 17], p = [1, 18], f = [1, 19], o = [1, 20], c = [1, 21], _ = [1, 22], E = [1, 25], g = [1, 30], O = [1, 31], y = [1, 32], A = [1, 33], Y = [1, 34], U = [6, 9, 11, 15, 20, 23, 25, 27, 29, 30, 31, 44, 45, 46, 47, 48, 52], X = [1, 46], I = [30, 31, 49, 50], N = [4, 6, 9, 11, 23, 25, 27, 29, 30, 31, 52], v = [44, 45, 46, 47, 48], k = [22, 37], x = [1, 66], P = [1, 65], Z = [22, 37, 39, 41], w = {
12 trace: function() {
13 },
14 yy: {},
15 symbols_: { error: 2, start: 3, ER_DIAGRAM: 4, document: 5, EOF: 6, directive: 7, line: 8, SPACE: 9, statement: 10, NEWLINE: 11, openDirective: 12, typeDirective: 13, closeDirective: 14, ":": 15, argDirective: 16, entityName: 17, relSpec: 18, role: 19, BLOCK_START: 20, attributes: 21, BLOCK_STOP: 22, title: 23, title_value: 24, acc_title: 25, acc_title_value: 26, acc_descr: 27, acc_descr_value: 28, acc_descr_multiline_value: 29, ALPHANUM: 30, ENTITY_NAME: 31, attribute: 32, attributeType: 33, attributeName: 34, attributeKeyTypeList: 35, attributeComment: 36, ATTRIBUTE_WORD: 37, attributeKeyType: 38, COMMA: 39, ATTRIBUTE_KEY: 40, COMMENT: 41, cardinality: 42, relType: 43, ZERO_OR_ONE: 44, ZERO_OR_MORE: 45, ONE_OR_MORE: 46, ONLY_ONE: 47, MD_PARENT: 48, NON_IDENTIFYING: 49, IDENTIFYING: 50, WORD: 51, open_directive: 52, type_directive: 53, arg_directive: 54, close_directive: 55, $accept: 0, $end: 1 },
16 terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 9: "SPACE", 11: "NEWLINE", 15: ":", 20: "BLOCK_START", 22: "BLOCK_STOP", 23: "title", 24: "title_value", 25: "acc_title", 26: "acc_title_value", 27: "acc_descr", 28: "acc_descr_value", 29: "acc_descr_multiline_value", 30: "ALPHANUM", 31: "ENTITY_NAME", 37: "ATTRIBUTE_WORD", 39: "COMMA", 40: "ATTRIBUTE_KEY", 41: "COMMENT", 44: "ZERO_OR_ONE", 45: "ZERO_OR_MORE", 46: "ONE_OR_MORE", 47: "ONLY_ONE", 48: "MD_PARENT", 49: "NON_IDENTIFYING", 50: "IDENTIFYING", 51: "WORD", 52: "open_directive", 53: "type_directive", 54: "arg_directive", 55: "close_directive" },
17 productions_: [0, [3, 3], [3, 2], [5, 0], [5, 2], [8, 2], [8, 1], [8, 1], [8, 1], [7, 4], [7, 6], [10, 1], [10, 5], [10, 4], [10, 3], [10, 1], [10, 2], [10, 2], [10, 2], [10, 1], [17, 1], [17, 1], [21, 1], [21, 2], [32, 2], [32, 3], [32, 3], [32, 4], [33, 1], [34, 1], [35, 1], [35, 3], [38, 1], [36, 1], [18, 3], [42, 1], [42, 1], [42, 1], [42, 1], [42, 1], [43, 1], [43, 1], [19, 1], [19, 1], [19, 1], [12, 1], [13, 1], [16, 1], [14, 1]],
18 performAction: function(a, l, d, u, m, i, Q) {
19 var h = i.length - 1;
20 switch (m) {
21 case 1:
22 break;
23 case 3:
24 this.$ = [];
25 break;
26 case 4:
27 i[h - 1].push(i[h]), this.$ = i[h - 1];
28 break;
29 case 5:
30 case 6:
31 this.$ = i[h];
32 break;
33 case 7:
34 case 8:
35 this.$ = [];
36 break;
37 case 12:
38 u.addEntity(i[h - 4]), u.addEntity(i[h - 2]), u.addRelationship(i[h - 4], i[h], i[h - 2], i[h - 3]);
39 break;
40 case 13:
41 u.addEntity(i[h - 3]), u.addAttributes(i[h - 3], i[h - 1]);
42 break;
43 case 14:
44 u.addEntity(i[h - 2]);
45 break;
46 case 15:
47 u.addEntity(i[h]);
48 break;
49 case 16:
50 case 17:
51 this.$ = i[h].trim(), u.setAccTitle(this.$);
52 break;
53 case 18:
54 case 19:
55 this.$ = i[h].trim(), u.setAccDescription(this.$);
56 break;
57 case 20:
58 case 44:
59 this.$ = i[h];
60 break;
61 case 21:
62 case 42:
63 case 43:
64 this.$ = i[h].replace(/"/g, "");
65 break;
66 case 22:
67 case 30:
68 this.$ = [i[h]];
69 break;
70 case 23:
71 i[h].push(i[h - 1]), this.$ = i[h];
72 break;
73 case 24:
74 this.$ = { attributeType: i[h - 1], attributeName: i[h] };
75 break;
76 case 25:
77 this.$ = { attributeType: i[h - 2], attributeName: i[h - 1], attributeKeyTypeList: i[h] };
78 break;
79 case 26:
80 this.$ = { attributeType: i[h - 2], attributeName: i[h - 1], attributeComment: i[h] };
81 break;
82 case 27:
83 this.$ = { attributeType: i[h - 3], attributeName: i[h - 2], attributeKeyTypeList: i[h - 1], attributeComment: i[h] };
84 break;
85 case 28:
86 case 29:
87 case 32:
88 this.$ = i[h];
89 break;
90 case 31:
91 i[h - 2].push(i[h]), this.$ = i[h - 2];
92 break;
93 case 33:
94 this.$ = i[h].replace(/"/g, "");
95 break;
96 case 34:
97 this.$ = { cardA: i[h], relType: i[h - 1], cardB: i[h - 2] };
98 break;
99 case 35:
100 this.$ = u.Cardinality.ZERO_OR_ONE;
101 break;
102 case 36:
103 this.$ = u.Cardinality.ZERO_OR_MORE;
104 break;
105 case 37:
106 this.$ = u.Cardinality.ONE_OR_MORE;
107 break;
108 case 38:
109 this.$ = u.Cardinality.ONLY_ONE;
110 break;
111 case 39:
112 this.$ = u.Cardinality.MD_PARENT;
113 break;
114 case 40:
115 this.$ = u.Identification.NON_IDENTIFYING;
116 break;
117 case 41:
118 this.$ = u.Identification.IDENTIFYING;
119 break;
120 case 45:
121 u.parseDirective("%%{", "open_directive");
122 break;
123 case 46:
124 u.parseDirective(i[h], "type_directive");
125 break;
126 case 47:
127 i[h] = i[h].trim().replace(/'/g, '"'), u.parseDirective(i[h], "arg_directive");
128 break;
129 case 48:
130 u.parseDirective("}%%", "close_directive", "er");
131 break;
132 }
133 },
134 table: [{ 3: 1, 4: r, 7: 3, 12: 4, 52: e }, { 1: [3] }, t(n, [2, 3], { 5: 6 }), { 3: 7, 4: r, 7: 3, 12: 4, 52: e }, { 13: 8, 53: [1, 9] }, { 53: [2, 45] }, { 6: [1, 10], 7: 15, 8: 11, 9: [1, 12], 10: 13, 11: [1, 14], 12: 4, 17: 16, 23: s, 25: p, 27: f, 29: o, 30: c, 31: _, 52: e }, { 1: [2, 2] }, { 14: 23, 15: [1, 24], 55: E }, t([15, 55], [2, 46]), t(n, [2, 8], { 1: [2, 1] }), t(n, [2, 4]), { 7: 15, 10: 26, 12: 4, 17: 16, 23: s, 25: p, 27: f, 29: o, 30: c, 31: _, 52: e }, t(n, [2, 6]), t(n, [2, 7]), t(n, [2, 11]), t(n, [2, 15], { 18: 27, 42: 29, 20: [1, 28], 44: g, 45: O, 46: y, 47: A, 48: Y }), { 24: [1, 35] }, { 26: [1, 36] }, { 28: [1, 37] }, t(n, [2, 19]), t(U, [2, 20]), t(U, [2, 21]), { 11: [1, 38] }, { 16: 39, 54: [1, 40] }, { 11: [2, 48] }, t(n, [2, 5]), { 17: 41, 30: c, 31: _ }, { 21: 42, 22: [1, 43], 32: 44, 33: 45, 37: X }, { 43: 47, 49: [1, 48], 50: [1, 49] }, t(I, [2, 35]), t(I, [2, 36]), t(I, [2, 37]), t(I, [2, 38]), t(I, [2, 39]), t(n, [2, 16]), t(n, [2, 17]), t(n, [2, 18]), t(N, [2, 9]), { 14: 50, 55: E }, { 55: [2, 47] }, { 15: [1, 51] }, { 22: [1, 52] }, t(n, [2, 14]), { 21: 53, 22: [2, 22], 32: 44, 33: 45, 37: X }, { 34: 54, 37: [1, 55] }, { 37: [2, 28] }, { 42: 56, 44: g, 45: O, 46: y, 47: A, 48: Y }, t(v, [2, 40]), t(v, [2, 41]), { 11: [1, 57] }, { 19: 58, 30: [1, 61], 31: [1, 60], 51: [1, 59] }, t(n, [2, 13]), { 22: [2, 23] }, t(k, [2, 24], { 35: 62, 36: 63, 38: 64, 40: x, 41: P }), t([22, 37, 40, 41], [2, 29]), t([30, 31], [2, 34]), t(N, [2, 10]), t(n, [2, 12]), t(n, [2, 42]), t(n, [2, 43]), t(n, [2, 44]), t(k, [2, 25], { 36: 67, 39: [1, 68], 41: P }), t(k, [2, 26]), t(Z, [2, 30]), t(k, [2, 33]), t(Z, [2, 32]), t(k, [2, 27]), { 38: 69, 40: x }, t(Z, [2, 31])],
135 defaultActions: { 5: [2, 45], 7: [2, 2], 25: [2, 48], 40: [2, 47], 46: [2, 28], 53: [2, 23] },
136 parseError: function(a, l) {
137 if (l.recoverable)
138 this.trace(a);
139 else {
140 var d = new Error(a);
141 throw d.hash = l, d;
142 }
143 },
144 parse: function(a) {
145 var l = this, d = [0], u = [], m = [null], i = [], Q = this.table, h = "", J = 0, ht = 0, Et = 2, dt = 1, mt = i.slice.call(arguments, 1), b = Object.create(this.lexer), H = { yy: {} };
146 for (var rt in this.yy)
147 Object.prototype.hasOwnProperty.call(this.yy, rt) && (H.yy[rt] = this.yy[rt]);
148 b.setInput(a, H.yy), H.yy.lexer = b, H.yy.parser = this, typeof b.yylloc > "u" && (b.yylloc = {});
149 var it = b.yylloc;
150 i.push(it);
151 var gt = b.options && b.options.ranges;
152 typeof H.yy.parseError == "function" ? this.parseError = H.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
153 function kt() {
154 var W;
155 return W = u.pop() || b.lex() || dt, typeof W != "number" && (W instanceof Array && (u = W, W = u.pop()), W = l.symbols_[W] || W), W;
156 }
157 for (var D, G, L, at, K = {}, $, F, ut, tt; ; ) {
158 if (G = d[d.length - 1], this.defaultActions[G] ? L = this.defaultActions[G] : ((D === null || typeof D > "u") && (D = kt()), L = Q[G] && Q[G][D]), typeof L > "u" || !L.length || !L[0]) {
159 var nt = "";
160 tt = [];
161 for ($ in Q[G])
162 this.terminals_[$] && $ > Et && tt.push("'" + this.terminals_[$] + "'");
163 b.showPosition ? nt = "Parse error on line " + (J + 1) + `:
164` + b.showPosition() + `
165Expecting ` + tt.join(", ") + ", got '" + (this.terminals_[D] || D) + "'" : nt = "Parse error on line " + (J + 1) + ": Unexpected " + (D == dt ? "end of input" : "'" + (this.terminals_[D] || D) + "'"), this.parseError(nt, {
166 text: b.match,
167 token: this.terminals_[D] || D,
168 line: b.yylineno,
169 loc: it,
170 expected: tt
171 });
172 }
173 if (L[0] instanceof Array && L.length > 1)
174 throw new Error("Parse Error: multiple actions possible at state: " + G + ", token: " + D);
175 switch (L[0]) {
176 case 1:
177 d.push(D), m.push(b.yytext), i.push(b.yylloc), d.push(L[1]), D = null, ht = b.yyleng, h = b.yytext, J = b.yylineno, it = b.yylloc;
178 break;
179 case 2:
180 if (F = this.productions_[L[1]][1], K.$ = m[m.length - F], K._$ = {
181 first_line: i[i.length - (F || 1)].first_line,
182 last_line: i[i.length - 1].last_line,
183 first_column: i[i.length - (F || 1)].first_column,
184 last_column: i[i.length - 1].last_column
185 }, gt && (K._$.range = [
186 i[i.length - (F || 1)].range[0],
187 i[i.length - 1].range[1]
188 ]), at = this.performAction.apply(K, [
189 h,
190 ht,
191 J,
192 H.yy,
193 L[1],
194 m,
195 i
196 ].concat(mt)), typeof at < "u")
197 return at;
198 F && (d = d.slice(0, -1 * F * 2), m = m.slice(0, -1 * F), i = i.slice(0, -1 * F)), d.push(this.productions_[L[1]][0]), m.push(K.$), i.push(K._$), ut = Q[d[d.length - 2]][d[d.length - 1]], d.push(ut);
199 break;
200 case 3:
201 return !0;
202 }
203 }
204 return !0;
205 }
206 }, z = function() {
207 var M = {
208 EOF: 1,
209 parseError: function(l, d) {
210 if (this.yy.parser)
211 this.yy.parser.parseError(l, d);
212 else
213 throw new Error(l);
214 },
215 // resets the lexer, sets new input
216 setInput: function(a, l) {
217 return this.yy = l || this.yy || {}, this._input = a, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
218 first_line: 1,
219 first_column: 0,
220 last_line: 1,
221 last_column: 0
222 }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
223 },
224 // consumes and returns one char from the input
225 input: function() {
226 var a = this._input[0];
227 this.yytext += a, this.yyleng++, this.offset++, this.match += a, this.matched += a;
228 var l = a.match(/(?:\r\n?|\n).*/g);
229 return l ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), a;
230 },
231 // unshifts one char (or a string) into the input
232 unput: function(a) {
233 var l = a.length, d = a.split(/(?:\r\n?|\n)/g);
234 this._input = a + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - l), this.offset -= l;
235 var u = this.match.split(/(?:\r\n?|\n)/g);
236 this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), d.length - 1 && (this.yylineno -= d.length - 1);
237 var m = this.yylloc.range;
238 return this.yylloc = {
239 first_line: this.yylloc.first_line,
240 last_line: this.yylineno + 1,
241 first_column: this.yylloc.first_column,
242 last_column: d ? (d.length === u.length ? this.yylloc.first_column : 0) + u[u.length - d.length].length - d[0].length : this.yylloc.first_column - l
243 }, this.options.ranges && (this.yylloc.range = [m[0], m[0] + this.yyleng - l]), this.yyleng = this.yytext.length, this;
244 },
245 // When called from action, caches matched text and appends it on next action
246 more: function() {
247 return this._more = !0, this;
248 },
249 // 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.
250 reject: function() {
251 if (this.options.backtrack_lexer)
252 this._backtrack = !0;
253 else
254 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).
255` + this.showPosition(), {
256 text: "",
257 token: null,
258 line: this.yylineno
259 });
260 return this;
261 },
262 // retain first n characters of the match
263 less: function(a) {
264 this.unput(this.match.slice(a));
265 },
266 // displays already matched input, i.e. for error messages
267 pastInput: function() {
268 var a = this.matched.substr(0, this.matched.length - this.match.length);
269 return (a.length > 20 ? "..." : "") + a.substr(-20).replace(/\n/g, "");
270 },
271 // displays upcoming input, i.e. for error messages
272 upcomingInput: function() {
273 var a = this.match;
274 return a.length < 20 && (a += this._input.substr(0, 20 - a.length)), (a.substr(0, 20) + (a.length > 20 ? "..." : "")).replace(/\n/g, "");
275 },
276 // displays the character position where the lexing error occurred, i.e. for error messages
277 showPosition: function() {
278 var a = this.pastInput(), l = new Array(a.length + 1).join("-");
279 return a + this.upcomingInput() + `
280` + l + "^";
281 },
282 // test the lexed token: return FALSE when not a match, otherwise return token
283 test_match: function(a, l) {
284 var d, u, m;
285 if (this.options.backtrack_lexer && (m = {
286 yylineno: this.yylineno,
287 yylloc: {
288 first_line: this.yylloc.first_line,
289 last_line: this.last_line,
290 first_column: this.yylloc.first_column,
291 last_column: this.yylloc.last_column
292 },
293 yytext: this.yytext,
294 match: this.match,
295 matches: this.matches,
296 matched: this.matched,
297 yyleng: this.yyleng,
298 offset: this.offset,
299 _more: this._more,
300 _input: this._input,
301 yy: this.yy,
302 conditionStack: this.conditionStack.slice(0),
303 done: this.done
304 }, this.options.ranges && (m.yylloc.range = this.yylloc.range.slice(0))), u = a[0].match(/(?:\r\n?|\n).*/g), u && (this.yylineno += u.length), this.yylloc = {
305 first_line: this.yylloc.last_line,
306 last_line: this.yylineno + 1,
307 first_column: this.yylloc.last_column,
308 last_column: u ? u[u.length - 1].length - u[u.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + a[0].length
309 }, this.yytext += a[0], this.match += a[0], this.matches = a, 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(a[0].length), this.matched += a[0], d = this.performAction.call(this, this.yy, this, l, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), d)
310 return d;
311 if (this._backtrack) {
312 for (var i in m)
313 this[i] = m[i];
314 return !1;
315 }
316 return !1;
317 },
318 // return next match in input
319 next: function() {
320 if (this.done)
321 return this.EOF;
322 this._input || (this.done = !0);
323 var a, l, d, u;
324 this._more || (this.yytext = "", this.match = "");
325 for (var m = this._currentRules(), i = 0; i < m.length; i++)
326 if (d = this._input.match(this.rules[m[i]]), d && (!l || d[0].length > l[0].length)) {
327 if (l = d, u = i, this.options.backtrack_lexer) {
328 if (a = this.test_match(d, m[i]), a !== !1)
329 return a;
330 if (this._backtrack) {
331 l = !1;
332 continue;
333 } else
334 return !1;
335 } else if (!this.options.flex)
336 break;
337 }
338 return l ? (a = this.test_match(l, m[u]), a !== !1 ? a : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
339` + this.showPosition(), {
340 text: "",
341 token: null,
342 line: this.yylineno
343 });
344 },
345 // return next match that has a token
346 lex: function() {
347 var l = this.next();
348 return l || this.lex();
349 },
350 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
351 begin: function(l) {
352 this.conditionStack.push(l);
353 },
354 // pop the previously active lexer condition state off the condition stack
355 popState: function() {
356 var l = this.conditionStack.length - 1;
357 return l > 0 ? this.conditionStack.pop() : this.conditionStack[0];
358 },
359 // produce the lexer rule set which is active for the currently active lexer condition state
360 _currentRules: function() {
361 return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
362 },
363 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
364 topState: function(l) {
365 return l = this.conditionStack.length - 1 - Math.abs(l || 0), l >= 0 ? this.conditionStack[l] : "INITIAL";
366 },
367 // alias for begin(condition)
368 pushState: function(l) {
369 this.begin(l);
370 },
371 // return the number of states currently on the stack
372 stateStackSize: function() {
373 return this.conditionStack.length;
374 },
375 options: { "case-insensitive": !0 },
376 performAction: function(l, d, u, m) {
377 switch (u) {
378 case 0:
379 return this.begin("acc_title"), 25;
380 case 1:
381 return this.popState(), "acc_title_value";
382 case 2:
383 return this.begin("acc_descr"), 27;
384 case 3:
385 return this.popState(), "acc_descr_value";
386 case 4:
387 this.begin("acc_descr_multiline");
388 break;
389 case 5:
390 this.popState();
391 break;
392 case 6:
393 return "acc_descr_multiline_value";
394 case 7:
395 return this.begin("open_directive"), 52;
396 case 8:
397 return this.begin("type_directive"), 53;
398 case 9:
399 return this.popState(), this.begin("arg_directive"), 15;
400 case 10:
401 return this.popState(), this.popState(), 55;
402 case 11:
403 return 54;
404 case 12:
405 return 11;
406 case 13:
407 break;
408 case 14:
409 return 9;
410 case 15:
411 return 31;
412 case 16:
413 return 51;
414 case 17:
415 return 4;
416 case 18:
417 return this.begin("block"), 20;
418 case 19:
419 return 39;
420 case 20:
421 break;
422 case 21:
423 return 40;
424 case 22:
425 return 37;
426 case 23:
427 return 37;
428 case 24:
429 return 41;
430 case 25:
431 break;
432 case 26:
433 return this.popState(), 22;
434 case 27:
435 return d.yytext[0];
436 case 28:
437 return 44;
438 case 29:
439 return 46;
440 case 30:
441 return 46;
442 case 31:
443 return 46;
444 case 32:
445 return 44;
446 case 33:
447 return 44;
448 case 34:
449 return 45;
450 case 35:
451 return 45;
452 case 36:
453 return 45;
454 case 37:
455 return 45;
456 case 38:
457 return 45;
458 case 39:
459 return 46;
460 case 40:
461 return 45;
462 case 41:
463 return 46;
464 case 42:
465 return 47;
466 case 43:
467 return 47;
468 case 44:
469 return 47;
470 case 45:
471 return 47;
472 case 46:
473 return 44;
474 case 47:
475 return 45;
476 case 48:
477 return 46;
478 case 49:
479 return 48;
480 case 50:
481 return 49;
482 case 51:
483 return 50;
484 case 52:
485 return 50;
486 case 53:
487 return 49;
488 case 54:
489 return 49;
490 case 55:
491 return 49;
492 case 56:
493 return 30;
494 case 57:
495 return d.yytext[0];
496 case 58:
497 return 6;
498 }
499 },
500 rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:%%\{)/i, /^(?:((?:(?!\}%%)[^:.])*))/i, /^(?::)/i, /^(?:\}%%)/i, /^(?:((?:(?!\}%%).|\n)*))/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:,)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:(.*?)[~](.*?)*[~])/i, /^(?:[A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:1\b)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:\s*u\b)/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:[A-Za-z][A-Za-z0-9\-_]*)/i, /^(?:.)/i, /^(?:$)/i],
501 conditions: { acc_descr_multiline: { rules: [5, 6], inclusive: !1 }, acc_descr: { rules: [3], inclusive: !1 }, acc_title: { rules: [1], inclusive: !1 }, open_directive: { rules: [8], inclusive: !1 }, type_directive: { rules: [9, 10], inclusive: !1 }, arg_directive: { rules: [10, 11], inclusive: !1 }, block: { rules: [19, 20, 21, 22, 23, 24, 25, 26, 27], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 12, 13, 14, 15, 16, 17, 18, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58], inclusive: !0 } }
502 };
503 return M;
504 }();
505 w.lexer = z;
506 function S() {
507 this.yy = {};
508 }
509 return S.prototype = w, w.Parser = S, new S();
510}();
511ct.parser = ct;
512const Ct = ct;
513let j = {}, lt = [];
514const Pt = {
515 ZERO_OR_ONE: "ZERO_OR_ONE",
516 ZERO_OR_MORE: "ZERO_OR_MORE",
517 ONE_OR_MORE: "ONE_OR_MORE",
518 ONLY_ONE: "ONLY_ONE",
519 MD_PARENT: "MD_PARENT"
520}, Yt = {
521 NON_IDENTIFYING: "NON_IDENTIFYING",
522 IDENTIFYING: "IDENTIFYING"
523}, Zt = function(t, r, e) {
524 At.parseDirective(this, t, r, e);
525}, pt = function(t) {
526 return j[t] === void 0 && (j[t] = { attributes: [] }, et.info("Added new entity :", t)), j[t];
527}, Ft = () => j, Wt = function(t, r) {
528 let e = pt(t), n;
529 for (n = r.length - 1; n >= 0; n--)
530 e.attributes.push(r[n]), et.debug("Added attribute ", r[n].attributeName);
531}, Vt = function(t, r, e, n) {
532 let s = {
533 entityA: t,
534 roleA: r,
535 entityB: e,
536 relSpec: n
537 };
538 lt.push(s), et.debug("Added new relationship :", s);
539}, Ut = () => lt, zt = function() {
540 j = {}, lt = [], Mt();
541}, Ht = {
542 Cardinality: Pt,
543 Identification: Yt,
544 parseDirective: Zt,
545 getConfig: () => V().er,
546 addEntity: pt,
547 addAttributes: Wt,
548 getEntities: Ft,
549 addRelationship: Vt,
550 getRelationships: Ut,
551 clear: zt,
552 setAccTitle: xt,
553 getAccTitle: Rt,
554 setAccDescription: Ot,
555 getAccDescription: bt,
556 setDiagramTitle: Nt,
557 getDiagramTitle: Tt
558}, B = {
559 ONLY_ONE_START: "ONLY_ONE_START",
560 ONLY_ONE_END: "ONLY_ONE_END",
561 ZERO_OR_ONE_START: "ZERO_OR_ONE_START",
562 ZERO_OR_ONE_END: "ZERO_OR_ONE_END",
563 ONE_OR_MORE_START: "ONE_OR_MORE_START",
564 ONE_OR_MORE_END: "ONE_OR_MORE_END",
565 ZERO_OR_MORE_START: "ZERO_OR_MORE_START",
566 ZERO_OR_MORE_END: "ZERO_OR_MORE_END",
567 MD_PARENT_END: "MD_PARENT_END",
568 MD_PARENT_START: "MD_PARENT_START"
569}, Gt = function(t, r) {
570 let e;
571 t.append("defs").append("marker").attr("id", B.MD_PARENT_START).attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", B.MD_PARENT_END).attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", B.ONLY_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M9,0 L9,18 M15,0 L15,18"), t.append("defs").append("marker").attr("id", B.ONLY_ONE_END).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M3,0 L3,18 M9,0 L9,18"), e = t.append("defs").append("marker").attr("id", B.ZERO_OR_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), e.append("circle").attr("stroke", r.stroke).attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6), e.append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M9,0 L9,18"), e = t.append("defs").append("marker").attr("id", B.ZERO_OR_ONE_END).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), e.append("circle").attr("stroke", r.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6), e.append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M21,0 L21,18"), t.append("defs").append("marker").attr("id", B.ONE_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"), t.append("defs").append("marker").attr("id", B.ONE_OR_MORE_END).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18"), e = t.append("defs").append("marker").attr("id", B.ZERO_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), e.append("circle").attr("stroke", r.stroke).attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6), e.append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18"), e = t.append("defs").append("marker").attr("id", B.ZERO_OR_MORE_END).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), e.append("circle").attr("stroke", r.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6), e.append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
572}, C = {
573 ERMarkers: B,
574 insertMarkers: Gt
575}, Kt = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
576function Xt(t) {
577 return typeof t == "string" && Kt.test(t);
578}
579const T = [];
580for (let t = 0; t < 256; ++t)
581 T.push((t + 256).toString(16).slice(1));
582function Qt(t, r = 0) {
583 return (T[t[r + 0]] + T[t[r + 1]] + T[t[r + 2]] + T[t[r + 3]] + "-" + T[t[r + 4]] + T[t[r + 5]] + "-" + T[t[r + 6]] + T[t[r + 7]] + "-" + T[t[r + 8]] + T[t[r + 9]] + "-" + T[t[r + 10]] + T[t[r + 11]] + T[t[r + 12]] + T[t[r + 13]] + T[t[r + 14]] + T[t[r + 15]]).toLowerCase();
584}
585function jt(t) {
586 if (!Xt(t))
587 throw TypeError("Invalid UUID");
588 let r;
589 const e = new Uint8Array(16);
590 return e[0] = (r = parseInt(t.slice(0, 8), 16)) >>> 24, e[1] = r >>> 16 & 255, e[2] = r >>> 8 & 255, e[3] = r & 255, e[4] = (r = parseInt(t.slice(9, 13), 16)) >>> 8, e[5] = r & 255, e[6] = (r = parseInt(t.slice(14, 18), 16)) >>> 8, e[7] = r & 255, e[8] = (r = parseInt(t.slice(19, 23), 16)) >>> 8, e[9] = r & 255, e[10] = (r = parseInt(t.slice(24, 36), 16)) / 1099511627776 & 255, e[11] = r / 4294967296 & 255, e[12] = r >>> 24 & 255, e[13] = r >>> 16 & 255, e[14] = r >>> 8 & 255, e[15] = r & 255, e;
591}
592function qt(t) {
593 t = unescape(encodeURIComponent(t));
594 const r = [];
595 for (let e = 0; e < t.length; ++e)
596 r.push(t.charCodeAt(e));
597 return r;
598}
599const Jt = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", $t = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
600function te(t, r, e) {
601 function n(s, p, f, o) {
602 var c;
603 if (typeof s == "string" && (s = qt(s)), typeof p == "string" && (p = jt(p)), ((c = p) === null || c === void 0 ? void 0 : c.length) !== 16)
604 throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
605 let _ = new Uint8Array(16 + s.length);
606 if (_.set(p), _.set(s, p.length), _ = e(_), _[6] = _[6] & 15 | r, _[8] = _[8] & 63 | 128, f) {
607 o = o || 0;
608 for (let E = 0; E < 16; ++E)
609 f[o + E] = _[E];
610 return f;
611 }
612 return Qt(_);
613 }
614 try {
615 n.name = t;
616 } catch {
617 }
618 return n.DNS = Jt, n.URL = $t, n;
619}
620function ee(t, r, e, n) {
621 switch (t) {
622 case 0:
623 return r & e ^ ~r & n;
624 case 1:
625 return r ^ e ^ n;
626 case 2:
627 return r & e ^ r & n ^ e & n;
628 case 3:
629 return r ^ e ^ n;
630 }
631}
632function ot(t, r) {
633 return t << r | t >>> 32 - r;
634}
635function re(t) {
636 const r = [1518500249, 1859775393, 2400959708, 3395469782], e = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
637 if (typeof t == "string") {
638 const f = unescape(encodeURIComponent(t));
639 t = [];
640 for (let o = 0; o < f.length; ++o)
641 t.push(f.charCodeAt(o));
642 } else
643 Array.isArray(t) || (t = Array.prototype.slice.call(t));
644 t.push(128);
645 const n = t.length / 4 + 2, s = Math.ceil(n / 16), p = new Array(s);
646 for (let f = 0; f < s; ++f) {
647 const o = new Uint32Array(16);
648 for (let c = 0; c < 16; ++c)
649 o[c] = t[f * 64 + c * 4] << 24 | t[f * 64 + c * 4 + 1] << 16 | t[f * 64 + c * 4 + 2] << 8 | t[f * 64 + c * 4 + 3];
650 p[f] = o;
651 }
652 p[s - 1][14] = (t.length - 1) * 8 / Math.pow(2, 32), p[s - 1][14] = Math.floor(p[s - 1][14]), p[s - 1][15] = (t.length - 1) * 8 & 4294967295;
653 for (let f = 0; f < s; ++f) {
654 const o = new Uint32Array(80);
655 for (let y = 0; y < 16; ++y)
656 o[y] = p[f][y];
657 for (let y = 16; y < 80; ++y)
658 o[y] = ot(o[y - 3] ^ o[y - 8] ^ o[y - 14] ^ o[y - 16], 1);
659 let c = e[0], _ = e[1], E = e[2], g = e[3], O = e[4];
660 for (let y = 0; y < 80; ++y) {
661 const A = Math.floor(y / 20), Y = ot(c, 5) + ee(A, _, E, g) + O + r[A] + o[y] >>> 0;
662 O = g, g = E, E = ot(_, 30) >>> 0, _ = c, c = Y;
663 }
664 e[0] = e[0] + c >>> 0, e[1] = e[1] + _ >>> 0, e[2] = e[2] + E >>> 0, e[3] = e[3] + g >>> 0, e[4] = e[4] + O >>> 0;
665 }
666 return [e[0] >> 24 & 255, e[0] >> 16 & 255, e[0] >> 8 & 255, e[0] & 255, e[1] >> 24 & 255, e[1] >> 16 & 255, e[1] >> 8 & 255, e[1] & 255, e[2] >> 24 & 255, e[2] >> 16 & 255, e[2] >> 8 & 255, e[2] & 255, e[3] >> 24 & 255, e[3] >> 16 & 255, e[3] >> 8 & 255, e[3] & 255, e[4] >> 24 & 255, e[4] >> 16 & 255, e[4] >> 8 & 255, e[4] & 255];
667}
668const ie = te("v5", 80, re), ae = ie, ne = /[^\dA-Za-z](\W)*/g;
669let R = {}, q = /* @__PURE__ */ new Map();
670const se = function(t) {
671 const r = Object.keys(t);
672 for (const e of r)
673 R[e] = t[e];
674}, oe = (t, r, e) => {
675 const n = R.entityPadding / 3, s = R.entityPadding / 3, p = R.fontSize * 0.85, f = r.node().getBBox(), o = [];
676 let c = !1, _ = !1, E = 0, g = 0, O = 0, y = 0, A = f.height + n * 2, Y = 1;
677 e.forEach((N) => {
678 N.attributeKeyTypeList !== void 0 && N.attributeKeyTypeList.length > 0 && (c = !0), N.attributeComment !== void 0 && (_ = !0);
679 }), e.forEach((N) => {
680 const v = `${r.node().id}-attr-${Y}`;
681 let k = 0;
682 const x = It(N.attributeType), P = t.append("text").classed("er entityLabel", !0).attr("id", `${v}-type`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", V().fontFamily).style("font-size", p + "px").text(x), Z = t.append("text").classed("er entityLabel", !0).attr("id", `${v}-name`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", V().fontFamily).style("font-size", p + "px").text(N.attributeName), w = {};
683 w.tn = P, w.nn = Z;
684 const z = P.node().getBBox(), S = Z.node().getBBox();
685 if (E = Math.max(E, z.width), g = Math.max(g, S.width), k = Math.max(z.height, S.height), c) {
686 const M = N.attributeKeyTypeList !== void 0 ? N.attributeKeyTypeList.join(",") : "", a = t.append("text").classed("er entityLabel", !0).attr("id", `${v}-key`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", V().fontFamily).style("font-size", p + "px").text(M);
687 w.kn = a;
688 const l = a.node().getBBox();
689 O = Math.max(O, l.width), k = Math.max(k, l.height);
690 }
691 if (_) {
692 const M = t.append("text").classed("er entityLabel", !0).attr("id", `${v}-comment`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", V().fontFamily).style("font-size", p + "px").text(N.attributeComment || "");
693 w.cn = M;
694 const a = M.node().getBBox();
695 y = Math.max(y, a.width), k = Math.max(k, a.height);
696 }
697 w.height = k, o.push(w), A += k + n * 2, Y += 1;
698 });
699 let U = 4;
700 c && (U += 2), _ && (U += 2);
701 const X = E + g + O + y, I = {
702 width: Math.max(
703 R.minEntityWidth,
704 Math.max(
705 f.width + R.entityPadding * 2,
706 X + s * U
707 )
708 ),
709 height: e.length > 0 ? A : Math.max(R.minEntityHeight, f.height + R.entityPadding * 2)
710 };
711 if (e.length > 0) {
712 const N = Math.max(
713 0,
714 (I.width - X - s * U) / (U / 2)
715 );
716 r.attr(
717 "transform",
718 "translate(" + I.width / 2 + "," + (n + f.height / 2) + ")"
719 );
720 let v = f.height + n * 2, k = "attributeBoxOdd";
721 o.forEach((x) => {
722 const P = v + n + x.height / 2;
723 x.tn.attr("transform", "translate(" + s + "," + P + ")");
724 const Z = t.insert("rect", "#" + x.tn.node().id).classed(`er ${k}`, !0).attr("x", 0).attr("y", v).attr("width", E + s * 2 + N).attr("height", x.height + n * 2), w = parseFloat(Z.attr("x")) + parseFloat(Z.attr("width"));
725 x.nn.attr(
726 "transform",
727 "translate(" + (w + s) + "," + P + ")"
728 );
729 const z = t.insert("rect", "#" + x.nn.node().id).classed(`er ${k}`, !0).attr("x", w).attr("y", v).attr("width", g + s * 2 + N).attr("height", x.height + n * 2);
730 let S = parseFloat(z.attr("x")) + parseFloat(z.attr("width"));
731 if (c) {
732 x.kn.attr(
733 "transform",
734 "translate(" + (S + s) + "," + P + ")"
735 );
736 const M = t.insert("rect", "#" + x.kn.node().id).classed(`er ${k}`, !0).attr("x", S).attr("y", v).attr("width", O + s * 2 + N).attr("height", x.height + n * 2);
737 S = parseFloat(M.attr("x")) + parseFloat(M.attr("width"));
738 }
739 _ && (x.cn.attr(
740 "transform",
741 "translate(" + (S + s) + "," + P + ")"
742 ), t.insert("rect", "#" + x.cn.node().id).classed(`er ${k}`, "true").attr("x", S).attr("y", v).attr("width", y + s * 2 + N).attr("height", x.height + n * 2)), v += x.height + n * 2, k = k === "attributeBoxOdd" ? "attributeBoxEven" : "attributeBoxOdd";
743 });
744 } else
745 I.height = Math.max(R.minEntityHeight, A), r.attr("transform", "translate(" + I.width / 2 + "," + I.height / 2 + ")");
746 return I;
747}, ce = function(t, r, e) {
748 const n = Object.keys(r);
749 let s;
750 return n.forEach(function(p) {
751 const f = ye(p, "entity");
752 q.set(p, f);
753 const o = t.append("g").attr("id", f);
754 s = s === void 0 ? f : s;
755 const c = "text-" + f, _ = o.append("text").classed("er entityLabel", !0).attr("id", c).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "middle").style("font-family", V().fontFamily).style("font-size", R.fontSize + "px").text(p), { width: E, height: g } = oe(
756 o,
757 _,
758 r[p].attributes
759 ), y = o.insert("rect", "#" + c).classed("er entityBox", !0).attr("x", 0).attr("y", 0).attr("width", E).attr("height", g).node().getBBox();
760 e.setNode(f, {
761 width: y.width,
762 height: y.height,
763 shape: "rect",
764 id: f
765 });
766 }), s;
767}, le = function(t, r) {
768 r.nodes().forEach(function(e) {
769 e !== void 0 && r.node(e) !== void 0 && t.select("#" + e).attr(
770 "transform",
771 "translate(" + (r.node(e).x - r.node(e).width / 2) + "," + (r.node(e).y - r.node(e).height / 2) + " )"
772 );
773 });
774}, _t = function(t) {
775 return (t.entityA + t.roleA + t.entityB).replace(/\s/g, "");
776}, he = function(t, r) {
777 return t.forEach(function(e) {
778 r.setEdge(
779 q.get(e.entityA),
780 q.get(e.entityB),
781 { relationship: e },
782 _t(e)
783 );
784 }), t;
785};
786let ft = 0;
787const de = function(t, r, e, n, s) {
788 ft++;
789 const p = e.edge(
790 q.get(r.entityA),
791 q.get(r.entityB),
792 _t(r)
793 ), f = Bt().x(function(A) {
794 return A.x;
795 }).y(function(A) {
796 return A.y;
797 }).curve(wt), o = t.insert("path", "#" + n).classed("er relationshipLine", !0).attr("d", f(p.points)).style("stroke", R.stroke).style("fill", "none");
798 r.relSpec.relType === s.db.Identification.NON_IDENTIFYING && o.attr("stroke-dasharray", "8,8");
799 let c = "";
800 switch (R.arrowMarkerAbsolute && (c = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, c = c.replace(/\(/g, "\\("), c = c.replace(/\)/g, "\\)")), r.relSpec.cardA) {
801 case s.db.Cardinality.ZERO_OR_ONE:
802 o.attr("marker-end", "url(" + c + "#" + C.ERMarkers.ZERO_OR_ONE_END + ")");
803 break;
804 case s.db.Cardinality.ZERO_OR_MORE:
805 o.attr("marker-end", "url(" + c + "#" + C.ERMarkers.ZERO_OR_MORE_END + ")");
806 break;
807 case s.db.Cardinality.ONE_OR_MORE:
808 o.attr("marker-end", "url(" + c + "#" + C.ERMarkers.ONE_OR_MORE_END + ")");
809 break;
810 case s.db.Cardinality.ONLY_ONE:
811 o.attr("marker-end", "url(" + c + "#" + C.ERMarkers.ONLY_ONE_END + ")");
812 break;
813 case s.db.Cardinality.MD_PARENT:
814 o.attr("marker-end", "url(" + c + "#" + C.ERMarkers.MD_PARENT_END + ")");
815 break;
816 }
817 switch (r.relSpec.cardB) {
818 case s.db.Cardinality.ZERO_OR_ONE:
819 o.attr(
820 "marker-start",
821 "url(" + c + "#" + C.ERMarkers.ZERO_OR_ONE_START + ")"
822 );
823 break;
824 case s.db.Cardinality.ZERO_OR_MORE:
825 o.attr(
826 "marker-start",
827 "url(" + c + "#" + C.ERMarkers.ZERO_OR_MORE_START + ")"
828 );
829 break;
830 case s.db.Cardinality.ONE_OR_MORE:
831 o.attr(
832 "marker-start",
833 "url(" + c + "#" + C.ERMarkers.ONE_OR_MORE_START + ")"
834 );
835 break;
836 case s.db.Cardinality.ONLY_ONE:
837 o.attr("marker-start", "url(" + c + "#" + C.ERMarkers.ONLY_ONE_START + ")");
838 break;
839 case s.db.Cardinality.MD_PARENT:
840 o.attr("marker-start", "url(" + c + "#" + C.ERMarkers.MD_PARENT_START + ")");
841 break;
842 }
843 const _ = o.node().getTotalLength(), E = o.node().getPointAtLength(_ * 0.5), g = "rel" + ft, y = t.append("text").classed("er relationshipLabel", !0).attr("id", g).attr("x", E.x).attr("y", E.y).style("text-anchor", "middle").style("dominant-baseline", "middle").style("font-family", V().fontFamily).style("font-size", R.fontSize + "px").text(r.roleA).node().getBBox();
844 t.insert("rect", "#" + g).classed("er relationshipLabelBox", !0).attr("x", E.x - y.width / 2).attr("y", E.y - y.height / 2).attr("width", y.width).attr("height", y.height);
845}, ue = function(t, r, e, n) {
846 R = V().er, et.info("Drawing ER diagram");
847 const s = V().securityLevel;
848 let p;
849 s === "sandbox" && (p = st("#i" + r));
850 const o = (s === "sandbox" ? st(p.nodes()[0].contentDocument.body) : st("body")).select(`[id='${r}']`);
851 C.insertMarkers(o, R);
852 let c;
853 c = new St({
854 multigraph: !0,
855 directed: !0,
856 compound: !1
857 }).setGraph({
858 rankdir: R.layoutDirection,
859 marginx: 20,
860 marginy: 20,
861 nodesep: 100,
862 edgesep: 100,
863 ranksep: 100
864 }).setDefaultEdgeLabel(function() {
865 return {};
866 });
867 const _ = ce(o, n.db.getEntities(), c), E = he(n.db.getRelationships(), c);
868 Lt(c), le(o, c), E.forEach(function(Y) {
869 de(o, Y, c, _, n);
870 });
871 const g = R.diagramPadding;
872 vt.insertTitle(o, "entityTitleText", R.titleTopMargin, n.db.getDiagramTitle());
873 const O = o.node().getBBox(), y = O.width + g * 2, A = O.height + g * 2;
874 Dt(o, A, y, R.useMaxWidth), o.attr("viewBox", `${O.x - g} ${O.y - g} ${y} ${A}`);
875}, fe = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
876function ye(t = "", r = "") {
877 const e = t.replace(ne, "");
878 return `${yt(r)}${yt(e)}${ae(
879 t,
880 fe
881 )}`;
882}
883function yt(t = "") {
884 return t.length > 0 ? `${t}-` : "";
885}
886const pe = {
887 setConf: se,
888 draw: ue
889}, _e = (t) => `
890 .entityBox {
891 fill: ${t.mainBkg};
892 stroke: ${t.nodeBorder};
893 }
894
895 .attributeBoxOdd {
896 fill: ${t.attributeBackgroundColorOdd};
897 stroke: ${t.nodeBorder};
898 }
899
900 .attributeBoxEven {
901 fill: ${t.attributeBackgroundColorEven};
902 stroke: ${t.nodeBorder};
903 }
904
905 .relationshipLabelBox {
906 fill: ${t.tertiaryColor};
907 opacity: 0.7;
908 background-color: ${t.tertiaryColor};
909 rect {
910 opacity: 0.5;
911 }
912 }
913
914 .relationshipLine {
915 stroke: ${t.lineColor};
916 }
917
918 .entityTitleText {
919 text-anchor: middle;
920 font-size: 18px;
921 fill: ${t.textColor};
922 }
923 #MD_PARENT_START {
924 fill: #f5f5f5 !important;
925 stroke: ${t.lineColor} !important;
926 stroke-width: 1;
927 }
928 #MD_PARENT_END {
929 fill: #f5f5f5 !important;
930 stroke: ${t.lineColor} !important;
931 stroke-width: 1;
932 }
933
934`, Ee = _e, Oe = {
935 parser: Ct,
936 db: Ht,
937 renderer: pe,
938 styles: Ee
939};
940export {
941 Oe as diagram
942};