@draftably/editor 0.1.0 → 0.3.0

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 (104) hide show
  1. package/README.md +4 -5
  2. package/dist/assets/engine.worker-BY9GKt7x.js +7505 -0
  3. package/dist/element.js +1 -1
  4. package/dist/index.js +20202 -2
  5. package/dist/types/src/cli/raster-fonts.d.ts +3 -0
  6. package/dist/types/src/components/controls.d.ts +8 -5
  7. package/dist/types/src/dsl/compile.d.ts +13 -0
  8. package/dist/types/src/dsl/corridors.d.ts +38 -0
  9. package/dist/types/src/model/types.d.ts +9 -0
  10. package/dist/types/src/state/canvas-commands.d.ts +169 -0
  11. package/dist/types/src/state/canvas-keyboard.d.ts +15 -0
  12. package/dist/types/src/state/links.d.ts +4 -1
  13. package/dist/types/src/state/workspace.d.ts +3 -0
  14. package/package.json +1 -1
  15. package/dist/assets/engine.worker-DmHew5f6.js +0 -6813
  16. package/dist/assets/import-d2.worker-CnXfFXoa.js +0 -5395
  17. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +0 -87
  18. package/dist/chunks/arc-rJj0TtXf.js +0 -83
  19. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +0 -4781
  20. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +0 -1440
  21. package/dist/chunks/browser-iNhbPsGc.js +0 -40
  22. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +0 -1524
  23. package/dist/chunks/channel-qMvPU6eH.js +0 -5
  24. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +0 -670
  25. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +0 -18
  26. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +0 -262
  27. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +0 -68
  28. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +0 -19
  29. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +0 -8
  30. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +0 -19
  31. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +0 -8
  32. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +0 -451
  33. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +0 -1570
  34. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +0 -2608
  35. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +0 -22361
  36. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +0 -299
  37. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +0 -18791
  38. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +0 -2157
  39. package/dist/chunks/defaultLocale-BgPVtth8.js +0 -171
  40. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +0 -531
  41. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +0 -153
  42. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +0 -346
  43. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +0 -480
  44. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +0 -219
  45. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +0 -2586
  46. package/dist/chunks/dot-importer-B23jwEkx.js +0 -1547
  47. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +0 -109
  48. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +0 -49229
  49. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +0 -1064
  50. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +0 -1771
  51. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +0 -2729
  52. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +0 -815
  53. package/dist/chunks/graph-CKJmgLki.js +0 -1541
  54. package/dist/chunks/import-core-C-I1wGfw.js +0 -145
  55. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +0 -24
  56. package/dist/chunks/init-DjUOC4st.js +0 -16
  57. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +0 -624
  58. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +0 -834
  59. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +0 -724
  60. package/dist/chunks/katex-BsrBVQKd.js +0 -11314
  61. package/dist/chunks/linear-4t7D_ros.js +0 -259
  62. package/dist/chunks/mermaid-facade-BoLWBerE.js +0 -289
  63. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +0 -478
  64. package/dist/chunks/mermaid.core-DXv6D2Sm.js +0 -19244
  65. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +0 -837
  66. package/dist/chunks/mount-C1Xk_GQz.js +0 -22131
  67. package/dist/chunks/ordinal-DfAQgscy.js +0 -61
  68. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +0 -95
  69. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +0 -208
  70. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +0 -1029
  71. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +0 -77
  72. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +0 -889
  73. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +0 -859
  74. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +0 -2972
  75. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +0 -46
  76. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +0 -1520
  77. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +0 -4991
  78. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +0 -13
  79. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +0 -1058
  80. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +0 -7945
  81. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +0 -1578
  82. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +0 -678
  83. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +0 -1536
  84. package/dist/types/src/cli/png.d.ts +0 -23
  85. package/dist/types/src/import/browser.d.ts +0 -3
  86. package/dist/types/src/import/detect.d.ts +0 -31
  87. package/dist/types/src/import/dot-importer.d.ts +0 -3
  88. package/dist/types/src/import/import-core.d.ts +0 -105
  89. package/dist/types/src/import/mermaid-facade.d.ts +0 -120
  90. package/dist/types/src/import/mermaid-importer.d.ts +0 -4
  91. package/dist/types/src/import/mermaid-sequence.d.ts +0 -8
  92. package/dist/types/src/import/scratch.d.ts +0 -3
  93. package/dist/types/src/lib/source-hash.d.ts +0 -7
  94. package/dist/types/src/model/candidates.d.ts +0 -53
  95. package/dist/types/src/model/embed.d.ts +0 -17
  96. package/dist/types/src/model/examples.d.ts +0 -15
  97. package/dist/types/src/model/label-hits.d.ts +0 -27
  98. package/dist/types/src/model/static-scene.d.ts +0 -15
  99. package/dist/types/src/state/commands.d.ts +0 -529
  100. package/dist/types/src/state/comparison.d.ts +0 -151
  101. package/dist/types/src/state/files.d.ts +0 -61
  102. package/dist/types/src/state/keyboard.d.ts +0 -6
  103. package/dist/types/src/state/launch.d.ts +0 -61
  104. package/dist/types/src/state/ui.d.ts +0 -39
@@ -1,259 +0,0 @@
1
- import { bl as j, bm as v, bn as w, bo as k, bp as q } from "./mermaid.core-DXv6D2Sm.js";
2
- import { i as D } from "./init-DjUOC4st.js";
3
- import { e as g, f as F, a as z, b as B } from "./defaultLocale-BgPVtth8.js";
4
- function M(n, r) {
5
- return n == null || r == null ? NaN : n < r ? -1 : n > r ? 1 : n >= r ? 0 : NaN;
6
- }
7
- function I(n, r) {
8
- return n == null || r == null ? NaN : r < n ? -1 : r > n ? 1 : r >= n ? 0 : NaN;
9
- }
10
- function R(n) {
11
- let r, t, e;
12
- n.length !== 2 ? (r = M, t = (o, c) => M(n(o), c), e = (o, c) => n(o) - c) : (r = n === M || n === I ? n : P, t = n, e = n);
13
- function u(o, c, i = 0, h = o.length) {
14
- if (i < h) {
15
- if (r(c, c) !== 0) return h;
16
- do {
17
- const l = i + h >>> 1;
18
- t(o[l], c) < 0 ? i = l + 1 : h = l;
19
- } while (i < h);
20
- }
21
- return i;
22
- }
23
- function f(o, c, i = 0, h = o.length) {
24
- if (i < h) {
25
- if (r(c, c) !== 0) return h;
26
- do {
27
- const l = i + h >>> 1;
28
- t(o[l], c) <= 0 ? i = l + 1 : h = l;
29
- } while (i < h);
30
- }
31
- return i;
32
- }
33
- function a(o, c, i = 0, h = o.length) {
34
- const l = u(o, c, i, h - 1);
35
- return l > i && e(o[l - 1], c) > -e(o[l], c) ? l - 1 : l;
36
- }
37
- return { left: u, center: a, right: f };
38
- }
39
- function P() {
40
- return 0;
41
- }
42
- function V(n) {
43
- return n === null ? NaN : +n;
44
- }
45
- const $ = R(M), x = $.right;
46
- R(V).center;
47
- const O = Math.sqrt(50), T = Math.sqrt(10), C = Math.sqrt(2);
48
- function p(n, r, t) {
49
- const e = (r - n) / Math.max(0, t), u = Math.floor(Math.log10(e)), f = e / Math.pow(10, u), a = f >= O ? 10 : f >= T ? 5 : f >= C ? 2 : 1;
50
- let o, c, i;
51
- return u < 0 ? (i = Math.pow(10, -u) / a, o = Math.round(n * i), c = Math.round(r * i), o / i < n && ++o, c / i > r && --c, i = -i) : (i = Math.pow(10, u) * a, o = Math.round(n / i), c = Math.round(r / i), o * i < n && ++o, c * i > r && --c), c < o && 0.5 <= t && t < 2 ? p(n, r, t * 2) : [o, c, i];
52
- }
53
- function E(n, r, t) {
54
- if (r = +r, n = +n, t = +t, !(t > 0)) return [];
55
- if (n === r) return [n];
56
- const e = r < n, [u, f, a] = e ? p(r, n, t) : p(n, r, t);
57
- if (!(f >= u)) return [];
58
- const o = f - u + 1, c = new Array(o);
59
- if (e)
60
- if (a < 0) for (let i = 0; i < o; ++i) c[i] = (f - i) / -a;
61
- else for (let i = 0; i < o; ++i) c[i] = (f - i) * a;
62
- else if (a < 0) for (let i = 0; i < o; ++i) c[i] = (u + i) / -a;
63
- else for (let i = 0; i < o; ++i) c[i] = (u + i) * a;
64
- return c;
65
- }
66
- function y(n, r, t) {
67
- return r = +r, n = +n, t = +t, p(n, r, t)[2];
68
- }
69
- function G(n, r, t) {
70
- r = +r, n = +n, t = +t;
71
- const e = r < n, u = e ? y(r, n, t) : y(n, r, t);
72
- return (e ? -1 : 1) * (u < 0 ? 1 / -u : u);
73
- }
74
- function H(n, r) {
75
- r || (r = []);
76
- var t = n ? Math.min(r.length, n.length) : 0, e = r.slice(), u;
77
- return function(f) {
78
- for (u = 0; u < t; ++u) e[u] = n[u] * (1 - f) + r[u] * f;
79
- return e;
80
- };
81
- }
82
- function J(n) {
83
- return ArrayBuffer.isView(n) && !(n instanceof DataView);
84
- }
85
- function K(n, r) {
86
- var t = r ? r.length : 0, e = n ? Math.min(t, n.length) : 0, u = new Array(e), f = new Array(t), a;
87
- for (a = 0; a < e; ++a) u[a] = d(n[a], r[a]);
88
- for (; a < t; ++a) f[a] = r[a];
89
- return function(o) {
90
- for (a = 0; a < e; ++a) f[a] = u[a](o);
91
- return f;
92
- };
93
- }
94
- function L(n, r) {
95
- var t = /* @__PURE__ */ new Date();
96
- return n = +n, r = +r, function(e) {
97
- return t.setTime(n * (1 - e) + r * e), t;
98
- };
99
- }
100
- function Q(n, r) {
101
- var t = {}, e = {}, u;
102
- (n === null || typeof n != "object") && (n = {}), (r === null || typeof r != "object") && (r = {});
103
- for (u in r)
104
- u in n ? t[u] = d(n[u], r[u]) : e[u] = r[u];
105
- return function(f) {
106
- for (u in t) e[u] = t[u](f);
107
- return e;
108
- };
109
- }
110
- function d(n, r) {
111
- var t = typeof r, e;
112
- return r == null || t === "boolean" ? j(r) : (t === "number" ? v : t === "string" ? (e = w(r)) ? (r = e, k) : q : r instanceof w ? k : r instanceof Date ? L : J(r) ? H : Array.isArray(r) ? K : typeof r.valueOf != "function" && typeof r.toString != "function" || isNaN(r) ? Q : v)(n, r);
113
- }
114
- function U(n, r) {
115
- return n = +n, r = +r, function(t) {
116
- return Math.round(n * (1 - t) + r * t);
117
- };
118
- }
119
- function W(n) {
120
- return Math.max(0, -g(Math.abs(n)));
121
- }
122
- function X(n, r) {
123
- return Math.max(0, Math.max(-8, Math.min(8, Math.floor(g(r) / 3))) * 3 - g(Math.abs(n)));
124
- }
125
- function Y(n, r) {
126
- return n = Math.abs(n), r = Math.abs(r) - n, Math.max(0, g(r) - g(n)) + 1;
127
- }
128
- function Z(n) {
129
- return function() {
130
- return n;
131
- };
132
- }
133
- function _(n) {
134
- return +n;
135
- }
136
- var A = [0, 1];
137
- function m(n) {
138
- return n;
139
- }
140
- function N(n, r) {
141
- return (r -= n = +n) ? function(t) {
142
- return (t - n) / r;
143
- } : Z(isNaN(r) ? NaN : 0.5);
144
- }
145
- function b(n, r) {
146
- var t;
147
- return n > r && (t = n, n = r, r = t), function(e) {
148
- return Math.max(n, Math.min(r, e));
149
- };
150
- }
151
- function nn(n, r, t) {
152
- var e = n[0], u = n[1], f = r[0], a = r[1];
153
- return u < e ? (e = N(u, e), f = t(a, f)) : (e = N(e, u), f = t(f, a)), function(o) {
154
- return f(e(o));
155
- };
156
- }
157
- function rn(n, r, t) {
158
- var e = Math.min(n.length, r.length) - 1, u = new Array(e), f = new Array(e), a = -1;
159
- for (n[e] < n[0] && (n = n.slice().reverse(), r = r.slice().reverse()); ++a < e; )
160
- u[a] = N(n[a], n[a + 1]), f[a] = t(r[a], r[a + 1]);
161
- return function(o) {
162
- var c = x(n, o, 1, e) - 1;
163
- return f[c](u[c](o));
164
- };
165
- }
166
- function en(n, r) {
167
- return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown());
168
- }
169
- function tn() {
170
- var n = A, r = A, t = d, e, u, f, a = m, o, c, i;
171
- function h() {
172
- var s = Math.min(n.length, r.length);
173
- return a !== m && (a = b(n[0], n[s - 1])), o = s > 2 ? rn : nn, c = i = null, l;
174
- }
175
- function l(s) {
176
- return s == null || isNaN(s = +s) ? f : (c || (c = o(n.map(e), r, t)))(e(a(s)));
177
- }
178
- return l.invert = function(s) {
179
- return a(u((i || (i = o(r, n.map(e), v)))(s)));
180
- }, l.domain = function(s) {
181
- return arguments.length ? (n = Array.from(s, _), h()) : n.slice();
182
- }, l.range = function(s) {
183
- return arguments.length ? (r = Array.from(s), h()) : r.slice();
184
- }, l.rangeRound = function(s) {
185
- return r = Array.from(s), t = U, h();
186
- }, l.clamp = function(s) {
187
- return arguments.length ? (a = s ? !0 : m, h()) : a !== m;
188
- }, l.interpolate = function(s) {
189
- return arguments.length ? (t = s, h()) : t;
190
- }, l.unknown = function(s) {
191
- return arguments.length ? (f = s, l) : f;
192
- }, function(s, S) {
193
- return e = s, u = S, h();
194
- };
195
- }
196
- function un() {
197
- return tn()(m, m);
198
- }
199
- function an(n, r, t, e) {
200
- var u = G(n, r, t), f;
201
- switch (e = F(e ?? ",f"), e.type) {
202
- case "s": {
203
- var a = Math.max(Math.abs(n), Math.abs(r));
204
- return e.precision == null && !isNaN(f = X(u, a)) && (e.precision = f), z(e, a);
205
- }
206
- case "":
207
- case "e":
208
- case "g":
209
- case "p":
210
- case "r": {
211
- e.precision == null && !isNaN(f = Y(u, Math.max(Math.abs(n), Math.abs(r)))) && (e.precision = f - (e.type === "e"));
212
- break;
213
- }
214
- case "f":
215
- case "%": {
216
- e.precision == null && !isNaN(f = W(u)) && (e.precision = f - (e.type === "%") * 2);
217
- break;
218
- }
219
- }
220
- return B(e);
221
- }
222
- function on(n) {
223
- var r = n.domain;
224
- return n.ticks = function(t) {
225
- var e = r();
226
- return E(e[0], e[e.length - 1], t ?? 10);
227
- }, n.tickFormat = function(t, e) {
228
- var u = r();
229
- return an(u[0], u[u.length - 1], t ?? 10, e);
230
- }, n.nice = function(t) {
231
- t == null && (t = 10);
232
- var e = r(), u = 0, f = e.length - 1, a = e[u], o = e[f], c, i, h = 10;
233
- for (o < a && (i = a, a = o, o = i, i = u, u = f, f = i); h-- > 0; ) {
234
- if (i = y(a, o, t), i === c)
235
- return e[u] = a, e[f] = o, r(e);
236
- if (i > 0)
237
- a = Math.floor(a / i) * i, o = Math.ceil(o / i) * i;
238
- else if (i < 0)
239
- a = Math.ceil(a * i) / i, o = Math.floor(o * i) / i;
240
- else
241
- break;
242
- c = i;
243
- }
244
- return n;
245
- }, n;
246
- }
247
- function fn() {
248
- var n = un();
249
- return n.copy = function() {
250
- return en(n, fn());
251
- }, D.apply(n, arguments), on(n);
252
- }
253
- export {
254
- en as a,
255
- R as b,
256
- un as c,
257
- fn as l,
258
- G as t
259
- };
@@ -1,289 +0,0 @@
1
- const E = "12.2.0";
2
- const l = (t) => {
3
- if (!t || typeof t != "object" || Array.isArray(t))
4
- throw new Error("Expected a Mermaid data object.");
5
- return t;
6
- }, a = (t, s) => {
7
- if (typeof t == "string") return t;
8
- if (t == null && s !== void 0) return s;
9
- throw new Error("Expected a Mermaid string.");
10
- }, m = (t) => {
11
- if (t == null) return [];
12
- if (!Array.isArray(t) || t.some((s) => typeof s != "string"))
13
- throw new Error("Expected a Mermaid string array.");
14
- return [...t];
15
- }, i = (t) => t == null ? void 0 : a(t), y = (t) => {
16
- if (!Array.isArray(t)) throw new Error("Expected a Mermaid array.");
17
- return t;
18
- }, x = (t) => {
19
- if (!(t instanceof Map)) throw new Error("Expected a Mermaid Map.");
20
- return [...t.values()];
21
- }, b = (t) => {
22
- if (t != null) {
23
- if (typeof t != "number" || !Number.isFinite(t))
24
- throw new Error("Expected finite number.");
25
- return t;
26
- }
27
- };
28
- function w(t) {
29
- return t.replace(/fl°°(\d+)¶ß/g, "&#$1;").replace(/fl°([A-Za-z]\w*)¶ß/g, "&$1;");
30
- }
31
- function P(t) {
32
- return (s) => {
33
- const g = t.createElement("template");
34
- return g.innerHTML = w(s).replace(/<br\s*\/?>/gi, `
35
- `), g.content.textContent ?? "";
36
- };
37
- }
38
- function R(t) {
39
- if (new TextEncoder().encode(t).length > 1e5)
40
- return [
41
- {
42
- code: "IMPORT_INPUT_LIMIT",
43
- severity: "error",
44
- message: "Mermaid input exceeds 100000 UTF-8 bytes."
45
- }
46
- ];
47
- const s = t.replace(/^\uFEFF/, "").replace(/\r\n?/g, `
48
- `);
49
- if (/^\s*---(?:\n|$)/.test(s) || /%%\s*\{/.test(s))
50
- return [
51
- {
52
- code: "MERMAID_CONFIGURATION_UNSUPPORTED",
53
- severity: "error",
54
- message: "This importer does not apply Mermaid frontmatter or directives. Remove the configuration block and import the diagram text."
55
- }
56
- ];
57
- if ([...s].some((o) => {
58
- const d = o.charCodeAt(0);
59
- return d < 32 && ![9, 10, 13].includes(d);
60
- }))
61
- return [
62
- {
63
- code: "IMPORT_CONTROL_CHARACTER",
64
- severity: "error",
65
- message: "Input contains unsupported control characters."
66
- }
67
- ];
68
- const g = s.split(`
69
- `).find((o) => o.trim() && !o.trimStart().startsWith("%%")) ?? "";
70
- if (!/^\s*(?:flowchart|graph|sequenceDiagram)\b/.test(g))
71
- return [
72
- {
73
- code: "MERMAID_FAMILY_UNSUPPORTED",
74
- severity: "error",
75
- message: "This adapter supports Mermaid flowcharts and sequence diagrams only. Class, ER, state, chart and other families require separate semantic adapters."
76
- }
77
- ];
78
- const f = [];
79
- for (const [o, d] of s.split(`
80
- `).entries())
81
- /(?:^|;)\s*click\s/.test(d) && f.push({
82
- code: "MERMAID_INTERACTION_IGNORED",
83
- severity: "warning",
84
- message: "Mermaid click links and callbacks are data only; no interactions are installed.",
85
- line: o + 1,
86
- locationKind: "source"
87
- });
88
- return f;
89
- }
90
- function S(t, s) {
91
- const g = new Map(
92
- Object.entries(l(t.LINETYPE)).map(([n, r]) => [r, n])
93
- ), f = new Map(
94
- Object.entries(l(t.PLACEMENT)).map(([n, r]) => [r, n])
95
- ), o = y(s("getBoxes")), d = s("getActors");
96
- if (!(d instanceof Map)) throw new Error("Expected a Mermaid Map.");
97
- const p = (n) => new Set(s(n) instanceof Map ? s(n).keys() : []);
98
- return {
99
- format: "mermaid",
100
- family: "sequence",
101
- parserVersion: E,
102
- title: i(s("getDiagramTitle")) || void 0,
103
- actors: m(s("getActorKeys")).map((n) => {
104
- const r = l(d.get(n));
105
- return {
106
- id: n,
107
- name: a(r.description, a(r.name, n)),
108
- type: a(r.type, "participant"),
109
- box: r.box ? o.indexOf(r.box) : void 0,
110
- links: Object.keys(l(r.links ?? {}))
111
- };
112
- }),
113
- boxes: o.map((n) => {
114
- const r = l(n);
115
- return { name: i(r.name), fill: i(r.fill) };
116
- }),
117
- events: y(s("getMessages")).map((n) => {
118
- const r = l(n), u = f.get(r.placement);
119
- return {
120
- kind: g.get(r.type) ?? "UNKNOWN",
121
- from: i(r.from),
122
- to: i(r.to),
123
- // `autonumber` stores its numbering object here.
124
- text: typeof r.message == "string" ? r.message : "",
125
- ...r.placement == null ? {} : {
126
- placement: u === "LEFTOF" ? "left" : u === "RIGHTOF" ? "right" : "over"
127
- },
128
- central: !!r.centralConnection
129
- };
130
- }),
131
- created: [...p("getCreatedActors")].map(String),
132
- destroyed: [...p("getDestroyedActors")].map(String)
133
- };
134
- }
135
- function D(t) {
136
- let s = Promise.resolve();
137
- return (g) => {
138
- const f = s.then(async () => {
139
- const o = R(g);
140
- if (o.some((p) => p.severity === "error")) return { ok: !1, diagnostics: o };
141
- let d = "load";
142
- try {
143
- const p = await t();
144
- p.initialize({
145
- startOnLoad: !1,
146
- securityLevel: "strict",
147
- htmlLabels: !1,
148
- maxTextSize: 1e5,
149
- maxEdges: 3e3,
150
- suppressErrorRendering: !0
151
- }), d = "parse";
152
- const n = await p.mermaidAPI.getDiagramFromText(g.replace(/^\uFEFF/, ""));
153
- if (!["flowchart", "flowchart-v2", "sequence"].includes(n.type))
154
- return {
155
- ok: !1,
156
- diagnostics: [
157
- ...o,
158
- {
159
- code: "MERMAID_FAMILY_UNSUPPORTED",
160
- severity: "error",
161
- message: `Parser selected unsupported diagram family ${n.type}.`
162
- }
163
- ]
164
- };
165
- d = "snapshot";
166
- const r = l(n.db), u = (c) => {
167
- if (typeof r[c] != "function")
168
- throw new Error(`Mermaid ${E} boundary missing ${c}().`);
169
- return r[c].call(r);
170
- };
171
- if (n.type === "sequence") {
172
- const c = S(r, u);
173
- return c.actors.length > 1e3 || c.events.length > 3e3 ? {
174
- ok: !1,
175
- diagnostics: [
176
- ...o,
177
- {
178
- code: "IMPORT_GRAPH_LIMIT",
179
- severity: "error",
180
- message: "Parsed sequence exceeds the import entity or event limit."
181
- }
182
- ]
183
- } : { ok: !0, diagnostics: o, snapshot: c };
184
- }
185
- const M = u("getEdges"), h = x(u("getVertices")).map((c) => {
186
- const e = l(c);
187
- return {
188
- id: a(e.id),
189
- text: a(e.text, a(e.id)),
190
- type: i(e.type),
191
- labelType: a(e.labelType, "text"),
192
- classes: m(e.classes),
193
- styles: m(e.styles),
194
- link: i(e.link),
195
- icon: i(e.icon),
196
- img: i(e.img),
197
- props: e.props == null ? void 0 : structuredClone(l(e.props))
198
- };
199
- }), T = y(M).map((c) => {
200
- const e = l(c);
201
- return {
202
- start: a(e.start),
203
- end: a(e.end),
204
- text: a(e.text, ""),
205
- type: i(e.type),
206
- stroke: i(e.stroke),
207
- id: i(e.id),
208
- isUserDefinedId: e.isUserDefinedId === !0,
209
- labelType: a(e.labelType, "text"),
210
- classes: m(e.classes),
211
- style: m(e.style),
212
- length: b(e.length),
213
- interpolate: i(e.interpolate),
214
- animate: e.animate === !0,
215
- animation: i(e.animation)
216
- };
217
- }), A = y(u("getSubGraphs")).map((c) => {
218
- const e = l(c);
219
- return {
220
- id: a(e.id),
221
- title: a(e.title, ""),
222
- nodes: m(e.nodes),
223
- dir: i(e.dir),
224
- labelType: a(e.labelType, "text"),
225
- classes: m(e.classes),
226
- metadata: e.metadata == null ? void 0 : structuredClone(l(e.metadata))
227
- };
228
- }), _ = x(u("getClasses")).map((c) => {
229
- const e = l(c);
230
- return { id: a(e.id), styles: m(e.styles), textStyles: m(e.textStyles) };
231
- });
232
- if (h.length + A.length > 1e3 || T.length > 3e3)
233
- return {
234
- ok: !1,
235
- diagnostics: [
236
- ...o,
237
- {
238
- code: "IMPORT_GRAPH_LIMIT",
239
- severity: "error",
240
- message: "Parsed graph exceeds the import entity or edge limit."
241
- }
242
- ]
243
- };
244
- const I = M;
245
- return {
246
- ok: !0,
247
- diagnostics: o,
248
- snapshot: {
249
- format: "mermaid",
250
- family: "flowchart",
251
- parserVersion: E,
252
- direction: a(u("getDirection"), "TB"),
253
- vertices: h,
254
- edges: T,
255
- groups: A,
256
- classes: _,
257
- defaultEdgeStyle: m(I.defaultStyle),
258
- defaultEdgeInterpolate: i(I.defaultInterpolate)
259
- }
260
- };
261
- } catch (p) {
262
- const n = p, r = n.hash?.loc;
263
- return {
264
- ok: !1,
265
- diagnostics: [
266
- ...o,
267
- {
268
- code: d === "parse" ? "MERMAID_PARSE_ERROR" : "MERMAID_ADAPTER_MISMATCH",
269
- severity: "error",
270
- message: n.message ?? String(p),
271
- line: r?.first_line,
272
- column: r?.first_column == null ? void 0 : r.first_column + 1,
273
- locationKind: r ? "parser-relative" : void 0
274
- }
275
- ]
276
- };
277
- }
278
- });
279
- return s = f.catch(() => {
280
- }), f;
281
- };
282
- }
283
- export {
284
- E as MERMAID_VERSION,
285
- D as createMermaidFlowParser,
286
- P as makePlainLabel,
287
- R as preflightMermaidFlow,
288
- w as restoreEntitySpelling
289
- };