@metadev/daga-react 5.0.5 → 5.1.1

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/index.mjs CHANGED
@@ -51,11 +51,11 @@ var p = /* @__PURE__ */ function(e) {
51
51
  i ||= ne;
52
52
  let a = "", o, s;
53
53
  switch (e) {
54
- case D.Straight:
54
+ case "straight":
55
55
  a += `M ${t[0][0]} ${t[0][1]}`;
56
56
  for (let e = 1; e < t.length; ++e) a += ` L ${t[e][0]} ${t[e][1]}`;
57
57
  break;
58
- case D.Bezier:
58
+ case "bezier":
59
59
  o = n, a += `M ${t[0][0]} ${t[0][1]}`;
60
60
  for (let e = 1; e < t.length; ++e) {
61
61
  if (e + 1 >= t.length) switch (r) {
@@ -127,7 +127,7 @@ var p = /* @__PURE__ */ function(e) {
127
127
  o = s;
128
128
  }
129
129
  break;
130
- case D.Square:
130
+ case "square":
131
131
  o = n, a += `M ${t[0][0]} ${t[0][1]}`;
132
132
  for (let e = 1; e < t.length; ++e) {
133
133
  if (e + 1 >= t.length) switch (r) {
@@ -230,70 +230,69 @@ var p = /* @__PURE__ */ function(e) {
230
230
  }
231
231
  }, ie = (e, t) => {
232
232
  switch (e) {
233
- case te.Dotted: return `${t}`;
234
- case te.Dashed: return `${4 * t} ${t}`;
235
- case te.GappedDashes: return `${4 * t} ${4 * t}`;
236
- case te.Solid:
233
+ case "dotted": return `${t}`;
234
+ case "dashed": return `${4 * t} ${t}`;
235
+ case "gapped-dashes": return `${4 * t} ${4 * t}`;
237
236
  default: return "none";
238
237
  }
239
238
  }, O = (e, t) => {
240
239
  let n = e.indexOf(t);
241
240
  return n >= 0 && e.splice(n, 1), e;
242
- }, k = /* @__PURE__ */ function(e) {
241
+ }, ae = /* @__PURE__ */ function(e) {
243
242
  return e.Ellipse = "ellipse", e.Empty = "empty", e.Folder = "folder", e.Hexagon = "hexagon", e.Octagon = "octagon", e.Pill = "pill", e.Rectangle = "rectangle", e.Rhombus = "rhombus", e.RoundedRectangle = "rounded-rectangle", e.StickyNote = "sticky-note", e;
244
- }({}), ae = (e, t, n, r, i) => {
243
+ }({}), oe = (e, t, n, r, i) => {
245
244
  if (typeof e == "function") return e(t, n, r, i);
246
245
  switch (e) {
247
- case k.Ellipse: return oe(t, n, r, i);
248
- case k.Empty: return se();
249
- case k.Folder: return ce(t, n, r, i);
250
- case k.Hexagon: return le(t, n, r, i);
251
- case k.Octagon: return ue(t, n, r, i);
252
- case k.Pill: return de(t, n, r, i);
253
- case k.Rectangle: return fe(t, n, r, i);
254
- case k.Rhombus: return pe(t, n, r, i);
255
- case k.RoundedRectangle: return me(t, n, r, i);
256
- case k.StickyNote: return he(t, n, r, i);
257
- default: return fe(t, n, r, i);
258
- }
259
- }, oe = (e, t, n, r) => `M ${e + n / 2} ${t} A ${n / 2} ${r / 2} 0 0 0 ${e + n / 2} ${t + r} A ${n / 2} ${r / 2} 0 1 0 ${e + n / 2} ${t} Z`, se = () => "Z", ce = (e, t, n, r) => `M ${e} ${t} L ${e + n / 3} ${t} L ${e + n / 2} ${t + r / 6} L ${e + n} ${t + r / 6} L ${e + n} ${t + r} L ${e} ${t + r} Z`, le = (e, t, n, r) => `M ${e + n / 4} ${t} L ${e + 3 * n / 4} ${t} L ${e + n} ${t + r / 2} L ${e + 3 * n / 4} ${t + r} L ${e + n / 4} ${t + r} L ${e} ${t + r / 2} Z`, ue = (e, t, n, r) => `M ${e + n / 4} ${t} L ${e + 3 * n / 4} ${t} L ${e + n} ${t + r / 4} L ${e + n} ${t + 3 * r / 4} L ${e + 3 * n / 4} ${t + r} L ${e + n / 4} ${t + r} L ${e} ${t + 3 * r / 4} L ${e} ${t + r / 4} L ${e + n / 4} ${t} Z`, de = (e, t, n, r) => r < n ? `M ${e + r / 2} ${t} L ${e + n - r / 2} ${t} A ${r / 2} ${r / 2} 0 0 1 ${e + n} ${t + r / 2} A ${r / 2} ${r / 2} 0 0 1 ${e + n - r / 2} ${t + r} L ${e + r / 2} ${t + r} A ${r / 2} ${r / 2} 0 0 1 ${e} ${t + r / 2} A ${r / 2} ${r / 2} 0 0 1 ${e + r / 2} ${t} Z` : r > n ? `M ${e} ${t + n / 2} L ${e} ${t + r - n / 2} A ${n / 2} ${n / 2} 0 0 0 ${e + n / 2} ${t + r} A ${n / 2} ${n / 2} 0 0 0 ${e + n} ${t + r - n / 2} L ${e + n} ${t + n / 2} A ${n / 2} ${n / 2} 0 0 0 ${e + n / 2} ${t} A ${n / 2} ${n / 2} 0 0 0 ${e} ${t + n / 2} Z` : oe(e, t, n, r), fe = (e, t, n, r) => `M ${e} ${t} L ${e + n} ${t} L ${e + n} ${t + r} L ${e} ${t + r} Z`, pe = (e, t, n, r) => `M ${e + n / 2} ${t} L ${e + n} ${t + r / 2} L ${e + n / 2} ${t + r} L ${e} ${t + r / 2} Z`, me = (e, t, n, r) => `M ${e + n / 4} ${t} L ${e + 3 * n / 4} ${t} A ${n / 4} ${r / 4} 0 0 1 ${e + n} ${t + r / 4} L ${e + n} ${t + 3 * r / 4} A ${n / 4} ${r / 4} 0 0 1 ${e + 3 * n / 4} ${t + r} L ${e + n / 4} ${t + r} A ${n / 4} ${r / 4} 0 0 1 ${e} ${t + 3 * r / 4} L ${e} ${t + r / 4} A ${n / 4} ${r / 4} 0 0 1 ${e + n / 4} ${t} Z`, he = (e, t, n, r) => `M ${e} ${t} L ${e + 3 * n / 4} ${t} L ${e + 3 * n / 4} ${t + r / 4} L ${e + 3 * n / 4} ${t} L ${e + n} ${t + r / 4} L ${e + 3 * n / 4} ${t + r / 4} L ${e + n} ${t + r / 4} L ${e + n} ${t + r} L ${e} ${t + r} Z`, A = /* @__PURE__ */ function(e) {
260
- return e.AllScroll = "all-scroll", e.Auto = "auto", e.Crosshair = "crosshair", e.EWResize = "ew-resize", e.Grab = "grab", e.Grabbing = "grabbing", e.Move = "move", e.NoDrop = "no-drop", e.NSResize = "ns-resize", e.NotAllowed = "not-allowed", e.ZoomIn = "zoom-in", e.ZoomOut = "zoom-out", e;
261
- }({}), ge = (e) => Math.max(...e.split("\n").map((e) => e.length)), _e = (e) => e.match(/\n/g)?.length || 0, j = [];
262
- for (let e = 0; e < 256; ++e) j.push((e + 256).toString(16).slice(1));
263
- function ve(e, t = 0) {
264
- return (j[e[t + 0]] + j[e[t + 1]] + j[e[t + 2]] + j[e[t + 3]] + "-" + j[e[t + 4]] + j[e[t + 5]] + "-" + j[e[t + 6]] + j[e[t + 7]] + "-" + j[e[t + 8]] + j[e[t + 9]] + "-" + j[e[t + 10]] + j[e[t + 11]] + j[e[t + 12]] + j[e[t + 13]] + j[e[t + 14]] + j[e[t + 15]]).toLowerCase();
246
+ case "ellipse": return se(t, n, r, i);
247
+ case "empty": return ce();
248
+ case "folder": return le(t, n, r, i);
249
+ case "hexagon": return ue(t, n, r, i);
250
+ case "octagon": return de(t, n, r, i);
251
+ case "pill": return fe(t, n, r, i);
252
+ case "rectangle": return pe(t, n, r, i);
253
+ case "rhombus": return me(t, n, r, i);
254
+ case "rounded-rectangle": return he(t, n, r, i);
255
+ case "sticky-note": return ge(t, n, r, i);
256
+ default: return pe(t, n, r, i);
257
+ }
258
+ }, se = (e, t, n, r) => `M ${e + n / 2} ${t} A ${n / 2} ${r / 2} 0 0 0 ${e + n / 2} ${t + r} A ${n / 2} ${r / 2} 0 1 0 ${e + n / 2} ${t} Z`, ce = () => "Z", le = (e, t, n, r) => `M ${e} ${t} L ${e + n / 3} ${t} L ${e + n / 2} ${t + r / 6} L ${e + n} ${t + r / 6} L ${e + n} ${t + r} L ${e} ${t + r} Z`, ue = (e, t, n, r) => `M ${e + n / 4} ${t} L ${e + 3 * n / 4} ${t} L ${e + n} ${t + r / 2} L ${e + 3 * n / 4} ${t + r} L ${e + n / 4} ${t + r} L ${e} ${t + r / 2} Z`, de = (e, t, n, r) => `M ${e + n / 4} ${t} L ${e + 3 * n / 4} ${t} L ${e + n} ${t + r / 4} L ${e + n} ${t + 3 * r / 4} L ${e + 3 * n / 4} ${t + r} L ${e + n / 4} ${t + r} L ${e} ${t + 3 * r / 4} L ${e} ${t + r / 4} L ${e + n / 4} ${t} Z`, fe = (e, t, n, r) => r < n ? `M ${e + r / 2} ${t} L ${e + n - r / 2} ${t} A ${r / 2} ${r / 2} 0 0 1 ${e + n} ${t + r / 2} A ${r / 2} ${r / 2} 0 0 1 ${e + n - r / 2} ${t + r} L ${e + r / 2} ${t + r} A ${r / 2} ${r / 2} 0 0 1 ${e} ${t + r / 2} A ${r / 2} ${r / 2} 0 0 1 ${e + r / 2} ${t} Z` : r > n ? `M ${e} ${t + n / 2} L ${e} ${t + r - n / 2} A ${n / 2} ${n / 2} 0 0 0 ${e + n / 2} ${t + r} A ${n / 2} ${n / 2} 0 0 0 ${e + n} ${t + r - n / 2} L ${e + n} ${t + n / 2} A ${n / 2} ${n / 2} 0 0 0 ${e + n / 2} ${t} A ${n / 2} ${n / 2} 0 0 0 ${e} ${t + n / 2} Z` : se(e, t, n, r), pe = (e, t, n, r) => `M ${e} ${t} L ${e + n} ${t} L ${e + n} ${t + r} L ${e} ${t + r} Z`, me = (e, t, n, r) => `M ${e + n / 2} ${t} L ${e + n} ${t + r / 2} L ${e + n / 2} ${t + r} L ${e} ${t + r / 2} Z`, he = (e, t, n, r) => `M ${e + n / 4} ${t} L ${e + 3 * n / 4} ${t} A ${n / 4} ${r / 4} 0 0 1 ${e + n} ${t + r / 4} L ${e + n} ${t + 3 * r / 4} A ${n / 4} ${r / 4} 0 0 1 ${e + 3 * n / 4} ${t + r} L ${e + n / 4} ${t + r} A ${n / 4} ${r / 4} 0 0 1 ${e} ${t + 3 * r / 4} L ${e} ${t + r / 4} A ${n / 4} ${r / 4} 0 0 1 ${e + n / 4} ${t} Z`, ge = (e, t, n, r) => `M ${e} ${t} L ${e + 3 * n / 4} ${t} L ${e + 3 * n / 4} ${t + r / 4} L ${e + 3 * n / 4} ${t} L ${e + n} ${t + r / 4} L ${e + 3 * n / 4} ${t + r / 4} L ${e + n} ${t + r / 4} L ${e + n} ${t + r} L ${e} ${t + r} Z`, k = /* @__PURE__ */ function(e) {
259
+ return e.AllScroll = "all-scroll", e.Auto = "auto", e.Crosshair = "crosshair", e.EWResize = "ew-resize", e.Grab = "grab", e.Grabbing = "grabbing", e.Move = "move", e.NoDrop = "no-drop", e.NESWResize = "nesw-resize", e.NSResize = "ns-resize", e.NWSEResize = "nwse-resize", e.NotAllowed = "not-allowed", e.ZoomIn = "zoom-in", e.ZoomOut = "zoom-out", e;
260
+ }({}), _e = (e) => Math.max(...e.split("\n").map((e) => e.length)), ve = (e) => e.match(/\n/g)?.length || 0, A = [];
261
+ for (let e = 0; e < 256; ++e) A.push((e + 256).toString(16).slice(1));
262
+ function ye(e, t = 0) {
263
+ return (A[e[t + 0]] + A[e[t + 1]] + A[e[t + 2]] + A[e[t + 3]] + "-" + A[e[t + 4]] + A[e[t + 5]] + "-" + A[e[t + 6]] + A[e[t + 7]] + "-" + A[e[t + 8]] + A[e[t + 9]] + "-" + A[e[t + 10]] + A[e[t + 11]] + A[e[t + 12]] + A[e[t + 13]] + A[e[t + 14]] + A[e[t + 15]]).toLowerCase();
265
264
  }
266
265
  //#endregion
267
266
  //#region node_modules/uuid/dist/rng.js
268
- var ye = new Uint8Array(16);
269
- function be() {
270
- return crypto.getRandomValues(ye);
267
+ var be = new Uint8Array(16);
268
+ function xe() {
269
+ return crypto.getRandomValues(be);
271
270
  }
272
271
  //#endregion
273
272
  //#region node_modules/uuid/dist/v4.js
274
- function xe(e, t, n) {
275
- return !t && !e && crypto.randomUUID ? crypto.randomUUID() : Se(e, t, n);
276
- }
277
273
  function Se(e, t, n) {
274
+ return !t && !e && crypto.randomUUID ? crypto.randomUUID() : Ce(e, t, n);
275
+ }
276
+ function Ce(e, t, n) {
278
277
  e ||= {};
279
- let r = e.random ?? e.rng?.() ?? be();
278
+ let r = e.random ?? e.rng?.() ?? xe();
280
279
  if (r.length < 16) throw Error("Random bytes length must be >= 16");
281
280
  if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
282
281
  if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
283
282
  for (let e = 0; e < 16; ++e) t[n + e] = r[e];
284
283
  return t;
285
284
  }
286
- return ve(r);
285
+ return ye(r);
287
286
  }
288
287
  //#endregion
289
288
  //#region libs/daga/src/lib/util/object-util.ts
290
- var Ce = (e) => {
289
+ var we = (e) => {
291
290
  if (typeof e != "object" || !e) return e;
292
- if (Array.isArray(e)) return e.map(Ce);
291
+ if (Array.isArray(e)) return e.map(we);
293
292
  let t = {};
294
- for (let n of Object.entries(e)) t[n[0]] = Ce(n[1]);
293
+ for (let n of Object.entries(e)) t[n[0]] = we(n[1]);
295
294
  return t;
296
- }, M = (e) => {
295
+ }, j = (e) => {
297
296
  let { selected: t, highlighted: n, selectedAndHighlighted: r, ...i } = e, a = i;
298
297
  return {
299
298
  defaultLook: a,
@@ -312,106 +311,13 @@ var Ce = (e) => {
312
311
  ...r
313
312
  }
314
313
  };
315
- }, we = class {
316
- constructor() {
317
- this.entities = [], this.entityMap = {};
318
- }
319
- get length() {
320
- return this.size();
321
- }
322
- all() {
323
- return [...this.entities];
324
- }
325
- add(e) {
326
- this.entityMap[e.id] === void 0 && (this.entityMap[e.id] = e, this.entities.push(e));
327
- }
328
- clear() {
329
- for (; this.entities.length > 0;) this.remove(this.entities[0].id);
330
- }
331
- contains(e) {
332
- return this.entityMap[e] !== void 0;
333
- }
334
- count(e) {
335
- return this.entities.filter(e).length;
336
- }
337
- filter(e) {
338
- return this.entities.filter(e);
339
- }
340
- find(e) {
341
- return this.entities.find(e);
342
- }
343
- get(e) {
344
- return this.entityMap[e];
345
- }
346
- map(e) {
347
- return this.entities.map(e);
348
- }
349
- remove(e) {
350
- let t = this.get(e);
351
- t !== void 0 && (delete this.entityMap[e], O(this.entities, t));
352
- }
353
- size() {
354
- return this.entities.length;
355
- }
356
- *[Symbol.iterator]() {
357
- for (let e of this.entities) yield e;
358
- }
359
314
  }, Te = class {
360
- get id() {
361
- return this._id;
362
- }
363
- get highlighted() {
364
- return this.model.canvas?.userHighlight?.contains(this.id) || !1;
365
- }
366
- get selected() {
367
- return this.model.canvas?.userSelection?.contains(this.id) || !1;
368
- }
369
- constructor(e, t) {
370
- this.selfRemoved = !1, this.selfRemovedTimestamp = null, this.model = e, this._id = t;
371
- }
372
- select() {
373
- return this.model.canvas?.selectCanvasView()?.select(`[id='${E(this.id)}']`);
374
- }
375
- }, N = class extends we {
376
- all(e = !1) {
377
- return e ? super.all() : super.filter((e) => !e.removed);
378
- }
379
- contains(e, t = !1) {
380
- return t ? super.contains(e) : super.contains(e) && !this.entityMap[e].removed;
381
- }
382
- count(e, t = !1) {
383
- return t ? super.count(e) : super.count((t, n, r) => e(t, n, r) && !t.removed);
384
- }
385
- filter(e, t = !1) {
386
- return t ? super.filter(e) : super.filter((t, n, r) => e(t, n, r) && !t.removed);
387
- }
388
- find(e, t = !1) {
389
- return t ? super.find(e) : super.find((t, n, r) => e(t, n, r) && !t.removed);
390
- }
391
- get(e, t = !1) {
392
- return t || this.contains(e) ? super.get(e) : void 0;
393
- }
394
- map(e, t = !1) {
395
- return t ? super.map(e) : super.filter((e) => !e.removed).map(e);
396
- }
397
- remove(e) {
398
- let t = this.get(e, !0);
399
- t !== void 0 && (delete this.entityMap[e], O(this.entities, t));
400
- }
401
- size(e = !1) {
402
- return e ? super.size() : super.filter((e) => !e.removed).length;
403
- }
404
- *[Symbol.iterator](e = !1) {
405
- if (e) for (let e of this.entities) yield e;
406
- else for (let e of this.entities.filter((e) => !e.removed)) yield e;
407
- }
408
- }, Ee = class {
409
315
  constructor(e, t, n, r, i, a, o) {
410
316
  this.name = e, this.label = t, this.type = n, this.defaultValue = r, this.basic = i, this.editable = a, this.rootAttribute = o, this.options = void 0, this.properties = void 0;
411
317
  }
412
- }, P = /* @__PURE__ */ function(e) {
318
+ }, M = /* @__PURE__ */ function(e) {
413
319
  return e.Boolean = "boolean", e.Color = "color", e.Date = "date", e.Datetime = "datetime", e.Number = "number", e.Object = "object", e.Option = "option", e.OptionList = "option-list", e.OptionSet = "option-set", e.Text = "text", e.TextArea = "text-area", e.TextList = "text-list", e.TextSet = "text-set", e.TextMap = "text-map", e.Time = "time", e.Url = "url", e;
414
- }({}), De = class {
320
+ }({}), Ee = class {
415
321
  constructor(e = []) {
416
322
  this.propertyList = e, this.propertyMap = {};
417
323
  for (let e of this.propertyList) this.propertyMap[e.name] = e;
@@ -428,19 +334,19 @@ var Ce = (e) => {
428
334
  };
429
335
  //#endregion
430
336
  //#region libs/daga/src/lib/diagram/collab/primitives.ts
431
- function Oe(e, t) {
337
+ function De(e, t) {
432
338
  return !t || e[0] > t[0] ? !0 : e[0] === t[0] ? e[1] >= t[1] : !1;
433
339
  }
434
340
  //#endregion
435
341
  //#region libs/daga/src/lib/diagram/property/property-util.ts
436
- var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 || e instanceof Object && Object.keys(e).length === 0, Ae = (e, t) => e === t || JSON.stringify(e) === JSON.stringify(t), je = (e, t, n) => {
342
+ var Oe = (e) => e == null || e === "" || e instanceof Array && e.length === 0 || e instanceof Object && Object.keys(e).length === 0, ke = (e, t) => e === t || JSON.stringify(e) === JSON.stringify(t), Ae = (e, t, n) => {
437
343
  let r = {}, i = {};
438
- for (let a in n.propertySet.propertyMap) if (n.propertySet.propertyMap[a].type === P.Object) {
439
- let o = je(e[a], t[a], n.getSubValueSet(a));
344
+ for (let a in n.propertySet.propertyMap) if (n.propertySet.propertyMap[a].type === M.Object) {
345
+ let o = Ae(e[a], t[a], n.getSubValueSet(a));
440
346
  Object.keys(o[0]).length > 0 && Object.keys(o[1]).length > 0 && (r[a] = o[0], i[a] = o[1]);
441
- } else Ae(e[a], t[a]) || (r[a] = e[a], i[a] = t[a]);
347
+ } else ke(e[a], t[a]) || (r[a] = e[a], i[a] = t[a]);
442
348
  return [r, i];
443
- }, Me = (e) => e != null && e.constructor === Object, Ne = class e {
349
+ }, je = (e) => e != null && e.constructor === Object, Me = class e {
444
350
  constructor(e, t) {
445
351
  this.displayedProperties = [], this.hiddenProperties = [], this.values = {}, this.valueSets = {}, this.ownTimestamps = {}, this.propertySet = e, this.rootElement = t, this.resetValues();
446
352
  }
@@ -474,21 +380,21 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
474
380
  }
475
381
  getValue(e) {
476
382
  let t = this.propertySet.getProperty(e)?.rootAttribute;
477
- return t != null && (this.values[e] = this.getRootElementValue(t)), this.propertySet.getProperty(e).type === P.Object ? this.valueSets[e].getValues() : this.values[e];
383
+ return t != null && (this.values[e] = this.getRootElementValue(t)), this.propertySet.getProperty(e).type === M.Object ? this.valueSets[e].getValues() : this.values[e];
478
384
  }
479
385
  getValues() {
480
386
  let e = {};
481
- for (let t in this.propertySet.propertyMap) this.propertySet.getProperty(t).type === P.Object ? e[t] = this.valueSets[t].getValues() : e[t] = this.getValue(t);
387
+ for (let t in this.propertySet.propertyMap) this.propertySet.getProperty(t).type === M.Object ? e[t] = this.valueSets[t].getValues() : e[t] = this.getValue(t);
482
388
  return e;
483
389
  }
484
390
  getValuesForKeys(e) {
485
391
  let t = {};
486
- for (let n in e) this.propertySet.getProperty(n).type === P.Object ? t[n] = this.valueSets[n].getValuesForKeys(e[n]) : t[n] = this.getValue(n);
392
+ for (let n in e) this.propertySet.getProperty(n).type === M.Object ? t[n] = this.valueSets[n].getValuesForKeys(e[n]) : t[n] = this.getValue(n);
487
393
  return t;
488
394
  }
489
395
  getTimestamps() {
490
396
  let e = {};
491
- for (let t in this.propertySet.propertyMap) if (this.propertySet.getProperty(t).type === P.Object) e[t] = this.valueSets[t].getTimestamps();
397
+ for (let t in this.propertySet.propertyMap) if (this.propertySet.getProperty(t).type === M.Object) e[t] = this.valueSets[t].getTimestamps();
492
398
  else {
493
399
  let n = this.ownTimestamps[t];
494
400
  n && (e[t] = n);
@@ -496,11 +402,11 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
496
402
  return e;
497
403
  }
498
404
  hasValue(e) {
499
- return !ke(this.getValue(e));
405
+ return !Oe(this.getValue(e));
500
406
  }
501
407
  hasSetValue(e) {
502
408
  let t = this.getValue(e), n = this.propertySet.getProperty(e);
503
- return n && n.type === P.Object ? this.getSubValueSet(e).hasAnySetValue() : !ke(t) && !Ae(t, n?.defaultValue);
409
+ return n && n.type === M.Object ? this.getSubValueSet(e).hasAnySetValue() : !Oe(t) && !ke(t, n?.defaultValue);
504
410
  }
505
411
  hasAnySetValue() {
506
412
  for (let e of this.propertySet.propertyList) if (this.hasSetValue(e.name)) return !0;
@@ -509,35 +415,35 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
509
415
  setValue(e, t) {
510
416
  let n = this.propertySet.getProperty(e);
511
417
  if (n) {
512
- n.type === P.Object ? this.valueSets[e].setValues(t) : (this.values[e] = t, Ae(t, n.defaultValue) || this.displayProperty(n));
418
+ n.type === M.Object ? this.valueSets[e].setValues(t) : (this.values[e] = t, ke(t, n.defaultValue) || this.displayProperty(n));
513
419
  let r = n.rootAttribute;
514
420
  r != null && this.setRootElementValue(r, t);
515
421
  }
516
422
  }
517
423
  setValues(e) {
518
424
  this.resetValues();
519
- for (let t in e) this.propertySet.getProperty(t).type === P.Object ? this.valueSets[t].setValues(e[t]) : this.setValue(t, e[t]);
425
+ for (let t in e) this.propertySet.getProperty(t).type === M.Object ? this.valueSets[t].setValues(e[t]) : this.setValue(t, e[t]);
520
426
  }
521
427
  setTimestamps(e) {
522
428
  this.ownTimestamps = {};
523
- for (let t in e) this.propertySet.getProperty(t).type === P.Object ? this.valueSets[t].setTimestamps(e[t]) : this.ownTimestamps[t] = e[t];
429
+ for (let t in e) this.propertySet.getProperty(t).type === M.Object ? this.valueSets[t].setTimestamps(e[t]) : this.ownTimestamps[t] = e[t];
524
430
  }
525
431
  overwriteValues(e) {
526
- for (let t in e) this.propertySet.getProperty(t).type === P.Object ? this.valueSets[t].overwriteValues(e[t]) : this.setValue(t, e[t]);
432
+ for (let t in e) this.propertySet.getProperty(t).type === M.Object ? this.valueSets[t].overwriteValues(e[t]) : this.setValue(t, e[t]);
527
433
  }
528
434
  overwriteValuesLww(e, t) {
529
- for (let n in e) this.propertySet.getProperty(n).type === P.Object ? this.valueSets[n].overwriteValuesLww(e[n], t) : Oe(t, this.ownTimestamps[n]) && (this.setValue(n, e[n]), this.ownTimestamps[n] = t);
435
+ for (let n in e) this.propertySet.getProperty(n).type === M.Object ? this.valueSets[n].overwriteValuesLww(e[n], t) : De(t, this.ownTimestamps[n]) && (this.setValue(n, e[n]), this.ownTimestamps[n] = t);
530
436
  }
531
437
  resetValues() {
532
438
  this.displayedProperties = [], this.hiddenProperties = [], this.ownTimestamps = {};
533
439
  for (let e in this.propertySet.propertyMap) {
534
440
  let t = this.propertySet.getProperty(e), n = t.rootAttribute;
535
- t.type === P.Object ? this.valueSets[e] = this.constructSubValueSet(e) : this.values[e] = Ce(t.defaultValue), n != null && t.defaultValue !== void 0 && !Ae(this.getRootElementValue(n), t.defaultValue) && this.setRootElementValue(n, this.values[e]), t.basic === !1 ? this.hiddenProperties.push(t) : this.displayedProperties.push(t);
441
+ t.type === M.Object ? this.valueSets[e] = this.constructSubValueSet(e) : this.values[e] = we(t.defaultValue), n != null && t.defaultValue !== void 0 && !ke(this.getRootElementValue(n), t.defaultValue) && this.setRootElementValue(n, this.values[e]), t.basic === !1 ? this.hiddenProperties.push(t) : this.displayedProperties.push(t);
536
442
  }
537
443
  }
538
444
  constructSubValueSet(t) {
539
- let n = this.propertySet.getProperty(t), r = new e(new De(n.properties), this.rootElement);
540
- return r.overwriteValues(Ce(n.defaultValue)), r;
445
+ let n = this.propertySet.getProperty(t), r = new e(new Ee(n.properties), this.rootElement);
446
+ return r.overwriteValues(we(n.defaultValue)), r;
541
447
  }
542
448
  getSubValueSet(e) {
543
449
  return this.valueSets[e];
@@ -548,11 +454,103 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
548
454
  hideProperty(e) {
549
455
  this.hiddenProperties.includes(e) || (this.hiddenProperties.push(e), O(this.displayedProperties, e));
550
456
  }
551
- }, F = {
457
+ }, Ne = class {
458
+ constructor() {
459
+ this.entities = [], this.entityMap = {};
460
+ }
461
+ get length() {
462
+ return this.size();
463
+ }
464
+ all() {
465
+ return [...this.entities];
466
+ }
467
+ add(e) {
468
+ this.entityMap[e.id] === void 0 && (this.entityMap[e.id] = e, this.entities.push(e));
469
+ }
470
+ clear() {
471
+ for (; this.entities.length > 0;) this.remove(this.entities[0].id);
472
+ }
473
+ contains(e) {
474
+ return this.entityMap[e] !== void 0;
475
+ }
476
+ count(e) {
477
+ return this.entities.filter(e).length;
478
+ }
479
+ filter(e) {
480
+ return this.entities.filter(e);
481
+ }
482
+ find(e) {
483
+ return this.entities.find(e);
484
+ }
485
+ get(e) {
486
+ return this.entityMap[e];
487
+ }
488
+ map(e) {
489
+ return this.entities.map(e);
490
+ }
491
+ remove(e) {
492
+ let t = this.get(e);
493
+ t !== void 0 && (delete this.entityMap[e], O(this.entities, t));
494
+ }
495
+ size() {
496
+ return this.entities.length;
497
+ }
498
+ *[Symbol.iterator]() {
499
+ for (let e of this.entities) yield e;
500
+ }
501
+ }, Pe = class {
502
+ get id() {
503
+ return this._id;
504
+ }
505
+ get highlighted() {
506
+ return this.model.canvas?.userHighlight?.contains(this.id) || !1;
507
+ }
508
+ get selected() {
509
+ return this.model.canvas?.userSelection?.contains(this.id) || !1;
510
+ }
511
+ constructor(e, t) {
512
+ this.selfRemoved = !1, this.selfRemovedTimestamp = null, this.model = e, this._id = t;
513
+ }
514
+ select() {
515
+ return this.model.canvas?.selectCanvasView()?.select(`[id='${E(this.id)}']`);
516
+ }
517
+ }, N = class extends Ne {
518
+ all(e = !1) {
519
+ return e ? super.all() : super.filter((e) => !e.removed);
520
+ }
521
+ contains(e, t = !1) {
522
+ return t ? super.contains(e) : super.contains(e) && !this.entityMap[e].removed;
523
+ }
524
+ count(e, t = !1) {
525
+ return t ? super.count(e) : super.count((t, n, r) => e(t, n, r) && !t.removed);
526
+ }
527
+ filter(e, t = !1) {
528
+ return t ? super.filter(e) : super.filter((t, n, r) => e(t, n, r) && !t.removed);
529
+ }
530
+ find(e, t = !1) {
531
+ return t ? super.find(e) : super.find((t, n, r) => e(t, n, r) && !t.removed);
532
+ }
533
+ get(e, t = !1) {
534
+ return t || this.contains(e) ? super.get(e) : void 0;
535
+ }
536
+ map(e, t = !1) {
537
+ return t ? super.map(e) : super.filter((e) => !e.removed).map(e);
538
+ }
539
+ remove(e) {
540
+ let t = this.get(e, !0);
541
+ t !== void 0 && (delete this.entityMap[e], O(this.entities, t));
542
+ }
543
+ size(e = !1) {
544
+ return e ? super.size() : super.filter((e) => !e.removed).length;
545
+ }
546
+ *[Symbol.iterator](e = !1) {
547
+ if (e) for (let e of this.entities) yield e;
548
+ else for (let e of this.entities.filter((e) => !e.removed)) yield e;
549
+ }
550
+ }, P = {
552
551
  name: "",
553
552
  label: null,
554
553
  look: {
555
- lookType: "connection-look",
556
554
  color: "#000000",
557
555
  thickness: 1,
558
556
  shape: D.Straight,
@@ -565,23 +563,23 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
565
563
  startTypes: [],
566
564
  endTypes: [],
567
565
  properties: []
568
- }, Pe = class {
566
+ }, Fe = class {
569
567
  constructor(e) {
570
568
  let t = {
571
- ...F,
569
+ ...P,
572
570
  ...e
573
571
  };
574
572
  this.id = t.id, this.name = t.name, this.label = t.label;
575
- let n = M(t.look);
573
+ let n = j(t.look);
576
574
  if (this.defaultLook = n.defaultLook, this.selectedLook = n.selectedLook, this.highlightedLook = n.highlightedLook, this.selectedAndHighlightedLook = n.selectedAndHighlightedLook, t.startMarkerLook !== void 0) {
577
- let e = M(t.startMarkerLook);
575
+ let e = j(t.startMarkerLook);
578
576
  this.defaultStartMarkerLook = e.defaultLook, this.selectedStartMarkerLook = e.selectedLook, this.highlightedStartMarkerLook = e.highlightedLook, this.selectedAndHighlightedStartMarkerLook = e.selectedAndHighlightedLook;
579
577
  } else this.defaultStartMarkerLook = null, this.selectedStartMarkerLook = null, this.highlightedStartMarkerLook = null, this.selectedAndHighlightedStartMarkerLook = null;
580
578
  if (t.endMarkerLook !== void 0) {
581
- let e = M(t.endMarkerLook);
579
+ let e = j(t.endMarkerLook);
582
580
  this.defaultEndMarkerLook = e.defaultLook, this.selectedEndMarkerLook = e.selectedLook, this.highlightedEndMarkerLook = e.highlightedLook, this.selectedAndHighlightedEndMarkerLook = e.selectedAndHighlightedLook;
583
581
  } else this.defaultEndMarkerLook = null, this.selectedEndMarkerLook = null, this.highlightedEndMarkerLook = null, this.selectedAndHighlightedEndMarkerLook = null;
584
- this.startTypes = t.startTypes, this.endTypes = t.endTypes, this.propertySet = new De(t.properties);
582
+ this.startTypes = t.startTypes, this.endTypes = t.endTypes, this.propertySet = new Ee(t.properties);
585
583
  }
586
584
  canStartFromType(e) {
587
585
  return this.startTypes.indexOf(e) >= 0;
@@ -589,12 +587,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
589
587
  canFinishOnType(e) {
590
588
  return this.endTypes.indexOf(e) >= 0;
591
589
  }
592
- }, I = class extends Te {
590
+ }, F = class extends Pe {
593
591
  get type() {
594
592
  return this._type;
595
593
  }
596
594
  set type(e) {
597
- e !== this._type && (this._type = e, this.valueSet &&= new Ne(e.propertySet, this), this.model.canvas?.userSelection?.openInPropertyEditor(this, !1), this.updateInView());
595
+ e !== this._type && (this._type = e, this.valueSet &&= new Me(e.propertySet, this), this.model.canvas?.userSelection?.openInPropertyEditor(this, !1), this.updateInView());
598
596
  }
599
597
  get typeString() {
600
598
  return this.type.id;
@@ -622,7 +620,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
622
620
  }
623
621
  set lookConfig(e) {
624
622
  if (this._lookConfig = e, e) {
625
- let t = M(e);
623
+ let t = j(e);
626
624
  this._defaultLook = {
627
625
  ...this._defaultLook,
628
626
  ...t.defaultLook
@@ -649,7 +647,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
649
647
  }
650
648
  set startMarkerLookConfig(e) {
651
649
  if (this._startMarkerLookConfig = e, e) {
652
- let t = M(e);
650
+ let t = j(e);
653
651
  this._defaultStartMarkerLook = {
654
652
  ...this._defaultStartMarkerLook,
655
653
  ...t.defaultLook
@@ -676,7 +674,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
676
674
  }
677
675
  set endMarkerLookConfig(e) {
678
676
  if (this._endMarkerLookConfig = e, e) {
679
- let t = M(e);
677
+ let t = j(e);
680
678
  this._defaultEndMarkerLook = {
681
679
  ...this._defaultEndMarkerLook,
682
680
  ...t.defaultLook
@@ -695,7 +693,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
695
693
  constructor(e, t, n, r, i) {
696
694
  if (e.connections.get(i) !== void 0) throw Error(`DiagramConnection with id "${i}" already exists`);
697
695
  if (!i) throw Error("DiagramConnection cannot have an empty or null id");
698
- super(e, i), this.startCoords = [0, 0], this.endCoords = [0, 0], this.startLabel = "", this.middleLabel = "", this.endLabel = "", this.points = [], this._type = t, this.valueSet = new Ne(t.propertySet, this), this.originalData = {}, this.setStart(n), this.setEnd(r);
696
+ super(e, i), this.startCoords = [0, 0], this.endCoords = [0, 0], this.startLabel = "", this.middleLabel = "", this.endLabel = "", this.points = [], this._type = t, this.valueSet = new Me(t.propertySet, this), this.originalData = {}, this.setStart(n), this.setEnd(r);
699
697
  }
700
698
  get removed() {
701
699
  return this.selfRemoved || this.start !== void 0 && this.start.removed || this.end !== void 0 && this.end.removed;
@@ -744,52 +742,59 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
744
742
  getPriority() {
745
743
  return this.start ? this.end ? Math.min(this.start.getPriority(), this.end.getPriority()) : this.start.getPriority() : this.end ? this.end.getPriority() : 0;
746
744
  }
747
- }, Fe = class extends N {
745
+ }, Ie = class extends N {
748
746
  constructor(e) {
749
- super(), this.types = new we(), this.model = e;
747
+ super(), this.types = new Ne(), this.model = e;
750
748
  }
751
749
  new(e, t, n, r) {
752
750
  let i;
753
- if (e instanceof Pe) i = e;
751
+ if (e instanceof Fe) i = e;
754
752
  else {
755
753
  let t = this.types.get(e);
756
754
  if (t === void 0) throw TypeError(`Connection type with id '${e}' could not be found.`);
757
755
  i = t;
758
756
  }
759
- let a = new I(this.model, i, t, n, r);
757
+ let a = new F(this.model, i, t, n, r);
760
758
  return super.add(a), a.updateInView(), a.valueSet.resetValues(), a.start?.raise(!1), a.end?.raise(!1), a;
761
759
  }
762
760
  remove(e) {
763
761
  let t = this.get(e, !0);
764
762
  t && (O(t.start?.outgoingConnections || [], t), O(t.end?.incomingConnections || [], t), super.remove(e), t.updateInView());
765
763
  }
766
- }, L = {
764
+ }, I = /* @__PURE__ */ function(e) {
765
+ return e[e.Always = 0] = "Always", e[e.OnlyWhenSelected = 1] = "OnlyWhenSelected", e[e.Never = 2] = "Never", e;
766
+ }({}), L = {
767
767
  editable: !0,
768
- fontSize: 0,
769
768
  margin: 0,
770
769
  padding: 0,
771
- fontFamily: "'Wonder Unit Sans', sans-serif",
772
- color: "#000000",
773
- selectedColor: "#000000",
774
- backgroundColor: "transparent",
775
770
  horizontalAlign: h.Center,
776
771
  verticalAlign: g.Center,
777
772
  orientation: p.Top,
778
773
  multiline: !1,
779
774
  fit: !1,
780
- shrink: !0
781
- }, Ie = class extends Te {
775
+ shrink: !0,
776
+ look: {
777
+ fillColor: "transparent",
778
+ fontColor: "#000000",
779
+ fontFamily: "'Wonder Unit Sans', sans-serif",
780
+ fontSize: 10,
781
+ fontWeight: 400
782
+ }
783
+ }, Le = class extends Pe {
782
784
  get text() {
783
785
  return this._text;
784
786
  }
785
787
  set text(e) {
786
788
  (e == null || e?.trim() === "") && (e = this.defaultText), this._text = e, this.updateInView(), this.fit && this.model.canvas?.fitFieldRootInView(this.id, this.shrink);
787
789
  }
788
- constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, m, h, g, _) {
789
- let v = `${t?.id}_field`;
790
- if (e.fields.get(v) !== void 0) throw Error("DiagramField for rootElement already exists");
791
- if (super(e, v), this.textTimestamp = null, this.rootElement = t, this.coords = n, this.width = r, this.height = i, this.fontSize = a, this.fontFamily = o, this.color = s, this.selectedColor = c, this.horizontalAlign = l, this.verticalAlign = u, !isNaN(Number(d))) this.orientation = Number(d);
792
- else switch (d) {
790
+ get look() {
791
+ return this.selected ? this.highlighted ? this.selectedAndHighlightedLook : this.selectedLook : this.highlighted ? this.highlightedLook : this.defaultLook;
792
+ }
793
+ constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, m) {
794
+ let h = `${t?.id}_field`;
795
+ if (e.fields.get(h) !== void 0) throw Error("DiagramField for rootElement already exists");
796
+ if (super(e, h), this.textTimestamp = null, this.rootElement = t, this.coords = n, this.width = r, this.height = i, this.horizontalAlign = a, this.verticalAlign = o, this.multiline = c, !isNaN(Number(s))) this.orientation = Number(s);
797
+ else switch (s) {
793
798
  case p.Top:
794
799
  this.orientation = 0;
795
800
  break;
@@ -804,7 +809,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
804
809
  break;
805
810
  default: this.orientation = 0;
806
811
  }
807
- this.multiline = f, this.defaultText = m, this._text = m, this.editable = h, this.fit = g, this.shrink = _;
812
+ let g = j(l);
813
+ this.defaultLook = g.defaultLook, this.selectedLook = g.selectedLook, this.highlightedLook = g.highlightedLook, this.selectedAndHighlightedLook = g.selectedAndHighlightedLook, this.defaultText = u, this._text = u, this.editable = d, this.fit = f, this.shrink = m;
808
814
  }
809
815
  get removed() {
810
816
  return this.selfRemoved || this.rootElement !== void 0 && this.rootElement.removed;
@@ -821,36 +827,56 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
821
827
  getPriority() {
822
828
  return this.rootElement?.getPriority() || 0;
823
829
  }
824
- }, Le = class extends N {
830
+ }, Re = class extends N {
825
831
  constructor(e) {
826
832
  super(), this.model = e;
827
833
  }
828
- new(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
829
- let g = new Ie(this.model, e, t, o, s, n, r, i, a, c, l, u, d, f, p, m, h);
830
- return super.add(g), g.updateInView(), e !== void 0 && (e.label = g), g;
834
+ new(e, t, n, r, i, a, o, s, c, l, u, d, f) {
835
+ let p = new Le(this.model, e, t, n, r, i, a, o, s, c, l, u, d, f);
836
+ return super.add(p), p.updateInView(), e !== void 0 && (e.label = p), p;
831
837
  }
832
838
  remove(e) {
833
839
  let t = this.get(e, !0);
834
840
  t && (t.rootElement?.label !== void 0 && t.rootElement.label === t && (t.rootElement.label = void 0), super.remove(e), t.updateInView());
835
841
  }
836
- }, R = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : e.margin.length === 1 || e.margin.length === 2 ? e.margin[0] : (e.margin.length, e.margin[2]), z = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : e.margin.length === 1 ? e.margin[0] : e.margin.length === 2 || e.margin.length === 3 ? e.margin[1] : e.margin[3], B = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : e.margin.length === 1 ? e.margin[0] : (e.margin.length === 2 || e.margin.length, e.margin[1]), V = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : (e.margin.length === 1 || e.margin.length === 2 || e.margin.length, e.margin[0]), Re = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? L.padding : e.padding.length === 1 || e.padding.length === 2 ? e.padding[0] : (e.padding.length, e.padding[2]), ze = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? L.padding : e.padding.length === 1 ? e.padding[0] : e.padding.length === 2 || e.padding.length === 3 ? e.padding[1] : e.padding[3], Be = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? L.padding : e.padding.length === 1 ? e.padding[0] : (e.padding.length === 2 || e.padding.length, e.padding[1]), Ve = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? L.padding : (e.padding.length === 1 || e.padding.length === 2 || e.padding.length, e.padding[0]), He = /* @__PURE__ */ function(e) {
837
- return e[e.OnlyWhenSelected = 0] = "OnlyWhenSelected", e;
838
- }({}), Ue = class {
842
+ }, R = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 1 || e.margin.length === 2 ? e.margin[0] : (e.margin.length, e.margin[2]), z = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 1 ? e.margin[0] : e.margin.length === 2 || e.margin.length === 3 ? e.margin[1] : e.margin[3], B = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 1 ? e.margin[0] : (e.margin.length === 2 || e.margin.length, e.margin[1]), V = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : (e.margin.length === 1 || e.margin.length === 2 || e.margin.length, e.margin[0]), ze = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 1 || e.padding.length === 2 ? e.padding[0] : (e.padding.length, e.padding[2]), Be = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 1 ? e.padding[0] : e.padding.length === 2 || e.padding.length === 3 ? e.padding[1] : e.padding[3], Ve = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 1 ? e.padding[0] : (e.padding.length === 2 || e.padding.length, e.padding[1]), He = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : (e.padding.length === 1 || e.padding.length === 2 || e.padding.length, e.padding[0]), Ue = {
843
+ mode: I.Never,
844
+ thickness: 10,
845
+ outerMargin: 0,
846
+ look: {
847
+ fillColor: "transparent",
848
+ borderColor: "transparent",
849
+ borderThickness: 0
850
+ }
851
+ }, H = class {
852
+ constructor(e) {
853
+ let t;
854
+ t = typeof e == "boolean" ? { mode: e ? I.Always : I.Never } : typeof e == "string" || typeof e == "number" ? { mode: e } : e, t = {
855
+ ...Ue,
856
+ ...t
857
+ }, this.mode = t.mode, this.thickness = t.thickness, this.outerMargin = t.outerMargin;
858
+ let n = j(t.look ?? Ue.look);
859
+ this.defaultLook = n.defaultLook, this.selectedLook = n.selectedLook, this.highlightedLook = n.highlightedLook, this.selectedAndHighlightedLook = n.selectedAndHighlightedLook;
860
+ }
861
+ getLook(e) {
862
+ return e ? e.selected ? e.highlighted ? this.selectedAndHighlightedLook : this.selectedLook : e.highlighted ? this.highlightedLook : this.defaultLook : this.defaultLook;
863
+ }
864
+ }, We = new H(Ue), Ge = class {
839
865
  constructor(e) {
840
866
  this.margin = e.margin || 0, this.defaultWidths = e.defaultWidths || null, this.defaultHeights = e.defaultHeights || null, this.minWidths = e.minWidths || null, this.minHeights = e.minHeights || null, this.sections = [];
841
867
  for (let t of e.sections) {
842
868
  let e = [];
843
869
  this.sections.push(e);
844
- for (let n of t) e.push(new We(n));
870
+ for (let n of t) e.push(new Ke(n));
845
871
  }
846
872
  }
847
- }, We = class {
873
+ }, Ke = class {
848
874
  constructor(e) {
849
- this.label = e.label || null, this.ports = e.ports || [], this.priority = e.priority || 0, this.resizableX = e.resizableX, this.resizableY = e.resizableY;
850
- let t = M(e.look || Ke);
875
+ this.label = e.label || null, this.ports = e.ports || [], this.priority = e.priority || 0, e.resizableX === void 0 ? this.resizerX = void 0 : this.resizerX = new H(e.resizableX), e.resizableY === void 0 ? this.resizerY = void 0 : this.resizerY = new H(e.resizableY), e.resizableXY === void 0 ? this.resizerXY = void 0 : this.resizerXY = new H(e.resizableXY);
876
+ let t = j(e.look || Je);
851
877
  this.defaultLook = t.defaultLook, this.selectedLook = t.selectedLook, this.highlightedLook = t.highlightedLook, this.selectedAndHighlightedLook = t.selectedAndHighlightedLook;
852
878
  }
853
- }, H = class extends Te {
879
+ }, U = class extends Pe {
854
880
  get name() {
855
881
  return this.label?.text || "";
856
882
  }
@@ -868,7 +894,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
868
894
  }
869
895
  set lookConfig(e) {
870
896
  if (this._lookConfig = e, e) {
871
- let t = M(e);
897
+ let t = j(e);
872
898
  this._defaultLook = {
873
899
  ...this._defaultLook,
874
900
  ...t.defaultLook
@@ -912,13 +938,44 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
912
938
  getPriority() {
913
939
  return this.node?.type?.sectionGrid?.sections?.[this.indexYInNode]?.[this.indexXInNode]?.priority || 0;
914
940
  }
941
+ getResizerX() {
942
+ return this.type?.resizerX ?? this.node?.getResizerX() ?? We;
943
+ }
944
+ getResizerY() {
945
+ return this.type?.resizerY ?? this.node?.getResizerY() ?? We;
946
+ }
947
+ getResizerXY() {
948
+ return this.type?.resizerXY ?? this.node?.getResizerXY() ?? We;
949
+ }
915
950
  getResizableX() {
916
951
  let e = this.type;
917
- return e?.resizableX === void 0 ? this.node?.getResizableX() || !1 : e.resizableX === He.OnlyWhenSelected ? this.selected : e.resizableX;
952
+ if (e?.resizerX !== void 0) switch (e.resizerX.mode) {
953
+ case I.OnlyWhenSelected: return this.selected;
954
+ case I.Always: return !0;
955
+ case I.Never:
956
+ default: return !1;
957
+ }
958
+ return this.node?.getResizableX() || !1;
918
959
  }
919
960
  getResizableY() {
920
961
  let e = this.type;
921
- return e?.resizableY === void 0 ? this.node?.getResizableY() || !1 : e.resizableY === He.OnlyWhenSelected ? this.selected : e.resizableY;
962
+ if (e?.resizerY !== void 0) switch (e.resizerY.mode) {
963
+ case I.OnlyWhenSelected: return this.selected;
964
+ case I.Always: return !0;
965
+ case I.Never:
966
+ default: return !1;
967
+ }
968
+ return this.node?.getResizableY() || !1;
969
+ }
970
+ getResizableXY() {
971
+ let e = this.type;
972
+ if (e?.resizerXY !== void 0) switch (e.resizerXY.mode) {
973
+ case I.OnlyWhenSelected: return this.selected;
974
+ case I.Always: return !0;
975
+ case I.Never:
976
+ default: return !1;
977
+ }
978
+ return this.node?.getResizableXY() || !1;
922
979
  }
923
980
  getClosestPortToPoint(e) {
924
981
  if (this.ports.length !== 0) {
@@ -993,12 +1050,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
993
1050
  for (let e of this.decorators) e.move(b(e.coords, t, n, r, i, e.anchorPointX, e.anchorPointY));
994
1051
  this.model.canvas?.autoTightenConnections !== !1 && this.getConnections().forEach((e) => e.tighten()), this.updateInView();
995
1052
  }
996
- }, Ge = class extends N {
1053
+ }, qe = class extends N {
997
1054
  constructor(e) {
998
1055
  super(), this.model = e;
999
1056
  }
1000
1057
  new(e, t, n, r, i, a, o) {
1001
- let s = new H(this.model, e, t, n, r, i, a, o);
1058
+ let s = new U(this.model, e, t, n, r, i, a, o);
1002
1059
  super.add(s), s.updateInView(), e.sections.push(s), e.updateInView();
1003
1060
  let c = e.type.sectionGrid?.sections?.[n]?.[t]?.ports;
1004
1061
  if (c && c.length > 0) for (let e = 0; e < c.length; ++e) {
@@ -1007,7 +1064,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1007
1064
  let e = {
1008
1065
  ...L,
1009
1066
  ...n.type?.label
1010
- }, t = 6 * e.fontSize + ze(e) + Be(e), r = e.fontSize + Ve(e) + Re(e), i;
1067
+ };
1068
+ e.look = {
1069
+ ...L.look,
1070
+ ...e.look
1071
+ };
1072
+ let t = 6 * (e.look.fontSize || L.look.fontSize) + Be(e) + Ve(e), r = (e.look.fontSize || L.look.fontSize) + He(e) + ze(e), i;
1011
1073
  switch (n.direction) {
1012
1074
  case p.Bottom:
1013
1075
  case p.Left:
@@ -1019,7 +1081,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1019
1081
  break;
1020
1082
  default: i = n.coords;
1021
1083
  }
1022
- this.model.fields.new(n, i, e.fontSize, e.fontFamily, e.color, e.selectedColor, t, r, e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, "", e.editable, e.fit, e.shrink);
1084
+ this.model.fields.new(n, i, t, r, e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, e.look, "", e.editable, e.fit, e.shrink);
1023
1085
  }
1024
1086
  }
1025
1087
  let l = e.type.sectionGrid?.sections?.[n]?.[t]?.label;
@@ -1028,7 +1090,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1028
1090
  ...L,
1029
1091
  ...l
1030
1092
  };
1031
- this.model.fields.new(s, [s.coords[0] + z(e), s.coords[1] + V(e)], e.fontSize, e.fontFamily, e.color, e.selectedColor, s.width - z(e) - B(e), s.height - V(e) - R(e), e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, "", e.editable, e.fit, e.shrink);
1093
+ e.look = {
1094
+ ...L.look,
1095
+ ...e.look
1096
+ }, this.model.fields.new(s, [s.coords[0] + z(e), s.coords[1] + V(e)], s.width - z(e) - B(e), s.height - V(e) - R(e), e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, e.look, "", e.editable, e.fit, e.shrink);
1032
1097
  }
1033
1098
  return s;
1034
1099
  }
@@ -1039,9 +1104,9 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1039
1104
  t.label && this.model.fields.remove(t.label.id), t.node && O(t.node.sections, t), super.remove(e), t.updateInView();
1040
1105
  }
1041
1106
  }
1042
- }, Ke = {
1107
+ }, Je = {
1043
1108
  lookType: "shaped-look",
1044
- shape: k.Rectangle,
1109
+ shape: ae.Rectangle,
1045
1110
  fillColor: "#FFFFFF",
1046
1111
  borderColor: "#000000",
1047
1112
  borderThickness: 1,
@@ -1050,7 +1115,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1050
1115
  borderColor: "#AA00AA"
1051
1116
  },
1052
1117
  highlighted: { borderThickness: 3 }
1053
- }, U = {
1118
+ }, Ye = {
1054
1119
  name: "",
1055
1120
  defaultWidth: 1,
1056
1121
  defaultHeight: 1,
@@ -1069,28 +1134,28 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1069
1134
  ports: [],
1070
1135
  decorators: [],
1071
1136
  sectionGrid: null,
1072
- look: Ke,
1137
+ look: Je,
1073
1138
  isUnique: !1,
1074
1139
  canBeParentless: !0,
1075
1140
  childrenTypes: [],
1076
1141
  priority: 0,
1077
1142
  properties: []
1078
- }, qe = class {
1143
+ }, Xe = class {
1079
1144
  constructor(e) {
1080
1145
  let t = {
1081
- ...U,
1146
+ ...Ye,
1082
1147
  ...e
1083
1148
  };
1084
- this.id = t.id, this.name = t.name, this.defaultWidth = t.defaultWidth, this.defaultHeight = t.defaultHeight, this.minWidth = t.minWidth, this.minHeight = t.minHeight, this.resizableX = t.resizableX, this.resizableY = t.resizableY, this.snapToGridOffset = t.snapToGridOffset, this.bottomPadding = Xe(t), this.leftPadding = Ze(t), this.rightPadding = Qe(t), this.topPadding = $e(t), this.label = t.label, this.ports = t.ports, this.decorators = t.decorators, this.sectionGrid = t.sectionGrid ? new Ue(t.sectionGrid) : null;
1085
- let n = M(t.look);
1086
- this.defaultLook = n.defaultLook, this.selectedLook = n.selectedLook, this.highlightedLook = n.highlightedLook, this.selectedAndHighlightedLook = n.selectedAndHighlightedLook, this.isUnique = t.isUnique, this.canBeParentless = t.canBeParentless, this.childrenTypes = t.childrenTypes, this.priority = t.priority, this.propertySet = new De(e?.properties || []);
1149
+ this.id = t.id, this.name = t.name, this.defaultWidth = t.defaultWidth, this.defaultHeight = t.defaultHeight, this.minWidth = t.minWidth, this.minHeight = t.minHeight, e.resizableX === void 0 ? this.resizerX = new H({ mode: I.Never }) : this.resizerX = new H(e.resizableX), e.resizableY === void 0 ? this.resizerY = new H({ mode: I.Never }) : this.resizerY = new H(e.resizableY), e.resizableXY === void 0 ? this.resizerXY = new H({ mode: I.Never }) : this.resizerXY = new H(e.resizableXY), this.snapToGridOffset = t.snapToGridOffset, this.bottomPadding = $e(t), this.leftPadding = et(t), this.rightPadding = tt(t), this.topPadding = nt(t), this.label = t.label, this.ports = t.ports, this.decorators = t.decorators, this.sectionGrid = t.sectionGrid ? new Ge(t.sectionGrid) : null;
1150
+ let n = j(t.look);
1151
+ this.defaultLook = n.defaultLook, this.selectedLook = n.selectedLook, this.highlightedLook = n.highlightedLook, this.selectedAndHighlightedLook = n.selectedAndHighlightedLook, this.isUnique = t.isUnique, this.canBeParentless = t.canBeParentless, this.childrenTypes = t.childrenTypes, this.priority = t.priority, this.propertySet = new Ee(e?.properties || []);
1087
1152
  }
1088
- }, W = class extends Te {
1153
+ }, W = class extends Pe {
1089
1154
  get type() {
1090
1155
  return this._type;
1091
1156
  }
1092
1157
  set type(e) {
1093
- e !== this._type && (this._type = e, this.valueSet &&= new Ne(e.propertySet, this), this.model.canvas?.userSelection?.openInPropertyEditor(this, !1), this.updateInView());
1158
+ e !== this._type && (this._type = e, this.valueSet &&= new Me(e.propertySet, this), this.model.canvas?.userSelection?.openInPropertyEditor(this, !1), this.updateInView());
1094
1159
  }
1095
1160
  get typeString() {
1096
1161
  return this.type.id;
@@ -1118,7 +1183,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1118
1183
  }
1119
1184
  set lookConfig(e) {
1120
1185
  if (this._lookConfig = e, e) {
1121
- let t = M(e);
1186
+ let t = j(e);
1122
1187
  this._defaultLook = {
1123
1188
  ...this._defaultLook,
1124
1189
  ...t.defaultLook
@@ -1137,7 +1202,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1137
1202
  constructor(e, t, n = [0, 0], r) {
1138
1203
  if (e.nodes.get(r) !== void 0) throw Error(`DiagramNode with id "${r}" already exists`);
1139
1204
  if (!r) throw Error("DiagramNode cannot have an empty or null id");
1140
- super(e, r), this.children = [], this.sections = [], this.ports = [], this.decorators = [], this.geometryTimestamp = null, this._type = t, this.valueSet = new Ne(t.propertySet, this), this.originalData = {}, this.coords = n, this.width = t.defaultWidth, this.height = t.defaultHeight;
1205
+ super(e, r), this.children = [], this.sections = [], this.ports = [], this.decorators = [], this.geometryTimestamp = null, this._type = t, this.valueSet = new Me(t.propertySet, this), this.originalData = {}, this.coords = n, this.width = t.defaultWidth, this.height = t.defaultHeight;
1141
1206
  }
1142
1207
  get removed() {
1143
1208
  return this.selfRemoved;
@@ -1156,13 +1221,38 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1156
1221
  getPriority() {
1157
1222
  return this.type.priority;
1158
1223
  }
1224
+ getResizerX() {
1225
+ return this.type.resizerX;
1226
+ }
1227
+ getResizerY() {
1228
+ return this.type.resizerY;
1229
+ }
1230
+ getResizerXY() {
1231
+ return this.type.resizerXY;
1232
+ }
1159
1233
  getResizableX() {
1160
- let e = this.type.resizableX;
1161
- return e === He.OnlyWhenSelected ? this.selected : e;
1234
+ switch (this.type.resizerX.mode) {
1235
+ case I.OnlyWhenSelected: return this.selected;
1236
+ case I.Always: return !0;
1237
+ case I.Never:
1238
+ default: return !1;
1239
+ }
1162
1240
  }
1163
1241
  getResizableY() {
1164
- let e = this.type.resizableY;
1165
- return e === He.OnlyWhenSelected ? this.selected : e;
1242
+ switch (this.type.resizerY.mode) {
1243
+ case I.OnlyWhenSelected: return this.selected;
1244
+ case I.Always: return !0;
1245
+ case I.Never:
1246
+ default: return !1;
1247
+ }
1248
+ }
1249
+ getResizableXY() {
1250
+ switch (this.type.resizerXY.mode) {
1251
+ case I.OnlyWhenSelected: return this.selected;
1252
+ case I.Always: return !0;
1253
+ case I.Never:
1254
+ default: return !1;
1255
+ }
1166
1256
  }
1167
1257
  getClosestPortToPoint(e) {
1168
1258
  if (this.ports.length !== 0) {
@@ -1381,13 +1471,13 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1381
1471
  for (let i of r) i.indexYInNode > e && (++i.indexYInNode, i.move([i.coords[0], i.coords[1] + n + t]));
1382
1472
  this.stretch(p.Bottom, t + n);
1383
1473
  }
1384
- }, Je = class extends N {
1474
+ }, Ze = class extends N {
1385
1475
  constructor(e) {
1386
- super(), this.types = new we(), this.model = e;
1476
+ super(), this.types = new Ne(), this.model = e;
1387
1477
  }
1388
1478
  new(e, t, n) {
1389
1479
  let r;
1390
- if (e instanceof qe) r = e;
1480
+ if (e instanceof Xe) r = e;
1391
1481
  else {
1392
1482
  let t = this.types.get(e);
1393
1483
  if (t === void 0) throw TypeError(`Node type with id '${e}' could not be found.`);
@@ -1408,7 +1498,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1408
1498
  let e = {
1409
1499
  ...L,
1410
1500
  ...a.type?.label
1411
- }, t = 6 * e.fontSize + ze(e) + Be(e), n = e.fontSize + Ve(e) + Re(e), r;
1501
+ };
1502
+ e.look = {
1503
+ ...L.look,
1504
+ ...e.look
1505
+ };
1506
+ let t = 6 * (e.look.fontSize || L.look.fontSize) + Be(e) + Ve(e), n = (e.look.fontSize || L.look.fontSize) + He(e) + ze(e), r;
1412
1507
  switch (a.direction) {
1413
1508
  case p.Bottom:
1414
1509
  case p.Left:
@@ -1420,7 +1515,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1420
1515
  break;
1421
1516
  default: r = a.coords;
1422
1517
  }
1423
- this.model.fields.new(a, r, e.fontSize, e.fontFamily, e.color, e.selectedColor, t, n, e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, "", e.editable, e.fit, e.shrink);
1518
+ this.model.fields.new(a, r, t, n, e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, e.look, "", e.editable, e.fit, e.shrink);
1424
1519
  }
1425
1520
  }
1426
1521
  if (r.label) {
@@ -1428,11 +1523,14 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1428
1523
  ...L,
1429
1524
  ...r.label
1430
1525
  };
1431
- this.model.fields.new(i, [i.coords[0] + z(e), i.coords[1] + V(e)], e.fontSize, e.fontFamily, e.color, e.selectedColor, i.width - z(e) - B(e), i.height - V(e) - R(e), e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, "", e.editable, e.fit, e.shrink);
1526
+ e.look = {
1527
+ ...L.look,
1528
+ ...e.look
1529
+ }, this.model.fields.new(i, [i.coords[0] + z(e), i.coords[1] + V(e)], i.width - z(e) - B(e), i.height - V(e) - R(e), e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, e.look, "", e.editable, e.fit, e.shrink);
1432
1530
  }
1433
1531
  if (r.decorators.length > 0) for (let e = 0; e < r.decorators.length; ++e) {
1434
1532
  let t = r.decorators[e];
1435
- this.model.decorators.new(i, [i.coords[0] + t.coords[0], i.coords[1] + t.coords[1]], t.width, t.height, i.getPriority(), t.html, `${i.id}_decorator_${e}`, t.anchorPointX || "floating", t.anchorPointY || "floating");
1533
+ this.model.decorators.new(i, [i.coords[0] + t.coords[0], i.coords[1] + t.coords[1]], t.width, t.height, i.getPriority(), t.svg, `${i.id}_decorator_${e}`, t.anchorPointX || "floating", t.anchorPointY || "floating");
1436
1534
  }
1437
1535
  return i.valueSet.resetValues(), i.model.canvas?.fitNodeInView(i.id), i;
1438
1536
  }
@@ -1451,35 +1549,101 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1451
1549
  for (let r of this) r.coords[0] < e && e < r.coords[0] + r.width && r.coords[1] < t && t < r.coords[1] + r.height && n.push(r);
1452
1550
  return n;
1453
1551
  }
1454
- }, Ye = (e) => {
1552
+ }, Qe = (e) => {
1455
1553
  for (let t = 0; t < e.length; ++t) for (let n = 0; n < e.length; ++n) n !== t && e[n].isAncestorOf(e[t]) && (e.splice(n, 1), --n, t > n && --t);
1456
1554
  return e;
1457
- }, Xe = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : e.padding.length === 1 || e.padding.length === 2 ? e.padding[0] : (e.padding.length, e.padding[2]), Ze = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : e.padding.length === 1 ? e.padding[0] : e.padding.length === 2 || e.padding.length === 3 ? e.padding[1] : e.padding[3], Qe = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : e.padding.length === 1 ? e.padding[0] : (e.padding.length === 2 || e.padding.length, e.padding[1]), $e = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : (e.padding.length === 1 || e.padding.length === 2 || e.padding.length, e.padding[0]), et = {
1555
+ }, $e = (e) => e?.padding === null || e?.padding === void 0 ? Ye.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 1 || e.padding.length === 2 ? e.padding[0] : (e.padding.length, e.padding[2]), et = (e) => e?.padding === null || e?.padding === void 0 ? Ye.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 1 ? e.padding[0] : e.padding.length === 2 || e.padding.length === 3 ? e.padding[1] : e.padding[3], tt = (e) => e?.padding === null || e?.padding === void 0 ? Ye.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 1 ? e.padding[0] : (e.padding.length === 2 || e.padding.length, e.padding[1]), nt = (e) => e?.padding === null || e?.padding === void 0 ? Ye.padding : typeof e.padding == "number" ? e.padding : (e.padding.length === 1 || e.padding.length === 2 || e.padding.length, e.padding[0]), rt = class extends Pe {
1556
+ constructor(e, t, n, r, i, a, o, s, c = "floating", l = "floating") {
1557
+ if (e.objects.get(s) !== void 0) throw Error(`DiagramDecorator with id "${s}" already exists`);
1558
+ if (!s) throw Error("DiagramDecorator cannot have an empty or null id");
1559
+ super(e, s), this.rootElement = t, this.coords = n, this.width = r, this.height = i, this.priority = a, this.svg = o, this.anchorPointX = c, this.anchorPointY = l;
1560
+ }
1561
+ get removed() {
1562
+ return this.selfRemoved || this.rootElement !== void 0 && this.rootElement.removed;
1563
+ }
1564
+ updateInView() {
1565
+ this.model.canvas?.updateDecoratorsInView(this.id);
1566
+ }
1567
+ raise() {
1568
+ this.select()?.raise();
1569
+ }
1570
+ move(e) {
1571
+ this.coords = e, this.updateInView();
1572
+ }
1573
+ getPriority() {
1574
+ return this.priority;
1575
+ }
1576
+ }, it = class extends N {
1577
+ constructor(e) {
1578
+ super(), this.model = e;
1579
+ }
1580
+ new(e, t, n, r, i, a, o, s = "floating", c = "floating") {
1581
+ let l = new rt(this.model, e, t, n, r, i, a, o, s, c);
1582
+ return super.add(l), l.updateInView(), e !== void 0 && e.decorators.push(l), l;
1583
+ }
1584
+ remove(e) {
1585
+ let t = this.get(e, !0);
1586
+ t && ((t.rootElement instanceof W || t.rootElement instanceof U) && O(t.rootElement.decorators, t), super.remove(e), t.updateInView());
1587
+ }
1588
+ }, at = class extends Pe {
1589
+ constructor(e, t, n, r, i, a, o) {
1590
+ if (e.objects.get(o) !== void 0) throw Error(`DiagramObject with id "${o}" already exists`);
1591
+ if (!o) throw Error("DiagramObject cannot have an empty or null id");
1592
+ super(e, o), this.coords = t, this.width = n, this.height = r, this.priority = i, this.svg = a;
1593
+ }
1594
+ get removed() {
1595
+ return this.selfRemoved;
1596
+ }
1597
+ updateInView() {
1598
+ this.model.canvas?.updateObjectsInView(this.id);
1599
+ }
1600
+ raise() {
1601
+ this.select()?.raise();
1602
+ }
1603
+ move(e) {
1604
+ this.coords = e, this.updateInView();
1605
+ }
1606
+ getPriority() {
1607
+ return this.priority;
1608
+ }
1609
+ }, ot = class extends N {
1610
+ constructor(e) {
1611
+ super(), this.model = e;
1612
+ }
1613
+ new(e, t, n, r, i, a) {
1614
+ let o = new at(this.model, e, t, n, r, i, a);
1615
+ return super.add(o), o.updateInView(), o;
1616
+ }
1617
+ remove(e) {
1618
+ let t = this.get(e, !0);
1619
+ t && (super.remove(e), t.updateInView());
1620
+ }
1621
+ }, st = {
1458
1622
  lookType: "shaped-look",
1459
- shape: k.Ellipse,
1623
+ shape: ae.Ellipse,
1460
1624
  fillColor: "transparent",
1461
1625
  borderColor: "transparent",
1462
1626
  borderThickness: 0,
1463
1627
  selected: { fillColor: "rgba(255, 0, 255, 0.5)" },
1464
1628
  highlighted: { fillColor: "rgba(0, 255, 255, 0.5)" }
1465
- }, tt = M(et), nt = {
1629
+ }, ct = j(st), lt = {
1466
1630
  name: "",
1467
1631
  label: null,
1468
1632
  allowsOutgoing: !0,
1469
1633
  allowsIncoming: !0,
1470
1634
  width: 24,
1471
- look: et
1472
- }, rt = class {
1635
+ look: st
1636
+ }, ut = class {
1473
1637
  constructor(e) {
1474
1638
  let t = {
1475
- ...nt,
1639
+ ...lt,
1476
1640
  ...e
1477
1641
  };
1478
1642
  this.id = t.id, this.name = t.name, this.label = t.label, this.allowsOutgoing = t.allowsOutgoing, this.allowsIncoming = t.allowsIncoming, this.width = t.width;
1479
- let n = M(t.look);
1643
+ let n = j(t.look);
1480
1644
  this.defaultLook = n.defaultLook, this.selectedLook = n.selectedLook, this.highlightedLook = n.highlightedLook, this.selectedAndHighlightedLook = n.selectedAndHighlightedLook;
1481
1645
  }
1482
- }, it = class extends Te {
1646
+ }, dt = class extends Pe {
1483
1647
  get type() {
1484
1648
  return this._type;
1485
1649
  }
@@ -1509,7 +1673,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1509
1673
  this.label && (this.label.text = e);
1510
1674
  }
1511
1675
  get look() {
1512
- return this.selected ? this.highlighted ? this._selectedAndHighlightedLook === void 0 ? (this.type || tt)?.selectedAndHighlightedLook : this._selectedAndHighlightedLook : this._selectedLook === void 0 ? (this.type || tt)?.selectedLook : this._selectedLook : this.highlighted ? this._highlightedLook === void 0 ? (this.type || tt)?.highlightedLook : this._highlightedLook : this._defaultLook === void 0 ? (this.type || tt)?.defaultLook : this._defaultLook;
1676
+ return this.selected ? this.highlighted ? this._selectedAndHighlightedLook === void 0 ? (this.type || ct)?.selectedAndHighlightedLook : this._selectedAndHighlightedLook : this._selectedLook === void 0 ? (this.type || ct)?.selectedLook : this._selectedLook : this.highlighted ? this._highlightedLook === void 0 ? (this.type || ct)?.highlightedLook : this._highlightedLook : this._defaultLook === void 0 ? (this.type || ct)?.defaultLook : this._defaultLook;
1513
1677
  }
1514
1678
  set look(e) {
1515
1679
  this.lookConfig = e;
@@ -1519,7 +1683,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1519
1683
  }
1520
1684
  set lookConfig(e) {
1521
1685
  if (this._lookConfig = e, e) {
1522
- let t = M(e);
1686
+ let t = j(e);
1523
1687
  this._defaultLook = {
1524
1688
  ...this._defaultLook,
1525
1689
  ...t.defaultLook
@@ -1536,7 +1700,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1536
1700
  } else this._defaultLook = e, this._selectedLook = e, this._highlightedLook = e, this._selectedAndHighlightedLook = e;
1537
1701
  }
1538
1702
  get width() {
1539
- return this.type?.width || nt.width;
1703
+ return this.type?.width || lt.width;
1540
1704
  }
1541
1705
  get height() {
1542
1706
  return this.width;
@@ -1566,7 +1730,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1566
1730
  }
1567
1731
  getNode() {
1568
1732
  if (this.rootElement instanceof W) return this.rootElement;
1569
- if (this.rootElement instanceof H) return this.rootElement.node;
1733
+ if (this.rootElement instanceof U) return this.rootElement.node;
1570
1734
  }
1571
1735
  getPriority() {
1572
1736
  return this.rootElement?.getPriority() || 0;
@@ -1581,12 +1745,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1581
1745
  distanceTo(e) {
1582
1746
  return x(this.coords, e);
1583
1747
  }
1584
- }, at = class extends N {
1748
+ }, ft = class extends N {
1585
1749
  constructor(e) {
1586
- super(), this.types = new we(), this.model = e;
1750
+ super(), this.types = new Ne(), this.model = e;
1587
1751
  }
1588
1752
  new(e, t, n, r, i, a, o = "floating", s = "floating") {
1589
- let c = new it(this.model, e, t, n, r, i, a, o, s);
1753
+ let c = new dt(this.model, e, t, n, r, i, a, o, s);
1590
1754
  return super.add(c), c.updateInView(), t !== void 0 && t.ports.push(c), c;
1591
1755
  }
1592
1756
  remove(e) {
@@ -1594,29 +1758,34 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1594
1758
  if (t) {
1595
1759
  for (; t.outgoingConnections.length > 0;) this.model.connections.remove(t.outgoingConnections[0].id);
1596
1760
  for (; t.incomingConnections.length > 0;) this.model.connections.remove(t.incomingConnections[0].id);
1597
- t.label && this.model.fields.remove(t.label.id), (t.rootElement instanceof W || t.rootElement instanceof H) && O(t.rootElement.ports, t), super.remove(e), t.updateInView();
1761
+ t.label && this.model.fields.remove(t.label.id), (t.rootElement instanceof W || t.rootElement instanceof U) && O(t.rootElement.ports, t), super.remove(e), t.updateInView();
1598
1762
  }
1599
1763
  }
1600
- }, ot = class {
1764
+ }, pt = class {
1601
1765
  import(e, t) {
1602
1766
  e.clear(), t.id && (e.id = t.id), e.name = t.name, e.description = t.description, e.type = t.type, e.createdAt = new Date(t.createdAt), e.updatedAt = new Date(t.updatedAt);
1603
1767
  for (let n of t.nodes || []) this.importNode(e, n);
1604
1768
  for (let n of t.connections || []) this.importConnection(e, n);
1769
+ for (let n of t.objects || []) {
1770
+ let t = new at(e, n.coords, n.width, n.height, n.priority, n.svg, n.id);
1771
+ n.collabMeta && (t.selfRemoved = n.collabMeta.selfRemoved), e.objects.add(t), t.updateInView();
1772
+ }
1605
1773
  return t.data && e.valueSet.setValues(t.data), t.collabMeta && (e.logicalClock = t.collabMeta.logicalClock, e.valueSet.setTimestamps(t.collabMeta.dataTimestamps)), e;
1606
1774
  }
1607
1775
  importNode(e, t) {
1608
1776
  let n = e.nodes.types.get(t.type);
1609
1777
  if (n) {
1610
1778
  let r = new W(e, n, t.coords, t.id);
1611
- if (e.nodes.add(r), r.width = t.width, r.height = t.height, n.decorators) for (let t = 0; t < n.decorators.length; ++t) {
1612
- let i = n.decorators[t];
1613
- e.decorators.new(r, [r.coords[0] + i.coords[0], r.coords[1] + i.coords[1]], i.width, i.height, r.getPriority(), i.html, `${r.id}_decorator_${t}`);
1614
- }
1615
- if (n.label) {
1779
+ if (e.nodes.add(r), r.width = t.width, r.height = t.height, n.label) {
1616
1780
  let i = {
1617
1781
  ...L,
1618
1782
  ...n.label
1619
- }, a = new Ie(e, r, [r.coords[0] + z(i), r.coords[1] + V(i)], r.width - z(i) - B(i), r.height - V(i) - R(i), i.fontSize, i.fontFamily, i.color, i.selectedColor, i.horizontalAlign, i.verticalAlign, i.orientation, i.multiline, "", i.editable, i.fit, i.shrink);
1783
+ };
1784
+ i.look = {
1785
+ ...L.look,
1786
+ ...i.look
1787
+ };
1788
+ let a = new Le(e, r, [r.coords[0] + z(i), r.coords[1] + V(i)], r.width - z(i) - B(i), r.height - V(i) - R(i), i.horizontalAlign, i.verticalAlign, i.orientation, i.multiline, i.look, "", i.editable, i.fit, i.shrink);
1620
1789
  a.text = t.label, r.label = a, e.fields.add(a), a.updateInView();
1621
1790
  }
1622
1791
  for (let n of t.children || []) {
@@ -1624,94 +1793,117 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1624
1793
  t !== void 0 && (r.children?.push(t), t.parent = r);
1625
1794
  }
1626
1795
  for (let i of t.sections || []) {
1627
- let t = new H(e, r, i.indexXInNode, i.indexYInNode, i.coords, i.width, i.height, i.id);
1796
+ let t = new U(e, r, i.indexXInNode, i.indexYInNode, i.coords, i.width, i.height, i.id);
1628
1797
  if (r.sections?.push(t), e.sections.add(t), n.sectionGrid?.sections?.[i.indexYInNode]?.[i.indexXInNode]?.label) {
1629
1798
  let r = {
1630
1799
  ...L,
1631
1800
  ...n.sectionGrid?.sections?.[i.indexYInNode]?.[i.indexXInNode]?.label
1632
- }, a = new Ie(e, t, [t.coords[0] + z(r), t.coords[1] + V(r)], t.width - z(r) - B(r), t.height - V(r) - R(r), r.fontSize, r.fontFamily, r.color, r.selectedColor, r.horizontalAlign, r.verticalAlign, r.orientation, r.multiline, "", r.editable, r.fit, r.shrink);
1801
+ };
1802
+ r.look = {
1803
+ ...L.look,
1804
+ ...r.look
1805
+ };
1806
+ let a = new Le(e, t, [t.coords[0] + z(r), t.coords[1] + V(r)], t.width - z(r) - B(r), t.height - V(r) - R(r), r.horizontalAlign, r.verticalAlign, r.orientation, r.multiline, r.look, "", r.editable, r.fit, r.shrink);
1633
1807
  a.text = i.label, t.label = a, e.fields.add(a), a.updateInView();
1634
1808
  }
1635
1809
  let a = 0;
1636
1810
  for (let r of i.ports || []) {
1637
- let i = r.type === void 0 ? void 0 : e.ports.types.get(r.type), o = new it(e, i, t, r.coords, r.connectionPoint || r.coords, r.direction, r.id);
1811
+ let i = r.type === void 0 ? void 0 : e.ports.types.get(r.type), o = new dt(e, i, t, r.coords, r.connectionPoint || r.coords, r.direction, r.id);
1638
1812
  if (t.ports.push(o), e.ports.add(o), r.label) {
1639
1813
  if (n.ports.length > a && i?.label) {
1640
1814
  let t = {
1641
1815
  ...L,
1642
1816
  ...i?.label
1643
- }, n;
1817
+ };
1818
+ t.look = {
1819
+ ...L.look,
1820
+ ...t.look
1821
+ };
1822
+ let n;
1644
1823
  switch (o.direction) {
1645
1824
  case p.Top:
1646
1825
  case p.Left:
1647
- n = [o.coords[0] - t.fontSize, o.coords[1] - t.fontSize];
1826
+ n = [o.coords[0] - (t.look.fontSize || L.look.fontSize), o.coords[1] - (t.look.fontSize || L.look.fontSize)];
1648
1827
  break;
1649
1828
  case p.Bottom:
1650
- n = [o.coords[0] - t.fontSize, o.coords[1] + t.fontSize];
1829
+ n = [o.coords[0] - (t.look.fontSize || L.look.fontSize), o.coords[1] + (t.look.fontSize || L.look.fontSize)];
1651
1830
  break;
1652
1831
  case p.Right:
1653
- n = [o.coords[0] + t.fontSize, o.coords[1] - t.fontSize];
1832
+ n = [o.coords[0] + (t.look.fontSize || L.look.fontSize), o.coords[1] - (t.look.fontSize || L.look.fontSize)];
1654
1833
  break;
1655
1834
  default: n = o.coords;
1656
1835
  }
1657
- let a = new Ie(e, o, n, t.fontSize, t.fontSize, t.fontSize, t.fontFamily, t.color, t.selectedColor, t.horizontalAlign, t.verticalAlign, t.orientation, t.multiline, "", t.editable, t.fit, t.shrink);
1836
+ let a = new Le(e, o, n, t.look.fontSize || L.look.fontSize, t.look.fontSize || L.look.fontSize, t.horizontalAlign, t.verticalAlign, t.orientation, t.multiline, t.look, "", t.editable, t.fit, t.shrink);
1658
1837
  a.text = r.label, o.label = a, e.fields.add(a), a.updateInView();
1659
1838
  }
1660
1839
  ++a;
1661
1840
  }
1662
1841
  r.collabMeta && (o.selfRemoved = r.collabMeta.selfRemoved, o.selfRemovedTimestamp = r.collabMeta.selfRemovedTimestamp, this.importLabelCollabMeta(o.label, r.collabMeta.label)), o.updateInView();
1663
1842
  }
1843
+ for (let n of i.decorators || []) {
1844
+ let i = new rt(e, t, n.coords, n.width, n.height, n.priority, n.svg, n.id, n.anchorPoints[0], n.anchorPoints[1]);
1845
+ n.collabMeta && (i.selfRemoved = n.collabMeta.selfRemoved), r.decorators.push(i), e.decorators.add(i), i.updateInView();
1846
+ }
1664
1847
  i.collabMeta && (t.selfRemoved = i.collabMeta.selfRemoved, t.selfRemovedTimestamp = i.collabMeta.selfRemovedTimestamp, this.importLabelCollabMeta(t.label, i.collabMeta.label)), t.updateInView();
1665
1848
  }
1666
1849
  let i = 0;
1667
1850
  for (let a of t.ports || []) {
1668
- let t = a.type === void 0 ? void 0 : e.ports.types.get(a.type), o = new it(e, t, r, a.coords, a.connectionPoint || a.coords, a.direction, a.id);
1851
+ let t = a.type === void 0 ? void 0 : e.ports.types.get(a.type), o = new dt(e, t, r, a.coords, a.connectionPoint || a.coords, a.direction, a.id);
1669
1852
  if (r.ports.push(o), e.ports.add(o), a.label) {
1670
1853
  if (n.ports.length > i && t?.label) {
1671
1854
  let n = {
1672
1855
  ...L,
1673
1856
  ...t?.label
1674
- }, r;
1857
+ };
1858
+ n.look = {
1859
+ ...L.look,
1860
+ ...n.look
1861
+ };
1862
+ let r;
1675
1863
  switch (o.direction) {
1676
1864
  case p.Top:
1677
1865
  case p.Left:
1678
- r = [o.coords[0] - n.fontSize, o.coords[1] - n.fontSize];
1866
+ r = [o.coords[0] - (n.look.fontSize || L.look.fontSize), o.coords[1] - (n.look.fontSize || L.look.fontSize)];
1679
1867
  break;
1680
1868
  case p.Bottom:
1681
- r = [o.coords[0] - n.fontSize, o.coords[1] + n.fontSize];
1869
+ r = [o.coords[0] - (n.look.fontSize || L.look.fontSize), o.coords[1] + (n.look.fontSize || L.look.fontSize)];
1682
1870
  break;
1683
1871
  case p.Right:
1684
- r = [o.coords[0] + n.fontSize, o.coords[1] - n.fontSize];
1872
+ r = [o.coords[0] + (n.look.fontSize || L.look.fontSize), o.coords[1] - (n.look.fontSize || L.look.fontSize)];
1685
1873
  break;
1686
1874
  default: r = o.coords;
1687
1875
  }
1688
- let i = new Ie(e, o, r, n.fontSize, n.fontSize, n.fontSize, n.fontFamily, n.color, n.selectedColor, n.horizontalAlign, n.verticalAlign, n.orientation, n.multiline, "", n.editable, n.fit, n.shrink);
1876
+ let i = new Le(e, o, r, n.look.fontSize || L.look.fontSize, n.look.fontSize || L.look.fontSize, n.horizontalAlign, n.verticalAlign, n.orientation, n.multiline, n.look, "", n.editable, n.fit, n.shrink);
1689
1877
  i.text = a.label, o.label = i, e.fields.add(i), i.updateInView();
1690
1878
  }
1691
1879
  ++i;
1692
1880
  }
1693
1881
  a.collabMeta && (o.selfRemoved = a.collabMeta.selfRemoved, o.selfRemovedTimestamp = a.collabMeta.selfRemovedTimestamp, this.importLabelCollabMeta(o.label, a.collabMeta.label)), o.updateInView();
1694
1882
  }
1883
+ for (let n of t.decorators || []) {
1884
+ let t = new rt(e, r, n.coords, n.width, n.height, n.priority, n.svg, n.id, n.anchorPoints[0], n.anchorPoints[1]);
1885
+ n.collabMeta && (t.selfRemoved = n.collabMeta.selfRemoved), r.decorators.push(t), e.decorators.add(t), t.updateInView();
1886
+ }
1695
1887
  return t.data && r.valueSet.setValues(t.data), t.collabMeta && (r.selfRemoved = t.collabMeta.selfRemoved, r.selfRemovedTimestamp = t.collabMeta.selfRemovedTimestamp, r.geometryTimestamp = t.collabMeta.geometryTimestamp, this.importLabelCollabMeta(r.label, t.collabMeta.label), r.valueSet.setTimestamps(t.collabMeta.dataTimestamps)), r.updateInView(), r.raise(), r;
1696
1888
  }
1697
1889
  }
1698
1890
  importConnection(e, t) {
1699
1891
  let n = e.connections.types.get(t.type);
1700
1892
  if (n) {
1701
- let r = new I(e, n, t.start ? e.ports.get(t.start) : void 0, t.end ? e.ports.get(t.end) : void 0, t.id);
1893
+ let r = new F(e, n, t.start ? e.ports.get(t.start) : void 0, t.end ? e.ports.get(t.end) : void 0, t.id);
1702
1894
  return e.connections.add(r), r.startLabel = t.startLabel, r.middleLabel = t.middleLabel, r.endLabel = t.endLabel, r.points = t.points, t.data && r.valueSet.setValues(t.data), t.collabMeta && (r.selfRemoved = t.collabMeta.selfRemoved, r.selfRemovedTimestamp = t.collabMeta.selfRemovedTimestamp, r.valueSet.setTimestamps(t.collabMeta.dataTimestamps)), r.updateInView(), r.raise(), r;
1703
1895
  }
1704
1896
  }
1705
1897
  importLabelCollabMeta(e, t) {
1706
1898
  e && t && (e.selfRemoved = t.selfRemoved, e.selfRemovedTimestamp = t.selfRemovedTimestamp, e.textTimestamp = t.textTimestamp);
1707
1899
  }
1708
- }, st = class e {
1900
+ }, mt = class e {
1709
1901
  constructor(e, t, n, r, i, a, o) {
1710
1902
  this.canvas = e, this.id = t, this.typeId = n, this.coords = r, this.parentId = i, this.label = a, this.values = o;
1711
1903
  }
1712
1904
  do() {
1713
1905
  let e = this.canvas.model.nodes.new(this.typeId, this.coords, this.id);
1714
- this.parentId !== void 0 && this.canvas.model.nodes.get(this.parentId)?.addChild(e), e.label && (e.label.text = this.label || ""), this.values === void 0 ? e.valueSet.resetValues() : e.valueSet.setValues(Ce({
1906
+ this.parentId !== void 0 && this.canvas.model.nodes.get(this.parentId)?.addChild(e), e.label && (e.label.text = this.label || ""), this.values === void 0 ? e.valueSet.resetValues() : e.valueSet.setValues(we({
1715
1907
  ...e.valueSet.getValues(),
1716
1908
  ...this.values
1717
1909
  }));
@@ -1730,13 +1922,13 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1730
1922
  static deserialize(t, n) {
1731
1923
  return new e(t, n.id, n.typeId, n.coords, n.parentId, n.label, n.values);
1732
1924
  }
1733
- }, ct = class e {
1925
+ }, ht = class e {
1734
1926
  constructor(e, t, n, r, i, a, o) {
1735
1927
  this.canvas = e, this.nodeId = t, this.copyColumnIndex = n, this.copyRowIndex = r, this.removeColumnIndex = i, this.removeRowIndex = a, this.timestamp = o;
1736
1928
  }
1737
1929
  do() {
1738
1930
  let e = this.canvas.model.nodes.get(this.nodeId);
1739
- e && Oe(this.timestamp, e.geometryTimestamp) && (this.copyColumnIndex !== void 0 && e.copySectionColumn(this.copyColumnIndex), this.copyRowIndex !== void 0 && e.copySectionRow(this.copyRowIndex), this.removeColumnIndex !== void 0 && e.removeSectionColumn(this.removeColumnIndex), this.removeRowIndex !== void 0 && e.removeSectionRow(this.removeRowIndex), e.geometryTimestamp = this.timestamp);
1931
+ e && De(this.timestamp, e.geometryTimestamp) && (this.copyColumnIndex !== void 0 && e.copySectionColumn(this.copyColumnIndex), this.copyRowIndex !== void 0 && e.copySectionRow(this.copyRowIndex), this.removeColumnIndex !== void 0 && e.removeSectionColumn(this.removeColumnIndex), this.removeRowIndex !== void 0 && e.removeSectionRow(this.removeRowIndex), e.geometryTimestamp = this.timestamp);
1740
1932
  }
1741
1933
  serialize() {
1742
1934
  return {
@@ -1752,14 +1944,14 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1752
1944
  static deserialize(t, n) {
1753
1945
  return new e(t, n.nodeId, n.copyColumnIndex, n.copyRowIndex, n.removeColumnIndex, n.removeRowIndex, n.timestamp);
1754
1946
  }
1755
- }, lt = class e {
1947
+ }, gt = class e {
1756
1948
  constructor(e, t, n) {
1757
1949
  this.canvas = e, this.to = t, this.timestamp = n;
1758
1950
  }
1759
1951
  do() {
1760
1952
  for (let e in this.to) {
1761
1953
  let t = this.canvas.model.nodes.get(e, !0);
1762
- if (t && Oe(this.timestamp, t.geometryTimestamp)) {
1954
+ if (t && De(this.timestamp, t.geometryTimestamp)) {
1763
1955
  let n = this.to[e];
1764
1956
  t.move([n[0], n[1]]), t.geometryTimestamp = this.timestamp;
1765
1957
  }
@@ -1775,14 +1967,14 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1775
1967
  static deserialize(t, n) {
1776
1968
  return new e(t, n.to, n.timestamp);
1777
1969
  }
1778
- }, ut = class e {
1970
+ }, _t = class e {
1779
1971
  constructor(e, t, n, r) {
1780
1972
  this.canvas = e, this.nodeIds = t, this.delta = n, this.timestamp = r;
1781
1973
  }
1782
1974
  do() {
1783
1975
  for (let e of this.nodeIds) {
1784
1976
  let t = this.canvas.model.nodes.get(e, !0);
1785
- t && Oe(this.timestamp, t.geometryTimestamp) && (t.move([t.coords[0] + this.delta[0], t.coords[1] + this.delta[1]]), t.parent?.fitToChild(t), t.geometryTimestamp = this.timestamp);
1977
+ t && De(this.timestamp, t.geometryTimestamp) && (t.move([t.coords[0] + this.delta[0], t.coords[1] + this.delta[1]]), t.parent?.fitToChild(t), t.geometryTimestamp = this.timestamp);
1786
1978
  }
1787
1979
  }
1788
1980
  serialize() {
@@ -1802,7 +1994,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1802
1994
  }
1803
1995
  do() {
1804
1996
  let e = this.canvas.model.nodes.get(this.nodeId, !0);
1805
- if (e && Oe(this.timestamp, e.geometryTimestamp)) {
1997
+ if (e && De(this.timestamp, e.geometryTimestamp)) {
1806
1998
  e.setGeometry(this.to), e.label?.fit && this.canvas.fitFieldRootInView(e.label.id, e.label.shrink);
1807
1999
  for (let t of e.sections) t.label?.fit && this.canvas.fitFieldRootInView(t.label.id, t.label.shrink);
1808
2000
  e.parent?.fitToChild(e), e.geometryTimestamp = this.timestamp;
@@ -1819,13 +2011,13 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1819
2011
  static deserialize(t, n) {
1820
2012
  return new e(t, n.nodeId, n.to, n.timestamp);
1821
2013
  }
1822
- }, dt = class e {
2014
+ }, vt = class e {
1823
2015
  constructor(e, t, n, r, i) {
1824
2016
  this.canvas = e, this.childId = t, this.parentId = n, this.childGeometry = r, this.timestamp = i;
1825
2017
  }
1826
2018
  do() {
1827
2019
  let e = this.canvas.model.nodes.get(this.childId, !0), t = this.parentId === void 0 ? void 0 : this.canvas.model.nodes.get(this.parentId, !0);
1828
- e && (this.parentId === void 0 || t) && Oe(this.timestamp, e.geometryTimestamp) && (e.parent?.removeChild(e), e.setGeometry(this.childGeometry), t?.addChild(e));
2020
+ e && (this.parentId === void 0 || t) && De(this.timestamp, e.geometryTimestamp) && (e.parent?.removeChild(e), e.setGeometry(this.childGeometry), t?.addChild(e));
1829
2021
  }
1830
2022
  serialize() {
1831
2023
  return {
@@ -1839,7 +2031,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1839
2031
  static deserialize(t, n) {
1840
2032
  return new e(t, n.childId, n.parentId, n.childGeometry, n.timestamp);
1841
2033
  }
1842
- }, ft = class e {
2034
+ }, yt = class e {
1843
2035
  constructor(e, t, n, r, i) {
1844
2036
  this.canvas = e, this.id = t, this.typeId = n, this.startId = r, this.endId = i;
1845
2037
  }
@@ -1859,13 +2051,13 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1859
2051
  static deserialize(t, n) {
1860
2052
  return new e(t, n.id, n.typeId, n.startId, n.endId);
1861
2053
  }
1862
- }, pt = class e {
2054
+ }, bt = class e {
1863
2055
  constructor(e, t, n, r) {
1864
2056
  this.canvas = e, this.fieldId = t, this.to = n, this.timestamp = r;
1865
2057
  }
1866
2058
  do() {
1867
2059
  let e = this.canvas.model.fields.get(this.fieldId, !0);
1868
- e && Oe(this.timestamp, e.textTimestamp) && (e.text = this.to, e.textTimestamp = this.timestamp);
2060
+ e && De(this.timestamp, e.textTimestamp) && (e.text = this.to, e.textTimestamp = this.timestamp);
1869
2061
  }
1870
2062
  serialize() {
1871
2063
  return {
@@ -1878,7 +2070,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1878
2070
  static deserialize(t, n) {
1879
2071
  return new e(t, n.fieldId, n.to, n.timestamp);
1880
2072
  }
1881
- }, mt = class e {
2073
+ }, xt = class e {
1882
2074
  constructor(e, t, n, r) {
1883
2075
  this.canvas = e, this.id = t, this.to = n, this.timestamp = r;
1884
2076
  }
@@ -1899,12 +2091,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1899
2091
  static deserialize(t, n) {
1900
2092
  return new e(t, n.id, n.to, n.timestamp);
1901
2093
  }
1902
- }, K = class e {
2094
+ }, St = class e {
1903
2095
  constructor(e, t, n, r, i, a, o, s) {
1904
2096
  this.canvas = e, this.nodeIds = t, this.sectionIds = n, this.portIds = r, this.connectionIds = i, this.fieldIds = a, this.selfRemoved = o, this.timestamp = s;
1905
2097
  }
1906
2098
  doOne(e) {
1907
- e && Oe(this.timestamp, e.selfRemovedTimestamp) && (e.selfRemoved = this.selfRemoved, e.selfRemovedTimestamp = this.timestamp);
2099
+ e && De(this.timestamp, e.selfRemovedTimestamp) && (e.selfRemoved = this.selfRemoved, e.selfRemovedTimestamp = this.timestamp);
1908
2100
  }
1909
2101
  do() {
1910
2102
  for (let e of this.nodeIds) this.doOne(this.canvas.model.nodes.get(e, !0));
@@ -1929,12 +2121,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1929
2121
  static deserialize(t, n) {
1930
2122
  return new e(t, n.nodeIds, n.sectionIds, n.portIds, n.connectionIds, n.fieldIds, n.removed, n.timestamp);
1931
2123
  }
1932
- }, ht = class e {
2124
+ }, Ct = class e {
1933
2125
  constructor(e, t, n) {
1934
2126
  this.canvas = e, this.nodes = t, this.connections = n;
1935
2127
  }
1936
2128
  do() {
1937
- let e = new ot();
2129
+ let e = new pt();
1938
2130
  this.canvas.userSelection.clear();
1939
2131
  for (let t of this.nodes) {
1940
2132
  let n = e.importNode(this.canvas.model, t);
@@ -1955,15 +2147,15 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1955
2147
  static deserialize(t, n) {
1956
2148
  return new e(t, n.nodes, n.connections);
1957
2149
  }
1958
- }, gt = class {
2150
+ }, wt = class {
1959
2151
  constructor(e) {
1960
- this.isInRoom = !1, this.canvas = e, this.replicaId = xe();
2152
+ this.isInRoom = !1, this.canvas = e, this.replicaId = Se();
1961
2153
  }
1962
2154
  freshTimestamp() {
1963
2155
  return this.canvas.model.logicalClock++, [this.canvas.model.logicalClock, this.replicaId];
1964
2156
  }
1965
2157
  freshId() {
1966
- return "id" + xe();
2158
+ return "id" + Se();
1967
2159
  }
1968
2160
  doCollaboratively(e) {
1969
2161
  if (e.do(), this.onSend) {
@@ -1974,49 +2166,49 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
1974
2166
  receive(e) {
1975
2167
  switch ("timestamp" in e && (this.canvas.model.logicalClock = Math.max(this.canvas.model.logicalClock, e.timestamp[0])), e.type) {
1976
2168
  case "addNode":
1977
- st.deserialize(this.canvas, e).do();
2169
+ mt.deserialize(this.canvas, e).do();
1978
2170
  break;
1979
2171
  case "addSection":
1980
- ct.deserialize(this.canvas, e).do();
2172
+ ht.deserialize(this.canvas, e).do();
1981
2173
  break;
1982
2174
  case "applyLayout":
1983
- lt.deserialize(this.canvas, e).do();
2175
+ gt.deserialize(this.canvas, e).do();
1984
2176
  break;
1985
2177
  case "move":
1986
- ut.deserialize(this.canvas, e).do();
2178
+ _t.deserialize(this.canvas, e).do();
1987
2179
  break;
1988
2180
  case "setGeometry":
1989
2181
  G.deserialize(this.canvas, e).do();
1990
2182
  break;
1991
2183
  case "setParent":
1992
- dt.deserialize(this.canvas, e).do();
2184
+ vt.deserialize(this.canvas, e).do();
1993
2185
  break;
1994
2186
  case "addConnection":
1995
- ft.deserialize(this.canvas, e).do();
2187
+ yt.deserialize(this.canvas, e).do();
1996
2188
  break;
1997
2189
  case "editField":
1998
- pt.deserialize(this.canvas, e).do();
2190
+ bt.deserialize(this.canvas, e).do();
1999
2191
  break;
2000
2192
  case "updateValues":
2001
- mt.deserialize(this.canvas, e).do();
2193
+ xt.deserialize(this.canvas, e).do();
2002
2194
  break;
2003
2195
  case "setSelfRemoved":
2004
- K.deserialize(this.canvas, e).do();
2196
+ St.deserialize(this.canvas, e).do();
2005
2197
  break;
2006
2198
  case "paste":
2007
- ht.deserialize(this.canvas, e).do();
2199
+ Ct.deserialize(this.canvas, e).do();
2008
2200
  break;
2009
2201
  default: console.error("Unknown CollabAction type, skipping:", e);
2010
2202
  }
2011
2203
  }
2012
- }, _t = class {
2204
+ }, Tt = class {
2013
2205
  constructor(e, t) {
2014
2206
  this.canvas = e, this.maximum = t, this.history = [], this.index = 0;
2015
2207
  }
2016
2208
  add(e) {
2017
2209
  this.index < this.history.length && (this.history = this.history.slice(0, this.index)), this.history.length >= this.maximum ? (this.history = this.history.slice(1, this.history.length), this.history.push(e)) : (this.history.push(e), ++this.index), this.canvas.diagramChange$.next({
2018
2210
  action: e,
2019
- method: vt.Do
2211
+ method: 0
2020
2212
  });
2021
2213
  }
2022
2214
  undo() {
@@ -2029,7 +2221,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2029
2221
  }
2030
2222
  this.canvas.diagramChange$.next({
2031
2223
  action: e,
2032
- method: vt.Undo
2224
+ method: 1
2033
2225
  });
2034
2226
  }
2035
2227
  redo() {
@@ -2042,19 +2234,17 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2042
2234
  }
2043
2235
  this.canvas.diagramChange$.next({
2044
2236
  action: e,
2045
- method: vt.Redo
2237
+ method: 2
2046
2238
  });
2047
2239
  }
2048
- }, vt = /* @__PURE__ */ function(e) {
2049
- return e[e.Do = 0] = "Do", e[e.Undo = 1] = "Undo", e[e.Redo = 2] = "Redo", e;
2050
- }({}), q = /* @__PURE__ */ function(e) {
2240
+ }, K = /* @__PURE__ */ function(e) {
2051
2241
  return e.AddConnection = "add-connection", e.AddNode = "add-node", e.AddSectionAction = "add-section", e.ApplyLayout = "apply-layout", e.Clipboard = "clipboard", e.ContextMenu = "context-menu", e.EditField = "edit-field", e.MoveNode = "move-node", e.Paste = "paste", e.Remove = "remove", e.StretchNode = "stretch-node", e.StretchSection = "stretch-section", e.UpdateValues = "update-values", e.Zoom = "zoom", e;
2052
- }({}), yt = class {
2242
+ }({}), Et = class {
2053
2243
  constructor(e, t, n, r, i, a, o, s, c) {
2054
2244
  this.canvas = e, this.type = t, this.coords = n, this.parentId = r, this.ancestorId = i, this.fromAncestorGeometry = a, this.toAncestorGeometry = o, this.label = s, this.values = c, this.id = this.canvas.collabEngine.freshId();
2055
2245
  }
2056
2246
  do() {
2057
- let e = new st(this.canvas, this.id, this.type.id, this.coords, this.parentId, this.label, this.values);
2247
+ let e = new mt(this.canvas, this.id, this.type.id, this.coords, this.parentId, this.label, this.values);
2058
2248
  if (this.canvas.collabEngine.doCollaboratively(e), this.ancestorId !== void 0 && this.toAncestorGeometry !== void 0) {
2059
2249
  let e = new G(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
2060
2250
  this.canvas.collabEngine.doCollaboratively(e);
@@ -2062,7 +2252,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2062
2252
  return !0;
2063
2253
  }
2064
2254
  undo() {
2065
- let e = this.canvas.model.nodes.get(this.id), t = new K(this.canvas, [this.id], [], [], [], [], !0, this.canvas.collabEngine.freshTimestamp());
2255
+ let e = this.canvas.model.nodes.get(this.id), t = new St(this.canvas, [this.id], [], [], [], [], !0, this.canvas.collabEngine.freshTimestamp());
2066
2256
  if (this.canvas.collabEngine.doCollaboratively(t), this.ancestorId !== void 0 && this.fromAncestorGeometry !== void 0) {
2067
2257
  let e = new G(this.canvas, this.ancestorId, this.fromAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
2068
2258
  this.canvas.collabEngine.doCollaboratively(e);
@@ -2070,29 +2260,29 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2070
2260
  return e !== void 0;
2071
2261
  }
2072
2262
  redo() {
2073
- let e = this.canvas.model.nodes.get(this.id), t = new K(this.canvas, [this.id], [], [], [], [], !1, this.canvas.collabEngine.freshTimestamp());
2263
+ let e = this.canvas.model.nodes.get(this.id), t = new St(this.canvas, [this.id], [], [], [], [], !1, this.canvas.collabEngine.freshTimestamp());
2074
2264
  if (this.canvas.collabEngine.doCollaboratively(t), this.ancestorId !== void 0 && this.toAncestorGeometry !== void 0) {
2075
2265
  let e = new G(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
2076
2266
  this.canvas.collabEngine.doCollaboratively(e);
2077
2267
  }
2078
2268
  return e === void 0;
2079
2269
  }
2080
- }, bt = class {
2270
+ }, Dt = class {
2081
2271
  constructor(e, t, n) {
2082
2272
  this.canvas = e, this.nodeIds = t, this.delta = n;
2083
2273
  }
2084
2274
  do() {
2085
- let e = new ut(this.canvas, this.nodeIds, this.delta, this.canvas.collabEngine.freshTimestamp());
2275
+ let e = new _t(this.canvas, this.nodeIds, this.delta, this.canvas.collabEngine.freshTimestamp());
2086
2276
  return this.canvas.collabEngine.doCollaboratively(e), this.nodeIds.map((e) => this.canvas.model.nodes.get(e) !== void 0).includes(!0) && (this.delta[0] !== 0 || this.delta[1] !== 0);
2087
2277
  }
2088
2278
  undo() {
2089
- let e = new ut(this.canvas, this.nodeIds, [-this.delta[0], -this.delta[1]], this.canvas.collabEngine.freshTimestamp());
2279
+ let e = new _t(this.canvas, this.nodeIds, [-this.delta[0], -this.delta[1]], this.canvas.collabEngine.freshTimestamp());
2090
2280
  return this.canvas.collabEngine.doCollaboratively(e), this.nodeIds.map((e) => this.canvas.model.nodes.get(e) !== void 0).includes(!0) && (this.delta[0] !== 0 || this.delta[1] !== 0);
2091
2281
  }
2092
2282
  redo() {
2093
2283
  return this.do();
2094
2284
  }
2095
- }, J = class {
2285
+ }, q = class {
2096
2286
  constructor(e, t, n, r, i, a, o, s) {
2097
2287
  this.canvas = e, this.intent = t, this.nodeId = n, this.from = r, this.to = i, this.ancestorId = a, this.fromAncestorGeometry = o, this.toAncestorGeometry = s;
2098
2288
  }
@@ -2128,12 +2318,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2128
2318
  }
2129
2319
  return e !== void 0;
2130
2320
  }
2131
- }, xt = class {
2321
+ }, Ot = class {
2132
2322
  constructor(e, t, n, r, i, a, o, s, c) {
2133
2323
  this.canvas = e, this.childId = t, this.fromParentId = n, this.toParentId = r, this.fromChildGeometry = i, this.toChildGeometry = a, this.ancestorId = o, this.fromAncestorGeometry = s, this.toAncestorGeometry = c;
2134
2324
  }
2135
2325
  do() {
2136
- let e = this.canvas.model.nodes.get(this.childId), t = new dt(this.canvas, this.childId, this.toParentId, this.toChildGeometry, this.canvas.collabEngine.freshTimestamp());
2326
+ let e = this.canvas.model.nodes.get(this.childId), t = new vt(this.canvas, this.childId, this.toParentId, this.toChildGeometry, this.canvas.collabEngine.freshTimestamp());
2137
2327
  if (this.canvas.collabEngine.doCollaboratively(t), this.ancestorId !== void 0 && this.toAncestorGeometry !== void 0) {
2138
2328
  let e = new G(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
2139
2329
  this.canvas.collabEngine.doCollaboratively(e);
@@ -2141,7 +2331,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2141
2331
  return e !== void 0;
2142
2332
  }
2143
2333
  undo() {
2144
- let e = this.canvas.model.nodes.get(this.childId), t = new dt(this.canvas, this.childId, this.fromParentId, this.fromChildGeometry, this.canvas.collabEngine.freshTimestamp());
2334
+ let e = this.canvas.model.nodes.get(this.childId), t = new vt(this.canvas, this.childId, this.fromParentId, this.fromChildGeometry, this.canvas.collabEngine.freshTimestamp());
2145
2335
  if (this.canvas.collabEngine.doCollaboratively(t), this.ancestorId !== void 0 && this.fromAncestorGeometry !== void 0) {
2146
2336
  let e = new G(this.canvas, this.ancestorId, this.fromAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
2147
2337
  this.canvas.collabEngine.doCollaboratively(e);
@@ -2151,35 +2341,35 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2151
2341
  redo() {
2152
2342
  return this.do();
2153
2343
  }
2154
- }, St = class {
2344
+ }, kt = class {
2155
2345
  constructor(e, t, n, r) {
2156
2346
  this.canvas = e, this.type = t, this.startId = n, this.endId = r, this.id = this.canvas.collabEngine.freshId();
2157
2347
  }
2158
2348
  do() {
2159
- let e = new ft(this.canvas, this.id, this.type.id, this.startId, this.endId);
2349
+ let e = new yt(this.canvas, this.id, this.type.id, this.startId, this.endId);
2160
2350
  return this.canvas.collabEngine.doCollaboratively(e), !0;
2161
2351
  }
2162
2352
  undo() {
2163
- let e = this.canvas.model.connections.get(this.id), t = new K(this.canvas, [], [], [], [this.id], [], !0, this.canvas.collabEngine.freshTimestamp());
2353
+ let e = this.canvas.model.connections.get(this.id), t = new St(this.canvas, [], [], [], [this.id], [], !0, this.canvas.collabEngine.freshTimestamp());
2164
2354
  return this.canvas.collabEngine.doCollaboratively(t), e !== void 0;
2165
2355
  }
2166
2356
  redo() {
2167
- let e = this.canvas.model.connections.get(this.id), t = new K(this.canvas, [], [], [], [this.id], [], !1, this.canvas.collabEngine.freshTimestamp());
2357
+ let e = this.canvas.model.connections.get(this.id), t = new St(this.canvas, [], [], [], [this.id], [], !1, this.canvas.collabEngine.freshTimestamp());
2168
2358
  return this.canvas.collabEngine.doCollaboratively(t), e === void 0;
2169
2359
  }
2170
- }, Ct = class {
2360
+ }, At = class {
2171
2361
  constructor(e, t, n, r) {
2172
2362
  this.canvas = e, this.fieldId = t, this.from = n, this.to = r;
2173
2363
  }
2174
2364
  do() {
2175
- let e = this.canvas.model.fields.get(this.fieldId), t = new pt(this.canvas, this.fieldId, this.to, this.canvas.collabEngine.freshTimestamp());
2365
+ let e = this.canvas.model.fields.get(this.fieldId), t = new bt(this.canvas, this.fieldId, this.to, this.canvas.collabEngine.freshTimestamp());
2176
2366
  return this.canvas.collabEngine.doCollaboratively(t), e !== void 0;
2177
2367
  }
2178
2368
  undo() {
2179
2369
  let e = this.canvas.model.fields.get(this.fieldId);
2180
2370
  if (e) {
2181
2371
  this.to = e.text;
2182
- let t = new pt(this.canvas, this.fieldId, this.from, this.canvas.collabEngine.freshTimestamp());
2372
+ let t = new bt(this.canvas, this.fieldId, this.from, this.canvas.collabEngine.freshTimestamp());
2183
2373
  this.canvas.collabEngine.doCollaboratively(t);
2184
2374
  }
2185
2375
  return e !== void 0;
@@ -2188,47 +2378,47 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2188
2378
  let e = this.canvas.model.fields.get(this.fieldId);
2189
2379
  if (e) {
2190
2380
  this.from = e.text;
2191
- let t = new pt(this.canvas, this.fieldId, this.to, this.canvas.collabEngine.freshTimestamp());
2381
+ let t = new bt(this.canvas, this.fieldId, this.to, this.canvas.collabEngine.freshTimestamp());
2192
2382
  this.canvas.collabEngine.doCollaboratively(t);
2193
2383
  }
2194
2384
  return e !== void 0;
2195
2385
  }
2196
- }, wt = class {
2386
+ }, jt = class {
2197
2387
  constructor(e, t, n, r) {
2198
2388
  this.canvas = e, this.id = t, this.from = n, this.to = r;
2199
2389
  }
2200
2390
  do() {
2201
- let e = new mt(this.canvas, this.id, this.to, this.canvas.collabEngine.freshTimestamp());
2391
+ let e = new xt(this.canvas, this.id, this.to, this.canvas.collabEngine.freshTimestamp());
2202
2392
  return this.canvas.collabEngine.doCollaboratively(e), !0;
2203
2393
  }
2204
2394
  undo() {
2205
- let e = new mt(this.canvas, this.id, this.from, this.canvas.collabEngine.freshTimestamp()), t = e.getValueSet();
2395
+ let e = new xt(this.canvas, this.id, this.from, this.canvas.collabEngine.freshTimestamp()), t = e.getValueSet();
2206
2396
  if (t) this.to = t.getValuesForKeys(this.to), this.canvas.collabEngine.doCollaboratively(e);
2207
2397
  else return !1;
2208
2398
  return !t.rootElement.removed;
2209
2399
  }
2210
2400
  redo() {
2211
- let e = new mt(this.canvas, this.id, this.to, this.canvas.collabEngine.freshTimestamp()), t = e.getValueSet();
2401
+ let e = new xt(this.canvas, this.id, this.to, this.canvas.collabEngine.freshTimestamp()), t = e.getValueSet();
2212
2402
  if (t) this.from = t.getValuesForKeys(this.from), this.canvas.collabEngine.doCollaboratively(e);
2213
2403
  else return !1;
2214
2404
  return !t.rootElement.removed;
2215
2405
  }
2216
- }, Tt = class {
2406
+ }, Mt = class {
2217
2407
  constructor(e, t, n, r, i, a) {
2218
2408
  this.canvas = e, this.nodeIds = t, this.sectionIds = n, this.portIds = r, this.connectionIds = i, this.fieldIds = a;
2219
2409
  }
2220
2410
  do() {
2221
- let e = this.nodeIds.map((e) => this.canvas.model.nodes.get(e) !== void 0).includes(!0) || this.sectionIds.map((e) => this.canvas.model.sections.get(e) !== void 0).includes(!0) || this.portIds.map((e) => this.canvas.model.ports.get(e) !== void 0).includes(!0) || this.connectionIds.map((e) => this.canvas.model.connections.get(e) !== void 0).includes(!0) || this.fieldIds.map((e) => this.canvas.model.fields.get(e) !== void 0).includes(!0), t = new K(this.canvas, this.nodeIds, this.sectionIds, this.portIds, this.connectionIds, this.fieldIds, !0, this.canvas.collabEngine.freshTimestamp());
2411
+ let e = this.nodeIds.map((e) => this.canvas.model.nodes.get(e) !== void 0).includes(!0) || this.sectionIds.map((e) => this.canvas.model.sections.get(e) !== void 0).includes(!0) || this.portIds.map((e) => this.canvas.model.ports.get(e) !== void 0).includes(!0) || this.connectionIds.map((e) => this.canvas.model.connections.get(e) !== void 0).includes(!0) || this.fieldIds.map((e) => this.canvas.model.fields.get(e) !== void 0).includes(!0), t = new St(this.canvas, this.nodeIds, this.sectionIds, this.portIds, this.connectionIds, this.fieldIds, !0, this.canvas.collabEngine.freshTimestamp());
2222
2412
  return this.canvas.collabEngine.doCollaboratively(t), e;
2223
2413
  }
2224
2414
  undo() {
2225
- let e = this.nodeIds.map((e) => this.canvas.model.nodes.get(e) === void 0).includes(!0) || this.sectionIds.map((e) => this.canvas.model.sections.get(e) === void 0).includes(!0) || this.portIds.map((e) => this.canvas.model.ports.get(e) === void 0).includes(!0) || this.connectionIds.map((e) => this.canvas.model.connections.get(e) === void 0).includes(!0) || this.fieldIds.map((e) => this.canvas.model.fields.get(e) === void 0).includes(!0), t = new K(this.canvas, this.nodeIds, this.sectionIds, this.portIds, this.connectionIds, this.fieldIds, !1, this.canvas.collabEngine.freshTimestamp());
2415
+ let e = this.nodeIds.map((e) => this.canvas.model.nodes.get(e) === void 0).includes(!0) || this.sectionIds.map((e) => this.canvas.model.sections.get(e) === void 0).includes(!0) || this.portIds.map((e) => this.canvas.model.ports.get(e) === void 0).includes(!0) || this.connectionIds.map((e) => this.canvas.model.connections.get(e) === void 0).includes(!0) || this.fieldIds.map((e) => this.canvas.model.fields.get(e) === void 0).includes(!0), t = new St(this.canvas, this.nodeIds, this.sectionIds, this.portIds, this.connectionIds, this.fieldIds, !1, this.canvas.collabEngine.freshTimestamp());
2226
2416
  return this.canvas.collabEngine.doCollaboratively(t), e;
2227
2417
  }
2228
2418
  redo() {
2229
2419
  return this.do();
2230
2420
  }
2231
- }, Et = class {
2421
+ }, Nt = class {
2232
2422
  constructor(e, t, n, r) {
2233
2423
  this.canvas = e, this.nodes = t, this.connections = n, this.coords = r;
2234
2424
  }
@@ -2254,233 +2444,208 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2254
2444
  let r = this.canvas.collabEngine.freshId();
2255
2445
  if (n[e.id] = r, e.id = r, e.start = n[e.start] || e.start, e.end = n[e.end] || e.end, t) for (let n = 0; n < e.points.length; ++n) e.points[n] = [e.points[n][0] + t[0], e.points[n][1] + t[1]];
2256
2446
  }
2257
- let r = new ht(this.canvas, this.nodes, this.connections);
2447
+ let r = new Ct(this.canvas, this.nodes, this.connections);
2258
2448
  return this.canvas.collabEngine.doCollaboratively(r), !0;
2259
2449
  }
2260
2450
  undo() {
2261
- let e = this.nodes.map((e) => this.canvas.model.nodes.get(e.id) !== void 0).includes(!0) || this.connections.map((e) => this.canvas.model.connections.get(e.id) !== void 0).includes(!0), t = new K(this.canvas, this.nodes.map((e) => e.id), [], [], this.connections.map((e) => e.id), [], !0, this.canvas.collabEngine.freshTimestamp());
2451
+ let e = this.nodes.map((e) => this.canvas.model.nodes.get(e.id) !== void 0).includes(!0) || this.connections.map((e) => this.canvas.model.connections.get(e.id) !== void 0).includes(!0), t = new St(this.canvas, this.nodes.map((e) => e.id), [], [], this.connections.map((e) => e.id), [], !0, this.canvas.collabEngine.freshTimestamp());
2262
2452
  return this.canvas.collabEngine.doCollaboratively(t), e;
2263
2453
  }
2264
2454
  redo() {
2265
- let e = this.nodes.map((e) => this.canvas.model.nodes.get(e.id) === void 0).includes(!0) || this.connections.map((e) => this.canvas.model.connections.get(e.id) === void 0).includes(!0), t = new K(this.canvas, this.nodes.map((e) => e.id), [], [], this.connections.map((e) => e.id), [], !1, this.canvas.collabEngine.freshTimestamp());
2455
+ let e = this.nodes.map((e) => this.canvas.model.nodes.get(e.id) === void 0).includes(!0) || this.connections.map((e) => this.canvas.model.connections.get(e.id) === void 0).includes(!0), t = new St(this.canvas, this.nodes.map((e) => e.id), [], [], this.connections.map((e) => e.id), [], !1, this.canvas.collabEngine.freshTimestamp());
2266
2456
  return this.canvas.collabEngine.doCollaboratively(t), e;
2267
2457
  }
2268
- }, Dt = class {
2458
+ }, Pt = class {
2269
2459
  constructor(e) {
2270
2460
  this.type = e, this.defaultPrevented = !1;
2271
2461
  }
2272
2462
  preventDefault() {
2273
2463
  this.defaultPrevented = !0;
2274
2464
  }
2275
- }, Ot = /* @__PURE__ */ function(e) {
2465
+ }, Ft = /* @__PURE__ */ function(e) {
2276
2466
  return e[e.Zoom = 0] = "Zoom", e[e.DoubleClick = 1] = "DoubleClick", e[e.SecondaryClick = 2] = "SecondaryClick", e[e.Selection = 3] = "Selection", e[e.Highlight = 4] = "Highlight", e[e.DraggingNode = 5] = "DraggingNode", e;
2277
- }({}), kt = class extends Dt {
2467
+ }({}), It = class extends Pt {
2278
2468
  constructor(e, t) {
2279
- super(Ot.Zoom), this.coords = e, this.zoom = t;
2469
+ super(0), this.coords = e, this.zoom = t;
2280
2470
  }
2281
- }, At = class extends Dt {
2471
+ }, Lt = class extends Pt {
2282
2472
  constructor(e, t, n) {
2283
- super(Ot.DoubleClick), this.cause = e, this.target = t, this.coords = n;
2473
+ super(1), this.cause = e, this.target = t, this.coords = n;
2284
2474
  }
2285
- }, jt = class extends Dt {
2475
+ }, Rt = class extends Pt {
2286
2476
  constructor(e, t, n) {
2287
- super(Ot.SecondaryClick), this.cause = e, this.target = t, this.coords = n;
2477
+ super(2), this.cause = e, this.target = t, this.coords = n;
2288
2478
  }
2289
- }, Y = class extends Dt {
2479
+ }, J = class extends Pt {
2290
2480
  constructor(e, t) {
2291
- super(Ot.Selection), this.targets = e, this.selected = t;
2292
- }
2293
- }, X = class extends Dt {
2294
- constructor(e) {
2295
- super(Ot.Highlight), this.target = e;
2481
+ super(3), this.targets = e, this.selected = t;
2296
2482
  }
2297
- }, Mt = class extends Dt {
2483
+ }, Y = class extends Pt {
2298
2484
  constructor(e) {
2299
- super(Ot.DraggingNode), this.target = e;
2300
- }
2301
- }, Nt = class extends Te {
2302
- constructor(e, t, n, r, i, a, o, s, c = "floating", l = "floating") {
2303
- if (e.objects.get(s) !== void 0) throw Error(`DiagramDecorator with id "${s}" already exists`);
2304
- if (!s) throw Error("DiagramDecorator cannot have an empty or null id");
2305
- super(e, s), this.rootElement = t, this.coords = n, this.width = r, this.height = i, this.priority = a, this.html = o, this.anchorPointX = c, this.anchorPointY = l;
2306
- }
2307
- get removed() {
2308
- return this.selfRemoved || this.rootElement !== void 0 && this.rootElement.removed;
2309
- }
2310
- updateInView() {
2311
- this.model.canvas?.updateDecoratorsInView(this.id);
2312
- }
2313
- raise() {
2314
- this.select()?.raise();
2315
- }
2316
- move(e) {
2317
- this.coords = e, this.updateInView();
2318
- }
2319
- getPriority() {
2320
- return this.priority;
2321
- }
2322
- }, Pt = class extends N {
2323
- constructor(e) {
2324
- super(), this.model = e;
2325
- }
2326
- new(e, t, n, r, i, a, o, s = "floating", c = "floating") {
2327
- let l = new Nt(this.model, e, t, n, r, i, a, o, s, c);
2328
- return super.add(l), l.updateInView(), e !== void 0 && e.decorators.push(l), l;
2329
- }
2330
- remove(e) {
2331
- let t = this.get(e, !0);
2332
- t && ((t.rootElement instanceof W || t.rootElement instanceof H) && O(t.rootElement.decorators, t), super.remove(e), t.updateInView());
2333
- }
2334
- }, Ft = class extends Te {
2335
- constructor(e, t, n, r, i, a, o) {
2336
- if (e.objects.get(o) !== void 0) throw Error(`DiagramObject with id "${o}" already exists`);
2337
- if (!o) throw Error("DiagramObject cannot have an empty or null id");
2338
- super(e, o), this.coords = t, this.width = n, this.height = r, this.priority = i, this.html = a;
2339
- }
2340
- get removed() {
2341
- return this.selfRemoved;
2342
- }
2343
- updateInView() {
2344
- this.model.canvas?.updateObjectsInView(this.id);
2345
- }
2346
- raise() {
2347
- this.select()?.raise();
2485
+ super(4), this.target = e;
2348
2486
  }
2349
- move(e) {
2350
- this.coords = e, this.updateInView();
2351
- }
2352
- getPriority() {
2353
- return this.priority;
2354
- }
2355
- }, It = class extends N {
2487
+ }, zt = class extends Pt {
2356
2488
  constructor(e) {
2357
- super(), this.model = e;
2358
- }
2359
- new(e, t, n, r, i, a) {
2360
- let o = new Ft(this.model, e, t, n, r, i, a);
2361
- return super.add(o), o.updateInView(), o;
2362
- }
2363
- remove(e) {
2364
- let t = this.get(e, !0);
2365
- t && (super.remove(e), t.updateInView());
2489
+ super(5), this.target = e;
2366
2490
  }
2367
- }, Lt = class {
2491
+ }, Bt = class {
2368
2492
  constructor(e, t, n, r, i, a = []) {
2369
- this.nodes = new Je(this), this.sections = new Ge(this), this.ports = new at(this), this.connections = new Fe(this), this.fields = new Le(this), this.objects = new It(this), this.decorators = new Pt(this), this.canvas = e, this.id = t, this.name = n, this.description = r, this.type = i, this.createdAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.logicalClock = 0, this.valueSet = new Ne(new De(a), this);
2493
+ this.nodes = new Ze(this), this.sections = new qe(this), this.ports = new ft(this), this.connections = new Ie(this), this.fields = new Re(this), this.objects = new ot(this), this.decorators = new it(this), this.canvas = e, this.id = t, this.name = n, this.description = r, this.type = i, this.createdAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.logicalClock = 0, this.valueSet = new Me(new Ee(a), this);
2370
2494
  }
2371
2495
  clear() {
2372
2496
  this.canvas?.cancelAllUserActions(), this.id = void 0, this.name = "", this.description = void 0, this.createdAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.logicalClock = 0, this.nodes.clear(), this.sections.clear(), this.ports.clear(), this.connections.clear(), this.fields.clear(), this.objects.clear(), this.decorators.clear(), this.valueSet.resetValues(), this.canvas?.updateModelInView();
2373
2497
  }
2374
- }, Rt = (e) => !!e.button, zt = (e, t, n, r, i, a, o, s, c) => re(e, [
2498
+ }, Vt = (e) => !!e.button, Ht = (e, t, n, r, i, a, o, s, c) => re(e, [
2375
2499
  t,
2376
2500
  ...a,
2377
2501
  n
2378
- ], r, i, Math.max(10, s || 0, c || 0) * o), Z = (t) => {
2379
- t ? e.select("body").style("cursor", t) : e.select("body").style("cursor", A.Auto);
2380
- }, Q = (e) => e instanceof W ? e : e instanceof H ? e.node || e : e.rootElement instanceof W || e.rootElement instanceof H || e.rootElement instanceof it ? Q(e.rootElement) : e, Bt = (e) => {
2381
- if (e instanceof W) return e.type.resizableX !== !1;
2382
- if (e instanceof H) {
2383
- if (e.type !== void 0) return e.type.resizableX !== !1;
2384
- if (e.node !== void 0) return Bt(e.node);
2502
+ ], r, i, Math.max(10, s ?? 0, c ?? 0) * o), X = (t) => {
2503
+ t ? e.select("body").style("cursor", t) : e.select("body").style("cursor", k.Auto);
2504
+ }, Ut = (e) => e instanceof W ? e : e instanceof U ? e.node ?? e : e.rootElement instanceof W || e.rootElement instanceof U || e.rootElement instanceof dt ? Ut(e.rootElement) : e, Wt = (e) => {
2505
+ if (e instanceof W) return e.type.resizerX.mode !== I.Never;
2506
+ if (e instanceof U) {
2507
+ if (e.type?.resizerX !== void 0) return e.type.resizerX.mode !== I.Never;
2508
+ if (e.node !== void 0) return Wt(e.node);
2385
2509
  }
2386
2510
  return !1;
2387
- }, Vt = (e) => {
2388
- if (e instanceof W) return e.type.resizableY !== !1;
2389
- if (e instanceof H) {
2390
- if (e.type !== void 0) return e.type.resizableY !== !1;
2391
- if (e.node !== void 0) return Vt(e.node);
2511
+ }, Gt = (e) => {
2512
+ if (e instanceof W) return e.type.resizerY.mode !== I.Never;
2513
+ if (e instanceof U) {
2514
+ if (e.type?.resizerY !== void 0) return e.type.resizerY.mode !== I.Never;
2515
+ if (e.node !== void 0) return Gt(e.node);
2392
2516
  }
2393
2517
  return !1;
2394
- }, Ht = (e) => {
2518
+ }, Kt = (e) => {
2519
+ if (e instanceof W) return e.type.resizerXY.mode !== I.Never;
2520
+ if (e instanceof U) {
2521
+ if (e.type?.resizerXY !== void 0) return e.type.resizerXY.mode !== I.Never;
2522
+ if (e.node !== void 0) return Kt(e.node);
2523
+ }
2524
+ return !1;
2525
+ }, qt = (e) => {
2395
2526
  e.filter(".shaped-look").append("path"), e.filter(".image-look").append("image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "top-left-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "top-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "top-right-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "left-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "center-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "right-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "bottom-left-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "bottom-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "bottom-right-image").attr("preserveAspectRatio", "none");
2396
- }, Ut = {
2527
+ }, Jt = {
2397
2528
  fillColor: "#FFFFFF",
2398
2529
  borderColor: "#000000",
2399
2530
  borderThickness: 1,
2400
2531
  borderStyle: te.Solid
2401
- }, Wt = (e) => {
2402
- e.filter(".shaped-look").select("path").attr("d", (e) => ae(e.look.shape || k.Rectangle, 0, 0, e.width, e.height)).attr("fill", (e) => e.look.fillColor || Ut.fillColor).attr("stroke", (e) => e.look.borderColor || Ut.borderColor).attr("stroke-width", (e) => `${e.look.borderThickness || Ut.borderThickness}px`).attr("stroke-dasharray", (e) => ie(e.look.borderStyle || Ut.borderStyle, e.type?.defaultLook?.borderThickness || e.look?.borderThickness || Ut.borderThickness)), e.filter(".image-look").select("image").attr("x", 0).attr("y", 0).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("href", (e) => e.look.backgroundImage), e.filter(".stretchable-image-look").select("image.top-left-image").attr("x", 0).attr("y", 0).attr("width", (e) => e.look.leftMargin).attr("height", (e) => e.look.topMargin).attr("href", (e) => e.look.backgroundImageTopLeft), e.filter(".stretchable-image-look").select("image.top-image").attr("x", (e) => e.look.leftMargin).attr("y", 0).attr("width", (e) => e.width - e.look.rightMargin - e.look.leftMargin).attr("height", (e) => e.look.topMargin).attr("href", (e) => e.look.backgroundImageTop), e.filter(".stretchable-image-look").select("image.top-right-image").attr("x", (e) => e.width - e.look.rightMargin).attr("y", 0).attr("width", (e) => e.look.rightMargin).attr("height", (e) => e.look.topMargin).attr("href", (e) => e.look.backgroundImageTopRight), e.filter(".stretchable-image-look").select("image.left-image").attr("x", 0).attr("y", (e) => e.look.topMargin).attr("width", (e) => e.look.leftMargin).attr("height", (e) => e.height - e.look.bottomMargin - e.look.topMargin).attr("href", (e) => e.look.backgroundImageLeft), e.filter(".stretchable-image-look").select("image.center-image").attr("x", (e) => e.look.leftMargin).attr("y", (e) => e.look.topMargin).attr("width", (e) => e.width - e.look.rightMargin - e.look.leftMargin).attr("height", (e) => e.height - e.look.bottomMargin - e.look.topMargin).attr("href", (e) => e.look.backgroundImageCenter), e.filter(".stretchable-image-look").select("image.right-image").attr("x", (e) => e.width - e.look.rightMargin).attr("y", (e) => e.look.topMargin).attr("width", (e) => e.look.rightMargin).attr("height", (e) => e.height - e.look.bottomMargin - e.look.topMargin).attr("href", (e) => e.look.backgroundImageRight), e.filter(".stretchable-image-look").select("image.bottom-left-image").attr("x", 0).attr("y", (e) => e.height - e.look.bottomMargin).attr("width", (e) => e.look.leftMargin).attr("height", (e) => e.look.bottomMargin).attr("href", (e) => e.look.backgroundImageBottomLeft), e.filter(".stretchable-image-look").select("image.bottom-image").attr("x", (e) => e.look.leftMargin).attr("y", (e) => e.height - e.look.bottomMargin).attr("width", (e) => e.width - e.look.rightMargin - e.look.leftMargin).attr("height", (e) => e.look.bottomMargin).attr("href", (e) => e.look.backgroundImageBottom), e.filter(".stretchable-image-look").select("image.bottom-right-image").attr("x", (e) => e.width - e.look.rightMargin).attr("y", (e) => e.height - e.look.bottomMargin).attr("width", (e) => e.look.rightMargin).attr("height", (e) => e.look.bottomMargin).attr("href", (e) => e.look.backgroundImageBottomRight);
2403
- }, Gt = {
2532
+ }, Yt = (e) => {
2533
+ e.filter(".shaped-look").select("path").attr("d", (e) => oe(e.look.shape ?? ae.Rectangle, 0, 0, e.width, e.height)).attr("fill", (e) => e.look.fillColor ?? Jt.fillColor).attr("stroke", (e) => e.look.borderColor ?? Jt.borderColor).attr("stroke-width", (e) => `${e.look.borderThickness ?? Jt.borderThickness}px`).attr("stroke-dasharray", (e) => ie(e.look.borderStyle ?? Jt.borderStyle, e.type?.defaultLook?.borderThickness ?? e.look?.borderThickness ?? Jt.borderThickness)), e.filter(".image-look").select("image").attr("x", 0).attr("y", 0).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("href", (e) => e.look.backgroundImage), e.filter(".stretchable-image-look").select("image.top-left-image").attr("x", 0).attr("y", 0).attr("width", (e) => e.look.leftMargin).attr("height", (e) => e.look.topMargin).attr("href", (e) => e.look.backgroundImageTopLeft), e.filter(".stretchable-image-look").select("image.top-image").attr("x", (e) => e.look.leftMargin).attr("y", 0).attr("width", (e) => e.width - e.look.rightMargin - e.look.leftMargin).attr("height", (e) => e.look.topMargin).attr("href", (e) => e.look.backgroundImageTop), e.filter(".stretchable-image-look").select("image.top-right-image").attr("x", (e) => e.width - e.look.rightMargin).attr("y", 0).attr("width", (e) => e.look.rightMargin).attr("height", (e) => e.look.topMargin).attr("href", (e) => e.look.backgroundImageTopRight), e.filter(".stretchable-image-look").select("image.left-image").attr("x", 0).attr("y", (e) => e.look.topMargin).attr("width", (e) => e.look.leftMargin).attr("height", (e) => e.height - e.look.bottomMargin - e.look.topMargin).attr("href", (e) => e.look.backgroundImageLeft), e.filter(".stretchable-image-look").select("image.center-image").attr("x", (e) => e.look.leftMargin).attr("y", (e) => e.look.topMargin).attr("width", (e) => e.width - e.look.rightMargin - e.look.leftMargin).attr("height", (e) => e.height - e.look.bottomMargin - e.look.topMargin).attr("href", (e) => e.look.backgroundImageCenter), e.filter(".stretchable-image-look").select("image.right-image").attr("x", (e) => e.width - e.look.rightMargin).attr("y", (e) => e.look.topMargin).attr("width", (e) => e.look.rightMargin).attr("height", (e) => e.height - e.look.bottomMargin - e.look.topMargin).attr("href", (e) => e.look.backgroundImageRight), e.filter(".stretchable-image-look").select("image.bottom-left-image").attr("x", 0).attr("y", (e) => e.height - e.look.bottomMargin).attr("width", (e) => e.look.leftMargin).attr("height", (e) => e.look.bottomMargin).attr("href", (e) => e.look.backgroundImageBottomLeft), e.filter(".stretchable-image-look").select("image.bottom-image").attr("x", (e) => e.look.leftMargin).attr("y", (e) => e.height - e.look.bottomMargin).attr("width", (e) => e.width - e.look.rightMargin - e.look.leftMargin).attr("height", (e) => e.look.bottomMargin).attr("href", (e) => e.look.backgroundImageBottom), e.filter(".stretchable-image-look").select("image.bottom-right-image").attr("x", (e) => e.width - e.look.rightMargin).attr("y", (e) => e.height - e.look.bottomMargin).attr("width", (e) => e.look.rightMargin).attr("height", (e) => e.look.bottomMargin).attr("href", (e) => e.look.backgroundImageBottomRight);
2534
+ }, Xt = {
2535
+ style: "solid",
2536
+ color: "#FFFFFF"
2537
+ }, Zt = {
2404
2538
  enabled: !0,
2539
+ style: "none",
2540
+ snap: !1,
2541
+ spacing: 1
2542
+ }, Qt = {
2543
+ ...Zt,
2405
2544
  style: "dots",
2406
- color: "rgba(0, 0, 0, 0.1)",
2407
2545
  snap: !1,
2408
2546
  spacing: 10,
2409
- thickness: .05
2410
- }, Kt = (e, t, n) => {
2411
- let r = t.append("defs");
2412
- if (e.gridSize > 0 && isFinite(e.gridSize)) {
2413
- let i = r.append("pattern").attr("id", n).attr("x", -e.gridSize / 2).attr("y", -e.gridSize / 2).attr("width", e.gridSize).attr("height", e.gridSize).attr("patternUnits", "userSpaceOnUse");
2414
- switch (i.append("rect").attr("x", 0).attr("y", 0).attr("width", e.gridSize).attr("height", e.gridSize).attr("fill", e.backgroundColor), e.gridStyle) {
2547
+ thickness: .05,
2548
+ color: "rgba(0, 0, 0, 0.1)"
2549
+ }, $t = (e, t) => {
2550
+ switch (t?.style ?? "") {
2551
+ case "image": return e.append("image").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%").attr("href", t.image).attr("preserveAspectRatio", "none");
2552
+ default: return e.append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%").attr("fill", t.color ?? "#FFFFFF").attr("stroke-width", "0");
2553
+ }
2554
+ }, en = (e) => {
2555
+ if (!e) return Qt;
2556
+ switch (e.style) {
2557
+ case "dots":
2558
+ case "lines": return {
2559
+ ...Qt,
2560
+ ...e
2561
+ };
2562
+ default: return {
2563
+ ...Zt,
2564
+ ...e
2565
+ };
2566
+ }
2567
+ }, tn = (e, t, n, r, i) => {
2568
+ if (Z(i) !== 0 && Q(i) !== 0) {
2569
+ let e = n.append("pattern").attr("id", r).attr("x", -Z(i) / 2).attr("y", -Q(i) / 2).attr("width", Z(i)).attr("height", Q(i)).attr("patternUnits", "userSpaceOnUse");
2570
+ switch (e.append("rect").attr("x", 0).attr("y", 0).attr("width", Z(i)).attr("height", Q(i)).attr("fill", "transparent"), i.style) {
2415
2571
  case "dots":
2416
- i.append("circle").attr("cx", e.gridSize / 2).attr("cy", e.gridSize / 2).attr("r", e.gridSize * e.gridThickness).attr("fill", e.gridColor);
2572
+ e.append("circle").attr("cx", Z(i) / 2).attr("cy", Q(i) / 2).attr("r", Math.min(Z(i), Q(i)) * (i.thickness ?? 0)).attr("fill", i.color ?? "");
2417
2573
  break;
2418
2574
  case "lines":
2419
- i.append("line").attr("x1", e.gridSize / 2).attr("x2", e.gridSize / 2).attr("y1", 0).attr("y2", e.gridSize).attr("stroke-width", e.gridSize * e.gridThickness).attr("stroke", e.gridColor), i.append("line").attr("x1", 0).attr("x2", (e.gridSize - e.gridSize * e.gridThickness) / 2).attr("y1", e.gridSize / 2).attr("y2", e.gridSize / 2).attr("stroke-width", e.gridSize * e.gridThickness).attr("stroke", e.gridColor), i.append("line").attr("x1", (e.gridSize + e.gridSize * e.gridThickness) / 2).attr("x2", e.gridSize).attr("y1", e.gridSize / 2).attr("y2", e.gridSize / 2).attr("stroke-width", e.gridSize * e.gridThickness).attr("stroke", e.gridColor);
2575
+ e.append("line").attr("x1", Z(i) / 2).attr("x2", Z(i) / 2).attr("y1", 0).attr("y2", Q(i)).attr("stroke-width", Math.min(Z(i), Q(i)) * (i.thickness ?? 0)).attr("stroke", i.color ?? ""), e.append("line").attr("x1", 0).attr("x2", (Z(i) - Z(i) * (i.thickness ?? 0)) / 2).attr("y1", Q(i) / 2).attr("y2", Q(i) / 2).attr("stroke-width", Math.min(Z(i), Q(i)) * (i.thickness ?? 0)).attr("stroke", i.color ?? ""), e.append("line").attr("x1", (Z(i) + Z(i) * (i.thickness ?? 0)) / 2).attr("x2", Z(i)).attr("y1", Q(i) / 2).attr("y2", Q(i) / 2).attr("stroke-width", Math.min(Z(i), Q(i)) * (i.thickness ?? 0)).attr("stroke", i.color ?? "");
2576
+ break;
2577
+ case "image":
2578
+ e.append("image").attr("x", 0).attr("y", 0).attr("width", Z(i)).attr("height", Q(i)).attr("href", i.image).attr("preserveAspectRatio", "none");
2420
2579
  break;
2421
2580
  }
2422
- t.select("rect").attr("fill", `url(#${n})`);
2423
- }
2424
- }, qt = 96, $ = 32, Jt = qt + $, Yt = Math.PI / 4, Xt = 100, Zt = { customButtons: [] }, Qt = class {
2581
+ return t.append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%").attr("fill", `url(#${r})`).attr("stroke-width", "0");
2582
+ }
2583
+ }, Z = (e) => {
2584
+ let t = 0;
2585
+ return typeof e.spacing == "number" ? t = e.spacing : Array.isArray(e.spacing) && typeof e.spacing[0] == "number" && (t = e.spacing[0]), isFinite(t) ? t : 0;
2586
+ }, Q = (e) => {
2587
+ let t = 0;
2588
+ return typeof e.spacing == "number" ? t = e.spacing : Array.isArray(e.spacing) && typeof e.spacing[1] == "number" && (t = e.spacing[1]), isFinite(t) ? t : 0;
2589
+ }, nn = 96, $ = 32, rn = 128, an = Math.PI / 4, on = 100, sn = { customButtons: [] }, cn = class {
2425
2590
  constructor(e, t) {
2426
- this.canvas = e, this.config = t || Zt;
2591
+ this.canvas = e, this.config = t || sn;
2427
2592
  }
2428
2593
  open(t) {
2429
2594
  this.close();
2430
- let n = this.canvas.getPointerLocationRelativeToRoot(t), r = this.canvas.getPointerLocationRelativeToCanvas(t), i = this.canvas.selectSVGElement().append("foreignObject").attr("class", "daga-context-menu").attr("x", `${n[0] - Jt}px`).attr("y", `${n[1] - Jt}px`).attr("width", `${2 * Jt}px`).attr("height", `${2 * Jt}px`).style("pointer-events", "none").on(S.ContextMenu, (e) => {
2431
- this.canvas.canUserPerformAction(q.ContextMenu) && (t.preventDefault(), this.open(e));
2595
+ let n = this.canvas.getPointerLocationRelativeToRoot(t), r = this.canvas.getPointerLocationRelativeToCanvas(t), i = this.canvas.selectSVGElement().append("foreignObject").attr("class", "daga-context-menu").attr("x", `${n[0] - rn}px`).attr("y", `${n[1] - rn}px`).attr("width", `${2 * rn}px`).attr("height", `${2 * rn}px`).style("pointer-events", "none").on(S.ContextMenu, (e) => {
2596
+ this.canvas.canUserPerformAction(K.ContextMenu) && (t.preventDefault(), this.open(e));
2432
2597
  }).on(S.Click, (e) => {
2433
2598
  e.preventDefault(), this.close();
2434
2599
  });
2435
2600
  this.contextMenuContainer = i;
2436
2601
  let a = [];
2437
- this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(q.Clipboard) && this.canvas.canUserPerformAction(q.Remove) && a.push({
2602
+ this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(K.Clipboard) && this.canvas.canUserPerformAction(K.Remove) && a.push({
2438
2603
  name: "CUT",
2439
2604
  imageClass: "daga-cut",
2440
2605
  onPress: (e) => {
2441
2606
  e.userSelection.cutToClipboard(), e.cancelAllUserActions();
2442
2607
  }
2443
- }), this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(q.Clipboard) && a.push({
2608
+ }), this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(K.Clipboard) && a.push({
2444
2609
  name: "COPY",
2445
2610
  imageClass: "daga-copy",
2446
2611
  onPress: (e) => {
2447
2612
  e.userSelection.copyToClipboard(), e.cancelAllUserActions();
2448
2613
  }
2449
- }), this.canvas.canUserPerformAction(q.Paste) && a.push({
2614
+ }), this.canvas.canUserPerformAction(K.Paste) && a.push({
2450
2615
  name: "PASTE",
2451
2616
  imageClass: "daga-paste",
2452
2617
  onPress: (e) => {
2453
2618
  e.userSelection.pasteFromClipboard(e.getClosestGridPoint(r)), e.cancelAllUserActions();
2454
2619
  }
2455
- }), this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(q.Remove) && a.push({
2620
+ }), this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(K.Remove) && a.push({
2456
2621
  name: "DELETE",
2457
2622
  imageClass: "daga-delete",
2458
2623
  onPress: (e) => {
2459
2624
  e.userSelection.removeFromModel(), e.cancelAllUserActions();
2460
2625
  }
2461
2626
  });
2462
- for (let e of this.config.customButtons || Zt.customButtons) (e.condition === void 0 || e.condition(this.canvas)) && a.push(e);
2627
+ for (let e of this.config.customButtons || sn.customButtons) (e.condition === void 0 || e.condition(this.canvas)) && a.push(e);
2463
2628
  a.length === 0 && a.push({
2464
2629
  name: "NONE",
2465
2630
  imageClass: "daga-cross",
2466
2631
  onPress: void 0
2467
2632
  });
2468
2633
  for (let t = 0; t < a.length; ++t) {
2469
- let n = a[t], r = n.onPress, o = (t + .5 - a.length / 2) * Yt, s = i.append("xhtml:div").attr("class", `daga-context-menu-button ${n.onPress === void 0 ? "" : " daga-clickable"}`).attr("tabindex", 0).style("position", "absolute").style("box-sizing", "border-box").style("width", `${2 * $}px`).style("height", `${2 * $}px`).style("border-radius", `${$}px`).style("pointer-events", "auto").on(S.Click, (e) => {
2634
+ let n = a[t], r = n.onPress, o = (t + .5 - a.length / 2) * an, s = i.append("xhtml:div").attr("class", `daga-context-menu-button ${n.onPress === void 0 ? "" : " daga-clickable"}`).attr("tabindex", 0).style("position", "absolute").style("box-sizing", "border-box").style("width", `${2 * $}px`).style("height", `${2 * $}px`).style("border-radius", `${$}px`).style("pointer-events", "auto").on(S.Click, (e) => {
2470
2635
  r && (e.preventDefault(), r(this.canvas));
2471
2636
  }).on(S.KeyDown, (e) => {
2472
2637
  r && e.key === C.Enter && (e.preventDefault(), r(this.canvas));
2473
2638
  });
2474
- n.imageClass === void 0 ? n.image !== void 0 && s.append("xhtml:img").style("position", "absolute").style("left", `${.75 * $}px`).style("top", `${.5 * $}px`).style("width", `${.5 * $}px`).style("height", `${.5 * $}px`).attr("src", n.image) : s.append("xhtml:div").style("position", "absolute").style("left", `${.75 * $}px`).style("top", `${.5 * $}px`).style("width", `${.5 * $}px`).style("height", `${.5 * $}px`).style("background-size", "contain").style("background-repeat", "no-repeat").attr("class", n.imageClass), s.append("xhtml:span").style("position", "absolute").style("left", `${.2 * $}px`).style("top", `${1.1 * $}px`).style("text-align", "center").style("width", `${1.6 * $}px`).style("height", `${.35 * $}px`).style("margin", "0").style("font-size", `${.35 * $}px`).style("font-weight", "700").style("user-select", "none").text(n.name), s.transition().ease(e.easeLinear).duration(Xt).tween("progress", () => (e) => {
2639
+ n.imageClass === void 0 ? n.image !== void 0 && s.append("xhtml:img").style("position", "absolute").style("left", `${.75 * $}px`).style("top", `${.5 * $}px`).style("width", `${.5 * $}px`).style("height", `${.5 * $}px`).attr("src", n.image) : s.append("xhtml:div").style("position", "absolute").style("left", `${.75 * $}px`).style("top", `${.5 * $}px`).style("width", `${.5 * $}px`).style("height", `${.5 * $}px`).style("background-size", "contain").style("background-repeat", "no-repeat").attr("class", n.imageClass), s.append("xhtml:span").style("position", "absolute").style("left", `${.2 * $}px`).style("top", `${1.1 * $}px`).style("text-align", "center").style("width", `${1.6 * $}px`).style("height", `${.35 * $}px`).style("margin", "0").style("font-size", `${.35 * $}px`).style("font-weight", "700").style("user-select", "none").text(n.name), s.transition().ease(e.easeLinear).duration(on).tween("progress", () => (e) => {
2475
2640
  let t = o * e;
2476
- return s.style("left", `${Math.sin(t) * qt - $ + Jt}px`).style("top", `${-Math.cos(t) * qt - $ + Jt}px`);
2641
+ return s.style("left", `${Math.sin(t) * nn - $ + rn}px`).style("top", `${-Math.cos(t) * nn - $ + rn}px`);
2477
2642
  });
2478
2643
  }
2479
2644
  }
2480
2645
  close() {
2481
2646
  this.contextMenuContainer?.remove(), this.contextMenuContainer = void 0;
2482
2647
  }
2483
- }, $t = class extends N {
2648
+ }, ln = class extends N {
2484
2649
  constructor(e, t = !0) {
2485
2650
  super(), this.focus = void 0, this.canvas = e, this.highlightSections = t;
2486
2651
  }
@@ -2488,7 +2653,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2488
2653
  return this.focus;
2489
2654
  }
2490
2655
  focusOn(e) {
2491
- this.clear(), this.focus = e, (e instanceof Ie || e instanceof Nt) && e.rootElement ? this.focusOn(e.rootElement) : this.add(e);
2656
+ this.clear(), this.focus = e, (e instanceof Le || e instanceof rt) && e.rootElement ? this.focusOn(e.rootElement) : this.add(e);
2492
2657
  }
2493
2658
  add(e) {
2494
2659
  if (super.add(e), e instanceof W) {
@@ -2499,12 +2664,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2499
2664
  }
2500
2665
  for (let t of e.ports) super.add(t), this.canvas.updatePortsInView(t.id);
2501
2666
  e.label && (super.add(e.label), this.canvas.updateFieldsInView(e.label.id)), this.canvas.updateNodesInView(e.id);
2502
- } else if (e instanceof H) if (!this.highlightSections && e.node) this.add(e.node);
2667
+ } else if (e instanceof U) if (!this.highlightSections && e.node) this.add(e.node);
2503
2668
  else {
2504
2669
  for (let t of e.ports) super.add(t), this.canvas.updatePortsInView(t.id);
2505
2670
  e.label && (super.add(e.label), this.canvas.updateFieldsInView(e.label.id)), this.canvas.updateSectionsInView(e.id);
2506
2671
  }
2507
- else e instanceof it ? (e.label && (super.add(e.label), this.canvas.updateFieldsInView(e.label.id)), this.canvas.updatePortsInView(e.id)) : e instanceof I && this.canvas.updateConnectionsInView(e.id);
2672
+ else e instanceof dt ? (e.label && (super.add(e.label), this.canvas.updateFieldsInView(e.label.id)), this.canvas.updatePortsInView(e.id)) : e instanceof F && this.canvas.updateConnectionsInView(e.id);
2508
2673
  }
2509
2674
  clear() {
2510
2675
  for (; this.entities.length > 0;) {
@@ -2513,7 +2678,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2513
2678
  }
2514
2679
  this.focus = void 0;
2515
2680
  }
2516
- }, en = class {
2681
+ }, un = class {
2517
2682
  export(e, t = !1) {
2518
2683
  let n = {
2519
2684
  name: e.name,
@@ -2523,6 +2688,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2523
2688
  updatedAt: e.updatedAt,
2524
2689
  nodes: [],
2525
2690
  connections: [],
2691
+ objects: [],
2526
2692
  data: e.valueSet.getValues(),
2527
2693
  ...t ? { collabMeta: {
2528
2694
  logicalClock: e.logicalClock,
@@ -2532,6 +2698,18 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2532
2698
  e.id && (n.id = e.id), e.description && (n.description = e.description);
2533
2699
  for (let r of e.nodes.all(!0)) !t && r.removed || r.parent === void 0 && n.nodes.push(this.exportNode(r, t));
2534
2700
  for (let r of e.connections.all(!0)) !t && r.removed || n.connections.push(this.exportConnection(r, t));
2701
+ for (let r of e.objects.all(!0)) n.objects?.push({
2702
+ id: r.id,
2703
+ coords: _(r.coords),
2704
+ width: r.width,
2705
+ height: r.height,
2706
+ priority: r.priority,
2707
+ svg: r.svg,
2708
+ ...t ? { collabMeta: {
2709
+ removed: r.removed,
2710
+ selfRemoved: r.selfRemoved
2711
+ } } : {}
2712
+ });
2535
2713
  return n;
2536
2714
  }
2537
2715
  exportNode(e, t = !1) {
@@ -2554,9 +2732,24 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2554
2732
  ...this.exportLabelCollabMeta(r)
2555
2733
  } } : {}
2556
2734
  });
2735
+ let i = [];
2736
+ for (let e of n.decorators) i.push({
2737
+ id: e.id,
2738
+ coords: _(e.coords),
2739
+ width: e.width,
2740
+ height: e.height,
2741
+ priority: e.priority,
2742
+ svg: e.svg,
2743
+ anchorPoints: [e.anchorPointX, e.anchorPointY],
2744
+ ...t ? { collabMeta: {
2745
+ removed: e.removed,
2746
+ selfRemoved: e.selfRemoved
2747
+ } } : {}
2748
+ });
2557
2749
  r.push({
2558
2750
  id: n.id,
2559
2751
  ports: e,
2752
+ decorators: i,
2560
2753
  label: n.label?.text || "",
2561
2754
  indexXInNode: n.indexXInNode,
2562
2755
  indexYInNode: n.indexYInNode,
@@ -2586,12 +2779,27 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2586
2779
  ...this.exportLabelCollabMeta(n)
2587
2780
  } } : {}
2588
2781
  });
2782
+ let a = [];
2783
+ for (let n of e.decorators) a.push({
2784
+ id: n.id,
2785
+ coords: _(n.coords),
2786
+ width: n.width,
2787
+ height: n.height,
2788
+ priority: n.priority,
2789
+ svg: n.svg,
2790
+ anchorPoints: [n.anchorPointX, n.anchorPointY],
2791
+ ...t ? { collabMeta: {
2792
+ removed: n.removed,
2793
+ selfRemoved: n.selfRemoved
2794
+ } } : {}
2795
+ });
2589
2796
  return {
2590
2797
  id: e.id,
2591
2798
  type: e.type.id,
2592
2799
  children: n,
2593
2800
  sections: r,
2594
2801
  ports: i,
2802
+ decorators: a,
2595
2803
  label: e.label?.text || "",
2596
2804
  coords: _(e.coords),
2597
2805
  width: e.width,
@@ -2634,14 +2842,14 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2634
2842
  textTimestamp: e.textTimestamp
2635
2843
  } } : {};
2636
2844
  }
2637
- }, tn = "Diagram properties", nn = class extends N {
2845
+ }, dn = "Diagram properties", fn = class extends N {
2638
2846
  constructor(e, t) {
2639
2847
  super(), this.canvas = e, this.canvas.propertyEditorChanges$.pipe(n(2e3)).subscribe(() => {
2640
2848
  this.makeUpdateValuesAction();
2641
- }), this.diagramPropertiesText = t === void 0 ? tn : t;
2849
+ }), this.diagramPropertiesText = t === void 0 ? dn : t;
2642
2850
  }
2643
2851
  add(e) {
2644
- if (!this.contains(e.id) && (this.length === 0 ? this.propertyEditorSelection === void 0 && (e instanceof W || e instanceof I) ? this.openInPropertyEditor(e) : this.propertyEditorSelection === void 0 && e instanceof H ? this.openInPropertyEditor(e.node) : this.openInPropertyEditor(void 0) : this.openInPropertyEditor(void 0), super.add(e), e.updateInView(), e instanceof W && e.sections)) for (let t of e.sections) super.add(t), t.updateInView();
2852
+ if (!this.contains(e.id) && (this.length === 0 ? this.propertyEditorSelection === void 0 && (e instanceof W || e instanceof F) ? this.openInPropertyEditor(e) : this.propertyEditorSelection === void 0 && e instanceof U ? this.openInPropertyEditor(e.node) : this.openInPropertyEditor(void 0) : this.openInPropertyEditor(void 0), super.add(e), e.updateInView(), e instanceof W && e.sections)) for (let t of e.sections) super.add(t), t.updateInView();
2645
2853
  }
2646
2854
  remove(e) {
2647
2855
  let t = this.get(e);
@@ -2662,8 +2870,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2662
2870
  removeFromModel() {
2663
2871
  if (this.length > 0) {
2664
2872
  let e = [], t = [], n = [], r = [], i = [];
2665
- for (let a of this.all()) a instanceof W ? e.push(a.id) : a instanceof H ? t.push(a.id) : a instanceof it ? n.push(a.id) : a instanceof I ? r.push(a.id) : a instanceof Ie && i.push(a.id);
2666
- let a = new Tt(this.canvas, e, t, n, r, i);
2873
+ for (let a of this.all()) a instanceof W ? e.push(a.id) : a instanceof U ? t.push(a.id) : a instanceof dt ? n.push(a.id) : a instanceof F ? r.push(a.id) : a instanceof Le && i.push(a.id);
2874
+ let a = new Mt(this.canvas, e, t, n, r, i);
2667
2875
  a.do(), this.canvas.actionStack.add(a);
2668
2876
  }
2669
2877
  }
@@ -2672,8 +2880,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2672
2880
  type: "daga-user-selection",
2673
2881
  nodes: [],
2674
2882
  connections: []
2675
- }, t = new en();
2676
- for (let n of this.all()) n instanceof W && e.nodes.push(t.exportNode(n, !1)), n instanceof I && e.connections.push(t.exportConnection(n, !1));
2883
+ }, t = new un();
2884
+ for (let n of this.all()) n instanceof W && e.nodes.push(t.exportNode(n, !1)), n instanceof F && e.connections.push(t.exportConnection(n, !1));
2677
2885
  navigator.clipboard.writeText(JSON.stringify(e));
2678
2886
  }
2679
2887
  cutToClipboard() {
@@ -2684,7 +2892,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2684
2892
  try {
2685
2893
  let n = JSON.parse(t);
2686
2894
  if (n.type !== "daga-user-selection") return;
2687
- let r = new Et(this.canvas, n.nodes, n.connections, e);
2895
+ let r = new Nt(this.canvas, n.nodes, n.connections, e);
2688
2896
  this.canvas.actionStack.add(r), r.do();
2689
2897
  } catch {
2690
2898
  return;
@@ -2696,16 +2904,16 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2696
2904
  let n = this.canvas.parentComponent?.propertyEditor;
2697
2905
  if (n === void 0) return;
2698
2906
  let r = e?.valueSet;
2699
- r ? (this.propertyEditorSelection = e, t && (this.propertyEditorValues = Ce(r.getValues())), n && (e instanceof W || e instanceof I ? (e instanceof W ? e.name ? n.title = `${e.type.name}: ${e.name}` : n.title = e.type.name : e instanceof I && (n.title = e.type.name), n.valueSet = void 0, n.valueSet = r) : (n.title = this.diagramPropertiesText, n.valueSet = void 0, n.valueSet = r))) : (this.propertyEditorSelection = void 0, this.propertyEditorValues = void 0, n && (n.title = "", n.valueSet = void 0));
2907
+ r ? (this.propertyEditorSelection = e, t && (this.propertyEditorValues = we(r.getValues())), n && (e instanceof W || e instanceof F ? (e instanceof W ? e.name ? n.title = `${e.type.name}: ${e.name}` : n.title = e.type.name : e instanceof F && (n.title = e.type.name), n.valueSet = void 0, n.valueSet = r) : (n.title = this.diagramPropertiesText, n.valueSet = void 0, n.valueSet = r))) : (this.propertyEditorSelection = void 0, this.propertyEditorValues = void 0, n && (n.title = "", n.valueSet = void 0));
2700
2908
  }
2701
2909
  makeUpdateValuesAction() {
2702
2910
  if (this.propertyEditorSelection === void 0 || this.propertyEditorValues === void 0) return;
2703
- let e = this.propertyEditorSelection instanceof Lt ? void 0 : this.propertyEditorSelection.id;
2704
- if (Ae(this.propertyEditorValues, this.propertyEditorSelection?.valueSet.getValues())) return;
2705
- let t = this.propertyEditorValues, n = Ce(this.propertyEditorSelection?.valueSet.getValues()), [r, i] = je(t, n, this.propertyEditorSelection?.valueSet), a = new wt(this.canvas, e, r, i);
2911
+ let e = this.propertyEditorSelection instanceof Bt ? void 0 : this.propertyEditorSelection.id;
2912
+ if (ke(this.propertyEditorValues, this.propertyEditorSelection?.valueSet.getValues())) return;
2913
+ let t = this.propertyEditorValues, n = we(this.propertyEditorSelection?.valueSet.getValues()), [r, i] = Ae(t, n, this.propertyEditorSelection?.valueSet), a = new jt(this.canvas, e, r, i);
2706
2914
  a.do(), this.canvas.actionStack.add(a), this.propertyEditorValues = n;
2707
2915
  }
2708
- }, rn = "diagram-connection-unfinished", an = class n {
2916
+ }, pn = "diagram-connection-unfinished", mn = class n {
2709
2917
  static {
2710
2918
  this.canvasCount = 0;
2711
2919
  }
@@ -2716,15 +2924,17 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2716
2924
  this._connectionType = e, this.parentComponent?.palette?.refreshPalette();
2717
2925
  }
2718
2926
  constructor(r, i) {
2719
- if (this.backgroundPatternId = `daga-background-pattern-id-${n.canvasCount++}`, this.zoomTransform = e.zoomIdentity, this.draggingFrom = [0, 0], this.dragging = !1, this.secondaryButton = !1, this.validatorChange$ = new t(), this.diagramChange$ = new t(), this.diagramEvent$ = new t(), this.propertyEditorChanges$ = new t(), this.parentComponent = r, this.model = new Lt(this, void 0, i.name || "unnamed", "", i.type || "", i.properties || []), this.userSelection = new nn(this, i.components?.propertyEditor?.title), this.userHighlight = new $t(this, i.canvas?.highlightSections !== !1), this.contextMenu = new Qt(this, i.canvas?.contextMenu), this.backgroundColor = i.canvas?.backgroundColor || "#FFFFFF", this.gridStyle = i.canvas?.grid?.style ?? Gt.style, this.gridSize = i.canvas?.grid?.enabled === !1 || i.canvas?.grid === void 0 ? 0 : Math.abs(i.canvas?.grid?.spacing || Gt.spacing), this.gridThickness = Math.abs(i.canvas?.grid?.thickness || Gt.thickness), this.gridColor = i.canvas?.grid?.color || Gt.color, this.snapToGrid = i.canvas?.grid?.enabled === !1 || i.canvas?.grid === void 0 ? !1 : i.canvas?.grid?.snap || Gt.snap, this.zoomFactor = i.canvas?.zoomFactor || 2, this.panRate = i.canvas?.panRate || 100, this.inferConnectionType = i.connectionSettings?.inferConnectionType || !1, this.autoTightenConnections = i.connectionSettings?.autoTighten !== !1, this.tightenConnectionsAcrossPortTypes = i.connectionSettings?.tightenAcrossPortTypes || !1, this.allowConnectionLoops = i.connectionSettings?.allowLoops || !1, this.allowSharingPorts = i.connectionSettings?.sharePorts !== !1, this.allowSharingBothPorts = i.connectionSettings?.shareBothPorts || !1, this.portHighlightRadius = i.connectionSettings?.portHighlightRadius || 100, this.multipleSelectionOn = !1, this.priorityThresholds = i.canvas?.priorityThresholds || [], this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : void 0, this.layoutFormat = i.layoutFormat, this.userActions = i.userActions || {}, this.validators = [], this.actionStack = new _t(this, 25), this.collabEngine = new gt(this), i.nodeTypes) for (let e of i.nodeTypes) {
2720
- let t = new qe({
2927
+ this.gridPatternId = `daga-grid-pattern-id-${++n.canvasCount}`, this.ancillaryGridPatternIds = [], this.zoomTransform = e.zoomIdentity, this.draggingFrom = [0, 0], this.dragging = !1, this.secondaryButton = !1, this.validatorChange$ = new t(), this.diagramChange$ = new t(), this.diagramEvent$ = new t(), this.propertyEditorChanges$ = new t(), this.parentComponent = r, this.model = new Bt(this, void 0, i.name || "unnamed", "", i.type || "", i.properties || []), this.userSelection = new fn(this, i.components?.propertyEditor?.title), this.userHighlight = new ln(this, i.canvas?.highlightSections !== !1), this.contextMenu = new cn(this, i.canvas?.contextMenu), this.backgroundConfig = i.canvas?.background ?? Xt, this.gridConfig = en(i.canvas?.grid), this.ancillaryGridsConfig = [];
2928
+ for (let e = 0; e < (i.canvas?.ancillaryGrids?.length || 0); ++e) this.ancillaryGridsConfig.push(en(i.canvas?.ancillaryGrids?.[e])), this.ancillaryGridPatternIds.push(`${this.gridPatternId}-ancillary-${e}`);
2929
+ if (this.zoomFactor = i.canvas?.zoomFactor || 2, this.panRate = i.canvas?.panRate || 100, this.inferConnectionType = i.connectionSettings?.inferConnectionType || !1, this.autoTightenConnections = i.connectionSettings?.autoTighten !== !1, this.tightenConnectionsAcrossPortTypes = i.connectionSettings?.tightenAcrossPortTypes || !1, this.allowConnectionLoops = i.connectionSettings?.allowLoops || !1, this.allowSharingPorts = i.connectionSettings?.sharePorts !== !1, this.allowSharingBothPorts = i.connectionSettings?.shareBothPorts || !1, this.portHighlightRadius = i.connectionSettings?.portHighlightRadius || 100, this.multipleSelectionOn = !1, this.priorityThresholds = i.canvas?.priorityThresholds || [], this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : void 0, this.layoutFormat = i.layoutFormat, this.userActions = i.userActions || {}, this.validators = [], this.actionStack = new Tt(this, 25), this.collabEngine = new wt(this), i.nodeTypes) for (let e of i.nodeTypes) {
2930
+ let t = new Xe({
2721
2931
  ...i.nodeTypeDefaults,
2722
2932
  ...e
2723
2933
  });
2724
2934
  this.model.nodes.types.add(t);
2725
2935
  }
2726
2936
  if (i.portTypes) for (let e of i.portTypes) {
2727
- let t = new rt({
2937
+ let t = new ut({
2728
2938
  ...i.portTypeDefaults,
2729
2939
  ...e
2730
2940
  });
@@ -2732,7 +2942,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2732
2942
  }
2733
2943
  if (i.connectionTypes) {
2734
2944
  for (let e of i.connectionTypes) {
2735
- let t = new Pe({
2945
+ let t = new Fe({
2736
2946
  ...i.connectionTypeDefaults,
2737
2947
  ...e
2738
2948
  });
@@ -2760,73 +2970,81 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2760
2970
  }
2761
2971
  initView(t) {
2762
2972
  let n = e.select(t);
2763
- n.html(""), this.diagramRoot = n.append("div").node(), e.select(this.diagramRoot).attr("tabindex", 0).style("width", "100%").style("height", "100%").append("svg").style("width", "100%").style("height", "100%"), e.select(this.diagramRoot).on(S.Click, () => {
2764
- e.select(this.diagramRoot).node()?.focus();
2973
+ n.html(""), this.diagramRoot = n.append("div").node(), this.selectRoot().attr("tabindex", 0).style("width", "100%").style("height", "100%").append("svg").style("width", "100%").style("height", "100%"), this.selectRoot().on(S.Click, () => {
2974
+ this.selectRoot().node()?.focus();
2765
2975
  }).on(S.ContextMenu, (e) => {
2766
2976
  if (this.dragging) {
2767
2977
  e.preventDefault(), e.stopPropagation(), this.dragging = !1;
2768
2978
  return;
2769
2979
  }
2770
- let t = new jt(e, null);
2771
- this.diagramEvent$.next(t), !t.defaultPrevented && this.canUserPerformAction(q.ContextMenu) && (e.preventDefault(), this.contextMenu.open(e));
2980
+ let t = new Rt(e, null);
2981
+ this.diagramEvent$.next(t), !t.defaultPrevented && this.canUserPerformAction(K.ContextMenu) && (e.preventDefault(), this.contextMenu.open(e));
2772
2982
  }).on(S.DoubleClick, (e) => {
2773
- let t = new At(e, null);
2983
+ let t = new Lt(e, null);
2774
2984
  this.diagramEvent$.next(t);
2775
2985
  }).on(S.KeyDown, (e) => {
2776
- if (!e.ctrlKey && (e.key === C.Delete || e.key === C.Backspace) && this.canUserPerformAction(q.Remove) && (this.userSelection.removeFromModel(), this.cancelAllUserActions()), e.ctrlKey && e.key === "a") {
2986
+ if (!e.ctrlKey && (e.key === C.Delete || e.key === C.Backspace) && this.canUserPerformAction(K.Remove) && (this.userSelection.removeFromModel(), this.cancelAllUserActions()), e.ctrlKey && e.key === "a") {
2777
2987
  e.preventDefault();
2778
2988
  for (let e of this.model.nodes) this.userSelection.add(e);
2779
2989
  for (let e of this.model.connections) this.userSelection.add(e);
2780
- this.diagramEvent$.next(new Y(this.userSelection.all(), !0));
2990
+ this.diagramEvent$.next(new J(this.userSelection.all(), !0));
2781
2991
  }
2782
2992
  if (e.ctrlKey && e.key === "i") {
2783
2993
  e.preventDefault();
2784
2994
  let t = [], n = [];
2785
2995
  for (let e of this.model.nodes) this.userSelection.toggle(e), e.selected ? t.push(e) : n.push(e);
2786
2996
  for (let e of this.model.connections) this.userSelection.toggle(e), e.selected ? t.push(e) : n.push(e);
2787
- t.length > 0 && this.diagramEvent$.next(new Y(t, !0)), n.length > 0 && this.diagramEvent$.next(new Y(n, !1));
2997
+ t.length > 0 && this.diagramEvent$.next(new J(t, !0)), n.length > 0 && this.diagramEvent$.next(new J(n, !1));
2788
2998
  }
2789
- if (e.ctrlKey && e.key === "c" && this.canUserPerformAction(q.Clipboard) && (e.preventDefault(), this.userSelection.copyToClipboard(), this.cancelAllUserActions()), e.ctrlKey && e.key === "x" && this.canUserPerformAction(q.Clipboard) && this.canUserPerformAction(q.Remove) && (e.preventDefault(), this.userSelection.cutToClipboard(), this.cancelAllUserActions()), e.ctrlKey && e.key === "v" && this.canUserPerformAction(q.Paste)) {
2999
+ if (e.ctrlKey && e.key === "c" && this.canUserPerformAction(K.Clipboard) && (e.preventDefault(), this.userSelection.copyToClipboard(), this.cancelAllUserActions()), e.ctrlKey && e.key === "x" && this.canUserPerformAction(K.Clipboard) && this.canUserPerformAction(K.Remove) && (e.preventDefault(), this.userSelection.cutToClipboard(), this.cancelAllUserActions()), e.ctrlKey && e.key === "v" && this.canUserPerformAction(K.Paste)) {
2790
3000
  e.preventDefault();
2791
3001
  let t = this.getCoordinatesOnScreen();
2792
3002
  this.userSelection.pasteFromClipboard(this.getClosestGridPoint([(t[0][0] + t[1][0]) / 2, (t[0][1] + t[1][1]) / 2])), this.cancelAllUserActions();
2793
3003
  }
2794
- e.ctrlKey && e.key === "y" && (e.preventDefault(), this.actionStack.redo()), e.ctrlKey && e.key === "z" && (e.preventDefault(), this.actionStack.undo()), e.key === "+" && this.canUserPerformAction(q.Zoom) && (e.preventDefault(), this.zoomBy(this.zoomFactor)), e.key === "-" && this.canUserPerformAction(q.Zoom) && (e.preventDefault(), this.zoomBy(1 / this.zoomFactor)), e.key === C.ArrowLeft && this.canUserPerformAction(q.Zoom) && (e.preventDefault(), this.translateBy(this.panRate / this.zoomTransform.k, 0)), e.key === C.ArrowRight && this.canUserPerformAction(q.Zoom) && (e.preventDefault(), this.translateBy(-this.panRate / this.zoomTransform.k, 0)), e.key === C.ArrowDown && this.canUserPerformAction(q.Zoom) && (e.preventDefault(), this.translateBy(0, -this.panRate / this.zoomTransform.k)), e.key === C.ArrowUp && this.canUserPerformAction(q.Zoom) && (e.preventDefault(), this.translateBy(0, this.panRate / this.zoomTransform.k));
3004
+ e.ctrlKey && e.key === "y" && (e.preventDefault(), this.actionStack.redo()), e.ctrlKey && e.key === "z" && (e.preventDefault(), this.actionStack.undo()), e.key === "+" && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.zoomBy(this.zoomFactor)), e.key === "-" && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.zoomBy(1 / this.zoomFactor)), e.key === C.ArrowLeft && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.translateBy(this.panRate / this.zoomTransform.k, 0)), e.key === C.ArrowRight && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.translateBy(-this.panRate / this.zoomTransform.k, 0)), e.key === C.ArrowDown && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.translateBy(0, -this.panRate / this.zoomTransform.k)), e.key === C.ArrowUp && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.translateBy(0, this.panRate / this.zoomTransform.k));
2795
3005
  });
2796
3006
  let r = this.selectSVGElement().append("g").attr("class", "daga-canvas-view").attr("width", "100%").attr("height", "100%");
2797
- r.call(this.zoomBehavior = e.zoom().filter((e) => e.type !== S.DoubleClick).on(T.Zoom, (t) => {
2798
- if (t.sourceEvent) {
2799
- if (!this.canUserPerformAction(q.Zoom)) {
2800
- Z(A.NotAllowed);
3007
+ r.call(this.zoomBehavior = e.zoom().filter((e) => e.type !== S.DoubleClick).on(T.Zoom, (e) => {
3008
+ if (e.sourceEvent) {
3009
+ if (!this.canUserPerformAction(K.Zoom)) {
3010
+ X(k.NotAllowed);
2801
3011
  return;
2802
3012
  }
2803
- t.sourceEvent.type === S.Wheel && t.sourceEvent.wheelDelta !== void 0 ? (t.sourceEvent.wheelDelta > 0 && Z(A.ZoomIn), t.sourceEvent.wheelDelta < 0 && Z(A.ZoomOut)) : t.sourceEvent.type === S.MouseMove && Z(A.AllScroll);
3013
+ e.sourceEvent.type === S.Wheel && e.sourceEvent.wheelDelta !== void 0 ? (e.sourceEvent.wheelDelta > 0 && X(k.ZoomIn), e.sourceEvent.wheelDelta < 0 && X(k.ZoomOut)) : e.sourceEvent.type === S.MouseMove && X(k.AllScroll);
2804
3014
  }
2805
- this.zoomTransform = t.transform;
2806
- let n = t.transform.toString();
2807
- this.selectCanvasElements().attr("transform", n), e.select(`#${this.backgroundPatternId}`).attr("patternTransform", n), this.contextMenu.close(), this.diagramEvent$.next(new kt([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
3015
+ this.zoomTransform = e.transform;
3016
+ let t = e.transform.toString();
3017
+ this.selectCanvasElements().attr("transform", t);
3018
+ for (let e of [this.gridPatternId, ...this.ancillaryGridPatternIds]) this.selectCanvasView().select(`#${e}`).attr("patternTransform", t);
3019
+ this.contextMenu.close(), this.diagramEvent$.next(new It([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
2808
3020
  }).on(T.End, () => {
2809
- Z();
2810
- })), r.append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%").attr("fill", this.backgroundColor).attr("stroke-width", "0").on(S.MouseMove, (e) => {
3021
+ X();
3022
+ }));
3023
+ let i = r.append("defs"), a = [];
3024
+ a.push($t(r, this.backgroundConfig).attr("class", "daga-background"));
3025
+ for (let e = 0; e < this.ancillaryGridsConfig.length; ++e) a.push(tn(this, r, i, this.ancillaryGridPatternIds[e], this.ancillaryGridsConfig[e]));
3026
+ a.push(tn(this, r, i, this.gridPatternId, this.gridConfig));
3027
+ for (let t of a) t.on(S.MouseMove, (e) => {
2811
3028
  if (this.unfinishedConnection !== void 0) {
2812
3029
  let t = this.getPointerLocationRelativeToCanvas(e);
2813
3030
  this.unfinishedConnection.endCoords = t;
2814
3031
  }
2815
- }).on(S.MouseOver, () => {
2816
- this.userHighlight.size() > 0 && (this.userHighlight.clear(), this.diagramEvent$.next(new X(null)));
2817
- }).on(S.Click, () => {
2818
- if (this.userHighlight.size() > 0 && (this.userHighlight.clear(), this.diagramEvent$.next(new X(null))), this.contextMenu.close(), this.userSelection.size() > 0) {
3032
+ }), t.on(S.MouseOver, () => {
3033
+ this.userHighlight.size() > 0 && (this.userHighlight.clear(), this.diagramEvent$.next(new Y(null)));
3034
+ }), t.on(S.Click, () => {
3035
+ if (this.userHighlight.size() > 0 && (this.userHighlight.clear(), this.diagramEvent$.next(new Y(null))), this.contextMenu.close(), this.userSelection.size() > 0) {
2819
3036
  let e = this.userSelection.all();
2820
- this.userSelection.clear(), this.diagramEvent$.next(new Y(e, !1));
3037
+ this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
2821
3038
  }
2822
3039
  this.userSelection.openInPropertyEditor(this.model);
2823
- }).call(e.drag().filter((e) => this.multipleSelectionOn || Rt(e)).on(w.Start, (e) => {
3040
+ }), t.call(e.drag().filter((e) => this.multipleSelectionOn || Vt(e)).on(w.Start, (e) => {
2824
3041
  this.startMultipleSelection(e);
2825
3042
  }).on(w.Drag, (e) => {
2826
3043
  this.continueMultipleSelection(e);
2827
3044
  }).on(w.End, (e) => {
2828
3045
  this.finishMultipleSelection(e);
2829
- })), Kt(this, r, this.backgroundPatternId), r.append("g").attr("class", "daga-canvas-elements");
3046
+ }));
3047
+ r.append("g").attr("class", "daga-canvas-elements");
2830
3048
  }
2831
3049
  getZoomLevel() {
2832
3050
  return this.zoomTransform.k;
@@ -2838,7 +3056,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2838
3056
  isNaN(e) || this.zoomBehavior.scaleTo(this.selectCanvasView(), e);
2839
3057
  }
2840
3058
  getViewCoordinates() {
2841
- let e = this.selectCanvasView()?.select("rect")?.node()?.getBBox();
3059
+ let e = this.selectCanvasView()?.select(".daga-background")?.node()?.getBBox();
2842
3060
  return [((e.width + e.x) / 2 - this.zoomTransform.x) / this.zoomTransform.k, ((e.height + e.y) / 2 - this.zoomTransform.y) / this.zoomTransform.k];
2843
3061
  }
2844
3062
  translateBy(e, t) {
@@ -2870,12 +3088,17 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2870
3088
  }
2871
3089
  center(e, t, n) {
2872
3090
  if (this.model.nodes.length > 0) {
2873
- let r = this.selectCanvasView().select("rect").node()?.getBBox(), i = e?.map((e) => this.model.nodes.get(e)).filter((e) => !!e) || this.model.nodes.all(), a = Math.min(...i.map((e) => e.coords[0])), o = Math.max(...i.map((e) => e.coords[0] + e.width)), s = (a + o) / 2, c = o - a, l = r.width, u = Math.min(...i.map((e) => e.coords[1])), d = Math.max(...i.map((e) => e.coords[1] + e.height)), f = (u + d) / 2, p = d - u, m = r.height, h = Math.min(l / c, m / p, t === void 0 ? 1 : t);
3091
+ let r = this.selectCanvasView().select(".daga-background").node()?.getBBox();
3092
+ if (!r.width || !r.height) return;
3093
+ let i = e?.map((e) => this.model.nodes.get(e)).filter((e) => !!e) || this.model.nodes.all(), a = Math.min(...i.map((e) => e.coords[0])), o = Math.max(...i.map((e) => e.coords[0] + e.width)), s = (a + o) / 2, c = o - a, l = r.width, u = Math.min(...i.map((e) => e.coords[1])), d = Math.max(...i.map((e) => e.coords[1] + e.height)), f = (u + d) / 2, p = d - u, m = r.height, h = Math.min(l / c, m / p, t === void 0 ? 1 : t);
2874
3094
  this.zoomAndPanTo(s, f, h, n);
2875
3095
  }
2876
3096
  }
2877
3097
  getClosestGridPoint(e) {
2878
- return this.gridSize === 0 || !isFinite(this.gridSize) ? e : [Math.round(e[0] / this.gridSize) * this.gridSize, Math.round(e[1] / this.gridSize) * this.gridSize];
3098
+ let t = e[0], n = Z(this.gridConfig);
3099
+ n !== 0 && (t = Math.round(t / n) * n);
3100
+ let r = e[1], i = Q(this.gridConfig);
3101
+ return i !== 0 && (r = Math.round(r / i) * i), [t, r];
2879
3102
  }
2880
3103
  getCoordinatesOnScreen() {
2881
3104
  let e = this.selectSVGElement().node()?.getBoundingClientRect(), t = [e?.width || 0, e?.height || 0];
@@ -2905,255 +3128,391 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
2905
3128
  this.updateNodesInView(), this.updateSectionsInView(), this.updatePortsInView(), this.updateConnectionsInView(), this.updateFieldsInView(), this.updateObjectsInView(), this.updateDecoratorsInView();
2906
3129
  }
2907
3130
  updateNodesInView(...t) {
2908
- let n = this.selectCanvasElements().selectAll("g.diagram-node").data(this.model.nodes.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", (e) => `diagram-node${Bt(e) ? " resizable-x" : ""}${Vt(e) ? " resizable-y" : ""} ${e.type.defaultLook.lookType}`);
3131
+ let n = this.selectCanvasElements().selectAll("g.diagram-node").data(this.model.nodes.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", (e) => `diagram-node${Wt(e) ? " resizable-x" : ""}${Gt(e) ? " resizable-y" : ""}${Kt(e) ? " resizable-xy" : ""} ${e.type.defaultLook.lookType}`);
2909
3132
  t && t.length > 0 && (n = n.filter((e) => t.includes(e.id)));
2910
3133
  let a = i.merge(n);
2911
3134
  r.remove(), i.on(S.MouseOver, (e, t) => {
2912
- this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new X(t)));
3135
+ this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)));
2913
3136
  }).on(S.Click, (e, t) => {
2914
3137
  if (!e.ctrlKey && !e.shiftKey) {
2915
3138
  let e = this.userSelection.all();
2916
- this.userSelection.clear(), this.diagramEvent$.next(new Y(e, !1));
3139
+ this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
2917
3140
  }
2918
- this.userSelection.toggle(t), this.diagramEvent$.next(new Y([t], t.selected));
3141
+ this.userSelection.toggle(t), this.diagramEvent$.next(new J([t], t.selected));
2919
3142
  }).on(S.ContextMenu, (e, t) => {
2920
3143
  if (this.dragging) {
2921
3144
  e.preventDefault(), e.stopPropagation(), this.dragging = !1;
2922
3145
  return;
2923
3146
  }
2924
- let n = new jt(e, t);
2925
- this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(q.ContextMenu) && (e.preventDefault(), this.userHighlight.focusOn(t), this.diagramEvent$.next(new X(t)), this.userSelection.add(t), this.diagramEvent$.next(new Y([t], !0)), this.contextMenu.open(e));
3147
+ let n = new Rt(e, t);
3148
+ this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu) && (e.preventDefault(), this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)), this.userSelection.add(t), this.diagramEvent$.next(new J([t], !0)), this.contextMenu.open(e));
2926
3149
  }).on(S.DoubleClick, (e, t) => {
2927
- let n = new At(e, t);
3150
+ let n = new Lt(e, t);
2928
3151
  this.diagramEvent$.next(n);
2929
- }).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e, t) => {
3152
+ }).call(e.drag().filter((e) => (this.secondaryButton = Vt(e), !0)).on(w.Start, (e, t) => {
2930
3153
  this.multipleSelectionOn || this.secondaryButton ? this.startMultipleSelection(e) : this.startMovingNode(e, t);
2931
3154
  }).on(w.Drag, (e, t) => {
2932
3155
  this.multipleSelectionOn || this.secondaryButton ? this.continueMultipleSelection(e) : this.continueMovingNode(e, t);
2933
3156
  }).on(w.End, (e, t) => {
2934
3157
  this.multipleSelectionOn || this.secondaryButton ? this.finishMultipleSelection(e) : this.finishMovingNode(e, t), this.secondaryButton = !1;
2935
- })), Ht(i), i.filter(".resizable-x").append("line").attr("class", "left-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
2936
- this.canUserPerformAction(q.StretchNode) && t.getResizableX() && !t.removed && Z(A.EWResize);
3158
+ })), qt(i), i.filter(".resizable-x").append("rect").attr("class", "left-resizer").on(S.MouseOver, (e, t) => {
3159
+ this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && X(k.EWResize);
2937
3160
  }).on(S.MouseOut, (e, t) => {
2938
- this.canUserPerformAction(q.StretchNode) && t.getResizableX() && !t.removed && Z();
3161
+ this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && X();
2939
3162
  }).call(e.drag().on(w.Start, (e, t) => {
2940
- this.canUserPerformAction(q.StretchNode) && t.getResizableX() && !t.removed ? (Z(A.EWResize), this.currentAction = new J(this, q.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : Z(A.NotAllowed);
3163
+ this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed ? (X(k.EWResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(k.NotAllowed);
2941
3164
  }).on(w.Drag, (e, t) => {
2942
- if (this.canUserPerformAction(q.StretchNode) && t.getResizableX() && !t.removed) {
3165
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed) {
2943
3166
  let n = this.getPointerLocationRelativeToCanvas(e);
2944
3167
  t.stretch(p.Left, t.coords[0] - n[0]);
2945
3168
  }
2946
3169
  }).on(w.End, (e, t) => {
2947
- if (this.canUserPerformAction(q.StretchNode) && t.getResizableX() && !t.removed && this.currentAction instanceof J && this.currentAction.intent === q.StretchNode) {
3170
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
2948
3171
  let n = this.getPointerLocationRelativeToCanvas(e);
2949
- this.snapToGrid && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), t.stretch(p.Left, t.coords[0] - n[0]), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3172
+ this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), t.stretch(p.Left, t.coords[0] - n[0]), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
2950
3173
  }
2951
- Z();
2952
- })), i.filter(".resizable-y").append("line").attr("class", "top-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
2953
- this.canUserPerformAction(q.StretchNode) && t.getResizableY() && !t.removed && Z(A.NSResize);
3174
+ X();
3175
+ })), i.filter(".resizable-x").append("rect").attr("class", "right-resizer").on(S.MouseOver, (e, t) => {
3176
+ this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && X(k.EWResize);
2954
3177
  }).on(S.MouseOut, (e, t) => {
2955
- this.canUserPerformAction(q.StretchNode) && t.getResizableY() && !t.removed && Z();
3178
+ this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && X();
2956
3179
  }).call(e.drag().on(w.Start, (e, t) => {
2957
- this.canUserPerformAction(q.StretchNode) && t.getResizableY() && !t.removed ? (Z(A.NSResize), this.currentAction = new J(this, q.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : Z(A.NotAllowed);
3180
+ this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed ? (X(k.EWResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(k.NotAllowed);
2958
3181
  }).on(w.Drag, (e, t) => {
2959
- if (this.canUserPerformAction(q.StretchNode) && t.getResizableY() && !t.removed) {
3182
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed) {
2960
3183
  let n = this.getPointerLocationRelativeToCanvas(e);
2961
- t.stretch(p.Top, t.coords[1] - n[1]);
3184
+ t.stretch(p.Right, n[0] - (t.coords[0] + t.width));
2962
3185
  }
2963
3186
  }).on(w.End, (e, t) => {
2964
- if (this.canUserPerformAction(q.StretchNode) && t.getResizableY() && !t.removed && this.currentAction instanceof J && this.currentAction.intent === q.StretchNode) {
3187
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
2965
3188
  let n = this.getPointerLocationRelativeToCanvas(e);
2966
- this.snapToGrid && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), t.stretch(p.Top, t.coords[1] - n[1]), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3189
+ this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[2], n[1] - t.type.snapToGridOffset[3]]), n[0] += t.type.snapToGridOffset[2], n[1] += t.type.snapToGridOffset[3]), t.stretch(p.Right, n[0] - (t.coords[0] + t.width)), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
2967
3190
  }
2968
- Z();
2969
- })), i.filter(".resizable-x").append("line").attr("class", "right-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
2970
- this.canUserPerformAction(q.StretchNode) && t.getResizableX() && !t.removed && Z(A.EWResize);
3191
+ X();
3192
+ })), i.filter(".resizable-y").append("rect").attr("class", "top-resizer").on(S.MouseOver, (e, t) => {
3193
+ this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && X(k.NSResize);
2971
3194
  }).on(S.MouseOut, (e, t) => {
2972
- this.canUserPerformAction(q.StretchNode) && t.getResizableX() && !t.removed && Z();
3195
+ this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && X();
2973
3196
  }).call(e.drag().on(w.Start, (e, t) => {
2974
- this.canUserPerformAction(q.StretchNode) && t.getResizableX() && !t.removed ? (Z(A.EWResize), this.currentAction = new J(this, q.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : Z(A.NotAllowed);
3197
+ this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed ? (X(k.NSResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(k.NotAllowed);
2975
3198
  }).on(w.Drag, (e, t) => {
2976
- if (this.canUserPerformAction(q.StretchNode) && t.getResizableX() && !t.removed) {
3199
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed) {
2977
3200
  let n = this.getPointerLocationRelativeToCanvas(e);
2978
- t.stretch(p.Right, n[0] - (t.coords[0] + t.width));
3201
+ t.stretch(p.Top, t.coords[1] - n[1]);
2979
3202
  }
2980
3203
  }).on(w.End, (e, t) => {
2981
- if (this.canUserPerformAction(q.StretchNode) && t.getResizableX() && !t.removed && this.currentAction instanceof J && this.currentAction.intent === q.StretchNode) {
3204
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
2982
3205
  let n = this.getPointerLocationRelativeToCanvas(e);
2983
- this.snapToGrid && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[2], n[1] - t.type.snapToGridOffset[3]]), n[0] += t.type.snapToGridOffset[2], n[1] += t.type.snapToGridOffset[3]), t.stretch(p.Right, n[0] - (t.coords[0] + t.width)), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3206
+ this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), t.stretch(p.Top, t.coords[1] - n[1]), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
2984
3207
  }
2985
- Z();
2986
- })), i.filter(".resizable-y").append("line").attr("class", "bottom-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
2987
- this.canUserPerformAction(q.StretchNode) && t.getResizableY() && !t.removed && Z(A.NSResize);
3208
+ X();
3209
+ })), i.filter(".resizable-y").append("rect").attr("class", "bottom-resizer").on(S.MouseOver, (e, t) => {
3210
+ this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && X(k.NSResize);
2988
3211
  }).on(S.MouseOut, (e, t) => {
2989
- this.canUserPerformAction(q.StretchNode) && t.getResizableY() && !t.removed && Z();
3212
+ this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && X();
2990
3213
  }).call(e.drag().on(w.Start, (e, t) => {
2991
- this.canUserPerformAction(q.StretchNode) && t.getResizableY() && !t.removed ? (Z(A.NSResize), this.currentAction = new J(this, q.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : Z(A.NotAllowed);
3214
+ this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed ? (X(k.NSResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(k.NotAllowed);
2992
3215
  }).on(w.Drag, (e, t) => {
2993
- if (this.canUserPerformAction(q.StretchNode) && t.getResizableY() && !t.removed) {
3216
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed) {
2994
3217
  let n = this.getPointerLocationRelativeToCanvas(e);
2995
3218
  t.stretch(p.Bottom, n[1] - (t.coords[1] + t.height));
2996
3219
  }
2997
3220
  }).on(w.End, (e, t) => {
2998
- if (this.canUserPerformAction(q.StretchNode) && t.getResizableY() && !t.removed && this.currentAction instanceof J && this.currentAction.intent === q.StretchNode) {
3221
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
3222
+ let n = this.getPointerLocationRelativeToCanvas(e);
3223
+ this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[2], n[1] - t.type.snapToGridOffset[3]]), n[0] += t.type.snapToGridOffset[2], n[1] += t.type.snapToGridOffset[3]), t.stretch(p.Bottom, n[1] - (t.coords[1] + t.height)), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3224
+ }
3225
+ X();
3226
+ })), i.filter(".resizable-xy").append("rect").attr("class", "top-left-resizer").on(S.MouseOver, (e, t) => {
3227
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && X(k.NWSEResize);
3228
+ }).on(S.MouseOut, (e, t) => {
3229
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && X();
3230
+ }).call(e.drag().on(w.Start, (e, t) => {
3231
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed ? (X(k.NWSEResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(k.NotAllowed);
3232
+ }).on(w.Drag, (e, t) => {
3233
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed) {
3234
+ let n = this.getPointerLocationRelativeToCanvas(e);
3235
+ t.stretch(p.Left, t.coords[0] - n[0]), t.stretch(p.Top, t.coords[1] - n[1]);
3236
+ }
3237
+ }).on(w.End, (e, t) => {
3238
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
3239
+ let n = this.getPointerLocationRelativeToCanvas(e);
3240
+ this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), t.stretch(p.Left, t.coords[0] - n[0]), t.stretch(p.Top, t.coords[1] - n[1]), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3241
+ }
3242
+ X();
3243
+ })), i.filter(".resizable-xy").append("rect").attr("class", "top-right-resizer").on(S.MouseOver, (e, t) => {
3244
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && X(k.NESWResize);
3245
+ }).on(S.MouseOut, (e, t) => {
3246
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && X();
3247
+ }).call(e.drag().on(w.Start, (e, t) => {
3248
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed ? (X(k.NESWResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(k.NotAllowed);
3249
+ }).on(w.Drag, (e, t) => {
3250
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed) {
3251
+ let n = this.getPointerLocationRelativeToCanvas(e);
3252
+ t.stretch(p.Right, n[0] - (t.coords[0] + t.width)), t.stretch(p.Top, t.coords[1] - n[1]);
3253
+ }
3254
+ }).on(w.End, (e, t) => {
3255
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
3256
+ let n = this.getPointerLocationRelativeToCanvas(e);
3257
+ this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), t.stretch(p.Right, n[0] - (t.coords[0] + t.width)), t.stretch(p.Top, t.coords[1] - n[1]), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3258
+ }
3259
+ X();
3260
+ })), i.filter(".resizable-xy").append("rect").attr("class", "bottom-left-resizer").on(S.MouseOver, (e, t) => {
3261
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && X(k.NESWResize);
3262
+ }).on(S.MouseOut, (e, t) => {
3263
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && X();
3264
+ }).call(e.drag().on(w.Start, (e, t) => {
3265
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed ? (X(k.NESWResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(k.NotAllowed);
3266
+ }).on(w.Drag, (e, t) => {
3267
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed) {
3268
+ let n = this.getPointerLocationRelativeToCanvas(e);
3269
+ t.stretch(p.Left, t.coords[0] - n[0]), t.stretch(p.Bottom, n[1] - (t.coords[1] + t.height));
3270
+ }
3271
+ }).on(w.End, (e, t) => {
3272
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
3273
+ let n = this.getPointerLocationRelativeToCanvas(e);
3274
+ this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), t.stretch(p.Left, t.coords[0] - n[0]), t.stretch(p.Bottom, n[1] - (t.coords[1] + t.height)), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3275
+ }
3276
+ X();
3277
+ })), i.filter(".resizable-xy").append("rect").attr("class", "bottom-right-resizer").on(S.MouseOver, (e, t) => {
3278
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && X(k.NWSEResize);
3279
+ }).on(S.MouseOut, (e, t) => {
3280
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && X();
3281
+ }).call(e.drag().on(w.Start, (e, t) => {
3282
+ this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed ? (X(k.NWSEResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(k.NotAllowed);
3283
+ }).on(w.Drag, (e, t) => {
3284
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed) {
3285
+ let n = this.getPointerLocationRelativeToCanvas(e);
3286
+ t.stretch(p.Right, n[0] - (t.coords[0] + t.width)), t.stretch(p.Bottom, n[1] - (t.coords[1] + t.height));
3287
+ }
3288
+ }).on(w.End, (e, t) => {
3289
+ if (this.canUserPerformAction(K.StretchNode) && t.getResizableXY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
2999
3290
  let n = this.getPointerLocationRelativeToCanvas(e);
3000
- this.snapToGrid && this.snapToGrid && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[2], n[1] - t.type.snapToGridOffset[3]]), n[0] += t.type.snapToGridOffset[2], n[1] += t.type.snapToGridOffset[3]), t.stretch(p.Bottom, n[1] - (t.coords[1] + t.height)), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3291
+ this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), t.stretch(p.Right, n[0] - (t.coords[0] + t.width)), t.stretch(p.Bottom, n[1] - (t.coords[1] + t.height)), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3001
3292
  }
3002
- Z();
3003
- })), a.attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).attr("opacity", (e) => e.removed ? .5 : 1), Wt(a), a.filter(".resizable-x").select("line.left-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x1", 6 / 2).attr("x2", 6 / 2).attr("y1", 0).attr("y2", (e) => e.height), a.filter(".resizable-y").select("line.top-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x1", 0).attr("x2", (e) => e.width).attr("y1", 6 / 2).attr("y2", 6 / 2), a.filter(".resizable-x").select("line.right-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x1", (e) => e.width - 6 / 2).attr("x2", (e) => e.width - 6 / 2).attr("y1", 0).attr("y2", (e) => e.height), a.filter(".resizable-y").select("line.bottom-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x1", 0).attr("x2", (e) => e.width).attr("y1", (e) => e.height - 6 / 2).attr("y2", (e) => e.height - 6 / 2);
3293
+ X();
3294
+ })), a.attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).attr("opacity", (e) => e.removed ? .5 : 1), Yt(a), a.filter(".resizable-x").select("rect.left-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x", (e) => -e.getResizerX().outerMargin).attr("y", (e) => e.getResizerXY().thickness - e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerX().thickness).attr("height", (e) => e.height - e.getResizerXY().thickness * 2 + e.getResizerXY().outerMargin * 2).attr("fill", (e) => e.getResizerX().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerX().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerX().getLook(e).borderThickness || 0), a.filter(".resizable-x").select("rect.right-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x", (e) => e.width - e.getResizerX().thickness + e.getResizerX().outerMargin).attr("y", (e) => e.getResizerXY().thickness - e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerX().thickness).attr("height", (e) => e.height - e.getResizerXY().thickness * 2 + e.getResizerXY().outerMargin * 2).attr("fill", (e) => e.getResizerX().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerX().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerX().getLook(e).borderThickness || 0), a.filter(".resizable-y").select("rect.top-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x", (e) => e.getResizerXY().thickness - e.getResizerXY().outerMargin).attr("y", (e) => -e.getResizerY().outerMargin).attr("width", (e) => e.width - e.getResizerXY().thickness * 2 + e.getResizerXY().outerMargin * 2).attr("height", (e) => e.getResizerY().thickness).attr("fill", (e) => e.getResizerY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerY().getLook(e).borderThickness || 0), a.filter(".resizable-y").select("rect.bottom-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x", (e) => e.getResizerXY().thickness - e.getResizerXY().outerMargin).attr("y", (e) => e.height - e.getResizerY().thickness + e.getResizerY().outerMargin).attr("width", (e) => e.width - e.getResizerXY().thickness * 2 + e.getResizerXY().outerMargin * 2).attr("height", (e) => e.getResizerY().thickness).attr("fill", (e) => e.getResizerY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerY().getLook(e).borderThickness || 0), a.filter(".resizable-xy").select("rect.top-left-resizer").style("pointer-events", (e) => e.getResizableXY() ? "initial" : "none").attr("x", (e) => -e.getResizerXY().outerMargin).attr("y", (e) => -e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerXY().thickness).attr("height", (e) => e.getResizerXY().thickness).attr("fill", (e) => e.getResizerXY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerXY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerXY().getLook(e).borderThickness || 0), a.filter(".resizable-xy").select("rect.top-right-resizer").style("pointer-events", (e) => e.getResizableXY() ? "initial" : "none").attr("x", (e) => e.width - e.getResizerXY().thickness + e.getResizerXY().outerMargin).attr("y", (e) => -e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerXY().thickness).attr("height", (e) => e.getResizerXY().thickness).attr("fill", (e) => e.getResizerXY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerXY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerXY().getLook(e).borderThickness || 0), a.filter(".resizable-xy").select("rect.bottom-left-resizer").style("pointer-events", (e) => e.getResizableXY() ? "initial" : "none").attr("x", (e) => -e.getResizerXY().outerMargin).attr("y", (e) => e.height - e.getResizerXY().thickness + e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerXY().thickness).attr("height", (e) => e.getResizerXY().thickness).attr("fill", (e) => e.getResizerXY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerXY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerXY().getLook(e).borderThickness || 0), a.filter(".resizable-xy").select("rect.bottom-right-resizer").style("pointer-events", (e) => e.getResizableXY() ? "initial" : "none").attr("x", (e) => e.width - e.getResizerXY().thickness + e.getResizerXY().outerMargin).attr("y", (e) => e.height - e.getResizerXY().thickness + e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerXY().thickness).attr("height", (e) => e.getResizerXY().thickness).attr("fill", (e) => e.getResizerXY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerXY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerXY().getLook(e).borderThickness || 0);
3004
3295
  }
3005
3296
  updateSectionsInView(...t) {
3006
- let n = this.selectCanvasElements().selectAll("g.diagram-section").data(this.model.sections.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", (e) => `diagram-section${Bt(e) ? " resizable-x" : ""}${Vt(e) ? " resizable-y" : ""} ${e.look?.lookType}`);
3297
+ let n = this.selectCanvasElements().selectAll("g.diagram-section").data(this.model.sections.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", (e) => `diagram-section${Wt(e) ? " resizable-x" : ""}${Gt(e) ? " resizable-y" : ""}${Kt(e) ? " resizable-xy" : ""} ${e.look?.lookType}`);
3007
3298
  t && t.length > 0 && (n = n.filter((e) => t.includes(e.id)));
3008
3299
  let a = i.merge(n);
3009
3300
  r.remove(), i.on(S.MouseOver, (e, t) => {
3010
- this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new X(t)));
3301
+ this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)));
3011
3302
  }).on(S.Click, (e, t) => {
3012
3303
  if (!e.ctrlKey && !e.shiftKey) {
3013
3304
  let e = this.userSelection.all();
3014
- this.userSelection.clear(), this.diagramEvent$.next(new Y(e, !1));
3305
+ this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
3015
3306
  }
3016
- let n = Q(t);
3017
- this.userSelection.toggle(n), this.diagramEvent$.next(new Y([n], n.selected));
3307
+ let n = Ut(t);
3308
+ this.userSelection.toggle(n), this.diagramEvent$.next(new J([n], n.selected));
3018
3309
  }).on(S.ContextMenu, (e, t) => {
3019
3310
  if (this.dragging) {
3020
3311
  e.preventDefault(), e.stopPropagation(), this.dragging = !1;
3021
3312
  return;
3022
3313
  }
3023
- let n = new jt(e, t);
3024
- if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(q.ContextMenu)) {
3314
+ let n = new Rt(e, t);
3315
+ if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu)) {
3025
3316
  e.preventDefault();
3026
- let n = Q(t);
3027
- this.userHighlight.focusOn(n), this.diagramEvent$.next(new X(n)), this.userSelection.add(n), this.diagramEvent$.next(new Y([n], !0)), this.contextMenu.open(e);
3317
+ let n = Ut(t);
3318
+ this.userHighlight.focusOn(n), this.diagramEvent$.next(new Y(n)), this.userSelection.add(n), this.diagramEvent$.next(new J([n], !0)), this.contextMenu.open(e);
3028
3319
  }
3029
3320
  }).on(S.DoubleClick, (e, t) => {
3030
- let n = new At(e, t);
3321
+ let n = new Lt(e, t);
3031
3322
  this.diagramEvent$.next(n);
3032
- }).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e, t) => {
3323
+ }).call(e.drag().filter((e) => (this.secondaryButton = Vt(e), !0)).on(w.Start, (e, t) => {
3033
3324
  if (this.multipleSelectionOn || this.secondaryButton) this.startMultipleSelection(e);
3034
3325
  else {
3035
3326
  let n = t?.node;
3036
- n ? this.startMovingNode(e, n) : Z(A.NotAllowed);
3327
+ n ? this.startMovingNode(e, n) : X(k.NotAllowed);
3037
3328
  }
3038
3329
  }).on(w.Drag, (e, t) => {
3039
3330
  if (this.multipleSelectionOn || this.secondaryButton) this.continueMultipleSelection(e);
3040
3331
  else {
3041
3332
  let n = t?.node;
3042
- n ? this.continueMovingNode(e, n) : Z(A.NotAllowed);
3333
+ n ? this.continueMovingNode(e, n) : X(k.NotAllowed);
3043
3334
  }
3044
3335
  }).on(w.End, (e, t) => {
3045
3336
  if (this.multipleSelectionOn || this.secondaryButton) this.finishMultipleSelection(e);
3046
3337
  else {
3047
3338
  let n = t?.node;
3048
- n ? this.finishMovingNode(e, n) : Z();
3339
+ n ? this.finishMovingNode(e, n) : X();
3049
3340
  }
3050
3341
  this.secondaryButton = !1;
3051
- })), Ht(i), i.filter(".resizable-x").append("line").attr("class", "left-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
3052
- this.canUserPerformAction(q.StretchSection) && t.getResizableX() && !t.removed && Z(A.EWResize);
3342
+ })), qt(i), i.filter(".resizable-x").append("rect").attr("class", "left-resizer").on(S.MouseOver, (e, t) => {
3343
+ this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && X(k.EWResize);
3053
3344
  }).on(S.MouseOut, (e, t) => {
3054
- this.canUserPerformAction(q.StretchSection) && t.getResizableX() && !t.removed && Z();
3345
+ this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && X();
3055
3346
  }).call(e.drag().on(w.Start, (e, t) => {
3056
- this.canUserPerformAction(q.StretchSection) && t.getResizableX() && !t.removed && t.node ? (Z(A.EWResize), this.currentAction = new J(this, q.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : Z(A.NotAllowed);
3347
+ this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && t.node ? (X(k.EWResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(k.NotAllowed);
3057
3348
  }).on(w.Drag, (e, t) => {
3058
- if (this.canUserPerformAction(q.StretchSection) && t.getResizableX() && !t.removed && t.node) {
3349
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && t.node) {
3059
3350
  let n = this.getPointerLocationRelativeToCanvas(e);
3060
3351
  t.node.stretchSections(p.Left, t.coords[0] - n[0], t.indexXInNode, t.indexYInNode);
3061
3352
  }
3062
3353
  }).on(w.End, (e, t) => {
3063
- if (this.canUserPerformAction(q.StretchSection) && t.getResizableX() && !t.removed && this.currentAction instanceof J && this.currentAction.intent === q.StretchSection && t.node) {
3354
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
3064
3355
  let n = this.getPointerLocationRelativeToCanvas(e);
3065
- this.snapToGrid && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Left, t.coords[0] - n[0], t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3356
+ this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Left, t.coords[0] - n[0], t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3066
3357
  }
3067
- Z();
3068
- })), i.filter(".resizable-y").append("line").attr("class", "top-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
3069
- this.canUserPerformAction(q.StretchSection) && t.getResizableY() && !t.removed && Z(A.NSResize);
3358
+ X();
3359
+ })), i.filter(".resizable-x").append("rect").attr("class", "right-resizer").on(S.MouseOver, (e, t) => {
3360
+ this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && X(k.EWResize);
3070
3361
  }).on(S.MouseOut, (e, t) => {
3071
- this.canUserPerformAction(q.StretchSection) && t.getResizableY() && !t.removed && Z();
3362
+ this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && X();
3072
3363
  }).call(e.drag().on(w.Start, (e, t) => {
3073
- this.canUserPerformAction(q.StretchSection) && t.getResizableY() && !t.removed && t.node ? (Z(A.NSResize), this.currentAction = new J(this, q.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : Z(A.NotAllowed);
3364
+ this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && t.node ? (X(k.EWResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(k.NotAllowed);
3074
3365
  }).on(w.Drag, (e, t) => {
3075
- if (this.canUserPerformAction(q.StretchSection) && t.getResizableY() && !t.removed && t.node) {
3366
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && t.node) {
3076
3367
  let n = this.getPointerLocationRelativeToCanvas(e);
3077
- t.node.stretchSections(p.Top, t.coords[1] - n[1], t.indexXInNode, t.indexYInNode);
3368
+ t.node.stretchSections(p.Right, n[0] - (t.coords[0] + t.width), t.indexXInNode, t.indexYInNode);
3078
3369
  }
3079
3370
  }).on(w.End, (e, t) => {
3080
- if (this.canUserPerformAction(q.StretchSection) && t.getResizableY() && !t.removed && this.currentAction instanceof J && this.currentAction.intent === q.StretchSection && t.node) {
3371
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
3081
3372
  let n = this.getPointerLocationRelativeToCanvas(e);
3082
- this.snapToGrid && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Top, t.coords[1] - n[1], t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3373
+ this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Right, n[0] - (t.coords[0] + t.width), t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3083
3374
  }
3084
- Z();
3085
- })), i.filter(".resizable-x").append("line").attr("class", "right-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
3086
- this.canUserPerformAction(q.StretchSection) && t.getResizableX() && !t.removed && Z(A.EWResize);
3375
+ X();
3376
+ })), i.filter(".resizable-y").append("rect").attr("class", "top-resizer").on(S.MouseOver, (e, t) => {
3377
+ this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && X(k.NSResize);
3087
3378
  }).on(S.MouseOut, (e, t) => {
3088
- this.canUserPerformAction(q.StretchSection) && t.getResizableX() && !t.removed && Z();
3379
+ this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && X();
3089
3380
  }).call(e.drag().on(w.Start, (e, t) => {
3090
- this.canUserPerformAction(q.StretchSection) && t.getResizableX() && !t.removed && t.node ? (Z(A.EWResize), this.currentAction = new J(this, q.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : Z(A.NotAllowed);
3381
+ this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && t.node ? (X(k.NSResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(k.NotAllowed);
3091
3382
  }).on(w.Drag, (e, t) => {
3092
- if (this.canUserPerformAction(q.StretchSection) && t.getResizableX() && !t.removed && t.node) {
3383
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && t.node) {
3093
3384
  let n = this.getPointerLocationRelativeToCanvas(e);
3094
- t.node.stretchSections(p.Right, n[0] - (t.coords[0] + t.width), t.indexXInNode, t.indexYInNode);
3385
+ t.node.stretchSections(p.Top, t.coords[1] - n[1], t.indexXInNode, t.indexYInNode);
3095
3386
  }
3096
3387
  }).on(w.End, (e, t) => {
3097
- if (this.canUserPerformAction(q.StretchSection) && t.getResizableX() && !t.removed && this.currentAction instanceof J && this.currentAction.intent === q.StretchSection && t.node) {
3388
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
3098
3389
  let n = this.getPointerLocationRelativeToCanvas(e);
3099
- this.snapToGrid && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Right, n[0] - (t.coords[0] + t.width), t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3390
+ this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Top, t.coords[1] - n[1], t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3100
3391
  }
3101
- Z();
3102
- })), i.filter(".resizable-y").append("line").attr("class", "bottom-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
3103
- this.canUserPerformAction(q.StretchSection) && t.getResizableY() && !t.removed && Z(A.NSResize);
3392
+ X();
3393
+ })), i.filter(".resizable-y").append("rect").attr("class", "bottom-resizer").on(S.MouseOver, (e, t) => {
3394
+ this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && X(k.NSResize);
3104
3395
  }).on(S.MouseOut, (e, t) => {
3105
- this.canUserPerformAction(q.StretchSection) && t.getResizableY() && !t.removed && Z();
3396
+ this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && X();
3106
3397
  }).call(e.drag().on(w.Start, (e, t) => {
3107
- this.canUserPerformAction(q.StretchSection) && t.getResizableY() && !t.removed && t.node ? (Z(A.NSResize), this.currentAction = new J(this, q.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : Z(A.NotAllowed);
3398
+ this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && t.node ? (X(k.NSResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(k.NotAllowed);
3108
3399
  }).on(w.Drag, (e, t) => {
3109
- if (this.canUserPerformAction(q.StretchSection) && t.getResizableY() && !t.removed && t.node) {
3400
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && t.node) {
3110
3401
  let n = this.getPointerLocationRelativeToCanvas(e);
3111
3402
  t.node.stretchSections(p.Bottom, n[1] - (t.coords[1] + t.height), t.indexXInNode, t.indexYInNode);
3112
3403
  }
3113
3404
  }).on(w.End, (e, t) => {
3114
- if (this.canUserPerformAction(q.StretchSection) && t.getResizableY() && !t.removed && this.currentAction instanceof J && this.currentAction.intent === q.StretchSection && t.node) {
3405
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
3406
+ let n = this.getPointerLocationRelativeToCanvas(e);
3407
+ this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Bottom, n[1] - (t.coords[1] + t.height), t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3408
+ }
3409
+ X();
3410
+ })), i.filter(".resizable-xy").append("rect").attr("class", "top-left-resizer").on(S.MouseOver, (e, t) => {
3411
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && X(k.NWSEResize);
3412
+ }).on(S.MouseOut, (e, t) => {
3413
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && X();
3414
+ }).call(e.drag().on(w.Start, (e, t) => {
3415
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && t.node ? (X(k.NWSEResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(k.NotAllowed);
3416
+ }).on(w.Drag, (e, t) => {
3417
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && t.node) {
3418
+ let n = this.getPointerLocationRelativeToCanvas(e);
3419
+ t.node.stretchSections(p.Left, t.coords[0] - n[0], t.indexXInNode, t.indexYInNode), t.node.stretchSections(p.Top, t.coords[1] - n[1], t.indexXInNode, t.indexYInNode);
3420
+ }
3421
+ }).on(w.End, (e, t) => {
3422
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
3423
+ let n = this.getPointerLocationRelativeToCanvas(e);
3424
+ this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Left, t.coords[0] - n[0], t.indexXInNode, t.indexYInNode), t.node.stretchSections(p.Top, t.coords[1] - n[1], t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3425
+ }
3426
+ X();
3427
+ })), i.filter(".resizable-xy").append("rect").attr("class", "top-right-resizer").on(S.MouseOver, (e, t) => {
3428
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && X(k.NESWResize);
3429
+ }).on(S.MouseOut, (e, t) => {
3430
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && X();
3431
+ }).call(e.drag().on(w.Start, (e, t) => {
3432
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && t.node ? (X(k.NESWResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(k.NotAllowed);
3433
+ }).on(w.Drag, (e, t) => {
3434
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && t.node) {
3435
+ let n = this.getPointerLocationRelativeToCanvas(e);
3436
+ t.node.stretchSections(p.Right, n[0] - (t.coords[0] + t.width), t.indexXInNode, t.indexYInNode), t.node.stretchSections(p.Top, t.coords[1] - n[1], t.indexXInNode, t.indexYInNode);
3437
+ }
3438
+ }).on(w.End, (e, t) => {
3439
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
3440
+ let n = this.getPointerLocationRelativeToCanvas(e);
3441
+ this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Right, n[0] - (t.coords[0] + t.width), t.indexXInNode, t.indexYInNode), t.node.stretchSections(p.Top, t.coords[1] - n[1], t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3442
+ }
3443
+ X();
3444
+ })), i.filter(".resizable-xy").append("rect").attr("class", "bottom-left-resizer").on(S.MouseOver, (e, t) => {
3445
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && X(k.NESWResize);
3446
+ }).on(S.MouseOut, (e, t) => {
3447
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && X();
3448
+ }).call(e.drag().on(w.Start, (e, t) => {
3449
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && t.node ? (X(k.NESWResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(k.NotAllowed);
3450
+ }).on(w.Drag, (e, t) => {
3451
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && t.node) {
3452
+ let n = this.getPointerLocationRelativeToCanvas(e);
3453
+ t.node.stretchSections(p.Left, t.coords[0] - n[0], t.indexXInNode, t.indexYInNode), t.node.stretchSections(p.Bottom, n[1] - (t.coords[1] + t.height), t.indexXInNode, t.indexYInNode);
3454
+ }
3455
+ }).on(w.End, (e, t) => {
3456
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
3457
+ let n = this.getPointerLocationRelativeToCanvas(e);
3458
+ this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Left, t.coords[0] - n[0], t.indexXInNode, t.indexYInNode), t.node.stretchSections(p.Bottom, n[1] - (t.coords[1] + t.height), t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3459
+ }
3460
+ X();
3461
+ })), i.filter(".resizable-xy").append("rect").attr("class", "bottom-right-resizer").on(S.MouseOver, (e, t) => {
3462
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && X(k.NWSEResize);
3463
+ }).on(S.MouseOut, (e, t) => {
3464
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && X();
3465
+ }).call(e.drag().on(w.Start, (e, t) => {
3466
+ this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && t.node ? (X(k.NWSEResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(k.NotAllowed);
3467
+ }).on(w.Drag, (e, t) => {
3468
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && t.node) {
3115
3469
  let n = this.getPointerLocationRelativeToCanvas(e);
3116
- this.snapToGrid && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Bottom, n[1] - (t.coords[1] + t.height), t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3470
+ t.node.stretchSections(p.Right, n[0] - (t.coords[0] + t.width), t.indexXInNode, t.indexYInNode), t.node.stretchSections(p.Bottom, n[1] - (t.coords[1] + t.height), t.indexXInNode, t.indexYInNode);
3117
3471
  }
3118
- Z();
3119
- })), a.attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).attr("opacity", (e) => e.removed ? .5 : 1), Wt(a), a.filter(".resizable-x").select("line.left-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x1", 6 / 2).attr("x2", 6 / 2).attr("y1", 0).attr("y2", (e) => e.height), a.filter(".resizable-y").select("line.top-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x1", 0).attr("x2", (e) => e.width).attr("y1", 6 / 2).attr("y2", 6 / 2), a.filter(".resizable-x").select("line.right-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x1", (e) => e.width - 6 / 2).attr("x2", (e) => e.width - 6 / 2).attr("y1", 0).attr("y2", (e) => e.height), a.filter(".resizable-y").select("line.bottom-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x1", 0).attr("x2", (e) => e.width).attr("y1", (e) => e.height - 6 / 2).attr("y2", (e) => e.height - 6 / 2);
3472
+ }).on(w.End, (e, t) => {
3473
+ if (this.canUserPerformAction(K.StretchSection) && t.getResizableXY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
3474
+ let n = this.getPointerLocationRelativeToCanvas(e);
3475
+ this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Right, n[0] - (t.coords[0] + t.width), t.indexXInNode, t.indexYInNode), t.node.stretchSections(p.Bottom, n[1] - (t.coords[1] + t.height), t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
3476
+ }
3477
+ X();
3478
+ })), a.attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).attr("opacity", (e) => e.removed ? .5 : 1), Yt(a), a.filter(".resizable-x").select("rect.left-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x", (e) => -e.getResizerX().outerMargin).attr("y", (e) => e.getResizerXY().thickness - e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerX().thickness).attr("height", (e) => e.height - e.getResizerXY().thickness * 2 + e.getResizerXY().outerMargin * 2).attr("fill", (e) => e.getResizerX().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerX().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerX().getLook(e).borderThickness || 0), a.filter(".resizable-x").select("rect.right-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x", (e) => e.width - e.getResizerX().thickness + e.getResizerX().outerMargin).attr("y", (e) => e.getResizerXY().thickness - e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerX().thickness).attr("height", (e) => e.height - e.getResizerXY().thickness * 2 + e.getResizerXY().outerMargin * 2).attr("fill", (e) => e.getResizerX().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerX().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerX().getLook(e).borderThickness || 0), a.filter(".resizable-y").select("rect.top-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x", (e) => e.getResizerXY().thickness - e.getResizerXY().outerMargin).attr("y", (e) => -e.getResizerY().outerMargin).attr("width", (e) => e.width - e.getResizerXY().thickness * 2 + e.getResizerXY().outerMargin * 2).attr("height", (e) => e.getResizerY().thickness).attr("fill", (e) => e.getResizerY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerY().getLook(e).borderThickness || 0), a.filter(".resizable-y").select("rect.bottom-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x", (e) => e.getResizerXY().thickness - e.getResizerXY().outerMargin).attr("y", (e) => e.height - e.getResizerY().thickness + e.getResizerY().outerMargin).attr("width", (e) => e.width - e.getResizerXY().thickness * 2 + e.getResizerXY().outerMargin * 2).attr("height", (e) => e.getResizerY().thickness).attr("fill", (e) => e.getResizerY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerY().getLook(e).borderThickness || 0), a.filter(".resizable-xy").select("rect.top-left-resizer").style("pointer-events", (e) => e.getResizableXY() ? "initial" : "none").attr("x", (e) => -e.getResizerXY().outerMargin).attr("y", (e) => -e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerXY().thickness).attr("height", (e) => e.getResizerXY().thickness).attr("fill", (e) => e.getResizerXY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerXY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerXY().getLook(e).borderThickness || 0), a.filter(".resizable-xy").select("rect.top-right-resizer").style("pointer-events", (e) => e.getResizableXY() ? "initial" : "none").attr("x", (e) => e.width - e.getResizerXY().thickness + e.getResizerXY().outerMargin).attr("y", (e) => -e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerXY().thickness).attr("height", (e) => e.getResizerXY().thickness).attr("fill", (e) => e.getResizerXY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerXY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerXY().getLook(e).borderThickness || 0), a.filter(".resizable-xy").select("rect.bottom-left-resizer").style("pointer-events", (e) => e.getResizableXY() ? "initial" : "none").attr("x", (e) => -e.getResizerXY().outerMargin).attr("y", (e) => e.height - e.getResizerXY().thickness + e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerXY().thickness).attr("height", (e) => e.getResizerXY().thickness).attr("fill", (e) => e.getResizerXY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerXY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerXY().getLook(e).borderThickness || 0), a.filter(".resizable-xy").select("rect.bottom-right-resizer").style("pointer-events", (e) => e.getResizableXY() ? "initial" : "none").attr("x", (e) => e.width - e.getResizerXY().thickness + e.getResizerXY().outerMargin).attr("y", (e) => e.height - e.getResizerXY().thickness + e.getResizerXY().outerMargin).attr("width", (e) => e.getResizerXY().thickness).attr("height", (e) => e.getResizerXY().thickness).attr("fill", (e) => e.getResizerXY().getLook(e).fillColor || "transparent").attr("stroke", (e) => e.getResizerXY().getLook(e).borderColor || "transparent").attr("stroke-width", (e) => e.getResizerXY().getLook(e).borderThickness || 0);
3120
3479
  }
3121
3480
  updatePortsInView(...t) {
3122
3481
  let n = this.selectCanvasElements().selectAll("g.diagram-port").data(this.model.ports.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", (e) => `diagram-port ${e.look.lookType}`);
3123
3482
  t && t.length > 0 && (n = n.filter((e) => t.includes(e.id)));
3124
3483
  let a = i.merge(n);
3125
3484
  r.remove(), i.on(S.MouseOver, (e, t) => {
3126
- !this.unfinishedConnection && !this.dragging && (this.userHighlight.focusOn(t), this.diagramEvent$.next(new X(t))), this.unfinishedConnection && (this.unfinishedConnection.type.canStartFromType(this.unfinishedConnection.start?.getNode()?.type?.id || "") && this.unfinishedConnection.start?.allowsOutgoing && this.unfinishedConnection.type.canFinishOnType(t.getNode()?.type?.id || "") && t.allowsIncoming || this.unfinishedConnection.type.canStartFromType(t.getNode()?.type?.id || "") && t.allowsOutgoing && this.unfinishedConnection.type.canFinishOnType(this.unfinishedConnection.start?.getNode()?.type?.id || "") && this.unfinishedConnection.start?.allowsIncoming || Z(A.NoDrop));
3485
+ !this.unfinishedConnection && !this.dragging && (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t))), this.unfinishedConnection && (this.unfinishedConnection.type.canStartFromType(this.unfinishedConnection.start?.getNode()?.type?.id || "") && this.unfinishedConnection.start?.allowsOutgoing && this.unfinishedConnection.type.canFinishOnType(t.getNode()?.type?.id || "") && t.allowsIncoming || this.unfinishedConnection.type.canStartFromType(t.getNode()?.type?.id || "") && t.allowsOutgoing && this.unfinishedConnection.type.canFinishOnType(this.unfinishedConnection.start?.getNode()?.type?.id || "") && this.unfinishedConnection.start?.allowsIncoming || X(k.NoDrop));
3127
3486
  }).on(S.MouseOut, () => {
3128
- this.unfinishedConnection && Z(A.Grabbing);
3487
+ this.unfinishedConnection && X(k.Grabbing);
3129
3488
  }).on(S.Click, (e, t) => {
3130
3489
  if (!e.ctrlKey && !e.shiftKey) {
3131
3490
  let e = this.userSelection.all();
3132
- this.userSelection.clear(), this.diagramEvent$.next(new Y(e, !1));
3491
+ this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
3133
3492
  }
3134
- let n = Q(t);
3135
- this.userSelection.toggle(n), this.diagramEvent$.next(new Y([n], n.selected));
3493
+ let n = Ut(t);
3494
+ this.userSelection.toggle(n), this.diagramEvent$.next(new J([n], n.selected));
3136
3495
  }).on(S.ContextMenu, (e, t) => {
3137
3496
  if (this.dragging) {
3138
3497
  e.preventDefault(), e.stopPropagation(), this.dragging = !1;
3139
3498
  return;
3140
3499
  }
3141
- let n = new jt(e, t);
3142
- if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(q.ContextMenu)) {
3500
+ let n = new Rt(e, t);
3501
+ if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu)) {
3143
3502
  e.preventDefault();
3144
- let n = Q(t);
3145
- this.userHighlight.focusOn(n), this.diagramEvent$.next(new X(n)), this.userSelection.add(n), this.diagramEvent$.next(new Y([n], !0)), this.contextMenu.open(e);
3503
+ let n = Ut(t);
3504
+ this.userHighlight.focusOn(n), this.diagramEvent$.next(new Y(n)), this.userSelection.add(n), this.diagramEvent$.next(new J([n], !0)), this.contextMenu.open(e);
3146
3505
  }
3147
3506
  }).on(S.DoubleClick, (e, t) => {
3148
- let n = new At(e, t);
3507
+ let n = new Lt(e, t);
3149
3508
  this.diagramEvent$.next(n);
3150
- }).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e, t) => {
3151
- this.multipleSelectionOn || this.secondaryButton ? this.startMultipleSelection(e) : this.canUserPerformAction(q.AddConnection) && (this.allowSharingPorts || t.incomingConnections.filter((e) => !e.removed).length === 0 && t.outgoingConnections.filter((e) => !e.removed).length === 0) && !t.removed ? (Z(A.Grabbing), this.startConnection(t), this.unfinishedConnection && (this.unfinishedConnectionTracer = this.selectCanvasElements().append("path").attr("stroke", "none").attr("fill", "none"))) : Z(A.NotAllowed);
3509
+ }).call(e.drag().filter((e) => (this.secondaryButton = Vt(e), !0)).on(w.Start, (e, t) => {
3510
+ this.multipleSelectionOn || this.secondaryButton ? this.startMultipleSelection(e) : this.canUserPerformAction(K.AddConnection) && (this.allowSharingPorts || t.incomingConnections.filter((e) => !e.removed).length === 0 && t.outgoingConnections.filter((e) => !e.removed).length === 0) && !t.removed ? (X(k.Grabbing), this.startConnection(t), this.unfinishedConnection && (this.unfinishedConnectionTracer = this.selectCanvasElements().append("path").attr("stroke", "none").attr("fill", "none"))) : X(k.NotAllowed);
3152
3511
  }).on(w.Drag, (e, t) => {
3153
3512
  if (this.multipleSelectionOn || this.secondaryButton) this.continueMultipleSelection(e);
3154
- else if (this.canUserPerformAction(q.AddConnection) && !t.removed && this.unfinishedConnection !== void 0) {
3513
+ else if (this.canUserPerformAction(K.AddConnection) && !t.removed && this.unfinishedConnection !== void 0) {
3155
3514
  let t = [e.x, e.y];
3156
- this.unfinishedConnectionTracer?.attr("d", zt(this.unfinishedConnection.look.shape || F.look.shape, this.unfinishedConnection.startCoords, t, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.points, this.unfinishedConnection.type.defaultLook.thickness || F.look.thickness, this.unfinishedConnection.type.defaultStartMarkerLook?.width, this.unfinishedConnection.type.defaultEndMarkerLook?.width));
3515
+ this.unfinishedConnectionTracer?.attr("d", Ht(this.unfinishedConnection.look.shape || P.look.shape, this.unfinishedConnection.startCoords, t, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.points, this.unfinishedConnection.type.defaultLook.thickness || P.look.thickness, this.unfinishedConnection.type.defaultStartMarkerLook?.width, this.unfinishedConnection.type.defaultEndMarkerLook?.width));
3157
3516
  let n = this.unfinishedConnectionTracer?.node();
3158
3517
  if (n) {
3159
3518
  let e = 2, t = n.getTotalLength();
@@ -3161,7 +3520,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3161
3520
  let r = n.getPointAtLength(t - e);
3162
3521
  this.unfinishedConnection.endCoords = [r.x, r.y];
3163
3522
  } else this.unfinishedConnection.endCoords = t;
3164
- if (this.updateConnectionsInView(rn), this.unfinishedConnectionPort?.raise(!1), this.model.ports.length > 0) {
3523
+ if (this.updateConnectionsInView(pn), this.unfinishedConnectionPort?.raise(!1), this.model.ports.length > 0) {
3165
3524
  let t = this.getPointerLocationRelativeToCanvas(e), n = Infinity, r;
3166
3525
  for (let e of this.model.ports) {
3167
3526
  let i = e.distanceTo(t);
@@ -3173,15 +3532,15 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3173
3532
  }).on(w.End, (e, t) => {
3174
3533
  if (this.multipleSelectionOn || this.secondaryButton) this.finishMultipleSelection(e);
3175
3534
  else {
3176
- if (this.canUserPerformAction(q.AddConnection) && !t.removed) {
3535
+ if (this.canUserPerformAction(K.AddConnection) && !t.removed) {
3177
3536
  this.unfinishedConnectionTracer?.remove();
3178
3537
  let t = this.userHighlight.getFocus();
3179
- if (t instanceof it) this.finishConnection(t);
3180
- else if (t instanceof Ie && t.rootElement instanceof it) this.finishConnection(t.rootElement);
3181
- else if (t instanceof W || t instanceof H || t instanceof Ie) {
3538
+ if (t instanceof dt) this.finishConnection(t);
3539
+ else if (t instanceof Le && t.rootElement instanceof dt) this.finishConnection(t.rootElement);
3540
+ else if (t instanceof W || t instanceof U || t instanceof Le) {
3182
3541
  let n;
3183
- if (t instanceof W || t instanceof H) n = t;
3184
- else if (t.rootElement instanceof W || t.rootElement instanceof H) n = t.rootElement;
3542
+ if (t instanceof W || t instanceof U) n = t;
3543
+ else if (t.rootElement instanceof W || t.rootElement instanceof U) n = t.rootElement;
3185
3544
  else {
3186
3545
  this.dropConnection();
3187
3546
  return;
@@ -3190,10 +3549,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3190
3549
  r === void 0 ? this.dropConnection() : this.finishConnection(r);
3191
3550
  } else this.dropConnection();
3192
3551
  }
3193
- Z();
3552
+ X();
3194
3553
  }
3195
3554
  this.secondaryButton = !1;
3196
- })), i.filter(".image-look").append("image"), Ht(i), a.attr("transform", (e) => `translate(${e.coords[0] - e.width / 2},${e.coords[1] - e.width / 2})`).attr("opacity", (e) => e.removed ? .5 : 1), Wt(a);
3555
+ })), i.filter(".image-look").append("image"), qt(i), a.attr("transform", (e) => `translate(${e.coords[0] - e.width / 2},${e.coords[1] - e.width / 2})`).attr("opacity", (e) => e.removed ? .5 : 1), Yt(a);
3197
3556
  }
3198
3557
  updateConnectionsInView(...t) {
3199
3558
  let n = this.model.connections.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold);
@@ -3202,30 +3561,30 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3202
3561
  t && t.length > 0 && (r = r.filter((e) => t.includes(e.id)));
3203
3562
  let o = a.merge(r);
3204
3563
  i.remove(), a.on(S.MouseOver, (e, t) => {
3205
- t.end !== void 0 && !this.dragging && (this.userHighlight.focusOn(t), this.diagramEvent$.next(new X(t)));
3564
+ t.end !== void 0 && !this.dragging && (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)));
3206
3565
  }).on(S.Click, (e, t) => {
3207
3566
  if (!e.ctrlKey && !e.shiftKey) {
3208
3567
  let e = this.userSelection.all();
3209
- this.userSelection.clear(), this.diagramEvent$.next(new Y(e, !1));
3568
+ this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
3210
3569
  }
3211
- this.userSelection.toggle(t), this.diagramEvent$.next(new Y([t], t.selected));
3570
+ this.userSelection.toggle(t), this.diagramEvent$.next(new J([t], t.selected));
3212
3571
  }).on(S.ContextMenu, (e, t) => {
3213
3572
  if (this.dragging) {
3214
3573
  e.preventDefault(), e.stopPropagation(), this.dragging = !1;
3215
3574
  return;
3216
3575
  }
3217
- let n = new jt(e, t);
3218
- this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(q.ContextMenu) && (e.preventDefault(), this.userHighlight.focusOn(t), this.diagramEvent$.next(new X(t)), this.userSelection.add(t), this.diagramEvent$.next(new Y([t], !0)), this.contextMenu.open(e));
3576
+ let n = new Rt(e, t);
3577
+ this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu) && (e.preventDefault(), this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)), this.userSelection.add(t), this.diagramEvent$.next(new J([t], !0)), this.contextMenu.open(e));
3219
3578
  }).on(S.DoubleClick, (e, t) => {
3220
- let n = new At(e, t);
3579
+ let n = new Lt(e, t);
3221
3580
  this.diagramEvent$.next(n);
3222
- }).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e) => {
3581
+ }).call(e.drag().filter((e) => (this.secondaryButton = Vt(e), !0)).on(w.Start, (e) => {
3223
3582
  this.startMultipleSelection(e);
3224
3583
  }).on(w.Drag, (e) => {
3225
3584
  this.continueMultipleSelection(e);
3226
3585
  }).on(w.End, (e) => {
3227
3586
  this.finishMultipleSelection(e);
3228
- })), a.append("path").attr("class", "diagram-connection-path"), a.append("path").attr("class", "diagram-connection-path-box"), a.append("marker").attr("id", (e) => `${e.id}-start-marker`).attr("class", "diagram-connection-start-marker").append("image").attr("preserveAspectRatio", "none"), a.append("marker").attr("id", (e) => `${e.id}-end-marker`).attr("class", "diagram-connection-end-marker").append("image").attr("preserveAspectRatio", "none"), a.append("g").attr("class", "diagram-connection-start-label"), a.select("g.diagram-connection-start-label").append("path"), a.select("g.diagram-connection-start-label").append("text").style("user-select", "none"), a.append("g").attr("class", "diagram-connection-middle-label"), a.select("g.diagram-connection-middle-label").append("path"), a.select("g.diagram-connection-middle-label").append("text").style("user-select", "none"), a.append("g").attr("class", "diagram-connection-end-label"), a.select("g.diagram-connection-end-label").append("path"), a.select("g.diagram-connection-end-label").append("text").style("user-select", "none"), o.attr("opacity", (e) => e.removed ? .5 : 1).select("path.diagram-connection-path").attr("d", (e) => zt(e.look.shape || F.look.shape, e.startCoords, e.endCoords, e.startDirection, e.endDirection, e.points, e.type.defaultLook.thickness || F.look.thickness, e.type.defaultStartMarkerLook?.width, e.type.defaultEndMarkerLook?.width)).attr("marker-start", (e) => `url(#${e.id}-start-marker)`).attr("marker-end", (e) => `url(#${e.id}-end-marker)`).attr("stroke", (e) => e.look.color || F.look.color).attr("stroke-width", (e) => e.look.thickness || F.look.thickness).attr("stroke-dasharray", (e) => ie(e.look.style || F.look.style, e.type.defaultLook.thickness || F.look.thickness)).attr("fill", "none"), o.select("path.diagram-connection-path-box").attr("d", (e) => zt(e.look.shape || F.look.shape, e.startCoords, e.endCoords, e.startDirection, e.endDirection, e.points, e.type.defaultLook.thickness || F.look.thickness, e.type.defaultStartMarkerLook?.width, e.type.defaultEndMarkerLook?.width)).attr("stroke", "transparent").attr("pointer-events", "stroke").attr("stroke-width", (e) => (e.look.thickness || F.look.thickness) + 12).attr("stroke-dasharray", (e) => ie(e.look.style || F.look.style, e.type.defaultLook.thickness || F.look.thickness)).attr("fill", "none"), o.data().forEach((e) => {
3587
+ })), a.append("path").attr("class", "diagram-connection-path"), a.append("path").attr("class", "diagram-connection-path-box"), a.append("marker").attr("id", (e) => `${e.id}-start-marker`).attr("class", "diagram-connection-start-marker").append("image").attr("preserveAspectRatio", "none"), a.append("marker").attr("id", (e) => `${e.id}-end-marker`).attr("class", "diagram-connection-end-marker").append("image").attr("preserveAspectRatio", "none"), a.append("g").attr("class", "diagram-connection-start-label"), a.select("g.diagram-connection-start-label").append("path"), a.select("g.diagram-connection-start-label").append("text").style("user-select", "none"), a.append("g").attr("class", "diagram-connection-middle-label"), a.select("g.diagram-connection-middle-label").append("path"), a.select("g.diagram-connection-middle-label").append("text").style("user-select", "none"), a.append("g").attr("class", "diagram-connection-end-label"), a.select("g.diagram-connection-end-label").append("path"), a.select("g.diagram-connection-end-label").append("text").style("user-select", "none"), o.attr("opacity", (e) => e.removed ? .5 : 1).select("path.diagram-connection-path").attr("d", (e) => Ht(e.look.shape || P.look.shape, e.startCoords, e.endCoords, e.startDirection, e.endDirection, e.points, e.type.defaultLook.thickness || P.look.thickness, e.type.defaultStartMarkerLook?.width, e.type.defaultEndMarkerLook?.width)).attr("marker-start", (e) => `url(#${e.id}-start-marker)`).attr("marker-end", (e) => `url(#${e.id}-end-marker)`).attr("stroke", (e) => e.look.color || P.look.color).attr("stroke-width", (e) => e.look.thickness || P.look.thickness).attr("stroke-dasharray", (e) => ie(e.look.style || P.look.style, e.type.defaultLook.thickness || P.look.thickness)).attr("fill", "none"), o.select("path.diagram-connection-path-box").attr("d", (e) => Ht(e.look.shape || P.look.shape, e.startCoords, e.endCoords, e.startDirection, e.endDirection, e.points, e.type.defaultLook.thickness || P.look.thickness, e.type.defaultStartMarkerLook?.width, e.type.defaultEndMarkerLook?.width)).attr("stroke", "transparent").attr("pointer-events", "stroke").attr("stroke-width", (e) => (e.look.thickness || P.look.thickness) + 12).attr("stroke-dasharray", (e) => ie(e.look.style || P.look.style, e.type.defaultLook.thickness || P.look.thickness)).attr("fill", "none"), o.data().forEach((e) => {
3229
3588
  this.updateConnectionLabelsInView(e), this.updateConnectionMarkersInView(e);
3230
3589
  });
3231
3590
  }
@@ -3234,64 +3593,64 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3234
3593
  t && t.length > 0 && (n = n.filter((e) => t.includes(e.id)));
3235
3594
  let a = i.merge(n);
3236
3595
  r.remove(), i.on(S.MouseOver, (e, t) => {
3237
- this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new X(t)));
3596
+ this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)));
3238
3597
  }).on(S.Click, (e, t) => {
3239
3598
  if (!e.ctrlKey && !e.shiftKey) {
3240
3599
  let e = this.userSelection.all();
3241
- this.userSelection.clear(), this.diagramEvent$.next(new Y(e, !1));
3600
+ this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
3242
3601
  }
3243
- let n = Q(t);
3244
- this.userSelection.toggle(n), this.diagramEvent$.next(new Y([n], n.selected));
3602
+ let n = Ut(t);
3603
+ this.userSelection.toggle(n), this.diagramEvent$.next(new J([n], n.selected));
3245
3604
  }).on(S.ContextMenu, (e, t) => {
3246
3605
  if (this.dragging) {
3247
3606
  e.preventDefault(), e.stopPropagation(), this.dragging = !1;
3248
3607
  return;
3249
3608
  }
3250
- let n = new jt(e, t);
3251
- if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(q.ContextMenu)) {
3609
+ let n = new Rt(e, t);
3610
+ if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu)) {
3252
3611
  e.preventDefault();
3253
- let n = Q(t);
3254
- this.userHighlight.focusOn(n), this.diagramEvent$.next(new X(n)), this.userSelection.add(n), this.diagramEvent$.next(new Y([n], !0)), this.contextMenu.open(e);
3612
+ let n = Ut(t);
3613
+ this.userHighlight.focusOn(n), this.diagramEvent$.next(new Y(n)), this.userSelection.add(n), this.diagramEvent$.next(new J([n], !0)), this.contextMenu.open(e);
3255
3614
  }
3256
3615
  }).on(S.DoubleClick, (e, t) => {
3257
- let n = new At(e, t);
3258
- this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(q.EditField) && t.editable && !t.removed && (this.currentAction = new Ct(this, t.id, t.text, ""), this.openTextInput(t.id));
3259
- }).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e, t) => {
3616
+ let n = new Lt(e, t);
3617
+ this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.EditField) && t.editable && !t.removed && (this.currentAction = new At(this, t.id, t.text, ""), this.openTextInput(t.id));
3618
+ }).call(e.drag().filter((e) => (this.secondaryButton = Vt(e), !0)).on(w.Start, (e, t) => {
3260
3619
  if (this.multipleSelectionOn || this.secondaryButton) this.startMultipleSelection(e);
3261
3620
  else {
3262
3621
  let n;
3263
- t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.startMovingNode(e, n) : Z(A.NotAllowed);
3622
+ t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof U && (n = t.rootElement.node), n ? this.startMovingNode(e, n) : X(k.NotAllowed);
3264
3623
  }
3265
3624
  }).on(w.Drag, (e, t) => {
3266
3625
  if (this.multipleSelectionOn || this.secondaryButton) this.continueMultipleSelection(e);
3267
3626
  else {
3268
3627
  let n;
3269
- t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.continueMovingNode(e, n) : Z(A.NotAllowed);
3628
+ t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof U && (n = t.rootElement.node), n ? this.continueMovingNode(e, n) : X(k.NotAllowed);
3270
3629
  }
3271
3630
  }).on(w.End, (e, t) => {
3272
3631
  if (this.multipleSelectionOn || this.secondaryButton) this.finishMultipleSelection(e);
3273
3632
  else {
3274
3633
  let n;
3275
- t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.finishMovingNode(e, n) : Z();
3634
+ t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof U && (n = t.rootElement.node), n ? this.finishMovingNode(e, n) : X();
3276
3635
  }
3277
3636
  this.secondaryButton = !1;
3278
- })), i.append("text"), i.append("rect"), a.attr("x", 0).attr("y", 0).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]}) rotate(${e.orientation} ${e.width / 2} ${e.height / 2})`).attr("opacity", (e) => e.removed ? .5 : 1).select("text").attr("x", (e) => e.horizontalAlign === h.Center ? e.width / 2 : e.horizontalAlign === h.Right ? e.width : 0).attr("text-anchor", (e) => e.horizontalAlign === h.Center ? "middle" : e.horizontalAlign === h.Right ? "end" : "start").attr("y", (e) => e.verticalAlign === g.Center ? e.height / 2 : e.verticalAlign === g.Bottom ? e.height : 0).attr("dominant-baseline", (e) => e.verticalAlign === g.Center ? "middle" : e.verticalAlign === g.Bottom ? "auto" : "hanging").attr("font-size", (e) => e.fontSize).attr("font-family", (e) => e.fontFamily || "'Wonder Unit Sans', sans-serif").attr("font-weight", (e) => e.highlighted ? 600 : 400).attr("fill", (e) => e.selected ? e.selectedColor || "#000000" : e.color || "#000000").each((e) => {
3637
+ })), i.append("text").style("user-select", "none").style("font-kerning", "none").style("white-space", "nowrap"), i.append("rect"), a.attr("x", 0).attr("y", 0).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]}) rotate(${e.orientation} ${e.width / 2} ${e.height / 2})`).attr("opacity", (e) => e.removed ? .5 : 1).select("text").attr("x", (e) => e.horizontalAlign === h.Center ? e.width / 2 : e.horizontalAlign === h.Right ? e.width : 0).attr("text-anchor", (e) => e.horizontalAlign === h.Center ? "middle" : e.horizontalAlign === h.Right ? "end" : "start").attr("y", (e) => e.verticalAlign === g.Center ? e.height / 2 : e.verticalAlign === g.Bottom ? e.height : 0).attr("dominant-baseline", (e) => e.verticalAlign === g.Center ? "middle" : e.verticalAlign === g.Bottom ? "auto" : "hanging").attr("font-size", (e) => e.look.fontSize || L.look.fontSize).attr("font-family", (e) => e.look.fontFamily || "'Wonder Unit Sans', sans-serif").attr("font-weight", (e) => e.look.fontWeight || L.look.fontWeight).attr("fill", (e) => e.look.fontColor || L.look.fontColor).style("font-kerning", "none").each((e) => {
3279
3638
  this.setFieldTextAndWrap(e);
3280
3639
  }), a.select("rect").attr("x", 0).attr("y", 0).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("fill", "transparent");
3281
3640
  }
3282
3641
  updateObjectsInView(...t) {
3283
3642
  let n = this.selectCanvasElements().selectAll("g.diagram-object").data(this.model.objects.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", "diagram-object");
3284
- t && t.length > 0 && (n = n.filter((e) => t.includes(e.id))), i.merge(n).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).html((e) => e.html), r.remove(), i.on(S.ContextMenu, (e, t) => {
3643
+ t && t.length > 0 && (n = n.filter((e) => t.includes(e.id))), i.merge(n).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).html((e) => e.svg), r.remove(), i.on(S.ContextMenu, (e, t) => {
3285
3644
  if (this.dragging) {
3286
3645
  e.preventDefault(), e.stopPropagation(), this.dragging = !1;
3287
3646
  return;
3288
3647
  }
3289
- let n = new jt(e, t);
3290
- this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(q.ContextMenu) && (e.preventDefault(), this.contextMenu.open(e));
3648
+ let n = new Rt(e, t);
3649
+ this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu) && (e.preventDefault(), this.contextMenu.open(e));
3291
3650
  }).on(S.DoubleClick, (e, t) => {
3292
- let n = new At(e, t);
3651
+ let n = new Lt(e, t);
3293
3652
  this.diagramEvent$.next(n);
3294
- }).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e) => {
3653
+ }).call(e.drag().filter((e) => (this.secondaryButton = Vt(e), !0)).on(w.Start, (e) => {
3295
3654
  (this.multipleSelectionOn || this.secondaryButton) && this.startMultipleSelection(e);
3296
3655
  }).on(w.Drag, (e) => {
3297
3656
  (this.multipleSelectionOn || this.secondaryButton) && this.continueMultipleSelection(e);
@@ -3301,48 +3660,48 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3301
3660
  }
3302
3661
  updateDecoratorsInView(...t) {
3303
3662
  let n = this.selectCanvasElements().selectAll("g.diagram-decorator").data(this.model.decorators.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", "diagram-decorator");
3304
- t && t.length > 0 && (n = n.filter((e) => t.includes(e.id))), i.merge(n).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).html((e) => e.html), r.remove(), i.on(S.MouseOver, (e, t) => {
3305
- this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new X(t)));
3663
+ t && t.length > 0 && (n = n.filter((e) => t.includes(e.id))), i.merge(n).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).html((e) => e.svg), r.remove(), i.on(S.MouseOver, (e, t) => {
3664
+ this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)));
3306
3665
  }).on(S.Click, (e, t) => {
3307
3666
  if (!e.ctrlKey && !e.shiftKey) {
3308
3667
  let e = this.userSelection.all();
3309
- this.userSelection.clear(), this.diagramEvent$.next(new Y(e, !1));
3668
+ this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
3310
3669
  }
3311
3670
  if (t.rootElement) {
3312
- let e = Q(t.rootElement);
3313
- this.userSelection.toggle(e), this.diagramEvent$.next(new Y([e], e.selected));
3671
+ let e = Ut(t.rootElement);
3672
+ this.userSelection.toggle(e), this.diagramEvent$.next(new J([e], e.selected));
3314
3673
  }
3315
3674
  }).on(S.ContextMenu, (e, t) => {
3316
3675
  if (this.dragging) {
3317
3676
  e.preventDefault(), e.stopPropagation(), this.dragging = !1;
3318
3677
  return;
3319
3678
  }
3320
- let n = new jt(e, t);
3321
- if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(q.ContextMenu) && t.rootElement) {
3679
+ let n = new Rt(e, t);
3680
+ if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu) && t.rootElement) {
3322
3681
  e.preventDefault();
3323
- let n = Q(t.rootElement);
3324
- this.userHighlight.focusOn(n), this.diagramEvent$.next(new X(n)), this.userSelection.add(n), this.diagramEvent$.next(new Y([n], !0)), this.contextMenu.open(e);
3682
+ let n = Ut(t.rootElement);
3683
+ this.userHighlight.focusOn(n), this.diagramEvent$.next(new Y(n)), this.userSelection.add(n), this.diagramEvent$.next(new J([n], !0)), this.contextMenu.open(e);
3325
3684
  }
3326
3685
  }).on(S.DoubleClick, (e, t) => {
3327
- let n = new At(e, t);
3686
+ let n = new Lt(e, t);
3328
3687
  this.diagramEvent$.next(n);
3329
- }).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e, t) => {
3688
+ }).call(e.drag().filter((e) => (this.secondaryButton = Vt(e), !0)).on(w.Start, (e, t) => {
3330
3689
  if (this.multipleSelectionOn || this.secondaryButton) this.startMultipleSelection(e);
3331
3690
  else {
3332
3691
  let n;
3333
- t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.startMovingNode(e, n) : Z(A.NotAllowed);
3692
+ t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof U && (n = t.rootElement.node), n ? this.startMovingNode(e, n) : X(k.NotAllowed);
3334
3693
  }
3335
3694
  }).on(w.Drag, (e, t) => {
3336
3695
  if (this.multipleSelectionOn || this.secondaryButton) this.continueMultipleSelection(e);
3337
3696
  else {
3338
3697
  let n;
3339
- t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.continueMovingNode(e, n) : Z(A.NotAllowed);
3698
+ t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof U && (n = t.rootElement.node), n ? this.continueMovingNode(e, n) : X(k.NotAllowed);
3340
3699
  }
3341
3700
  }).on(w.End, (e, t) => {
3342
3701
  if (this.multipleSelectionOn || this.secondaryButton) this.finishMultipleSelection(e);
3343
3702
  else {
3344
3703
  let n;
3345
- t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.finishMovingNode(e, n) : Z();
3704
+ t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof U && (n = t.rootElement.node), n ? this.finishMovingNode(e, n) : X();
3346
3705
  }
3347
3706
  this.secondaryButton = !1;
3348
3707
  }));
@@ -3352,9 +3711,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3352
3711
  ...L,
3353
3712
  ...e.type.label
3354
3713
  };
3355
- if (n) {
3714
+ if (r.look = {
3715
+ ...L.look,
3716
+ ...r.look
3717
+ }, n) {
3356
3718
  let i = n.getTotalLength(), a = 0, o = 0, s = 0, c = 0, l = 0, u = 0;
3357
- if (r.backgroundColor === "transparent") {
3719
+ if (r.look.fillColor === "transparent") {
3358
3720
  let t = e.endCoords[0] - e.startCoords[0], n = e.endCoords[1] - e.startCoords[1];
3359
3721
  switch (e.startDirection) {
3360
3722
  case p.Top:
@@ -3388,10 +3750,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3388
3750
  }
3389
3751
  Math.abs(t) >= Math.abs(n) ? (s = t > 0 ? -.5 : .5, c = n > 0 ? .5 : -.5) : (s = t > 0 ? .5 : -.5, c = n > 0 ? -.5 : .5);
3390
3752
  }
3391
- t.select("g.diagram-connection-start-label text").attr("x", 0).attr("y", r.fontSize / 3).attr("text-anchor", "middle").attr("font-family", r.fontFamily).attr("font-size", r.fontSize).attr("fill", e.selected ? r.selectedColor : r.color).style("font-kerning", "none").text(e.startLabel);
3753
+ t.select("g.diagram-connection-start-label text").attr("x", 0).attr("y", (r.look.fontSize || L.look.fontSize) / 3).attr("text-anchor", "middle").attr("font-family", r.look.fontFamily || L.look.fontFamily).attr("font-size", r.look.fontSize || L.look.fontSize).attr("fill", r.look.fontColor || L.look.fontColor).text(e.startLabel);
3392
3754
  let d = t.select("g.diagram-connection-start-label text").node()?.getBoundingClientRect();
3393
3755
  if (d) {
3394
- let i = e.startLabel ? d.width / this.zoomTransform.k + ze(r) + Be(r) : 0, s = e.startLabel ? d.height / this.zoomTransform.k + Ve(r) + Re(r) : 0, c;
3756
+ let i = e.startLabel ? d.width / this.zoomTransform.k + Be(r) + Ve(r) : 0, s = e.startLabel ? d.height / this.zoomTransform.k + He(r) + ze(r) : 0, c;
3395
3757
  switch (e.startDirection) {
3396
3758
  case p.Left:
3397
3759
  c = n.getPointAtLength(B(r) + i / 2);
@@ -3407,18 +3769,18 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3407
3769
  break;
3408
3770
  default: c = n.getPointAtLength(Math.max(z(r) + i / 2, B(r) + i / 2, V(r) + s / 2, R(r) + s / 2));
3409
3771
  }
3410
- t.select("g.diagram-connection-start-label path").attr("d", de(-i / 2, -s / 2, i, s)).attr("fill", r.backgroundColor).attr("stroke", "none"), t.select("g.diagram-connection-start-label").attr("transform", `translate(${c.x + a * i},${c.y + o * s})`);
3772
+ t.select("g.diagram-connection-start-label path").attr("d", fe(-i / 2, -s / 2, i, s)).attr("fill", r.look.fillColor || L.look.fillColor).attr("stroke", "none"), t.select("g.diagram-connection-start-label").attr("transform", `translate(${c.x + a * i},${c.y + o * s})`);
3411
3773
  }
3412
- t.select("g.diagram-connection-middle-label text").attr("x", 0).attr("y", r.fontSize / 3).attr("text-anchor", "middle").attr("font-family", r.fontFamily).attr("font-size", r.fontSize).attr("fill", e.selected ? r.selectedColor : r.color).style("font-kerning", "none").text(e.middleLabel);
3774
+ t.select("g.diagram-connection-middle-label text").attr("x", 0).attr("y", (r.look.fontSize || L.look.fontSize) / 3).attr("text-anchor", "middle").attr("font-family", r.look.fontFamily || L.look.fontFamily).attr("font-size", r.look.fontSize || L.look.fontSize).attr("fill", r.look.fontColor || L.look.fillColor).style("font-kerning", "none").text(e.middleLabel);
3413
3775
  let f = t.select("g.diagram-connection-middle-label text").node()?.getBoundingClientRect();
3414
3776
  if (f) {
3415
- let a = e.middleLabel ? f.width / this.zoomTransform.k + ze(r) + Be(r) : 0, o = e.middleLabel ? f.height / this.zoomTransform.k + Ve(r) + Re(r) : 0, l = n.getPointAtLength(i / 2);
3416
- t.select("g.diagram-connection-middle-label path").attr("d", de(-a / 2, -o / 2, a, o)).attr("fill", r.backgroundColor).attr("stroke", "none"), t.select("g.diagram-connection-middle-label").attr("transform", `translate(${l.x + s * a},${l.y + c * o})`);
3777
+ let a = e.middleLabel ? f.width / this.zoomTransform.k + Be(r) + Ve(r) : 0, o = e.middleLabel ? f.height / this.zoomTransform.k + He(r) + ze(r) : 0, l = n.getPointAtLength(i / 2);
3778
+ t.select("g.diagram-connection-middle-label path").attr("d", fe(-a / 2, -o / 2, a, o)).attr("fill", r.look.fillColor || L.look.fillColor).attr("stroke", "none"), t.select("g.diagram-connection-middle-label").attr("transform", `translate(${l.x + s * a},${l.y + c * o})`);
3417
3779
  }
3418
- t.select("g.diagram-connection-end-label text").attr("x", 0).attr("y", r.fontSize / 3).attr("text-anchor", "middle").attr("font-family", r.fontFamily).attr("font-size", r.fontSize).attr("fill", e.selected ? r.selectedColor : r.color).style("font-kerning", "none").text(e.endLabel);
3780
+ t.select("g.diagram-connection-end-label text").attr("x", 0).attr("y", (r.look.fontSize || L.look.fontSize) / 3).attr("text-anchor", "middle").attr("font-family", r.look.fontFamily || L.look.fontFamily).attr("font-size", r.look.fontSize || L.look.fontSize).attr("fill", r.look.fontColor || L.look.fontColor).style("font-kerning", "none").text(e.endLabel);
3419
3781
  let m = t.select("g.diagram-connection-end-label text").node()?.getBoundingClientRect();
3420
3782
  if (m) {
3421
- let a = e.endLabel ? m.width / this.zoomTransform.k + ze(r) + Be(r) : 0, o = e.endLabel ? m.height / this.zoomTransform.k + Ve(r) + Re(r) : 0, s;
3783
+ let a = e.endLabel ? m.width / this.zoomTransform.k + Be(r) + Ve(r) : 0, o = e.endLabel ? m.height / this.zoomTransform.k + He(r) + ze(r) : 0, s;
3422
3784
  switch (e.endDirection) {
3423
3785
  case p.Left:
3424
3786
  s = n.getPointAtLength(i - (B(r) + a / 2));
@@ -3434,7 +3796,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3434
3796
  break;
3435
3797
  default: s = n.getPointAtLength(i - Math.max(z(r) + a / 2, B(r) + a / 2, V(r) + o / 2, R(r) + o / 2));
3436
3798
  }
3437
- t.select("g.diagram-connection-end-label path").attr("d", de(-a / 2, -o / 2, a, o)).attr("fill", r.backgroundColor).attr("stroke", "none"), t.select("g.diagram-connection-end-label").attr("transform", `translate(${s.x + l * a},${s.y + u * o})`);
3799
+ t.select("g.diagram-connection-end-label path").attr("d", fe(-a / 2, -o / 2, a, o)).attr("fill", r.look.fillColor || L.look.fillColor).attr("stroke", "none"), t.select("g.diagram-connection-end-label").attr("transform", `translate(${s.x + l * a},${s.y + u * o})`);
3438
3800
  }
3439
3801
  }
3440
3802
  }
@@ -3445,7 +3807,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3445
3807
  fieldRootFitsInView(e) {
3446
3808
  let t = this.model.fields.get(e);
3447
3809
  if (!t) return !1;
3448
- if (t.rootElement instanceof W || t.rootElement instanceof H) {
3810
+ if (t.rootElement instanceof W || t.rootElement instanceof U) {
3449
3811
  let e = this.minimumSizeOfField(t), n = e[0] + z(t.rootElement.type?.label) + B(t.rootElement.type?.label) - t.rootElement.width, r = e[1] + V(t.rootElement.type?.label) + R(t.rootElement.type?.label) - t.rootElement.height;
3450
3812
  return n <= 0 && r <= 0;
3451
3813
  }
@@ -3455,15 +3817,15 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3455
3817
  let n = this.model.fields.get(e);
3456
3818
  if (n) {
3457
3819
  if (n.rootElement instanceof W) {
3458
- let e = this.minimumSizeOfField(n), r = e[0] + z(n.rootElement.type.label) + B(n.rootElement.type.label) - n.rootElement.width, i = e[1] + V(n.rootElement.type.label) + R(n.rootElement.type.label) - n.rootElement.height;
3459
- this.snapToGrid && (r = Math.ceil(r / this.gridSize) * this.gridSize, i = Math.ceil(i / this.gridSize) * this.gridSize), n.rootElement.width + r < n.rootElement.type.minWidth && (r = n.rootElement.type.minWidth - n.rootElement.width), n.rootElement.height + i < n.rootElement.type.minHeight && (i = n.rootElement.type.minHeight - n.rootElement.height), (t !== !1 || r > 0) && n.rootElement.stretch(p.Right, r), (t !== !1 || i > 0) && n.rootElement.stretch(p.Bottom, i);
3820
+ let e = this.minimumSizeOfField(n), r = e[0] + z(n.rootElement.type.label) + B(n.rootElement.type.label) - n.rootElement.width, i = e[1] + V(n.rootElement.type.label) + R(n.rootElement.type.label) - n.rootElement.height, a = Z(this.gridConfig), o = Q(this.gridConfig);
3821
+ this.gridConfig.snap && a !== 0 && (r = Math.ceil(r / a) * a), this.gridConfig.snap && o !== 0 && (i = Math.ceil(i / o) * o), n.rootElement.width + r < n.rootElement.type.minWidth && (r = n.rootElement.type.minWidth - n.rootElement.width), n.rootElement.height + i < n.rootElement.type.minHeight && (i = n.rootElement.type.minHeight - n.rootElement.height), (t !== !1 || r > 0) && n.rootElement.stretch(p.Right, r), (t !== !1 || i > 0) && n.rootElement.stretch(p.Bottom, i);
3460
3822
  }
3461
- if (n.rootElement instanceof H) {
3823
+ if (n.rootElement instanceof U) {
3462
3824
  let e = this.minimumSizeOfField(n), r = e[0], i = e[1];
3463
3825
  for (let e of n.rootElement.node?.sections || []) e.label && (e.indexXInNode === n.rootElement.indexXInNode && e.indexYInNode !== n.rootElement.indexYInNode ? r = Math.max(r, this.minimumSizeOfField(e.label)[0]) : e.indexXInNode !== n.rootElement.indexXInNode && e.indexYInNode === n.rootElement.indexYInNode && (i = Math.max(i, this.minimumSizeOfField(e.label)[1])));
3464
3826
  e[0] < r && (e[0] = r), e[1] < i && (e[1] = i);
3465
- let a = n.rootElement.type, o = e[0] + z(a?.label) + B(a?.label) - n.rootElement.width, s = e[1] + V(a?.label) + R(a?.label) - n.rootElement.height;
3466
- this.snapToGrid && (o = Math.ceil(o / this.gridSize) * this.gridSize, s = Math.ceil(s / this.gridSize) * this.gridSize), n.rootElement.width + o < (n.rootElement.getMinWidth() || 0) && (o = (n.rootElement.getMinWidth() || 0) - n.rootElement.width), n.rootElement.height + s < (n.rootElement.getMinHeight() || 0) && (s = (n.rootElement.getMinHeight() || 0) - n.rootElement.height), (t || o > 0) && n.rootElement.node?.stretchSections(p.Right, o, n.rootElement.indexXInNode, n.rootElement.indexYInNode), (t || s > 0) && n.rootElement.node?.stretchSections(p.Bottom, s, n.rootElement.indexXInNode, n.rootElement.indexYInNode);
3827
+ let a = n.rootElement.type, o = e[0] + z(a?.label) + B(a?.label) - n.rootElement.width, s = e[1] + V(a?.label) + R(a?.label) - n.rootElement.height, c = Z(this.gridConfig), l = Q(this.gridConfig);
3828
+ this.gridConfig.snap && c !== 0 && (o = Math.ceil(o / c) * c), this.gridConfig.snap && l !== 0 && (s = Math.ceil(s / l) * l), n.rootElement.width + o < (n.rootElement.getMinWidth() || 0) && (o = (n.rootElement.getMinWidth() || 0) - n.rootElement.width), n.rootElement.height + s < (n.rootElement.getMinHeight() || 0) && (s = (n.rootElement.getMinHeight() || 0) - n.rootElement.height), (t || o > 0) && n.rootElement.node?.stretchSections(p.Right, o, n.rootElement.indexXInNode, n.rootElement.indexYInNode), (t || s > 0) && n.rootElement.node?.stretchSections(p.Bottom, s, n.rootElement.indexXInNode, n.rootElement.indexYInNode);
3467
3829
  }
3468
3830
  }
3469
3831
  }
@@ -3482,20 +3844,20 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3482
3844
  return e.select(this.diagramRoot);
3483
3845
  }
3484
3846
  selectSVGElement() {
3485
- return e.select(this.diagramRoot).select("svg");
3847
+ return this.selectRoot().select("svg");
3486
3848
  }
3487
3849
  selectCanvasView() {
3488
3850
  return this.selectSVGElement().select(".daga-canvas-view");
3489
3851
  }
3490
3852
  selectCanvasElements() {
3491
- return this.selectSVGElement().select(".daga-canvas-elements");
3853
+ return this.selectCanvasView().select(".daga-canvas-elements");
3492
3854
  }
3493
3855
  startConnection(e) {
3494
3856
  if (e.allowsOutgoing || e.allowsIncoming) {
3495
- if (this.connectionType && (this.connectionType.canStartFromType(e.getNode()?.type?.id || "") && e.allowsOutgoing || this.connectionType.canFinishOnType(e.getNode()?.type?.id || "") && e.allowsIncoming)) this.unfinishedConnection = new I(this.model, this.connectionType, e, void 0, rn), this.unfinishedConnectionPort = e;
3857
+ if (this.connectionType && (this.connectionType.canStartFromType(e.getNode()?.type?.id || "") && e.allowsOutgoing || this.connectionType.canFinishOnType(e.getNode()?.type?.id || "") && e.allowsIncoming)) this.unfinishedConnection = new F(this.model, this.connectionType, e, void 0, pn), this.unfinishedConnectionPort = e;
3496
3858
  else if (this.inferConnectionType) {
3497
3859
  let t = this.model.connections.types.all().find((t) => e.allowsOutgoing && t.canStartFromType(e.getNode()?.type?.id || ""));
3498
- t === void 0 && (t = this.model.connections.types.all().find((t) => e.allowsIncoming && t.canFinishOnType(e.getNode()?.type?.id || ""))), t !== void 0 && (this.unfinishedConnection = new I(this.model, t, e, void 0, rn), this.unfinishedConnectionPort = e);
3860
+ t === void 0 && (t = this.model.connections.types.all().find((t) => e.allowsIncoming && t.canFinishOnType(e.getNode()?.type?.id || ""))), t !== void 0 && (this.unfinishedConnection = new F(this.model, t, e, void 0, pn), this.unfinishedConnectionPort = e);
3499
3861
  }
3500
3862
  }
3501
3863
  }
@@ -3514,15 +3876,15 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3514
3876
  return;
3515
3877
  }
3516
3878
  if (this.unfinishedConnection.type.canStartFromType(this.unfinishedConnection?.start?.getNode()?.type?.id || "") && this.unfinishedConnection?.start?.allowsOutgoing && this.unfinishedConnection.type.canFinishOnType(e.getNode()?.type?.id || "") && e.allowsIncoming) {
3517
- let t = new St(this, this.unfinishedConnection.type, this.unfinishedConnection.start?.id, e.id);
3879
+ let t = new kt(this, this.unfinishedConnection.type, this.unfinishedConnection.start?.id, e.id);
3518
3880
  this.dropConnection(), t.do(), this.actionStack.add(t);
3519
3881
  } else if (this.unfinishedConnection.type.canFinishOnType(this.unfinishedConnection?.start?.getNode()?.type?.id || "") && this.unfinishedConnection?.start?.allowsIncoming && this.unfinishedConnection.type.canStartFromType(e.getNode()?.type?.id || "") && e.allowsOutgoing) {
3520
- let t = new St(this, this.unfinishedConnection.type, e.id, this.unfinishedConnection.start?.id);
3882
+ let t = new kt(this, this.unfinishedConnection.type, e.id, this.unfinishedConnection.start?.id);
3521
3883
  this.dropConnection(), t.do(), this.actionStack.add(t);
3522
3884
  } else if (this.inferConnectionType) {
3523
3885
  let t = this.model.connections.types.all().find((t) => t.canStartFromType(this.unfinishedConnection?.start?.getNode()?.type?.id || "") && this.unfinishedConnection?.start?.allowsOutgoing && t.canFinishOnType(e.getNode()?.type?.id || "") && e.allowsIncoming), n = !1;
3524
3886
  if (t === void 0 && (t = this.model.connections.types.all().find((t) => t.canFinishOnType(this.unfinishedConnection?.start?.getNode()?.type?.id || "") && this.unfinishedConnection?.start?.allowsIncoming && t.canStartFromType(e.getNode()?.type?.id || "") && e.allowsOutgoing), n = !0), t !== void 0) {
3525
- let r = new St(this, t, n ? e.id : this.unfinishedConnection.start?.id, n ? this.unfinishedConnection.start?.id : e.id);
3887
+ let r = new kt(this, t, n ? e.id : this.unfinishedConnection.start?.id, n ? this.unfinishedConnection.start?.id : e.id);
3526
3888
  this.dropConnection(), r.do(), this.actionStack.add(r);
3527
3889
  } else this.dropConnection();
3528
3890
  } else this.dropConnection();
@@ -3539,8 +3901,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3539
3901
  }
3540
3902
  openTextInput(e) {
3541
3903
  let t = this.model.fields.get(e);
3542
- t && this.createInputField(t.text, t.coords, t.width, t.height, t.fontSize, t.fontFamily || L.fontFamily, t.orientation, t.multiline, () => {}, (e) => {
3543
- t.text = e, this.currentAction instanceof Ct && (this.currentAction.to = e, this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0);
3904
+ t && this.createInputField(t.text, t.coords, t.width, t.height, t.look.fontSize || L.look.fontSize, t.look.fontFamily || L.look.fontFamily, t.orientation, t.multiline, () => {}, (e) => {
3905
+ t.text = e, this.currentAction instanceof At && (this.currentAction.to = e, this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0);
3544
3906
  });
3545
3907
  }
3546
3908
  createInputField(e, t, n, r, i, a, o, s, c, l) {
@@ -3555,11 +3917,11 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3555
3917
  }
3556
3918
  }).on(S.KeyUp, (e) => {
3557
3919
  e.stopPropagation();
3558
- }).on(S.Input, (e) => {
3559
- let t = d.property("value");
3560
- d.attr("cols", ge(t) + 1), d.attr("rows", _e(t) + 1), d.style("width", ""), d.style("height", ""), f = d.property("scrollWidth") + 1, p = d.property("scrollHeight") + 1;
3561
- let i = Math.max(f, n), a = Math.max(p, r);
3562
- u?.attr("width", `${i}px`), d.style("width", `${i}px`), u?.attr("height", `${a}px`), d.style("height", `${a}px`), c && c(t);
3920
+ }).on(S.Input, () => {
3921
+ let e = d.property("value");
3922
+ d.attr("cols", _e(e) + 1), d.attr("rows", ve(e) + 1), d.style("width", ""), d.style("height", ""), f = d.property("scrollWidth") + 1, p = d.property("scrollHeight") + 1;
3923
+ let t = Math.max(f, n), i = Math.max(p, r);
3924
+ u?.attr("width", `${t}px`), d.style("width", `${t}px`), u?.attr("height", `${i}px`), d.style("height", `${i}px`), c && c(e);
3563
3925
  }).on(S.Click, (e) => {
3564
3926
  e.stopPropagation();
3565
3927
  }).on(S.FocusOut, () => {
@@ -3593,33 +3955,33 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3593
3955
  setFieldText(e, t, n) {
3594
3956
  let r = n.split("\n");
3595
3957
  t.html("");
3596
- for (let n = 0; n < r.length; ++n) t.append("tspan").attr("x", e.horizontalAlign === h.Center ? e.width / 2 : e.horizontalAlign === h.Right ? e.width : 0).attr("y", e.verticalAlign === g.Center ? (n + .5 - r.length / 2) * e.fontSize + e.height / 2 : e.verticalAlign === g.Bottom ? e.height - (r.length - n - 1) * e.fontSize : n * e.fontSize).text(r[n]);
3958
+ for (let n = 0; n < r.length; ++n) t.append("tspan").attr("x", e.horizontalAlign === h.Center ? e.width / 2 : e.horizontalAlign === h.Right ? e.width : 0).attr("y", e.verticalAlign === g.Center ? (n + .5 - r.length / 2) * (e.look.fontSize || L.look.fontSize) + e.height / 2 : e.verticalAlign === g.Bottom ? e.height - (r.length - n - 1) * (e.look.fontSize || L.look.fontSize) : n * (e.look.fontSize || L.look.fontSize)).text(r[n]);
3597
3959
  }
3598
3960
  startMovingNode(e, t) {
3599
- if (this.canUserPerformAction(q.MoveNode) && !t.removed) if (Z(A.Grabbing), this.draggingFrom = [e.x, e.y], t.selected && this.userSelection.count((e) => e instanceof W) > 1) this.currentAction = new bt(this, this.userSelection.filter((e) => e instanceof W).map((e) => e.id), t.coords);
3961
+ if (this.canUserPerformAction(K.MoveNode) && !t.removed) if (X(k.Grabbing), this.draggingFrom = [e.x, e.y], t.selected && this.userSelection.count((e) => e instanceof W) > 1) this.currentAction = new Dt(this, this.userSelection.filter((e) => e instanceof W).map((e) => e.id), t.coords);
3600
3962
  else {
3601
3963
  let e = t.getLastAncestor();
3602
- this.currentAction = new J(this, q.MoveNode, t.id, t.getGeometry(), t.getGeometry(), e?.id, e?.getGeometry(t.id), e?.getGeometry(t.id));
3964
+ this.currentAction = new q(this, K.MoveNode, t.id, t.getGeometry(), t.getGeometry(), e?.id, e?.getGeometry(t.id), e?.getGeometry(t.id));
3603
3965
  }
3604
- else Z(A.NotAllowed);
3966
+ else X(k.NotAllowed);
3605
3967
  }
3606
3968
  continueMovingNode(e, t) {
3607
- if (this.canUserPerformAction(q.MoveNode) && (this.currentAction instanceof bt || this.currentAction instanceof J) && !t.removed) {
3969
+ if (this.canUserPerformAction(K.MoveNode) && (this.currentAction instanceof Dt || this.currentAction instanceof q) && !t.removed) {
3608
3970
  let n = [e.x - t.width / 2, e.y - t.height / 2];
3609
- t.selected ? this.userSelection.move([n[0] - t.coords[0], n[1] - t.coords[1]]) : t.move(n), this.userHighlight.clear(), this.dragging = !0, this.diagramEvent$.next(new Mt(t));
3971
+ t.selected ? this.userSelection.move([n[0] - t.coords[0], n[1] - t.coords[1]]) : t.move(n), this.userHighlight.clear(), this.dragging = !0, this.diagramEvent$.next(new zt(t));
3610
3972
  }
3611
3973
  }
3612
3974
  finishMovingNode(e, t) {
3613
- if (this.canUserPerformAction(q.MoveNode) && !t.removed && (this.draggingFrom[0] !== e.x || this.draggingFrom[1] !== e.y)) {
3975
+ if (this.canUserPerformAction(K.MoveNode) && !t.removed && (this.draggingFrom[0] !== e.x || this.draggingFrom[1] !== e.y)) {
3614
3976
  let n = [e.x - t.width / 2, e.y - t.height / 2];
3615
- if (this.snapToGrid && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), this.currentAction instanceof bt) {
3977
+ if (this.gridConfig?.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), this.currentAction instanceof Dt) {
3616
3978
  let e = this.currentAction.delta;
3617
3979
  this.currentAction.delta = [n[0] - e[0], n[1] - e[1]], t.selected ? this.userSelection.move([e[0] - t.coords[0], e[1] - t.coords[1]]) : t.move(e);
3618
- } else if (this.currentAction instanceof J) {
3980
+ } else if (this.currentAction instanceof q) {
3619
3981
  t.move(n);
3620
- let r = Ye(this.model.nodes.getAtCoordinates(e.x, e.y).filter((e) => e.id !== t.id && !e.isDescendantOf(t)).filter((e) => e.type.childrenTypes.includes(t.type.id))), i = r[r.length - 1];
3982
+ let r = Qe(this.model.nodes.getAtCoordinates(e.x, e.y).filter((e) => e.id !== t.id && !e.isDescendantOf(t)).filter((e) => e.type.childrenTypes.includes(t.type.id))), i = r[r.length - 1];
3621
3983
  if (i !== t.parent && (t.type.canBeParentless || i !== void 0)) {
3622
- let e = i?.getLastAncestor(), n = this.currentAction.from, r = new xt(this, t.id, t.parent?.id, i?.id, n, t.getGeometry(), e?.id, e?.getGeometry(t.id), e?.getGeometry(t.id));
3984
+ let e = i?.getLastAncestor(), n = this.currentAction.from, r = new Ot(this, t.id, t.parent?.id, i?.id, n, t.getGeometry(), e?.id, e?.getGeometry(t.id), e?.getGeometry(t.id));
3623
3985
  t.parent?.removeChild(t), i !== void 0 && i.addChild(t), r.toChildGeometry = t.getGeometry(t.id), r.toAncestorGeometry = e?.getGeometry(t.id), this.currentAction = r;
3624
3986
  } else {
3625
3987
  let e = t?.getLastAncestor();
@@ -3628,22 +3990,22 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3628
3990
  }
3629
3991
  this.currentAction !== void 0 && (this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0);
3630
3992
  }
3631
- Z(), this.dragging = !1;
3993
+ X(), this.dragging = !1;
3632
3994
  }
3633
3995
  startMultipleSelection(e) {
3634
3996
  this.draggingFrom = this.getPointerLocationRelativeToCanvas(e), this.multipleSelectionContainer = this.selectSVGElement().append("rect").attr("stroke", "#0E74B6").attr("fill", "rgba(14, 116, 182, 0.06)");
3635
3997
  }
3636
3998
  continueMultipleSelection(e) {
3637
3999
  let t = this.getPointerLocationRelativeToCanvas(e);
3638
- (this.draggingFrom[0] !== t[0] || this.draggingFrom[1] !== t[1]) && (Z(A.Crosshair), this.multipleSelectionContainer?.attr("x", Math.min(this.draggingFrom[0], t[0]) * this.zoomTransform.k + this.zoomTransform.x)?.attr("y", Math.min(this.draggingFrom[1], t[1]) * this.zoomTransform.k + this.zoomTransform.y)?.attr("width", Math.abs(this.draggingFrom[0] - t[0]) * this.zoomTransform.k)?.attr("height", Math.abs(this.draggingFrom[1] - t[1]) * this.zoomTransform.k), this.dragging = !0);
4000
+ (this.draggingFrom[0] !== t[0] || this.draggingFrom[1] !== t[1]) && (X(k.Crosshair), this.multipleSelectionContainer?.attr("x", Math.min(this.draggingFrom[0], t[0]) * this.zoomTransform.k + this.zoomTransform.x)?.attr("y", Math.min(this.draggingFrom[1], t[1]) * this.zoomTransform.k + this.zoomTransform.y)?.attr("width", Math.abs(this.draggingFrom[0] - t[0]) * this.zoomTransform.k)?.attr("height", Math.abs(this.draggingFrom[1] - t[1]) * this.zoomTransform.k), this.dragging = !0);
3639
4001
  }
3640
4002
  finishMultipleSelection(e) {
3641
4003
  let t = this.getPointerLocationRelativeToCanvas(e);
3642
4004
  this.multipleSelectionContainer?.remove(), this.multipleSelectionContainer = void 0, this.userSelection.clear();
3643
4005
  for (let e of this.model.nodes) ee([e.coords, [e.coords[0] + e.width, e.coords[1] + e.height]], [this.draggingFrom, t]) && this.userSelection.add(e);
3644
- this.multipleSelectionOn = !1, this.diagramEvent$.next(new Y(this.userSelection.all(), !0)), Z();
4006
+ this.multipleSelectionOn = !1, this.diagramEvent$.next(new J(this.userSelection.all(), !0)), X();
3645
4007
  }
3646
- }, on = class {
4008
+ }, hn = class {
3647
4009
  constructor() {
3648
4010
  this.grid = [[void 0]], this.offsetX = 0, this.offsetY = 0;
3649
4011
  }
@@ -3701,32 +4063,32 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3701
4063
  for (let e = t[1]; e !== i[1] + r; e += r) if (t[1] = e, this.get(t) === void 0) return t;
3702
4064
  }
3703
4065
  }
3704
- }, sn = class {
4066
+ }, gn = class {
3705
4067
  constructor(e) {
3706
4068
  this.gapSize = e;
3707
4069
  }
3708
4070
  apply(e) {
3709
4071
  if (e.nodes.length === 0) return e;
3710
- let t = new on(), n = e.nodes.filter((e) => !e.parent);
3711
- for (; n.length > 0;) cn(n[0], t, [0, 0], n);
3712
- let r = Math.max(...e.nodes.map((e) => e.width)), i = Math.max(...e.nodes.map((e) => e.height)), a = this.gapSize === void 0 ? (e.canvas?.gridSize || 0) * 2 : this.gapSize;
4072
+ let t = new hn(), n = e.nodes.filter((e) => !e.parent);
4073
+ for (; n.length > 0;) _n(n[0], t, [0, 0], n);
4074
+ let r = Math.max(...e.nodes.map((e) => e.width)), i = Math.max(...e.nodes.map((e) => e.height)), a = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, o = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize;
3713
4075
  for (let e = t.minY(); e <= t.maxY(); ++e) for (let n = t.minX(); n <= t.maxX(); ++n) {
3714
- let o = t.get([n, e]);
3715
- o !== void 0 && o.move([n * (r + a), e * (i + a)]);
4076
+ let s = t.get([n, e]);
4077
+ s !== void 0 && s.move([n * (r + a), e * (i + o)]);
3716
4078
  }
3717
4079
  return e;
3718
4080
  }
3719
- }, cn = (e, t, n, r) => {
4081
+ }, _n = (e, t, n, r) => {
3720
4082
  let i = t.getClosestEmptyCoordinate(n);
3721
4083
  t.set(i, e), O(r, e);
3722
- for (let n of e.getAdjacentNodes()) r.includes(n) && cn(n, t, i, r);
3723
- }, ln = class {
4084
+ for (let n of e.getAdjacentNodes()) r.includes(n) && _n(n, t, i, r);
4085
+ }, vn = class {
3724
4086
  constructor(e) {
3725
4087
  this.gapSize = e;
3726
4088
  }
3727
4089
  apply(e) {
3728
4090
  if (e.nodes.length === 0) return e;
3729
- let t = new on(), n = e.nodes.filter((e) => !e.parent), r = {}, i = n[0], a = [i];
4091
+ let t = new hn(), n = e.nodes.filter((e) => !e.parent), r = {}, i = n[0], a = [i];
3730
4092
  for (r[i.id] = [0, 0]; n.length > 0;) {
3731
4093
  let e = [];
3732
4094
  for (let i of a) {
@@ -3740,179 +4102,177 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3740
4102
  a = [e], r[e.id] = t.getClosestEmptyCoordinate([0, 0]);
3741
4103
  }
3742
4104
  }
3743
- let o = Math.max(...e.nodes.map((e) => e.width)), s = Math.max(...e.nodes.map((e) => e.height)), c = this.gapSize === void 0 ? (e.canvas?.gridSize || 0) * 2 : this.gapSize;
4105
+ let o = Math.max(...e.nodes.map((e) => e.width)), s = Math.max(...e.nodes.map((e) => e.height)), c = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, l = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize;
3744
4106
  for (let e = t.minY(); e <= t.maxY(); ++e) for (let n = t.minX(); n <= t.maxX(); ++n) {
3745
4107
  let r = t.get([n, e]);
3746
- r !== void 0 && r.move([n * (o + c), e * (s + c)]);
4108
+ r !== void 0 && r.move([n * (o + c), e * (s + l)]);
3747
4109
  }
3748
4110
  return e;
3749
4111
  }
3750
- }, un = class {
4112
+ }, yn = class {
3751
4113
  constructor(e) {
3752
4114
  this.gapSize = e;
3753
4115
  }
3754
4116
  apply(e) {
3755
4117
  if (e.nodes.length === 0) return e;
3756
- let t = this.gapSize === void 0 ? (e.canvas?.gridSize || 0) * 2 : this.gapSize, n = e.nodes.filter((e) => !e.parent), r = n[0];
3757
- O(n, r);
3758
- let i = [[r]];
3759
- for (; n.length > 0;) {
3760
- let e = i[i.length - 1], t = [];
3761
- for (let r of e) {
3762
- let e = r.getAdjacentNodes();
3763
- for (let r of e) n.includes(r) && (O(n, r), t.push(r));
4118
+ let t = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, n = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, r = e.nodes.filter((e) => !e.parent), i = r[0];
4119
+ O(r, i);
4120
+ let a = [[i]];
4121
+ for (; r.length > 0;) {
4122
+ let e = a[a.length - 1], t = [];
4123
+ for (let n of e) {
4124
+ let e = n.getAdjacentNodes();
4125
+ for (let n of e) r.includes(n) && (O(r, n), t.push(n));
3764
4126
  }
3765
- t.length > 0 ? i.push(t) : (i.push(n), n = []);
4127
+ t.length > 0 ? a.push(t) : (a.push(r), r = []);
3766
4128
  }
3767
- let a = 0;
3768
- for (let e of i) {
3769
- let n = 0;
3770
- for (let r of e) r.move([a, n]), n += t + r.height;
3771
- let r = Math.max(...e.map((e) => e.width));
3772
- a += t + r;
4129
+ let o = 0;
4130
+ for (let e of a) {
4131
+ let r = 0;
4132
+ for (let t of e) t.move([o, r]), r += n + t.height;
4133
+ let i = Math.max(...e.map((e) => e.width));
4134
+ o += t + i;
3773
4135
  }
3774
4136
  for (let t of e.connections) t.tighten();
3775
4137
  return e;
3776
4138
  }
3777
- }, dn = class {
4139
+ }, bn = class {
3778
4140
  constructor(e) {
3779
4141
  this.gapSize = e;
3780
4142
  }
3781
4143
  apply(e) {
3782
4144
  if (e.nodes.length === 0) return e;
3783
- new un(this.gapSize).apply(e);
3784
- let t = this.gapSize === void 0 ? (e.canvas?.gridSize || 0) * 2 : this.gapSize, n = .1, r = .5, i = .002, a = 100;
3785
- for (; a > 1;) {
3786
- a *= .99;
3787
- let o = [0, 0];
3788
- if (i > 0) {
3789
- for (let t of e.nodes) o[0] = o[0] + t.coords[0] + t.width / 2, o[1] = o[1] + t.coords[1] + t.width / 2;
3790
- o[0] /= e.nodes.length, o[1] /= e.nodes.length;
3791
- }
3792
- for (let s of e.nodes) {
3793
- let c = s.getAdjacentNodes();
4145
+ new yn(this.gapSize).apply(e);
4146
+ let t = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, n = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, r = Math.max(t, n), i = .1, a = .5, o = .002, s = 100;
4147
+ for (; s > 1;) {
4148
+ s *= .99;
4149
+ let t = [0, 0];
4150
+ for (let n of e.nodes) t[0] = t[0] + n.coords[0] + n.width / 2, t[1] = t[1] + n.coords[1] + n.width / 2;
4151
+ t[0] /= e.nodes.length, t[1] /= e.nodes.length;
4152
+ for (let n of e.nodes) {
4153
+ let c = n.getAdjacentNodes();
3794
4154
  for (let l of e.nodes) {
3795
- let e = [s.coords[0] + s.width / 2, s.coords[1] + s.height / 2], u = [l.coords[0] + l.width / 2, l.coords[1] + l.height / 2], d = x(s.coords, l.coords), f = [l.coords[0], l.coords[1]];
3796
- if (c.includes(l) && d > 0 && (d > t + (Math.max(s.width, s.height) + Math.max(l.width, l.height)) / 2 ? (f[0] -= (u[0] - e[0]) * n, f[1] -= (u[1] - e[1]) * n) : (f[0] += (u[0] - e[0]) * r, f[1] += (u[1] - e[1]) * r)), d > 0) {
4155
+ let e = [n.coords[0] + n.width / 2, n.coords[1] + n.height / 2], u = [l.coords[0] + l.width / 2, l.coords[1] + l.height / 2], d = x(n.coords, l.coords), f = [l.coords[0], l.coords[1]];
4156
+ if (c.includes(l) && d > 0 && (d > r + (Math.max(n.width, n.height) + Math.max(l.width, l.height)) / 2 ? (f[0] -= (u[0] - e[0]) * i, f[1] -= (u[1] - e[1]) * i) : (f[0] += (u[0] - e[0]) * a, f[1] += (u[1] - e[1]) * a)), d > 0) {
3797
4157
  let t = 2e5 / (d * d);
3798
4158
  f[0] += t * (u[0] - e[0]) / d, f[1] += t * (u[1] - e[1]) / d;
3799
4159
  } else f[0] += 1 * (Math.random() * 2 - 1), f[1] += 1 * (Math.random() * 2 - 1);
3800
- i > 0 && (f[0] -= (u[0] - o[0]) * i, f[1] -= (u[1] - o[1]) * i), f[0] - l.coords[0] > a ? f[0] = l.coords[0] + a : f[0] - l.coords[0] < -a && (f[0] = l.coords[0] - a), f[1] - l.coords[1] > a ? f[1] = l.coords[1] + a : f[1] - l.coords[1] < -a && (f[1] = l.coords[1] - a), l.move(f);
4160
+ f[0] -= (u[0] - t[0]) * o, f[1] -= (u[1] - t[1]) * o, f[0] - l.coords[0] > s ? f[0] = l.coords[0] + s : f[0] - l.coords[0] < -s && (f[0] = l.coords[0] - s), f[1] - l.coords[1] > s ? f[1] = l.coords[1] + s : f[1] - l.coords[1] < -s && (f[1] = l.coords[1] - s), l.move(f);
3801
4161
  }
3802
4162
  }
3803
4163
  }
3804
- if (e.canvas && e.canvas.snapToGrid) for (let t of e.nodes) {
4164
+ if (e.canvas && e.canvas.gridConfig.snap) for (let t of e.nodes) {
3805
4165
  let n = e.canvas.getClosestGridPoint([t.coords[0] - t.type.snapToGridOffset[0], t.coords[1] - t.type.snapToGridOffset[1]]);
3806
4166
  n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1], t.move(n);
3807
4167
  }
3808
4168
  for (let t of e.connections) t.tighten();
3809
4169
  return e;
3810
4170
  }
3811
- }, fn = class {
4171
+ }, xn = class {
3812
4172
  constructor(e) {
3813
4173
  this.gapSize = e;
3814
4174
  }
3815
4175
  apply(e) {
3816
4176
  if (e.nodes.length === 0) return e;
3817
- let t = this.gapSize === void 0 ? (e.canvas?.gridSize || 0) * 2 : this.gapSize, n = e.nodes.filter((e) => !e.parent);
4177
+ let t = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, n = e.nodes.filter((e) => !e.parent);
3818
4178
  n.sort((e, t) => t.type.priority - e.type.priority);
3819
4179
  let r = 0;
3820
4180
  for (let e of n) e.move([r, 0]), r += e.width + t;
3821
4181
  return e;
3822
4182
  }
3823
- }, pn = class {
4183
+ }, Sn = class {
3824
4184
  constructor(e) {
3825
4185
  this.gapSize = e;
3826
4186
  }
3827
4187
  apply(e) {
3828
4188
  if (e.nodes.length === 0) return e;
3829
4189
  let t = Math.max(...e.nodes.map((e) => e.getPriority()));
3830
- if (t === Math.min(...e.nodes.map((e) => e.getPriority()))) return new un(this.gapSize).apply(e), e;
3831
- let n = this.gapSize === void 0 ? (e.canvas?.gridSize || 0) * 2 : this.gapSize, r = e.nodes.filter((e) => !e.parent), i = [], a = e.nodes.filter((e) => !e.parent).filter((e) => e.getPriority() >= t), o = [];
3832
- if (a.length > 1) {
3833
- let e = a[0];
3834
- a.splice(0, 1), o.push(e);
4190
+ if (t === Math.min(...e.nodes.map((e) => e.getPriority()))) return new yn(this.gapSize).apply(e), e;
4191
+ let n = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, r = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, i = e.nodes.filter((e) => !e.parent), a = [], o = e.nodes.filter((e) => !e.parent).filter((e) => e.getPriority() >= t), s = [];
4192
+ if (o.length > 1) {
4193
+ let e = o[0];
4194
+ o.splice(0, 1), s.push(e);
3835
4195
  let t = [e], n = [e];
3836
4196
  for (; t.length > 0;) {
3837
4197
  let e = t[0];
3838
- t.splice(0, 1), a.includes(e) && (o.push(e), O(a, e));
4198
+ t.splice(0, 1), o.includes(e) && (s.push(e), O(o, e));
3839
4199
  let r = e.getAdjacentNodes();
3840
4200
  for (let e of r) n.includes(e) || (t.push(e), n.push(e));
3841
4201
  }
3842
- for (let e of a) o.push(e);
3843
- } else o.push(a[0]);
3844
- for (let e of o) O(r, e), i.push([e]);
3845
- for (i.push([]), r.sort((e, t) => t.type.priority - e.type.priority); r.length > 0;) {
3846
- let e = r[0];
3847
- r.splice(0, 1);
3848
- let t = [e], n = [e], a = !1;
4202
+ for (let e of o) s.push(e);
4203
+ } else s.push(o[0]);
4204
+ for (let e of s) O(i, e), a.push([e]);
4205
+ for (a.push([]), i.sort((e, t) => t.type.priority - e.type.priority); i.length > 0;) {
4206
+ let e = i[0];
4207
+ i.splice(0, 1);
4208
+ let t = [e], n = [e], r = !1;
3849
4209
  for (; t.length > 0;) {
3850
- let r = t[0];
4210
+ let i = t[0];
3851
4211
  t.splice(0, 1);
3852
- let s = o.indexOf(r);
3853
- if (s >= 0) {
3854
- i[s].push(e), a = !0;
4212
+ let o = s.indexOf(i);
4213
+ if (o >= 0) {
4214
+ a[o].push(e), r = !0;
3855
4215
  break;
3856
4216
  } else {
3857
- let e = r.getAdjacentNodes();
4217
+ let e = i.getAdjacentNodes();
3858
4218
  for (let r of e) n.includes(r) || (t.push(r), n.push(r));
3859
4219
  }
3860
4220
  }
3861
- a || i[i.length - 1].push(e);
4221
+ r || a[a.length - 1].push(e);
3862
4222
  }
3863
- let s = 0;
3864
- for (let e = 0; e < i.length; ++e) {
4223
+ let c = 0;
4224
+ for (let e = 0; e < a.length; ++e) {
3865
4225
  let t = 0;
3866
- for (let r = 0; r < i[e].length; ++r) {
3867
- let a = i[e][r];
3868
- a.move([s, t]), t += n + a.height;
4226
+ for (let n = 0; n < a[e].length; ++n) {
4227
+ let i = a[e][n];
4228
+ i.move([c, t]), t += r + i.height;
3869
4229
  }
3870
- let r = Math.max(...i[e].map((e) => e.width));
3871
- s += n + r;
4230
+ let i = Math.max(...a[e].map((e) => e.width));
4231
+ c += n + i;
3872
4232
  }
3873
4233
  for (let t of e.connections) t.tighten();
3874
4234
  return e;
3875
4235
  }
3876
- }, mn = class {
4236
+ }, Cn = class {
3877
4237
  constructor(e) {
3878
4238
  this.gapSize = e;
3879
4239
  }
3880
4240
  apply(e) {
3881
4241
  if (e.nodes.length === 0) return e;
3882
- if (Math.max(...e.nodes.map((e) => e.getPriority())) === Math.min(...e.nodes.map((e) => e.getPriority()))) return new un(this.gapSize).apply(e), e;
3883
- let t = this.gapSize === void 0 ? (e.canvas?.gridSize || 0) * 2 : this.gapSize, n = e.nodes.filter((e) => !e.parent).sort((e, t) => t.getPriority() - e.getPriority()), r = [];
3884
- for (; n.length > 0;) {
3885
- let e = n[0];
3886
- n.splice(0, 1);
3887
- let t = new _n(void 0, e);
3888
- hn(t, n), r.push(t);
4242
+ if (Math.max(...e.nodes.map((e) => e.getPriority())) === Math.min(...e.nodes.map((e) => e.getPriority()))) return new yn(this.gapSize).apply(e), e;
4243
+ let t = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, n = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, r = e.nodes.filter((e) => !e.parent).sort((e, t) => t.getPriority() - e.getPriority()), i = [];
4244
+ for (; r.length > 0;) {
4245
+ let e = r[0];
4246
+ r.splice(0, 1);
4247
+ let t = new En(void 0, e);
4248
+ wn(t, r), i.push(t);
3889
4249
  }
3890
- let i = [];
3891
- for (let e of r) i.push([e]), gn(e, i, i.length);
3892
- let a = Math.max(...e.nodes.map((e) => e.height)), o = 0;
3893
- for (let e = 0; e < i.length; ++e) {
3894
- let n = 0;
3895
- for (let r = 0; r < i[e].length; ++r) {
3896
- let s = i[e][r];
3897
- s.node.move([o, n]), n += (t + a) * s.countBranchHeight();
4250
+ let a = [];
4251
+ for (let e of i) a.push([e]), Tn(e, a, a.length);
4252
+ let o = Math.max(...e.nodes.map((e) => e.height)), s = 0;
4253
+ for (let e = 0; e < a.length; ++e) {
4254
+ let r = 0;
4255
+ for (let t = 0; t < a[e].length; ++t) {
4256
+ let i = a[e][t];
4257
+ i.node.move([s, r]), r += (n + o) * i.countBranchHeight();
3898
4258
  }
3899
- let r = Math.max(...i[e].map((e) => e.node.width));
3900
- o += t + r;
4259
+ let i = Math.max(...a[e].map((e) => e.node.width));
4260
+ s += t + i;
3901
4261
  }
3902
4262
  for (let t of e.connections) t.tighten();
3903
4263
  return e;
3904
4264
  }
3905
- }, hn = (e, t) => {
4265
+ }, wn = (e, t) => {
3906
4266
  for (let n of e.node.getAdjacentNodes().sort((e, t) => t.getPriority() - e.getPriority())) {
3907
4267
  let r = t.indexOf(n);
3908
- r >= 0 && (t.splice(r, 1), hn(e.addBranch(n), t));
4268
+ r >= 0 && (t.splice(r, 1), wn(e.addBranch(n), t));
3909
4269
  }
3910
- }, gn = (e, t, n) => {
4270
+ }, Tn = (e, t, n) => {
3911
4271
  if (e.branches.length > 0) {
3912
4272
  for (; n >= t.length;) t.push([]);
3913
- for (let r of e.branches) t[n].push(r), gn(r, t, n + 1);
4273
+ for (let r of e.branches) t[n].push(r), Tn(r, t, n + 1);
3914
4274
  }
3915
- }, _n = class e {
4275
+ }, En = class e {
3916
4276
  constructor(e, t) {
3917
4277
  this.parent = e, this.branches = [], this.depth = 0, this.node = t;
3918
4278
  }
@@ -3928,28 +4288,28 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3928
4288
  return e;
3929
4289
  }
3930
4290
  }
3931
- }, vn = class {
4291
+ }, Dn = class {
3932
4292
  constructor(e) {
3933
4293
  this.gapSize = e;
3934
4294
  }
3935
4295
  apply(e) {
3936
4296
  if (e.nodes.length === 0) return e;
3937
- let t = this.gapSize === void 0 ? (e.canvas?.gridSize || 0) * 2 : this.gapSize, n = e.nodes.filter((e) => !e.parent);
4297
+ let t = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, n = e.nodes.filter((e) => !e.parent);
3938
4298
  n.sort((e, t) => t.type.priority - e.type.priority);
3939
4299
  let r = 0;
3940
4300
  for (let e of n) e.move([0, r]), r += e.height + t;
3941
4301
  return e;
3942
4302
  }
3943
- }, yn = {
3944
- adjacency: new sn(),
3945
- breadth: new un(),
3946
- "breadth-adjacency": new ln(),
3947
- force: new dn(),
3948
- horizontal: new fn(),
3949
- priority: new pn(),
3950
- tree: new mn(),
3951
- vertical: new vn()
3952
- }, bn = a({}), xn = a({}), Sn = class {
4303
+ }, On = {
4304
+ adjacency: new gn(),
4305
+ breadth: new yn(),
4306
+ "breadth-adjacency": new vn(),
4307
+ force: new bn(),
4308
+ horizontal: new xn(),
4309
+ priority: new Sn(),
4310
+ tree: new Cn(),
4311
+ vertical: new Dn()
4312
+ }, kn = a({}), An = a({}), jn = class {
3953
4313
  constructor(e, t) {
3954
4314
  this.onTitleChange = e, this.onValueSetChange = t;
3955
4315
  }
@@ -3966,35 +4326,38 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
3966
4326
  this._valueSet = e, this.onValueSetChange(e);
3967
4327
  }
3968
4328
  highlightProperty(...e) {}
3969
- }, Cn = ({ direction: t, collapsableSelector: n, collapsableAdditionalSelector: r, collapsed: i, disabled: a, rule: o, collapsedValue: s, visibleValue: c, onCollapse: u }) => {
3970
- let [f, m] = l(i);
3971
- return /* @__PURE__ */ d("daga-collapse-button", { children: /* @__PURE__ */ d("button", {
4329
+ }, Mn = ({ direction: t, collapsableSelector: n, collapsableAdditionalSelector: r, collapsed: i, disabled: a, rule: o, collapsedValue: c, visibleValue: u, onCollapse: f }) => {
4330
+ let [m, h] = l(i), g = (t) => {
4331
+ let i;
4332
+ if (typeof n == "string") i = e.select(n), r && (i = i.select(r));
4333
+ else {
4334
+ let t = n;
4335
+ if (!t) throw Error("collapsableSelector is not a valid ref");
4336
+ i = e.select(t.current), r && (i = i.select(r));
4337
+ }
4338
+ i.style(o, t ? c : u);
4339
+ };
4340
+ return s(() => {
4341
+ g(m);
4342
+ }, [g, m]), /* @__PURE__ */ d("daga-collapse-button", { children: /* @__PURE__ */ d("button", {
3972
4343
  className: `daga-collapse-button daga-${t}`,
3973
4344
  onClick: () => {
3974
4345
  if (!a) {
3975
- let t = !f;
3976
- m(t), u?.(t);
3977
- let i;
3978
- if (typeof n == "string") i = e.select(n), r && (i = i.select(r));
3979
- else {
3980
- let t = n;
3981
- if (!t) throw Error("collapsableSelector is not a valid ref");
3982
- i = e.select(t.current), r && (i = i.select(r));
3983
- }
3984
- i.style(o, t ? s : c);
4346
+ let e = !m;
4347
+ h(e), f?.(e), g(e);
3985
4348
  }
3986
4349
  },
3987
4350
  children: /* @__PURE__ */ d("div", { className: (() => {
3988
4351
  switch (t) {
3989
- case p.Right: return a ? "daga-horizontal-none" : f ? "daga-horizontal-right" : "daga-horizontal-left";
3990
- case p.Bottom: return a ? "daga-vertical-none" : f ? "daga-vertical-down" : "daga-vertical-up";
3991
- case p.Left: return a ? "daga-horizontal-none" : f ? "daga-horizontal-left" : "daga-horizontal-right";
3992
- case p.Top: return a ? "daga-vertical-none" : f ? "daga-vertical-up" : "daga-vertical-down";
4352
+ case p.Right: return a ? "daga-horizontal-none" : m ? "daga-horizontal-right" : "daga-horizontal-left";
4353
+ case p.Bottom: return a ? "daga-vertical-none" : m ? "daga-vertical-down" : "daga-vertical-up";
4354
+ case p.Left: return a ? "daga-horizontal-none" : m ? "daga-horizontal-left" : "daga-horizontal-right";
4355
+ case p.Top: return a ? "daga-vertical-none" : m ? "daga-vertical-up" : "daga-vertical-down";
3993
4356
  }
3994
4357
  })() })
3995
4358
  }) });
3996
- }, wn = () => {
3997
- let e = o(xn), t = c(null), [n, a] = l([]);
4359
+ }, Nn = () => {
4360
+ let e = o(An), t = c(null), [n, a] = l([]);
3998
4361
  i(e.validatorChange$, e.diagramChange$).pipe(r(() => s())).subscribe();
3999
4362
  let s = () => {
4000
4363
  a([]);
@@ -4021,7 +4384,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4021
4384
  className: "daga-errors-summary daga-with-errors daga-prevent-user-select",
4022
4385
  children: [/* @__PURE__ */ f("span", { children: [n.length, " errors found"] }), /* @__PURE__ */ d("div", {
4023
4386
  className: "daga-collapse-button-container",
4024
- children: /* @__PURE__ */ d(Cn, {
4387
+ children: /* @__PURE__ */ d(Mn, {
4025
4388
  collapsableSelector: t,
4026
4389
  collapsableAdditionalSelector: ".daga-error-panel",
4027
4390
  direction: p.Top,
@@ -4042,10 +4405,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4042
4405
  })
4043
4406
  ]
4044
4407
  }) });
4045
- }, Tn = 200, En = (e) => (e || "").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""), Dn = ({ disabled: e, options: t, value: n, onChange: r }) => {
4408
+ }, Pn = 200, Fn = (e) => (e || "").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""), In = ({ disabled: e, options: t, value: n, onChange: r }) => {
4046
4409
  let i = c(null), [a, o] = l(""), [u, p] = l(void 0), [m, h] = l([]), [g, _] = l([]), [v, y] = l([]), [b, x] = l([]), [ee, S] = l(!1);
4047
4410
  s(() => {
4048
- o(t.find((e) => Ae(e.key, n))?.label || "");
4411
+ o(t.find((e) => ke(e.key, n))?.label || "");
4049
4412
  }, [n, t]);
4050
4413
  let w = (n) => {
4051
4414
  if (!e) switch (n.key) {
@@ -4071,10 +4434,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4071
4434
  }
4072
4435
  }, T = () => {
4073
4436
  if (!e) {
4074
- let e = En(a.trim());
4437
+ let e = Fn(a.trim());
4075
4438
  h([]), _([]), y([]), x([]);
4076
4439
  for (let n of t) {
4077
- let t = En(n.label).indexOf(e);
4440
+ let t = Fn(n.label).indexOf(e);
4078
4441
  if (t >= 0) {
4079
4442
  let r = n.label.substring(0, t), i = n.label.substring(t, t + e.length), a = n.label.substring(t + e.length);
4080
4443
  h((e) => [...e, n]), _((e) => [...e, r]), y((e) => [...e, i]), x((e) => [...e, a]);
@@ -4096,7 +4459,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4096
4459
  }, te = () => {
4097
4460
  setTimeout(() => {
4098
4461
  E();
4099
- }, Tn);
4462
+ }, Pn);
4100
4463
  }, ne = (e) => {
4101
4464
  let t = i.current?.querySelectorAll("li")[e];
4102
4465
  t && t.scrollIntoView({ block: "center" });
@@ -4144,7 +4507,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4144
4507
  })
4145
4508
  })]
4146
4509
  });
4147
- }, On = (e, t) => e.find((e) => e.key === t)?.label || `${t}`, kn = ({ disabled: e, allowRepeats: t, options: n, value: r, onChange: i }) => {
4510
+ }, Ln = (e, t) => e.find((e) => e.key === t)?.label || `${t}`, Rn = ({ disabled: e, allowRepeats: t, options: n, value: r, onChange: i }) => {
4148
4511
  let [a, o] = l(), [c, u] = l([]), [p, m] = l([]), h = (e) => {
4149
4512
  for (let t of r) if (t === e) return !0;
4150
4513
  return !1;
@@ -4157,7 +4520,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4157
4520
  };
4158
4521
  s(() => {
4159
4522
  let e = r.length === 0;
4160
- u(r.map((e) => On(n, e))), e && i(r), g();
4523
+ u(r.map((e) => Ln(n, e))), e && i(r), g();
4161
4524
  }, [r, n]);
4162
4525
  let _ = (e) => {
4163
4526
  r.length > e && (r.splice(e, 1), u(c.filter((t, n) => n !== e)), i(r), g());
@@ -4180,7 +4543,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4180
4543
  className: "daga-value-item-input",
4181
4544
  children: [/* @__PURE__ */ d("div", {
4182
4545
  className: "daga-input daga-relatively-positioned",
4183
- children: /* @__PURE__ */ d(Dn, {
4546
+ children: /* @__PURE__ */ d(In, {
4184
4547
  disabled: e,
4185
4548
  options: t ? n || [] : p || [],
4186
4549
  value: a,
@@ -4192,7 +4555,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4192
4555
  children: /* @__PURE__ */ d("div", { className: "daga-icon daga-add-icon" })
4193
4556
  })]
4194
4557
  })] });
4195
- }, An = ({ disabled: e, allowRepeats: t, value: n, onChange: r }) => {
4558
+ }, zn = ({ disabled: e, allowRepeats: t, value: n, onChange: r }) => {
4196
4559
  let [i, a] = l(""), o = (e) => {
4197
4560
  for (let t of e || []) if (t === e) return !0;
4198
4561
  return !1;
@@ -4240,7 +4603,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4240
4603
  children: /* @__PURE__ */ d("div", { className: "daga-icon daga-add-icon" })
4241
4604
  })]
4242
4605
  })] });
4243
- }, jn = ({ disabled: e, value: t, onChange: n }) => {
4606
+ }, Bn = ({ disabled: e, value: t, onChange: n }) => {
4244
4607
  let [r, i] = l(""), [a, o] = l(""), [s, c] = l({}), u = (e) => {
4245
4608
  let r = {};
4246
4609
  Object.keys(t).forEach((n) => {
@@ -4348,8 +4711,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4348
4711
  })
4349
4712
  ]
4350
4713
  })] });
4351
- }, Mn = ({ valueSet: e, onValueChange: t, depth: n }) => {
4352
- let r = o(xn).canUserPerformAction(q.UpdateValues) && e?.rootElement?.removed !== !0, i = (e) => "daga-property-name-" + e.replace(/\s/g, ""), a = (e) => {
4714
+ }, Vn = ({ valueSet: e, onValueChange: t, depth: n }) => {
4715
+ let r = o(An).canUserPerformAction(K.UpdateValues) && e?.rootElement?.removed !== !0, i = (e) => "daga-property-name-" + e.replace(/\s/g, ""), a = (e) => {
4353
4716
  if (typeof e == "string") return e;
4354
4717
  if (e == null || isNaN(e.valueOf())) return "";
4355
4718
  let t = new Date(e), n = t.getTimezoneOffset();
@@ -4362,55 +4725,55 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4362
4725
  className: "daga-property-name",
4363
4726
  children: o.label || o.name
4364
4727
  }),
4365
- o.type === P.Text && /* @__PURE__ */ d("input", {
4728
+ o.type === M.Text && /* @__PURE__ */ d("input", {
4366
4729
  type: "daga-text",
4367
4730
  disabled: o.editable === !1 || !r,
4368
4731
  value: e?.getValue(o.name),
4369
4732
  onChange: (n) => t(e, o, n.target.value)
4370
4733
  }),
4371
- o.type === P.TextArea && /* @__PURE__ */ d("textarea", {
4734
+ o.type === M.TextArea && /* @__PURE__ */ d("textarea", {
4372
4735
  disabled: o.editable === !1 || !r,
4373
4736
  value: e?.getValue(o.name),
4374
4737
  onChange: (n) => t(e, o, n.target.value)
4375
4738
  }),
4376
- o.type === P.Number && /* @__PURE__ */ d("input", {
4739
+ o.type === M.Number && /* @__PURE__ */ d("input", {
4377
4740
  type: "number",
4378
4741
  disabled: o.editable === !1 || !r,
4379
4742
  value: e?.getValue(o.name),
4380
4743
  onChange: (n) => t(e, o, n.target.value)
4381
4744
  }),
4382
- o.type === P.Color && /* @__PURE__ */ d("input", {
4745
+ o.type === M.Color && /* @__PURE__ */ d("input", {
4383
4746
  type: "text",
4384
4747
  pattern: "#[0-9a-fA-F]{6}",
4385
4748
  disabled: o.editable === !1 || !r,
4386
4749
  value: e?.getValue(o.name),
4387
4750
  onChange: (n) => t(e, o, n.target.value)
4388
4751
  }),
4389
- o.type === P.Datetime && /* @__PURE__ */ d("input", {
4752
+ o.type === M.Datetime && /* @__PURE__ */ d("input", {
4390
4753
  type: "datetime-local",
4391
4754
  disabled: o.editable === !1 || !r,
4392
4755
  value: a(e?.getValue(o.name)),
4393
4756
  onChange: (n) => t(e, o, s(n.target.value))
4394
4757
  }),
4395
- o.type === P.Date && /* @__PURE__ */ d("input", {
4758
+ o.type === M.Date && /* @__PURE__ */ d("input", {
4396
4759
  type: "date",
4397
4760
  disabled: o.editable === !1 || !r,
4398
4761
  value: e?.getValue(o.name),
4399
4762
  onChange: (n) => t(e, o, n.target.value)
4400
4763
  }),
4401
- o.type === P.Time && /* @__PURE__ */ d("input", {
4764
+ o.type === M.Time && /* @__PURE__ */ d("input", {
4402
4765
  type: "time",
4403
4766
  disabled: o.editable === !1 || !r,
4404
4767
  value: e?.getValue(o.name),
4405
4768
  onChange: (n) => t(e, o, n.target.value)
4406
4769
  }),
4407
- o.type === P.Url && /* @__PURE__ */ d("input", {
4770
+ o.type === M.Url && /* @__PURE__ */ d("input", {
4408
4771
  type: "url",
4409
4772
  disabled: o.editable === !1 || !r,
4410
4773
  value: e?.getValue(o.name),
4411
4774
  onChange: (n) => t(e, o, n.target.value)
4412
4775
  }),
4413
- o.type === P.Boolean && /* @__PURE__ */ f("div", {
4776
+ o.type === M.Boolean && /* @__PURE__ */ f("div", {
4414
4777
  className: "daga-radio",
4415
4778
  children: [/* @__PURE__ */ f("label", {
4416
4779
  className: "daga-radio-item daga-radio-start" + (e?.getValue(o.name) === !1 ? " daga-checked" : ""),
@@ -4434,36 +4797,36 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4434
4797
  }), "Yes"]
4435
4798
  })]
4436
4799
  }),
4437
- o.type === P.Option && /* @__PURE__ */ d("div", {
4800
+ o.type === M.Option && /* @__PURE__ */ d("div", {
4438
4801
  className: "daga-relatively-positioned",
4439
- children: /* @__PURE__ */ d(Dn, {
4802
+ children: /* @__PURE__ */ d(In, {
4440
4803
  disabled: o.editable === !1 || !r,
4441
4804
  options: o.options || [],
4442
4805
  value: e?.getValue(o.name),
4443
4806
  onChange: (n) => t(e, o, n)
4444
4807
  })
4445
4808
  }),
4446
- (o.type === P.OptionList || o.type === P.OptionSet) && /* @__PURE__ */ d(kn, {
4809
+ (o.type === M.OptionList || o.type === M.OptionSet) && /* @__PURE__ */ d(Rn, {
4447
4810
  disabled: o.editable === !1 || !r,
4448
- allowRepeats: o.type === P.OptionList,
4811
+ allowRepeats: o.type === M.OptionList,
4449
4812
  options: o.options || [],
4450
4813
  value: e?.getValue(o.name),
4451
4814
  onChange: (n) => t(e, o, n)
4452
4815
  }),
4453
- (o.type === P.TextList || o.type === P.TextSet) && /* @__PURE__ */ d(An, {
4816
+ (o.type === M.TextList || o.type === M.TextSet) && /* @__PURE__ */ d(zn, {
4454
4817
  disabled: o.editable === !1 || !r,
4455
- allowRepeats: o.type === P.TextList,
4818
+ allowRepeats: o.type === M.TextList,
4456
4819
  value: e?.getValue(o.name),
4457
4820
  onChange: (n) => t(e, o, n)
4458
4821
  }),
4459
- o.type === P.TextMap && /* @__PURE__ */ d(jn, {
4822
+ o.type === M.TextMap && /* @__PURE__ */ d(Bn, {
4460
4823
  disabled: o.editable === !1 || !r,
4461
4824
  value: e?.getValue(o.name),
4462
4825
  onChange: (n) => t(e, o, n)
4463
4826
  }),
4464
- o.type === P.Object && /* @__PURE__ */ d("div", {
4827
+ o.type === M.Object && /* @__PURE__ */ d("div", {
4465
4828
  className: "daga-left-bar",
4466
- children: /* @__PURE__ */ d(Mn, {
4829
+ children: /* @__PURE__ */ d(Vn, {
4467
4830
  valueSet: e.getSubValueSet(o.name),
4468
4831
  onValueChange: t,
4469
4832
  depth: n + 1
@@ -4471,22 +4834,22 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4471
4834
  })
4472
4835
  ]
4473
4836
  }, o.name)) });
4474
- }, Nn = ({ valueSet: t, depth: n }) => {
4475
- let r = o(xn), i = c(null), a = (e) => "daga-property-name-" + e.replace(/\s/g, ""), s = () => {
4837
+ }, Hn = ({ valueSet: t, depth: n }) => {
4838
+ let r = o(An), i = c(null), a = (e) => "daga-property-name-" + e.replace(/\s/g, ""), s = () => {
4476
4839
  for (let o of t?.displayedProperties || []) {
4477
4840
  let s = 0, c = 0, u = 0, d = e.select(i.current).select(`.daga-property.${a(o.name)}.daga-depth-${n}`);
4478
4841
  d.select("button.daga-move-button").call(e.drag().on(w.Start, (e) => {
4479
- Z(A.Grabbing);
4842
+ X(k.Grabbing);
4480
4843
  let t = r.getPointerLocationRelativeToScreen(e);
4481
4844
  if (t.length < 2 || isNaN(t[0]) || isNaN(t[1])) return;
4482
4845
  let n = d.node()?.getBoundingClientRect();
4483
4846
  s = n?.width || 0, c = n?.height || 0, d.style("position", "fixed").style("left", `${t[0] - s / 2}px`).style("top", `${t[1] - c / 2}px`).style("width", `${s}px`).style("height", `${c}px`).style("z-index", 1);
4484
4847
  }).on(w.Drag, (t) => {
4485
- Z(A.Grabbing);
4848
+ X(k.Grabbing);
4486
4849
  let a = r.getPointerLocationRelativeToScreen(t);
4487
4850
  a.length < 2 || isNaN(a[0]) || isNaN(a[1]) || (d.style("position", "fixed").style("left", `${a[0] - s / 2}px`).style("top", `${a[1] - c / 2}px`).style("width", `${s}px`).style("height", `${c}px`).style("z-index", 1), e.select(i.current).select(`.daga-dropbar.daga-index-${u}.daga-depth-${n}`).style("visibility", "hidden").style("height", 0), u = l(a), e.select(i.current).select(`.daga-dropbar.daga-index-${u}.daga-depth-${n}`).style("visibility", "visible").style("height", "0.25rem"));
4488
4851
  }).on(w.End, (a) => {
4489
- Z(A.Auto), d.style("position", "relative").style("left", 0).style("top", 0).style("z-index", 0).style("width", "unset").style("height", "unset"), e.select(i.current).select(`.daga-dropbar.daga-index-${u}.daga-depth-${n}`).style("visibility", "hidden").style("height", 0);
4852
+ X(k.Auto), d.style("position", "relative").style("left", 0).style("top", 0).style("z-index", 0).style("width", "unset").style("height", "unset"), e.select(i.current).select(`.daga-dropbar.daga-index-${u}.daga-depth-${n}`).style("visibility", "hidden").style("height", 0);
4490
4853
  let s = r.getPointerLocationRelativeToScreen(a);
4491
4854
  s.length < 2 || isNaN(s[0]) || isNaN(s[1]) || (u = l(s), t?.displayedProperties?.splice(t.displayedProperties.indexOf(o), 1), t?.displayedProperties?.splice(u, 0, o));
4492
4855
  }));
@@ -4505,7 +4868,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4505
4868
  }, u = (e) => {
4506
4869
  if (t === void 0) return;
4507
4870
  let n;
4508
- n = e instanceof Ee ? e : e instanceof Event ? t?.propertySet.getProperty(e.target?.value || "") : t?.propertySet.getProperty(e || ""), n && t?.hideProperty(n), s();
4871
+ n = e instanceof Te ? e : e instanceof Event ? t?.propertySet.getProperty(e.target?.value || "") : t?.propertySet.getProperty(e || ""), n && t?.hideProperty(n), s();
4509
4872
  };
4510
4873
  return /* @__PURE__ */ f("daga-property-settings", {
4511
4874
  ref: i,
@@ -4528,11 +4891,11 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4528
4891
  })]
4529
4892
  })]
4530
4893
  }),
4531
- e.type !== P.Object && /* @__PURE__ */ d("div", {
4894
+ e.type !== M.Object && /* @__PURE__ */ d("div", {
4532
4895
  className: "daga-property-value",
4533
- children: Pn(t?.getValue(e.name))
4896
+ children: Un(t?.getValue(e.name))
4534
4897
  }),
4535
- e.type === P.Object && /* @__PURE__ */ d(Nn, {
4898
+ e.type === M.Object && /* @__PURE__ */ d(Hn, {
4536
4899
  valueSet: t?.getSubValueSet(e.name),
4537
4900
  depth: n + 1
4538
4901
  })
@@ -4540,61 +4903,61 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4540
4903
  }), /* @__PURE__ */ d("div", { className: `daga-dropbar daga-index-${r + 1} daga-depth-${n}` })]
4541
4904
  }, e.name))]
4542
4905
  });
4543
- }, Pn = (e) => Array.isArray(e) ? e.join(", ") : Me(e) ? Object.entries(e).map((e) => e.map((e) => JSON.stringify(e)).join(": ")).join(", ") : e instanceof Date ? e.toLocaleString() : e == null ? "" : "" + e, Fn = ({ location: t, direction: n, width: r, height: i, title: a, valueSet: o, onValueChange: u }) => {
4544
- let m = c(null), [h, g] = l(!1), [_, v] = l(!1), y = () => e.select(m.current);
4906
+ }, Un = (e) => Array.isArray(e) ? e.join(", ") : je(e) ? Object.entries(e).map((e) => e.map((e) => JSON.stringify(e)).join(": ")).join(", ") : e instanceof Date ? e.toLocaleString() : e == null ? "" : "" + e, Wn = ({ collapsed: t, location: n, direction: r, width: i, length: a, title: o, valueSet: u, onValueChange: m }) => {
4907
+ let h = c(null), [g, _] = l(t), [v, y] = l(!1), b = () => e.select(h.current);
4545
4908
  return s(() => {
4546
- if (m.current) switch (n) {
4909
+ if (h.current) switch (r) {
4547
4910
  case p.Bottom:
4548
4911
  case p.Top:
4549
- y().style("width", r), i && y().select(".daga-panel-content").style("height", i);
4912
+ b().style("width", i).select(".daga-panel-content").style("height", a);
4550
4913
  break;
4551
4914
  case p.Left:
4552
4915
  case p.Right:
4553
- y().style("height", r), i && y().select(".daga-panel-content").style("width", i);
4916
+ b().style("height", i).select(".daga-panel-content").style("width", a);
4554
4917
  break;
4555
4918
  }
4556
4919
  }, [
4557
- r,
4558
4920
  i,
4559
- n
4921
+ a,
4922
+ r
4560
4923
  ]), /* @__PURE__ */ d("daga-property-editor", { children: /* @__PURE__ */ f("div", {
4561
- ref: m,
4562
- className: `daga-panel daga-bottom daga-${t} daga-${n}`,
4563
- children: [/* @__PURE__ */ d(Cn, {
4564
- disabled: !o || !o.propertySet || !o.propertySet.hasProperties(),
4565
- collapsed: h,
4566
- direction: n,
4567
- collapsableSelector: m,
4924
+ ref: h,
4925
+ className: `daga-panel daga-bottom daga-${n} daga-${r}`,
4926
+ children: [/* @__PURE__ */ d(Mn, {
4927
+ disabled: !u || !u.propertySet || !u.propertySet.hasProperties(),
4928
+ collapsed: g,
4929
+ direction: r,
4930
+ collapsableSelector: h,
4568
4931
  collapsableAdditionalSelector: ".daga-panel-content",
4569
4932
  rule: "display",
4570
4933
  collapsedValue: "none",
4571
4934
  visibleValue: "block",
4572
- onCollapse: g
4935
+ onCollapse: _
4573
4936
  }), /* @__PURE__ */ d("div", {
4574
4937
  className: "daga-panel-content",
4575
- children: o && o.propertySet && o.propertySet.hasProperties() && !h && /* @__PURE__ */ f("div", { children: [
4576
- a && /* @__PURE__ */ f("p", {
4938
+ children: u && u.propertySet && u.propertySet.hasProperties() && !g && /* @__PURE__ */ f("div", { children: [
4939
+ o && /* @__PURE__ */ f("p", {
4577
4940
  className: "daga-title",
4578
- children: [a, /* @__PURE__ */ d("button", {
4941
+ children: [o, /* @__PURE__ */ d("button", {
4579
4942
  className: "daga-property-button",
4580
- onClick: () => v(!_),
4581
- children: /* @__PURE__ */ d("div", { className: `daga-icon daga-settings-icon ${_ ? "daga-unrotate" : "daga-rotate"}` })
4943
+ onClick: () => y(!v),
4944
+ children: /* @__PURE__ */ d("div", { className: `daga-icon daga-settings-icon ${v ? "daga-unrotate" : "daga-rotate"}` })
4582
4945
  })]
4583
4946
  }),
4584
- !_ && /* @__PURE__ */ d(Mn, {
4585
- valueSet: o,
4586
- onValueChange: u,
4947
+ !v && /* @__PURE__ */ d(Vn, {
4948
+ valueSet: u,
4949
+ onValueChange: m,
4587
4950
  depth: 0
4588
4951
  }),
4589
- _ && /* @__PURE__ */ d(Nn, {
4590
- valueSet: o,
4952
+ v && /* @__PURE__ */ d(Hn, {
4953
+ valueSet: u,
4591
4954
  depth: 0
4592
4955
  })
4593
4956
  ] })
4594
4957
  })]
4595
4958
  }) });
4596
- }, In = 6, Ln = (t) => {
4597
- let n = o(xn), [r, i] = l(t.currentPalette || t.palettes[0]), [a, u] = l(0), [m, h] = l(void 0), g = c(null), _ = c(!1), v = (e) => {
4959
+ }, Gn = 6, Kn = (t) => {
4960
+ let n = o(An), [r, i] = l(t.currentPalette || t.palettes[0]), [a, u] = l(0), [m, h] = l(void 0), g = c(null), _ = c(!1), v = (e) => {
4598
4961
  if (i(e), y().selectAll("*").remove(), u(n.getPriorityThreshold() || 0), e.categories && b(e.categories), e.templates) for (let t of e.templates) x(t);
4599
4962
  }, y = () => e.select(g.current).select(".daga-palette-view"), b = (e) => {
4600
4963
  let t = y().append("select").style("width", "100%").style("height", "2rem").style("padding", "0.5rem").style("border-radius", "0.25rem").style("background-color", "#f7f8fc").style("border", "1px solid #e6e6e6");
@@ -4618,21 +4981,21 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4618
4981
  }, ee = (t, r, i) => {
4619
4982
  if (a !== void 0 && t.priority < a) return;
4620
4983
  let o = t.defaultLook.lookType === "shaped-look" ? t.defaultLook.borderThickness || 1 : 0, s = t.defaultHeight + o, c = t.defaultWidth + o, l = r.height || s, u = r.width || c, d = y().append("div").attr("class", `daga-template-container ${i === void 0 ? "" : i}`).style("width", `${u}px`).style("height", `${l}px`).call(e.drag().on(w.Drag, (e) => {
4621
- if (n.canUserPerformAction(q.AddNode)) {
4984
+ if (n.canUserPerformAction(K.AddNode)) {
4622
4985
  let t = n.getPointerLocationRelativeToScreen(e);
4623
4986
  if (t.length < 2 || isNaN(t[0]) || isNaN(t[1])) return;
4624
4987
  d.style("position", "fixed").style("left", `${t[0] - u / 2}px`).style("top", `${t[1] - l / 2}px`).style("z-index", 1);
4625
4988
  }
4626
4989
  }).on(w.Start, (e) => {
4627
- if (n.canUserPerformAction(q.AddNode)) {
4628
- Z(A.Grabbing);
4990
+ if (n.canUserPerformAction(K.AddNode)) {
4991
+ X(k.Grabbing);
4629
4992
  let r = n.getPointerLocationRelativeToScreen(e);
4630
4993
  if (r.length < 2 || isNaN(r[0]) || isNaN(r[1])) return;
4631
- d.style("position", "fixed").style("left", `${r[0] - u / 2}px`).style("top", `${r[1] - l / 2}px`).style("z-index", 1), t.isUnique && n.model.nodes.find((e) => !e.removed && e.type.id === t.id) !== void 0 && Z(A.NotAllowed);
4994
+ d.style("position", "fixed").style("left", `${r[0] - u / 2}px`).style("top", `${r[1] - l / 2}px`).style("z-index", 1), t.isUnique && n.model.nodes.find((e) => !e.removed && e.type.id === t.id) !== void 0 && X(k.NotAllowed);
4632
4995
  }
4633
4996
  }).on(w.End, (e) => {
4634
- if (n.canUserPerformAction(q.AddNode)) {
4635
- if (Z(A.Auto), d.style("position", "relative").style("left", 0).style("top", 0).style("z-index", "auto"), t.isUnique && n.model.nodes.find((e) => !e.removed && e.type.id === t.id) !== void 0) return;
4997
+ if (n.canUserPerformAction(K.AddNode)) {
4998
+ if (X(k.Auto), d.style("position", "relative").style("left", 0).style("top", 0).style("z-index", "auto"), t.isUnique && n.model.nodes.find((e) => !e.removed && e.type.id === t.id) !== void 0) return;
4636
4999
  let i = n.getPointerLocationRelativeToScreen(e);
4637
5000
  if (i.length < 2 || isNaN(i[0]) || isNaN(i[1])) return;
4638
5001
  let a = document.elementFromPoint(i[0], i[1]);
@@ -4640,16 +5003,16 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4640
5003
  let o = n.getPointerLocationRelativeToCanvas(e);
4641
5004
  if (o.length < 2 || isNaN(o[0]) || isNaN(o[1])) return;
4642
5005
  let s = [o[0] - t.defaultWidth / 2, o[1] - t.defaultHeight / 2];
4643
- n.snapToGrid && (s = n.getClosestGridPoint([s[0] - t.snapToGridOffset[0], s[1] - t.snapToGridOffset[1]]), s[0] += t.snapToGridOffset[0], s[1] += t.snapToGridOffset[1]);
4644
- let c = Ye(n.model.nodes.getAtCoordinates(o[0], o[1]).filter((e) => e.type.childrenTypes.includes(t.id))), l = c[c.length - 1];
5006
+ n.gridConfig.snap && (s = n.getClosestGridPoint([s[0] - t.snapToGridOffset[0], s[1] - t.snapToGridOffset[1]]), s[0] += t.snapToGridOffset[0], s[1] += t.snapToGridOffset[1]);
5007
+ let c = Qe(n.model.nodes.getAtCoordinates(o[0], o[1]).filter((e) => e.type.childrenTypes.includes(t.id))), l = c[c.length - 1];
4645
5008
  if (!t.canBeParentless && l === void 0) return;
4646
- let u = l?.getLastAncestor(), f = new yt(n, t, s, l?.id, u?.id, u?.getGeometry(), void 0, r.label, r.values);
4647
- f.do(), n?.actionStack.add(f), Z();
5009
+ let u = l?.getLastAncestor(), f = new Et(n, t, s, l?.id, u?.id, u?.getGeometry(), void 0, r.label, r.values);
5010
+ f.do(), n?.actionStack.add(f), X();
4648
5011
  }
4649
5012
  })).append("svg").attr("class", `palette-node ${t.id}`).attr("viewBox", `0 0 ${c} ${s}`).attr("preserveAspectRatio", "none").style("position", "relative").style("left", 0).style("top", 0).style("width", `${u}px`).style("height", `${l}px`), f = r.look || t.defaultLook;
4650
5013
  switch (f.lookType) {
4651
5014
  case "shaped-look":
4652
- d.append("path").attr("d", ae(f.shape || k.Rectangle, (f.borderThickness || 1) / 2, (f.borderThickness || 1) / 2, t.defaultWidth, t.defaultHeight)).attr("fill", f.fillColor || "#FFFFFF").attr("stroke", f.borderColor || "#000000").attr("stroke-width", `${f.borderThickness}px`);
5015
+ d.append("path").attr("d", oe(f.shape || ae.Rectangle, (f.borderThickness || 1) / 2, (f.borderThickness || 1) / 2, t.defaultWidth, t.defaultHeight)).attr("fill", f.fillColor || "#FFFFFF").attr("stroke", f.borderColor || "#000000").attr("stroke-width", `${f.borderThickness}px`);
4653
5016
  break;
4654
5017
  case "image-look":
4655
5018
  d.append("image").attr("x", 0).attr("y", 0).attr("width", t.defaultWidth).attr("height", t.defaultHeight).attr("href", f.backgroundImage).attr("preserveAspectRatio", "none");
@@ -4657,21 +5020,24 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4657
5020
  case "stretchable-image-look": d.append("image").attr("x", 0).attr("y", 0).attr("width", f.leftMargin).attr("height", f.topMargin).attr("href", f.backgroundImageTopLeft).attr("preserveAspectRatio", "none"), d.append("image").attr("x", f.leftMargin).attr("y", 0).attr("width", t.defaultWidth - f.rightMargin - f.leftMargin).attr("height", f.topMargin).attr("href", f.backgroundImageTop).attr("preserveAspectRatio", "none"), d.append("image").attr("x", t.defaultWidth - f.rightMargin).attr("y", 0).attr("width", f.rightMargin).attr("height", f.topMargin).attr("href", f.backgroundImageTopRight).attr("preserveAspectRatio", "none"), d.append("image").attr("x", 0).attr("y", f.topMargin).attr("width", f.leftMargin).attr("height", t.defaultHeight - f.bottomMargin - f.topMargin).attr("href", f.backgroundImageLeft).attr("preserveAspectRatio", "none"), d.append("image").attr("x", f.leftMargin).attr("y", f.topMargin).attr("width", t.defaultWidth - f.rightMargin - f.leftMargin).attr("height", t.defaultHeight - f.bottomMargin - f.topMargin).attr("href", f.backgroundImageCenter).attr("preserveAspectRatio", "none"), d.append("image").attr("x", t.defaultWidth - f.rightMargin).attr("y", f.topMargin).attr("width", f.rightMargin).attr("height", t.defaultHeight - f.bottomMargin - f.topMargin).attr("href", f.backgroundImageRight).attr("preserveAspectRatio", "none"), d.append("image").attr("x", 0).attr("y", t.defaultHeight - f.bottomMargin).attr("width", f.leftMargin).attr("height", f.bottomMargin).attr("href", f.backgroundImageBottomLeft).attr("preserveAspectRatio", "none"), d.append("image").attr("x", f.leftMargin).attr("y", t.defaultHeight - f.bottomMargin).attr("width", t.defaultWidth - f.rightMargin - f.leftMargin).attr("height", f.bottomMargin).attr("href", f.backgroundImageBottom).attr("preserveAspectRatio", "none"), d.append("image").attr("x", t.defaultWidth - f.rightMargin).attr("y", t.defaultHeight - f.bottomMargin).attr("width", f.rightMargin).attr("height", f.bottomMargin).attr("href", f.backgroundImageBottomRight).attr("preserveAspectRatio", "none");
4658
5021
  }
4659
5022
  if (r.look === void 0) {
4660
- if (t.decorators) for (let e of t.decorators) d.append("foreignObject").attr("width", `${e.width}px`).attr("height", `${e.height}px`).attr("transform", `translate(${e.coords[0]},${e.coords[1]})`).html(e.html);
5023
+ if (t.decorators) for (let e of t.decorators) d.append("foreignObject").attr("width", `${e.width}px`).attr("height", `${e.height}px`).attr("transform", `translate(${e.coords[0]},${e.coords[1]})`).html(e.svg);
4661
5024
  if (r.label) {
4662
5025
  let e = {
4663
5026
  ...L,
4664
5027
  ...t.label,
4665
5028
  ...r.labelLook
4666
5029
  };
4667
- d.append("text").attr("transform", `translate(${(z(e) + t.defaultWidth) / 2},${(V(e) + t.defaultHeight) / 2})`).attr("x", 0).attr("y", 0).attr("font-size", `${e.fontSize}px`).attr("text-anchor", "middle").attr("font-family", e.fontFamily).attr("font-weight", 400).attr("fill", e.color).attr("stroke", "none").style("font-kerning", "none").style("user-select", "none").text(r.label);
5030
+ e.look = {
5031
+ ...L.look,
5032
+ ...e.look
5033
+ }, d.append("text").attr("transform", `translate(${(z(e) + t.defaultWidth) / 2},${(V(e) + t.defaultHeight) / 2})`).attr("x", 0).attr("y", 0).attr("font-size", `${e.look.fontSize}px`).attr("text-anchor", "middle").attr("font-family", e.look.fontFamily || L.look.fontFamily).attr("font-weight", e.look.fontWeight || L.look.fontWeight).attr("fill", e.look.fontColor || L.look.fontColor).attr("stroke", "none").style("font-kerning", "none").style("user-select", "none").text(r.label);
4668
5034
  }
4669
5035
  }
4670
5036
  }, C = (e, t, r) => {
4671
5037
  let i = y().append("div").attr("class", `daga-template-container ${r === void 0 ? "" : r}`).style("width", `${t.width}px`).style("height", `${t.height}px`).append("svg").attr("class", `palette-button ${e.id}`).style("position", "relative").style("left", 0).style("top", 0).style("width", "100%").style("height", "100%").on("click", () => {
4672
5038
  n.connectionType = e;
4673
5039
  });
4674
- i.append("path").attr("d", ae(k.Rectangle, 0, 0, t.width, t.height)).attr("fill", t.backgroundColor).attr("stroke", "black").attr("stroke-width", "1px"), t.icon !== "" && i.append("image").attr("x", 0).attr("y", 0).attr("width", t.width).attr("height", t.height).attr("href", t.icon), t.label !== "" && i.append("text").attr("transform", `translate(${t.width / 2},${t.height / 2 + In})`).attr("x", 0).attr("y", 0).attr("font-size", "20px").attr("text-anchor", "middle").attr("font-family", "'Wonder Unit Sans', sans-serif").attr("font-weight", 400).attr("fill", "#000000").attr("stroke", "none").style("font-kerning", "none").style("user-select", "none").text(t.label);
5040
+ i.append("path").attr("d", oe(ae.Rectangle, 0, 0, t.width, t.height)).attr("fill", t.backgroundColor).attr("stroke", "black").attr("stroke-width", "1px"), t.icon !== "" && i.append("image").attr("x", 0).attr("y", 0).attr("width", t.width).attr("height", t.height).attr("href", t.icon), t.label !== "" && i.append("text").attr("transform", `translate(${t.width / 2},${t.height / 2 + Gn})`).attr("x", 0).attr("y", 0).attr("font-size", "20px").attr("text-anchor", "middle").attr("font-family", "'Wonder Unit Sans', sans-serif").attr("font-weight", 400).attr("fill", "#000000").attr("stroke", "none").style("font-kerning", "none").style("user-select", "none").text(t.label);
4675
5041
  };
4676
5042
  return s(() => {
4677
5043
  t.palettes.length > 0 && !_.current && (_.current = !0, v(t.palettes[0]));
@@ -4679,28 +5045,28 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4679
5045
  if (g.current) switch (t.direction) {
4680
5046
  case p.Bottom:
4681
5047
  case p.Top:
4682
- g.current.style.width = t.width, t.height && (g.current.style.height = t.height);
5048
+ g.current.style.width = t.width, g.current.style.height = t.length;
4683
5049
  break;
4684
5050
  case p.Left:
4685
5051
  case p.Right:
4686
- g.current.style.height = t.width, t.height && (g.current.style.width = t.height);
5052
+ g.current.style.height = t.width, g.current.style.width = t.length;
4687
5053
  break;
4688
5054
  }
4689
5055
  }, [
4690
5056
  t.direction,
4691
5057
  t.width,
4692
- t.height
5058
+ t.length
4693
5059
  ]), /* @__PURE__ */ d("daga-palette", { children: /* @__PURE__ */ f("div", {
4694
5060
  ref: g,
4695
5061
  className: `daga-panel daga-${t.location} daga-${t.direction}`,
4696
- children: [/* @__PURE__ */ d(Cn, {
5062
+ children: [/* @__PURE__ */ d(Mn, {
4697
5063
  direction: t.direction,
4698
5064
  collapsableSelector: g,
4699
5065
  collapsableAdditionalSelector: ".daga-panel-content",
4700
5066
  rule: "display",
4701
5067
  collapsedValue: "none",
4702
5068
  visibleValue: "block",
4703
- collapsed: !1,
5069
+ collapsed: t.collapsed,
4704
5070
  disabled: !1
4705
5071
  }), /* @__PURE__ */ f("div", {
4706
5072
  className: "daga-panel-content",
@@ -4714,7 +5080,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4714
5080
  }), /* @__PURE__ */ d("div", { className: "daga-palette-view" })]
4715
5081
  })]
4716
5082
  }) });
4717
- }, Rn = ({ location: t, direction: n, centerAnimationDuration: r, enableAction: i, enableFilter: a, enableLayout: l, enableSelection: u, enableZoom: m }) => {
5083
+ }, qn = ({ location: t, direction: n, centerAnimationDuration: r, enableAction: i, enableFilter: a, enableLayout: l, enableSelection: u, enableZoom: m }) => {
4718
5084
  let h = !1, g = !0, _ = !1, v, y, b, x;
4719
5085
  switch (n) {
4720
5086
  case p.Bottom:
@@ -4745,11 +5111,11 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4745
5111
  } else g = !0, t.transition().duration(500).ease(e.easeLinear).style(v, "0rem").style("transform", `${y}(0)`), setTimeout(() => {
4746
5112
  _ = !1;
4747
5113
  }, 500);
4748
- }, T = o(xn);
5114
+ }, T = o(An);
4749
5115
  return /* @__PURE__ */ d("daga-diagram-buttons", { children: /* @__PURE__ */ f("div", {
4750
5116
  className: `daga-diagram-buttons daga-${t} daga-${n}`,
4751
5117
  children: [
4752
- m && T.canUserPerformAction(q.Zoom) && /* @__PURE__ */ d("button", {
5118
+ m && T.canUserPerformAction(K.Zoom) && /* @__PURE__ */ d("button", {
4753
5119
  className: "daga-zoom-in",
4754
5120
  onClick: () => {
4755
5121
  T.zoomBy(T.zoomFactor);
@@ -4759,7 +5125,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4759
5125
  children: "Zoom in"
4760
5126
  })
4761
5127
  }),
4762
- m && T.canUserPerformAction(q.Zoom) && /* @__PURE__ */ d("button", {
5128
+ m && T.canUserPerformAction(K.Zoom) && /* @__PURE__ */ d("button", {
4763
5129
  className: "daga-zoom-out",
4764
5130
  onClick: () => {
4765
5131
  T.zoomBy(1 / T.zoomFactor);
@@ -4773,7 +5139,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4773
5139
  className: "daga-collapsable-buttons daga-collapsed",
4774
5140
  ref: ee,
4775
5141
  children: [
4776
- m && T.canUserPerformAction(q.Zoom) && /* @__PURE__ */ d("button", {
5142
+ m && T.canUserPerformAction(K.Zoom) && /* @__PURE__ */ d("button", {
4777
5143
  className: "daga-center",
4778
5144
  onClick: () => {
4779
5145
  T.center(void 0, 1, r);
@@ -4828,7 +5194,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4828
5194
  onClick: () => {
4829
5195
  T.multipleSelectionOn = !0, e.select(S.current).classed("daga-on", !0).classed("daga-off", !1);
4830
5196
  let t = T.diagramEvent$.subscribe((n) => {
4831
- n.type === Ot.Selection && (e.select(S.current).classed("daga-on", !1).classed("daga-off", !0), t.unsubscribe());
5197
+ n.type === Ft.Selection && (e.select(S.current).classed("daga-on", !1).classed("daga-off", !0), t.unsubscribe());
4832
5198
  });
4833
5199
  },
4834
5200
  ref: S,
@@ -4860,7 +5226,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4860
5226
  l && T.layoutFormat && /* @__PURE__ */ d("button", {
4861
5227
  className: "daga-layout",
4862
5228
  onClick: () => {
4863
- T.layoutFormat && T.layoutFormat in yn && yn[T.layoutFormat].apply(T.model);
5229
+ T.layoutFormat && T.layoutFormat in On && On[T.layoutFormat].apply(T.model);
4864
5230
  },
4865
5231
  children: /* @__PURE__ */ d("span", {
4866
5232
  className: "daga-tooltip",
@@ -4895,8 +5261,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4895
5261
  })
4896
5262
  ]
4897
5263
  }) });
4898
- }, zn = ({ config: e, model: t, onCanvasCreated: n, onDiagramEvent: r, onModelChange: i }) => {
4899
- let a = new ot(), o = new en(), u = c(null), h = c(void 0), g = c(!1), _ = [], [v, y] = l(void 0), [b, x] = l(void 0), ee = {
5264
+ }, Jn = ({ config: e, model: t, onCanvasCreated: n, onDiagramEvent: r, onModelChange: i }) => {
5265
+ let a = new pt(), o = new un(), u = c(null), h = c(void 0), g = c(!1), _ = [], [v, y] = l(void 0), [b, x] = l(void 0), ee = {
4900
5266
  zoomIn: () => {},
4901
5267
  zoomOut: () => {},
4902
5268
  center: () => {},
@@ -4904,12 +5270,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4904
5270
  filter: () => {},
4905
5271
  undo: () => {},
4906
5272
  redo: () => {}
4907
- }, S = { refreshPalette: () => {} }, C = new Sn((e) => y(e), (e) => x(e)), w = {
5273
+ }, S = { refreshPalette: () => {} }, C = new jn((e) => y(e), (e) => x(e)), w = {
4908
5274
  diagramButtons: ee,
4909
5275
  palette: S,
4910
5276
  propertyEditor: C
4911
5277
  }, T = (t = !1) => {
4912
- if ((!h.current || t) && (_.forEach((e) => e.unsubscribe()), h.current = new an(w, e)), !h.current) throw Error("Canvas could not be created");
5278
+ if ((!h.current || t) && (_.forEach((e) => e.unsubscribe()), h.current = new mn(w, e)), !h.current) throw Error("Canvas could not be created");
4913
5279
  return h.current;
4914
5280
  }, E = T(), D = (e) => {
4915
5281
  E.initView(e), _.push(E.diagramEvent$.subscribe((e) => {
@@ -4925,17 +5291,17 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4925
5291
  u.current && (T(!0), D(u.current), n?.(E));
4926
5292
  }, [e]), s(() => {
4927
5293
  t && a.import(E.model, t);
4928
- }, [t]), /* @__PURE__ */ d("daga-diagram", { children: /* @__PURE__ */ d(bn.Provider, {
5294
+ }, [t]), /* @__PURE__ */ d("daga-diagram", { children: /* @__PURE__ */ d(kn.Provider, {
4929
5295
  value: e,
4930
- children: /* @__PURE__ */ d(xn.Provider, {
5296
+ children: /* @__PURE__ */ d(An.Provider, {
4931
5297
  value: E,
4932
5298
  children: /* @__PURE__ */ f("daga-diagram-editor", { children: [/* @__PURE__ */ d("div", {
4933
5299
  className: "daga-append-to",
4934
5300
  ref: u
4935
- }), /* @__PURE__ */ f(xn.Provider, {
5301
+ }), /* @__PURE__ */ f(An.Provider, {
4936
5302
  value: E,
4937
5303
  children: [
4938
- e.components?.buttons !== void 0 && e.components?.buttons?.enabled !== !1 && /* @__PURE__ */ d(Rn, {
5304
+ e.components?.buttons !== void 0 && e.components?.buttons?.enabled !== !1 && /* @__PURE__ */ d(qn, {
4939
5305
  location: e.components?.buttons?.location || m.BottomRight,
4940
5306
  direction: e.components?.buttons?.direction || p.Top,
4941
5307
  centerAnimationDuration: e.components?.buttons?.centerAnimationDuration,
@@ -4945,33 +5311,37 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
4945
5311
  enableSelection: e.components?.buttons?.enableSelection !== !1,
4946
5312
  enableZoom: e.components?.buttons?.enableZoom !== !1
4947
5313
  }),
4948
- e.components?.palette !== void 0 && e.components?.palette?.enabled !== !1 && e.components?.palette?.sections && (e.components?.palette?.sections?.length || 0) > 0 && /* @__PURE__ */ d(Ln, {
5314
+ e.components?.palette !== void 0 && e.components?.palette?.enabled !== !1 && e.components?.palette?.sections && (e.components?.palette?.sections?.length || 0) > 0 && /* @__PURE__ */ d(Kn, {
5315
+ collapsed: e.components?.palette?.open === !1,
4949
5316
  location: e.components?.palette?.location || m.TopLeft,
4950
5317
  direction: e.components?.palette?.direction || p.Bottom,
4951
5318
  width: e.components?.palette?.width || "12rem",
4952
- height: e.components?.palette?.height,
5319
+ length: e.components?.palette?.length || "min-content",
5320
+ gap: e.components?.palette?.gap || "1rem",
5321
+ justifyContent: e.components?.palette?.justifyContent || "center",
4953
5322
  palettes: e.components?.palette?.sections || []
4954
5323
  }),
4955
- e.components?.propertyEditor !== void 0 && e.components?.propertyEditor?.enabled !== !1 && /* @__PURE__ */ d(Fn, {
5324
+ e.components?.propertyEditor !== void 0 && e.components?.propertyEditor?.enabled !== !1 && /* @__PURE__ */ d(Wn, {
5325
+ collapsed: e.components?.propertyEditor?.open === !1,
4956
5326
  location: e.components?.propertyEditor?.location || m.TopRight,
4957
5327
  direction: e.components?.propertyEditor?.direction || p.Bottom,
4958
5328
  width: e.components?.propertyEditor?.width || "24rem",
4959
- height: e.components?.propertyEditor?.height,
5329
+ length: e.components?.propertyEditor?.length || "min-content",
4960
5330
  title: v,
4961
5331
  valueSet: b,
4962
5332
  onValueChange: (e, t, n) => {
4963
- if (b !== void 0 && t.editable !== !1 && !Ae(e.getValue(t.name), n)) {
5333
+ if (b !== void 0 && t.editable !== !1 && !ke(e.getValue(t.name), n)) {
4964
5334
  e.setValue(t.name, n);
4965
- let r = new Ne(b.propertySet, void 0);
5335
+ let r = new Me(b.propertySet, void 0);
4966
5336
  r.setValues(b.getValues()), r.rootElement = b.rootElement, C.valueSet = r, b.rootElement.valueSet = r, E.propertyEditorChanges$?.next();
4967
5337
  }
4968
5338
  }
4969
5339
  }),
4970
- e.components?.errors !== void 0 && e.components?.errors?.enabled !== !1 && /* @__PURE__ */ d(wn, {})
5340
+ e.components?.errors !== void 0 && e.components?.errors?.enabled !== !1 && /* @__PURE__ */ d(Nn, {})
4971
5341
  ]
4972
5342
  })] })
4973
5343
  })
4974
5344
  }) });
4975
5345
  };
4976
5346
  //#endregion
4977
- export { zn as DagaDiagram };
5347
+ export { Jn as DagaDiagram };