@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,478 +0,0 @@
1
- import { c as x } from "./mount-C1Xk_GQz.js";
2
- import { b as C, I as v, f as P, h as B, a as G } from "./import-core-C-I1wGfw.js";
3
- import { MERMAID_VERSION as N } from "./mermaid-facade-BoLWBerE.js";
4
- const j = {
5
- SOLID: {},
6
- DOTTED: { dashed: !0 },
7
- SOLID_OPEN: { head: "none" },
8
- DOTTED_OPEN: { head: "none", dashed: !0 },
9
- SOLID_CROSS: { head: "cross" },
10
- DOTTED_CROSS: { head: "cross", dashed: !0 },
11
- SOLID_POINT: {},
12
- DOTTED_POINT: { dashed: !0 },
13
- BIDIRECTIONAL_SOLID: { tail: "arrow" },
14
- BIDIRECTIONAL_DOTTED: { tail: "arrow", dashed: !0 }
15
- }, k = {
16
- LOOP_START: "loop",
17
- ALT_START: "alt",
18
- OPT_START: "opt",
19
- PAR_START: "par",
20
- PAR_OVER_START: "par",
21
- CRITICAL_START: "critical",
22
- BREAK_START: "break"
23
- }, L = {
24
- ALT_ELSE: "else",
25
- PAR_AND: "and",
26
- CRITICAL_OPTION: "option"
27
- }, V = ["LOOP_END", "ALT_END", "OPT_END", "PAR_END", "CRITICAL_END", "BREAK_END"];
28
- function K(m, f, D, p) {
29
- const l = C(m.title ? f(m.title) : D), h = new v(), s = /* @__PURE__ */ new Set(), E = (r, t, a = "semantics") => {
30
- s.has(r) || (s.add(r), p.push({ code: r, severity: "warning", impact: a, message: t }));
31
- }, c = m.boxes.map((r, t) => {
32
- const a = h.get("group", "box_" + (t + 1));
33
- return l.objects.push({ id: a, kind: "group", label: f(r.name ?? "") }), r.fill && r.fill !== "transparent" && E("MERMAID_SEQUENCE_BOX_COLOR", "Box colors are omitted.", "appearance"), a;
34
- }), M = /* @__PURE__ */ new Map();
35
- for (const r of m.actors) {
36
- const t = h.get("node", r.id);
37
- M.set(r.id, t), l.objects.push({
38
- id: t,
39
- kind: "node",
40
- // `participant p as "Name"` keeps its quotes in the DB.
41
- label: f(r.name).replace(/^"(.*)"$/s, "$1"),
42
- ...r.box != null && r.box >= 0 ? { parent: c[r.box] } : {}
43
- }), r.type !== "participant" && E(
44
- "MERMAID_SEQUENCE_ACTOR_TYPE",
45
- "Participant symbols such as actor or database become ordinary boxes.",
46
- "appearance"
47
- ), r.links.length && E(
48
- "MERMAID_LINK_OMITTED",
49
- "Participant link menus are omitted; native participants have no menu.",
50
- "security"
51
- );
52
- }
53
- (m.created.length || m.destroyed.length) && E(
54
- "MERMAID_SEQUENCE_LIFELINE",
55
- "create and destroy are omitted: native participants span the whole diagram."
56
- ), l.layouts.push({ scope: "root", kind: "sequence" });
57
- const R = [], b = [];
58
- let _ = 0, I, T;
59
- const O = (r, t) => {
60
- const a = f(t).trim();
61
- I = {
62
- id: h.get("phase", String(R.length + 1), "phase_" + (R.length + 1)),
63
- label: a ? `${r}: ${a}` : r,
64
- members: []
65
- }, R.push(I);
66
- }, n = (r) => {
67
- const t = [r.from, r.to].filter((o) => o != null), a = T && t.every((o) => T.ends.includes(o)), d = r.placement === "left" ? "left" : r.placement === "right" ? "right" : void 0;
68
- b.push({
69
- text: f(r.text),
70
- near: a ? T.id : M.get(t[0]),
71
- side: d ?? (a ? "right" : "below")
72
- });
73
- };
74
- for (const [r, t] of m.events.entries())
75
- if (k[t.kind])
76
- _++, _ === 1 ? O(k[t.kind], t.text) : E(
77
- "MERMAID_SEQUENCE_NESTED_BLOCK",
78
- "A nested block has no band of its own; its messages stay in the outer band."
79
- ), E(
80
- "MERMAID_SEQUENCE_BLOCK",
81
- "Native sequences have no fragments. Each block branch becomes a phase band, so the branch logic is only in its label."
82
- );
83
- else if (L[t.kind])
84
- _ === 1 && O(L[t.kind], t.text);
85
- else if (V.includes(t.kind))
86
- _--, _ || (I = void 0);
87
- else if (t.kind === "NOTE") n(t);
88
- else if (t.kind === "ACTIVE_START" || t.kind === "ACTIVE_END")
89
- E("MERMAID_SEQUENCE_ACTIVATION", "Activation bars are omitted.", "appearance");
90
- else if (t.kind === "AUTONUMBER")
91
- E("MERMAID_SEQUENCE_AUTONUMBER", "Message numbers are omitted.", "appearance");
92
- else if (t.kind === "RECT_START" || t.kind === "RECT_END")
93
- E("MERMAID_SEQUENCE_RECT", "Background rectangles are omitted.", "appearance");
94
- else {
95
- const a = j[t.kind], d = M.get(t.from ?? ""), o = M.get(t.to ?? "");
96
- if (!a || !d || !o || t.central) {
97
- p.push({
98
- code: "MERMAID_SEQUENCE_ARROW_UNSUPPORTED",
99
- severity: "error",
100
- impact: "semantics",
101
- message: "Message line type is unsupported: " + (t.central ? "central connection" : t.kind) + ". The import is blocked rather than replacing it with an ordinary arrow."
102
- });
103
- continue;
104
- }
105
- t.kind === "SOLID_POINT" && E(
106
- "MERMAID_SEQUENCE_ASYNC_ARROW",
107
- "The open async arrow `-)` becomes an ordinary solid message, because native async draws dashed."
108
- );
109
- const g = h.get("edge-occurrence", String(r + 1), "m" + (l.edges.length + 1));
110
- l.edges.push({ id: g, from: d, to: o, label: f(t.text), directed: !0, ...a }), I?.members.push(g), T = { id: g, ends: [t.from, t.to] };
111
- }
112
- return l.phases = R.filter((r) => r.members.length), l.notes = b, P("mermaid", "sequence", l, p, h);
113
- }
114
- const H = {
115
- arrow_point: {},
116
- arrow_open: {},
117
- arrow_circle: { head: "circle" },
118
- arrow_cross: { head: "cross" },
119
- double_arrow_point: { tail: "arrow" },
120
- double_arrow_circle: { head: "circle", tail: "circle" },
121
- double_arrow_cross: { head: "cross", tail: "cross" }
122
- };
123
- function $(m, f, D = "Imported Mermaid") {
124
- const p = C(D), l = new v(), h = m.diagnostics.map((n) => ({
125
- code: n.code,
126
- severity: n.severity,
127
- impact: n.code.includes("LIMIT") || n.code.includes("TIMEOUT") ? "limit" : n.code.includes("CONFIGURATION") || n.code.includes("INTERACTION") ? "security" : "syntax",
128
- message: n.message + (n.locationKind === "parser-relative" && n.line != null ? ` (Parser-relative line ${n.line}, column ${n.column ?? 1}; original-source mapping is unavailable.)` : ""),
129
- ...n.locationKind === "source" && n.line != null ? { line: n.line, column: n.column } : {}
130
- })), s = (n, r, t = "appearance", a = "warning", d) => h.push({ code: n, message: r, impact: t, severity: a, ...d ? { foreignIds: d } : {} }), E = () => P("mermaid", "flowchart", p, h, l);
131
- if (!m.ok) return E();
132
- const c = m.snapshot;
133
- if (c.parserVersion !== N)
134
- return s(
135
- "MERMAID_VERSION_MISMATCH",
136
- "This adapter is verified only against Mermaid " + N + ".",
137
- "syntax",
138
- "error"
139
- ), E();
140
- if (c.family === "sequence")
141
- return K(c, f, D, h);
142
- const M = (n, r, t) => (/<\/?[a-z][\s\S]*?>/i.test(n) && s(
143
- "MERMAID_HTML_LABEL",
144
- "HTML label formatting was reduced to plain text; line breaks are retained and no HTML is inserted into the diagram.",
145
- "appearance",
146
- "warning",
147
- [t]
148
- ), r === "markdown" && s(
149
- "MERMAID_MARKDOWN_LABEL",
150
- "Markdown label markers remain literal text in this profile.",
151
- "appearance",
152
- "warning",
153
- [t]
154
- ), f(n)), R = (n, r) => {
155
- if (n) {
156
- if (n === "LR") return "right";
157
- if (n === "TB" || n === "TD") return "down";
158
- if (n === "RL" || n === "BT")
159
- return s(
160
- "MERMAID_REVERSED_LAYOUT",
161
- `${n} layout is normalized to ${n === "RL" ? "right" : "down"}; edge endpoints keep their semantic order.`,
162
- "layout",
163
- "warning",
164
- [r]
165
- ), n === "RL" ? "right" : "down";
166
- s("MERMAID_DIRECTION", "Unsupported Mermaid layout direction: " + n, "layout", "error", [
167
- r
168
- ]);
169
- }
170
- }, b = new Map(c.classes.map((n) => [n.id, n])), _ = (n, r, t, a) => {
171
- const d = [];
172
- for (const o of [...t ? ["default", "node"] : [], ...n]) {
173
- const g = b.get(o);
174
- g ? d.push(g) : ["default", "node", "clickable"].includes(o) || s(
175
- "MERMAID_CLASS_UNRESOLVED",
176
- "CSS class has no in-diagram definition and was not imported: " + o,
177
- "appearance",
178
- "warning",
179
- [a]
180
- );
181
- }
182
- return [...d.flatMap((o) => [...o.styles, ...o.textStyles]), ...r];
183
- }, I = (n, r, t) => {
184
- const a = /* @__PURE__ */ new Map();
185
- for (const d of r.flatMap((o) => o.split(";"))) {
186
- if (!d.trim()) continue;
187
- const o = /^\s*([a-z-]+)\s*:\s*(.*?)\s*$/i.exec(d), g = o?.[1]?.toLowerCase(), e = o?.[2];
188
- if (!g || !["fill", "stroke", "color"].includes(g)) {
189
- s(
190
- "MERMAID_STYLE_PROPERTY",
191
- "Unsupported style declaration was omitted: " + d,
192
- /url\s*\(|javascript:|expression\s*\(/i.test(d) ? "security" : "appearance",
193
- "warning",
194
- [t]
195
- );
196
- continue;
197
- }
198
- const i = B(e);
199
- if (!i) {
200
- s(
201
- "MERMAID_COLOR_VALUE",
202
- "Only #RGB or #RRGGBB colors are imported: " + d,
203
- "appearance",
204
- "warning",
205
- [t]
206
- );
207
- continue;
208
- }
209
- a.set(g, i);
210
- }
211
- G(p, n, a.get("fill"), a.get("stroke"), a.get("color"));
212
- }, T = {
213
- square: "box",
214
- rect: "box",
215
- rectangle: "box",
216
- box: "box",
217
- stadium: "pill",
218
- circle: "circle",
219
- diamond: "diamond",
220
- text: "text"
221
- }, O = (n, r) => {
222
- if (!n) return "box";
223
- if (Object.hasOwn(T, n)) return T[n];
224
- const t = n === "doublecircle" || n === "ellipse" ? "circle" : n === "round" ? "pill" : "box";
225
- return s(
226
- "MERMAID_SHAPE_APPROXIMATION",
227
- `Mermaid shape ${n} becomes native ${t}; the shape-specific visual meaning is not fully preserved.`,
228
- "semantics",
229
- "warning",
230
- [r]
231
- ), t;
232
- };
233
- try {
234
- const n = new Map(c.groups.map((e) => [e.id, e])), r = new Map(c.vertices.map((e) => [e.id, e]));
235
- if (n.size !== c.groups.length || r.size !== c.vertices.length)
236
- return s(
237
- "MERMAID_DUPLICATE_DB_ID",
238
- "The parser snapshot contains duplicate group or node identities.",
239
- "semantics",
240
- "error"
241
- ), E();
242
- const t = /* @__PURE__ */ new Map();
243
- for (const e of c.groups)
244
- t.set(e.id, {
245
- id: l.get("group", e.id),
246
- kind: "group",
247
- label: M(e.title, e.labelType, e.id)
248
- });
249
- for (const e of c.vertices)
250
- n.has(e.id) || t.set(e.id, {
251
- id: l.get("node", e.id),
252
- kind: "node",
253
- label: M(e.text, e.labelType, e.id),
254
- shape: O(e.type, e.id)
255
- });
256
- const a = /* @__PURE__ */ new Map();
257
- for (const e of c.groups)
258
- for (const i of e.nodes) {
259
- if (!t.has(i)) {
260
- s(
261
- "MERMAID_UNKNOWN_MEMBER",
262
- "Subgraph references an absent member: " + i,
263
- "semantics",
264
- "error",
265
- [e.id, i]
266
- );
267
- continue;
268
- }
269
- const u = a.get(i);
270
- if (u && u !== e.id) {
271
- s(
272
- "MERMAID_MULTIPLE_PARENTS",
273
- "A member belongs to multiple native parents; containment was not guessed.",
274
- "semantics",
275
- "error",
276
- [i, u, e.id]
277
- );
278
- continue;
279
- }
280
- a.set(i, e.id), t.get(i).parent = t.get(e.id).id;
281
- }
282
- const d = R(c.direction, "root");
283
- d && p.layouts.push({ scope: "root", kind: "flow", direction: d });
284
- const o = /* @__PURE__ */ new Map();
285
- for (const e of c.groups) {
286
- const i = R(e.dir, e.id);
287
- i && o.set(e.id, i);
288
- }
289
- const g = (e) => {
290
- const i = /* @__PURE__ */ new Set();
291
- let u = e;
292
- for (; u && !i.has(u); ) {
293
- i.add(u);
294
- const S = o.get(u);
295
- if (S) return S;
296
- u = a.get(u);
297
- }
298
- return d ?? "down";
299
- };
300
- for (const e of c.groups) {
301
- const i = t.get(e.id), u = r.get(e.id);
302
- I(
303
- i,
304
- _([...e.classes, ...u?.classes ?? []], u?.styles ?? [], !1, e.id),
305
- e.id
306
- ), p.layouts.push({
307
- scope: i.id,
308
- kind: "flow",
309
- direction: g(e.id)
310
- }), e.dir ? s(
311
- "MERMAID_SUBGRAPH_LAYOUT",
312
- "The native group retains its declared direction. Mermaid can ignore a subgraph direction when its members connect outside, so the resulting layout may differ.",
313
- "layout",
314
- "warning",
315
- [e.id]
316
- ) : s(
317
- "MERMAID_INHERITED_LAYOUT",
318
- "This group has no declared direction. Native flow layout uses the nearest declared ancestor/root direction; Mermaid can use another direction depending on its layout engine and external connections.",
319
- "layout",
320
- "warning",
321
- [e.id]
322
- ), e.metadata && Object.keys(e.metadata).length && s(
323
- "MERMAID_GROUP_METADATA",
324
- "Group metadata (including collapsed view and engine hints) is omitted: " + Object.keys(e.metadata).join(", "),
325
- "layout",
326
- "warning",
327
- [e.id]
328
- );
329
- }
330
- for (const e of c.vertices) {
331
- const i = t.get(e.id);
332
- n.has(e.id) || I(i, _(e.classes, e.styles, !0, e.id), e.id), e.link && s(
333
- "MERMAID_LINK_OMITTED",
334
- "External link was omitted; the native object has no active link.",
335
- "security",
336
- "warning",
337
- [e.id]
338
- ), (e.img || e.icon) && s(
339
- "MERMAID_ASSET_OMITTED",
340
- "Image/icon references are not fetched or embedded; the object remains a labeled native shape.",
341
- "security",
342
- "warning",
343
- [e.id]
344
- ), e.props && Object.keys(e.props).length && s(
345
- "MERMAID_NODE_METADATA",
346
- "Node properties are omitted: " + Object.keys(e.props).join(", "),
347
- "semantics",
348
- "warning",
349
- [e.id]
350
- );
351
- }
352
- p.objects.push(...t.values());
353
- for (const [e, i] of c.edges.entries()) {
354
- const u = H[String(i.type)];
355
- if (!u) {
356
- s(
357
- "MERMAID_ARROW_UNSUPPORTED",
358
- "Edge terminal semantics are unsupported: " + String(i.type) + ". The import is blocked rather than replacing them with ordinary arrows.",
359
- "semantics",
360
- "error",
361
- [i.id ?? String(e + 1)]
362
- );
363
- continue;
364
- }
365
- if (i.stroke === "invisible") {
366
- s(
367
- "MERMAID_INVISIBLE_EDGE",
368
- "Invisible links express layout constraints, not visible relationships; this profile cannot preserve them.",
369
- "layout",
370
- "error",
371
- [i.id ?? String(e + 1)]
372
- );
373
- continue;
374
- }
375
- if (!["normal", "thick", "dotted"].includes(i.stroke ?? "normal")) {
376
- s(
377
- "MERMAID_EDGE_STROKE",
378
- "Unsupported edge stroke: " + String(i.stroke),
379
- "appearance",
380
- "error",
381
- [i.id ?? String(e + 1)]
382
- );
383
- continue;
384
- }
385
- const S = t.get(i.start), y = t.get(i.end);
386
- if (!S || !y) {
387
- s("MERMAID_ENDPOINT", "A parsed edge has a missing endpoint.", "semantics", "error", [
388
- i.start,
389
- i.end
390
- ]);
391
- continue;
392
- }
393
- const U = i.isUserDefinedId && i.id ? l.get("edge-id", i.id, i.id) : l.get("edge-occurrence", String(e + 1), "edge_" + (e + 1)), A = i.id ?? String(e + 1);
394
- p.edges.push({
395
- id: U,
396
- from: S.id,
397
- to: y.id,
398
- label: M(i.text, i.labelType, A),
399
- directed: i.type !== "arrow_open",
400
- ...u,
401
- ...i.stroke === "dotted" ? { dashed: !0 } : {}
402
- }), i.stroke === "dotted" && s(
403
- "MERMAID_DASH_STYLE",
404
- "Dotted Mermaid stroke uses native kind=async only for its dashed visual treatment; no asynchronous execution semantics are inferred.",
405
- "appearance",
406
- "info",
407
- [A]
408
- ), i.stroke === "thick" && s(
409
- "MERMAID_THICK_EDGE",
410
- "Thick edge emphasis is omitted by this native-source profile.",
411
- "appearance",
412
- "warning",
413
- [A]
414
- ), (i.length ?? 1) > 1 && s(
415
- "MERMAID_MIN_RANK_LENGTH",
416
- "Minimum rank-length hint is omitted; native layout chooses spacing.",
417
- "layout",
418
- "warning",
419
- [A]
420
- ), (i.animate || i.animation) && s("MERMAID_EDGE_ANIMATION", "Edge animation is omitted.", "appearance", "warning", [
421
- A
422
- ]), (i.interpolate || c.defaultEdgeInterpolate) && s(
423
- "MERMAID_EDGE_CURVE",
424
- "Mermaid curve hints are omitted; native routing is used.",
425
- "layout",
426
- "warning",
427
- [A]
428
- );
429
- const w = _(
430
- i.classes,
431
- [...c.defaultEdgeStyle, ...i.style],
432
- !1,
433
- A
434
- );
435
- w.length && s(
436
- "MERMAID_EDGE_STYLE",
437
- "Per-edge CSS is omitted because native edge appearance is not a general CSS style map: " + w.join("; "),
438
- "appearance",
439
- "warning",
440
- [A]
441
- );
442
- }
443
- return E();
444
- } catch (n) {
445
- return s(
446
- "MERMAID_MAPPING_ERROR",
447
- "Could not map the parser snapshot: " + (n instanceof Error ? n.message : String(n)),
448
- "semantics",
449
- "error"
450
- ), E();
451
- }
452
- }
453
- function z(m, f, D) {
454
- const p = $(m, f, D);
455
- if (!p.nativeSource) return p;
456
- try {
457
- return x(p.nativeSource), p;
458
- } catch (l) {
459
- return {
460
- ...p,
461
- status: "failed",
462
- nativeSource: void 0,
463
- facts: void 0,
464
- diagnostics: [
465
- ...p.diagnostics,
466
- {
467
- code: "IMPORT_NATIVE_INVALID",
468
- severity: "error",
469
- impact: "semantics",
470
- message: "The converted diagram cannot be represented in native source: " + (l instanceof Error ? l.message : String(l))
471
- }
472
- ]
473
- };
474
- }
475
- }
476
- export {
477
- z as importMermaidFlow
478
- };