@miragon/team-topologies-renderer 0.13.2 → 0.14.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 (53) hide show
  1. package/README.md +127 -27
  2. package/dist/TtBaseViewer.d.ts +2 -1
  3. package/dist/TtBaseViewer.d.ts.map +1 -1
  4. package/dist/chrome/ShortcutsDialog.d.ts +13 -0
  5. package/dist/chrome/ShortcutsDialog.d.ts.map +1 -0
  6. package/dist/chrome/TitleDialog.d.ts +16 -0
  7. package/dist/chrome/TitleDialog.d.ts.map +1 -0
  8. package/dist/chrome/dialog.d.ts +40 -0
  9. package/dist/chrome/dialog.d.ts.map +1 -0
  10. package/dist/chrome/index.d.ts +10 -0
  11. package/dist/chrome/index.d.ts.map +1 -0
  12. package/dist/chrome/menu.d.ts +59 -0
  13. package/dist/chrome/menu.d.ts.map +1 -0
  14. package/dist/chrome/shortcuts.d.ts +41 -0
  15. package/dist/chrome/shortcuts.d.ts.map +1 -0
  16. package/dist/context-pad/TtContextPadPlacement.d.ts +31 -0
  17. package/dist/context-pad/TtContextPadPlacement.d.ts.map +1 -0
  18. package/dist/context-pad/TtContextPadProvider.d.ts +1 -0
  19. package/dist/context-pad/TtContextPadProvider.d.ts.map +1 -1
  20. package/dist/context-pad/index.d.ts +1 -1
  21. package/dist/context-pad/index.d.ts.map +1 -1
  22. package/dist/draw/TeamTopologiesRenderer.d.ts.map +1 -1
  23. package/dist/draw/colour.d.ts +22 -0
  24. package/dist/draw/colour.d.ts.map +1 -0
  25. package/dist/draw/label-layout.d.ts +3 -3
  26. package/dist/draw/label-layout.d.ts.map +1 -1
  27. package/dist/draw/palette-icons.d.ts.map +1 -1
  28. package/dist/index.d.ts +4 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1161 -577
  31. package/dist/index.js.map +1 -1
  32. package/dist/io/TtViewport.d.ts +8 -6
  33. package/dist/io/TtViewport.d.ts.map +1 -1
  34. package/dist/io/saveSvg.d.ts.map +1 -1
  35. package/dist/keyboard/TtKeyboard.d.ts.map +1 -1
  36. package/dist/keyboard/canvasFocus.d.ts +19 -0
  37. package/dist/keyboard/canvasFocus.d.ts.map +1 -0
  38. package/dist/label-editing/TtLabelEditing.d.ts.map +1 -1
  39. package/dist/legend/index.d.ts +3 -0
  40. package/dist/legend/index.d.ts.map +1 -0
  41. package/dist/legend/legendContent.d.ts +34 -0
  42. package/dist/legend/legendContent.d.ts.map +1 -0
  43. package/dist/palette/TtPaletteProvider.d.ts.map +1 -1
  44. package/dist/palette/TtPaletteTooltip.d.ts +19 -0
  45. package/dist/palette/TtPaletteTooltip.d.ts.map +1 -0
  46. package/dist/palette/index.d.ts +4 -1
  47. package/dist/palette/index.d.ts.map +1 -1
  48. package/dist/team-topologies.css +1 -1
  49. package/dist/theme/index.d.ts +1 -0
  50. package/dist/theme/index.d.ts.map +1 -1
  51. package/dist/theme/notation-fills.d.ts +4 -0
  52. package/dist/theme/notation-fills.d.ts.map +1 -0
  53. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -7,25 +7,75 @@ import { append as x, attr as S, create as C } from "tiny-svg";
7
7
  import ie from "diagram-js/lib/features/selection";
8
8
  import ae from "diagram-js/lib/navigation/zoomscroll";
9
9
  import oe from "diagram-js/lib/navigation/movecanvas";
10
- import w from "diagram-js/lib/features/lasso-tool";
11
- import se from "diagram-js/lib/features/modeling";
12
- import ce from "diagram-js/lib/features/move";
13
- import le from "diagram-js/lib/features/outline";
14
- import ue from "diagram-js/lib/features/resize";
15
- import de from "diagram-js/lib/layout/BaseLayouter";
16
- import fe from "diagram-js/lib/features/rules";
17
- import pe from "diagram-js/lib/features/rules/RuleProvider";
18
- import me from "diagram-js/lib/command/CommandInterceptor";
19
- import he from "diagram-js/lib/features/palette";
20
- import ge from "diagram-js/lib/features/create";
21
- import _e from "diagram-js/lib/features/connect";
22
- import ve from "diagram-js/lib/features/connection-preview";
23
- import ye from "diagram-js/lib/features/context-pad";
24
- import be from "diagram-js/lib/features/copy-paste";
25
- import xe from "diagram-js/lib/features/copy-paste/CopyPaste.js";
26
- import { MODELER_API_VERSION as Se } from "@miragon/modeler-api";
27
- //#region src/model/di-types.ts
28
- var Ce = /* @__PURE__ */ new Set([
10
+ import se from "diagram-js/lib/features/lasso-tool";
11
+ import ce from "diagram-js/lib/features/modeling";
12
+ import le from "diagram-js/lib/features/move";
13
+ import ue from "diagram-js/lib/features/outline";
14
+ import de from "diagram-js/lib/features/resize";
15
+ import fe from "diagram-js/lib/layout/BaseLayouter";
16
+ import pe from "diagram-js/lib/features/rules";
17
+ import me from "diagram-js/lib/features/rules/RuleProvider";
18
+ import he from "diagram-js/lib/command/CommandInterceptor";
19
+ import ge from "diagram-js/lib/features/palette";
20
+ import _e from "diagram-js/lib/features/create";
21
+ import ve from "diagram-js/lib/features/palette/PaletteTooltipComponent";
22
+ import { html as ye } from "diagram-js/lib/ui";
23
+ import be from "diagram-js/lib/features/connect";
24
+ import xe from "diagram-js/lib/features/connection-preview";
25
+ import Se from "diagram-js/lib/features/context-pad";
26
+ import Ce from "diagram-js/lib/features/copy-paste";
27
+ import we from "diagram-js/lib/features/copy-paste/CopyPaste.js";
28
+ import { MODELER_API_VERSION as Te } from "@miragon/modeler-api";
29
+ // src/theme/palette.ts
30
+ var w = {
31
+ blau: "#335DE5",
32
+ blauLink: "#2B50D4",
33
+ blauHell: "#6B8AFF",
34
+ gruen: "#00E676",
35
+ grau: "#F9F7F7",
36
+ schwarz: "#1D1D1D",
37
+ weiss: "#FFFFFF",
38
+ linie: "#E6E2E2",
39
+ kontur: "#8F8A8A",
40
+ textLeise: "#6B6666",
41
+ success: "#00E676",
42
+ successSoft: "#DAFBEB",
43
+ warning: "#FFB000",
44
+ warningSoft: "#FFF1D2",
45
+ danger: "#CD1839",
46
+ dangerSoft: "#FBEEF0",
47
+ info: "#335DE5",
48
+ infoSoft: "#EEF1FD",
49
+ successHell: "#00E676",
50
+ warningHell: "#FFB000",
51
+ dangerHell: "#FB6D73",
52
+ infoHell: "#6B8AFF",
53
+ gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
54
+ }, Ee = {
55
+ "--cd-blau": w.blau,
56
+ "--cd-gruen": w.gruen,
57
+ "--cd-grau": w.grau,
58
+ "--cd-schwarz": w.schwarz,
59
+ "--cd-weiss": w.weiss,
60
+ "--cd-blau-link": w.blauLink,
61
+ "--cd-blau-hell": w.blauHell,
62
+ "--cd-linie": w.linie,
63
+ "--cd-kontur": w.kontur,
64
+ "--cd-text-leise": w.textLeise,
65
+ "--cd-success": w.success,
66
+ "--cd-success-soft": w.successSoft,
67
+ "--cd-warning": w.warning,
68
+ "--cd-warning-soft": w.warningSoft,
69
+ "--cd-danger": w.danger,
70
+ "--cd-danger-soft": w.dangerSoft,
71
+ "--cd-info": w.info,
72
+ "--cd-info-soft": w.infoSoft,
73
+ "--cd-success-hell": w.successHell,
74
+ "--cd-warning-hell": w.warningHell,
75
+ "--cd-danger-hell": w.dangerHell,
76
+ "--cd-info-hell": w.infoHell,
77
+ "--cd-gradient-brand": w.gradientBrand
78
+ }, De = /* @__PURE__ */ new Set([
29
79
  "team",
30
80
  "interaction",
31
81
  "flow",
@@ -36,7 +86,7 @@ function T(e) {
36
86
  }
37
87
  function E(e) {
38
88
  let t = T(e);
39
- return t !== void 0 && Ce.has(t);
89
+ return t !== void 0 && De.has(t);
40
90
  }
41
91
  function D(e) {
42
92
  return T(e) === "team";
@@ -53,98 +103,241 @@ function A(e) {
53
103
  function j(e) {
54
104
  return T(e) === "association";
55
105
  }
56
- //#endregion
57
- //#region src/theme/palette.ts
58
- var M = {
59
- blau: "#335DE5",
60
- blauLink: "#2B50D4",
61
- blauHell: "#6B8AFF",
62
- gruen: "#00E676",
63
- grau: "#F9F7F7",
64
- schwarz: "#1D1D1D",
65
- weiss: "#FFFFFF",
66
- linie: "#E6E2E2",
67
- kontur: "#8F8A8A",
68
- textLeise: "#6B6666",
69
- success: "#00E676",
70
- successSoft: "#DAFBEB",
71
- warning: "#FFB000",
72
- warningSoft: "#FFF1D2",
73
- danger: "#CD1839",
74
- dangerSoft: "#FBEEF0",
75
- info: "#335DE5",
76
- infoSoft: "#EEF1FD",
77
- successHell: "#00E676",
78
- warningHell: "#FFB000",
79
- dangerHell: "#FB6D73",
80
- infoHell: "#6B8AFF",
81
- gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
82
- }, we = {
83
- "--cd-blau": M.blau,
84
- "--cd-gruen": M.gruen,
85
- "--cd-grau": M.grau,
86
- "--cd-schwarz": M.schwarz,
87
- "--cd-weiss": M.weiss,
88
- "--cd-blau-link": M.blauLink,
89
- "--cd-blau-hell": M.blauHell,
90
- "--cd-linie": M.linie,
91
- "--cd-kontur": M.kontur,
92
- "--cd-text-leise": M.textLeise,
93
- "--cd-success": M.success,
94
- "--cd-success-soft": M.successSoft,
95
- "--cd-warning": M.warning,
96
- "--cd-warning-soft": M.warningSoft,
97
- "--cd-danger": M.danger,
98
- "--cd-danger-soft": M.dangerSoft,
99
- "--cd-info": M.info,
100
- "--cd-info-soft": M.infoSoft,
101
- "--cd-success-hell": M.successHell,
102
- "--cd-warning-hell": M.warningHell,
103
- "--cd-danger-hell": M.dangerHell,
104
- "--cd-info-hell": M.infoHell,
105
- "--cd-gradient-brand": M.gradientBrand
106
- }, N = 40, P = "http://www.w3.org/2000/svg", Te = [
107
- ".djs-outline",
108
- ".djs-resizer",
109
- ".djs-selection-outline",
110
- ".djs-lasso-overlay",
111
- ".djs-dragger",
112
- ".djs-bendpoint",
113
- ".djs-segment-dragger"
114
- ].join(", "), Ee = ["selected", "hover"], De = [
106
+ // src/theme/notation-fills.ts
107
+ var Oe = {
108
+ collaboration: "#E3DFEF",
109
+ "x-as-a-service": "#DADADA",
110
+ facilitating: "#E4EFDF"
111
+ };
112
+ // src/draw/colour.ts
113
+ function M(e) {
114
+ if (typeof e != "string") return;
115
+ let t = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
116
+ if (!t) return;
117
+ let n = t[1].length === 3 ? [...t[1]].map((e) => e + e).join("") : t[1], r = (e) => parseInt(n.slice(e, e + 2), 16);
118
+ return [
119
+ r(0),
120
+ r(2),
121
+ r(4)
122
+ ];
123
+ }
124
+ function ke(e) {
125
+ return `#${e.map((e) => e.toString(16).padStart(2, "0")).join("")}`.toUpperCase();
126
+ }
127
+ function Ae(e, t, n) {
128
+ let r = (r) => Math.round(e[r] * n + t[r] * (1 - n));
129
+ return [
130
+ r(0),
131
+ r(1),
132
+ r(2)
133
+ ];
134
+ }
135
+ function je([e, t, n]) {
136
+ let r = (e) => {
137
+ let t = e / 255;
138
+ return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
139
+ };
140
+ return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
141
+ }
142
+ function Me(e, t) {
143
+ let [n, r] = [je(e), je(t)].sort((e, t) => t - e);
144
+ return (n + .05) / (r + .05);
145
+ }
146
+ function Ne(e, t) {
147
+ let n = M(e), r = M(w.weiss);
148
+ if (n && r) return ke(Ae(n, r, t));
149
+ }
150
+ function Pe(e) {
151
+ let t = d[e.mode] ?? d.collaboration;
152
+ if (e.fill === void 0) return {
153
+ fill: Oe[t.mode],
154
+ fillOpacity: 1
155
+ };
156
+ let n = Ne(e.fill, t.opacity);
157
+ return n ? {
158
+ fill: n,
159
+ fillOpacity: 1
160
+ } : {
161
+ fill: e.fill,
162
+ fillOpacity: t.opacity
163
+ };
164
+ }
165
+ // src/draw/styles.ts
166
+ var Fe = 1500, N = w.schwarz, Ie = w.textLeise, Le = w.kontur, P = {
167
+ family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
168
+ label: 13.5,
169
+ small: 11,
170
+ annotation: 12
171
+ }, Re = 10, F = {
172
+ left: 10,
173
+ right: 6,
174
+ top: 6,
175
+ bottom: 6
176
+ }, I = 1.2, ze = .58, Be = 4.5;
177
+ function Ve(e) {
178
+ let t = M(e), n = M(N), r = M(w.weiss);
179
+ if (!t || !n || !r) return N;
180
+ let i = Me(n, t);
181
+ return i >= Be ? N : Me(r, t) > i ? w.weiss : N;
182
+ }
183
+ function He(e) {
184
+ if (O(e)) return Ve(Pe(e).fill);
185
+ let t = p[e.teamType] ?? p["stream-aligned"];
186
+ return Ve(e.fill ?? t.fill);
187
+ }
188
+ function Ue(e, t) {
189
+ return Math.min(e * .16, t * 1.1);
190
+ }
191
+ function L(e) {
192
+ let t = Math.max(e.width, 1), n = Math.max(e.height, 1);
193
+ return A(e) ? {
194
+ box: {
195
+ x: F.left,
196
+ y: F.top,
197
+ width: Math.max(t - F.left - F.right, 1),
198
+ height: Math.max(n - F.top - F.bottom, 1)
199
+ },
200
+ align: "left-top",
201
+ fontSize: P.annotation,
202
+ fontWeight: "400",
203
+ fill: N
204
+ } : k(e) ? {
205
+ box: {
206
+ x: Re,
207
+ y: 0,
208
+ width: t - Ue(t, n) - 20,
209
+ height: n
210
+ },
211
+ align: "center",
212
+ fontSize: P.small,
213
+ fontWeight: "600",
214
+ letterSpacing: "0.06em",
215
+ fill: Ie
216
+ } : {
217
+ box: {
218
+ x: Re,
219
+ y: 0,
220
+ width: t - 20,
221
+ height: n
222
+ },
223
+ align: "center",
224
+ fontSize: O(e) ? P.small : P.label,
225
+ fontWeight: "600",
226
+ fill: He(e)
227
+ };
228
+ }
229
+ function We(e, t, n) {
230
+ let r = Math.max(4, Math.floor(t / (n * ze))), i = e.split(/\r?\n/), a = [];
231
+ for (let e of i) {
232
+ let t = e.split(/\s+/).filter(Boolean), n = "";
233
+ for (let e of t) {
234
+ let t = n ? `${n} ${e}` : e;
235
+ t.length > r && n ? (a.push(n), n = e) : n = t;
236
+ }
237
+ a.push(n);
238
+ }
239
+ for (; a.length > 0 && a[a.length - 1] === "";) a.pop();
240
+ for (; a.length > 0 && a[0] === "";) a.shift();
241
+ return a;
242
+ }
243
+ function Ge(e) {
244
+ let t = L(e), { box: n, fontSize: r } = t, i = We(e.ttLabel ?? "", n.width, r);
245
+ if (i.length === 0) return;
246
+ let a = Math.max(...i.map((e) => e.length)) * r * ze, o = i.length * r * I;
247
+ return t.align === "left-top" ? {
248
+ x: n.x,
249
+ y: n.y,
250
+ width: a,
251
+ height: o
252
+ } : {
253
+ x: n.x + (n.width - a) / 2,
254
+ y: n.y + (n.height - o) / 2,
255
+ width: a,
256
+ height: o
257
+ };
258
+ }
259
+ // src/io/TtViewport.ts
260
+ var Ke = 760, qe = 88, Je = 120, R = 56, Ye = 24, Xe = 1;
261
+ function Ze(e) {
262
+ let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity, a = (e, a, o, s) => {
263
+ t = Math.min(t, e), n = Math.min(n, a), r = Math.max(r, e + o), i = Math.max(i, a + s);
264
+ };
265
+ for (let t of e.getAll()) {
266
+ let e = t;
267
+ if (typeof e.x != "number" || typeof e.y != "number" || typeof e.width != "number" || typeof e.height != "number") continue;
268
+ a(e.x, e.y, e.width, e.height);
269
+ let n = E(t) ? Ge(t) : void 0;
270
+ n && a(e.x + n.x, e.y + n.y, n.width, n.height);
271
+ }
272
+ return Number.isFinite(t) ? {
273
+ minX: t,
274
+ minY: n,
275
+ maxX: r,
276
+ maxY: i
277
+ } : void 0;
278
+ }
279
+ var Qe = class {
280
+ canvas;
281
+ elementRegistry;
282
+ static $inject = ["canvas", "elementRegistry"];
283
+ constructor(e, t) {
284
+ this.canvas = e, this.elementRegistry = t;
285
+ }
286
+ fit() {
287
+ let e = this.contentBounds();
288
+ if (!e) return;
289
+ let t = this.canvas.getContainer().getBoundingClientRect(), n = t.width, r = t.height;
290
+ if (!n || !r) {
291
+ this.canvas.zoom("fit-viewport");
292
+ return;
293
+ }
294
+ let i = n <= Ke, a = i ? Je : qe, o = i ? Ye : R, s = Math.max(e.maxX - e.minX, 1), c = Math.max(e.maxY - e.minY, 1), l = Math.min((n - 2 * o) / s, (r - a - R) / c, Xe);
295
+ l > 0 ? this.canvas.viewbox({
296
+ x: e.minX + s / 2 - n / 2 / l,
297
+ y: this.viewboxTop(e, c, l, r, a, i),
298
+ width: n / l,
299
+ height: r / l
300
+ }) : this.canvas.zoom("fit-viewport");
301
+ }
302
+ viewboxTop(e, t, n, r, i, a) {
303
+ if (!a) return e.minY - i / n;
304
+ let o = r - i - R, s = Math.max(0, o - t * n);
305
+ return e.minY - (i + s / 2) / n;
306
+ }
307
+ contentBounds() {
308
+ return Ze(this.elementRegistry);
309
+ }
310
+ }, z = 40, $e = {
311
+ minX: 0,
312
+ minY: 0,
313
+ maxX: 100,
314
+ maxY: 100
315
+ }, et = "http://www.w3.org/2000/svg", tt = ".djs-outline, .djs-resizer, .djs-selection-outline, .djs-lasso-overlay, .djs-dragger, .djs-bendpoint, .djs-segment-dragger", nt = ["selected", "hover"], rt = [
115
316
  "class",
116
317
  "tabindex",
117
318
  "role",
118
319
  "aria-roledescription",
119
320
  "aria-label"
120
321
  ];
121
- function Oe(e, t) {
322
+ function it(e, t) {
122
323
  let n = e.getContainer().querySelector(":scope > svg");
123
324
  if (!n) throw Error("No SVG found in the canvas container.");
124
- let r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
125
- for (let e of t.getAll()) {
126
- if (!E(e)) continue;
127
- let t = e;
128
- r = Math.min(r, t.x), i = Math.min(i, t.y), a = Math.max(a, t.x + t.width), o = Math.max(o, t.y + t.height);
129
- }
130
- Number.isFinite(r) || (r = 0, i = 0, a = 100, o = 100);
131
- let s = r - N, c = i - N, l = a - r + 80, u = o - i + 80, d = n.cloneNode(!0);
132
- for (let e of De) d.removeAttribute(e);
133
- for (let e of d.querySelectorAll(Te)) e.remove();
134
- for (let e of d.querySelectorAll(Ee.map((e) => `.${e}`).join())) e.classList.remove(...Ee);
135
- d.setAttribute("xmlns", P), d.setAttribute("viewBox", `${s} ${c} ${l} ${u}`), d.setAttribute("width", String(Math.round(l))), d.setAttribute("height", String(Math.round(u)));
136
- let f = d.querySelector(".viewport");
137
- f && f.removeAttribute("transform");
138
- let p = d.ownerDocument.createElementNS(P, "rect");
139
- return p.setAttribute("class", "tt-export-paper"), p.setAttribute("x", String(s)), p.setAttribute("y", String(c)), p.setAttribute("width", String(l)), p.setAttribute("height", String(u)), p.setAttribute("fill", M.weiss), d.insertBefore(p, d.firstChild), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(d) };
140
- }
141
- //#endregion
142
- //#region src/io/types.ts
143
- var F = a, I = "tt-canvas-keyboard-focus";
144
- function ke(e) {
325
+ let r = Ze(t) ?? $e, i = Math.floor(r.minX - z), a = Math.floor(r.minY - z), o = Math.ceil(r.maxX + z) - i, s = Math.ceil(r.maxY + z) - a, c = n.cloneNode(!0);
326
+ for (let e of rt) c.removeAttribute(e);
327
+ for (let e of c.querySelectorAll(tt)) e.remove();
328
+ for (let e of c.querySelectorAll(nt.map((e) => `.${e}`).join())) e.classList.remove(...nt);
329
+ c.setAttribute("xmlns", et), c.setAttribute("viewBox", `${i} ${a} ${o} ${s}`), c.setAttribute("width", String(o)), c.setAttribute("height", String(s));
330
+ let l = c.querySelector(".viewport");
331
+ l && l.removeAttribute("transform");
332
+ let u = c.ownerDocument.createElementNS(et, "rect");
333
+ return u.setAttribute("class", "tt-export-paper"), u.setAttribute("x", String(i)), u.setAttribute("y", String(a)), u.setAttribute("width", String(o)), u.setAttribute("height", String(s)), u.setAttribute("fill", w.weiss), c.insertBefore(u, c.firstChild), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(c) };
334
+ }
335
+ // src/io/types.ts
336
+ var B = a, V = "tt-canvas-keyboard-focus";
337
+ function at(e) {
145
338
  return typeof e == "number" ? `${e}px` : e;
146
339
  }
147
- var Ae = class {
340
+ var ot = class {
148
341
  _diagram;
149
342
  _container;
150
343
  _options;
@@ -153,7 +346,7 @@ var Ae = class {
153
346
  }
154
347
  _createContainer(e) {
155
348
  let t = e.container ?? document.createElement("div");
156
- return t.classList.add("tt-djs-container"), t.style.width = ke(e.width ?? "100%"), t.style.height = ke(e.height ?? (e.container ? "100%" : "600px")), t;
349
+ return t.classList.add("tt-djs-container"), t.style.width = at(e.width ?? "100%"), t.style.height = at(e.height ?? (e.container ? "100%" : "600px")), t;
157
350
  }
158
351
  _ensureDiagram() {
159
352
  if (!this._diagram) {
@@ -165,7 +358,8 @@ var Ae = class {
165
358
  ttPalette: {
166
359
  freeArea: this._options.freeArea,
167
360
  freeRectCenter: this._options.freeRectCenter
168
- }
361
+ },
362
+ ttContextPad: { freeArea: this._options.freeArea }
169
363
  }), this._describeCanvas(this._diagram);
170
364
  }
171
365
  return this._diagram;
@@ -177,9 +371,9 @@ var Ae = class {
177
371
  let r = t.ownerDocument, i = !1, a = (e) => {
178
372
  i = e.key === "Tab";
179
373
  }, o = () => {
180
- i = !1, n.classList.remove(I);
374
+ i = !1, n.classList.remove(V);
181
375
  };
182
- r.addEventListener("keydown", a, !0), r.addEventListener("pointerdown", o, !0), n.addEventListener("focusin", () => n.classList.toggle(I, i)), n.addEventListener("focusout", () => n.classList.remove(I)), e.get("eventBus").on("diagram.destroy", () => {
376
+ r.addEventListener("keydown", a, !0), r.addEventListener("pointerdown", o, !0), n.addEventListener("focusin", () => n.classList.toggle(V, i)), n.addEventListener("focusout", () => n.classList.remove(V)), e.get("eventBus").on("diagram.destroy", () => {
183
377
  r.removeEventListener("keydown", a, !0), r.removeEventListener("pointerdown", o, !0);
184
378
  });
185
379
  }
@@ -226,7 +420,7 @@ var Ae = class {
226
420
  } catch {
227
421
  return;
228
422
  }
229
- if (!n || n.id !== F) return;
423
+ if (!n || n.id !== B) return;
230
424
  let r = n.businessObject ?? { title: "Untitled team topology" };
231
425
  n.businessObject = {
232
426
  ...r,
@@ -241,7 +435,7 @@ var Ae = class {
241
435
  }
242
436
  }
243
437
  saveSVG() {
244
- return Oe(this.get("canvas"), this.get("elementRegistry"));
438
+ return it(this.get("canvas"), this.get("elementRegistry"));
245
439
  }
246
440
  attachTo(e) {
247
441
  e.appendChild(this._container), this.get("canvas").resized();
@@ -258,7 +452,7 @@ var Ae = class {
258
452
  get container() {
259
453
  return this._container;
260
454
  }
261
- }, je = class {
455
+ }, st = class {
262
456
  elementFactory;
263
457
  static $inject = ["elementFactory"];
264
458
  constructor(e) {
@@ -377,138 +571,10 @@ var Ae = class {
377
571
  ttKind: "association"
378
572
  });
379
573
  }
380
- }, Me = { ttElementFactory: ["type", je] }, Ne = 1500, L = M.schwarz, Pe = M.textLeise, Fe = M.kontur, R = {
381
- family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
382
- label: 13.5,
383
- small: 11,
384
- annotation: 12
385
- }, Ie = 10, z = {
386
- left: 10,
387
- right: 6,
388
- top: 6,
389
- bottom: 6
390
- }, B = 1.2, Le = .58, Re = 4.5;
391
- function V(e) {
392
- if (typeof e != "string") return;
393
- let t = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
394
- if (!t) return;
395
- let n = t[1].length === 3 ? [...t[1]].map((e) => e + e).join("") : t[1], r = (e) => parseInt(n.slice(e, e + 2), 16);
396
- return [
397
- r(0),
398
- r(2),
399
- r(4)
400
- ];
401
- }
402
- function ze(e, t, n) {
403
- let r = (r) => Math.round(e[r] * n + t[r] * (1 - n));
404
- return [
405
- r(0),
406
- r(1),
407
- r(2)
408
- ];
409
- }
410
- function Be([e, t, n]) {
411
- let r = (e) => {
412
- let t = e / 255;
413
- return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
414
- };
415
- return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
416
- }
417
- function Ve(e, t) {
418
- let [n, r] = [Be(e), Be(t)].sort((e, t) => t - e);
419
- return (n + .05) / (r + .05);
420
- }
421
- function He(e, t = 1) {
422
- let n = V(e), r = V(L), i = V(M.weiss);
423
- if (!n || !r || !i) return L;
424
- let a = ze(n, i, t), o = Ve(r, a);
425
- return o >= Re ? L : Ve(i, a) > o ? M.weiss : L;
426
- }
427
- function Ue(e) {
428
- if (O(e)) {
429
- let t = d[e.mode] ?? d.collaboration;
430
- return He(e.fill ?? t.fill, t.opacity);
431
- }
432
- let t = p[e.teamType] ?? p["stream-aligned"];
433
- return He(e.fill ?? t.fill);
434
- }
435
- function We(e, t) {
436
- return Math.min(e * .16, t * 1.1);
437
- }
438
- function H(e) {
439
- let t = Math.max(e.width, 1), n = Math.max(e.height, 1);
440
- return A(e) ? {
441
- box: {
442
- x: z.left,
443
- y: z.top,
444
- width: Math.max(t - z.left - z.right, 1),
445
- height: Math.max(n - z.top - z.bottom, 1)
446
- },
447
- align: "left-top",
448
- fontSize: R.annotation,
449
- fontWeight: "400",
450
- fill: L
451
- } : k(e) ? {
452
- box: {
453
- x: Ie,
454
- y: 0,
455
- width: t - We(t, n) - 20,
456
- height: n
457
- },
458
- align: "center",
459
- fontSize: R.small,
460
- fontWeight: "600",
461
- letterSpacing: "0.06em",
462
- fill: Pe
463
- } : {
464
- box: {
465
- x: Ie,
466
- y: 0,
467
- width: t - 20,
468
- height: n
469
- },
470
- align: "center",
471
- fontSize: O(e) ? R.small : R.label,
472
- fontWeight: "600",
473
- fill: Ue(e)
474
- };
475
- }
476
- function Ge(e, t, n) {
477
- let r = Math.max(4, Math.floor(t / (n * Le))), i = e.split(/\r?\n/), a = [];
478
- for (let e of i) {
479
- let t = e.split(/\s+/).filter(Boolean), n = "";
480
- for (let e of t) {
481
- let t = n ? `${n} ${e}` : e;
482
- t.length > r && n ? (a.push(n), n = e) : n = t;
483
- }
484
- a.push(n);
485
- }
486
- for (; a.length > 0 && a[a.length - 1] === "";) a.pop();
487
- for (; a.length > 0 && a[0] === "";) a.shift();
488
- return a;
489
- }
490
- function Ke(e) {
491
- let t = H(e), { box: n, fontSize: r } = t, i = Ge(e.ttLabel ?? "", n.width, r);
492
- if (i.length === 0) return;
493
- let a = Math.max(...i.map((e) => e.length)) * r * Le, o = i.length * r * B;
494
- return t.align === "left-top" ? {
495
- x: n.x,
496
- y: n.y,
497
- width: a,
498
- height: o
499
- } : {
500
- x: n.x + (n.width - a) / 2,
501
- y: n.y + (n.height - o) / 2,
502
- width: a,
503
- height: o
504
- };
505
- }
506
- //#endregion
507
- //#region src/draw/TeamTopologiesRenderer.ts
508
- var qe = class extends re {
574
+ }, ct = { ttElementFactory: ["type", st] }, lt = class extends re {
509
575
  static $inject = ["eventBus"];
510
576
  constructor(e) {
511
- super(e, Ne);
577
+ super(e, Fe);
512
578
  }
513
579
  canRender(e) {
514
580
  return E(e) || j(e);
@@ -521,15 +587,15 @@ var qe = class extends re {
521
587
  let n = S(C("rect"), {
522
588
  width: t.width,
523
589
  height: t.height,
524
- fill: M.linie
590
+ fill: w.linie
525
591
  });
526
592
  return x(e, n), n;
527
593
  }
528
594
  drawConnection(e, t) {
529
595
  let n = S(C("path"), {
530
- d: Ye(t.waypoints),
596
+ d: dt(t.waypoints),
531
597
  fill: "none",
532
- stroke: Fe,
598
+ stroke: Le,
533
599
  "stroke-width": 1.5,
534
600
  "stroke-dasharray": "4 4",
535
601
  "stroke-linecap": "round"
@@ -541,7 +607,7 @@ var qe = class extends re {
541
607
  return `M${t},${n}l${r},0l0,${i}l${-r},0z`;
542
608
  }
543
609
  getConnectionPath(e) {
544
- return Ye(e.waypoints);
610
+ return dt(e.waypoints);
545
611
  }
546
612
  drawTeam(e, t) {
547
613
  let n = p[t.teamType] ?? p["stream-aligned"], r = Math.max(t.width, 1), i = Math.max(t.height, 1), a = n.strokeWidth, o = h(n.strokeStyle, a), s = this.teamOutline(n.shape, r, i, a, {
@@ -551,14 +617,14 @@ var qe = class extends re {
551
617
  ...o ? { "stroke-dasharray": o } : {},
552
618
  "stroke-linejoin": "round"
553
619
  });
554
- return x(e, s), this.appendLabel(e, t.ttLabel ?? "", H(t)), s;
620
+ return x(e, s), this.appendLabel(e, t.ttLabel ?? "", L(t)), s;
555
621
  }
556
622
  teamOutline(e, t, n, r, i) {
557
623
  let a = r / 2, o = t - r, s = n - r;
558
624
  if (e === "octagon") {
559
625
  let e = Math.min(o, s) * .29;
560
626
  return S(C("polygon"), {
561
- points: Je(a, o, s, e),
627
+ points: ut(a, o, s, e),
562
628
  ...i
563
629
  });
564
630
  }
@@ -574,38 +640,38 @@ var qe = class extends re {
574
640
  });
575
641
  }
576
642
  drawInteraction(e, t) {
577
- let n = d[t.mode] ?? d.collaboration, r = Math.max(t.width, 1), i = Math.max(t.height, 1), a = {
578
- fill: t.fill ?? n.fill,
579
- "fill-opacity": n.opacity,
643
+ let n = d[t.mode] ?? d.collaboration, r = Math.max(t.width, 1), i = Math.max(t.height, 1), a = Pe(t), o = {
644
+ fill: a.fill,
645
+ ...a.fillOpacity < 1 ? { "fill-opacity": a.fillOpacity } : {},
580
646
  stroke: t.stroke ?? n.stroke,
581
647
  "stroke-width": 2,
582
648
  "stroke-dasharray": h(n.strokeStyle, 2) || "6 4",
583
649
  "stroke-linejoin": "round"
584
- }, o;
585
- if (n.shape === "circle") o = S(C("ellipse"), {
650
+ }, s;
651
+ if (n.shape === "circle") s = S(C("ellipse"), {
586
652
  cx: r / 2,
587
653
  cy: i / 2,
588
654
  rx: (r - 2) / 2,
589
655
  ry: (i - 2) / 2,
590
- ...a
656
+ ...o
591
657
  });
592
658
  else if (n.shape === "triangle") {
593
659
  let e = `${r / 2},1 ${r - 1},${i - 1} 1,${i - 1}`;
594
- o = S(C("polygon"), {
660
+ s = S(C("polygon"), {
595
661
  points: e,
596
- ...a
662
+ ...o
597
663
  });
598
664
  } else {
599
665
  let e = Math.min(r * .26, i * .85), t = `${1 + e},1 ${r - 1},1 ${r - 1 - e},${i - 1} 1,${i - 1}`;
600
- o = S(C("polygon"), {
666
+ s = S(C("polygon"), {
601
667
  points: t,
602
- ...a
668
+ ...o
603
669
  });
604
670
  }
605
- return x(e, o), this.appendLabel(e, t.ttLabel ?? "", H(t)), o;
671
+ return x(e, s), this.appendLabel(e, t.ttLabel ?? "", L(t)), s;
606
672
  }
607
673
  drawFlow(e, t) {
608
- let n = Math.max(t.width, 1), r = Math.max(t.height, 1), i = l.strokeWidth, a = i / 2, o = We(n, r), s = r * .5, c = (r - s) / 2, u = c + s, d = [
674
+ let n = Math.max(t.width, 1), r = Math.max(t.height, 1), i = l.strokeWidth, a = i / 2, o = Ue(n, r), s = r * .5, c = (r - s) / 2, u = c + s, d = [
609
675
  [a, c],
610
676
  [n - o, c],
611
677
  [n - o, a],
@@ -621,26 +687,26 @@ var qe = class extends re {
621
687
  "stroke-dasharray": h(l.strokeStyle, i) || "6 4",
622
688
  "stroke-linejoin": "round"
623
689
  });
624
- return x(e, f), this.appendLabel(e, t.ttLabel ?? "", H(t)), f;
690
+ return x(e, f), this.appendLabel(e, t.ttLabel ?? "", L(t)), f;
625
691
  }
626
692
  drawAnnotation(e, t) {
627
693
  let n = Math.max(t.width, 1), r = Math.max(t.height, 1), i = 1.5, a = i / 2, o = Math.min(14, n / 2), s = S(C("path"), {
628
694
  d: `M${o},${a} L${a},${a} L${a},${r - a} L${o},${r - a}`,
629
695
  fill: "none",
630
- stroke: Fe,
696
+ stroke: Le,
631
697
  "stroke-width": i,
632
698
  "stroke-linejoin": "round"
633
699
  });
634
- return x(e, s), this.appendLabel(e, t.ttLabel ?? "", H(t)), s;
700
+ return x(e, s), this.appendLabel(e, t.ttLabel ?? "", L(t)), s;
635
701
  }
636
702
  appendLabel(e, t, n) {
637
- let { box: r, fontSize: i } = n, a = Ge(t, r.width, i), o = i * B, s = n.align === "center", c = s ? r.x + r.width / 2 : r.x, l = s ? r.y + r.height / 2 - (a.length - 1) * o / 2 : r.y + o / 2;
703
+ let { box: r, fontSize: i } = n, a = We(t, r.width, i), o = i * I, s = n.align === "center", c = s ? r.x + r.width / 2 : r.x, l = s ? r.y + r.height / 2 - (a.length - 1) * o / 2 : r.y + o / 2;
638
704
  a.forEach((t, r) => {
639
705
  if (!t) return;
640
706
  let a = S(C("text"), {
641
707
  x: c,
642
708
  y: l + r * o,
643
- "font-family": R.family,
709
+ "font-family": P.family,
644
710
  "font-size": i,
645
711
  fill: n.fill,
646
712
  "text-anchor": s ? "middle" : "start",
@@ -652,7 +718,7 @@ var qe = class extends re {
652
718
  });
653
719
  }
654
720
  };
655
- function Je(e, t, n, r) {
721
+ function ut(e, t, n, r) {
656
722
  return [
657
723
  [e + r, e],
658
724
  [e + t - r, e],
@@ -664,16 +730,15 @@ function Je(e, t, n, r) {
664
730
  [e, e + r]
665
731
  ].map((e) => e.join(",")).join(" ");
666
732
  }
667
- function Ye(e) {
733
+ function dt(e) {
668
734
  return e.map((e, t) => `${t === 0 ? "M" : "L"}${e.x},${e.y}`).join(" ");
669
735
  }
670
- //#endregion
671
- //#region src/draw/index.ts
672
- var Xe = {
736
+ // src/draw/index.ts
737
+ var ft = {
673
738
  __init__: ["ttRenderer"],
674
- ttRenderer: ["type", qe],
739
+ ttRenderer: ["type", lt],
675
740
  connectionDocking: ["type", ne]
676
- }, Ze = class {
741
+ }, pt = class {
677
742
  canvas;
678
743
  elementFactory;
679
744
  factory;
@@ -701,7 +766,7 @@ var Xe = {
701
766
  n = void 0;
702
767
  }
703
768
  let r;
704
- n && n.id === F ? r = n : (r = this.elementFactory.createRoot({ id: F }), this.canvas.setRootElement(r));
769
+ n && n.id === B ? r = n : (r = this.elementFactory.createRoot({ id: B }), this.canvas.setRootElement(r));
705
770
  let i = _(e, o);
706
771
  r.businessObject = {
707
772
  title: e.title,
@@ -733,7 +798,7 @@ var Xe = {
733
798
  this.canvas.removeShape(e.id);
734
799
  } catch {}
735
800
  }
736
- }, Qe = class {
801
+ }, mt = class {
737
802
  elementRegistry;
738
803
  canvas;
739
804
  static $inject = ["elementRegistry", "canvas"];
@@ -749,7 +814,7 @@ var Xe = {
749
814
  }
750
815
  let t = [], n = [], i = [], a = [];
751
816
  for (let e of this.elementRegistry.getAll()) {
752
- if (e.id === F) continue;
817
+ if (e.id === B) continue;
753
818
  let o = e, s = {
754
819
  x: o.x,
755
820
  y: o.y
@@ -783,7 +848,7 @@ var Xe = {
783
848
  ...e.ttLabel ? { label: e.ttLabel } : {}
784
849
  }, e.ttForeign, c));
785
850
  else if (A(e)) {
786
- let t = $e(e);
851
+ let t = ht(e);
787
852
  a.push(y({
788
853
  id: e.id,
789
854
  text: e.ttLabel ?? "",
@@ -803,86 +868,38 @@ var Xe = {
803
868
  }, e?.foreign, o);
804
869
  }
805
870
  };
806
- function $e(e) {
871
+ function ht(e) {
807
872
  let t = [...e.outgoing, ...e.incoming].find(j);
808
873
  if (t) return (t.source === e ? t.target : t.source)?.id;
809
874
  }
810
- //#endregion
811
- //#region src/io/TtViewport.ts
812
- var et = 760, tt = 88, nt = 120, U = 56, rt = 24, it = 1, at = class {
813
- canvas;
814
- elementRegistry;
815
- static $inject = ["canvas", "elementRegistry"];
816
- constructor(e, t) {
817
- this.canvas = e, this.elementRegistry = t;
818
- }
819
- fit() {
820
- let e = this.contentBounds();
821
- if (!e) return;
822
- let t = this.canvas.getContainer().getBoundingClientRect(), n = t.width, r = t.height;
823
- if (!n || !r) {
824
- this.canvas.zoom("fit-viewport");
825
- return;
826
- }
827
- let i = n <= et, a = i ? nt : tt, o = i ? rt : U, s = Math.max(e.maxX - e.minX, 1), c = Math.max(e.maxY - e.minY, 1), l = Math.min((n - 2 * o) / s, (r - a - U) / c, it);
828
- l > 0 ? this.canvas.viewbox({
829
- x: e.minX + s / 2 - n / 2 / l,
830
- y: this.viewboxTop(e, c, l, r, a, i),
831
- width: n / l,
832
- height: r / l
833
- }) : this.canvas.zoom("fit-viewport");
834
- }
835
- viewboxTop(e, t, n, r, i, a) {
836
- if (!a) return e.minY - i / n;
837
- let o = r - i - U, s = Math.max(0, o - t * n);
838
- return e.minY - (i + s / 2) / n;
839
- }
840
- contentBounds() {
841
- let e = Infinity, t = Infinity, n = -Infinity, r = -Infinity, i = (i, a, o, s) => {
842
- e = Math.min(e, i), t = Math.min(t, a), n = Math.max(n, i + o), r = Math.max(r, a + s);
843
- };
844
- for (let e of this.elementRegistry.getAll()) {
845
- let t = e;
846
- if (typeof t.x != "number" || typeof t.y != "number" || typeof t.width != "number" || typeof t.height != "number") continue;
847
- i(t.x, t.y, t.width, t.height);
848
- let n = E(e) ? Ke(e) : void 0;
849
- n && i(t.x + n.x, t.y + n.y, n.width, n.height);
850
- }
851
- return Number.isFinite(e) ? {
852
- minX: e,
853
- minY: t,
854
- maxX: n,
855
- maxY: r
856
- } : void 0;
857
- }
858
- }, W = "http://www.w3.org/2000/svg", G = {
875
+ // src/io/fontEmbedding.ts
876
+ var H = "http://www.w3.org/2000/svg", U = {
859
877
  latin: "U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD",
860
878
  latinExt: "U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF"
861
879
  };
862
- function ot(e) {
863
- return Object.keys(G).map((t) => `@font-face{font-family:'Geist Variable';font-style:normal;font-weight:100 900;font-display:block;src:url(${e[t].replace(/^data:[^;,]*/, "data:font/woff2")}) format('woff2');unicode-range:${G[t]};}`).join("");
880
+ function gt(e) {
881
+ return Object.keys(U).map((t) => `@font-face{font-family:'Geist Variable';font-style:normal;font-weight:100 900;font-display:block;src:url(${e[t].replace(/^data:[^;,]*/, "data:font/woff2")}) format('woff2');unicode-range:${U[t]};}`).join("");
864
882
  }
865
- function st(e, t) {
883
+ function _t(e, t) {
866
884
  let n = new DOMParser().parseFromString(e, "image/svg+xml"), r = n.documentElement;
867
- if (r.namespaceURI !== W || n.querySelector("parsererror")) return e;
868
- let i = n.createElementNS(W, "defs"), a = n.createElementNS(W, "style");
885
+ if (r.namespaceURI !== H || n.querySelector("parsererror")) return e;
886
+ let i = n.createElementNS(H, "defs"), a = n.createElementNS(H, "style");
869
887
  return a.textContent = t, i.appendChild(a), r.insertBefore(i, r.firstChild), new XMLSerializer().serializeToString(n);
870
888
  }
871
- //#endregion
872
- //#region src/io/index.ts
873
- var ct = {
874
- ttImporter: ["type", Ze],
875
- ttExporter: ["type", Qe],
876
- ttViewport: ["type", at]
877
- }, lt = class extends Ae {
889
+ // src/io/index.ts
890
+ var vt = {
891
+ ttImporter: ["type", pt],
892
+ ttExporter: ["type", mt],
893
+ ttViewport: ["type", Qe]
894
+ }, yt = class extends ot {
878
895
  _getModules() {
879
896
  return [
880
- Me,
881
- Xe,
882
- ct
897
+ ct,
898
+ ft,
899
+ vt
883
900
  ];
884
901
  }
885
- }, K = class extends lt {
902
+ }, W = class extends yt {
886
903
  _getModules() {
887
904
  return [
888
905
  ...super._getModules(),
@@ -892,30 +909,29 @@ var ct = {
892
909
  ];
893
910
  }
894
911
  };
895
- //#endregion
896
- //#region src/modeling/cmd/UpdatePropertiesHandler.ts
897
- function ut(e, t, n) {
912
+ // src/modeling/cmd/UpdatePropertiesHandler.ts
913
+ function bt(e, t, n) {
898
914
  n === void 0 ? delete e[t] : e[t] = n;
899
915
  }
900
- var dt = class {
916
+ var xt = class {
901
917
  execute(e) {
902
918
  let { element: t, properties: n } = e, r = t, i = {};
903
- for (let e of Object.keys(n)) i[e] = r[e], ut(r, e, n[e]);
919
+ for (let e of Object.keys(n)) i[e] = r[e], bt(r, e, n[e]);
904
920
  return e.oldProperties = i, [t];
905
921
  }
906
922
  revert(e) {
907
923
  let { element: t, oldProperties: n } = e, r = t;
908
- if (n) for (let e of Object.keys(n)) ut(r, e, n[e]);
924
+ if (n) for (let e of Object.keys(n)) bt(r, e, n[e]);
909
925
  return [t];
910
926
  }
911
- }, q = "Untitled team topology", ft = class {
927
+ }, G = "Untitled team topology", St = class {
912
928
  canvas;
913
929
  static $inject = ["canvas"];
914
930
  constructor(e) {
915
931
  this.canvas = e;
916
932
  }
917
933
  execute(e) {
918
- let t = this.canvas.getRootElement(), n = t.businessObject ?? { title: q };
934
+ let t = this.canvas.getRootElement(), n = t.businessObject ?? { title: G };
919
935
  return e.oldTitle = n.title, t.businessObject = {
920
936
  ...n,
921
937
  title: e.title
@@ -924,11 +940,11 @@ var dt = class {
924
940
  revert(e) {
925
941
  let t = this.canvas.getRootElement();
926
942
  return t.businessObject = {
927
- ...t.businessObject ?? { title: q },
928
- title: e.oldTitle ?? q
943
+ ...t.businessObject ?? { title: G },
944
+ title: e.oldTitle ?? G
929
945
  }, [t];
930
946
  }
931
- }, pt = "element.updateProperties", mt = "tt.title.update", ht = 40, gt = class {
947
+ }, Ct = "element.updateProperties", wt = "tt.title.update", Tt = 40, Et = class {
932
948
  commandStack;
933
949
  modeling;
934
950
  factory;
@@ -940,13 +956,13 @@ var dt = class {
940
956
  "canvas"
941
957
  ];
942
958
  constructor(e, t, n, r) {
943
- this.commandStack = e, this.modeling = t, this.factory = n, this.canvas = r, e.registerHandler(pt, dt), e.registerHandler(mt, ft);
959
+ this.commandStack = e, this.modeling = t, this.factory = n, this.canvas = r, e.registerHandler(Ct, xt), e.registerHandler(wt, St);
944
960
  }
945
961
  setTitle(e) {
946
- this.commandStack.execute(mt, { title: e });
962
+ this.commandStack.execute(wt, { title: e });
947
963
  }
948
964
  updateProperties(e, t) {
949
- this.commandStack.execute(pt, {
965
+ this.commandStack.execute(Ct, {
950
966
  element: e,
951
967
  properties: t
952
968
  });
@@ -971,8 +987,8 @@ var dt = class {
971
987
  }
972
988
  appendAnnotation(e) {
973
989
  let t = this.factory.createNewAnnotation(), n = {
974
- x: e.x + e.width + ht + t.width / 2,
975
- y: e.y - ht / 4
990
+ x: e.x + e.width + Tt + t.width / 2,
991
+ y: e.y - Tt / 4
976
992
  };
977
993
  return this.modeling.appendShape(e, t, n, this.canvas.getRootElement(), {
978
994
  connection: this.factory.createNewAssociation(),
@@ -983,42 +999,41 @@ var dt = class {
983
999
  let t = [...e.incoming, ...e.outgoing].filter(j);
984
1000
  t.length > 0 && this.modeling.removeElements(t);
985
1001
  }
986
- }, _t = class extends de {
1002
+ }, Dt = class extends fe {
987
1003
  layoutConnection(e, t = {}) {
988
1004
  let n = t.source ?? e.source, r = t.target ?? e.target;
989
1005
  return !n || !r ? super.layoutConnection(e, t) : [b(n), b(r)];
990
1006
  }
991
- }, vt = {
992
- __depends__: [se],
1007
+ }, Ot = {
1008
+ __depends__: [ce],
993
1009
  __init__: ["ttModeling"],
994
- ttModeling: ["type", gt],
995
- layouter: ["type", _t]
1010
+ ttModeling: ["type", Et],
1011
+ layouter: ["type", Dt]
996
1012
  };
997
- //#endregion
998
- //#region src/rules/TtRules.ts
999
- function yt(e) {
1013
+ // src/rules/TtRules.ts
1014
+ function kt(e) {
1000
1015
  return E(e) && !A(e);
1001
1016
  }
1002
- var bt = class extends pe {
1017
+ var At = class extends me {
1003
1018
  static $inject = ["eventBus"];
1004
1019
  constructor(e) {
1005
1020
  super(e);
1006
1021
  }
1007
1022
  init() {
1008
- this.addRule(["shape.move", "elements.move"], (e) => e.target && e.target.parent ? null : !0), this.addRule("shape.create", () => !0), this.addRule("shape.resize", () => !0), this.addRule("element.copy", () => !0), this.addRule("connection.create", ({ source: e, target: t }) => A(e) && yt(t) || A(t) && yt(e) ? { ttKind: "association" } : !1);
1023
+ this.addRule(["shape.move", "elements.move"], (e) => e.target && e.target.parent ? null : !0), this.addRule("shape.create", () => !0), this.addRule("shape.resize", () => !0), this.addRule("element.copy", () => !0), this.addRule("connection.create", ({ source: e, target: t }) => A(e) && kt(t) || A(t) && kt(e) ? { ttKind: "association" } : !1);
1009
1024
  }
1010
- }, xt = {
1011
- __depends__: [fe],
1025
+ }, jt = {
1026
+ __depends__: [pe],
1012
1027
  __init__: ["ttRules"],
1013
- ttRules: ["type", bt]
1014
- }, St = class extends me {
1028
+ ttRules: ["type", At]
1029
+ }, Mt = class extends he {
1015
1030
  static $inject = ["eventBus", "canvas"];
1016
1031
  constructor(e, t) {
1017
1032
  super(e), this.preExecute(["shape.create", "elements.create"], (e) => {
1018
1033
  e.parent = t.getRootElement();
1019
1034
  }, !0);
1020
1035
  }
1021
- }, Ct = class extends me {
1036
+ }, Nt = class extends he {
1022
1037
  static $inject = [
1023
1038
  "eventBus",
1024
1039
  "connectionDocking",
@@ -1038,21 +1053,21 @@ var bt = class extends pe {
1038
1053
  i.length > 0 && n.removeElements(i);
1039
1054
  }, !0);
1040
1055
  }
1041
- }, wt = {
1056
+ }, Pt = {
1042
1057
  __init__: ["ttFlatModelBehavior", "ttAssociationBehavior"],
1043
- ttFlatModelBehavior: ["type", St],
1044
- ttAssociationBehavior: ["type", Ct]
1045
- }, Tt = [["path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }], ["path", { d: "m15 5 4 4" }]], Et = [
1058
+ ttFlatModelBehavior: ["type", Mt],
1059
+ ttAssociationBehavior: ["type", Nt]
1060
+ }, Ft = [["path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }], ["path", { d: "m15 5 4 4" }]], It = [
1046
1061
  ["path", { d: "M10 11v6" }],
1047
1062
  ["path", { d: "M14 11v6" }],
1048
1063
  ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }],
1049
1064
  ["path", { d: "M3 6h18" }],
1050
1065
  ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }]
1051
- ], Dt = [["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }], ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }]], Ot = [
1066
+ ], Lt = [["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }], ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }]], Rt = [
1052
1067
  ["path", { d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" }],
1053
1068
  ["path", { d: "M12 8v6" }],
1054
1069
  ["path", { d: "M9 11h6" }]
1055
- ], kt = [
1070
+ ], zt = [
1056
1071
  ["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" }],
1057
1072
  ["path", { d: "M5 3a2 2 0 0 0-2 2" }],
1058
1073
  ["path", { d: "M19 3a2 2 0 0 1 2 2" }],
@@ -1063,20 +1078,20 @@ var bt = class extends pe {
1063
1078
  ["path", { d: "M3 9v1" }],
1064
1079
  ["path", { d: "M21 9v2" }],
1065
1080
  ["path", { d: "M3 14v1" }]
1066
- ], At = [
1081
+ ], Bt = [
1067
1082
  ["path", { d: "M4 5h16" }],
1068
1083
  ["path", { d: "M4 12h16" }],
1069
1084
  ["path", { d: "M4 19h16" }]
1070
- ], jt = [["path", { d: "M5 12h14" }]], Mt = [["path", { d: "M5 12h14" }], ["path", { d: "M12 5v14" }]], Nt = [
1085
+ ], Vt = [["path", { d: "M5 12h14" }]], Ht = [["path", { d: "M5 12h14" }], ["path", { d: "M12 5v14" }]], Ut = [
1071
1086
  ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3" }],
1072
1087
  ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3" }],
1073
1088
  ["path", { d: "M3 16v3a2 2 0 0 0 2 2h3" }],
1074
1089
  ["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3" }]
1075
- ], Pt = [
1090
+ ], Wt = [
1076
1091
  ["path", { d: "M12 15V3" }],
1077
1092
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }],
1078
1093
  ["path", { d: "m7 10 5 5 5-5" }]
1079
- ], Ft = [["path", { d: "M18 6 6 18" }], ["path", { d: "m6 6 12 12" }]], It = 2.5, Lt = 16, Rt = [
1094
+ ], Gt = [["path", { d: "M18 6 6 18" }], ["path", { d: "m6 6 12 12" }]], Kt = 2.5, qt = 16, Jt = [
1080
1095
  "path",
1081
1096
  "circle",
1082
1097
  "ellipse",
@@ -1084,7 +1099,7 @@ var bt = class extends pe {
1084
1099
  "polyline",
1085
1100
  "polygon",
1086
1101
  "rect"
1087
- ], zt = [
1102
+ ], Yt = [
1088
1103
  "d",
1089
1104
  "cx",
1090
1105
  "cy",
@@ -1101,85 +1116,107 @@ var bt = class extends pe {
1101
1116
  "height",
1102
1117
  "points"
1103
1118
  ];
1104
- function Bt(e) {
1119
+ function Xt(e) {
1105
1120
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1106
1121
  }
1107
- function Vt(e, t) {
1122
+ function Zt(e, t) {
1108
1123
  let n = Number(e);
1109
1124
  return Number.isFinite(n) && n > 0 ? n : t;
1110
1125
  }
1111
- function J(e, t = {}) {
1112
- let n = Vt(t.size, Lt), r = Vt(t.strokeWidth, It);
1113
- return `<svg${t.className ? ` class="${Bt(t.className)}"` : ""} xmlns="http://www.w3.org/2000/svg" width="${n}" height="${n}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${r}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${e.map(([e, t]) => {
1114
- let n = Rt.find((t) => t === e);
1126
+ function K(e, t = {}) {
1127
+ let n = Zt(t.size, qt), r = Zt(t.strokeWidth, Kt);
1128
+ return `<svg${t.className ? ` class="${Xt(t.className)}"` : ""} xmlns="http://www.w3.org/2000/svg" width="${n}" height="${n}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${r}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${e.map(([e, t]) => {
1129
+ let n = Jt.find((t) => t === e);
1115
1130
  return n ? `<${n} ${Object.entries(t).flatMap(([e, t]) => {
1116
- let n = zt.find((t) => t === e);
1117
- return n ? [`${n}="${Bt(String(t))}"`] : [];
1131
+ let n = Yt.find((t) => t === e);
1132
+ return n ? [`${n}="${Xt(String(t))}"`] : [];
1118
1133
  }).join(" ")}/>` : "";
1119
1134
  }).join("")}</svg>`;
1120
1135
  }
1121
- //#endregion
1122
- //#region src/draw/palette-icons.ts
1123
- var Ht = {
1136
+ // src/draw/palette-icons.ts
1137
+ var Qt = {
1124
1138
  size: 20,
1125
1139
  strokeWidth: 2
1126
1140
  };
1127
- function Y(e) {
1141
+ function q(e) {
1128
1142
  return `<svg class="tt-palette-svg" width="24" height="24" viewBox="0 0 26 26" aria-hidden="true">${e}</svg>`;
1129
1143
  }
1130
- function Ut(e) {
1144
+ function $t(e) {
1131
1145
  let t = p[e], n = h(t.strokeStyle, 1.5), r = `fill="${t.fill}" stroke="${t.stroke}" stroke-width="1.5"` + (n ? ` stroke-dasharray="${n}"` : "");
1132
1146
  switch (t.shape) {
1133
- case "octagon": return Y(`<polygon points="8,3 18,3 23,8 23,18 18,23 8,23 3,18 3,8" ${r}/>`);
1134
- case "rounded-rect-vertical": return Y(`<rect x="8" y="3" width="10" height="20" rx="4" ${r}/>`);
1135
- case "rect": return Y(`<rect x="3" y="7" width="20" height="12" rx="1.5" ${r}/>`);
1136
- default: return Y(`<rect x="3" y="8" width="20" height="10" rx="5" ${r}/>`);
1147
+ case "octagon": return q(`<polygon points="8,3 18,3 23,8 23,18 18,23 8,23 3,18 3,8" ${r}/>`);
1148
+ case "rounded-rect-vertical": return q(`<rect x="8" y="3" width="10" height="20" rx="4" ${r}/>`);
1149
+ case "rect": return q(`<rect x="3" y="7" width="20" height="12" rx="1.5" ${r}/>`);
1150
+ default: return q(`<rect x="3" y="8" width="20" height="10" rx="5" ${r}/>`);
1137
1151
  }
1138
1152
  }
1139
- function Wt() {
1153
+ function en() {
1140
1154
  let e = h(l.strokeStyle, 1.5);
1141
- return Y(`<g fill="none" stroke="${l.stroke}" stroke-width="1.5" stroke-linejoin="round"` + (e ? ` stroke-dasharray="${e}"` : "") + "><polygon points=\"3,9 16,9 16,5 23,13 16,21 16,17 3,17\"/></g>");
1155
+ return q(`<g fill="none" stroke="${l.stroke}" stroke-width="1.5" stroke-linejoin="round"` + (e ? ` stroke-dasharray="${e}"` : "") + "><polygon points=\"3,9 16,9 16,5 23,13 16,21 16,17 3,17\"/></g>");
1142
1156
  }
1143
- function Gt() {
1144
- return Y("<g fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"><path d=\"M10 4H5v18h5\"/><path d=\"M13 9h9M13 13h9M13 17h6\"/></g>");
1157
+ function tn() {
1158
+ return q("<g fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"><path d=\"M10 4H5v18h5\"/><path d=\"M13 9h9M13 13h9M13 17h6\"/></g>");
1145
1159
  }
1146
- function Kt() {
1147
- return J(kt, {
1148
- ...Ht,
1160
+ function nn() {
1161
+ return K(zt, {
1162
+ ...Qt,
1149
1163
  className: "tt-palette-svg"
1150
1164
  });
1151
1165
  }
1152
- function qt(e) {
1153
- let t = d[e], n = h(t.strokeStyle, 1.5), r = `fill="${t.fill}" fill-opacity="${t.opacity}" stroke="${t.stroke}" stroke-width="1.5"` + (n ? ` stroke-dasharray="${n}"` : "");
1166
+ function rn(e) {
1167
+ let t = d[e], n = h(t.strokeStyle, 1.5), r = `fill="${Oe[e]}" stroke="${t.stroke}" stroke-width="1.5"` + (n ? ` stroke-dasharray="${n}"` : "");
1154
1168
  switch (t.shape) {
1155
- case "circle": return Y(`<circle cx="13" cy="13" r="9" ${r}/>`);
1156
- case "triangle": return Y(`<polygon points="5,6 22,13 5,20" ${r}/>`);
1157
- default: return Y(`<polygon points="9,6 23,6 17,20 3,20" ${r}/>`);
1169
+ case "circle": return q(`<circle cx="13" cy="13" r="9" ${r}/>`);
1170
+ case "triangle": return q(`<polygon points="5,6 22,13 5,20" ${r}/>`);
1171
+ default: return q(`<polygon points="9,6 23,6 17,20 3,20" ${r}/>`);
1158
1172
  }
1159
1173
  }
1160
- //#endregion
1161
- //#region src/palette/TtPaletteProvider.ts
1162
- var Jt = "tools", Yt = "tt-1-teams", Xt = "tt-2-modes", Zt = "tt-3-guides", Qt = 24;
1163
- function $t(e, t = !0) {
1164
- return `<div class="entry tt-palette-entry" draggable="${t}">${e}</div>`;
1165
- }
1166
- function en(e) {
1174
+ // src/keyboard/canvasFocus.ts
1175
+ function an(e) {
1167
1176
  return e.type === "click" && e.detail === 0;
1168
1177
  }
1169
- function tn(e) {
1178
+ function on(e, t) {
1179
+ let n = e.getContainer().ownerDocument, r = n.activeElement;
1180
+ an(t) && r !== null && r !== n.body || e.focus();
1181
+ }
1182
+ function sn(e, t) {
1183
+ let n = e.ownerDocument, r = null, i = (e) => {
1184
+ r = e.target;
1185
+ }, a = (e) => {
1186
+ let t = e.target;
1187
+ queueMicrotask(() => {
1188
+ r === t && r?.isConnected && (r = null);
1189
+ });
1190
+ }, o = new MutationObserver(() => {
1191
+ let e = r;
1192
+ e && !e.isConnected && (r = null, n.activeElement === n.body && n.hasFocus() && t(e));
1193
+ });
1194
+ return e.addEventListener("focusin", i), e.addEventListener("focusout", a), o.observe(e, {
1195
+ childList: !0,
1196
+ subtree: !0
1197
+ }), () => {
1198
+ o.disconnect(), e.removeEventListener("focusin", i), e.removeEventListener("focusout", a);
1199
+ };
1200
+ }
1201
+ // src/palette/TtPaletteProvider.ts
1202
+ var cn = "tools", ln = "tt-1-teams", un = "tt-2-modes", dn = "tt-3-guides", fn = 24;
1203
+ function pn(e, t = !0) {
1204
+ return `<div class="entry tt-palette-entry" draggable="${t}">${e}</div>`;
1205
+ }
1206
+ function mn(e) {
1170
1207
  return {
1171
1208
  x: e.x + e.width / 2,
1172
1209
  y: e.y + e.height / 2
1173
1210
  };
1174
1211
  }
1175
- function nn(e, t) {
1212
+ function hn(e, t) {
1176
1213
  let { x: n, y: r, scale: i, outer: a } = e.viewbox(), o = a.width - t.left - t.right, s = a.height - t.top - t.bottom;
1177
1214
  if (i > 0 && o > 0 && s > 0) return {
1178
1215
  x: n + (t.left + o / 2) / i,
1179
1216
  y: r + (t.top + s / 2) / i
1180
1217
  };
1181
1218
  }
1182
- var rn = class {
1219
+ var gn = class {
1183
1220
  config;
1184
1221
  create;
1185
1222
  factory;
@@ -1208,23 +1245,25 @@ var rn = class {
1208
1245
  getPaletteEntries() {
1209
1246
  let e = {};
1210
1247
  e["lasso-tool"] = {
1211
- group: Jt,
1248
+ group: cn,
1212
1249
  title: "Select several elements",
1213
- html: $t(Kt(), !1),
1214
- action: { click: (e) => this.lassoTool.activateSelection(e) }
1250
+ html: pn(nn(), !1),
1251
+ action: { click: (e) => {
1252
+ this.lassoTool.activateSelection(e), on(this.canvas, e);
1253
+ } }
1215
1254
  };
1216
- for (let t of n) e[`team.${t.type}`] = this.createEntry(Yt, `${t.label} team`, Ut(t.type), () => this.factory.createNewTeam(t.type, t.label));
1217
- for (let n of t) e[`mode.${n.mode}`] = this.createEntry(Xt, `${n.label} interaction`, qt(n.mode), () => this.factory.createNewInteraction(n.mode));
1218
- return e.flow = this.createEntry(Zt, l.label, Wt(), () => this.factory.createNewFlow()), e.annotation = this.createEntry(Zt, i.label, Gt(), () => this.factory.createNewAnnotation()), e;
1255
+ for (let t of n) e[`team.${t.type}`] = this.createEntry(ln, `${t.label} team`, $t(t.type), () => this.factory.createNewTeam(t.type, t.label));
1256
+ for (let n of t) e[`mode.${n.mode}`] = this.createEntry(un, `${n.label} interaction`, rn(n.mode), () => this.factory.createNewInteraction(n.mode));
1257
+ return e.flow = this.createEntry(dn, l.label, en(), () => this.factory.createNewFlow()), e.annotation = this.createEntry(dn, i.label, tn(), () => this.factory.createNewAnnotation()), e;
1219
1258
  }
1220
1259
  createEntry(e, t, n, r) {
1221
1260
  let i = (e) => {
1222
- en(e) ? this.placeInFreeRect(r()) : this.create.start(e, r());
1261
+ an(e) ? this.placeInFreeRect(r()) : (this.create.start(e, r()), this.canvas.focus());
1223
1262
  };
1224
1263
  return {
1225
1264
  group: e,
1226
1265
  title: t,
1227
- html: $t(n),
1266
+ html: pn(n),
1228
1267
  action: {
1229
1268
  dragstart: i,
1230
1269
  click: i
@@ -1239,30 +1278,177 @@ var rn = class {
1239
1278
  x: Math.round(t.x),
1240
1279
  y: Math.round(t.y)
1241
1280
  }, r = () => this.elementRegistry.filter(E).some((e) => {
1242
- let t = tn(e);
1281
+ let t = mn(e);
1243
1282
  return Math.abs(t.x - n.x) < 1 && Math.abs(t.y - n.y) < 1;
1244
1283
  });
1245
- for (; r();) n.x += Qt, n.y += Qt;
1284
+ for (; r();) n.x += fn, n.y += fn;
1246
1285
  return n;
1247
1286
  }
1248
1287
  freeAreaCentre() {
1249
1288
  let e = this.config?.freeArea;
1250
- return e?.center ? e.center() : e?.insets ? nn(this.canvas, e.insets()) : this.config?.freeRectCenter?.();
1289
+ return e?.center ? e.center() : e?.insets ? hn(this.canvas, e.insets()) : this.config?.freeRectCenter?.();
1251
1290
  }
1252
1291
  placeInFreeRect(e) {
1253
1292
  if (this.readOnly?.isReadOnly()) return;
1254
1293
  let t = this.modeling.createShape(e, this.freePlace(), this.canvas.getRootElement());
1255
1294
  this.selection.select(t), this.canvas.focus(), E(t) && this.labelEditing?.activate(t);
1256
1295
  }
1257
- }, an = {
1296
+ }, _n = ".djs-palette-entries .entry", vn = ".djs-hover-tooltip", yn = 8, bn = 12, xn = {
1258
1297
  __depends__: [
1259
- he,
1260
1298
  ge,
1261
- w
1299
+ _e,
1300
+ se
1262
1301
  ],
1263
- __init__: ["ttPaletteProvider"],
1264
- ttPaletteProvider: ["type", rn]
1265
- }, X = "tt.readOnly.changed", on = 5e3, sn = [
1302
+ __init__: ["ttPaletteProvider", "paletteTooltip"],
1303
+ ttPaletteProvider: ["type", gn],
1304
+ paletteTooltip: ["type", class {
1305
+ palette;
1306
+ hoverTooltip;
1307
+ canvas;
1308
+ static $inject = [
1309
+ "eventBus",
1310
+ "palette",
1311
+ "hoverTooltip",
1312
+ "canvas"
1313
+ ];
1314
+ entries = {};
1315
+ constructor(e, t, n, r) {
1316
+ this.palette = t, this.hoverTooltip = n, this.canvas = r, e.on("palette.create", (e) => this.attachTo(e.container)), e.on("palette.changed", () => this.refreshEntries());
1317
+ }
1318
+ attachTo(e) {
1319
+ this.refreshEntries(), this.hoverTooltip.add({
1320
+ container: e,
1321
+ selector: _n,
1322
+ getContent: (e) => this.contentFor(e),
1323
+ getPosition: (e) => this.positionBelowPalette(e)
1324
+ });
1325
+ }
1326
+ refreshEntries() {
1327
+ this.entries = this.palette.getEntries();
1328
+ }
1329
+ contentFor(e) {
1330
+ let t = this.entries[e.getAttribute("data-action") ?? ""];
1331
+ return t?.title ? ye`<${ve}
1332
+ title=${t.title}
1333
+ shortcut=${t.shortcut}
1334
+ />` : null;
1335
+ }
1336
+ positionBelowPalette(e) {
1337
+ let t = this.canvas.getContainer().getBoundingClientRect(), n = e.getBoundingClientRect(), r = (e.closest(".djs-palette") ?? e).getBoundingClientRect();
1338
+ return queueMicrotask(() => this.keepInsideContainer()), {
1339
+ x: n.left + n.width / 2 - t.left,
1340
+ y: r.bottom + yn - t.top,
1341
+ placement: "bottom"
1342
+ };
1343
+ }
1344
+ keepInsideContainer() {
1345
+ let e = this.canvas.getContainer(), t = e.querySelector(vn);
1346
+ if (!t) return;
1347
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = n.left + bn - r.left, a = r.right - (n.right - bn), o = Math.max(i, Math.min(0, -a));
1348
+ o !== 0 && (t.style.left = `${parseFloat(t.style.left) + o}px`);
1349
+ }
1350
+ }]
1351
+ }, Sn = 8, Cn = {
1352
+ top: 0,
1353
+ right: 0,
1354
+ bottom: 0,
1355
+ left: 0
1356
+ }, wn = "ttContextPad#keepInsideFreeArea", Tn = 250;
1357
+ function En(e) {
1358
+ return !Array.isArray(e) && "waypoints" in e;
1359
+ }
1360
+ function Dn(e) {
1361
+ let t = parseFloat(e.style.left), n = parseFloat(e.style.top);
1362
+ return Number.isFinite(t) && Number.isFinite(n) ? {
1363
+ left: t,
1364
+ top: n
1365
+ } : void 0;
1366
+ }
1367
+ var On = class {
1368
+ config;
1369
+ canvas;
1370
+ scheduler;
1371
+ static $inject = [
1372
+ "config.ttContextPad",
1373
+ "eventBus",
1374
+ "canvas",
1375
+ "scheduler"
1376
+ ];
1377
+ openPad;
1378
+ diagramJsPosition;
1379
+ positionWrites;
1380
+ constructor(e, t, n, r) {
1381
+ this.config = e, this.canvas = n, this.scheduler = r, t.on("contextPad.open", (e) => this.follow(e.current)), t.on([
1382
+ "contextPad.show",
1383
+ "canvas.viewbox.changed",
1384
+ "canvas.resized"
1385
+ ], Tn, () => this.schedulePlacement()), t.on(["contextPad.close", "diagram.destroy"], () => this.stopFollowing());
1386
+ }
1387
+ follow(e) {
1388
+ this.stopFollowing(), this.openPad = e;
1389
+ let t = new MutationObserver(() => {
1390
+ this.diagramJsPosition = Dn(e.html), this.keepInsideFreeArea();
1391
+ });
1392
+ t.observe(e.html, {
1393
+ attributes: !0,
1394
+ attributeFilter: ["style"]
1395
+ }), this.positionWrites = t;
1396
+ }
1397
+ stopFollowing() {
1398
+ this.positionWrites?.disconnect(), this.positionWrites = void 0, this.openPad = void 0, this.diagramJsPosition = void 0, this.scheduler.cancel(wn);
1399
+ }
1400
+ schedulePlacement() {
1401
+ this.scheduler.schedule(() => this.keepInsideFreeArea(), wn);
1402
+ }
1403
+ keepInsideFreeArea() {
1404
+ let e = this.openPad, t = this.diagramJsPosition;
1405
+ if (!e || !t || !e.html.classList.contains("open")) return;
1406
+ let n = this.canvas.getContainer().getBoundingClientRect();
1407
+ n.width > 0 && n.height > 0 && this.moveTo(e.html, this.placementFor(e, t, n));
1408
+ }
1409
+ placementFor(e, t, n) {
1410
+ let r = this.targetBox(e.target, n);
1411
+ if (!r || r.right < 0 || r.bottom < 0 || r.left > n.width || r.top > n.height) return t;
1412
+ let i = this.config?.freeArea?.insets?.() ?? Cn, a = {
1413
+ left: i.left,
1414
+ top: i.top,
1415
+ right: n.width - i.right,
1416
+ bottom: n.height - i.bottom
1417
+ }, o = e.html.offsetWidth, s = e.html.offsetHeight, c = Sn * this.canvas.zoom(), l = t.left;
1418
+ if (l + o > a.right) {
1419
+ let t = (En(e.target) ? l - c : r.left) - c - o;
1420
+ l = t >= a.left && t + o <= a.right ? t : a.right - o;
1421
+ }
1422
+ return {
1423
+ left: Math.max(a.left, l),
1424
+ top: Math.max(a.top, Math.min(t.top, a.bottom - s))
1425
+ };
1426
+ }
1427
+ moveTo(e, t) {
1428
+ let n = Dn(e);
1429
+ (n?.left !== t.left || n.top !== t.top) && (e.style.left = `${t.left}px`, e.style.top = `${t.top}px`, this.positionWrites?.takeRecords());
1430
+ }
1431
+ targetBox(e, t) {
1432
+ let n = Array.isArray(e) ? e : [e], r;
1433
+ for (let e of n) {
1434
+ let n = this.canvas.getGraphics(e.id);
1435
+ if (!n) continue;
1436
+ let i = n.getBoundingClientRect(), a = {
1437
+ left: i.left - t.left,
1438
+ top: i.top - t.top,
1439
+ right: i.right - t.left,
1440
+ bottom: i.bottom - t.top
1441
+ };
1442
+ r = r ? {
1443
+ left: Math.min(r.left, a.left),
1444
+ top: Math.min(r.top, a.top),
1445
+ right: Math.max(r.right, a.right),
1446
+ bottom: Math.max(r.bottom, a.bottom)
1447
+ } : a;
1448
+ }
1449
+ return r;
1450
+ }
1451
+ }, J = "tt.readOnly.changed", kn = 5e3, An = [
1266
1452
  "elements.move",
1267
1453
  "shape.move",
1268
1454
  "shape.resize",
@@ -1274,7 +1460,7 @@ var rn = class {
1274
1460
  "connection.reconnect",
1275
1461
  "connection.updateWaypoints",
1276
1462
  "elements.delete"
1277
- ], cn = class extends pe {
1463
+ ], jn = class extends me {
1278
1464
  bus;
1279
1465
  static $inject = ["eventBus"];
1280
1466
  readOnly = !1;
@@ -1282,26 +1468,26 @@ var rn = class {
1282
1468
  super(e), this.bus = e;
1283
1469
  }
1284
1470
  init() {
1285
- this.addRule(sn, on, () => !this.readOnly && void 0);
1471
+ this.addRule(An, kn, () => !this.readOnly && void 0);
1286
1472
  }
1287
1473
  isReadOnly() {
1288
1474
  return this.readOnly;
1289
1475
  }
1290
1476
  setReadOnly(e) {
1291
- this.readOnly !== e && (this.readOnly = e, this.bus.fire(X, { readOnly: e }));
1477
+ this.readOnly !== e && (this.readOnly = e, this.bus.fire(J, { readOnly: e }));
1292
1478
  }
1293
- }, ln = {
1294
- __depends__: [fe],
1479
+ }, Mn = {
1480
+ __depends__: [pe],
1295
1481
  __init__: ["ttReadOnly"],
1296
- ttReadOnly: ["type", cn]
1297
- }, un = ".djs-context-pad .entry[data-action]";
1298
- function Z(e, t, n = !0) {
1299
- return `<div class="entry tt-cp-entry" role="button" tabindex="${n ? 0 : -1}" aria-label="${t}">${J(e)}</div>`;
1482
+ ttReadOnly: ["type", jn]
1483
+ }, Nn = ".djs-context-pad .entry[data-action]", Pn = ":scope > .djs-context-pad-parent";
1484
+ function Y(e, t, n = !0) {
1485
+ return `<div class="entry tt-cp-entry" role="button" tabindex="${n ? 0 : -1}" aria-label="${t}">${K(e)}</div>`;
1300
1486
  }
1301
- function dn(e) {
1487
+ function Fn(e) {
1302
1488
  return A(e) ? "Edit text" : O(e) || k(e) ? "Edit label" : "Rename";
1303
1489
  }
1304
- var fn = class {
1490
+ var In = class {
1305
1491
  contextPad;
1306
1492
  modeling;
1307
1493
  ttModeling;
@@ -1322,30 +1508,33 @@ var fn = class {
1322
1508
  ];
1323
1509
  readOnly;
1324
1510
  constructor(e, t, n, r, i, a, o, s, c) {
1325
- this.contextPad = e, this.modeling = t, this.ttModeling = n, this.labelEditing = r, this.connect = i, this.selection = a, this.canvas = o, this.readOnly = c.get("ttReadOnly", !1), e.registerProvider(this), s.on("contextPad.open.allowed", () => !this.readOnly?.isReadOnly() && void 0), s.on(X, (t) => {
1511
+ this.contextPad = e, this.modeling = t, this.ttModeling = n, this.labelEditing = r, this.connect = i, this.selection = a, this.canvas = o, this.readOnly = c.get("ttReadOnly", !1), e.registerProvider(this), s.on("contextPad.open.allowed", () => !this.readOnly?.isReadOnly() && void 0), s.on(J, (t) => {
1326
1512
  t.readOnly && e.close();
1327
- }), o.getContainer().addEventListener("keydown", (e) => this.onEntryKeyDown(e));
1513
+ });
1514
+ let l = o.getContainer();
1515
+ l.addEventListener("keydown", (e) => this.onEntryKeyDown(e));
1516
+ let u = l.querySelector(Pn);
1517
+ if (u) {
1518
+ let e = sn(u, (e) => this.focusSameEntryOrCanvas(e.closest(Nn)?.getAttribute("data-action")));
1519
+ s.on("diagram.destroy", e);
1520
+ }
1328
1521
  }
1329
1522
  getContextPadEntries(e) {
1330
1523
  if (this.readOnly?.isReadOnly()) return {};
1331
1524
  if (j(e)) return { delete: this.deleteEntry([e], "Delete connector") };
1332
1525
  if (!E(e)) return {};
1333
- if (A(e)) {
1334
- let t = (t) => this.connect.start(t, e);
1335
- return {
1336
- "edit-label": this.editEntry(e),
1337
- connect: {
1338
- group: "edit",
1339
- title: "Attach to element",
1340
- html: Z(Dt, "Attach to element", !1),
1341
- action: {
1342
- click: t,
1343
- dragstart: t
1344
- }
1345
- },
1346
- delete: this.deleteEntry([e], "Delete")
1347
- };
1348
- }
1526
+ if (A(e)) return {
1527
+ "edit-label": this.editEntry(e),
1528
+ connect: {
1529
+ group: "edit",
1530
+ title: "Attach to element",
1531
+ html: Y(Lt, "Attach to element", !1),
1532
+ action: { click: (t) => {
1533
+ this.connect.start(t, e), on(this.canvas, t);
1534
+ } }
1535
+ },
1536
+ delete: this.deleteEntry([e], "Delete")
1537
+ };
1349
1538
  let t = () => {
1350
1539
  let t = this.ttModeling.appendAnnotation(e);
1351
1540
  this.selection.select(t), this.labelEditing.activate(t);
@@ -1355,7 +1544,7 @@ var fn = class {
1355
1544
  "append-annotation": {
1356
1545
  group: "edit",
1357
1546
  title: "Add annotation",
1358
- html: Z(Ot, "Add annotation"),
1547
+ html: Y(Rt, "Add annotation"),
1359
1548
  action: {
1360
1549
  click: t,
1361
1550
  keyboard: t
@@ -1369,15 +1558,19 @@ var fn = class {
1369
1558
  }
1370
1559
  onEntryKeyDown(e) {
1371
1560
  if (e.key !== "Enter" && e.key !== " " || e.repeat) return;
1372
- let t = (e.target?.closest?.(un))?.getAttribute("data-action");
1561
+ let t = (e.target?.closest?.(Nn))?.getAttribute("data-action");
1373
1562
  t && (e.preventDefault(), e.stopPropagation(), this.contextPad.triggerEntry(t, "keyboard", e));
1374
1563
  }
1564
+ focusSameEntryOrCanvas(e) {
1565
+ let t = this.canvas.getContainer(), n = e ? t.querySelector(`.djs-context-pad.open .entry[data-action="${CSS.escape(e)}"]`) : null;
1566
+ n?.focus({ preventScroll: !0 }), t.ownerDocument.activeElement !== n && this.canvas.focus();
1567
+ }
1375
1568
  editEntry(e) {
1376
- let t = dn(e), n = () => this.labelEditing.activate(e);
1569
+ let t = Fn(e), n = () => this.labelEditing.activate(e);
1377
1570
  return {
1378
1571
  group: "edit",
1379
1572
  title: t,
1380
- html: Z(Tt, t),
1573
+ html: Y(Ft, t),
1381
1574
  action: {
1382
1575
  click: n,
1383
1576
  keyboard: n
@@ -1385,31 +1578,36 @@ var fn = class {
1385
1578
  };
1386
1579
  }
1387
1580
  deleteEntry(e, t) {
1581
+ let n = () => {
1582
+ this.modeling.removeElements([...e]), this.canvas.focus();
1583
+ };
1388
1584
  return {
1389
1585
  group: "edit",
1390
1586
  title: t,
1391
- html: Z(Et, t),
1587
+ html: Y(It, t),
1392
1588
  action: {
1393
- click: () => this.modeling.removeElements([...e]),
1394
- keyboard: () => {
1395
- this.modeling.removeElements([...e]), this.canvas.focus();
1396
- }
1589
+ click: n,
1590
+ keyboard: n
1397
1591
  }
1398
1592
  };
1399
1593
  }
1400
- }, pn = {
1594
+ }, Ln = {
1401
1595
  __depends__: [
1402
- ye,
1403
- _e,
1404
- ve
1596
+ Se,
1597
+ be,
1598
+ xe
1405
1599
  ],
1406
- __init__: ["ttContextPadProvider"],
1407
- ttContextPadProvider: ["type", fn]
1408
- }, mn = "tt-label-editing", hn = 96;
1409
- function gn(e) {
1600
+ __init__: ["ttContextPadProvider", "ttContextPadPlacement"],
1601
+ ttContextPadProvider: ["type", In],
1602
+ ttContextPadPlacement: ["type", On]
1603
+ }, Rn = "tt-label-editing", zn = 96;
1604
+ function Bn(e) {
1605
+ return e.isComposing || e.keyCode === 229;
1606
+ }
1607
+ function Vn(e) {
1410
1608
  return A(e) ? "Annotation text" : O(e) ? "Interaction label" : k(e) ? "Flow label" : "Team name";
1411
1609
  }
1412
- var _n = class {
1610
+ var Hn = class {
1413
1611
  canvas;
1414
1612
  modeling;
1415
1613
  elementRegistry;
@@ -1427,7 +1625,7 @@ var _n = class {
1427
1625
  constructor(e, t, n, r, i) {
1428
1626
  this.canvas = t, this.modeling = n, this.elementRegistry = r, this.readOnly = i.get("ttReadOnly", !1), e.on("element.dblclick", (e) => {
1429
1627
  E(e.element) && this.activate(e.element);
1430
- }), e.on(["element.mousedown", "drag.init"], () => this.active?.commit()), e.on("canvas.viewbox.changed", () => this.active?.place()), e.on("import.render.start", () => this.cancel()), e.on(X, (e) => {
1628
+ }), e.on(["element.mousedown", "drag.init"], () => this.active?.commit()), e.on("canvas.viewbox.changed", () => this.active?.place()), e.on("import.render.start", () => this.cancel()), e.on(J, (e) => {
1431
1629
  e.readOnly && this.cancel();
1432
1630
  }), e.on("diagram.destroy", () => {
1433
1631
  clearTimeout(this.resumeTimer), this.suspended = null, this.cancel();
@@ -1454,12 +1652,12 @@ var _n = class {
1454
1652
  }
1455
1653
  activate(e, t) {
1456
1654
  if (this.active?.commit(), this.readOnly?.isReadOnly()) return;
1457
- let n = H(e), r = n.align === "center", i = r ? Math.max(n.box.width, hn) : n.box.width, a = e.x + n.box.x + (n.box.width - i) / 2, o = document.createElement("textarea");
1458
- o.className = "tt-label-editor", o.value = t ? t.value : e.ttLabel ?? "", o.rows = 1, o.setAttribute("aria-label", gn(e)), Object.assign(o.style, {
1459
- fontFamily: R.family,
1655
+ let n = L(e), r = n.align === "center", i = r ? Math.max(n.box.width, zn) : n.box.width, a = e.x + n.box.x + (n.box.width - i) / 2, o = document.createElement("textarea");
1656
+ o.className = "tt-label-editor", o.value = t ? t.value : e.ttLabel ?? "", o.rows = 1, o.setAttribute("aria-label", Vn(e)), Object.assign(o.style, {
1657
+ fontFamily: P.family,
1460
1658
  fontWeight: n.fontWeight,
1461
1659
  letterSpacing: n.letterSpacing ?? "normal",
1462
- lineHeight: String(B),
1660
+ lineHeight: String(I),
1463
1661
  color: n.fill,
1464
1662
  textAlign: r ? "center" : "left"
1465
1663
  });
@@ -1475,15 +1673,15 @@ var _n = class {
1475
1673
  fontSize: `${n.fontSize * t}px`
1476
1674
  }), l();
1477
1675
  };
1478
- this.canvas.getContainer().appendChild(o), this.canvas.addMarker(e, mn), u(), o.focus(), t ? o.setSelectionRange(t.selectionStart, t.selectionEnd) : o.select();
1676
+ this.canvas.getContainer().appendChild(o), this.canvas.addMarker(e, Rn), u(), o.focus(), t ? o.setSelectionRange(t.selectionStart, t.selectionEnd) : o.select();
1479
1677
  let d = !1, f = () => {
1480
- d || (d = !0, o.removeEventListener("keydown", m), o.removeEventListener("input", l), o.removeEventListener("blur", h), o.remove(), this.elementRegistry.get(e.id) === e && this.canvas.removeMarker(e, mn), this.active = null, this.canvas.restoreFocus());
1678
+ d || (d = !0, o.removeEventListener("keydown", m), o.removeEventListener("input", l), o.removeEventListener("blur", h), o.remove(), this.elementRegistry.get(e.id) === e && this.canvas.removeMarker(e, Rn), this.active = null, this.canvas.restoreFocus());
1481
1679
  }, p = () => {
1482
1680
  if (d) return;
1483
1681
  let t = o.value.trim(), n = t !== (e.ttLabel ?? "");
1484
1682
  f(), n && this.modeling.updateLabel(e, t);
1485
1683
  }, m = (e) => {
1486
- e.key === "Enter" && !e.shiftKey && !e.isComposing ? (e.preventDefault(), p(), this.canvas.focus()) : e.key === "Escape" && (e.preventDefault(), f(), this.canvas.focus());
1684
+ Bn(e) || (e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), p(), this.canvas.focus()) : e.key === "Escape" && (e.preventDefault(), f(), this.canvas.focus()));
1487
1685
  }, h = () => p();
1488
1686
  o.addEventListener("keydown", m), o.addEventListener("input", l), o.addEventListener("blur", h);
1489
1687
  let g = () => ({
@@ -1502,10 +1700,10 @@ var _n = class {
1502
1700
  cancel() {
1503
1701
  this.active?.cleanup();
1504
1702
  }
1505
- }, vn = {
1703
+ }, Un = {
1506
1704
  __init__: ["ttLabelEditing"],
1507
- ttLabelEditing: ["type", _n]
1508
- }, yn = 1, bn = 10, xn = {
1705
+ ttLabelEditing: ["type", Hn]
1706
+ }, Wn = 1, Gn = 10, Kn = {
1509
1707
  ArrowLeft: {
1510
1708
  x: -1,
1511
1709
  y: 0
@@ -1522,24 +1720,17 @@ var _n = class {
1522
1720
  x: 0,
1523
1721
  y: 1
1524
1722
  }
1525
- }, Sn = "[aria-modal=\"true\"], dialog[open]";
1526
- function Cn(e) {
1527
- let t = e;
1528
- return t ? t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable : !1;
1529
- }
1530
- function wn(e) {
1723
+ }, qn = "[aria-modal=\"true\"], dialog[open]";
1724
+ function Jn(e) {
1531
1725
  return typeof e?.nodeType == "number";
1532
1726
  }
1533
- function Tn(e, t) {
1534
- if (t.closest("[inert]")) return !1;
1535
- if (!wn(e) || e.nodeType === Node.DOCUMENT_NODE) return !0;
1536
- let n = e.ownerDocument;
1537
- return e === n?.body || e === n?.documentElement || t.contains(e);
1727
+ function Yn(e, t) {
1728
+ return !t.closest("[inert]") && Jn(e) && t.contains(e);
1538
1729
  }
1539
- function En(e) {
1730
+ function Xn(e) {
1540
1731
  return !("waypoints" in e);
1541
1732
  }
1542
- var Dn = class {
1733
+ var Zn = class {
1543
1734
  static $inject = [
1544
1735
  "config.ttKeyboard",
1545
1736
  "eventBus",
@@ -1553,50 +1744,49 @@ var Dn = class {
1553
1744
  "injector"
1554
1745
  ];
1555
1746
  constructor(e, t, n, r, i, a, o, s, c, l) {
1556
- let u = n.getContainer(), d = u.ownerDocument ?? document, f = e?.undoRedoKeys ?? !0, p = l.get("dragging", !1), m = l.get("ttReadOnly", !1), h = (e, t, n) => {
1747
+ let u = n.getContainer(), d = u.querySelector(":scope > svg"), f = u.ownerDocument ?? document, p = e?.undoRedoKeys ?? !0, m = l.get("dragging", !1), h = l.get("ttReadOnly", !1), g = (e, t, n) => {
1557
1748
  if (t && n === "a" && !e.shiftKey) e.preventDefault(), a.select(r.filter((e) => !!e.parent));
1558
1749
  else if (t && n === "c" && !e.shiftKey) {
1559
1750
  let t = a.get();
1560
1751
  if (!t.length) return !0;
1561
1752
  e.preventDefault(), s.copy(t);
1562
1753
  } else if (!t && n === "escape") {
1563
- if (p?.context() || !a.get().length) return !0;
1754
+ if (m?.context() || !a.get().length) return !0;
1564
1755
  e.preventDefault(), a.select(null);
1565
1756
  } else return !1;
1566
1757
  return !0;
1567
- }, g = (e, t, n) => {
1758
+ }, _ = (e, t, n) => {
1568
1759
  let r = t && n === "z" && !e.shiftKey, l = t && n === "z" && e.shiftKey || t && n === "y" && !e.shiftKey;
1569
1760
  if (r || l) {
1570
- if (!f) return;
1761
+ if (!p) return;
1571
1762
  e.preventDefault(), r && i.canUndo() && i.undo(), l && i.canRedo() && i.redo();
1572
1763
  } else if (n === "delete" || n === "backspace") {
1573
1764
  let t = a.get();
1574
1765
  t.length && (e.preventDefault(), o.removeElements([...t]));
1575
1766
  } else if (t && n === "v" && !e.shiftKey) e.preventDefault(), s.paste();
1576
- else if (!t && Object.hasOwn(xn, e.key)) {
1577
- let t = a.get().filter(En);
1767
+ else if (!t && Object.hasOwn(Kn, e.key)) {
1768
+ let t = a.get().filter(Xn);
1578
1769
  if (!t.length || !c.allowed("elements.move", { shapes: t })) return;
1579
1770
  e.preventDefault();
1580
- let n = xn[e.key], r = e.shiftKey ? bn : yn;
1771
+ let n = Kn[e.key], r = e.shiftKey ? Gn : Wn;
1581
1772
  o.moveElements(t, {
1582
1773
  x: n.x * r,
1583
1774
  y: n.y * r
1584
1775
  });
1585
1776
  }
1586
- }, _ = (e) => {
1587
- if (e.defaultPrevented || e.altKey || e.isComposing || Cn(e.target) || !Tn(e.target, u) || d.querySelector(Sn)) return;
1777
+ }, v = (e) => {
1778
+ if (typeof e.key != "string" || e.defaultPrevented || e.altKey || e.isComposing || !Yn(e.target, d) || f.querySelector(qn)) return;
1588
1779
  let t = e.ctrlKey || e.metaKey, n = e.key.toLowerCase();
1589
- h(e, t, n) || m?.isReadOnly() || g(e, t, n);
1780
+ g(e, t, n) || h?.isReadOnly() || _(e, t, n);
1590
1781
  };
1591
- d.addEventListener("keydown", _), t.on("diagram.destroy", () => d.removeEventListener("keydown", _));
1782
+ f.addEventListener("keydown", v), t.on("diagram.destroy", () => f.removeEventListener("keydown", v));
1592
1783
  }
1593
- }, Q = {
1784
+ }, Qn = {
1594
1785
  __init__: ["ttKeyboard"],
1595
- ttKeyboard: ["type", Dn]
1786
+ ttKeyboard: ["type", Zn]
1596
1787
  };
1597
- //#endregion
1598
- //#region src/copy-paste/TtCopyPaste.ts
1599
- function On(e) {
1788
+ // src/copy-paste/TtCopyPaste.ts
1789
+ function $n(e) {
1600
1790
  switch (e) {
1601
1791
  case "team": return "team";
1602
1792
  case "interaction": return "int";
@@ -1606,7 +1796,7 @@ function On(e) {
1606
1796
  default: return;
1607
1797
  }
1608
1798
  }
1609
- var kn = class extends xe {
1799
+ var er = class extends we {
1610
1800
  elementFactory;
1611
1801
  static $inject = [
1612
1802
  "canvas",
@@ -1622,20 +1812,20 @@ var kn = class extends xe {
1622
1812
  super(e, t, n, r, i, a, o, s), this.elementFactory = r;
1623
1813
  }
1624
1814
  createConnection(e) {
1625
- let t = On(e.ttKind);
1815
+ let t = $n(e.ttKind);
1626
1816
  return t ? this.elementFactory.createConnection({
1627
1817
  ...e,
1628
1818
  id: v(t)
1629
1819
  }) : super.createConnection(e);
1630
1820
  }
1631
1821
  createShape(e) {
1632
- let t = On(e.ttKind);
1822
+ let t = $n(e.ttKind);
1633
1823
  return t ? this.elementFactory.createShape({
1634
1824
  ...e,
1635
1825
  id: v(t)
1636
1826
  }) : super.createShape(e);
1637
1827
  }
1638
- }, An = [
1828
+ }, tr = [
1639
1829
  "ttKind",
1640
1830
  "teamType",
1641
1831
  "mode",
@@ -1644,10 +1834,10 @@ var kn = class extends xe {
1644
1834
  "fill",
1645
1835
  "stroke",
1646
1836
  "ttForeign"
1647
- ], jn = {
1648
- __depends__: [be],
1837
+ ], nr = {
1838
+ __depends__: [Ce],
1649
1839
  __init__: ["ttCopyPasteProps"],
1650
- copyPaste: ["type", kn],
1840
+ copyPaste: ["type", er],
1651
1841
  ttCopyPasteProps: ["type", class {
1652
1842
  static $inject = ["eventBus"];
1653
1843
  constructor(e) {
@@ -1655,20 +1845,19 @@ var kn = class extends xe {
1655
1845
  let { descriptor: t, element: n } = e;
1656
1846
  if (!E(n) && !j(n)) return;
1657
1847
  let r = n;
1658
- for (let e of An) r[e] !== void 0 && (t[e] = structuredClone(r[e]));
1848
+ for (let e of tr) r[e] !== void 0 && (t[e] = structuredClone(r[e]));
1659
1849
  });
1660
1850
  }
1661
1851
  }]
1662
1852
  };
1663
- //#endregion
1664
- //#region src/zorder/TtZOrder.ts
1665
- function Mn(e) {
1853
+ // src/zorder/TtZOrder.ts
1854
+ function rr(e) {
1666
1855
  return k(e) ? 0 : D(e) ? e.teamType === "enabling" ? 3 : e.teamType === "complicated-subsystem" ? 2 : 1 : O(e) ? 4 : A(e) ? 5 : j(e) ? 6 : 1;
1667
1856
  }
1668
- function Nn(e) {
1857
+ function ir(e) {
1669
1858
  return E(e) || j(e);
1670
1859
  }
1671
- var Pn = class {
1860
+ var ar = class {
1672
1861
  canvas;
1673
1862
  elementRegistry;
1674
1863
  static $inject = [
@@ -1687,34 +1876,34 @@ var Pn = class {
1687
1876
  });
1688
1877
  }
1689
1878
  reorder() {
1690
- let e = this.elementRegistry.getAll().filter(Nn).sort((e, t) => Mn(e) - Mn(t));
1879
+ let e = this.elementRegistry.getAll().filter(ir).sort((e, t) => rr(e) - rr(t));
1691
1880
  for (let t of e) {
1692
1881
  let e = this.canvas.getGraphics(t)?.parentNode, n = e?.parentNode;
1693
1882
  e && n && n.appendChild(e);
1694
1883
  }
1695
1884
  }
1696
- }, Fn = {
1885
+ }, or = {
1697
1886
  __init__: ["ttZOrder"],
1698
- ttZOrder: ["type", Pn]
1699
- }, In = class extends K {
1887
+ ttZOrder: ["type", ar]
1888
+ }, sr = class extends W {
1700
1889
  _getModules() {
1701
1890
  return [
1702
1891
  ...super._getModules(),
1703
- se,
1704
- w,
1705
1892
  ce,
1893
+ se,
1706
1894
  le,
1707
1895
  ue,
1708
- ln,
1709
- vt,
1710
- xt,
1711
- wt,
1712
- an,
1713
- pn,
1714
- vn,
1715
- Q,
1716
- jn,
1717
- Fn
1896
+ de,
1897
+ Mn,
1898
+ Ot,
1899
+ jt,
1900
+ Pt,
1901
+ xn,
1902
+ Ln,
1903
+ Un,
1904
+ Qn,
1905
+ nr,
1906
+ or
1718
1907
  ];
1719
1908
  }
1720
1909
  undo() {
@@ -1729,34 +1918,34 @@ var Pn = class {
1729
1918
  canRedo() {
1730
1919
  return this.get("commandStack").canRedo();
1731
1920
  }
1732
- }, Ln = "team-topologies";
1733
- function Rn(e = {}) {
1734
- return Hn(new In({
1735
- ...Bn(e),
1921
+ }, cr = "team-topologies";
1922
+ function lr(e = {}) {
1923
+ return pr(new sr({
1924
+ ...dr(e),
1736
1925
  undoRedoKeys: e.undoRedoKeys ?? !0,
1737
1926
  freeArea: e.freeArea,
1738
1927
  freeRectCenter: e.freeRectCenter
1739
1928
  }), !0, e.fitOnImport ?? !0);
1740
1929
  }
1741
- function zn(e = {}) {
1742
- return Hn(new K(Bn(e)), !1, e.fitOnImport ?? !0);
1930
+ function ur(e = {}) {
1931
+ return pr(new W(dr(e)), !1, e.fitOnImport ?? !0);
1743
1932
  }
1744
- function Bn(e) {
1933
+ function dr(e) {
1745
1934
  return {
1746
1935
  width: "100%",
1747
1936
  height: "100%",
1748
1937
  additionalModules: e.additionalModules ?? []
1749
1938
  };
1750
1939
  }
1751
- function Vn(e) {
1940
+ function fr(e) {
1752
1941
  let t = ee(e.trim() === "" ? {} : JSON.parse(e));
1753
1942
  if (!t.ok) throw Error(t.error);
1754
1943
  return t.document;
1755
1944
  }
1756
- function Hn(e, t, n) {
1945
+ function pr(e, t, n) {
1757
1946
  let r = e.get("eventBus"), i = e.get("canvas"), a = e.get("elementRegistry"), o = e.get("selection"), s = /* @__PURE__ */ new Set(), c = 0, l = !1, u = "", d = {
1758
- notation: Ln,
1759
- apiVersion: Se,
1947
+ notation: cr,
1948
+ apiVersion: Te,
1760
1949
  editable: t
1761
1950
  };
1762
1951
  t && r.on("commandStack.changed", () => {
@@ -1766,15 +1955,15 @@ function Hn(e, t, n) {
1766
1955
  return {
1767
1956
  meta: d,
1768
1957
  elements: {
1769
- list: () => l ? [] : a.getAll().filter(E).map(Wn),
1958
+ list: () => l ? [] : a.getAll().filter(E).map(hr),
1770
1959
  reveal(e) {
1771
1960
  if (l) return !1;
1772
1961
  let t = a.get(e);
1773
1962
  return E(t) ? (o.select(t), i.scrollToElement(t), !0) : !1;
1774
1963
  },
1775
- selection: () => l ? [] : Un(o.get()),
1964
+ selection: () => l ? [] : mr(o.get()),
1776
1965
  onSelection(e) {
1777
- let t = (t) => e(Un(t.newSelection ?? []));
1966
+ let t = (t) => e(mr(t.newSelection ?? []));
1778
1967
  return r.on("selection.changed", t), () => r.off("selection.changed", t);
1779
1968
  },
1780
1969
  bounds(e) {
@@ -1796,7 +1985,7 @@ function Hn(e, t, n) {
1796
1985
  },
1797
1986
  async importText(t) {
1798
1987
  if (l) throw Error("The modeler was destroyed.");
1799
- let r = Vn(t);
1988
+ let r = fr(t);
1800
1989
  c += 1;
1801
1990
  try {
1802
1991
  let { warnings: t } = e.importDocument(r, { fit: n });
@@ -1819,13 +2008,13 @@ function Hn(e, t, n) {
1819
2008
  width: n,
1820
2009
  height: r
1821
2010
  };
1822
- return Gn(a) ? a : void 0;
2011
+ return gr(a) ? a : void 0;
1823
2012
  } catch {
1824
2013
  return;
1825
2014
  }
1826
2015
  },
1827
2016
  setViewState(e) {
1828
- !l && Gn(e) && i.viewbox({
2017
+ !l && gr(e) && i.viewbox({
1829
2018
  x: e.x,
1830
2019
  y: e.y,
1831
2020
  width: e.width,
@@ -1847,25 +2036,420 @@ function Hn(e, t, n) {
1847
2036
  }
1848
2037
  };
1849
2038
  }
1850
- function Un(e) {
2039
+ function mr(e) {
1851
2040
  return e.filter(E).map((e) => e.id);
1852
2041
  }
1853
- function Wn(e) {
2042
+ function hr(e) {
1854
2043
  let t = e.ttLabel;
1855
2044
  return t ? {
1856
2045
  id: e.id,
1857
2046
  name: t
1858
2047
  } : { id: e.id };
1859
2048
  }
1860
- function Gn(e) {
2049
+ function gr(e) {
1861
2050
  if (typeof e != "object" || !e) return !1;
1862
2051
  let { x: t, y: n, width: r, height: i } = e;
1863
- return $(t) && $(n) && $(r) && $(i) && r > 0 && i > 0;
2052
+ return X(t) && X(n) && X(r) && X(i) && r > 0 && i > 0;
1864
2053
  }
1865
- function $(e) {
2054
+ function X(e) {
1866
2055
  return typeof e == "number" && Number.isFinite(e);
1867
2056
  }
1868
- //#endregion
1869
- export { we as CD_TOKENS, G as GEIST_UNICODE_RANGES, Pt as ICON_DOWNLOAD, Dt as ICON_LINK, Nt as ICON_MAXIMIZE, At as ICON_MENU, Ot as ICON_MESSAGE_SQUARE_PLUS, jt as ICON_MINUS, Tt as ICON_PENCIL, Mt as ICON_PLUS, kt as ICON_SQUARE_DASHED_MOUSE_POINTER, Et as ICON_TRASH, Ft as ICON_X, M as MIRAGON, In as Modeler, K as NavigatedViewer, X as READ_ONLY_CHANGED_EVENT, F as ROOT_ID, Ln as TEAM_TOPOLOGIES_NOTATION, qe as TeamTopologiesRenderer, Ct as TtAssociationBehavior, Ae as TtBaseViewer, fn as TtContextPadProvider, je as TtElementFactory, Qe as TtExporter, St as TtFlatModelBehavior, Ze as TtImporter, Dn as TtKeyboard, _n as TtLabelEditing, _t as TtLayouter, gt as TtModeling, rn as TtPaletteProvider, cn as TtReadOnly, bt as TtRules, at as TtViewport, Pn as TtZOrder, lt as Viewer, Gt as annotationIconSvg, Rn as createCollaborativeModeler, zn as createCollaborativeViewer, st as embedSvgStyles, Wt as flowIconSvg, ot as geistFontFaceCss, J as iconMarkup, qt as interactionIconSvg, ct as ioModule, A as isTtAnnotation, j as isTtAssociation, E as isTtElement, k as isTtFlow, O as isTtInteraction, D as isTtTeam, Vn as parseDocumentText, Oe as saveSVG, Ut as teamIconSvg, wt as ttBehaviorsModule, pn as ttContextPadModule, Xe as ttDrawModule, Q as ttKeyboardModule, vn as ttLabelEditingModule, Me as ttModelModule, vt as ttModelingModule, an as ttPaletteModule, ln as ttReadOnlyModule, xt as ttRulesModule, Fn as ttZOrderModule };
2057
+ // src/chrome/menu.ts
2058
+ var Z = "Export as JSON", _r = "?";
2059
+ function vr(e, t, n, r) {
2060
+ return {
2061
+ kind: "action",
2062
+ id: e,
2063
+ label: t,
2064
+ ...r ? { icon: r } : {},
2065
+ ...n.shortcut ? { shortcut: n.shortcut } : {},
2066
+ onSelect: () => n.onSelect()
2067
+ };
2068
+ }
2069
+ function yr(e) {
2070
+ let { editTitle: t, exports: n, shortcutsKey: r } = e;
2071
+ return {
2072
+ model: t ? [{
2073
+ kind: "dialog",
2074
+ id: "diagram-title",
2075
+ label: "Diagram title…",
2076
+ onSelect: () => t()
2077
+ }] : [],
2078
+ export: [
2079
+ vr("export-png", "Export as PNG", n.png, "file-image"),
2080
+ vr("export-svg", "Export as SVG", n.svg, "file-code-corner"),
2081
+ ...n.json ? [vr("export-json", Z, n.json)] : []
2082
+ ],
2083
+ help: [{
2084
+ kind: "dialog",
2085
+ id: "keyboard-shortcuts",
2086
+ label: "Keyboard shortcuts…",
2087
+ icon: "keyboard",
2088
+ ...r ? { shortcut: r } : {},
2089
+ onSelect: () => e.showKeyboardShortcuts()
2090
+ }]
2091
+ };
2092
+ }
2093
+ // src/chrome/shortcuts.ts
2094
+ var br = [
2095
+ "←",
2096
+ "↑",
2097
+ "→",
2098
+ "↓"
2099
+ ];
2100
+ function xr(e) {
2101
+ let t = {
2102
+ style: "percent",
2103
+ maximumFractionDigits: 0
2104
+ };
2105
+ try {
2106
+ return new Intl.NumberFormat(e, t).format(1);
2107
+ } catch {
2108
+ return new Intl.NumberFormat("en", t).format(1);
2109
+ }
2110
+ }
2111
+ function Sr(e, t) {
2112
+ if (e === "mac") return {
2113
+ zoomIn: "⌘+",
2114
+ zoomOut: "⌘−",
2115
+ zoomToActual: "⌘0",
2116
+ fit: "⇧1"
2117
+ };
2118
+ let { ctrl: n, shift: r, plus: i, minus: a } = t;
2119
+ return {
2120
+ zoomIn: `${n}+${i}`,
2121
+ zoomOut: `${n}+${a}`,
2122
+ zoomToActual: `${n}+0`,
2123
+ fit: `${r}+1`
2124
+ };
2125
+ }
2126
+ function Cr(e, t) {
2127
+ if (e === "mac") return {
2128
+ undo: ["⌘Z"],
2129
+ redo: ["⌘⇧Z"],
2130
+ selectAll: ["⌘A"],
2131
+ copy: ["⌘C"],
2132
+ paste: ["⌘V"],
2133
+ remove: ["⌫"],
2134
+ coarseMove: br.map((e) => `⇧${e}`),
2135
+ shiftDrag: ["⇧ Drag"],
2136
+ shiftClick: ["⇧ Click"],
2137
+ newLine: ["⇧Enter"],
2138
+ open: ["⌘O"],
2139
+ save: ["⌘S"]
2140
+ };
2141
+ let { ctrl: n, shift: r } = t;
2142
+ return {
2143
+ undo: [`${n}+Z`],
2144
+ redo: [`${n}+${r}+Z`, `${n}+Y`],
2145
+ selectAll: [`${n}+A`],
2146
+ copy: [`${n}+C`],
2147
+ paste: [`${n}+V`],
2148
+ remove: ["Del", "Backspace"],
2149
+ coarseMove: br.map((e) => `${r}+${e}`),
2150
+ shiftDrag: [`${r}+Drag`],
2151
+ shiftClick: [`${r}+Click`],
2152
+ newLine: [`${r}+Enter`],
2153
+ open: [`${n}+O`],
2154
+ save: [`${n}+S`]
2155
+ };
2156
+ }
2157
+ function wr(e, t = {}) {
2158
+ let { platform: n, messages: r } = e, i = Sr(n, r.keyNames), a = Cr(n, r.keyNames), o = [
2159
+ {
2160
+ title: "View",
2161
+ rows: [
2162
+ {
2163
+ action: r.zoomIn,
2164
+ keys: [i.zoomIn]
2165
+ },
2166
+ {
2167
+ action: r.zoomOut,
2168
+ keys: [i.zoomOut]
2169
+ },
2170
+ {
2171
+ action: r.zoomToActual(xr(e.lang)),
2172
+ keys: [i.zoomToActual]
2173
+ },
2174
+ {
2175
+ action: r.fit,
2176
+ keys: [i.fit]
2177
+ },
2178
+ ...t.fileKeys ? [{
2179
+ action: "Keyboard shortcuts",
2180
+ keys: ["?"]
2181
+ }] : []
2182
+ ]
2183
+ },
2184
+ {
2185
+ title: "Edit",
2186
+ rows: [
2187
+ {
2188
+ action: "Undo",
2189
+ keys: a.undo
2190
+ },
2191
+ {
2192
+ action: "Redo",
2193
+ keys: a.redo
2194
+ },
2195
+ {
2196
+ action: "Select all",
2197
+ keys: a.selectAll
2198
+ },
2199
+ {
2200
+ action: "Copy",
2201
+ keys: a.copy
2202
+ },
2203
+ {
2204
+ action: "Paste",
2205
+ keys: a.paste
2206
+ },
2207
+ {
2208
+ action: "Delete",
2209
+ keys: a.remove
2210
+ },
2211
+ {
2212
+ action: "Move selection",
2213
+ keys: br
2214
+ },
2215
+ {
2216
+ action: "Move selection in large steps",
2217
+ keys: a.coarseMove
2218
+ },
2219
+ {
2220
+ action: "Clear the selection",
2221
+ keys: ["Esc"]
2222
+ }
2223
+ ]
2224
+ },
2225
+ {
2226
+ title: "Tools",
2227
+ rows: [
2228
+ {
2229
+ action: "Select several elements",
2230
+ keys: a.shiftDrag
2231
+ },
2232
+ {
2233
+ action: "Add to or remove from the selection",
2234
+ keys: a.shiftClick
2235
+ },
2236
+ {
2237
+ action: "Add the palette element in the middle",
2238
+ keys: ["Enter", "Space"]
2239
+ },
2240
+ {
2241
+ action: "Edit a name or text",
2242
+ keys: ["Double-click"]
2243
+ },
2244
+ {
2245
+ action: "Save the text",
2246
+ keys: ["Enter"]
2247
+ },
2248
+ {
2249
+ action: "Start a new line",
2250
+ keys: a.newLine
2251
+ },
2252
+ {
2253
+ action: "Discard the change",
2254
+ keys: ["Esc"]
2255
+ }
2256
+ ]
2257
+ }
2258
+ ];
2259
+ return t.fileKeys && o.unshift({
2260
+ title: "File",
2261
+ rows: [{
2262
+ action: r.openFile ?? "Open…",
2263
+ keys: a.open
2264
+ }, {
2265
+ action: Z,
2266
+ keys: a.save
2267
+ }]
2268
+ }), o;
2269
+ }
2270
+ // src/chrome/dialog.ts
2271
+ function Q(e, t, n) {
2272
+ let r = document.createElement(e);
2273
+ return r.className = t, n !== void 0 && (r.textContent = n), r;
2274
+ }
2275
+ function Tr(e, t, n) {
2276
+ let r = Q("header", "tt-dialog__header"), i = Q("h2", "tt-dialog__title", t.title);
2277
+ i.id = t.titleId;
2278
+ let a = Q("button", "tt-dialog__close");
2279
+ return a.type = "button", a.setAttribute("aria-label", e.messages.close), a.innerHTML = K(Gt), a.addEventListener("click", n), r.append(i, a), r;
2280
+ }
2281
+ function Er(e) {
2282
+ return e instanceof HTMLElement || e instanceof SVGElement ? e.isConnected && e !== e.ownerDocument.body : !1;
2283
+ }
2284
+ function Dr(e, t) {
2285
+ let n, r = null;
2286
+ function i() {
2287
+ let t = r;
2288
+ r = null, Er(t) && (t.focus({ preventScroll: !0 }), t.ownerDocument.activeElement === t) || e.menu.trigger.hidden || e.menu.trigger.focus({ preventScroll: !0 });
2289
+ }
2290
+ function a() {
2291
+ let n = Q("dialog", `tt-dialog ${t.className}`);
2292
+ n.setAttribute("aria-labelledby", t.titleId);
2293
+ let r = () => n.close(), a = Q("div", "tt-dialog__panel");
2294
+ a.append(Tr(e, t, r), ...t.content(r)), n.append(a);
2295
+ let o = !1;
2296
+ return n.addEventListener("pointerdown", (e) => {
2297
+ o = e.target === n;
2298
+ }), n.addEventListener("click", (e) => {
2299
+ e.target === n && o && n.close(), o = !1;
2300
+ }), n.addEventListener("close", i), e.root.append(n), n;
2301
+ }
2302
+ return {
2303
+ open() {
2304
+ n ??= a(), !n.open && (r = n.ownerDocument.activeElement, t.beforeOpen?.(), n.showModal(), t.afterOpen?.());
2305
+ },
2306
+ close() {
2307
+ n?.close();
2308
+ },
2309
+ isOpen: () => n?.open === !0,
2310
+ destroy() {
2311
+ n?.remove(), n = void 0, r = null;
2312
+ }
2313
+ };
2314
+ }
2315
+ // src/chrome/ShortcutsDialog.ts
2316
+ var $ = "tt-shortcuts", Or = "tt-shortcuts-title";
2317
+ function kr(e, t) {
2318
+ let n = Q("section", `${$}__group`), r = `${Or}-group-${t}`, i = Q("h3", `${$}__group-title`, e.title);
2319
+ i.id = r;
2320
+ let a = Q("table", `${$}__table`);
2321
+ a.setAttribute("aria-labelledby", r);
2322
+ let o = a.createTBody();
2323
+ for (let t of e.rows) {
2324
+ let e = o.insertRow(), n = Q("th", `${$}__action`, t.action);
2325
+ n.scope = "row";
2326
+ let r = Q("td", `${$}__keys`);
2327
+ for (let e of t.keys) r.append(Q("kbd", `${$}__key`, e));
2328
+ e.append(n, r);
2329
+ }
2330
+ return n.append(i, a), n;
2331
+ }
2332
+ function Ar(e, t = {}) {
2333
+ return Dr(e, {
2334
+ className: $,
2335
+ titleId: Or,
2336
+ title: "Keyboard shortcuts",
2337
+ content() {
2338
+ let n = Q("div", `tt-dialog__body ${$}__body`);
2339
+ return n.append(...wr(e, t).map(kr)), [n];
2340
+ }
2341
+ });
2342
+ }
2343
+ // src/chrome/TitleDialog.ts
2344
+ var jr = "tt-title-dialog", Mr = "tt-title-dialog-title", Nr = "tt-title-dialog-field";
2345
+ function Pr(e, t) {
2346
+ let n = Q("button", t ? "tt-dialog__button tt-dialog__button--primary" : "tt-dialog__button", e);
2347
+ return n.type = t ? "submit" : "button", n;
2348
+ }
2349
+ function Fr(e, t) {
2350
+ let n = Q("input", "tt-dialog__input");
2351
+ n.id = Nr, n.type = "text", n.autocomplete = "off", n.spellcheck = !1, n.enterKeyHint = "done", n.autofocus = !0;
2352
+ let r = Pr("Apply", !0), i = () => {
2353
+ r.disabled = n.value.trim() === "";
2354
+ };
2355
+ return n.addEventListener("input", i), Dr(e, {
2356
+ className: jr,
2357
+ titleId: Mr,
2358
+ title: "Diagram title",
2359
+ beforeOpen() {
2360
+ n.value = t.title(), i();
2361
+ },
2362
+ afterOpen() {
2363
+ n.select();
2364
+ },
2365
+ content(e) {
2366
+ let i = Q("form", "tt-dialog__form");
2367
+ i.noValidate = !0;
2368
+ let a = Q("div", "tt-dialog__body"), o = Q("label", "tt-dialog__field"), s = Q("span", "tt-dialog__label", "Title");
2369
+ o.htmlFor = Nr, o.append(s, n), a.append(o);
2370
+ let c = Q("div", "tt-dialog__footer"), l = Pr("Cancel", !1);
2371
+ return l.addEventListener("click", e), c.append(l, r), i.append(a, c), i.addEventListener("submit", (r) => {
2372
+ r.preventDefault();
2373
+ let i = n.value.trim();
2374
+ i !== "" && (e(), i !== t.title() && t.setTitle(i));
2375
+ }), [i];
2376
+ }
2377
+ });
2378
+ }
2379
+ // src/legend/legendContent.ts
2380
+ var Ir = {
2381
+ "stream-aligned": "Delivers one stream of work",
2382
+ enabling: "Coaches teams in new skills",
2383
+ "complicated-subsystem": "Owns a specialist subsystem",
2384
+ platform: "Self-service for other teams"
2385
+ }, Lr = {
2386
+ collaboration: "Teams work closely for a time",
2387
+ "x-as-a-service": "One provides, one consumes",
2388
+ facilitating: "One team helps another learn"
2389
+ };
2390
+ function Rr() {
2391
+ return [
2392
+ {
2393
+ label: "Team types",
2394
+ heading: "Teams: solid, long-lived",
2395
+ rows: n.map((e) => ({
2396
+ preview: $t(e.type),
2397
+ label: e.label,
2398
+ explanation: Ir[e.type]
2399
+ }))
2400
+ },
2401
+ {
2402
+ label: "Interaction modes",
2403
+ heading: "Interactions: dashed, short-lived",
2404
+ rows: t.map((e) => ({
2405
+ preview: rn(e.mode),
2406
+ label: e.label,
2407
+ explanation: Lr[e.mode]
2408
+ }))
2409
+ },
2410
+ {
2411
+ label: "Other elements",
2412
+ heading: "Other elements",
2413
+ rows: [{
2414
+ preview: en(),
2415
+ label: l.label,
2416
+ explanation: "Change flows left to right"
2417
+ }, {
2418
+ preview: tn(),
2419
+ label: i.label,
2420
+ explanation: "Rationale, questions, plans"
2421
+ }]
2422
+ }
2423
+ ];
2424
+ }
2425
+ function zr(e) {
2426
+ let t = e.ownerDocument, n = [];
2427
+ return Rr().forEach((e, r) => {
2428
+ if (r > 0) {
2429
+ let e = t.createElement("div");
2430
+ e.className = "cd-shell-legend-separator tt-legend__separator", e.setAttribute("role", "separator"), n.push(e);
2431
+ }
2432
+ let i = t.createElement("p");
2433
+ i.className = "tt-legend__heading", i.textContent = e.heading;
2434
+ let a = t.createElement("ul");
2435
+ a.className = "tt-legend__group", a.setAttribute("aria-label", e.label);
2436
+ for (let n of e.rows) {
2437
+ let e = t.createElement("li");
2438
+ e.className = "cd-shell-legend-row tt-legend__row";
2439
+ let r = t.createElement("span");
2440
+ r.className = "cd-shell-legend-preview tt-legend__preview", r.setAttribute("aria-hidden", "true"), r.innerHTML = n.preview;
2441
+ let i = t.createElement("span");
2442
+ i.className = "tt-legend__text";
2443
+ let o = t.createElement("span");
2444
+ o.className = "tt-legend__label", o.textContent = n.label;
2445
+ let s = t.createElement("span");
2446
+ s.className = "tt-legend__explanation", s.textContent = n.explanation, i.append(o, " ", s), e.append(r, i), a.append(e);
2447
+ }
2448
+ n.push(i, a);
2449
+ }), e.append(...n), () => {
2450
+ for (let e of n.splice(0)) e.remove();
2451
+ };
2452
+ }
2453
+ export { Ee as CD_TOKENS, U as GEIST_UNICODE_RANGES, Wt as ICON_DOWNLOAD, Lt as ICON_LINK, Ut as ICON_MAXIMIZE, Bt as ICON_MENU, Rt as ICON_MESSAGE_SQUARE_PLUS, Vt as ICON_MINUS, Ft as ICON_PENCIL, Ht as ICON_PLUS, zt as ICON_SQUARE_DASHED_MOUSE_POINTER, It as ICON_TRASH, Gt as ICON_X, Z as JSON_EXPORT_LABEL, w as MIRAGON, sr as Modeler, W as NavigatedViewer, J as READ_ONLY_CHANGED_EVENT, B as ROOT_ID, _r as SHORTCUTS_DIALOG_KEY, cr as TEAM_TOPOLOGIES_NOTATION, lt as TeamTopologiesRenderer, Nt as TtAssociationBehavior, ot as TtBaseViewer, In as TtContextPadProvider, st as TtElementFactory, mt as TtExporter, Mt as TtFlatModelBehavior, pt as TtImporter, Zn as TtKeyboard, Hn as TtLabelEditing, Dt as TtLayouter, Et as TtModeling, gn as TtPaletteProvider, jn as TtReadOnly, At as TtRules, Qe as TtViewport, ar as TtZOrder, yt as Viewer, tn as annotationIconSvg, lr as createCollaborativeModeler, ur as createCollaborativeViewer, Ar as createShortcutsDialog, Fr as createTitleDialog, yr as diagramMenu, wr as diagramShortcuts, _t as embedSvgStyles, en as flowIconSvg, gt as geistFontFaceCss, K as iconMarkup, rn as interactionIconSvg, vt as ioModule, A as isTtAnnotation, j as isTtAssociation, E as isTtElement, k as isTtFlow, O as isTtInteraction, D as isTtTeam, Rr as legendGroups, fr as parseDocumentText, zr as renderLegend, it as saveSVG, $t as teamIconSvg, Pt as ttBehaviorsModule, Ln as ttContextPadModule, ft as ttDrawModule, Qn as ttKeyboardModule, Un as ttLabelEditingModule, ct as ttModelModule, Ot as ttModelingModule, xn as ttPaletteModule, Mn as ttReadOnlyModule, jt as ttRulesModule, or as ttZOrderModule };
1870
2454
 
1871
2455
  //# sourceMappingURL=index.js.map