@miragon/value-chain-renderer 0.4.0 → 0.6.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 (69) hide show
  1. package/README.md +102 -12
  2. package/dist/Modeler.d.ts +4 -1
  3. package/dist/Modeler.d.ts.map +1 -1
  4. package/dist/VcBaseViewer.d.ts +24 -3
  5. package/dist/VcBaseViewer.d.ts.map +1 -1
  6. package/dist/bounds/VcBounds.d.ts +17 -0
  7. package/dist/bounds/VcBounds.d.ts.map +1 -0
  8. package/dist/bounds/index.d.ts +5 -0
  9. package/dist/bounds/index.d.ts.map +1 -0
  10. package/dist/collaborative/CollaborativeValueChain.d.ts +32 -0
  11. package/dist/collaborative/CollaborativeValueChain.d.ts.map +1 -0
  12. package/dist/collaborative/index.d.ts +2 -0
  13. package/dist/collaborative/index.d.ts.map +1 -0
  14. package/dist/context-pad/VcContextPadProvider.d.ts +3 -1
  15. package/dist/context-pad/VcContextPadProvider.d.ts.map +1 -1
  16. package/dist/diagram-menu/ShortcutsDialog.d.ts +27 -0
  17. package/dist/diagram-menu/ShortcutsDialog.d.ts.map +1 -0
  18. package/dist/diagram-menu/index.d.ts +7 -0
  19. package/dist/diagram-menu/index.d.ts.map +1 -0
  20. package/dist/diagram-menu/menu.d.ts +44 -0
  21. package/dist/diagram-menu/menu.d.ts.map +1 -0
  22. package/dist/diagram-menu/shortcuts.d.ts +41 -0
  23. package/dist/diagram-menu/shortcuts.d.ts.map +1 -0
  24. package/dist/draw/VcRenderer.d.ts +10 -1
  25. package/dist/draw/VcRenderer.d.ts.map +1 -1
  26. package/dist/draw/icons.d.ts +4 -7
  27. package/dist/draw/icons.d.ts.map +1 -1
  28. package/dist/draw/lucide.d.ts +31 -0
  29. package/dist/draw/lucide.d.ts.map +1 -0
  30. package/dist/draw/styles.d.ts +11 -5
  31. package/dist/draw/styles.d.ts.map +1 -1
  32. package/dist/index.d.ts +8 -4
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +1274 -520
  35. package/dist/index.js.map +1 -1
  36. package/dist/io/VcExporter.d.ts +6 -5
  37. package/dist/io/VcExporter.d.ts.map +1 -1
  38. package/dist/io/VcImporter.d.ts +21 -3
  39. package/dist/io/VcImporter.d.ts.map +1 -1
  40. package/dist/io/index.d.ts +2 -1
  41. package/dist/io/index.d.ts.map +1 -1
  42. package/dist/io/png.d.ts +8 -0
  43. package/dist/io/png.d.ts.map +1 -0
  44. package/dist/io/saveSvg.d.ts +5 -5
  45. package/dist/io/saveSvg.d.ts.map +1 -1
  46. package/dist/io/types.d.ts +6 -1
  47. package/dist/io/types.d.ts.map +1 -1
  48. package/dist/keyboard/VcEditorActions.d.ts +5 -1
  49. package/dist/keyboard/VcEditorActions.d.ts.map +1 -1
  50. package/dist/keyboard/VcKeyboardBindings.d.ts +14 -2
  51. package/dist/keyboard/VcKeyboardBindings.d.ts.map +1 -1
  52. package/dist/keyboard/index.d.ts +2 -2
  53. package/dist/keyboard/index.d.ts.map +1 -1
  54. package/dist/label-editing/VcLabelEditingProvider.d.ts +46 -5
  55. package/dist/label-editing/VcLabelEditingProvider.d.ts.map +1 -1
  56. package/dist/label-editing/index.d.ts +1 -1
  57. package/dist/label-editing/index.d.ts.map +1 -1
  58. package/dist/model/VcDiagramElementFactory.d.ts +4 -4
  59. package/dist/model/VcDiagramElementFactory.d.ts.map +1 -1
  60. package/dist/palette/VcPaletteProvider.d.ts +41 -5
  61. package/dist/palette/VcPaletteProvider.d.ts.map +1 -1
  62. package/dist/palette/index.d.ts +1 -1
  63. package/dist/palette/index.d.ts.map +1 -1
  64. package/dist/read-only/VcReadOnly.d.ts +25 -0
  65. package/dist/read-only/VcReadOnly.d.ts.map +1 -0
  66. package/dist/read-only/index.d.ts +5 -0
  67. package/dist/read-only/index.d.ts.map +1 -0
  68. package/dist/value-chain.css +1 -1
  69. package/package.json +16 -8
package/dist/index.js CHANGED
@@ -1,94 +1,96 @@
1
1
  import e from "diagram-js/lib/Diagram";
2
- import { getBBox as t } from "diagram-js/lib/util/Elements";
3
- import { CURRENT_SCHEMA_VERSION as n, DEFAULT_ORG_UNIT_SIZE as r, DEFAULT_STEP_SIZE as i, MIN_STEP_SIZE as a, validateDocument as o } from "@miragon/value-chain-schema-model";
4
- import s from "diagram-js/lib/core/ElementFactory";
5
- import c from "diagram-js/lib/draw/BaseRenderer";
6
- import l from "diagram-js/lib/util/Text";
7
- import { createLine as u } from "diagram-js/lib/util/RenderUtil";
8
- import { append as d, attr as f, create as p } from "tiny-svg";
9
- import ee from "diagram-js/lib/features/selection";
10
- import te from "diagram-js/lib/navigation/zoomscroll";
11
- import ne from "diagram-js/lib/navigation/movecanvas";
12
- import re from "diagram-js/lib/features/modeling";
13
- import ie from "diagram-js/lib/features/move";
14
- import ae from "diagram-js/lib/features/outline";
15
- import oe from "diagram-js/lib/features/bendpoints";
16
- import se from "diagram-js/lib/features/auto-scroll";
17
- import ce from "diagram-js/lib/features/grid-snapping";
18
- import le from "diagram-js/lib/features/snapping";
19
- import ue from "diagram-js/lib/features/keyboard-move-selection";
20
- import de from "diagram-js/lib/navigation/keyboard-move";
21
- import fe from "diagram-js/lib/layout/CroppingConnectionDocking";
22
- import pe from "diagram-js/lib/layout/BaseLayouter";
23
- import { getMid as m } from "diagram-js/lib/layout/LayoutUtil";
24
- import { connectPoints as me, connectRectangles as he, withoutRedundantPoints as h } from "diagram-js/lib/layout/ManhattanLayout";
25
- import ge from "diagram-js/lib/command/CommandInterceptor";
26
- import _e from "diagram-js/lib/features/rules";
27
- import ve from "diagram-js/lib/features/rules/RuleProvider";
28
- import ye from "diagram-js/lib/features/connect";
29
- import be from "diagram-js/lib/features/auto-place";
30
- import xe from "diagram-js/lib/features/create";
31
- import Se from "diagram-js/lib/features/connection-preview";
32
- import Ce from "diagram-js/lib/features/palette";
33
- import we from "diagram-js/lib/features/hand-tool";
34
- import Te from "diagram-js/lib/features/lasso-tool";
35
- import Ee from "diagram-js/lib/features/space-tool";
36
- import De from "diagram-js/lib/features/global-connect";
37
- import Oe from "diagram-js/lib/features/context-pad";
38
- import g from "diagram-js/lib/features/popup-menu";
39
- import ke from "diagram-js-direct-editing";
40
- import Ae from "diagram-js/lib/features/align-elements";
41
- import je from "diagram-js/lib/features/distribute-elements";
42
- import Me from "diagram-js/lib/features/keyboard";
43
- import Ne from "diagram-js/lib/features/editor-actions";
44
- import Pe from "diagram-js/lib/features/keyboard/KeyboardBindings";
45
- import { hasModifier as Fe, isKey as Ie } from "diagram-js/lib/features/keyboard/KeyboardUtil";
46
- import Le from "diagram-js/lib/features/ordering/OrderingProvider";
47
- import Re from "diagram-js/lib/features/copy-paste";
48
- import ze from "diagram-js/lib/features/resize";
2
+ import { CURRENT_SCHEMA_VERSION as t, DEFAULT_ORG_UNIT_SIZE as n, DEFAULT_STEP_SIZE as r, MIN_STEP_SIZE as i, connectionExtensions as a, createEmptyDocument as o, documentExtensions as s, elementExtensions as c, metaExtensions as l, parseDocumentJSON as u, serializeDocument as d, validateDocument as f } from "@miragon/value-chain-schema-model";
3
+ import ee from "diagram-js/lib/core/ElementFactory";
4
+ import te from "diagram-js/lib/draw/BaseRenderer";
5
+ import ne from "diagram-js/lib/util/Text";
6
+ import { createLine as re } from "diagram-js/lib/util/RenderUtil";
7
+ import { append as p, attr as m, create as h } from "tiny-svg";
8
+ import { getBBox as ie } from "diagram-js/lib/util/Elements";
9
+ import ae from "diagram-js/lib/features/selection";
10
+ import oe from "diagram-js/lib/navigation/zoomscroll";
11
+ import se from "diagram-js/lib/navigation/movecanvas";
12
+ import ce from "diagram-js/lib/features/modeling";
13
+ import le from "diagram-js/lib/features/move";
14
+ import ue from "diagram-js/lib/features/outline";
15
+ import de from "diagram-js/lib/features/bendpoints";
16
+ import fe from "diagram-js/lib/features/auto-scroll";
17
+ import pe from "diagram-js/lib/features/grid-snapping";
18
+ import me from "diagram-js/lib/features/snapping";
19
+ import he from "diagram-js/lib/features/keyboard-move-selection";
20
+ import ge from "diagram-js/lib/navigation/keyboard-move";
21
+ import _e from "diagram-js/lib/layout/CroppingConnectionDocking";
22
+ import ve from "diagram-js/lib/layout/BaseLayouter";
23
+ import { getMid as g } from "diagram-js/lib/layout/LayoutUtil";
24
+ import { connectPoints as ye, connectRectangles as be, withoutRedundantPoints as _ } from "diagram-js/lib/layout/ManhattanLayout";
25
+ import xe from "diagram-js/lib/command/CommandInterceptor";
26
+ import Se from "diagram-js/lib/features/rules";
27
+ import Ce from "diagram-js/lib/features/rules/RuleProvider";
28
+ import we from "diagram-js/lib/features/connect";
29
+ import Te from "diagram-js/lib/features/auto-place";
30
+ import Ee from "diagram-js/lib/features/create";
31
+ import De from "diagram-js/lib/features/connection-preview";
32
+ import Oe from "diagram-js/lib/features/palette";
33
+ import ke from "diagram-js/lib/features/hand-tool";
34
+ import Ae from "diagram-js/lib/features/lasso-tool";
35
+ import je from "diagram-js/lib/features/space-tool";
36
+ import Me from "diagram-js/lib/features/global-connect";
37
+ import Ne from "diagram-js/lib/features/context-pad";
38
+ import v from "diagram-js/lib/features/popup-menu";
39
+ import Pe from "diagram-js-direct-editing";
40
+ import Fe from "diagram-js/lib/features/align-elements";
41
+ import Ie from "diagram-js/lib/features/distribute-elements";
42
+ import Le from "diagram-js/lib/features/keyboard";
43
+ import Re from "diagram-js/lib/features/editor-actions";
44
+ import ze from "diagram-js/lib/features/keyboard/KeyboardBindings";
45
+ import { hasModifier as Be, isCmd as Ve, isKey as y } from "diagram-js/lib/features/keyboard/KeyboardUtil";
46
+ import He from "diagram-js/lib/features/ordering/OrderingProvider";
47
+ import Ue from "diagram-js/lib/features/copy-paste";
48
+ import We from "diagram-js/lib/features/resize";
49
+ import { MODELER_API_VERSION as Ge } from "@miragon/modeler-api";
50
+ //#region src/io/saveSvg.ts
51
+ var Ke = 20, qe = {
52
+ x: 0,
53
+ y: 0,
54
+ width: 800,
55
+ height: 600
56
+ }, Je = [
57
+ "tabindex",
58
+ "role",
59
+ "aria-label",
60
+ "aria-roledescription"
61
+ ];
62
+ function b(e, t) {
63
+ let n = [...e.getContainer().children].find((e) => e instanceof SVGSVGElement);
64
+ if (!n) throw Error("No SVG found in the canvas container.");
65
+ let r = t.contentBounds(Ke) ?? qe, i = n.cloneNode(!0);
66
+ for (let e of Je) i.removeAttribute(e);
67
+ i.setAttribute("xmlns", "http://www.w3.org/2000/svg"), i.setAttribute("viewBox", `${r.x} ${r.y} ${r.width} ${r.height}`), i.setAttribute("width", String(r.width)), i.setAttribute("height", String(r.height));
68
+ let a = i.querySelector(".viewport");
69
+ return a && a.removeAttribute("transform"), { svg: `<?xml version="1.0" encoding="utf-8"?>\n${new XMLSerializer().serializeToString(i)}` };
70
+ }
71
+ //#endregion
49
72
  //#region src/model/di-types.ts
50
- function _(e) {
73
+ function x(e) {
51
74
  return typeof e == "object" && !!e;
52
75
  }
53
- function v(e) {
54
- return _(e) && (e.vcType === "step" || e.vcType === "orgUnit");
55
- }
56
- function y(e) {
57
- return _(e) && e.vcType === "step";
76
+ function S(e) {
77
+ return x(e) && (e.vcType === "step" || e.vcType === "orgUnit");
58
78
  }
59
- function b(e) {
60
- return _(e) && e.vcType === "orgUnit";
79
+ function C(e) {
80
+ return x(e) && e.vcType === "step";
61
81
  }
62
- function x(e) {
63
- return _(e) && (e.vcType === "sequence" || e.vcType === "hierarchy" || e.vcType === "assignment") && "waypoints" in e;
82
+ function w(e) {
83
+ return x(e) && e.vcType === "orgUnit";
64
84
  }
65
- function S(e) {
66
- return v(e) || x(e);
85
+ function T(e) {
86
+ return x(e) && (e.vcType === "sequence" || e.vcType === "hierarchy" || e.vcType === "assignment") && "waypoints" in e;
67
87
  }
68
- //#endregion
69
- //#region src/io/saveSvg.ts
70
- var C = 20;
71
- function w(e, n) {
72
- let r = e.getContainer().querySelector("svg");
73
- if (!r) throw Error("No SVG found in the canvas container.");
74
- let i = n.getAll().filter(S), a = i.length ? t(i) : {
75
- x: 0,
76
- y: 0,
77
- width: 800,
78
- height: 600
79
- }, o = {
80
- x: a.x - C,
81
- y: a.y - C,
82
- width: a.width + 40,
83
- height: a.height + 40
84
- }, s = r.cloneNode(!0);
85
- s.setAttribute("xmlns", "http://www.w3.org/2000/svg"), s.setAttribute("viewBox", `${o.x} ${o.y} ${o.width} ${o.height}`), s.setAttribute("width", String(o.width)), s.setAttribute("height", String(o.height));
86
- let c = s.querySelector(".viewport");
87
- return c && c.removeAttribute("transform"), { svg: `<?xml version="1.0" encoding="utf-8"?>\n${new XMLSerializer().serializeToString(s)}` };
88
+ function E(e) {
89
+ return S(e) || T(e);
88
90
  }
89
91
  //#endregion
90
92
  //#region src/VcBaseViewer.ts
91
- var T = class {
93
+ var Ye = class {
92
94
  _diagram;
93
95
  _container;
94
96
  _options;
@@ -111,20 +113,25 @@ var T = class {
111
113
  this.get("eventBus").off(e, t);
112
114
  }
113
115
  importDocument(e) {
114
- let t = this.get("vcImporter");
115
- t.clear();
116
- let n = t.import(e);
117
- return this.getOptional("commandStack")?.clear(), this.fitViewport(), this.get("eventBus").fire("import.done", { warnings: n }), n;
116
+ let t = f(e), n = this.getOptional("vcLabelEditingProvider"), r = this._currentDocument();
117
+ n?.suspend(), this.getOptional("popupMenu")?.close();
118
+ let i;
119
+ try {
120
+ i = this._render(t);
121
+ } catch (e) {
122
+ throw r && this._render(r), e;
123
+ }
124
+ return n?.resumeAfterImport(), i;
118
125
  }
119
126
  exportDocument() {
120
127
  return this.get("vcExporter").export();
121
128
  }
122
129
  saveSVG() {
123
- return w(this.get("canvas"), this.get("elementRegistry"));
130
+ return b(this.get("canvas"), this.get("vcBounds"));
124
131
  }
125
132
  fitViewport() {
126
133
  let e = this.get("canvas");
127
- this.get("elementRegistry").getAll().some(S) && (e.zoom("fit-viewport"), e.zoom() > 1 && e.zoom(1));
134
+ this.get("elementRegistry").getAll().some(E) && (e.zoom("fit-viewport"), e.zoom() > 1 && e.zoom(1));
128
135
  }
129
136
  clear() {
130
137
  this.get("vcImporter").clear(), this.getOptional("commandStack")?.clear();
@@ -138,27 +145,46 @@ var T = class {
138
145
  destroy() {
139
146
  this._diagram?.destroy(), this._diagram = void 0, this.detach();
140
147
  }
148
+ _render(e) {
149
+ let t = this.get("vcImporter");
150
+ t.clear();
151
+ let n = t.import(e);
152
+ return this.getOptional("commandStack")?.clear(!1), this.get("eventBus").fire("import.done", { warnings: n }), n;
153
+ }
154
+ _currentDocument() {
155
+ try {
156
+ return this.exportDocument();
157
+ } catch {
158
+ return;
159
+ }
160
+ }
141
161
  _createContainer(e) {
142
162
  let t = e.container ?? document.createElement("div");
143
- return t.classList.add("vc-container"), t.style.width = E(e.width ?? "100%"), t.style.height = E(e.height ?? (e.container ? "100%" : "600px")), t;
163
+ return t.classList.add("vc-container"), t.style.width = Xe(e.width ?? "100%"), t.style.height = Xe(e.height ?? (e.container ? "100%" : "600px")), t;
144
164
  }
145
165
  _ensureDiagram() {
146
166
  if (!this._diagram) {
147
167
  let t = [...this._getModules(), ...this._options.additionalModules ?? []];
148
168
  this._diagram = new e({
149
169
  canvas: { container: this._container },
150
- modules: t
170
+ modules: t,
171
+ vcPalette: {
172
+ freeArea: this._options.freeArea,
173
+ freeRectCenter: this._options.freeRectCenter
174
+ },
175
+ vcKeyboard: { undoRedoKeys: this._options.undoRedoKeys ?? !0 },
176
+ vcImport: { fitOnImport: this._options.fitOnImport ?? !0 }
151
177
  });
152
178
  }
153
179
  return this._diagram;
154
180
  }
155
181
  };
156
- function E(e) {
182
+ function Xe(e) {
157
183
  return typeof e == "number" ? `${e}px` : e;
158
184
  }
159
185
  //#endregion
160
186
  //#region src/model/VcElementFactory.ts
161
- var D = class {
187
+ var Ze = class {
162
188
  elementFactory;
163
189
  static $inject = ["elementFactory"];
164
190
  constructor(e) {
@@ -193,31 +219,41 @@ var D = class {
193
219
  }
194
220
  createNewStep(e = "") {
195
221
  return this.elementFactory.createShape({
196
- width: i.width,
197
- height: i.height,
222
+ width: r.width,
223
+ height: r.height,
198
224
  vcType: "step",
199
225
  vcLabel: e
200
226
  });
201
227
  }
202
228
  createNewOrgUnit(e = "") {
203
229
  return this.elementFactory.createShape({
204
- width: r.width,
205
- height: r.height,
230
+ width: n.width,
231
+ height: n.height,
206
232
  vcType: "orgUnit",
207
233
  vcLabel: e
208
234
  });
209
235
  }
210
- }, O = class extends s {
236
+ }, Qe = "0123456789abcdefghijklmnopqrstuvwxyz", $e = 8, et = {
237
+ step: "step",
238
+ orgUnit: "org",
239
+ sequence: "sequence",
240
+ hierarchy: "hierarchy",
241
+ assignment: "assignment"
242
+ };
243
+ function tt() {
244
+ let e = crypto.getRandomValues(new Uint8Array($e));
245
+ return Array.from(e, (e) => Qe[e % 36]).join("");
246
+ }
247
+ var nt = class extends ee {
211
248
  elementRegistry;
212
249
  static $inject = ["elementRegistry"];
213
- counters = /* @__PURE__ */ new Map();
214
250
  constructor(e) {
215
251
  super(), this.elementRegistry = e;
216
252
  }
217
253
  create(e, t) {
218
254
  let n = t?.id ? t : {
219
255
  ...t,
220
- id: this.unusedId(e)
256
+ id: this.unusedId(e, t)
221
257
  };
222
258
  switch (e) {
223
259
  case "root": return super.create(e, n);
@@ -226,31 +262,31 @@ var D = class {
226
262
  case "label": return super.create(e, n);
227
263
  }
228
264
  }
229
- unusedId(e) {
230
- let t = this.counters.get(e) ?? 0, n;
265
+ unusedId(e, t) {
266
+ let n = t?.vcType, r = typeof n == "string" && et[n] || e, i;
231
267
  do
232
- t += 1, n = `${e}_${t}`;
233
- while (this.elementRegistry.get(n));
234
- return this.counters.set(e, t), n;
268
+ i = `${r}_${tt()}`;
269
+ while (this.elementRegistry.get(i));
270
+ return i;
235
271
  }
236
- }, k = {
237
- elementFactory: ["type", O],
238
- vcElementFactory: ["type", D]
272
+ }, rt = {
273
+ elementFactory: ["type", nt],
274
+ vcElementFactory: ["type", Ze]
239
275
  };
240
276
  //#endregion
241
277
  //#region src/draw/geometry.ts
242
- function A(e, t) {
278
+ function D(e, t) {
243
279
  return Math.min(t / 2, .4 * e);
244
280
  }
245
- function j(e, t) {
246
- return N(0, 0, e, t);
281
+ function it(e, t) {
282
+ return O(0, 0, e, t);
247
283
  }
248
- function M(e, t) {
249
- let n = A(e, t);
284
+ function at(e, t) {
285
+ let n = D(e, t);
250
286
  return Math.max(7, n - 5);
251
287
  }
252
- function N(e, t, n, r) {
253
- let i = A(n, r), a = t + r / 2;
288
+ function O(e, t, n, r) {
289
+ let i = D(n, r), a = t + r / 2;
254
290
  return [
255
291
  `M${e},${t}`,
256
292
  `L${e + n - i},${t}`,
@@ -261,7 +297,7 @@ function N(e, t, n, r) {
261
297
  "Z"
262
298
  ].join("");
263
299
  }
264
- function P(e, t, n, r) {
300
+ function k(e, t, n, r) {
265
301
  let i = n / 2, a = r / 2, o = e + i;
266
302
  return [
267
303
  `M${o},${t}`,
@@ -271,15 +307,42 @@ function P(e, t, n, r) {
271
307
  ].join("");
272
308
  }
273
309
  //#endregion
274
- //#region src/draw/styles.ts
275
- var F = {
276
- ink: "hsl(225, 10%, 15%)",
277
- fill: "white"
278
- }, I = {
279
- family: "Arial, sans-serif",
310
+ //#region src/theme/cd-tokens.generated.json
311
+ var ot = {
312
+ "--cd-ui-grund": "#F9F7F7",
313
+ "--cd-ui-flaeche": "#FFFFFF",
314
+ "--cd-ui-flaeche-hoch": "#FFFFFF",
315
+ "--cd-ui-hover": "#EEF1FD",
316
+ "--cd-ui-plot": "#FFFFFF",
317
+ "--cd-ui-seite": "#FFFFFF",
318
+ "--cd-ui-abschnitt": "#F9F7F7",
319
+ "--cd-ui-linie": "#E6E2E2",
320
+ "--cd-ui-kontur": "#8F8A8A",
321
+ "--cd-ui-text": "#1D1D1D",
322
+ "--cd-ui-text-leise": "#6B6666",
323
+ "--cd-ui-link": "#2B50D4",
324
+ "--cd-ui-icon-akzent": "#335DE5",
325
+ "--cd-ui-fokus": "#2B50D4",
326
+ "--cd-ui-interaktion": "#335DE5",
327
+ "--cd-ui-success": "#00E676",
328
+ "--cd-ui-warning": "#FFB000",
329
+ "--cd-ui-danger": "#CD1839",
330
+ "--cd-ui-info": "#335DE5",
331
+ "--cd-ui-success-flaeche": "#DAFBEB",
332
+ "--cd-ui-warning-flaeche": "#FFF1D2",
333
+ "--cd-ui-danger-flaeche": "#FBEEF0",
334
+ "--cd-ui-info-flaeche": "#EEF1FD",
335
+ "--cd-ui-wortmarke": "#00E676",
336
+ "--cd-ui-backdrop": "rgba(29, 29, 29, 0.42)",
337
+ "--cd-ui-chrome-deckkraft": "84%"
338
+ }, A = {
339
+ ink: ot["--cd-ui-text"],
340
+ fill: ot["--cd-ui-plot"]
341
+ }, j = {
342
+ family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, sans-serif",
280
343
  size: 12,
281
344
  lineHeight: 1.2
282
- }, L = [
345
+ }, st = [
283
346
  { label: "Default" },
284
347
  {
285
348
  label: "Blue",
@@ -301,32 +364,48 @@ var F = {
301
364
  label: "Purple",
302
365
  color: "hsl(287, 65%, 44%)"
303
366
  }
304
- ], Be = 1500, Ve = "M 1 5 L 11 10 L 1 15 Z", He = 0, R = class extends c {
305
- static $inject = ["eventBus"];
306
- textUtil = new l({ style: {
307
- fontFamily: I.family,
308
- fontSize: I.size,
367
+ ], ct = 1500, lt = "M 1 5 L 11 10 L 1 15 Z", ut = 0, dt = class extends te {
368
+ elementRegistry;
369
+ graphicsFactory;
370
+ static $inject = [
371
+ "eventBus",
372
+ "elementRegistry",
373
+ "graphicsFactory"
374
+ ];
375
+ textUtil = new ne({ style: {
376
+ fontFamily: j.family,
377
+ fontSize: j.size,
309
378
  fontWeight: "normal",
310
- lineHeight: I.lineHeight
379
+ lineHeight: j.lineHeight
311
380
  } });
312
- markerSuffix = `${He += 1}`;
313
- constructor(e) {
314
- super(e, Be);
381
+ markerSuffix = `${ut += 1}`;
382
+ constructor(e, t, n) {
383
+ super(e, ct), this.elementRegistry = t, this.graphicsFactory = n, this.relayoutLabelsWhenTheFontArrives(e);
384
+ }
385
+ relayoutLabelsWhenTheFontArrives(e) {
386
+ let t = typeof document > "u" ? void 0 : document.fonts, n = `${j.size}px ${j.family}`;
387
+ if (!t || t.check(n)) return;
388
+ let r = !1;
389
+ e.on("diagram.destroy", () => {
390
+ r = !0;
391
+ }), t.load(n).then((e) => {
392
+ if (!(r || e.length === 0)) for (let e of this.elementRegistry.getAll()) S(e) && e.vcLabel && this.graphicsFactory.update("shape", e, this.elementRegistry.getGraphics(e));
393
+ }, () => void 0);
315
394
  }
316
395
  canRender(e) {
317
- return v(e) || x(e);
396
+ return S(e) || T(e);
318
397
  }
319
398
  drawShape(e, t) {
320
- let n = t, r = n.color ?? F.ink, i = b(n), a = p("path");
321
- if (f(a, {
322
- d: i ? P(0, 0, n.width, n.height) : j(n.width, n.height),
323
- fill: F.fill,
399
+ let n = t, r = n.color ?? A.ink, i = w(n), a = h("path");
400
+ if (m(a, {
401
+ d: i ? k(0, 0, n.width, n.height) : it(n.width, n.height),
402
+ fill: A.fill,
324
403
  stroke: r,
325
404
  "stroke-width": 2,
326
405
  "stroke-linecap": "round",
327
406
  "stroke-linejoin": "round"
328
- }), d(e, a), n.vcLabel) {
329
- let t = i ? 12 : M(n.width, n.height), a = this.textUtil.createText(n.vcLabel, {
407
+ }), p(e, a), n.vcLabel) {
408
+ let t = i ? 12 : at(n.width, n.height), a = this.textUtil.createText(n.vcLabel, {
330
409
  box: {
331
410
  width: n.width,
332
411
  height: n.height
@@ -340,12 +419,12 @@ var F = {
340
419
  },
341
420
  style: { fill: r }
342
421
  });
343
- d(e, a);
422
+ p(e, a);
344
423
  }
345
424
  return a;
346
425
  }
347
426
  drawConnection(e, t) {
348
- let n = t, r = F.ink, i = {
427
+ let n = t, r = A.ink, i = {
349
428
  stroke: r,
350
429
  "stroke-width": 2,
351
430
  "stroke-linecap": "round",
@@ -356,11 +435,11 @@ var F = {
356
435
  let t = e.ownerSVGElement;
357
436
  t && (i["marker-end"] = this.arrowMarker(t, r));
358
437
  }
359
- let a = u(n.waypoints, i);
360
- return d(e, a), a;
438
+ let a = re(n.waypoints, i);
439
+ return p(e, a), a;
361
440
  }
362
441
  getShapePath(e) {
363
- return b(e) ? P(e.x, e.y, e.width, e.height) : N(e.x, e.y, e.width, e.height);
442
+ return w(e) ? k(e.x, e.y, e.width, e.height) : O(e.x, e.y, e.width, e.height);
364
443
  }
365
444
  getConnectionPath(e) {
366
445
  let [t, ...n] = e.waypoints;
@@ -370,9 +449,9 @@ var F = {
370
449
  let n = `vc-arrow-${this.markerSuffix}-${t.replace(/[^a-zA-Z0-9]/g, "")}`;
371
450
  if (!e.querySelector(`marker[id="${n}"]`)) {
372
451
  let r = e.querySelector("defs");
373
- r || (r = p("defs"), d(e, r));
374
- let i = p("marker");
375
- f(i, {
452
+ r || (r = h("defs"), p(e, r));
453
+ let i = h("marker");
454
+ m(i, {
376
455
  id: n,
377
456
  viewBox: "0 0 20 20",
378
457
  refX: 11,
@@ -381,49 +460,72 @@ var F = {
381
460
  markerHeight: 10,
382
461
  orient: "auto"
383
462
  });
384
- let a = p("path");
385
- f(a, {
386
- d: Ve,
463
+ let a = h("path");
464
+ m(a, {
465
+ d: lt,
387
466
  fill: t,
388
467
  stroke: t,
389
468
  "stroke-width": 1,
390
469
  "stroke-linejoin": "round"
391
- }), d(i, a), d(r, i);
470
+ }), p(i, a), p(r, i);
392
471
  }
393
472
  return `url(#${n})`;
394
473
  }
395
- }, z = {
474
+ }, ft = {
396
475
  __init__: ["vcRenderer"],
397
- vcRenderer: ["type", R]
398
- }, B = "vc-root", V = class {
476
+ vcRenderer: ["type", dt]
477
+ }, pt = class {
478
+ elementRegistry;
479
+ static $inject = ["elementRegistry"];
480
+ constructor(e) {
481
+ this.elementRegistry = e;
482
+ }
483
+ isEmpty() {
484
+ return !this.elementRegistry.getAll().some(S);
485
+ }
486
+ contentBounds(e = 0) {
487
+ if (this.isEmpty()) return;
488
+ let t = this.elementRegistry.filter(E), { x: n, y: r, width: i, height: a } = ie(t);
489
+ return {
490
+ x: n - e,
491
+ y: r - e,
492
+ width: i + 2 * e,
493
+ height: a + 2 * e
494
+ };
495
+ }
496
+ }, mt = { vcBounds: ["type", pt] }, M = "vc-root", ht = 20, gt = .001, _t = class {
399
497
  canvas;
400
498
  elementFactory;
401
499
  vcElementFactory;
402
500
  elementRegistry;
403
501
  eventBus;
502
+ vcBounds;
503
+ config;
404
504
  static $inject = [
405
505
  "canvas",
406
506
  "elementFactory",
407
507
  "vcElementFactory",
408
508
  "elementRegistry",
409
- "eventBus"
509
+ "eventBus",
510
+ "vcBounds",
511
+ "config.vcImport"
410
512
  ];
411
- constructor(e, t, n, r, i) {
412
- this.canvas = e, this.elementFactory = t, this.vcElementFactory = n, this.elementRegistry = r, this.eventBus = i;
513
+ constructor(e, t, n, r, i, a, o) {
514
+ this.canvas = e, this.elementFactory = t, this.vcElementFactory = n, this.elementRegistry = r, this.eventBus = i, this.vcBounds = a, this.config = o;
413
515
  }
414
516
  import(e) {
415
517
  let t = [];
416
518
  this.eventBus.fire("import.render.start", { document: e });
417
- let n = this.ensureRoot();
418
- n.businessObject = { name: e.meta.name };
519
+ let n = this.diagramRoot();
520
+ n.businessObject = {
521
+ name: e.meta.name,
522
+ extensions: s(e),
523
+ metaExtensions: l(e.meta)
524
+ };
419
525
  let r = /* @__PURE__ */ new Map();
420
- for (let i of e.elements) {
421
- if (i.id === "vc-root") {
422
- t.push({ message: `Skipped element "${i.id}": reserved id.` });
423
- continue;
424
- }
425
- let e = this.vcElementFactory.createElement(i);
426
- this.canvas.addShape(e, n), r.set(i.id, e);
526
+ for (let t of e.elements) {
527
+ let e = this.vcElementFactory.createElement(t);
528
+ this.canvas.addShape(e, n), r.set(t.id, e);
427
529
  }
428
530
  let i = 0;
429
531
  for (let a of e.connections) {
@@ -438,126 +540,195 @@ var F = {
438
540
  let s = this.vcElementFactory.createConnection(a, e, o);
439
541
  this.canvas.addConnection(s, n, i), i += 1;
440
542
  }
441
- return this.eventBus.fire("import.render.done", {
543
+ return this.config?.fitOnImport !== !1 && this.fitToContent(), this.eventBus.fire("import.render.done", {
442
544
  document: e,
443
545
  warnings: t
444
546
  }), t;
445
547
  }
446
548
  clear() {
447
- let e = this.elementRegistry.getAll();
448
- for (let t of e) if (t.id === "vc-root") t.businessObject = void 0;
549
+ let e = new Set(this.canvas.getRootElements());
550
+ for (let t of [...this.elementRegistry.getAll()]) if (e.has(t)) t.id === "vc-root" && (t.businessObject = void 0);
449
551
  else try {
450
- x(t) ? this.canvas.removeConnection(t) : v(t) && this.canvas.removeShape(t);
552
+ T(t) ? this.canvas.removeConnection(t) : S(t) && this.canvas.removeShape(t);
451
553
  } catch {}
452
554
  }
453
- ensureRoot() {
454
- let e = this.canvas.getRootElement();
455
- if (e.id === "vc-root") return e;
456
- let t = this.elementFactory.createRoot({ id: B });
457
- return this.canvas.setRootElement(t), t;
555
+ diagramRoot() {
556
+ let e = this.elementRegistry.get(M);
557
+ e || (e = this.elementFactory.createRoot({ id: M }), this.canvas.setRootElement(e));
558
+ for (let t of this.canvas.getRootElements()) t !== e && this.canvas.removeRootElement(t);
559
+ return e;
560
+ }
561
+ fitToContent() {
562
+ let { width: e, height: t } = this.canvas.getSize();
563
+ if (!(e > 0 && t > 0)) return;
564
+ let n = this.vcBounds.contentBounds(ht);
565
+ if (!n) {
566
+ this.canvas.viewbox({
567
+ x: 0,
568
+ y: 0,
569
+ width: e,
570
+ height: t
571
+ });
572
+ return;
573
+ }
574
+ let r = Math.max(Math.min(e / n.width, t / n.height, 1), gt);
575
+ this.canvas.viewbox({
576
+ x: n.x + n.width / 2 - e / 2 / r,
577
+ y: n.y + n.height / 2 - t / 2 / r,
578
+ width: e / r,
579
+ height: t / r
580
+ });
458
581
  }
459
- }, H = class {
582
+ }, vt = class {
460
583
  elementRegistry;
461
- canvas;
462
- static $inject = ["elementRegistry", "canvas"];
463
- constructor(e, t) {
464
- this.elementRegistry = e, this.canvas = t;
584
+ static $inject = ["elementRegistry"];
585
+ constructor(e) {
586
+ this.elementRegistry = e;
465
587
  }
466
588
  export() {
467
- let e = [], t = [];
468
- for (let n of this.elementRegistry.getAll()) if (n.id !== "vc-root") {
469
- if (x(n)) {
470
- if (!n.source || !n.target) continue;
471
- t.push({
472
- id: n.id,
473
- connectionType: n.vcType,
474
- source: n.source.id,
475
- target: n.target.id,
476
- waypoints: n.waypoints.map((e) => ({
589
+ let e = [], n = [];
590
+ for (let t of this.elementRegistry.getAll()) if (t.id !== "vc-root") {
591
+ if (T(t)) {
592
+ if (!t.source || !t.target) continue;
593
+ let e = t.businessObject;
594
+ n.push({
595
+ ...e ? a(e) : {},
596
+ id: t.id,
597
+ connectionType: t.vcType,
598
+ source: t.source.id,
599
+ target: t.target.id,
600
+ waypoints: t.waypoints.map((e) => ({
477
601
  x: e.x,
478
602
  y: e.y
479
603
  }))
480
604
  });
481
- } else if (v(n)) {
482
- let t = {
483
- x: n.x,
484
- y: n.y,
485
- width: n.width,
486
- height: n.height
487
- }, r = n.color === void 0 ? {} : { color: n.color };
488
- if (n.vcType === "orgUnit") e.push({
489
- id: n.id,
605
+ } else if (S(t)) {
606
+ let n = t.businessObject, r = n ? c(n) : {}, i = {
607
+ x: t.x,
608
+ y: t.y,
609
+ width: t.width,
610
+ height: t.height
611
+ }, a = t.color === void 0 ? {} : { color: t.color };
612
+ if (t.vcType === "orgUnit") e.push({
613
+ ...r,
614
+ id: t.id,
490
615
  elementType: "orgUnit",
491
- name: n.vcLabel,
492
- bounds: t,
493
- ...r
616
+ name: t.vcLabel,
617
+ bounds: i,
618
+ ...a
494
619
  });
495
620
  else {
496
- let i = n.businessObject, a = n.link ?? (i?.elementType === "step" ? i.link : void 0);
621
+ let o = t.link ?? (n?.elementType === "step" ? n.link : void 0);
497
622
  e.push({
498
- id: n.id,
499
- elementType: "step",
500
- name: n.vcLabel,
501
- bounds: t,
502
623
  ...r,
503
- ...a === void 0 ? {} : { link: a }
624
+ id: t.id,
625
+ elementType: "step",
626
+ name: t.vcLabel,
627
+ bounds: i,
628
+ ...a,
629
+ ...o === void 0 ? {} : { link: o }
504
630
  });
505
631
  }
506
632
  }
507
633
  }
508
- let r = this.canvas.getRootElement().businessObject;
509
- return o({
510
- schemaVersion: n,
511
- meta: { name: r?.name ?? "Untitled value chain" },
634
+ let r = this.rootData();
635
+ return f({
636
+ ...r?.extensions,
637
+ schemaVersion: t,
638
+ meta: {
639
+ ...r?.metaExtensions,
640
+ name: r?.name ?? "Untitled value chain"
641
+ },
512
642
  elements: e,
513
- connections: t
643
+ connections: n
644
+ });
645
+ }
646
+ rootData() {
647
+ return this.elementRegistry.get(M)?.businessObject;
648
+ }
649
+ };
650
+ //#endregion
651
+ //#region src/io/png.ts
652
+ async function yt(e, t = 2) {
653
+ let { width: n, height: r } = bt(e), i = URL.createObjectURL(new Blob([e], { type: "image/svg+xml" }));
654
+ try {
655
+ let e = new Image();
656
+ e.width = n, e.height = r, await new Promise((t, n) => {
657
+ e.onload = () => t(), e.onerror = () => n(/* @__PURE__ */ Error("Could not render the SVG.")), e.src = i;
514
658
  });
659
+ let a = document.createElement("canvas");
660
+ a.width = Math.round(n * t), a.height = Math.round(r * t);
661
+ let o = a.getContext("2d");
662
+ if (!o) throw Error("Canvas 2D context not available.");
663
+ o.fillStyle = A.fill, o.fillRect(0, 0, a.width, a.height), o.drawImage(e, 0, 0, a.width, a.height);
664
+ let s = await new Promise((e) => a.toBlob(e, "image/png"));
665
+ if (!s) throw Error("PNG generation failed.");
666
+ return s;
667
+ } finally {
668
+ URL.revokeObjectURL(i);
515
669
  }
516
- }, U = {
517
- vcImporter: ["type", V],
518
- vcExporter: ["type", H]
519
- }, W = class extends T {
670
+ }
671
+ function bt(e) {
672
+ let t = /width="(\d+(?:\.\d+)?)"/.exec(e), n = /height="(\d+(?:\.\d+)?)"/.exec(e);
673
+ return {
674
+ width: t ? Number(t[1]) : 1e3,
675
+ height: n ? Number(n[1]) : 700
676
+ };
677
+ }
678
+ function xt(e) {
679
+ return new Promise((t, n) => {
680
+ let r = new FileReader();
681
+ r.onload = () => t(String(r.result).split(",")[1] ?? ""), r.onerror = () => n(/* @__PURE__ */ Error("Could not read the export blob.")), r.readAsDataURL(e);
682
+ });
683
+ }
684
+ //#endregion
685
+ //#region src/io/index.ts
686
+ var St = {
687
+ __depends__: [mt],
688
+ vcImporter: ["type", _t],
689
+ vcExporter: ["type", vt]
690
+ }, Ct = class extends Ye {
520
691
  _getModules() {
521
692
  return [
522
- k,
523
- z,
524
- U
693
+ rt,
694
+ ft,
695
+ St
525
696
  ];
526
697
  }
527
- }, Ue = class extends W {
698
+ }, N = class extends Ct {
528
699
  _getModules() {
529
700
  return [
530
701
  ...super._getModules(),
531
- ee,
532
- te,
533
- ne
702
+ ae,
703
+ oe,
704
+ se
534
705
  ];
535
706
  }
536
- }, We = class {
707
+ }, wt = class {
537
708
  execute(e) {
538
709
  let { element: t, properties: n } = e, r = t, i = {};
539
- for (let e of Object.keys(n)) i[e] = r[e], Ge(r, e, n[e]);
710
+ for (let e of Object.keys(n)) i[e] = r[e], Tt(r, e, n[e]);
540
711
  return e.oldProperties = i, [t];
541
712
  }
542
713
  revert(e) {
543
714
  let { element: t, oldProperties: n } = e, r = t;
544
- if (n) for (let e of Object.keys(n)) Ge(r, e, n[e]);
715
+ if (n) for (let e of Object.keys(n)) Tt(r, e, n[e]);
545
716
  return [t];
546
717
  }
547
718
  };
548
- function Ge(e, t, n) {
719
+ function Tt(e, t, n) {
549
720
  n === void 0 ? delete e[t] : e[t] = n;
550
721
  }
551
722
  //#endregion
552
723
  //#region src/modeling/VcModeling.ts
553
- var Ke = "element.updateProperties", qe = class {
724
+ var Et = "element.updateProperties", Dt = class {
554
725
  commandStack;
555
726
  static $inject = ["commandStack"];
556
727
  constructor(e) {
557
- this.commandStack = e, e.registerHandler(Ke, We);
728
+ this.commandStack = e, e.registerHandler(Et, wt);
558
729
  }
559
730
  updateProperties(e, t) {
560
- this.commandStack.execute(Ke, {
731
+ this.commandStack.execute(Et, {
561
732
  element: e,
562
733
  properties: t
563
734
  });
@@ -571,7 +742,7 @@ var Ke = "element.updateProperties", qe = class {
571
742
  setConnectionType(e, t) {
572
743
  t !== e.vcType && this.updateProperties(e, { vcType: t });
573
744
  }
574
- }, Je = 25, Ye = 10, Xe = 10, Ze = class extends pe {
745
+ }, Ot = 25, kt = 10, At = 10, jt = class extends ve {
575
746
  connectionDocking;
576
747
  static $inject = ["connectionDocking"];
577
748
  constructor(e) {
@@ -583,7 +754,7 @@ var Ke = "element.updateProperties", qe = class {
583
754
  x: e.x,
584
755
  y: e.y
585
756
  })) ?? [];
586
- let i = nt(e) ? this.hierarchyWaypoints(n, r, t) : this.sequenceWaypoints(e, n, r, t), a = {
757
+ let i = It(e) ? this.hierarchyWaypoints(n, r, t) : this.sequenceWaypoints(e, n, r, t), a = {
587
758
  ...e,
588
759
  source: n,
589
760
  target: r,
@@ -592,9 +763,9 @@ var Ke = "element.updateProperties", qe = class {
592
763
  try {
593
764
  o = this.connectionDocking.getCroppedWaypoints(a, n, r);
594
765
  } catch {}
595
- if (!rt(o)) {
596
- let e = [m(n), m(r)];
597
- return rt(e) ? e : [];
766
+ if (!Lt(o)) {
767
+ let e = [g(n), g(r)];
768
+ return Lt(e) ? e : [];
598
769
  }
599
770
  return o;
600
771
  }
@@ -604,18 +775,18 @@ var Ke = "element.updateProperties", qe = class {
604
775
  y: e.y
605
776
  }));
606
777
  return [
607
- m(t),
778
+ g(t),
608
779
  ...i,
609
- m(n)
780
+ g(n)
610
781
  ];
611
782
  }
612
783
  hierarchyWaypoints(e, t, n) {
613
- let r = m(e), i = m(t);
784
+ let r = g(e), i = g(t);
614
785
  if (t.y >= e.y + e.height) {
615
- let n = $e(e), a = n.length ? n : [t];
616
- if (et(a, e)) return h(me(r, i, "v:v"));
617
- let o = e.y + e.height, s = Math.min(...a.map((e) => e.y)), c = Math.max(o + Ye, (o + s) / 2), l = Math.min(...a.map((e) => e.x)), u = r.x <= l - 10 ? r.x : l - Je;
618
- return h([
786
+ let n = Nt(e), a = n.length ? n : [t];
787
+ if (Pt(a, e)) return _(ye(r, i, "v:v"));
788
+ let o = e.y + e.height, s = Math.min(...a.map((e) => e.y)), c = Math.max(o + kt, (o + s) / 2), l = Math.min(...a.map((e) => e.x)), u = r.x <= l - 10 ? r.x : l - Ot;
789
+ return _([
619
790
  r,
620
791
  {
621
792
  x: r.x,
@@ -632,45 +803,45 @@ var Ke = "element.updateProperties", qe = class {
632
803
  i
633
804
  ]);
634
805
  }
635
- return h(he(e, t, r, i, { preferredLayouts: ["v:v"] }));
806
+ return _(be(e, t, r, i, { preferredLayouts: ["v:v"] }));
636
807
  }
637
808
  };
638
- function Qe(e) {
809
+ function Mt(e) {
639
810
  return {
640
- min: e.x + Xe,
641
- max: e.x + e.width - A(e.width, e.height) - Xe
811
+ min: e.x + At,
812
+ max: e.x + e.width - D(e.width, e.height) - At
642
813
  };
643
814
  }
644
- function $e(e) {
645
- return (e.outgoing ?? []).filter((e) => nt(e)).map((e) => e.target).filter((e) => !!e);
815
+ function Nt(e) {
816
+ return (e.outgoing ?? []).filter((e) => It(e)).map((e) => e.target).filter((e) => !!e);
646
817
  }
647
- function et(e, t) {
818
+ function Pt(e, t) {
648
819
  if (!e.length) return !1;
649
820
  if (e.length >= 2) {
650
821
  let t = e.map((e) => e.y);
651
- return Math.max(...t) - Math.min(...t) <= tt;
822
+ return Math.max(...t) - Math.min(...t) <= Ft;
652
823
  }
653
- let n = e[0], r = n.x + n.width / 2, i = Qe(t);
824
+ let n = e[0], r = n.x + n.width / 2, i = Mt(t);
654
825
  return r >= i.min && r <= i.max;
655
826
  }
656
- var tt = 10;
657
- function nt(e) {
827
+ var Ft = 10;
828
+ function It(e) {
658
829
  return e.vcType === "hierarchy";
659
830
  }
660
- function rt(e) {
831
+ function Lt(e) {
661
832
  return e.every((e) => Number.isFinite(e.x) && Number.isFinite(e.y));
662
833
  }
663
834
  //#endregion
664
835
  //#region src/modeling/VcConnectionTypeBehavior.ts
665
- var it = class extends ge {
836
+ var Rt = class extends xe {
666
837
  static $inject = ["eventBus", "modeling"];
667
838
  constructor(e, t) {
668
839
  super(e), this.postExecute(["element.updateProperties"], (e) => {
669
840
  let { element: n, properties: r } = e;
670
- r && "vcType" in r && x(n) && t.layoutConnection(n);
841
+ r && "vcType" in r && T(n) && t.layoutConnection(n);
671
842
  }, !0);
672
843
  }
673
- }, at = class extends ge {
844
+ }, zt = class extends xe {
674
845
  modeling;
675
846
  layouter;
676
847
  static $inject = [
@@ -692,74 +863,74 @@ var it = class extends ge {
692
863
  e.shape,
693
864
  ...e.shapes ?? [],
694
865
  ...e.elements ?? []
695
- ].filter(v), n = e.connection, r = /* @__PURE__ */ new Set();
696
- x(n) && n.vcType === "hierarchy" && n.source && r.add(n.source);
866
+ ].filter(S), n = e.connection, r = /* @__PURE__ */ new Set();
867
+ T(n) && n.vcType === "hierarchy" && n.source && r.add(n.source);
697
868
  for (let e of t) {
698
- ot(e).length && r.add(e);
699
- for (let t of e.incoming ?? []) x(t) && t.vcType === "hierarchy" && t.source && r.add(t.source);
869
+ Bt(e).length && r.add(e);
870
+ for (let t of e.incoming ?? []) T(t) && t.vcType === "hierarchy" && t.source && r.add(t.source);
700
871
  }
701
- for (let e of r) for (let t of ot(e)) st(this.layouter.layoutConnection(t), t.waypoints ?? []) || this.modeling.layoutConnection(t);
872
+ for (let e of r) for (let t of Bt(e)) Vt(this.layouter.layoutConnection(t), t.waypoints ?? []) || this.modeling.layoutConnection(t);
702
873
  }
703
874
  };
704
- function ot(e) {
705
- return (e.outgoing ?? []).filter((e) => x(e) && e.vcType === "hierarchy");
875
+ function Bt(e) {
876
+ return (e.outgoing ?? []).filter((e) => T(e) && e.vcType === "hierarchy");
706
877
  }
707
- function st(e, t) {
878
+ function Vt(e, t) {
708
879
  return e.length === t.length && e.every((e, n) => e.x === t[n].x && e.y === t[n].y);
709
880
  }
710
881
  //#endregion
711
882
  //#region src/modeling/index.ts
712
- var ct = {
883
+ var Ht = {
713
884
  __init__: [
714
885
  "vcModeling",
715
886
  "vcConnectionTypeBehavior",
716
887
  "vcHierarchyRelayoutBehavior"
717
888
  ],
718
- vcModeling: ["type", qe],
719
- vcConnectionTypeBehavior: ["type", it],
720
- vcHierarchyRelayoutBehavior: ["type", at],
721
- layouter: ["type", Ze],
722
- connectionDocking: ["type", fe]
723
- }, lt = class extends ve {
889
+ vcModeling: ["type", Dt],
890
+ vcConnectionTypeBehavior: ["type", Rt],
891
+ vcHierarchyRelayoutBehavior: ["type", zt],
892
+ layouter: ["type", jt],
893
+ connectionDocking: ["type", _e]
894
+ }, Ut = class extends Ce {
724
895
  vcConnect;
725
896
  static $inject = ["eventBus", "vcConnect"];
726
897
  constructor(e, t) {
727
898
  super(e), this.vcConnect = t;
728
899
  }
729
900
  init() {
730
- this.addRule("connection.start", (e) => v(e.source)), this.addRule("connection.create", (e) => {
901
+ this.addRule("connection.start", (e) => S(e.source)), this.addRule("connection.create", (e) => {
731
902
  let { source: t, target: n } = e, r = this.resolveType(t, n);
732
- return !r || ft(t, n, r) ? !1 : { vcType: r };
903
+ return !r || Kt(t, n, r) ? !1 : { vcType: r };
733
904
  }), this.addRule("connection.reconnect", (e) => {
734
905
  let { source: t, target: n, connection: r } = e;
735
- return !x(r) || !v(t) || !v(n) || t === n || !dt(r.vcType, t, n) ? !1 : !ft(t, n, r.vcType, r);
736
- }), this.addRule("connection.updateWaypoints", (e) => x(e.connection)), this.addRule("shape.create", (e) => ut(e.target)), this.addRule("elements.create", (e) => ut(e.target)), this.addRule(["shape.move", "elements.move"], () => !0), this.addRule("shape.resize", (e) => v(e.shape)), this.addRule(["elements.align", "elements.distribute"], (e) => (e.elements ?? []).filter(v));
906
+ return !T(r) || !S(t) || !S(n) || t === n || !Gt(r.vcType, t, n) ? !1 : !Kt(t, n, r.vcType, r);
907
+ }), this.addRule("connection.updateWaypoints", (e) => T(e.connection)), this.addRule("shape.create", (e) => Wt(e.target)), this.addRule("elements.create", (e) => Wt(e.target)), this.addRule(["shape.move", "elements.move"], () => !0), this.addRule("shape.resize", (e) => S(e.shape)), this.addRule(["elements.align", "elements.distribute"], (e) => (e.elements ?? []).filter(S));
737
908
  }
738
909
  resolveType(e, t) {
739
- if (!v(e) || !v(t) || e === t) return null;
740
- if (y(e) && y(t)) {
910
+ if (!S(e) || !S(t) || e === t) return null;
911
+ if (C(e) && C(t)) {
741
912
  let e = this.vcConnect.pendingType;
742
913
  return e === "assignment" ? null : e;
743
914
  }
744
- return y(e) && b(t) || b(e) && y(t) ? "assignment" : null;
915
+ return C(e) && w(t) || w(e) && C(t) ? "assignment" : null;
745
916
  }
746
917
  };
747
- function ut(e) {
748
- return !!e && !v(e) && !x(e) && !e.parent;
918
+ function Wt(e) {
919
+ return !!e && !S(e) && !T(e) && !e.parent;
749
920
  }
750
- function dt(e, t, n) {
751
- return e === "assignment" ? y(t) && b(n) || b(t) && y(n) : y(t) && y(n);
921
+ function Gt(e, t, n) {
922
+ return e === "assignment" ? C(t) && w(n) || w(t) && C(n) : C(t) && C(n);
752
923
  }
753
- function ft(e, t, n, r) {
754
- return [...e.outgoing ?? [], ...n === "assignment" ? e.incoming ?? [] : []].some((e) => e !== r && x(e) && e.vcType === n && (e.target === t || e.source === t));
924
+ function Kt(e, t, n, r) {
925
+ return [...e.outgoing ?? [], ...n === "assignment" ? e.incoming ?? [] : []].some((e) => e !== r && T(e) && e.vcType === n && (e.target === t || e.source === t));
755
926
  }
756
927
  //#endregion
757
928
  //#region src/rules/index.ts
758
- var pt = {
759
- __depends__: [_e],
929
+ var qt = {
930
+ __depends__: [Se],
760
931
  __init__: ["vcRules"],
761
- vcRules: ["type", lt]
762
- }, mt = class {
932
+ vcRules: ["type", Ut]
933
+ }, Jt = class {
763
934
  connect;
764
935
  static $inject = ["connect", "eventBus"];
765
936
  pendingType = "sequence";
@@ -775,11 +946,11 @@ var pt = {
775
946
  start(e, t, n) {
776
947
  this.pendingType = n, this.connect.start(e, t);
777
948
  }
778
- }, ht = {
779
- __depends__: [ye],
949
+ }, Yt = {
950
+ __depends__: [we],
780
951
  __init__: ["vcConnect"],
781
- vcConnect: ["type", mt]
782
- }, gt = class {
952
+ vcConnect: ["type", Jt]
953
+ }, Xt = class {
783
954
  autoPlace;
784
955
  create;
785
956
  factory;
@@ -804,16 +975,16 @@ var pt = {
804
975
  createShape(e) {
805
976
  return e === "assignment" ? this.factory.createNewOrgUnit() : this.factory.createNewStep();
806
977
  }
807
- }, _t = 200, vt = 45, yt = 45, bt = 30, xt = 20, St = 30, Ct = 10, wt = class {
978
+ }, Zt = 200, Qt = 45, $t = 45, en = 30, tn = 20, nn = 30, rn = 10, an = class {
808
979
  static $inject = [
809
980
  "eventBus",
810
981
  "vcConnect",
811
982
  "elementRegistry"
812
983
  ];
813
984
  constructor(e, t, n) {
814
- e.on("autoPlace", _t, (e) => {
985
+ e.on("autoPlace", Zt, (e) => {
815
986
  let { source: n, shape: r } = e;
816
- if (!v(n)) return;
987
+ if (!S(n)) return;
817
988
  let i = this.desiredPosition(t.pendingType, n, r);
818
989
  return this.deconflict(i, r);
819
990
  }), this.elementRegistry = n;
@@ -824,67 +995,67 @@ var pt = {
824
995
  }
825
996
  sequencePosition(e, t) {
826
997
  return {
827
- x: e.x + e.width + vt + t.width / 2,
998
+ x: e.x + e.width + Qt + t.width / 2,
828
999
  y: e.y + e.height / 2
829
1000
  };
830
1001
  }
831
1002
  assignmentPosition(e, t) {
832
1003
  return {
833
1004
  x: e.x + e.width / 2,
834
- y: e.y + e.height + yt + t.height / 2
1005
+ y: e.y + e.height + $t + t.height / 2
835
1006
  };
836
1007
  }
837
1008
  hierarchyPosition(e, t) {
838
- let n = $e(e);
1009
+ let n = Nt(e);
839
1010
  if (!n.length) return {
840
1011
  x: e.x + e.width / 2 + 10 + t.width / 2,
841
- y: e.y + e.height + yt + t.height / 2
1012
+ y: e.y + e.height + $t + t.height / 2
842
1013
  };
843
- if (et(n, e)) {
844
- let e = Tt(n);
1014
+ if (Pt(n, e)) {
1015
+ let e = on(n);
845
1016
  return {
846
- x: e.x + e.width + xt + t.width / 2,
1017
+ x: e.x + e.width + tn + t.width / 2,
847
1018
  y: e.y + t.height / 2
848
1019
  };
849
1020
  }
850
- let r = Et(n);
1021
+ let r = sn(n);
851
1022
  return {
852
1023
  x: r.x + t.width / 2,
853
- y: r.y + r.height + bt + t.height / 2
1024
+ y: r.y + r.height + en + t.height / 2
854
1025
  };
855
1026
  }
856
1027
  deconflict(e, t) {
857
- let n = this.elementRegistry.getAll().filter(v), r = { ...e };
1028
+ let n = this.elementRegistry.getAll().filter(S), r = { ...e };
858
1029
  for (let e = 0; e < 50; e += 1) {
859
1030
  let e = {
860
- x: r.x - t.width / 2 - Ct,
861
- y: r.y - t.height / 2 - Ct,
1031
+ x: r.x - t.width / 2 - rn,
1032
+ y: r.y - t.height / 2 - rn,
862
1033
  width: t.width + 20,
863
1034
  height: t.height + 20
864
1035
  };
865
1036
  if (!n.some((t) => t.x < e.x + e.width && t.x + t.width > e.x && t.y < e.y + e.height && t.y + t.height > e.y)) break;
866
- r.y += St;
1037
+ r.y += nn;
867
1038
  }
868
1039
  return r;
869
1040
  }
870
1041
  };
871
- function Tt(e) {
1042
+ function on(e) {
872
1043
  return e.reduce((e, t) => !e || t.x + t.width > e.x + e.width ? t : e, void 0);
873
1044
  }
874
- function Et(e) {
1045
+ function sn(e) {
875
1046
  return e.reduce((e, t) => !e || t.y + t.height > e.y + e.height ? t : e, void 0);
876
1047
  }
877
1048
  //#endregion
878
1049
  //#region src/append/index.ts
879
- var Dt = {
1050
+ var cn = {
880
1051
  __depends__: [
881
- be,
882
- xe,
883
- Se
1052
+ Te,
1053
+ Ee,
1054
+ De
884
1055
  ],
885
1056
  __init__: ["vcAutoPlaceBehavior", "vcCreatePreviewBehavior"],
886
- vcAppend: ["type", gt],
887
- vcAutoPlaceBehavior: ["type", wt],
1057
+ vcAppend: ["type", Xt],
1058
+ vcAutoPlaceBehavior: ["type", an],
888
1059
  vcCreatePreviewBehavior: ["type", class {
889
1060
  static $inject = ["injector", "eventBus"];
890
1061
  constructor(e, t) {
@@ -895,7 +1066,7 @@ var Dt = {
895
1066
  let i = typeof t.canExecute == "object" && t.canExecute?.connect;
896
1067
  n.drawPreview(t, i ?? !1, {
897
1068
  source: r,
898
- connectionStart: m(r),
1069
+ connectionStart: g(r),
899
1070
  connectionEnd: {
900
1071
  x: e.x,
901
1072
  y: e.y
@@ -911,44 +1082,77 @@ var Dt = {
911
1082
  }));
912
1083
  }
913
1084
  }]
1085
+ }, ln = {
1086
+ "square-dashed-mouse-pointer": "<path d=\"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z\"/><path d=\"M5 3a2 2 0 0 0-2 2\"/><path d=\"M19 3a2 2 0 0 1 2 2\"/><path d=\"M5 21a2 2 0 0 1-2-2\"/><path d=\"M9 3h1\"/><path d=\"M9 21h2\"/><path d=\"M14 3h1\"/><path d=\"M3 9v1\"/><path d=\"M21 9v2\"/><path d=\"M3 14v1\"/>",
1087
+ hand: "<path d=\"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2\"/><path d=\"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2\"/><path d=\"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8\"/><path d=\"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15\"/>",
1088
+ "unfold-horizontal": "<path d=\"M16 12h6\"/><path d=\"M8 12H2\"/><path d=\"M12 2v2\"/><path d=\"M12 8v2\"/><path d=\"M12 14v2\"/><path d=\"M12 20v2\"/><path d=\"m19 15 3-3-3-3\"/><path d=\"m5 9-3 3 3 3\"/>",
1089
+ workflow: "<rect width=\"8\" height=\"8\" x=\"3\" y=\"3\" rx=\"2\"/><path d=\"M7 11v4a2 2 0 0 0 2 2h4\"/><rect width=\"8\" height=\"8\" x=\"13\" y=\"13\" rx=\"2\"/>",
1090
+ palette: "<path d=\"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z\"/><circle cx=\"13.5\" cy=\"6.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"17.5\" cy=\"10.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"6.5\" cy=\"12.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"8.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"/>",
1091
+ trash: "<path d=\"M10 11v6\"/><path d=\"M14 11v6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\"/><path d=\"M3 6h18\"/><path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/>",
1092
+ "arrow-left-right": "<path d=\"M8 3 4 7l4 4\"/><path d=\"M4 7h16\"/><path d=\"m16 21 4-4-4-4\"/><path d=\"M20 17H4\"/>",
1093
+ "align-start-vertical": "<rect width=\"9\" height=\"6\" x=\"6\" y=\"14\" rx=\"2\"/><rect width=\"16\" height=\"6\" x=\"6\" y=\"4\" rx=\"2\"/><path d=\"M2 2v20\"/>",
1094
+ x: "<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>"
1095
+ }, P = {
1096
+ size: 16,
1097
+ strokeWidth: 2.5
1098
+ }, F = {
1099
+ size: 20,
1100
+ strokeWidth: 2
914
1101
  };
1102
+ /*! @miragon/value-chain-renderer icon geometry
1103
+ * Lucide (lucide-static 1.59.0) @license ISC
1104
+ * Copyright (c) 2026 Lucide Icons and Contributors
1105
+ * Derived from Feather, as Lucide's LICENSE lists them: trash and x. Feather @license MIT
1106
+ * Copyright (c) 2013-present Cole Bemis */
1107
+ function I(e, t = P) {
1108
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${t.size}" height="${t.size}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${t.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${ln[e]}</svg>`;
1109
+ }
915
1110
  //#endregion
916
1111
  //#region src/draw/icons.ts
917
- function G(e, t = "0 0 24 24") {
918
- return `<svg viewBox="${t}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`;
1112
+ function L(e, t = "0 0 24 24") {
1113
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${P.size}" height="${P.size}" viewBox="${t}" fill="none" stroke="currentColor" stroke-width="${P.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${e}</svg>`;
1114
+ }
1115
+ function un(e) {
1116
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="${A.fill}" stroke="${A.ink}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${e}</svg>`;
919
1117
  }
920
- var K = {
921
- handTool: G("<path d=\"M18 11V7.5a1.5 1.5 0 0 0-3 0\"/><path d=\"M15 10.5V6a1.5 1.5 0 0 0-3 0v4\"/><path d=\"M12 10V7a1.5 1.5 0 0 0-3 0v6\"/><path d=\"M18 10a1.5 1.5 0 0 1 3 0v4.5a6.5 6.5 0 0 1-6.5 6.5h-1.6c-2.1 0-3.4-.7-4.5-1.8l-3-3a1.5 1.5 0 0 1 2.1-2.1L9 15.5\"/>"),
922
- lassoTool: G("<rect x=\"3.5\" y=\"5.5\" width=\"14\" height=\"11\" rx=\"1\" stroke-dasharray=\"3.2 2.4\"/><path d=\"M17.5 16.5 l3.5 3.5 M21 17.5 v2.5 h-2.5\"/>"),
923
- spaceTool: G("<path d=\"M12 3.5 v17\" stroke-dasharray=\"3.2 2.4\"/><path d=\"M15 12 h5.5 m-2.5 -2.5 2.5 2.5 -2.5 2.5\"/><path d=\"M9 12 H3.5 m2.5 -2.5 L3.5 12 l2.5 2.5\"/>"),
924
- globalConnect: G("<rect x=\"3\" y=\"3.5\" width=\"6\" height=\"5\" rx=\"0.5\"/><rect x=\"15\" y=\"15.5\" width=\"6\" height=\"5\" rx=\"0.5\"/><path d=\"M9.5 9.5 L14.5 14.5 m-4.2 -1 4.2 1 -1 -4.2\" stroke-dasharray=\"2.6 2\"/>"),
925
- createStep: G("<path d=\"M3 7 h12 l6 5 -6 5 H3 l4.5 -5 Z\"/>"),
926
- appendStep: G("<path d=\"M2.5 12 h4.5 m-2 -2 2 2 -2 2\" stroke-dasharray=\"2.6 2\"/><path d=\"M9 7 h8 l4 5 -4 5 H9 l3 -5 Z\"/>"),
927
- appendSubStep: G("<path d=\"M7 3 v8.5 h2.5\" /><path d=\"M11 7 h7.5 l3 4.5 -3 4.5 H11 l2.5 -4.5 Z\" transform=\"translate(-1.5 0.5)\"/>", "0 0 22 22"),
928
- connectSequence: G("<path d=\"M4 19 L17.5 5.5\" stroke-dasharray=\"3 2.6\"/><path d=\"M13 5 h5.5 v5.5\" />"),
929
- connectHierarchy: G("<path d=\"M6 4 v14 h11.5 m-3.5 -3.5 3.5 3.5 -3.5 3.5\"/>"),
930
- createOrgUnit: G("<ellipse cx=\"12\" cy=\"12\" rx=\"9.5\" ry=\"6.5\"/>"),
931
- appendOrgUnit: G("<path d=\"M12 3.5 v5\"/><ellipse cx=\"12\" cy=\"15\" rx=\"8.5\" ry=\"5.5\"/>"),
932
- toggleType: G("<path d=\"M4.5 9 h13 m-3.2 -3.2 3.2 3.2 -3.2 3.2\"/><path d=\"M19.5 15.5 h-13 m3.2 3.2 -3.2 -3.2 3.2 -3.2\" stroke-dasharray=\"2.8 2.2\"/>"),
933
- align: G("<path d=\"M4 3.5 v17\"/><rect x=\"7\" y=\"6\" width=\"12\" height=\"4\" rx=\"0.5\"/><rect x=\"7\" y=\"13.5\" width=\"7.5\" height=\"4\" rx=\"0.5\"/>"),
934
- color: G("<path d=\"M12 3.5 c3 4 6 7 6 10.5 a6 6 0 1 1 -12 0 c0 -3.5 3 -6.5 6 -10.5 Z\"/>"),
935
- trash: G("<path d=\"M4.5 6.5 h15 M9.5 6 V4.5 h5 V6 M6.5 6.5 l1 13 h9 l1 -13 M10 10 v6 M14 10 v6\"/>")
1118
+ var R = {
1119
+ handTool: I("hand", F),
1120
+ lassoTool: I("square-dashed-mouse-pointer", F),
1121
+ spaceTool: I("unfold-horizontal", F),
1122
+ globalConnect: I("workflow", F),
1123
+ createStep: un("<path d=\"M3 7 h12 l6 5 -6 5 H3 l4.5 -5 Z\"/>"),
1124
+ createOrgUnit: un("<ellipse cx=\"12\" cy=\"12\" rx=\"9.5\" ry=\"6.5\"/>"),
1125
+ appendStep: L("<path d=\"M2.5 12 h4.5 m-2 -2 2 2 -2 2\" stroke-dasharray=\"2.6 2\"/><path d=\"M9 7 h8 l4 5 -4 5 H9 l3 -5 Z\"/>"),
1126
+ appendSubStep: L("<path d=\"M7 3 v8.5 h2.5\" /><path d=\"M11 7 h7.5 l3 4.5 -3 4.5 H11 l2.5 -4.5 Z\" transform=\"translate(-1.5 0.5)\"/>", "0 0 22 22"),
1127
+ connectSequence: L("<path d=\"M4 19 L17.5 5.5\" stroke-dasharray=\"3 2.6\"/><path d=\"M13 5 h5.5 v5.5\" />"),
1128
+ connectHierarchy: L("<path d=\"M6 4 v14 h11.5 m-3.5 -3.5 3.5 3.5 -3.5 3.5\"/>"),
1129
+ appendOrgUnit: L("<path d=\"M12 3.5 v5\"/><ellipse cx=\"12\" cy=\"15\" rx=\"8.5\" ry=\"5.5\"/>"),
1130
+ toggleType: I("arrow-left-right"),
1131
+ align: I("align-start-vertical"),
1132
+ color: I("palette"),
1133
+ trash: I("trash")
936
1134
  };
937
- function q(e, t, n = !1) {
938
- return `<div class="entry vc-palette-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${e}</div>`;
1135
+ function z(e, t = !1) {
1136
+ return `<div class="entry vc-palette-entry"${t ? " draggable=\"true\"" : ""}>${e}</div>`;
939
1137
  }
940
- function J(e, t, n = !1) {
941
- return `<div class="entry vc-cp-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${e}</div>`;
1138
+ function B(e, t = !1) {
1139
+ return `<div class="entry vc-cp-entry"${t ? " draggable=\"true\"" : ""}>${e}</div>`;
942
1140
  }
943
1141
  //#endregion
944
1142
  //#region src/palette/VcPaletteProvider.ts
945
- var Ot = class {
1143
+ var dn = 24, fn = class {
946
1144
  create;
947
1145
  factory;
948
1146
  handTool;
949
1147
  lassoTool;
950
1148
  spaceTool;
951
1149
  globalConnect;
1150
+ canvas;
1151
+ modeling;
1152
+ selection;
1153
+ elementRegistry;
1154
+ injector;
1155
+ config;
952
1156
  static $inject = [
953
1157
  "palette",
954
1158
  "create",
@@ -956,112 +1160,159 @@ var Ot = class {
956
1160
  "handTool",
957
1161
  "lassoTool",
958
1162
  "spaceTool",
959
- "globalConnect"
1163
+ "globalConnect",
1164
+ "canvas",
1165
+ "modeling",
1166
+ "selection",
1167
+ "elementRegistry",
1168
+ "injector",
1169
+ "config.vcPalette"
960
1170
  ];
961
- constructor(e, t, n, r, i, a, o) {
962
- this.create = t, this.factory = n, this.handTool = r, this.lassoTool = i, this.spaceTool = a, this.globalConnect = o, e.registerProvider(this);
1171
+ constructor(e, t, n, r, i, a, o, s, c, l, u, d, f) {
1172
+ this.create = t, this.factory = n, this.handTool = r, this.lassoTool = i, this.spaceTool = a, this.globalConnect = o, this.canvas = s, this.modeling = c, this.selection = l, this.elementRegistry = u, this.injector = d, this.config = f, e.registerProvider(this);
963
1173
  }
964
1174
  getPaletteEntries() {
965
- let e = (e) => {
966
- this.create.start(e, this.factory.createNewStep());
967
- }, t = (e) => {
968
- this.create.start(e, this.factory.createNewOrgUnit());
969
- };
1175
+ let e = (e) => (t) => {
1176
+ if (this.editLock()?.isReadOnly()) return;
1177
+ let n = e();
1178
+ pn(t) ? this.placeInFreeRect(n) : this.create.start(t, n);
1179
+ }, t = e(() => this.factory.createNewStep()), n = e(() => this.factory.createNewOrgUnit());
970
1180
  return {
971
- "hand-tool": {
972
- group: "tools",
973
- title: "Activate hand tool — H",
974
- html: q(K.handTool, "Activate hand tool"),
975
- action: { click: (e) => this.handTool.activateHand(e, !1, !1) }
976
- },
977
1181
  "lasso-tool": {
978
1182
  group: "tools",
979
- title: "Activate lasso tool — L",
980
- html: q(K.lassoTool, "Activate lasso tool"),
1183
+ title: "Lasso",
1184
+ shortcut: "L",
1185
+ html: z(R.lassoTool),
981
1186
  action: { click: (e) => this.lassoTool.activateSelection(e, !1) }
982
1187
  },
1188
+ "hand-tool": {
1189
+ group: "tools",
1190
+ title: "Hand",
1191
+ shortcut: "H",
1192
+ html: z(R.handTool),
1193
+ action: { click: (e) => this.handTool.activateHand(e, !1, !1) }
1194
+ },
983
1195
  "space-tool": {
984
1196
  group: "tools",
985
- title: "Activate create/remove space tool — S",
986
- html: q(K.spaceTool, "Activate create/remove space tool"),
1197
+ title: "Create or remove space",
1198
+ shortcut: "S",
1199
+ html: z(R.spaceTool),
987
1200
  action: { click: (e) => this.spaceTool.activateSelection(e, !1, !1) }
988
1201
  },
989
1202
  "global-connect-tool": {
990
1203
  group: "tools",
991
- title: "Activate connect tool — C",
992
- html: q(K.globalConnect, "Activate connect tool"),
1204
+ title: "Connect",
1205
+ shortcut: "C",
1206
+ html: z(R.globalConnect),
993
1207
  action: { click: (e) => this.globalConnect.start(e, !1) }
994
1208
  },
995
- "tool-separator": {
996
- group: "tools",
997
- separator: !0
998
- },
999
1209
  "create.step": {
1000
1210
  group: "value-chain",
1001
- title: "Create step",
1002
- html: q(K.createStep, "Create step", !0),
1211
+ title: "Step",
1212
+ html: z(R.createStep, !0),
1003
1213
  action: {
1004
- click: e,
1005
- dragstart: e
1214
+ click: t,
1215
+ dragstart: t
1006
1216
  }
1007
1217
  },
1008
1218
  "create.org-unit": {
1009
1219
  group: "value-chain",
1010
- title: "Create organizational unit",
1011
- html: q(K.createOrgUnit, "Create organizational unit", !0),
1220
+ title: "Organizational unit",
1221
+ html: z(R.createOrgUnit, !0),
1012
1222
  action: {
1013
- click: t,
1014
- dragstart: t
1223
+ click: n,
1224
+ dragstart: n
1015
1225
  }
1016
1226
  }
1017
1227
  };
1018
1228
  }
1019
- }, kt = {
1229
+ placeInFreeRect(e) {
1230
+ let t = this.freeAreaCentre() ?? this.visibleCentre(), n = {
1231
+ x: t.x,
1232
+ y: t.y
1233
+ };
1234
+ for (; this.centreTaken(n);) n.x += dn, n.y += dn;
1235
+ let r = this.modeling.createShape(e, n, this.canvas.getRootElement());
1236
+ this.selection.select(r), this.canvas.focus(), this.injector.get("directEditing", !1)?.activate(r);
1237
+ }
1238
+ freeAreaCentre() {
1239
+ let e = this.config?.freeArea;
1240
+ return e?.center ? e.center() : e?.insets ? this.centreWithin(e.insets()) : this.config?.freeRectCenter?.();
1241
+ }
1242
+ centreWithin(e) {
1243
+ let { width: t, height: n } = this.canvas.getSize();
1244
+ if (!(t > 0 && n > 0)) return;
1245
+ let r = (e, t, n) => t + n < e ? t + (e - t - n) / 2 : e / 2, { x: i, y: a, scale: o } = this.canvas.viewbox();
1246
+ return {
1247
+ x: i + r(t, e.left, e.right) / o,
1248
+ y: a + r(n, e.top, e.bottom) / o
1249
+ };
1250
+ }
1251
+ visibleCentre() {
1252
+ let { x: e, y: t, width: n, height: r } = this.canvas.viewbox();
1253
+ return {
1254
+ x: e + n / 2,
1255
+ y: t + r / 2
1256
+ };
1257
+ }
1258
+ centreTaken(e) {
1259
+ return this.elementRegistry.filter(S).some((t) => Math.abs(t.x + t.width / 2 - e.x) < 1 && Math.abs(t.y + t.height / 2 - e.y) < 1);
1260
+ }
1261
+ editLock() {
1262
+ return this.injector.get("vcReadOnly", !1);
1263
+ }
1264
+ };
1265
+ function pn(e) {
1266
+ return e.type === "click" && e.detail === 0;
1267
+ }
1268
+ //#endregion
1269
+ //#region src/palette/index.ts
1270
+ var mn = {
1020
1271
  __depends__: [
1021
- Ce,
1022
- xe,
1023
- we,
1024
- Te,
1272
+ Oe,
1025
1273
  Ee,
1026
- De
1274
+ ke,
1275
+ Ae,
1276
+ je,
1277
+ Me
1027
1278
  ],
1028
1279
  __init__: ["vcPaletteProvider"],
1029
- vcPaletteProvider: ["type", Ot]
1030
- }, Y = "vc-color-picker";
1031
- function At(e) {
1032
- return `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><rect x="1" y="1" width="14" height="14" rx="2" fill="white" stroke="${e}" stroke-width="2"/></svg>`;
1280
+ vcPaletteProvider: ["type", fn]
1281
+ }, V = "vc-color-picker";
1282
+ function hn(e) {
1283
+ return `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><rect x="1" y="1" width="14" height="14" rx="2" fill="${A.fill}" stroke="${e}" stroke-width="2"/></svg>`;
1033
1284
  }
1034
- var jt = class {
1285
+ var gn = class {
1035
1286
  vcModeling;
1036
1287
  static $inject = ["popupMenu", "vcModeling"];
1037
1288
  constructor(e, t) {
1038
- this.vcModeling = t, e.registerProvider(Y, this);
1289
+ this.vcModeling = t, e.registerProvider(V, this);
1039
1290
  }
1040
1291
  getPopupMenuEntries(e) {
1041
1292
  let t = Array.isArray(e) ? e[0] : e;
1042
- if (!v(t)) return {};
1293
+ if (!S(t)) return {};
1043
1294
  let n = {};
1044
- for (let e of L) n[`color-${e.label.toLowerCase()}`] = {
1295
+ for (let e of st) n[`color-${e.label.toLowerCase()}`] = {
1045
1296
  label: e.label,
1046
- imageHtml: At(e.color ?? F.ink),
1297
+ imageHtml: hn(e.color ?? A.ink),
1047
1298
  action: () => this.vcModeling.setColor(t, e.color)
1048
1299
  };
1049
1300
  return n;
1050
1301
  }
1051
- }, X = "vc-align-elements";
1052
- function Z(e) {
1302
+ }, H = "vc-align-elements";
1303
+ function U(e) {
1053
1304
  return `<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" aria-hidden="true">${e}</svg>`;
1054
1305
  }
1055
- var Q = {
1056
- left: Z("<path d=\"M3 2v12\"/><rect x=\"5\" y=\"4\" width=\"8\" height=\"3\"/><rect x=\"5\" y=\"9\" width=\"5\" height=\"3\"/>"),
1057
- center: Z("<path d=\"M8 2v12\"/><rect x=\"4\" y=\"4\" width=\"8\" height=\"3\"/><rect x=\"5.5\" y=\"9\" width=\"5\" height=\"3\"/>"),
1058
- right: Z("<path d=\"M13 2v12\"/><rect x=\"3\" y=\"4\" width=\"8\" height=\"3\"/><rect x=\"6\" y=\"9\" width=\"5\" height=\"3\"/>"),
1059
- top: Z("<path d=\"M2 3h12\"/><rect x=\"4\" y=\"5\" width=\"3\" height=\"8\"/><rect x=\"9\" y=\"5\" width=\"3\" height=\"5\"/>"),
1060
- middle: Z("<path d=\"M2 8h12\"/><rect x=\"4\" y=\"4\" width=\"3\" height=\"8\"/><rect x=\"9\" y=\"5.5\" width=\"3\" height=\"5\"/>"),
1061
- bottom: Z("<path d=\"M2 13h12\"/><rect x=\"4\" y=\"3\" width=\"3\" height=\"8\"/><rect x=\"9\" y=\"6\" width=\"3\" height=\"5\"/>"),
1062
- horizontal: Z("<rect x=\"2\" y=\"5\" width=\"3\" height=\"6\"/><rect x=\"6.5\" y=\"5\" width=\"3\" height=\"6\"/><rect x=\"11\" y=\"5\" width=\"3\" height=\"6\"/>"),
1063
- vertical: Z("<rect x=\"5\" y=\"2\" width=\"6\" height=\"3\"/><rect x=\"5\" y=\"6.5\" width=\"6\" height=\"3\"/><rect x=\"5\" y=\"11\" width=\"6\" height=\"3\"/>")
1064
- }, Mt = class {
1306
+ var W = {
1307
+ left: U("<path d=\"M3 2v12\"/><rect x=\"5\" y=\"4\" width=\"8\" height=\"3\"/><rect x=\"5\" y=\"9\" width=\"5\" height=\"3\"/>"),
1308
+ center: U("<path d=\"M8 2v12\"/><rect x=\"4\" y=\"4\" width=\"8\" height=\"3\"/><rect x=\"5.5\" y=\"9\" width=\"5\" height=\"3\"/>"),
1309
+ right: U("<path d=\"M13 2v12\"/><rect x=\"3\" y=\"4\" width=\"8\" height=\"3\"/><rect x=\"6\" y=\"9\" width=\"5\" height=\"3\"/>"),
1310
+ top: U("<path d=\"M2 3h12\"/><rect x=\"4\" y=\"5\" width=\"3\" height=\"8\"/><rect x=\"9\" y=\"5\" width=\"3\" height=\"5\"/>"),
1311
+ middle: U("<path d=\"M2 8h12\"/><rect x=\"4\" y=\"4\" width=\"3\" height=\"8\"/><rect x=\"9\" y=\"5.5\" width=\"3\" height=\"5\"/>"),
1312
+ bottom: U("<path d=\"M2 13h12\"/><rect x=\"4\" y=\"3\" width=\"3\" height=\"8\"/><rect x=\"9\" y=\"6\" width=\"3\" height=\"5\"/>"),
1313
+ horizontal: U("<rect x=\"2\" y=\"5\" width=\"3\" height=\"6\"/><rect x=\"6.5\" y=\"5\" width=\"3\" height=\"6\"/><rect x=\"11\" y=\"5\" width=\"3\" height=\"6\"/>"),
1314
+ vertical: U("<rect x=\"5\" y=\"2\" width=\"6\" height=\"3\"/><rect x=\"5\" y=\"6.5\" width=\"6\" height=\"3\"/><rect x=\"5\" y=\"11\" width=\"6\" height=\"3\"/>")
1315
+ }, _n = class {
1065
1316
  alignElements;
1066
1317
  distributeElements;
1067
1318
  static $inject = [
@@ -1070,10 +1321,10 @@ var Q = {
1070
1321
  "distributeElements"
1071
1322
  ];
1072
1323
  constructor(e, t, n) {
1073
- this.alignElements = t, this.distributeElements = n, e.registerProvider(X, this);
1324
+ this.alignElements = t, this.distributeElements = n, e.registerProvider(H, this);
1074
1325
  }
1075
1326
  getPopupMenuEntries(e) {
1076
- let t = (Array.isArray(e) ? e : [e]).filter(v);
1327
+ let t = (Array.isArray(e) ? e : [e]).filter(S);
1077
1328
  if (t.length < 2) return {};
1078
1329
  let n = (e, n, r) => ({
1079
1330
  label: n,
@@ -1081,94 +1332,97 @@ var Q = {
1081
1332
  imageHtml: r,
1082
1333
  action: () => this.alignElements.trigger(t, e)
1083
1334
  }), r = {
1084
- "align-left": n("left", "Align left", Q.left),
1085
- "align-center": n("center", "Align center", Q.center),
1086
- "align-right": n("right", "Align right", Q.right),
1087
- "align-top": n("top", "Align top", Q.top),
1088
- "align-middle": n("middle", "Align middle", Q.middle),
1089
- "align-bottom": n("bottom", "Align bottom", Q.bottom)
1335
+ "align-left": n("left", "Align left", W.left),
1336
+ "align-center": n("center", "Align center", W.center),
1337
+ "align-right": n("right", "Align right", W.right),
1338
+ "align-top": n("top", "Align top", W.top),
1339
+ "align-middle": n("middle", "Align middle", W.middle),
1340
+ "align-bottom": n("bottom", "Align bottom", W.bottom)
1090
1341
  };
1091
1342
  return t.length >= 3 && (r["distribute-horizontally"] = {
1092
1343
  label: "Distribute horizontally",
1093
1344
  group: "distribute",
1094
- imageHtml: Q.horizontal,
1345
+ imageHtml: W.horizontal,
1095
1346
  action: () => this.distributeElements.trigger(t, "horizontal")
1096
1347
  }, r["distribute-vertically"] = {
1097
1348
  label: "Distribute vertically",
1098
1349
  group: "distribute",
1099
- imageHtml: Q.vertical,
1350
+ imageHtml: W.vertical,
1100
1351
  action: () => this.distributeElements.trigger(t, "vertical")
1101
1352
  }), r;
1102
1353
  }
1103
- }, Nt = class {
1354
+ }, vn = class {
1104
1355
  modeling;
1105
1356
  popupMenu;
1106
1357
  vcAppend;
1107
1358
  vcConnect;
1108
1359
  vcModeling;
1360
+ readOnly;
1109
1361
  static $inject = [
1110
1362
  "contextPad",
1111
1363
  "modeling",
1112
1364
  "popupMenu",
1113
1365
  "vcAppend",
1114
1366
  "vcConnect",
1115
- "vcModeling"
1367
+ "vcModeling",
1368
+ "vcReadOnly"
1116
1369
  ];
1117
- constructor(e, t, n, r, i, a) {
1118
- this.modeling = t, this.popupMenu = n, this.vcAppend = r, this.vcConnect = i, this.vcModeling = a, e.registerProvider(this);
1370
+ constructor(e, t, n, r, i, a, o) {
1371
+ this.modeling = t, this.popupMenu = n, this.vcAppend = r, this.vcConnect = i, this.vcModeling = a, this.readOnly = o, e.registerProvider(this);
1119
1372
  }
1120
1373
  getContextPadEntries(e) {
1121
1374
  let t = {};
1122
- if (y(e) && this.addStepEntries(t, e), b(e)) {
1375
+ if (this.readOnly.isReadOnly()) return t;
1376
+ if (C(e) && this.addStepEntries(t, e), w(e)) {
1123
1377
  let n = (t) => {
1124
1378
  this.vcConnect.start(t, e, "assignment");
1125
1379
  };
1126
1380
  t["connect.assignment"] = {
1127
1381
  group: "connect",
1128
1382
  title: "Connect to step",
1129
- html: J(K.connectHierarchy, "Connect to step", !0),
1383
+ html: B(R.connectHierarchy, !0),
1130
1384
  action: {
1131
1385
  click: n,
1132
1386
  dragstart: n
1133
1387
  }
1134
1388
  };
1135
1389
  }
1136
- if (v(e) && (t["set-color"] = {
1390
+ if (S(e) && (t["set-color"] = {
1137
1391
  group: "edit",
1138
1392
  title: "Set color",
1139
- html: J(K.color, "Set color"),
1393
+ html: B(R.color),
1140
1394
  action: { click: (t) => {
1141
1395
  let n = t;
1142
- this.popupMenu.open(e, Y, {
1396
+ this.popupMenu.open(e, V, {
1143
1397
  x: n.clientX,
1144
1398
  y: n.clientY
1145
1399
  });
1146
1400
  } }
1147
- }), x(e) && e.vcType !== "assignment") {
1401
+ }), T(e) && e.vcType !== "assignment") {
1148
1402
  let n = e, r = n.vcType === "sequence" ? "hierarchy" : "sequence";
1149
1403
  t["toggle-type"] = {
1150
1404
  group: "edit",
1151
1405
  title: `Switch to "${r === "sequence" ? "is predecessor of" : "is process-oriented superior"}"`,
1152
- html: J(K.toggleType, "Switch relation type"),
1406
+ html: B(R.toggleType),
1153
1407
  action: { click: () => this.vcModeling.setConnectionType(n, r) }
1154
1408
  };
1155
1409
  }
1156
- return (v(e) || x(e)) && (t.delete = {
1410
+ return (S(e) || T(e)) && (t.delete = {
1157
1411
  group: "edit",
1158
1412
  title: "Delete",
1159
- html: J(K.trash, "Delete"),
1413
+ html: B(R.trash),
1160
1414
  action: { click: () => this.modeling.removeElements([e]) }
1161
1415
  }), t;
1162
1416
  }
1163
1417
  getMultiElementContextPadEntries(e) {
1164
1418
  let t = {};
1165
- return e.filter(v).length >= 2 && (t.align = {
1419
+ return this.readOnly.isReadOnly() || (e.filter(S).length >= 2 && (t.align = {
1166
1420
  group: "edit",
1167
1421
  title: "Align / distribute",
1168
- html: J(K.align, "Align / distribute"),
1422
+ html: B(R.align),
1169
1423
  action: { click: (t) => {
1170
1424
  let n = t;
1171
- this.popupMenu.open(e, X, {
1425
+ this.popupMenu.open(e, H, {
1172
1426
  x: n.clientX,
1173
1427
  y: n.clientY
1174
1428
  });
@@ -1176,9 +1430,9 @@ var Q = {
1176
1430
  }), t.delete = {
1177
1431
  group: "edit",
1178
1432
  title: "Delete",
1179
- html: J(K.trash, "Delete"),
1433
+ html: B(R.trash),
1180
1434
  action: { click: () => this.modeling.removeElements([...e]) }
1181
- }, t;
1435
+ }), t;
1182
1436
  }
1183
1437
  addStepEntries(e, t) {
1184
1438
  let n = (e) => () => {
@@ -1191,7 +1445,7 @@ var Q = {
1191
1445
  e["append.step"] = {
1192
1446
  group: "model",
1193
1447
  title: "Append step (is predecessor of)",
1194
- html: J(K.appendStep, "Append step (is predecessor of)", !0),
1448
+ html: B(R.appendStep, !0),
1195
1449
  action: {
1196
1450
  click: n("sequence"),
1197
1451
  dragstart: r("sequence")
@@ -1199,7 +1453,7 @@ var Q = {
1199
1453
  }, e["append.sub-step"] = {
1200
1454
  group: "model",
1201
1455
  title: "Append sub-step (is process-oriented superior)",
1202
- html: J(K.appendSubStep, "Append sub-step (is process-oriented superior)", !0),
1456
+ html: B(R.appendSubStep, !0),
1203
1457
  action: {
1204
1458
  click: n("hierarchy"),
1205
1459
  dragstart: r("hierarchy")
@@ -1207,7 +1461,7 @@ var Q = {
1207
1461
  }, e["append.org-unit"] = {
1208
1462
  group: "model",
1209
1463
  title: "Append organizational unit",
1210
- html: J(K.appendOrgUnit, "Append organizational unit", !0),
1464
+ html: B(R.appendOrgUnit, !0),
1211
1465
  action: {
1212
1466
  click: n("assignment"),
1213
1467
  dragstart: r("assignment")
@@ -1215,7 +1469,7 @@ var Q = {
1215
1469
  }, e["connect.sequence"] = {
1216
1470
  group: "connect",
1217
1471
  title: "Connect (is predecessor of)",
1218
- html: J(K.connectSequence, "Connect (is predecessor of)", !0),
1472
+ html: B(R.connectSequence, !0),
1219
1473
  action: {
1220
1474
  click: i("sequence"),
1221
1475
  dragstart: i("sequence")
@@ -1223,50 +1477,98 @@ var Q = {
1223
1477
  }, e["connect.hierarchy"] = {
1224
1478
  group: "connect",
1225
1479
  title: "Connect (is process-oriented superior)",
1226
- html: J(K.connectHierarchy, "Connect (is process-oriented superior)", !0),
1480
+ html: B(R.connectHierarchy, !0),
1227
1481
  action: {
1228
1482
  click: i("hierarchy"),
1229
1483
  dragstart: i("hierarchy")
1230
1484
  }
1231
1485
  };
1232
1486
  }
1233
- }, Pt = {
1234
- __depends__: [Oe, g],
1487
+ }, yn = {
1488
+ __depends__: [Ne, v],
1235
1489
  __init__: ["vcContextPadProvider"],
1236
- vcContextPadProvider: ["type", Nt]
1237
- }, Ft = class {
1490
+ vcContextPadProvider: ["type", vn]
1491
+ }, bn = class {
1238
1492
  directEditing;
1239
1493
  canvas;
1240
1494
  vcModeling;
1495
+ elementRegistry;
1241
1496
  static $inject = [
1242
1497
  "directEditing",
1243
1498
  "canvas",
1244
1499
  "eventBus",
1245
- "vcModeling"
1500
+ "vcModeling",
1501
+ "elementRegistry"
1246
1502
  ];
1247
- constructor(e, t, n, r) {
1248
- this.directEditing = e, this.canvas = t, this.vcModeling = r, e.registerProvider(this), n.on("element.dblclick", (t) => {
1249
- t.element && v(t.element) && e.activate(t.element);
1503
+ suspended = null;
1504
+ resumeTimer;
1505
+ constructor(e, t, n, r, i) {
1506
+ this.directEditing = e, this.canvas = t, this.vcModeling = r, this.elementRegistry = i, e.registerProvider(this), n.on("element.dblclick", (t) => {
1507
+ t.element && S(t.element) && e.activate(t.element);
1250
1508
  }), n.on("autoPlace.end", 500, (t) => {
1251
- t.shape && v(t.shape) && e.activate(t.shape);
1509
+ t.shape && S(t.shape) && e.activate(t.shape);
1252
1510
  }), n.on("create.end", 500, (t) => {
1253
1511
  let { source: n, shape: r, canExecute: i } = t.context;
1254
- n && i && r && v(r) && e.activate(r);
1512
+ n && i && r && S(r) && e.activate(r);
1255
1513
  }), n.on([
1256
1514
  "element.mousedown",
1257
1515
  "drag.init",
1258
- "canvas.viewbox.changing",
1259
1516
  "autoPlace.start",
1260
1517
  "popupMenu.open"
1261
1518
  ], () => {
1262
1519
  e.isActive() && e.complete();
1263
- }), n.on(["commandStack.changed", "diagram.destroy"], () => {
1520
+ }), n.on("canvas.viewbox.changed", () => this.followView()), n.on("commandStack.changed", () => {
1264
1521
  e.isActive() && e.cancel();
1522
+ }), n.on("diagram.destroy", 1500, () => {
1523
+ clearTimeout(this.resumeTimer), this.suspended = null, e.isActive() && e.cancel();
1265
1524
  });
1266
1525
  }
1526
+ openEdit() {
1527
+ let e = this.directEditing._active?.element;
1528
+ if (this.directEditing.isActive() && S(e)) return {
1529
+ element: e,
1530
+ text: this.directEditing.getValue()
1531
+ };
1532
+ }
1533
+ suspend() {
1534
+ clearTimeout(this.resumeTimer);
1535
+ let e = this.openEdit();
1536
+ e && (this.suspended = {
1537
+ elementId: e.element.id,
1538
+ text: e.text
1539
+ }, this.directEditing.cancel());
1540
+ }
1541
+ resumeAfterImport() {
1542
+ clearTimeout(this.resumeTimer), this.suspended && (this.resumeTimer = setTimeout(() => {
1543
+ let e = this.suspended;
1544
+ this.suspended = null, e && !this.directEditing.isActive() && this.resume(e);
1545
+ }, 0));
1546
+ }
1547
+ resume(e) {
1548
+ let t = this.elementRegistry.get(e.elementId);
1549
+ if (!S(t) || !this.directEditing.activate(t)) return;
1550
+ let n = this.directEditing._textbox?.content;
1551
+ if (!n) return;
1552
+ n.innerText = e.text;
1553
+ let r = n.ownerDocument.getSelection();
1554
+ r?.selectAllChildren(n), r?.collapseToEnd();
1555
+ }
1556
+ followView() {
1557
+ let e = this.directEditing._active, t = this.directEditing._textbox;
1558
+ if (!e || !t) return;
1559
+ let n = this.activate(e.element);
1560
+ if (!n) return;
1561
+ let { x: r, y: i, width: a, height: o } = n.bounds;
1562
+ Object.assign(t.parent.style, {
1563
+ left: `${r}px`,
1564
+ top: `${i}px`,
1565
+ width: `${a}px`,
1566
+ height: `${o}px`
1567
+ }), t.content.style.fontSize = n.style?.fontSize ?? "", e.context.bounds = n.bounds;
1568
+ }
1267
1569
  activate(e) {
1268
- if (!v(e)) return;
1269
- let t = e, n = this.canvas.getAbsoluteBBox(t), r = this.canvas.zoom(), i = (b(t) ? 12 : M(t.width, t.height)) * r;
1570
+ if (!S(e)) return;
1571
+ let t = e, n = this.canvas.getAbsoluteBBox(t), r = this.canvas.zoom(), i = (w(t) ? 12 : at(t.width, t.height)) * r;
1270
1572
  return {
1271
1573
  bounds: {
1272
1574
  x: n.x + i,
@@ -1275,142 +1577,201 @@ var Q = {
1275
1577
  height: n.height
1276
1578
  },
1277
1579
  style: {
1278
- fontFamily: I.family,
1279
- fontSize: `${I.size * r}px`,
1580
+ fontFamily: j.family,
1581
+ fontSize: `${j.size * r}px`,
1280
1582
  fontWeight: "normal",
1281
- lineHeight: String(I.lineHeight),
1282
- textAlign: "center"
1583
+ lineHeight: String(j.lineHeight),
1584
+ textAlign: "center",
1585
+ backgroundColor: "var(--cd-ui-flaeche-hoch)",
1586
+ border: "1px solid var(--cd-ui-interaktion)"
1283
1587
  },
1284
1588
  options: { centerVertically: !0 },
1285
1589
  text: t.vcLabel || ""
1286
1590
  };
1287
1591
  }
1288
1592
  update(e, t) {
1289
- this.vcModeling.updateLabel(e, It(t));
1593
+ this.vcModeling.updateLabel(e, xn(t));
1290
1594
  }
1291
1595
  };
1292
- function It(e) {
1596
+ function xn(e) {
1293
1597
  return e.replace(/\r\n?/g, "\n").trim();
1294
1598
  }
1295
1599
  //#endregion
1296
1600
  //#region src/label-editing/index.ts
1297
- var Lt = {
1298
- __depends__: [ke],
1601
+ var Sn = {
1602
+ __depends__: [Pe],
1299
1603
  __init__: ["vcLabelEditingProvider"],
1300
- vcLabelEditingProvider: ["type", Ft]
1301
- }, Rt = {
1302
- __depends__: [g],
1604
+ vcLabelEditingProvider: ["type", bn]
1605
+ }, Cn = {
1606
+ __depends__: [v],
1303
1607
  __init__: ["vcColorPickerProvider"],
1304
- vcColorPickerProvider: ["type", jt]
1305
- }, zt = {
1608
+ vcColorPickerProvider: ["type", gn]
1609
+ }, wn = {
1306
1610
  __depends__: [
1307
- g,
1308
- Ae,
1309
- je
1611
+ v,
1612
+ Fe,
1613
+ Ie
1310
1614
  ],
1311
1615
  __init__: ["vcAlignMenuProvider"],
1312
- vcAlignMenuProvider: ["type", Mt]
1313
- }, $ = class extends Pe {
1616
+ vcAlignMenuProvider: ["type", _n]
1617
+ }, Tn = /* @__PURE__ */ new Set(["undo", "redo"]), En = class extends ze {
1618
+ static $inject = [
1619
+ "eventBus",
1620
+ "keyboard",
1621
+ "config.vcKeyboard"
1622
+ ];
1623
+ undoRedoKeys;
1624
+ constructor(e, t, n) {
1625
+ super(e, t), this.undoRedoKeys = n?.undoRedoKeys ?? !0;
1626
+ }
1314
1627
  registerBindings(e, t) {
1315
- super.registerBindings(e, t);
1316
- let n = (n, r) => {
1628
+ let n = this.undoRedoKeys ? t : Object.create(t, { isRegistered: { value: (e) => !Tn.has(e) && t.isRegistered(e) } });
1629
+ super.registerBindings(e, n);
1630
+ let r = (n, r) => {
1317
1631
  t.isRegistered(n) && e.addListener(r);
1318
- }, r = (e, r) => {
1319
- n(e, (n) => {
1320
- let i = n.keyEvent;
1321
- if (Ie(r, i) && !Fe(i)) return t.trigger(e, {}), !0;
1632
+ }, i = (e, n) => {
1633
+ r(e, (r) => {
1634
+ let i = r.keyEvent;
1635
+ if (y(n, i) && !Be(i)) return t.trigger(e, {}), !0;
1322
1636
  });
1323
1637
  };
1324
- r("handTool", ["h", "H"]), r("lassoTool", ["l", "L"]), r("spaceTool", ["s", "S"]), r("globalConnectTool", ["c", "C"]), r("directEditing", ["e", "E"]);
1638
+ i("lassoTool", ["l", "L"]), i("handTool", ["h", "H"]), i("spaceTool", ["s", "S"]), i("globalConnectTool", ["c", "C"]), i("directEditing", ["e", "E"]), r("selectAll", (e) => {
1639
+ let n = e.keyEvent;
1640
+ if (Ve(n) && y(["a", "A"], n) && !n.shiftKey && !n.altKey) return t.trigger("selectAll", {}), !0;
1641
+ });
1325
1642
  }
1326
- }, Bt = 1500, Vt = class {
1643
+ }, Dn = 1500, On = class {
1327
1644
  static $inject = ["eventBus", "injector"];
1328
1645
  constructor(e, t) {
1329
- e.on("editorActions.init", Bt, (e) => {
1330
- let { editorActions: n } = e, r = (e, r, i) => {
1331
- let a = t.get(r, !1);
1332
- a && n.register({ [e]: () => i(a) });
1646
+ e.on("editorActions.init", Dn, (e) => {
1647
+ let { editorActions: n } = e, r = t.get("vcReadOnly", !1), i = () => !r?.isReadOnly(), a = (e, r, i, a = () => !0) => {
1648
+ let o = t.get(r, !1);
1649
+ o && n.register({ [e]: () => {
1650
+ a() && i(o);
1651
+ } });
1333
1652
  };
1334
- r("handTool", "handTool", (e) => e.toggle()), r("lassoTool", "lassoTool", (e) => e.toggle()), r("spaceTool", "spaceTool", (e) => e.toggle()), r("globalConnectTool", "globalConnect", (e) => e.toggle());
1335
- let i = t.get("directEditing", !1), a = t.get("selection", !1);
1336
- i && a && n.register({ directEditing: () => {
1337
- let e = a.get();
1338
- e.length === 1 && e[0] && i.activate(e[0]);
1653
+ a("handTool", "handTool", (e) => e.toggle()), a("lassoTool", "lassoTool", (e) => e.toggle()), a("spaceTool", "spaceTool", (e) => e.toggle(), i), a("globalConnectTool", "globalConnect", (e) => e.toggle(), i);
1654
+ let o = t.get("elementRegistry", !1), s = t.get("selection", !1);
1655
+ o && s && n.register({ selectAll: () => s.select(o.filter(E)) });
1656
+ let c = t.get("directEditing", !1);
1657
+ c && s && n.register({ directEditing: () => {
1658
+ let e = s.get();
1659
+ i() && e.length === 1 && e[0] && c.activate(e[0]);
1339
1660
  } });
1340
1661
  });
1341
1662
  }
1342
- }, Ht = {
1343
- __depends__: [Me, Ne],
1663
+ }, kn = {
1664
+ __depends__: [Le, Re],
1344
1665
  __init__: ["vcEditorActions"],
1345
- keyboardBindings: ["type", $],
1346
- vcEditorActions: ["type", Vt]
1347
- }, Ut = class extends Le {
1666
+ keyboardBindings: ["type", En],
1667
+ vcEditorActions: ["type", On]
1668
+ }, An = class extends He {
1348
1669
  static $inject = ["eventBus"];
1349
1670
  constructor(e) {
1350
1671
  super(e);
1351
1672
  }
1352
1673
  getOrdering(e, t) {
1353
- return x(e) ? {
1674
+ return T(e) ? {
1354
1675
  parent: t,
1355
- index: (t.children ?? []).filter((t) => t !== e && x(t)).length
1676
+ index: (t.children ?? []).filter((t) => t !== e && T(t)).length
1356
1677
  } : { parent: t };
1357
1678
  }
1358
- }, Wt = {
1679
+ }, jn = {
1359
1680
  __init__: ["vcOrderingProvider"],
1360
- vcOrderingProvider: ["type", Ut]
1361
- }, Gt = class {
1681
+ vcOrderingProvider: ["type", An]
1682
+ }, Mn = class {
1362
1683
  static $inject = ["eventBus"];
1363
1684
  constructor(e) {
1364
1685
  e.on("copyPaste.copyElement", (e) => {
1365
1686
  let { descriptor: t, element: n } = e;
1366
- v(n) ? (t.vcType = n.vcType, t.vcLabel = n.vcLabel, n.color !== void 0 && (t.color = n.color), n.link !== void 0 && (t.link = n.link)) : x(n) && (t.vcType = n.vcType);
1687
+ S(n) ? (t.vcType = n.vcType, t.vcLabel = n.vcLabel, n.color !== void 0 && (t.color = n.color), n.link !== void 0 && (t.link = n.link)) : T(n) && (t.vcType = n.vcType);
1367
1688
  });
1368
1689
  }
1369
- }, Kt = {
1370
- __depends__: [Re],
1690
+ }, Nn = {
1691
+ __depends__: [Ue],
1371
1692
  __init__: ["vcCopyPasteBehavior"],
1372
- vcCopyPasteBehavior: ["type", Gt]
1373
- }, qt = class {
1693
+ vcCopyPasteBehavior: ["type", Mn]
1694
+ }, Pn = class {
1374
1695
  static $inject = ["eventBus"];
1375
1696
  constructor(e) {
1376
1697
  e.on("resize.start", (e) => {
1377
- v(e.context.shape) && (e.context.minDimensions = { ...a });
1698
+ S(e.context.shape) && (e.context.minDimensions = { ...i });
1378
1699
  }), e.on("spaceTool.getMinDimensions", (e) => {
1379
1700
  let t = {};
1380
- for (let n of e.shapes) v(n) && (t[n.id] = { ...a });
1701
+ for (let n of e.shapes) S(n) && (t[n.id] = { ...i });
1381
1702
  return t;
1382
1703
  });
1383
1704
  }
1384
- }, Jt = {
1385
- __depends__: [ze],
1705
+ }, Fn = {
1706
+ __depends__: [We],
1386
1707
  __init__: ["vcResizeBehavior"],
1387
- vcResizeBehavior: ["type", qt]
1388
- }, Yt = class extends Ue {
1708
+ vcResizeBehavior: ["type", Pn]
1709
+ }, In = "valueChain.readOnly.changed", G = 5e3, Ln = [
1710
+ "elements.move",
1711
+ "shape.move",
1712
+ "shape.resize",
1713
+ "shape.create",
1714
+ "elements.create",
1715
+ "shape.append",
1716
+ "connection.start",
1717
+ "connection.create",
1718
+ "connection.reconnect",
1719
+ "connection.updateWaypoints",
1720
+ "elements.delete",
1721
+ "elements.align",
1722
+ "elements.distribute"
1723
+ ], Rn = class extends Ce {
1724
+ bus;
1725
+ injector;
1726
+ static $inject = ["eventBus", "injector"];
1727
+ readOnly = !1;
1728
+ constructor(e, t) {
1729
+ super(e), this.bus = e, this.injector = t, e.on("copyPaste.pasteElements", G, () => !this.readOnly && void 0), e.on("directEditing.activate.allowed", G, () => !this.readOnly && void 0);
1730
+ }
1731
+ init() {
1732
+ this.addRule(Ln, G, () => !this.readOnly && void 0);
1733
+ }
1734
+ isReadOnly() {
1735
+ return this.readOnly;
1736
+ }
1737
+ setReadOnly(e) {
1738
+ this.readOnly !== e && (this.readOnly = e, e && this.interruptEdits(), this.bus.fire(In, { readOnly: e }));
1739
+ }
1740
+ interruptEdits() {
1741
+ let e = (e) => this.injector.get(e, !1);
1742
+ e("directEditing")?.cancel(), e("dragging")?.cancel(), e("popupMenu")?.close(), e("contextPad")?.close();
1743
+ }
1744
+ }, zn = {
1745
+ __depends__: [Se],
1746
+ __init__: ["vcReadOnly"],
1747
+ vcReadOnly: ["type", Rn]
1748
+ }, Bn = class extends N {
1389
1749
  _getModules() {
1390
1750
  return [
1391
1751
  ...super._getModules(),
1392
- re,
1393
- ie,
1394
- ae,
1395
- oe,
1396
- se,
1397
1752
  ce,
1398
1753
  le,
1399
1754
  ue,
1400
1755
  de,
1401
- ct,
1402
- pt,
1403
- ht,
1404
- Dt,
1405
- kt,
1406
- Pt,
1407
- Lt,
1408
- Rt,
1409
- zt,
1756
+ fe,
1757
+ pe,
1758
+ me,
1759
+ he,
1760
+ ge,
1761
+ zn,
1410
1762
  Ht,
1411
- Wt,
1412
- Kt,
1413
- Jt
1763
+ qt,
1764
+ Yt,
1765
+ cn,
1766
+ mn,
1767
+ yn,
1768
+ Sn,
1769
+ Cn,
1770
+ wn,
1771
+ kn,
1772
+ jn,
1773
+ Nn,
1774
+ Fn
1414
1775
  ];
1415
1776
  }
1416
1777
  undo() {
@@ -1425,8 +1786,401 @@ var Lt = {
1425
1786
  canRedo() {
1426
1787
  return this.get("commandStack").canRedo();
1427
1788
  }
1428
- };
1789
+ }, Vn = "value-chain", Hn = "New value chain";
1790
+ function Un(e = {}) {
1791
+ return qn(new Bn({
1792
+ ...Gn(e),
1793
+ undoRedoKeys: e.undoRedoKeys ?? !0,
1794
+ freeArea: e.freeArea,
1795
+ freeRectCenter: e.freeRectCenter
1796
+ }), !0);
1797
+ }
1798
+ function Wn(e = {}) {
1799
+ return qn(new N(Gn(e)), !1);
1800
+ }
1801
+ function Gn(e) {
1802
+ return {
1803
+ width: "100%",
1804
+ height: "100%",
1805
+ additionalModules: e.additionalModules ?? [],
1806
+ fitOnImport: e.fitOnImport ?? !0
1807
+ };
1808
+ }
1809
+ function Kn(e) {
1810
+ return e.trim() === "" ? o(Hn) : u(e);
1811
+ }
1812
+ function qn(e, t) {
1813
+ let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = /* @__PURE__ */ new Set(), s = !1, c = "", l = {
1814
+ notation: Vn,
1815
+ apiVersion: Ge,
1816
+ editable: t
1817
+ };
1818
+ return t && n.on("commandStack.changed", () => {
1819
+ for (let e of [...o]) e();
1820
+ }), {
1821
+ meta: l,
1822
+ elements: {
1823
+ list: () => s ? [] : i.getAll().filter(S).map(Jn),
1824
+ reveal(e) {
1825
+ if (s) return !1;
1826
+ let t = i.get(e);
1827
+ return S(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
1828
+ },
1829
+ selection: () => s ? [] : K(a.get()),
1830
+ onSelection(e) {
1831
+ let t = (t) => e(K(t.newSelection ?? []));
1832
+ return n.on("selection.changed", t), () => n.off("selection.changed", t);
1833
+ },
1834
+ bounds(e) {
1835
+ if (s) return;
1836
+ let t = i.get(e);
1837
+ if (!S(t)) return;
1838
+ let { x: n, y: r, width: a, height: o } = t;
1839
+ return {
1840
+ x: n,
1841
+ y: r,
1842
+ width: a,
1843
+ height: o
1844
+ };
1845
+ }
1846
+ },
1847
+ diagram: e,
1848
+ attachTo(t) {
1849
+ t.appendChild(e.container), r.resized();
1850
+ },
1851
+ importText(t) {
1852
+ if (s) return Promise.reject(/* @__PURE__ */ Error("The modeler was destroyed."));
1853
+ try {
1854
+ let n = e.importDocument(Kn(t));
1855
+ return Promise.resolve({ warnings: n.map((e) => e.message) });
1856
+ } catch (e) {
1857
+ return Promise.reject(e instanceof Error ? e : Error(String(e)));
1858
+ }
1859
+ },
1860
+ exportText() {
1861
+ return s ? c : d(e.exportDocument());
1862
+ },
1863
+ onContentChanged(e) {
1864
+ return t ? (o.add(e), () => o.delete(e)) : () => void 0;
1865
+ },
1866
+ getViewState() {
1867
+ if (!s) try {
1868
+ let { x: e, y: t, width: n, height: i } = r.viewbox(), a = {
1869
+ x: e,
1870
+ y: t,
1871
+ width: n,
1872
+ height: i
1873
+ };
1874
+ return Yn(a) ? a : void 0;
1875
+ } catch {
1876
+ return;
1877
+ }
1878
+ },
1879
+ setViewState(e) {
1880
+ !s && Yn(e) && r.viewbox({
1881
+ x: e.x,
1882
+ y: e.y,
1883
+ width: e.width,
1884
+ height: e.height
1885
+ });
1886
+ },
1887
+ destroy() {
1888
+ if (!s) {
1889
+ try {
1890
+ c = d(e.exportDocument());
1891
+ } catch {
1892
+ c = "";
1893
+ }
1894
+ s = !0, o.clear(), e.destroy();
1895
+ }
1896
+ }
1897
+ };
1898
+ }
1899
+ function K(e) {
1900
+ return e.filter(S).map((e) => e.id);
1901
+ }
1902
+ function Jn(e) {
1903
+ return e.vcLabel ? {
1904
+ id: e.id,
1905
+ name: e.vcLabel
1906
+ } : { id: e.id };
1907
+ }
1908
+ function Yn(e) {
1909
+ if (typeof e != "object" || !e) return !1;
1910
+ let { x: t, y: n, width: r, height: i } = e;
1911
+ return q(t) && q(n) && q(r) && q(i) && r > 0 && i > 0;
1912
+ }
1913
+ function q(e) {
1914
+ return typeof e == "number" && Number.isFinite(e);
1915
+ }
1916
+ //#endregion
1917
+ //#region src/diagram-menu/menu.ts
1918
+ function J(e, t, n, r) {
1919
+ return {
1920
+ kind: "action",
1921
+ id: e,
1922
+ label: t,
1923
+ ...r ? { icon: r } : {},
1924
+ ...n.shortcut ? { shortcut: n.shortcut } : {},
1925
+ onSelect: () => n.onSelect()
1926
+ };
1927
+ }
1928
+ var Y = "Export as JSON";
1929
+ function Xn(e) {
1930
+ let { exports: t } = e;
1931
+ return {
1932
+ export: [
1933
+ J("export-png", "Export as PNG", t.png, "file-image"),
1934
+ J("export-svg", "Export as SVG", t.svg, "file-code-corner"),
1935
+ ...t.json ? [J("export-json", Y, t.json)] : []
1936
+ ],
1937
+ help: [{
1938
+ kind: "dialog",
1939
+ id: "keyboard-shortcuts",
1940
+ label: "Keyboard shortcuts…",
1941
+ icon: "keyboard",
1942
+ onSelect: () => e.showKeyboardShortcuts()
1943
+ }]
1944
+ };
1945
+ }
1946
+ //#endregion
1947
+ //#region src/diagram-menu/shortcuts.ts
1948
+ var X = [
1949
+ "←",
1950
+ "↑",
1951
+ "→",
1952
+ "↓"
1953
+ ];
1954
+ function Zn(e, t, n) {
1955
+ return t === "mac" ? `⌘${e}` : `${n.ctrl}+${e}`;
1956
+ }
1957
+ function Qn(e) {
1958
+ try {
1959
+ return new Intl.NumberFormat(e, { style: "percent" }).format(1);
1960
+ } catch {
1961
+ return new Intl.NumberFormat("en", { style: "percent" }).format(1);
1962
+ }
1963
+ }
1964
+ function $n(e, t) {
1965
+ if (e === "mac") return {
1966
+ zoomIn: "⌘+",
1967
+ zoomOut: "⌘−",
1968
+ zoomToActual: "⌘0",
1969
+ fit: "⇧1"
1970
+ };
1971
+ let { ctrl: n, shift: r, plus: i, minus: a } = t;
1972
+ return {
1973
+ zoomIn: `${n}+${i}`,
1974
+ zoomOut: `${n}+${a}`,
1975
+ zoomToActual: `${n}+0`,
1976
+ fit: `${r}+1`
1977
+ };
1978
+ }
1979
+ function er(e, t) {
1980
+ if (e === "mac") return {
1981
+ undo: ["⌘Z"],
1982
+ redo: ["⌘⇧Z"],
1983
+ selectAll: ["⌘A"],
1984
+ copy: ["⌘C"],
1985
+ cut: ["⌘X"],
1986
+ paste: ["⌘V"],
1987
+ duplicate: ["⌘D"],
1988
+ remove: ["⌫"],
1989
+ coarseMove: X.map((e) => `⇧${e}`),
1990
+ moveCanvas: X.map((e) => `⌘${e}`),
1991
+ lassoDrag: ["⇧ Drag"]
1992
+ };
1993
+ let { ctrl: n, shift: r } = t;
1994
+ return {
1995
+ undo: [`${n}+Z`],
1996
+ redo: [`${n}+${r}+Z`, `${n}+Y`],
1997
+ selectAll: [`${n}+A`],
1998
+ copy: [`${n}+C`],
1999
+ cut: [`${n}+X`],
2000
+ paste: [`${n}+V`],
2001
+ duplicate: [`${n}+D`],
2002
+ remove: ["Del", "Backspace"],
2003
+ coarseMove: X.map((e) => `${r}+${e}`),
2004
+ moveCanvas: X.map((e) => `${n}+${e}`),
2005
+ lassoDrag: [`${r}+Drag`]
2006
+ };
2007
+ }
2008
+ function tr(e) {
2009
+ let { platform: t, messages: n } = e;
2010
+ return {
2011
+ title: "File",
2012
+ rows: [{
2013
+ action: n.openFile ?? "Open…",
2014
+ keys: [Zn("O", t, n.keyNames)]
2015
+ }, {
2016
+ action: Y,
2017
+ keys: [Zn("S", t, n.keyNames)]
2018
+ }]
2019
+ };
2020
+ }
2021
+ function nr(e, t = {}) {
2022
+ let { platform: n, messages: r } = e, i = $n(n, r.keyNames), a = er(n, r.keyNames);
2023
+ return [
2024
+ ...t.fileKeys ? [tr(e)] : [],
2025
+ {
2026
+ title: "View",
2027
+ rows: [
2028
+ {
2029
+ action: r.zoomIn,
2030
+ keys: [i.zoomIn]
2031
+ },
2032
+ {
2033
+ action: r.zoomOut,
2034
+ keys: [i.zoomOut]
2035
+ },
2036
+ {
2037
+ action: r.zoomToActual(Qn(e.lang)),
2038
+ keys: [i.zoomToActual]
2039
+ },
2040
+ {
2041
+ action: r.fit,
2042
+ keys: [i.fit]
2043
+ },
2044
+ {
2045
+ action: "Move the canvas",
2046
+ keys: a.moveCanvas
2047
+ }
2048
+ ]
2049
+ },
2050
+ {
2051
+ title: "Edit",
2052
+ rows: [
2053
+ {
2054
+ action: "Undo",
2055
+ keys: a.undo
2056
+ },
2057
+ {
2058
+ action: "Redo",
2059
+ keys: a.redo
2060
+ },
2061
+ {
2062
+ action: "Select all",
2063
+ keys: a.selectAll
2064
+ },
2065
+ {
2066
+ action: "Copy",
2067
+ keys: a.copy
2068
+ },
2069
+ {
2070
+ action: "Cut",
2071
+ keys: a.cut
2072
+ },
2073
+ {
2074
+ action: "Paste",
2075
+ keys: a.paste
2076
+ },
2077
+ {
2078
+ action: "Duplicate",
2079
+ keys: a.duplicate
2080
+ },
2081
+ {
2082
+ action: "Delete",
2083
+ keys: a.remove
2084
+ },
2085
+ {
2086
+ action: "Edit label",
2087
+ keys: ["E", "Double-click"]
2088
+ },
2089
+ {
2090
+ action: "Move selection",
2091
+ keys: X
2092
+ },
2093
+ {
2094
+ action: "Move selection in large steps",
2095
+ keys: a.coarseMove
2096
+ }
2097
+ ]
2098
+ },
2099
+ {
2100
+ title: "Tools",
2101
+ rows: [
2102
+ {
2103
+ action: "Lasso",
2104
+ keys: ["L"]
2105
+ },
2106
+ {
2107
+ action: "Lasso by dragging",
2108
+ keys: a.lassoDrag
2109
+ },
2110
+ {
2111
+ action: "Hand",
2112
+ keys: ["H"]
2113
+ },
2114
+ {
2115
+ action: "Hand while held",
2116
+ keys: ["Space"]
2117
+ },
2118
+ {
2119
+ action: "Create or remove space",
2120
+ keys: ["S"]
2121
+ },
2122
+ {
2123
+ action: "Connect",
2124
+ keys: ["C"]
2125
+ }
2126
+ ]
2127
+ }
2128
+ ];
2129
+ }
2130
+ //#endregion
2131
+ //#region src/diagram-menu/ShortcutsDialog.ts
2132
+ var Z = "vc-shortcuts", Q = "vc-shortcuts-title";
2133
+ function $(e, t, n) {
2134
+ let r = document.createElement(e);
2135
+ return r.className = t, n !== void 0 && (r.textContent = n), r;
2136
+ }
2137
+ function rr(e, t) {
2138
+ let n = $("section", `${Z}-group`), r = `${Q}-group-${t}`, i = $("h4", `${Z}-group-title`, e.title);
2139
+ i.id = r;
2140
+ let a = $("table", `${Z}-table`);
2141
+ a.setAttribute("aria-labelledby", r);
2142
+ let o = a.createTBody();
2143
+ for (let t of e.rows) {
2144
+ let e = o.insertRow(), n = $("th", `${Z}-action`, t.action);
2145
+ n.scope = "row";
2146
+ let r = $("td", `${Z}-keys`);
2147
+ for (let e of t.keys) r.append($("kbd", `${Z}-key`, e));
2148
+ e.append(n, r);
2149
+ }
2150
+ return n.append(i, a), n;
2151
+ }
2152
+ function ir(e, t, n) {
2153
+ let r = $("div", `${Z}-panel`), i = $("header", `${Z}-header`), a = $("h3", `${Z}-title`, "Keyboard shortcuts");
2154
+ a.id = Q;
2155
+ let o = $("button", `${Z}-close`);
2156
+ o.type = "button", o.setAttribute("aria-label", e.messages.close), o.innerHTML = I("x"), o.addEventListener("click", n), i.append(a, o);
2157
+ let s = $("div", `${Z}-body`);
2158
+ return s.append(...nr(e, t).map(rr)), r.append(i, s), r;
2159
+ }
2160
+ function ar(e, t = {}) {
2161
+ let n;
2162
+ function r() {
2163
+ let n = $("dialog", Z);
2164
+ return n.setAttribute("aria-labelledby", Q), n.append(ir(e, t, () => n.close())), n.addEventListener("click", (e) => {
2165
+ e.target === n && n.close();
2166
+ }), n.addEventListener("close", () => {
2167
+ e.menu.trigger.hidden || e.menu.trigger.focus({ preventScroll: !0 });
2168
+ }), e.root.append(n), n;
2169
+ }
2170
+ return {
2171
+ open() {
2172
+ n ??= r(), n.open || n.showModal();
2173
+ },
2174
+ close() {
2175
+ n?.close();
2176
+ },
2177
+ isOpen: () => n?.open === !0,
2178
+ destroy() {
2179
+ n?.remove(), n = void 0;
2180
+ }
2181
+ };
2182
+ }
1429
2183
  //#endregion
1430
- export { X as ALIGN_MENU_PROVIDER_ID, F as COLORS, L as COLOR_OPTIONS, Y as COLOR_PICKER_PROVIDER_ID, I as FONT, K as ICONS, Yt as Modeler, Ue as NavigatedViewer, B as ROOT_ID, Mt as VcAlignMenuProvider, gt as VcAppend, T as VcBaseViewer, jt as VcColorPickerProvider, mt as VcConnect, it as VcConnectionTypeBehavior, Nt as VcContextPadProvider, Gt as VcCopyPasteBehavior, O as VcDiagramElementFactory, Vt as VcEditorActions, D as VcElementFactory, H as VcExporter, V as VcImporter, $ as VcKeyboardBindings, Ft as VcLabelEditingProvider, Ze as VcLayouter, qe as VcModeling, Ut as VcOrderingProvider, Ot as VcPaletteProvider, R as VcRenderer, qt as VcResizeBehavior, lt as VcRules, W as Viewer, j as chevronPath, N as chevronPathAt, P as ellipsePathAt, U as ioModule, b as isOrgUnit, y as isStep, x as isVcConnection, S as isVcElement, v as isVcShape, A as notchDepth, w as saveSVG, zt as vcAlignMenuModule, Dt as vcAppendModule, Rt as vcColorPickerModule, ht as vcConnectModule, Pt as vcContextPadModule, Kt as vcCopyPasteModule, z as vcDrawModule, Ht as vcKeyboardModule, Lt as vcLabelEditingModule, k as vcModelModule, ct as vcModelingModule, Wt as vcOrderingModule, kt as vcPaletteModule, Jt as vcResizeModule, pt as vcRulesModule };
2184
+ export { H as ALIGN_MENU_PROVIDER_ID, Hn as BLANK_DOCUMENT_NAME, A as COLORS, st as COLOR_OPTIONS, V as COLOR_PICKER_PROVIDER_ID, j as FONT, R as ICONS, Y as JSON_EXPORT_LABEL, Bn as Modeler, N as NavigatedViewer, In as READ_ONLY_CHANGED_EVENT, M as ROOT_ID, Vn as VALUE_CHAIN_NOTATION, _n as VcAlignMenuProvider, Xt as VcAppend, Ye as VcBaseViewer, pt as VcBounds, gn as VcColorPickerProvider, Jt as VcConnect, Rt as VcConnectionTypeBehavior, vn as VcContextPadProvider, Mn as VcCopyPasteBehavior, nt as VcDiagramElementFactory, On as VcEditorActions, Ze as VcElementFactory, vt as VcExporter, _t as VcImporter, En as VcKeyboardBindings, bn as VcLabelEditingProvider, jt as VcLayouter, Dt as VcModeling, An as VcOrderingProvider, fn as VcPaletteProvider, Rn as VcReadOnly, dt as VcRenderer, Pn as VcResizeBehavior, Ut as VcRules, Ct as Viewer, xt as blobToBase64, it as chevronPath, O as chevronPathAt, Un as createCollaborativeModeler, Wn as createCollaborativeViewer, ar as createShortcutsDialog, Xn as diagramMenu, nr as diagramShortcuts, k as ellipsePathAt, St as ioModule, w as isOrgUnit, C as isStep, T as isVcConnection, E as isVcElement, S as isVcShape, D as notchDepth, b as saveSVG, yt as svgToPng, wn as vcAlignMenuModule, cn as vcAppendModule, mt as vcBoundsModule, Cn as vcColorPickerModule, Yt as vcConnectModule, yn as vcContextPadModule, Nn as vcCopyPasteModule, ft as vcDrawModule, kn as vcKeyboardModule, Sn as vcLabelEditingModule, rt as vcModelModule, Ht as vcModelingModule, jn as vcOrderingModule, mn as vcPaletteModule, zn as vcReadOnlyModule, Fn as vcResizeModule, qt as vcRulesModule };
1431
2185
 
1432
2186
  //# sourceMappingURL=index.js.map