@elmethis/core 1.0.0-alpha.134 → 1.0.0-alpha.136

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