@miragon/team-topologies-renderer 0.11.2 → 0.13.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.
package/dist/index.js CHANGED
@@ -7,55 +7,55 @@ 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 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/connect";
22
- import ye from "diagram-js/lib/features/connection-preview";
23
- import be from "diagram-js/lib/features/context-pad";
24
- import xe from "diagram-js/lib/features/copy-paste";
25
- import Se from "diagram-js/lib/features/copy-paste/CopyPaste.js";
26
- import { MODELER_API_VERSION as Ce } from "@miragon/modeler-api";
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
27
  //#region src/model/di-types.ts
28
- var we = /* @__PURE__ */ new Set([
28
+ var Ce = /* @__PURE__ */ new Set([
29
29
  "team",
30
30
  "interaction",
31
31
  "flow",
32
32
  "annotation"
33
33
  ]);
34
- function w(e) {
35
- return typeof e == "object" && e ? e.ttKind : void 0;
36
- }
37
34
  function T(e) {
38
- let t = w(e);
39
- return t !== void 0 && we.has(t);
35
+ return typeof e == "object" && e ? e.ttKind : void 0;
40
36
  }
41
37
  function E(e) {
42
- return w(e) === "team";
38
+ let t = T(e);
39
+ return t !== void 0 && Ce.has(t);
43
40
  }
44
41
  function D(e) {
45
- return w(e) === "interaction";
42
+ return T(e) === "team";
46
43
  }
47
44
  function O(e) {
48
- return w(e) === "flow";
45
+ return T(e) === "interaction";
49
46
  }
50
47
  function k(e) {
51
- return w(e) === "annotation";
48
+ return T(e) === "flow";
52
49
  }
53
50
  function A(e) {
54
- return w(e) === "association";
51
+ return T(e) === "annotation";
52
+ }
53
+ function j(e) {
54
+ return T(e) === "association";
55
55
  }
56
56
  //#endregion
57
57
  //#region src/theme/palette.ts
58
- var j = {
58
+ var M = {
59
59
  blau: "#335DE5",
60
60
  blauLink: "#2B50D4",
61
61
  blauHell: "#6B8AFF",
@@ -79,31 +79,31 @@ var j = {
79
79
  dangerHell: "#FB6D73",
80
80
  infoHell: "#6B8AFF",
81
81
  gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
82
- }, Te = {
83
- "--cd-blau": j.blau,
84
- "--cd-gruen": j.gruen,
85
- "--cd-grau": j.grau,
86
- "--cd-schwarz": j.schwarz,
87
- "--cd-weiss": j.weiss,
88
- "--cd-blau-link": j.blauLink,
89
- "--cd-blau-hell": j.blauHell,
90
- "--cd-linie": j.linie,
91
- "--cd-kontur": j.kontur,
92
- "--cd-text-leise": j.textLeise,
93
- "--cd-success": j.success,
94
- "--cd-success-soft": j.successSoft,
95
- "--cd-warning": j.warning,
96
- "--cd-warning-soft": j.warningSoft,
97
- "--cd-danger": j.danger,
98
- "--cd-danger-soft": j.dangerSoft,
99
- "--cd-info": j.info,
100
- "--cd-info-soft": j.infoSoft,
101
- "--cd-success-hell": j.successHell,
102
- "--cd-warning-hell": j.warningHell,
103
- "--cd-danger-hell": j.dangerHell,
104
- "--cd-info-hell": j.infoHell,
105
- "--cd-gradient-brand": j.gradientBrand
106
- }, M = 40, Ee = "http://www.w3.org/2000/svg", De = [
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
107
  ".djs-outline",
108
108
  ".djs-resizer",
109
109
  ".djs-selection-outline",
@@ -111,40 +111,40 @@ var j = {
111
111
  ".djs-dragger",
112
112
  ".djs-bendpoint",
113
113
  ".djs-segment-dragger"
114
- ].join(", "), Oe = ["selected", "hover"], ke = [
114
+ ].join(", "), Ee = ["selected", "hover"], De = [
115
115
  "class",
116
116
  "tabindex",
117
117
  "role",
118
118
  "aria-roledescription",
119
119
  "aria-label"
120
120
  ];
121
- function Ae(e, t) {
121
+ function Oe(e, t) {
122
122
  let n = e.getContainer().querySelector(":scope > svg");
123
123
  if (!n) throw Error("No SVG found in the canvas container.");
124
124
  let r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
125
125
  for (let e of t.getAll()) {
126
- if (!T(e)) continue;
126
+ if (!E(e)) continue;
127
127
  let t = e;
128
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
129
  }
130
130
  Number.isFinite(r) || (r = 0, i = 0, a = 100, o = 100);
131
- let s = r - M, c = i - M, l = a - r + 80, u = o - i + 80, d = n.cloneNode(!0);
132
- for (let e of ke) d.removeAttribute(e);
133
- for (let e of d.querySelectorAll(De)) e.remove();
134
- for (let e of d.querySelectorAll(Oe.map((e) => `.${e}`).join())) e.classList.remove(...Oe);
135
- d.setAttribute("xmlns", Ee), d.setAttribute("viewBox", `${s} ${c} ${l} ${u}`), d.setAttribute("width", String(Math.round(l))), d.setAttribute("height", String(Math.round(u)));
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
136
  let f = d.querySelector(".viewport");
137
137
  f && f.removeAttribute("transform");
138
- let p = d.ownerDocument.createElementNS(Ee, "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", j.weiss), d.insertBefore(p, d.firstChild), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(d) };
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
140
  }
141
141
  //#endregion
142
142
  //#region src/io/types.ts
143
- var N = a, P = "tt-canvas-keyboard-focus";
144
- function je(e) {
143
+ var F = a, I = "tt-canvas-keyboard-focus";
144
+ function ke(e) {
145
145
  return typeof e == "number" ? `${e}px` : e;
146
146
  }
147
- var Me = class {
147
+ var Ae = class {
148
148
  _diagram;
149
149
  _container;
150
150
  _options;
@@ -153,7 +153,7 @@ var Me = class {
153
153
  }
154
154
  _createContainer(e) {
155
155
  let t = e.container ?? document.createElement("div");
156
- return t.classList.add("tt-djs-container"), t.style.width = je(e.width ?? "100%"), t.style.height = je(e.height ?? (e.container ? "100%" : "600px")), t;
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;
157
157
  }
158
158
  _ensureDiagram() {
159
159
  if (!this._diagram) {
@@ -162,7 +162,10 @@ var Me = class {
162
162
  canvas: { container: this._container },
163
163
  modules: t,
164
164
  ttKeyboard: { undoRedoKeys: this._options.undoRedoKeys ?? !0 },
165
- ttPalette: { freeRectCenter: this._options.freeRectCenter }
165
+ ttPalette: {
166
+ freeArea: this._options.freeArea,
167
+ freeRectCenter: this._options.freeRectCenter
168
+ }
166
169
  }), this._describeCanvas(this._diagram);
167
170
  }
168
171
  return this._diagram;
@@ -174,9 +177,9 @@ var Me = class {
174
177
  let r = t.ownerDocument, i = !1, a = (e) => {
175
178
  i = e.key === "Tab";
176
179
  }, o = () => {
177
- i = !1, n.classList.remove(P);
180
+ i = !1, n.classList.remove(I);
178
181
  };
179
- r.addEventListener("keydown", a, !0), r.addEventListener("pointerdown", o, !0), n.addEventListener("focusin", () => n.classList.toggle(P, i)), n.addEventListener("focusout", () => n.classList.remove(P)), e.get("eventBus").on("diagram.destroy", () => {
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", () => {
180
183
  r.removeEventListener("keydown", a, !0), r.removeEventListener("pointerdown", o, !0);
181
184
  });
182
185
  }
@@ -204,6 +207,15 @@ var Me = class {
204
207
  let e = this._ensureDiagram().get("ttViewport", !1);
205
208
  e ? e.fit() : this.get("canvas").zoom("fit-viewport");
206
209
  }
210
+ contentBounds() {
211
+ let e = this._diagram?.get("ttViewport", !1)?.contentBounds();
212
+ return e && {
213
+ x: e.minX,
214
+ y: e.minY,
215
+ width: e.maxX - e.minX,
216
+ height: e.maxY - e.minY
217
+ };
218
+ }
207
219
  exportDocument() {
208
220
  return this.get("ttExporter").export();
209
221
  }
@@ -214,7 +226,7 @@ var Me = class {
214
226
  } catch {
215
227
  return;
216
228
  }
217
- if (!n || n.id !== N) return;
229
+ if (!n || n.id !== F) return;
218
230
  let r = n.businessObject ?? { title: "Untitled team topology" };
219
231
  n.businessObject = {
220
232
  ...r,
@@ -229,7 +241,7 @@ var Me = class {
229
241
  }
230
242
  }
231
243
  saveSVG() {
232
- return Ae(this.get("canvas"), this.get("elementRegistry"));
244
+ return Oe(this.get("canvas"), this.get("elementRegistry"));
233
245
  }
234
246
  attachTo(e) {
235
247
  e.appendChild(this._container), this.get("canvas").resized();
@@ -246,7 +258,7 @@ var Me = class {
246
258
  get container() {
247
259
  return this._container;
248
260
  }
249
- }, Ne = class {
261
+ }, je = class {
250
262
  elementFactory;
251
263
  static $inject = ["elementFactory"];
252
264
  constructor(e) {
@@ -365,18 +377,18 @@ var Me = class {
365
377
  ttKind: "association"
366
378
  });
367
379
  }
368
- }, Pe = { ttElementFactory: ["type", Ne] }, Fe = 1500, F = j.schwarz, Ie = j.textLeise, Le = j.kontur, I = {
380
+ }, Me = { ttElementFactory: ["type", je] }, Ne = 1500, L = M.schwarz, Pe = M.textLeise, Fe = M.kontur, R = {
369
381
  family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
370
382
  label: 13.5,
371
383
  small: 11,
372
384
  annotation: 12
373
- }, Re = 10, L = {
385
+ }, Ie = 10, z = {
374
386
  left: 10,
375
387
  right: 6,
376
388
  top: 6,
377
389
  bottom: 6
378
- }, R = 1.2, ze = 4.5;
379
- function z(e) {
390
+ }, B = 1.2, Le = .58, Re = 4.5;
391
+ function V(e) {
380
392
  if (typeof e != "string") return;
381
393
  let t = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
382
394
  if (!t) return;
@@ -387,7 +399,7 @@ function z(e) {
387
399
  r(4)
388
400
  ];
389
401
  }
390
- function Be(e, t, n) {
402
+ function ze(e, t, n) {
391
403
  let r = (r) => Math.round(e[r] * n + t[r] * (1 - n));
392
404
  return [
393
405
  r(0),
@@ -395,74 +407,74 @@ function Be(e, t, n) {
395
407
  r(2)
396
408
  ];
397
409
  }
398
- function B([e, t, n]) {
410
+ function Be([e, t, n]) {
399
411
  let r = (e) => {
400
412
  let t = e / 255;
401
413
  return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
402
414
  };
403
415
  return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
404
416
  }
405
- function V(e, t) {
406
- let [n, r] = [B(e), B(t)].sort((e, t) => t - e);
417
+ function Ve(e, t) {
418
+ let [n, r] = [Be(e), Be(t)].sort((e, t) => t - e);
407
419
  return (n + .05) / (r + .05);
408
420
  }
409
- function Ve(e, t = 1) {
410
- let n = z(e), r = z(F), i = z(j.weiss);
411
- if (!n || !r || !i) return F;
412
- let a = Be(n, i, t), o = V(r, a);
413
- return o >= ze ? F : V(i, a) > o ? j.weiss : F;
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;
414
426
  }
415
- function He(e) {
416
- if (D(e)) {
427
+ function Ue(e) {
428
+ if (O(e)) {
417
429
  let t = d[e.mode] ?? d.collaboration;
418
- return Ve(e.fill ?? t.fill, t.opacity);
430
+ return He(e.fill ?? t.fill, t.opacity);
419
431
  }
420
432
  let t = p[e.teamType] ?? p["stream-aligned"];
421
- return Ve(e.fill ?? t.fill);
433
+ return He(e.fill ?? t.fill);
422
434
  }
423
- function Ue(e, t) {
435
+ function We(e, t) {
424
436
  return Math.min(e * .16, t * 1.1);
425
437
  }
426
438
  function H(e) {
427
439
  let t = Math.max(e.width, 1), n = Math.max(e.height, 1);
428
- return k(e) ? {
440
+ return A(e) ? {
429
441
  box: {
430
- x: L.left,
431
- y: L.top,
432
- width: Math.max(t - L.left - L.right, 1),
433
- height: Math.max(n - L.top - L.bottom, 1)
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)
434
446
  },
435
447
  align: "left-top",
436
- fontSize: I.annotation,
448
+ fontSize: R.annotation,
437
449
  fontWeight: "400",
438
- fill: F
439
- } : O(e) ? {
450
+ fill: L
451
+ } : k(e) ? {
440
452
  box: {
441
- x: Re,
453
+ x: Ie,
442
454
  y: 0,
443
- width: t - Ue(t, n) - 20,
455
+ width: t - We(t, n) - 20,
444
456
  height: n
445
457
  },
446
458
  align: "center",
447
- fontSize: I.small,
459
+ fontSize: R.small,
448
460
  fontWeight: "600",
449
461
  letterSpacing: "0.06em",
450
- fill: Ie
462
+ fill: Pe
451
463
  } : {
452
464
  box: {
453
- x: Re,
465
+ x: Ie,
454
466
  y: 0,
455
467
  width: t - 20,
456
468
  height: n
457
469
  },
458
470
  align: "center",
459
- fontSize: D(e) ? I.small : I.label,
471
+ fontSize: O(e) ? R.small : R.label,
460
472
  fontWeight: "600",
461
- fill: He(e)
473
+ fill: Ue(e)
462
474
  };
463
475
  }
464
- function We(e, t, n) {
465
- let r = Math.max(4, Math.floor(t / (n * .58))), i = e.split(/\r?\n/), a = [];
476
+ function Ge(e, t, n) {
477
+ let r = Math.max(4, Math.floor(t / (n * Le))), i = e.split(/\r?\n/), a = [];
466
478
  for (let e of i) {
467
479
  let t = e.split(/\s+/).filter(Boolean), n = "";
468
480
  for (let e of t) {
@@ -475,33 +487,49 @@ function We(e, t, n) {
475
487
  for (; a.length > 0 && a[0] === "";) a.shift();
476
488
  return a;
477
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
+ }
478
506
  //#endregion
479
507
  //#region src/draw/TeamTopologiesRenderer.ts
480
- var Ge = class extends re {
508
+ var qe = class extends re {
481
509
  static $inject = ["eventBus"];
482
510
  constructor(e) {
483
- super(e, Fe);
511
+ super(e, Ne);
484
512
  }
485
513
  canRender(e) {
486
- return T(e) || A(e);
514
+ return E(e) || j(e);
487
515
  }
488
516
  drawShape(e, t) {
489
- if (E(t)) return this.drawTeam(e, t);
490
- if (D(t)) return this.drawInteraction(e, t);
491
- if (O(t)) return this.drawFlow(e, t);
492
- if (k(t)) return this.drawAnnotation(e, t);
517
+ if (D(t)) return this.drawTeam(e, t);
518
+ if (O(t)) return this.drawInteraction(e, t);
519
+ if (k(t)) return this.drawFlow(e, t);
520
+ if (A(t)) return this.drawAnnotation(e, t);
493
521
  let n = S(C("rect"), {
494
522
  width: t.width,
495
523
  height: t.height,
496
- fill: j.linie
524
+ fill: M.linie
497
525
  });
498
526
  return x(e, n), n;
499
527
  }
500
528
  drawConnection(e, t) {
501
529
  let n = S(C("path"), {
502
- d: qe(t.waypoints),
530
+ d: Ye(t.waypoints),
503
531
  fill: "none",
504
- stroke: Le,
532
+ stroke: Fe,
505
533
  "stroke-width": 1.5,
506
534
  "stroke-dasharray": "4 4",
507
535
  "stroke-linecap": "round"
@@ -513,7 +541,7 @@ var Ge = class extends re {
513
541
  return `M${t},${n}l${r},0l0,${i}l${-r},0z`;
514
542
  }
515
543
  getConnectionPath(e) {
516
- return qe(e.waypoints);
544
+ return Ye(e.waypoints);
517
545
  }
518
546
  drawTeam(e, t) {
519
547
  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, {
@@ -530,7 +558,7 @@ var Ge = class extends re {
530
558
  if (e === "octagon") {
531
559
  let e = Math.min(o, s) * .29;
532
560
  return S(C("polygon"), {
533
- points: Ke(a, o, s, e),
561
+ points: Je(a, o, s, e),
534
562
  ...i
535
563
  });
536
564
  }
@@ -577,7 +605,7 @@ var Ge = class extends re {
577
605
  return x(e, o), this.appendLabel(e, t.ttLabel ?? "", H(t)), o;
578
606
  }
579
607
  drawFlow(e, t) {
580
- 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 = [
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 = [
581
609
  [a, c],
582
610
  [n - o, c],
583
611
  [n - o, a],
@@ -599,20 +627,20 @@ var Ge = class extends re {
599
627
  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"), {
600
628
  d: `M${o},${a} L${a},${a} L${a},${r - a} L${o},${r - a}`,
601
629
  fill: "none",
602
- stroke: Le,
630
+ stroke: Fe,
603
631
  "stroke-width": i,
604
632
  "stroke-linejoin": "round"
605
633
  });
606
634
  return x(e, s), this.appendLabel(e, t.ttLabel ?? "", H(t)), s;
607
635
  }
608
636
  appendLabel(e, t, n) {
609
- let { box: r, fontSize: i } = n, a = We(t, r.width, i), o = i * R, 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;
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;
610
638
  a.forEach((t, r) => {
611
639
  if (!t) return;
612
640
  let a = S(C("text"), {
613
641
  x: c,
614
642
  y: l + r * o,
615
- "font-family": I.family,
643
+ "font-family": R.family,
616
644
  "font-size": i,
617
645
  fill: n.fill,
618
646
  "text-anchor": s ? "middle" : "start",
@@ -624,7 +652,7 @@ var Ge = class extends re {
624
652
  });
625
653
  }
626
654
  };
627
- function Ke(e, t, n, r) {
655
+ function Je(e, t, n, r) {
628
656
  return [
629
657
  [e + r, e],
630
658
  [e + t - r, e],
@@ -636,16 +664,16 @@ function Ke(e, t, n, r) {
636
664
  [e, e + r]
637
665
  ].map((e) => e.join(",")).join(" ");
638
666
  }
639
- function qe(e) {
667
+ function Ye(e) {
640
668
  return e.map((e, t) => `${t === 0 ? "M" : "L"}${e.x},${e.y}`).join(" ");
641
669
  }
642
670
  //#endregion
643
671
  //#region src/draw/index.ts
644
- var Je = {
672
+ var Xe = {
645
673
  __init__: ["ttRenderer"],
646
- ttRenderer: ["type", Ge],
674
+ ttRenderer: ["type", qe],
647
675
  connectionDocking: ["type", ne]
648
- }, Ye = class {
676
+ }, Ze = class {
649
677
  canvas;
650
678
  elementFactory;
651
679
  factory;
@@ -673,7 +701,7 @@ var Je = {
673
701
  n = void 0;
674
702
  }
675
703
  let r;
676
- n && n.id === N ? r = n : (r = this.elementFactory.createRoot({ id: N }), this.canvas.setRootElement(r));
704
+ n && n.id === F ? r = n : (r = this.elementFactory.createRoot({ id: F }), this.canvas.setRootElement(r));
677
705
  let i = _(e, o);
678
706
  r.businessObject = {
679
707
  title: e.title,
@@ -686,7 +714,7 @@ var Je = {
686
714
  for (let n of e.annotations) {
687
715
  if (!n.attachedTo) continue;
688
716
  let e = this.elementRegistry.get(n.id), i = this.elementRegistry.get(n.attachedTo);
689
- if (!T(i) || k(i)) {
717
+ if (!E(i) || A(i)) {
690
718
  t.push({
691
719
  message: `Annotation "${n.id}" is attached to unknown element "${n.attachedTo}"; its connector was dropped.`,
692
720
  elementId: n.id
@@ -705,7 +733,7 @@ var Je = {
705
733
  this.canvas.removeShape(e.id);
706
734
  } catch {}
707
735
  }
708
- }, Xe = class {
736
+ }, Qe = class {
709
737
  elementRegistry;
710
738
  canvas;
711
739
  static $inject = ["elementRegistry", "canvas"];
@@ -721,7 +749,7 @@ var Je = {
721
749
  }
722
750
  let t = [], n = [], i = [], a = [];
723
751
  for (let e of this.elementRegistry.getAll()) {
724
- if (e.id === N) continue;
752
+ if (e.id === F) continue;
725
753
  let o = e, s = {
726
754
  x: o.x,
727
755
  y: o.y
@@ -729,7 +757,7 @@ var Je = {
729
757
  width: o.width,
730
758
  height: o.height
731
759
  };
732
- if (E(e)) t.push(y({
760
+ if (D(e)) t.push(y({
733
761
  id: e.id,
734
762
  type: e.teamType,
735
763
  label: e.ttLabel ?? "",
@@ -739,7 +767,7 @@ var Je = {
739
767
  ...e.fill ? { fill: e.fill } : {},
740
768
  ...e.stroke ? { stroke: e.stroke } : {}
741
769
  }, e.ttForeign, f));
742
- else if (D(e)) n.push(y({
770
+ else if (O(e)) n.push(y({
743
771
  id: e.id,
744
772
  mode: e.mode,
745
773
  position: s,
@@ -748,14 +776,14 @@ var Je = {
748
776
  ...e.fill ? { fill: e.fill } : {},
749
777
  ...e.stroke ? { stroke: e.stroke } : {}
750
778
  }, e.ttForeign, u));
751
- else if (O(e)) i.push(y({
779
+ else if (k(e)) i.push(y({
752
780
  id: e.id,
753
781
  position: s,
754
782
  size: l,
755
783
  ...e.ttLabel ? { label: e.ttLabel } : {}
756
784
  }, e.ttForeign, c));
757
- else if (k(e)) {
758
- let t = Ze(e);
785
+ else if (A(e)) {
786
+ let t = $e(e);
759
787
  a.push(y({
760
788
  id: e.id,
761
789
  text: e.ttLabel ?? "",
@@ -775,13 +803,13 @@ var Je = {
775
803
  }, e?.foreign, o);
776
804
  }
777
805
  };
778
- function Ze(e) {
779
- let t = [...e.outgoing, ...e.incoming].find(A);
806
+ function $e(e) {
807
+ let t = [...e.outgoing, ...e.incoming].find(j);
780
808
  if (t) return (t.source === e ? t.target : t.source)?.id;
781
809
  }
782
810
  //#endregion
783
811
  //#region src/io/TtViewport.ts
784
- var Qe = 760, $e = 88, et = 120, U = 56, tt = 24, nt = 1, rt = class {
812
+ var et = 760, tt = 88, nt = 120, U = 56, rt = 24, it = 1, at = class {
785
813
  canvas;
786
814
  elementRegistry;
787
815
  static $inject = ["canvas", "elementRegistry"];
@@ -796,7 +824,7 @@ var Qe = 760, $e = 88, et = 120, U = 56, tt = 24, nt = 1, rt = class {
796
824
  this.canvas.zoom("fit-viewport");
797
825
  return;
798
826
  }
799
- let i = n <= Qe, a = i ? et : $e, o = i ? tt : 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, nt);
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);
800
828
  l > 0 ? this.canvas.viewbox({
801
829
  x: e.minX + s / 2 - n / 2 / l,
802
830
  y: this.viewboxTop(e, c, l, r, a, i),
@@ -810,10 +838,15 @@ var Qe = 760, $e = 88, et = 120, U = 56, tt = 24, nt = 1, rt = class {
810
838
  return e.minY - (i + s / 2) / n;
811
839
  }
812
840
  contentBounds() {
813
- let e = Infinity, t = Infinity, n = -Infinity, r = -Infinity;
814
- for (let i of this.elementRegistry.getAll()) {
815
- let a = i;
816
- typeof a.x == "number" && typeof a.y == "number" && typeof a.width == "number" && typeof a.height == "number" && (e = Math.min(e, a.x), t = Math.min(t, a.y), n = Math.max(n, a.x + a.width), r = Math.max(r, a.y + a.height));
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);
817
850
  }
818
851
  return Number.isFinite(e) ? {
819
852
  minX: e,
@@ -826,10 +859,10 @@ var Qe = 760, $e = 88, et = 120, U = 56, tt = 24, nt = 1, rt = class {
826
859
  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",
827
860
  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"
828
861
  };
829
- function it(e) {
862
+ function ot(e) {
830
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("");
831
864
  }
832
- function at(e, t) {
865
+ function st(e, t) {
833
866
  let n = new DOMParser().parseFromString(e, "image/svg+xml"), r = n.documentElement;
834
867
  if (r.namespaceURI !== W || n.querySelector("parsererror")) return e;
835
868
  let i = n.createElementNS(W, "defs"), a = n.createElementNS(W, "style");
@@ -837,19 +870,19 @@ function at(e, t) {
837
870
  }
838
871
  //#endregion
839
872
  //#region src/io/index.ts
840
- var ot = {
841
- ttImporter: ["type", Ye],
842
- ttExporter: ["type", Xe],
843
- ttViewport: ["type", rt]
844
- }, st = class extends Me {
873
+ var ct = {
874
+ ttImporter: ["type", Ze],
875
+ ttExporter: ["type", Qe],
876
+ ttViewport: ["type", at]
877
+ }, lt = class extends Ae {
845
878
  _getModules() {
846
879
  return [
847
- Pe,
848
- Je,
849
- ot
880
+ Me,
881
+ Xe,
882
+ ct
850
883
  ];
851
884
  }
852
- }, K = class extends st {
885
+ }, K = class extends lt {
853
886
  _getModules() {
854
887
  return [
855
888
  ...super._getModules(),
@@ -861,21 +894,21 @@ var ot = {
861
894
  };
862
895
  //#endregion
863
896
  //#region src/modeling/cmd/UpdatePropertiesHandler.ts
864
- function ct(e, t, n) {
897
+ function ut(e, t, n) {
865
898
  n === void 0 ? delete e[t] : e[t] = n;
866
899
  }
867
- var lt = class {
900
+ var dt = class {
868
901
  execute(e) {
869
902
  let { element: t, properties: n } = e, r = t, i = {};
870
- for (let e of Object.keys(n)) i[e] = r[e], ct(r, e, n[e]);
903
+ for (let e of Object.keys(n)) i[e] = r[e], ut(r, e, n[e]);
871
904
  return e.oldProperties = i, [t];
872
905
  }
873
906
  revert(e) {
874
907
  let { element: t, oldProperties: n } = e, r = t;
875
- if (n) for (let e of Object.keys(n)) ct(r, e, n[e]);
908
+ if (n) for (let e of Object.keys(n)) ut(r, e, n[e]);
876
909
  return [t];
877
910
  }
878
- }, q = "Untitled team topology", ut = class {
911
+ }, q = "Untitled team topology", ft = class {
879
912
  canvas;
880
913
  static $inject = ["canvas"];
881
914
  constructor(e) {
@@ -895,7 +928,7 @@ var lt = class {
895
928
  title: e.oldTitle ?? q
896
929
  }, [t];
897
930
  }
898
- }, dt = "element.updateProperties", ft = "tt.title.update", pt = 40, mt = class {
931
+ }, pt = "element.updateProperties", mt = "tt.title.update", ht = 40, gt = class {
899
932
  commandStack;
900
933
  modeling;
901
934
  factory;
@@ -907,13 +940,13 @@ var lt = class {
907
940
  "canvas"
908
941
  ];
909
942
  constructor(e, t, n, r) {
910
- this.commandStack = e, this.modeling = t, this.factory = n, this.canvas = r, e.registerHandler(dt, lt), e.registerHandler(ft, ut);
943
+ this.commandStack = e, this.modeling = t, this.factory = n, this.canvas = r, e.registerHandler(pt, dt), e.registerHandler(mt, ft);
911
944
  }
912
945
  setTitle(e) {
913
- this.commandStack.execute(ft, { title: e });
946
+ this.commandStack.execute(mt, { title: e });
914
947
  }
915
948
  updateProperties(e, t) {
916
- this.commandStack.execute(dt, {
949
+ this.commandStack.execute(pt, {
917
950
  element: e,
918
951
  properties: t
919
952
  });
@@ -938,8 +971,8 @@ var lt = class {
938
971
  }
939
972
  appendAnnotation(e) {
940
973
  let t = this.factory.createNewAnnotation(), n = {
941
- x: e.x + e.width + pt + t.width / 2,
942
- y: e.y - pt / 4
974
+ x: e.x + e.width + ht + t.width / 2,
975
+ y: e.y - ht / 4
943
976
  };
944
977
  return this.modeling.appendShape(e, t, n, this.canvas.getRootElement(), {
945
978
  connection: this.factory.createNewAssociation(),
@@ -947,45 +980,45 @@ var lt = class {
947
980
  });
948
981
  }
949
982
  detachAnnotation(e) {
950
- let t = [...e.incoming, ...e.outgoing].filter(A);
983
+ let t = [...e.incoming, ...e.outgoing].filter(j);
951
984
  t.length > 0 && this.modeling.removeElements(t);
952
985
  }
953
- }, ht = class extends fe {
986
+ }, _t = class extends de {
954
987
  layoutConnection(e, t = {}) {
955
988
  let n = t.source ?? e.source, r = t.target ?? e.target;
956
989
  return !n || !r ? super.layoutConnection(e, t) : [b(n), b(r)];
957
990
  }
958
- }, gt = {
959
- __depends__: [ce],
991
+ }, vt = {
992
+ __depends__: [se],
960
993
  __init__: ["ttModeling"],
961
- ttModeling: ["type", mt],
962
- layouter: ["type", ht]
994
+ ttModeling: ["type", gt],
995
+ layouter: ["type", _t]
963
996
  };
964
997
  //#endregion
965
998
  //#region src/rules/TtRules.ts
966
- function _t(e) {
967
- return T(e) && !k(e);
999
+ function yt(e) {
1000
+ return E(e) && !A(e);
968
1001
  }
969
- var vt = class extends me {
1002
+ var bt = class extends pe {
970
1003
  static $inject = ["eventBus"];
971
1004
  constructor(e) {
972
1005
  super(e);
973
1006
  }
974
1007
  init() {
975
- 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 }) => k(e) && _t(t) || k(t) && _t(e) ? { ttKind: "association" } : !1);
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);
976
1009
  }
977
- }, yt = {
978
- __depends__: [pe],
1010
+ }, xt = {
1011
+ __depends__: [fe],
979
1012
  __init__: ["ttRules"],
980
- ttRules: ["type", vt]
981
- }, bt = class extends he {
1013
+ ttRules: ["type", bt]
1014
+ }, St = class extends me {
982
1015
  static $inject = ["eventBus", "canvas"];
983
1016
  constructor(e, t) {
984
1017
  super(e), this.preExecute(["shape.create", "elements.create"], (e) => {
985
1018
  e.parent = t.getRootElement();
986
1019
  }, !0);
987
1020
  }
988
- }, xt = class extends he {
1021
+ }, Ct = class extends me {
989
1022
  static $inject = [
990
1023
  "eventBus",
991
1024
  "connectionDocking",
@@ -993,33 +1026,33 @@ var vt = class extends me {
993
1026
  ];
994
1027
  constructor(e, t, n) {
995
1028
  super(e), this.executed(["connection.layout", "connection.create"], (e) => {
996
- !e.cropped && A(e.connection) && (e.connection.waypoints = t.getCroppedWaypoints(e.connection), e.cropped = !0);
1029
+ !e.cropped && j(e.connection) && (e.connection.waypoints = t.getCroppedWaypoints(e.connection), e.cropped = !0);
997
1030
  }, !0), this.reverted("connection.layout", (e) => {
998
1031
  delete e.cropped;
999
1032
  }, !0), this.postExecuted("connection.create", (e) => {
1000
1033
  let t = e.connection;
1001
- if (!A(t)) return;
1002
- let r = k(t.source) ? t.source : t.target;
1003
- if (!k(r)) return;
1004
- let i = [...r.incoming, ...r.outgoing].filter((e) => e !== t && A(e));
1034
+ if (!j(t)) return;
1035
+ let r = A(t.source) ? t.source : t.target;
1036
+ if (!A(r)) return;
1037
+ let i = [...r.incoming, ...r.outgoing].filter((e) => e !== t && j(e));
1005
1038
  i.length > 0 && n.removeElements(i);
1006
1039
  }, !0);
1007
1040
  }
1008
- }, St = {
1041
+ }, wt = {
1009
1042
  __init__: ["ttFlatModelBehavior", "ttAssociationBehavior"],
1010
- ttFlatModelBehavior: ["type", bt],
1011
- ttAssociationBehavior: ["type", xt]
1012
- }, Ct = [["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" }]], wt = [
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 = [
1013
1046
  ["path", { d: "M10 11v6" }],
1014
1047
  ["path", { d: "M14 11v6" }],
1015
1048
  ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }],
1016
1049
  ["path", { d: "M3 6h18" }],
1017
1050
  ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }]
1018
- ], Tt = [["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" }]], Et = [
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 = [
1019
1052
  ["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" }],
1020
1053
  ["path", { d: "M12 8v6" }],
1021
1054
  ["path", { d: "M9 11h6" }]
1022
- ], Dt = [
1055
+ ], kt = [
1023
1056
  ["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" }],
1024
1057
  ["path", { d: "M5 3a2 2 0 0 0-2 2" }],
1025
1058
  ["path", { d: "M19 3a2 2 0 0 1 2 2" }],
@@ -1030,20 +1063,20 @@ var vt = class extends me {
1030
1063
  ["path", { d: "M3 9v1" }],
1031
1064
  ["path", { d: "M21 9v2" }],
1032
1065
  ["path", { d: "M3 14v1" }]
1033
- ], Ot = [
1066
+ ], At = [
1034
1067
  ["path", { d: "M4 5h16" }],
1035
1068
  ["path", { d: "M4 12h16" }],
1036
1069
  ["path", { d: "M4 19h16" }]
1037
- ], kt = [["path", { d: "M5 12h14" }]], At = [["path", { d: "M5 12h14" }], ["path", { d: "M12 5v14" }]], jt = [
1070
+ ], jt = [["path", { d: "M5 12h14" }]], Mt = [["path", { d: "M5 12h14" }], ["path", { d: "M12 5v14" }]], Nt = [
1038
1071
  ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3" }],
1039
1072
  ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3" }],
1040
1073
  ["path", { d: "M3 16v3a2 2 0 0 0 2 2h3" }],
1041
1074
  ["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3" }]
1042
- ], Mt = [
1075
+ ], Pt = [
1043
1076
  ["path", { d: "M12 15V3" }],
1044
1077
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }],
1045
1078
  ["path", { d: "m7 10 5 5 5-5" }]
1046
- ], Nt = [["path", { d: "M18 6 6 18" }], ["path", { d: "m6 6 12 12" }]], Pt = 2.5, Ft = 16, It = [
1079
+ ], Ft = [["path", { d: "M18 6 6 18" }], ["path", { d: "m6 6 12 12" }]], It = 2.5, Lt = 16, Rt = [
1047
1080
  "path",
1048
1081
  "circle",
1049
1082
  "ellipse",
@@ -1051,7 +1084,7 @@ var vt = class extends me {
1051
1084
  "polyline",
1052
1085
  "polygon",
1053
1086
  "rect"
1054
- ], Lt = [
1087
+ ], zt = [
1055
1088
  "d",
1056
1089
  "cx",
1057
1090
  "cy",
@@ -1068,33 +1101,33 @@ var vt = class extends me {
1068
1101
  "height",
1069
1102
  "points"
1070
1103
  ];
1071
- function Rt(e) {
1104
+ function Bt(e) {
1072
1105
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1073
1106
  }
1074
- function zt(e, t) {
1107
+ function Vt(e, t) {
1075
1108
  let n = Number(e);
1076
1109
  return Number.isFinite(n) && n > 0 ? n : t;
1077
1110
  }
1078
1111
  function J(e, t = {}) {
1079
- let n = zt(t.size, Ft), r = zt(t.strokeWidth, Pt);
1080
- return `<svg${t.className ? ` class="${Rt(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]) => {
1081
- let n = It.find((t) => t === e);
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);
1082
1115
  return n ? `<${n} ${Object.entries(t).flatMap(([e, t]) => {
1083
- let n = Lt.find((t) => t === e);
1084
- return n ? [`${n}="${Rt(String(t))}"`] : [];
1116
+ let n = zt.find((t) => t === e);
1117
+ return n ? [`${n}="${Bt(String(t))}"`] : [];
1085
1118
  }).join(" ")}/>` : "";
1086
1119
  }).join("")}</svg>`;
1087
1120
  }
1088
1121
  //#endregion
1089
1122
  //#region src/draw/palette-icons.ts
1090
- var Bt = {
1123
+ var Ht = {
1091
1124
  size: 20,
1092
1125
  strokeWidth: 2
1093
1126
  };
1094
1127
  function Y(e) {
1095
1128
  return `<svg class="tt-palette-svg" width="24" height="24" viewBox="0 0 26 26" aria-hidden="true">${e}</svg>`;
1096
1129
  }
1097
- function Vt(e) {
1130
+ function Ut(e) {
1098
1131
  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}"` : "");
1099
1132
  switch (t.shape) {
1100
1133
  case "octagon": return Y(`<polygon points="8,3 18,3 23,8 23,18 18,23 8,23 3,18 3,8" ${r}/>`);
@@ -1103,20 +1136,20 @@ function Vt(e) {
1103
1136
  default: return Y(`<rect x="3" y="8" width="20" height="10" rx="5" ${r}/>`);
1104
1137
  }
1105
1138
  }
1106
- function Ht() {
1139
+ function Wt() {
1107
1140
  let e = h(l.strokeStyle, 1.5);
1108
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>");
1109
1142
  }
1110
- function Ut() {
1143
+ function Gt() {
1111
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>");
1112
1145
  }
1113
- function Wt() {
1114
- return J(Dt, {
1115
- ...Bt,
1146
+ function Kt() {
1147
+ return J(kt, {
1148
+ ...Ht,
1116
1149
  className: "tt-palette-svg"
1117
1150
  });
1118
1151
  }
1119
- function Gt(e) {
1152
+ function qt(e) {
1120
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}"` : "");
1121
1154
  switch (t.shape) {
1122
1155
  case "circle": return Y(`<circle cx="13" cy="13" r="9" ${r}/>`);
@@ -1126,20 +1159,27 @@ function Gt(e) {
1126
1159
  }
1127
1160
  //#endregion
1128
1161
  //#region src/palette/TtPaletteProvider.ts
1129
- var Kt = "tools", qt = "tt-1-teams", Jt = "tt-2-modes", Yt = "tt-3-guides", Xt = 24;
1130
- function Zt(e, t = !0) {
1162
+ var Jt = "tools", Yt = "tt-1-teams", Xt = "tt-2-modes", Zt = "tt-3-guides", Qt = 24;
1163
+ function $t(e, t = !0) {
1131
1164
  return `<div class="entry tt-palette-entry" draggable="${t}">${e}</div>`;
1132
1165
  }
1133
- function Qt(e) {
1166
+ function en(e) {
1134
1167
  return e.type === "click" && e.detail === 0;
1135
1168
  }
1136
- function $t(e) {
1169
+ function tn(e) {
1137
1170
  return {
1138
1171
  x: e.x + e.width / 2,
1139
1172
  y: e.y + e.height / 2
1140
1173
  };
1141
1174
  }
1142
- var en = class {
1175
+ function nn(e, t) {
1176
+ 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
+ if (i > 0 && o > 0 && s > 0) return {
1178
+ x: n + (t.left + o / 2) / i,
1179
+ y: r + (t.top + s / 2) / i
1180
+ };
1181
+ }
1182
+ var rn = class {
1143
1183
  config;
1144
1184
  create;
1145
1185
  factory;
@@ -1168,23 +1208,23 @@ var en = class {
1168
1208
  getPaletteEntries() {
1169
1209
  let e = {};
1170
1210
  e["lasso-tool"] = {
1171
- group: Kt,
1211
+ group: Jt,
1172
1212
  title: "Select several elements",
1173
- html: Zt(Wt(), !1),
1213
+ html: $t(Kt(), !1),
1174
1214
  action: { click: (e) => this.lassoTool.activateSelection(e) }
1175
1215
  };
1176
- for (let t of n) e[`team.${t.type}`] = this.createEntry(qt, `${t.label} team`, Vt(t.type), () => this.factory.createNewTeam(t.type, t.label));
1177
- for (let n of t) e[`mode.${n.mode}`] = this.createEntry(Jt, `${n.label} interaction`, Gt(n.mode), () => this.factory.createNewInteraction(n.mode));
1178
- return e.flow = this.createEntry(Yt, l.label, Ht(), () => this.factory.createNewFlow()), e.annotation = this.createEntry(Yt, i.label, Ut(), () => this.factory.createNewAnnotation()), e;
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;
1179
1219
  }
1180
1220
  createEntry(e, t, n, r) {
1181
1221
  let i = (e) => {
1182
- Qt(e) ? this.placeInFreeRect(r()) : this.create.start(e, r());
1222
+ en(e) ? this.placeInFreeRect(r()) : this.create.start(e, r());
1183
1223
  };
1184
1224
  return {
1185
1225
  group: e,
1186
1226
  title: t,
1187
- html: Zt(n),
1227
+ html: $t(n),
1188
1228
  action: {
1189
1229
  dragstart: i,
1190
1230
  click: i
@@ -1192,33 +1232,37 @@ var en = class {
1192
1232
  };
1193
1233
  }
1194
1234
  freePlace() {
1195
- let e = this.canvas.viewbox(), t = this.config?.freeRectCenter?.() ?? {
1235
+ let e = this.canvas.viewbox(), t = this.freeAreaCentre() ?? {
1196
1236
  x: e.x + e.width / 2,
1197
1237
  y: e.y + e.height / 2
1198
1238
  }, n = {
1199
1239
  x: Math.round(t.x),
1200
1240
  y: Math.round(t.y)
1201
- }, r = () => this.elementRegistry.filter(T).some((e) => {
1202
- let t = $t(e);
1241
+ }, r = () => this.elementRegistry.filter(E).some((e) => {
1242
+ let t = tn(e);
1203
1243
  return Math.abs(t.x - n.x) < 1 && Math.abs(t.y - n.y) < 1;
1204
1244
  });
1205
- for (; r();) n.x += Xt, n.y += Xt;
1245
+ for (; r();) n.x += Qt, n.y += Qt;
1206
1246
  return n;
1207
1247
  }
1248
+ freeAreaCentre() {
1249
+ let e = this.config?.freeArea;
1250
+ return e?.center ? e.center() : e?.insets ? nn(this.canvas, e.insets()) : this.config?.freeRectCenter?.();
1251
+ }
1208
1252
  placeInFreeRect(e) {
1209
1253
  if (this.readOnly?.isReadOnly()) return;
1210
1254
  let t = this.modeling.createShape(e, this.freePlace(), this.canvas.getRootElement());
1211
- this.selection.select(t), this.canvas.focus(), T(t) && this.labelEditing?.activate(t);
1255
+ this.selection.select(t), this.canvas.focus(), E(t) && this.labelEditing?.activate(t);
1212
1256
  }
1213
- }, tn = {
1257
+ }, an = {
1214
1258
  __depends__: [
1259
+ he,
1215
1260
  ge,
1216
- _e,
1217
- se
1261
+ w
1218
1262
  ],
1219
1263
  __init__: ["ttPaletteProvider"],
1220
- ttPaletteProvider: ["type", en]
1221
- }, X = "tt.readOnly.changed", nn = 5e3, rn = [
1264
+ ttPaletteProvider: ["type", rn]
1265
+ }, X = "tt.readOnly.changed", on = 5e3, sn = [
1222
1266
  "elements.move",
1223
1267
  "shape.move",
1224
1268
  "shape.resize",
@@ -1230,7 +1274,7 @@ var en = class {
1230
1274
  "connection.reconnect",
1231
1275
  "connection.updateWaypoints",
1232
1276
  "elements.delete"
1233
- ], an = class extends me {
1277
+ ], cn = class extends pe {
1234
1278
  bus;
1235
1279
  static $inject = ["eventBus"];
1236
1280
  readOnly = !1;
@@ -1238,7 +1282,7 @@ var en = class {
1238
1282
  super(e), this.bus = e;
1239
1283
  }
1240
1284
  init() {
1241
- this.addRule(rn, nn, () => !this.readOnly && void 0);
1285
+ this.addRule(sn, on, () => !this.readOnly && void 0);
1242
1286
  }
1243
1287
  isReadOnly() {
1244
1288
  return this.readOnly;
@@ -1246,18 +1290,18 @@ var en = class {
1246
1290
  setReadOnly(e) {
1247
1291
  this.readOnly !== e && (this.readOnly = e, this.bus.fire(X, { readOnly: e }));
1248
1292
  }
1249
- }, on = {
1250
- __depends__: [pe],
1293
+ }, ln = {
1294
+ __depends__: [fe],
1251
1295
  __init__: ["ttReadOnly"],
1252
- ttReadOnly: ["type", an]
1253
- }, sn = ".djs-context-pad .entry[data-action]";
1296
+ ttReadOnly: ["type", cn]
1297
+ }, un = ".djs-context-pad .entry[data-action]";
1254
1298
  function Z(e, t, n = !0) {
1255
1299
  return `<div class="entry tt-cp-entry" role="button" tabindex="${n ? 0 : -1}" aria-label="${t}">${J(e)}</div>`;
1256
1300
  }
1257
- function cn(e) {
1258
- return k(e) ? "Edit text" : D(e) || O(e) ? "Edit label" : "Rename";
1301
+ function dn(e) {
1302
+ return A(e) ? "Edit text" : O(e) || k(e) ? "Edit label" : "Rename";
1259
1303
  }
1260
- var ln = class {
1304
+ var fn = class {
1261
1305
  contextPad;
1262
1306
  modeling;
1263
1307
  ttModeling;
@@ -1284,16 +1328,16 @@ var ln = class {
1284
1328
  }
1285
1329
  getContextPadEntries(e) {
1286
1330
  if (this.readOnly?.isReadOnly()) return {};
1287
- if (A(e)) return { delete: this.deleteEntry([e], "Delete connector") };
1288
- if (!T(e)) return {};
1289
- if (k(e)) {
1331
+ if (j(e)) return { delete: this.deleteEntry([e], "Delete connector") };
1332
+ if (!E(e)) return {};
1333
+ if (A(e)) {
1290
1334
  let t = (t) => this.connect.start(t, e);
1291
1335
  return {
1292
1336
  "edit-label": this.editEntry(e),
1293
1337
  connect: {
1294
1338
  group: "edit",
1295
1339
  title: "Attach to element",
1296
- html: Z(Tt, "Attach to element", !1),
1340
+ html: Z(Dt, "Attach to element", !1),
1297
1341
  action: {
1298
1342
  click: t,
1299
1343
  dragstart: t
@@ -1311,7 +1355,7 @@ var ln = class {
1311
1355
  "append-annotation": {
1312
1356
  group: "edit",
1313
1357
  title: "Add annotation",
1314
- html: Z(Et, "Add annotation"),
1358
+ html: Z(Ot, "Add annotation"),
1315
1359
  action: {
1316
1360
  click: t,
1317
1361
  keyboard: t
@@ -1325,15 +1369,15 @@ var ln = class {
1325
1369
  }
1326
1370
  onEntryKeyDown(e) {
1327
1371
  if (e.key !== "Enter" && e.key !== " " || e.repeat) return;
1328
- let t = (e.target?.closest?.(sn))?.getAttribute("data-action");
1372
+ let t = (e.target?.closest?.(un))?.getAttribute("data-action");
1329
1373
  t && (e.preventDefault(), e.stopPropagation(), this.contextPad.triggerEntry(t, "keyboard", e));
1330
1374
  }
1331
1375
  editEntry(e) {
1332
- let t = cn(e), n = () => this.labelEditing.activate(e);
1376
+ let t = dn(e), n = () => this.labelEditing.activate(e);
1333
1377
  return {
1334
1378
  group: "edit",
1335
1379
  title: t,
1336
- html: Z(Ct, t),
1380
+ html: Z(Tt, t),
1337
1381
  action: {
1338
1382
  click: n,
1339
1383
  keyboard: n
@@ -1344,7 +1388,7 @@ var ln = class {
1344
1388
  return {
1345
1389
  group: "edit",
1346
1390
  title: t,
1347
- html: Z(wt, t),
1391
+ html: Z(Et, t),
1348
1392
  action: {
1349
1393
  click: () => this.modeling.removeElements([...e]),
1350
1394
  keyboard: () => {
@@ -1353,19 +1397,19 @@ var ln = class {
1353
1397
  }
1354
1398
  };
1355
1399
  }
1356
- }, un = {
1400
+ }, pn = {
1357
1401
  __depends__: [
1358
- be,
1359
- ve,
1360
- ye
1402
+ ye,
1403
+ _e,
1404
+ ve
1361
1405
  ],
1362
1406
  __init__: ["ttContextPadProvider"],
1363
- ttContextPadProvider: ["type", ln]
1364
- }, dn = "tt-label-editing", fn = 96;
1365
- function pn(e) {
1366
- return k(e) ? "Annotation text" : D(e) ? "Interaction label" : O(e) ? "Flow label" : "Team name";
1407
+ ttContextPadProvider: ["type", fn]
1408
+ }, mn = "tt-label-editing", hn = 96;
1409
+ function gn(e) {
1410
+ return A(e) ? "Annotation text" : O(e) ? "Interaction label" : k(e) ? "Flow label" : "Team name";
1367
1411
  }
1368
- var mn = class {
1412
+ var _n = class {
1369
1413
  canvas;
1370
1414
  modeling;
1371
1415
  elementRegistry;
@@ -1382,12 +1426,8 @@ var mn = class {
1382
1426
  readOnly;
1383
1427
  constructor(e, t, n, r, i) {
1384
1428
  this.canvas = t, this.modeling = n, this.elementRegistry = r, this.readOnly = i.get("ttReadOnly", !1), e.on("element.dblclick", (e) => {
1385
- T(e.element) && this.activate(e.element);
1386
- }), e.on([
1387
- "element.mousedown",
1388
- "drag.init",
1389
- "canvas.viewbox.changing"
1390
- ], () => this.active?.commit()), e.on("import.render.start", () => this.cancel()), e.on(X, (e) => {
1429
+ 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) => {
1391
1431
  e.readOnly && this.cancel();
1392
1432
  }), e.on("diagram.destroy", () => {
1393
1433
  clearTimeout(this.resumeTimer), this.suspended = null, this.cancel();
@@ -1401,7 +1441,7 @@ var mn = class {
1401
1441
  let e = this.suspended;
1402
1442
  if (this.suspended = null, !e || this.active) return;
1403
1443
  let t = this.elementRegistry.get(e.elementId);
1404
- T(t) && this.activate(t, e);
1444
+ E(t) && this.activate(t, e);
1405
1445
  }, 0));
1406
1446
  }
1407
1447
  openEdit() {
@@ -1414,53 +1454,58 @@ var mn = class {
1414
1454
  }
1415
1455
  activate(e, t) {
1416
1456
  if (this.active?.commit(), this.readOnly?.isReadOnly()) return;
1417
- let n = H(e), r = n.align === "center", i = this.canvas.zoom(), a = this.canvas.viewbox(), o = r ? Math.max(n.box.width, fn) : n.box.width, s = e.x + n.box.x + (n.box.width - o) / 2, c = (e.y + n.box.y - a.y) * i, l = n.box.height * i, u = document.createElement("textarea");
1418
- u.className = "tt-label-editor", u.value = t ? t.value : e.ttLabel ?? "", u.rows = 1, u.setAttribute("aria-label", pn(e)), Object.assign(u.style, {
1419
- left: `${(s - a.x) * i}px`,
1420
- width: `${o * i}px`,
1421
- fontFamily: I.family,
1422
- fontSize: `${n.fontSize * i}px`,
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,
1423
1460
  fontWeight: n.fontWeight,
1424
1461
  letterSpacing: n.letterSpacing ?? "normal",
1425
- lineHeight: String(R),
1462
+ lineHeight: String(B),
1426
1463
  color: n.fill,
1427
1464
  textAlign: r ? "center" : "left"
1428
1465
  });
1429
- let d = () => {
1430
- u.style.height = "0px";
1431
- let e = u.scrollHeight;
1432
- u.style.height = `${r ? e : Math.max(e, l)}px`, u.style.top = `${r ? c + (l - e) / 2 : c}px`;
1466
+ let s = 0, c = 0, l = () => {
1467
+ o.style.height = "0px";
1468
+ let e = o.scrollHeight;
1469
+ o.style.height = `${r ? e : Math.max(e, c)}px`, o.style.top = `${r ? s + (c - e) / 2 : s}px`;
1470
+ }, u = () => {
1471
+ let t = this.canvas.zoom(), r = this.canvas.viewbox();
1472
+ s = (e.y + n.box.y - r.y) * t, c = n.box.height * t, Object.assign(o.style, {
1473
+ left: `${(a - r.x) * t}px`,
1474
+ width: `${i * t}px`,
1475
+ fontSize: `${n.fontSize * t}px`
1476
+ }), l();
1433
1477
  };
1434
- this.canvas.getContainer().appendChild(u), this.canvas.addMarker(e, dn), d(), u.focus(), t ? u.setSelectionRange(t.selectionStart, t.selectionEnd) : u.select();
1435
- let f = !1, p = () => {
1436
- f || (f = !0, u.removeEventListener("keydown", h), u.removeEventListener("input", d), u.removeEventListener("blur", g), u.remove(), this.elementRegistry.get(e.id) === e && this.canvas.removeMarker(e, dn), this.active = null, this.canvas.restoreFocus());
1437
- }, m = () => {
1438
- if (f) return;
1439
- let t = u.value.trim(), n = t !== (e.ttLabel ?? "");
1440
- p(), n && this.modeling.updateLabel(e, t);
1441
- }, h = (e) => {
1442
- e.key === "Enter" && !e.shiftKey && !e.isComposing ? (e.preventDefault(), m(), this.canvas.focus()) : e.key === "Escape" && (e.preventDefault(), p(), this.canvas.focus());
1443
- }, g = () => m();
1444
- u.addEventListener("keydown", h), u.addEventListener("input", d), u.addEventListener("blur", g);
1445
- let _ = () => ({
1478
+ this.canvas.getContainer().appendChild(o), this.canvas.addMarker(e, mn), u(), o.focus(), t ? o.setSelectionRange(t.selectionStart, t.selectionEnd) : o.select();
1479
+ 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());
1481
+ }, p = () => {
1482
+ if (d) return;
1483
+ let t = o.value.trim(), n = t !== (e.ttLabel ?? "");
1484
+ f(), n && this.modeling.updateLabel(e, t);
1485
+ }, 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());
1487
+ }, h = () => p();
1488
+ o.addEventListener("keydown", m), o.addEventListener("input", l), o.addEventListener("blur", h);
1489
+ let g = () => ({
1446
1490
  elementId: e.id,
1447
- value: u.value,
1448
- selectionStart: u.selectionStart,
1449
- selectionEnd: u.selectionEnd
1491
+ value: o.value,
1492
+ selectionStart: o.selectionStart,
1493
+ selectionEnd: o.selectionEnd
1450
1494
  });
1451
1495
  this.active = {
1452
- commit: m,
1453
- cleanup: p,
1454
- snapshot: _
1496
+ commit: p,
1497
+ cleanup: f,
1498
+ place: u,
1499
+ snapshot: g
1455
1500
  };
1456
1501
  }
1457
1502
  cancel() {
1458
1503
  this.active?.cleanup();
1459
1504
  }
1460
- }, hn = {
1505
+ }, vn = {
1461
1506
  __init__: ["ttLabelEditing"],
1462
- ttLabelEditing: ["type", mn]
1463
- }, gn = 1, _n = 10, vn = {
1507
+ ttLabelEditing: ["type", _n]
1508
+ }, yn = 1, bn = 10, xn = {
1464
1509
  ArrowLeft: {
1465
1510
  x: -1,
1466
1511
  y: 0
@@ -1477,24 +1522,24 @@ var mn = class {
1477
1522
  x: 0,
1478
1523
  y: 1
1479
1524
  }
1480
- }, yn = "[aria-modal=\"true\"], dialog[open]";
1481
- function bn(e) {
1525
+ }, Sn = "[aria-modal=\"true\"], dialog[open]";
1526
+ function Cn(e) {
1482
1527
  let t = e;
1483
1528
  return t ? t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable : !1;
1484
1529
  }
1485
- function xn(e) {
1530
+ function wn(e) {
1486
1531
  return typeof e?.nodeType == "number";
1487
1532
  }
1488
- function Sn(e, t) {
1533
+ function Tn(e, t) {
1489
1534
  if (t.closest("[inert]")) return !1;
1490
- if (!xn(e) || e.nodeType === Node.DOCUMENT_NODE) return !0;
1535
+ if (!wn(e) || e.nodeType === Node.DOCUMENT_NODE) return !0;
1491
1536
  let n = e.ownerDocument;
1492
1537
  return e === n?.body || e === n?.documentElement || t.contains(e);
1493
1538
  }
1494
- function Cn(e) {
1539
+ function En(e) {
1495
1540
  return !("waypoints" in e);
1496
1541
  }
1497
- var Q = class {
1542
+ var Dn = class {
1498
1543
  static $inject = [
1499
1544
  "config.ttKeyboard",
1500
1545
  "eventBus",
@@ -1528,30 +1573,30 @@ var Q = class {
1528
1573
  let t = a.get();
1529
1574
  t.length && (e.preventDefault(), o.removeElements([...t]));
1530
1575
  } else if (t && n === "v" && !e.shiftKey) e.preventDefault(), s.paste();
1531
- else if (!t && Object.hasOwn(vn, e.key)) {
1532
- let t = a.get().filter(Cn);
1576
+ else if (!t && Object.hasOwn(xn, e.key)) {
1577
+ let t = a.get().filter(En);
1533
1578
  if (!t.length || !c.allowed("elements.move", { shapes: t })) return;
1534
1579
  e.preventDefault();
1535
- let n = vn[e.key], r = e.shiftKey ? _n : gn;
1580
+ let n = xn[e.key], r = e.shiftKey ? bn : yn;
1536
1581
  o.moveElements(t, {
1537
1582
  x: n.x * r,
1538
1583
  y: n.y * r
1539
1584
  });
1540
1585
  }
1541
1586
  }, _ = (e) => {
1542
- if (e.defaultPrevented || e.altKey || e.isComposing || bn(e.target) || !Sn(e.target, u) || d.querySelector(yn)) return;
1587
+ if (e.defaultPrevented || e.altKey || e.isComposing || Cn(e.target) || !Tn(e.target, u) || d.querySelector(Sn)) return;
1543
1588
  let t = e.ctrlKey || e.metaKey, n = e.key.toLowerCase();
1544
1589
  h(e, t, n) || m?.isReadOnly() || g(e, t, n);
1545
1590
  };
1546
1591
  d.addEventListener("keydown", _), t.on("diagram.destroy", () => d.removeEventListener("keydown", _));
1547
1592
  }
1548
- }, wn = {
1593
+ }, Q = {
1549
1594
  __init__: ["ttKeyboard"],
1550
- ttKeyboard: ["type", Q]
1595
+ ttKeyboard: ["type", Dn]
1551
1596
  };
1552
1597
  //#endregion
1553
1598
  //#region src/copy-paste/TtCopyPaste.ts
1554
- function Tn(e) {
1599
+ function On(e) {
1555
1600
  switch (e) {
1556
1601
  case "team": return "team";
1557
1602
  case "interaction": return "int";
@@ -1561,7 +1606,7 @@ function Tn(e) {
1561
1606
  default: return;
1562
1607
  }
1563
1608
  }
1564
- var En = class extends Se {
1609
+ var kn = class extends xe {
1565
1610
  elementFactory;
1566
1611
  static $inject = [
1567
1612
  "canvas",
@@ -1577,20 +1622,20 @@ var En = class extends Se {
1577
1622
  super(e, t, n, r, i, a, o, s), this.elementFactory = r;
1578
1623
  }
1579
1624
  createConnection(e) {
1580
- let t = Tn(e.ttKind);
1625
+ let t = On(e.ttKind);
1581
1626
  return t ? this.elementFactory.createConnection({
1582
1627
  ...e,
1583
1628
  id: v(t)
1584
1629
  }) : super.createConnection(e);
1585
1630
  }
1586
1631
  createShape(e) {
1587
- let t = Tn(e.ttKind);
1632
+ let t = On(e.ttKind);
1588
1633
  return t ? this.elementFactory.createShape({
1589
1634
  ...e,
1590
1635
  id: v(t)
1591
1636
  }) : super.createShape(e);
1592
1637
  }
1593
- }, Dn = [
1638
+ }, An = [
1594
1639
  "ttKind",
1595
1640
  "teamType",
1596
1641
  "mode",
@@ -1599,31 +1644,31 @@ var En = class extends Se {
1599
1644
  "fill",
1600
1645
  "stroke",
1601
1646
  "ttForeign"
1602
- ], On = {
1603
- __depends__: [xe],
1647
+ ], jn = {
1648
+ __depends__: [be],
1604
1649
  __init__: ["ttCopyPasteProps"],
1605
- copyPaste: ["type", En],
1650
+ copyPaste: ["type", kn],
1606
1651
  ttCopyPasteProps: ["type", class {
1607
1652
  static $inject = ["eventBus"];
1608
1653
  constructor(e) {
1609
1654
  e.on("copyPaste.copyElement", (e) => {
1610
1655
  let { descriptor: t, element: n } = e;
1611
- if (!T(n) && !A(n)) return;
1656
+ if (!E(n) && !j(n)) return;
1612
1657
  let r = n;
1613
- for (let e of Dn) r[e] !== void 0 && (t[e] = structuredClone(r[e]));
1658
+ for (let e of An) r[e] !== void 0 && (t[e] = structuredClone(r[e]));
1614
1659
  });
1615
1660
  }
1616
1661
  }]
1617
1662
  };
1618
1663
  //#endregion
1619
1664
  //#region src/zorder/TtZOrder.ts
1620
- function kn(e) {
1621
- return O(e) ? 0 : E(e) ? e.teamType === "enabling" ? 3 : e.teamType === "complicated-subsystem" ? 2 : 1 : D(e) ? 4 : k(e) ? 5 : A(e) ? 6 : 1;
1665
+ function Mn(e) {
1666
+ 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;
1622
1667
  }
1623
- function An(e) {
1624
- return T(e) || A(e);
1668
+ function Nn(e) {
1669
+ return E(e) || j(e);
1625
1670
  }
1626
- var jn = class {
1671
+ var Pn = class {
1627
1672
  canvas;
1628
1673
  elementRegistry;
1629
1674
  static $inject = [
@@ -1642,34 +1687,34 @@ var jn = class {
1642
1687
  });
1643
1688
  }
1644
1689
  reorder() {
1645
- let e = this.elementRegistry.getAll().filter(An).sort((e, t) => kn(e) - kn(t));
1690
+ let e = this.elementRegistry.getAll().filter(Nn).sort((e, t) => Mn(e) - Mn(t));
1646
1691
  for (let t of e) {
1647
1692
  let e = this.canvas.getGraphics(t)?.parentNode, n = e?.parentNode;
1648
1693
  e && n && n.appendChild(e);
1649
1694
  }
1650
1695
  }
1651
- }, Mn = {
1696
+ }, Fn = {
1652
1697
  __init__: ["ttZOrder"],
1653
- ttZOrder: ["type", jn]
1654
- }, Nn = class extends K {
1698
+ ttZOrder: ["type", Pn]
1699
+ }, In = class extends K {
1655
1700
  _getModules() {
1656
1701
  return [
1657
1702
  ...super._getModules(),
1658
- ce,
1659
1703
  se,
1704
+ w,
1705
+ ce,
1660
1706
  le,
1661
1707
  ue,
1662
- de,
1663
- on,
1664
- gt,
1665
- yt,
1666
- St,
1667
- tn,
1668
- un,
1669
- hn,
1670
- wn,
1671
- On,
1672
- Mn
1708
+ ln,
1709
+ vt,
1710
+ xt,
1711
+ wt,
1712
+ an,
1713
+ pn,
1714
+ vn,
1715
+ Q,
1716
+ jn,
1717
+ Fn
1673
1718
  ];
1674
1719
  }
1675
1720
  undo() {
@@ -1684,33 +1729,34 @@ var jn = class {
1684
1729
  canRedo() {
1685
1730
  return this.get("commandStack").canRedo();
1686
1731
  }
1687
- }, Pn = "team-topologies";
1688
- function Fn(e = {}) {
1689
- return zn(new Nn({
1690
- ...Ln(e),
1732
+ }, Ln = "team-topologies";
1733
+ function Rn(e = {}) {
1734
+ return Hn(new In({
1735
+ ...Bn(e),
1691
1736
  undoRedoKeys: e.undoRedoKeys ?? !0,
1737
+ freeArea: e.freeArea,
1692
1738
  freeRectCenter: e.freeRectCenter
1693
1739
  }), !0, e.fitOnImport ?? !0);
1694
1740
  }
1695
- function In(e = {}) {
1696
- return zn(new K(Ln(e)), !1, e.fitOnImport ?? !0);
1741
+ function zn(e = {}) {
1742
+ return Hn(new K(Bn(e)), !1, e.fitOnImport ?? !0);
1697
1743
  }
1698
- function Ln(e) {
1744
+ function Bn(e) {
1699
1745
  return {
1700
1746
  width: "100%",
1701
1747
  height: "100%",
1702
1748
  additionalModules: e.additionalModules ?? []
1703
1749
  };
1704
1750
  }
1705
- function Rn(e) {
1751
+ function Vn(e) {
1706
1752
  let t = ee(e.trim() === "" ? {} : JSON.parse(e));
1707
1753
  if (!t.ok) throw Error(t.error);
1708
1754
  return t.document;
1709
1755
  }
1710
- function zn(e, t, n) {
1756
+ function Hn(e, t, n) {
1711
1757
  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 = {
1712
- notation: Pn,
1713
- apiVersion: Ce,
1758
+ notation: Ln,
1759
+ apiVersion: Se,
1714
1760
  editable: t
1715
1761
  };
1716
1762
  t && r.on("commandStack.changed", () => {
@@ -1720,16 +1766,28 @@ function zn(e, t, n) {
1720
1766
  return {
1721
1767
  meta: d,
1722
1768
  elements: {
1723
- list: () => l ? [] : a.getAll().filter(T).map(Vn),
1769
+ list: () => l ? [] : a.getAll().filter(E).map(Wn),
1724
1770
  reveal(e) {
1725
1771
  if (l) return !1;
1726
1772
  let t = a.get(e);
1727
- return T(t) ? (o.select(t), i.scrollToElement(t), !0) : !1;
1773
+ return E(t) ? (o.select(t), i.scrollToElement(t), !0) : !1;
1728
1774
  },
1729
- selection: () => l ? [] : Bn(o.get()),
1775
+ selection: () => l ? [] : Un(o.get()),
1730
1776
  onSelection(e) {
1731
- let t = (t) => e(Bn(t.newSelection ?? []));
1777
+ let t = (t) => e(Un(t.newSelection ?? []));
1732
1778
  return r.on("selection.changed", t), () => r.off("selection.changed", t);
1779
+ },
1780
+ bounds(e) {
1781
+ if (l) return;
1782
+ let t = a.get(e);
1783
+ if (!E(t)) return;
1784
+ let { x: n, y: r, width: i, height: o } = t;
1785
+ return {
1786
+ x: n,
1787
+ y: r,
1788
+ width: i,
1789
+ height: o
1790
+ };
1733
1791
  }
1734
1792
  },
1735
1793
  diagram: e,
@@ -1738,7 +1796,7 @@ function zn(e, t, n) {
1738
1796
  },
1739
1797
  async importText(t) {
1740
1798
  if (l) throw Error("The modeler was destroyed.");
1741
- let r = Rn(t);
1799
+ let r = Vn(t);
1742
1800
  c += 1;
1743
1801
  try {
1744
1802
  let { warnings: t } = e.importDocument(r, { fit: n });
@@ -1761,19 +1819,22 @@ function zn(e, t, n) {
1761
1819
  width: n,
1762
1820
  height: r
1763
1821
  };
1764
- return Hn(a) ? a : void 0;
1822
+ return Gn(a) ? a : void 0;
1765
1823
  } catch {
1766
1824
  return;
1767
1825
  }
1768
1826
  },
1769
1827
  setViewState(e) {
1770
- !l && Hn(e) && i.viewbox({
1828
+ !l && Gn(e) && i.viewbox({
1771
1829
  x: e.x,
1772
1830
  y: e.y,
1773
1831
  width: e.width,
1774
1832
  height: e.height
1775
1833
  });
1776
1834
  },
1835
+ contentBounds() {
1836
+ return e.contentBounds();
1837
+ },
1777
1838
  destroy() {
1778
1839
  if (!l) {
1779
1840
  try {
@@ -1786,17 +1847,17 @@ function zn(e, t, n) {
1786
1847
  }
1787
1848
  };
1788
1849
  }
1789
- function Bn(e) {
1790
- return e.filter(T).map((e) => e.id);
1850
+ function Un(e) {
1851
+ return e.filter(E).map((e) => e.id);
1791
1852
  }
1792
- function Vn(e) {
1853
+ function Wn(e) {
1793
1854
  let t = e.ttLabel;
1794
1855
  return t ? {
1795
1856
  id: e.id,
1796
1857
  name: t
1797
1858
  } : { id: e.id };
1798
1859
  }
1799
- function Hn(e) {
1860
+ function Gn(e) {
1800
1861
  if (typeof e != "object" || !e) return !1;
1801
1862
  let { x: t, y: n, width: r, height: i } = e;
1802
1863
  return $(t) && $(n) && $(r) && $(i) && r > 0 && i > 0;
@@ -1805,6 +1866,6 @@ function $(e) {
1805
1866
  return typeof e == "number" && Number.isFinite(e);
1806
1867
  }
1807
1868
  //#endregion
1808
- export { Te as CD_TOKENS, G as GEIST_UNICODE_RANGES, Mt as ICON_DOWNLOAD, Tt as ICON_LINK, jt as ICON_MAXIMIZE, Ot as ICON_MENU, Et as ICON_MESSAGE_SQUARE_PLUS, kt as ICON_MINUS, Ct as ICON_PENCIL, At as ICON_PLUS, Dt as ICON_SQUARE_DASHED_MOUSE_POINTER, wt as ICON_TRASH, Nt as ICON_X, j as MIRAGON, Nn as Modeler, K as NavigatedViewer, X as READ_ONLY_CHANGED_EVENT, N as ROOT_ID, Pn as TEAM_TOPOLOGIES_NOTATION, Ge as TeamTopologiesRenderer, xt as TtAssociationBehavior, Me as TtBaseViewer, ln as TtContextPadProvider, Ne as TtElementFactory, Xe as TtExporter, bt as TtFlatModelBehavior, Ye as TtImporter, Q as TtKeyboard, mn as TtLabelEditing, ht as TtLayouter, mt as TtModeling, en as TtPaletteProvider, an as TtReadOnly, vt as TtRules, rt as TtViewport, jn as TtZOrder, st as Viewer, Ut as annotationIconSvg, Fn as createCollaborativeModeler, In as createCollaborativeViewer, at as embedSvgStyles, Ht as flowIconSvg, it as geistFontFaceCss, J as iconMarkup, Gt as interactionIconSvg, ot as ioModule, k as isTtAnnotation, A as isTtAssociation, T as isTtElement, O as isTtFlow, D as isTtInteraction, E as isTtTeam, Rn as parseDocumentText, Ae as saveSVG, Vt as teamIconSvg, St as ttBehaviorsModule, un as ttContextPadModule, Je as ttDrawModule, wn as ttKeyboardModule, hn as ttLabelEditingModule, Pe as ttModelModule, gt as ttModelingModule, tn as ttPaletteModule, on as ttReadOnlyModule, yt as ttRulesModule, Mn as ttZOrderModule };
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 };
1809
1870
 
1810
1871
  //# sourceMappingURL=index.js.map