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