lowcoder-comps 0.0.21 → 0.0.23

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