UNPKG

@metadev/daga-react

Version:

![Daga banner](https://metadev.pro/content/daga/daga-banner.png)

1,210 lines 298 kB
import { jsx as k, jsxs as V, Fragment as Oi } from "react/jsx-runtime"; import * as N from "d3"; import { debounceTime as Di, Subject as Xt, merge as Hi, map as Gi } from "rxjs"; import { createContext as mi, useState as U, useContext as Yt, useRef as dt, useEffect as Tt, useMemo as Fi } from "react"; var v = /* @__PURE__ */ ((i) => (i.Bottom = "bottom", i.Left = "left", i.Right = "right", i.Top = "top", i))(v || {}), Wt = /* @__PURE__ */ ((i) => (i.BottomLeft = "bottom-left", i.BottomRight = "bottom-right", i.TopLeft = "top-left", i.TopRight = "top-right", i))(Wt || {}), Pt = /* @__PURE__ */ ((i) => (i.Left = "left", i.Center = "center", i.Right = "right", i))(Pt || {}), Kt = /* @__PURE__ */ ((i) => (i.Top = "top", i.Center = "center", i.Bottom = "bottom", i))(Kt || {}); const Mt = (i) => [Math.round(i[0]), Math.round(i[1])], bt = (i, t, e) => t < e ? t <= i && i <= e : e <= i && i <= t, ii = (i, t, e) => (i - t[0]) / (t[1] - t[0]) * (e[1] - e[0]) + e[0], qt = (i, t, e, s, a) => [ ii(i[0], t, s), ii(i[1], e, a) ], fi = (i, t) => ((i[0] - t[0]) ** 2 + (i[1] - t[1]) ** 2) ** 0.5, Bi = (i, t) => (bt( i[0][0], t[0][0], t[1][0] ) || bt( i[1][0], t[1][0], t[0][0] ) || bt( t[0][0], i[0][0], i[1][0] ) || bt( t[1][0], i[1][0], i[0][0] )) && (bt( i[0][1], t[0][1], t[1][1] ) || bt( i[1][1], t[1][1], t[0][1] ) || bt( t[0][1], i[0][1], i[1][1] ) || bt( t[1][1], i[1][1], i[0][1] )); var E = /* @__PURE__ */ ((i) => (i.Blur = "blur", i.Change = "change", i.Click = "click", i.ContextMenu = "contextmenu", i.DoubleClick = "dblclick", i.Focus = "focus", i.FocusIn = "focusin", i.FocusOut = "focusout", i.Input = "input", i.KeyDown = "keydown", i.KeyUp = "keyup", i.MouseDown = "mousedown", i.MouseEnter = "mouseenter", i.MouseLeave = "mouseleave", i.MouseMove = "mousemove", i.MouseOut = "mouseout", i.MouseOver = "mouseover", i.MouseUp = "mouseup", i.TouchStart = "touchstart", i.TouchEnd = "touchend", i.Wheel = "wheel", i))(E || {}), et = /* @__PURE__ */ ((i) => (i.Alt = "Alt", i.AltGraph = "AltGraph", i.ArrowDown = "ArrowDown", i.ArrowLeft = "ArrowLeft", i.ArrowRight = "ArrowRight", i.ArrowUp = "ArrowUp", i.Backspace = "Backspace", i.Control = "Control", i.Delete = "Delete", i.End = "End", i.Enter = "Enter", i.Escape = "Escape", i.Home = "Home", i.OS = "OS", i.PageDown = "PageDown", i.PageUp = "PageUp", i.Shift = "Shift", i.Tab = "Tab", i))(et || {}), $ = /* @__PURE__ */ ((i) => (i.Drag = "drag", i.Start = "start", i.End = "end", i))($ || {}), fe = /* @__PURE__ */ ((i) => (i.Zoom = "zoom", i.Start = "start", i.End = "end", i))(fe || {}), pi = /* @__PURE__ */ ((i) => (i.Straight = "straight", i.Bezier = "bezier", i.Square = "square", i))(pi || {}), yi = /* @__PURE__ */ ((i) => (i.Solid = "solid", i.Dashed = "dashed", i.GappedDashes = "gapped-dashes", i.Dotted = "dotted", i))(yi || {}); const Ui = 20, Yi = (i, t, e, s, a) => { if (typeof i == "function") return i( t, e, s, a ); if (t.length === 0) return ""; if (t.length === 1) return `M ${t[0][0]} ${t[0][1]}`; { a = a || Ui; let l = "", o, n; switch (i) { case "straight": l += `M ${t[0][0]} ${t[0][1]}`; for (let r = 1; r < t.length; ++r) l += ` L ${t[r][0]} ${t[r][1]}`; break; case "bezier": o = e, l += `M ${t[0][0]} ${t[0][1]}`; for (let r = 1; r < t.length; ++r) { if (r + 1 >= t.length ? n = s : Math.abs(t[r][0] - t[r - 1][0]) < Math.abs(t[r][1] - t[r - 1][1]) ? t[r][1] > t[r - 1][1] ? n = v.Bottom : n = v.Top : t[r][0] > t[r - 1][0] ? n = v.Right : n = v.Left, o !== void 0) { let d = "", h = ""; const c = (Math.abs(t[r][0] - t[r - 1][0]) + Math.abs(t[r][1] - t[r - 1][1])) / 2; switch (o) { case v.Bottom: d = `${t[r - 1][0]} ${t[r - 1][1] + c}`; break; case v.Top: d = `${t[r - 1][0]} ${t[r - 1][1] - c}`; break; case v.Right: d = `${t[r - 1][0] + c} ${t[r - 1][1]}`; break; case v.Left: d = `${t[r - 1][0] - c} ${t[r - 1][1]}`; break; } if (n !== void 0) { switch (n) { case v.Bottom: h = `${t[r][0]} ${t[r][1] + c}`; break; case v.Top: h = `${t[r][0]} ${t[r][1] - c}`; break; case v.Right: h = `${t[r][0] + c} ${t[r][1]}`; break; case v.Left: h = `${t[r][0] - c} ${t[r][1]}`; break; } l += ` C ${d} ${h} ${t[r][0]} ${t[r][1]}`; } else l += ` Q ${d} ${t[r][0]} ${t[r][1]}`; } else if (n !== void 0) { let d = ""; const h = (Math.abs(t[r][0] - t[r - 1][0]) + Math.abs(t[r][1] - t[r - 1][1])) / 2; switch (n) { case v.Bottom: d = `${t[r][0]} ${t[r][1] + h}`; break; case v.Top: d = `${t[r][0]} ${t[r][1] - h}`; break; case v.Right: d = `${t[r][0] + h} ${t[r][1]}`; break; case v.Left: d = `${t[r][0] - h} ${t[r][1]}`; break; } l += ` Q ${d} ${t[r][0]} ${t[r][1]}`; } else l += ` L ${t[r][0]} ${t[r][1]}`; o = n; } break; case "square": if (l += `M ${t[0][0]} ${t[0][1]}`, e) switch (e) { case v.Bottom: t.splice(1, 0, [ t[0][0], t[0][1] + a ]); break; case v.Top: t.splice(1, 0, [ t[0][0], t[0][1] - a ]); break; case v.Right: t.splice(1, 0, [ t[0][0] + a, t[0][1] ]); break; case v.Left: t.splice(1, 0, [ t[0][0] - a, t[0][1] ]); break; } if (s) switch (s) { case v.Bottom: t.splice(t.length - 1, 0, [ t[t.length - 1][0], t[t.length - 1][1] + a ]); break; case v.Top: t.splice(t.length - 1, 0, [ t[t.length - 1][0], t[t.length - 1][1] - a ]); break; case v.Right: t.splice(t.length - 1, 0, [ t[t.length - 1][0] + a, t[t.length - 1][1] ]); break; case v.Left: t.splice(t.length - 1, 0, [ t[t.length - 1][0] - a, t[t.length - 1][1] ]); break; } for (let r = 1; r < t.length; ++r) if (o !== void 0) switch (o) { case v.Bottom: t[r][1] < t[r - 1][1] && t[r][0] !== t[r - 1][0] ? (l += ` H ${t[r][0]}`, l += ` V ${t[r][1]}`, o = v.Top) : t[r][1] < t[r - 1][1] && t[r][0] === t[r - 1][0] ? (l += ` H ${t[r][0] + a}`, l += ` V ${t[r][1]}`, l += ` H ${t[r][0]}`, o = v.Left) : t[r][1] === t[r - 1][1] && t[r][0] !== t[r - 1][0] ? (l += ` H ${t[r][0]}`, o = t[r][0] > t[r - 1][0] ? v.Right : v.Left) : t[r][1] > t[r - 1][1] && t[r][0] !== t[r - 1][0] ? (l += ` H ${t[r][0]}`, l += ` V ${t[r][1]}`) : t[r][1] > t[r - 1][1] && t[r][0] === t[r - 1][0] && (l += ` V ${t[r][1]}`); break; case v.Top: t[r][1] > t[r - 1][1] && t[r][0] !== t[r - 1][0] ? (l += ` H ${t[r][0]}`, l += ` V ${t[r][1]}`, o = v.Bottom) : t[r][1] > t[r - 1][1] && t[r][0] === t[r - 1][0] ? (l += ` H ${t[r][0] - a}`, l += ` V ${t[r][1]}`, l += ` H ${t[r][0]}`, o = v.Right) : t[r][1] === t[r - 1][1] && t[r][0] !== t[r - 1][0] ? (l += ` H ${t[r][0]}`, o = t[r][0] > t[r - 1][0] ? v.Right : v.Left) : t[r][1] < t[r - 1][1] && t[r][0] !== t[r - 1][0] ? (l += ` H ${t[r][0]}`, l += ` V ${t[r][1]}`) : t[r][1] < t[r - 1][1] && t[r][0] === t[r - 1][0] && (l += ` V ${t[r][1]}`); break; case v.Right: t[r][0] < t[r - 1][0] && t[r][1] !== t[r - 1][1] ? (l += ` V ${t[r][1]}`, l += ` H ${t[r][0]}`, o = v.Left) : t[r][0] < t[r - 1][0] && t[r][1] === t[r - 1][1] ? (l += ` V ${t[r][1] + a}`, l += ` H ${t[r][0]}`, l += ` V ${t[r][1]}`, o = v.Top) : t[r][0] === t[r - 1][0] && t[r][1] !== t[r - 1][1] ? (l += ` V ${t[r][1]}`, o = t[r][1] > t[r - 1][1] ? v.Bottom : v.Top) : t[r][0] > t[r - 1][0] && t[r][1] !== t[r - 1][1] ? (l += ` V ${t[r][1]}`, l += ` H ${t[r][0]}`) : t[r][0] > t[r - 1][0] && t[r][1] === t[r - 1][1] && (l += ` H ${t[r][0]}`); break; case v.Left: t[r][0] > t[r - 1][0] && t[r][1] !== t[r - 1][1] ? (l += ` V ${t[r][1]}`, l += ` H ${t[r][0]}`, o = v.Right) : t[r][0] > t[r - 1][0] && t[r][1] === t[r - 1][1] ? (l += ` V ${t[r][1] - a}`, l += ` H ${t[r][0]}`, l += ` V ${t[r][1]}`, o = v.Bottom) : t[r][0] === t[r - 1][0] && t[r][1] !== t[r - 1][1] ? (l += ` V ${t[r][1]}`, o = t[r][1] > t[r - 1][1] ? v.Bottom : v.Top) : t[r][0] < t[r - 1][0] && t[r][1] !== t[r - 1][1] ? (l += ` V ${t[r][1]}`, l += ` H ${t[r][0]}`) : t[r][0] < t[r - 1][0] && t[r][1] === t[r - 1][1] && (l += ` H ${t[r][0]}`); break; } else t[r][0] !== t[r - 1][0] && (l += ` H ${t[r][0]}`, o = t[r][0] > t[r - 1][0] ? v.Right : v.Left), t[r][1] !== t[r - 1][1] && (l += ` V ${t[r][1]}`, o = t[r][1] > t[r - 1][1] ? v.Bottom : v.Top); break; } return l; } }, oi = (i, t) => { switch (i) { case "dotted": return `${t}`; case "dashed": return `${4 * t} ${t}`; case "gapped-dashes": return `${4 * t} ${4 * t}`; case "solid": default: return "none"; } }, j = (i, t) => { const e = i.indexOf(t); return e >= 0 && i.splice(e, 1), i; }; var Qt = /* @__PURE__ */ ((i) => (i.Ellipse = "ellipse", i.Empty = "empty", i.Folder = "folder", i.Hexagon = "hexagon", i.Octagon = "octagon", i.Pill = "pill", i.Rectangle = "rectangle", i.Rhombus = "rhombus", i.RoundedRectangle = "rounded-rectangle", i.StickyNote = "sticky-note", i))(Qt || {}); const pe = (i, t, e, s, a) => { if (typeof i == "function") return i(t, e, s, a); switch (i) { case "ellipse": return vi(t, e, s, a); case "empty": return Xi(); case "folder": return ji(t, e, s, a); case "hexagon": return Wi(t, e, s, a); case "octagon": return Zi(t, e, s, a); case "pill": return Zt(t, e, s, a); case "rectangle": return si(t, e, s, a); case "rhombus": return Ki(t, e, s, a); case "rounded-rectangle": return qi(t, e, s, a); case "sticky-note": return Ji(t, e, s, a); default: return si(t, e, s, a); } }, vi = (i, t, e, s) => `M ${i + e / 2} ${t} A ${e / 2} ${s / 2} 0 0 0 ${i + e / 2} ${t + s} A ${e / 2} ${s / 2} 0 1 0 ${i + e / 2} ${t} Z`, Xi = () => "Z", ji = (i, t, e, s) => `M ${i} ${t} L ${i + e / 3} ${t} L ${i + e / 2} ${t + s / 6} L ${i + e} ${t + s / 6} L ${i + e} ${t + s} L ${i} ${t + s} Z`, Wi = (i, t, e, s) => `M ${i + e / 4} ${t} L ${i + 3 * e / 4} ${t} L ${i + e} ${t + s / 2} L ${i + 3 * e / 4} ${t + s} L ${i + e / 4} ${t + s} L ${i} ${t + s / 2} Z`, Zi = (i, t, e, s) => `M ${i + e / 4} ${t} L ${i + 3 * e / 4} ${t} L ${i + e} ${t + s / 4} L ${i + e} ${t + 3 * s / 4} L ${i + 3 * e / 4} ${t + s} L ${i + e / 4} ${t + s} L ${i} ${t + 3 * s / 4} L ${i} ${t + s / 4} L ${i + e / 4} ${t} Z`, Zt = (i, t, e, s) => s < e ? `M ${i + s / 2} ${t} L ${i + e - s / 2} ${t} A ${s / 2} ${s / 2} 0 0 1 ${i + e} ${t + s / 2} A ${s / 2} ${s / 2} 0 0 1 ${i + e - s / 2} ${t + s} L ${i + s / 2} ${t + s} A ${s / 2} ${s / 2} 0 0 1 ${i} ${t + s / 2} A ${s / 2} ${s / 2} 0 0 1 ${i + s / 2} ${t} Z` : s > e ? `M ${i} ${t + e / 2} L ${i} ${t + s - e / 2} A ${e / 2} ${e / 2} 0 0 0 ${i + e / 2} ${t + s} A ${e / 2} ${e / 2} 0 0 0 ${i + e} ${t + s - e / 2} L ${i + e} ${t + e / 2} A ${e / 2} ${e / 2} 0 0 0 ${i + e / 2} ${t} A ${e / 2} ${e / 2} 0 0 0 ${i} ${t + e / 2} Z` : vi(i, t, e, s), si = (i, t, e, s) => `M ${i} ${t} L ${i + e} ${t} L ${i + e} ${t + s} L ${i} ${t + s} Z`, Ki = (i, t, e, s) => `M ${i + e / 2} ${t} L ${i + e} ${t + s / 2} L ${i + e / 2} ${t + s} L ${i} ${t + s / 2} Z`, qi = (i, t, e, s) => `M ${i + e / 4} ${t} L ${i + 3 * e / 4} ${t} A ${e / 4} ${s / 4} 0 0 1 ${i + e} ${t + s / 4} L ${i + e} ${t + 3 * s / 4} A ${e / 4} ${s / 4} 0 0 1 ${i + 3 * e / 4} ${t + s} L ${i + e / 4} ${t + s} A ${e / 4} ${s / 4} 0 0 1 ${i} ${t + 3 * s / 4} L ${i} ${t + s / 4} A ${e / 4} ${s / 4} 0 0 1 ${i + e / 4} ${t} Z`, Ji = (i, t, e, s) => `M ${i} ${t} L ${i + 3 * e / 4} ${t} L ${i + 3 * e / 4} ${t + s / 4} L ${i + 3 * e / 4} ${t} L ${i + e} ${t + s / 4} L ${i + 3 * e / 4} ${t + s / 4} L ${i + e} ${t + s / 4} L ${i + e} ${t + s} L ${i} ${t + s} Z`; var P = /* @__PURE__ */ ((i) => (i.AllScroll = "all-scroll", i.Auto = "auto", i.Crosshair = "crosshair", i.EWResize = "ew-resize", i.Grab = "grab", i.Grabbing = "grabbing", i.Move = "move", i.NoDrop = "no-drop", i.NSResize = "ns-resize", i.NotAllowed = "not-allowed", i.ZoomIn = "zoom-in", i.ZoomOut = "zoom-out", i))(P || {}); const Qi = (i) => Math.max(...i.split(` `).map((t) => t.length)), to = (i) => { var t; return ((t = i.match(/\n/g)) == null ? void 0 : t.length) || 0; }, J = []; for (let i = 0; i < 256; ++i) J.push((i + 256).toString(16).slice(1)); function eo(i, t = 0) { return (J[i[t + 0]] + J[i[t + 1]] + J[i[t + 2]] + J[i[t + 3]] + "-" + J[i[t + 4]] + J[i[t + 5]] + "-" + J[i[t + 6]] + J[i[t + 7]] + "-" + J[i[t + 8]] + J[i[t + 9]] + "-" + J[i[t + 10]] + J[i[t + 11]] + J[i[t + 12]] + J[i[t + 13]] + J[i[t + 14]] + J[i[t + 15]]).toLowerCase(); } let le; const io = new Uint8Array(16); function oo() { if (!le) { if (typeof crypto > "u" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); le = crypto.getRandomValues.bind(crypto); } return le(io); } const so = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ni = { randomUUID: so }; function ri(i, t, e) { var a; if (ni.randomUUID && !i) return ni.randomUUID(); i = i || {}; const s = i.random ?? ((a = i.rng) == null ? void 0 : a.call(i)) ?? oo(); if (s.length < 16) throw new Error("Random bytes length must be >= 16"); return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, eo(s); } const rt = (i) => { const { selected: t, highlighted: e, ...s } = i, a = s, l = { ...a, ...t }, o = { ...a, ...e }, n = { ...a, ...e, ...t }; return { defaultLook: a, selectedLook: l, highlightedLook: o, selectedAndHighlightedLook: n }; }; class te { constructor() { this.entities = [], this.entityMap = {}; } /** * The number of entities in this set. * @public */ get length() { return this.size(); } /** * Gets all of the entities of this set. * @public * @returns An array containing all of the entities of this set. */ all() { return [...this.entities]; } /** * Adds an entity to this set if there are no entities with the same id. Has no effect if there already exists an entity with the same id as the given entity. * For creating entities with relationships with other entities, the new() method should be used instead. The add() method adds an entity but doesn't take care of setting that entity's relationships with other entities. * @private * @param entity An entity to be added to this set. */ add(t) { this.entityMap[t.id] === void 0 && (this.entityMap[t.id] = t, this.entities.push(t)); } /** * Removes all the entities in this set. * @public */ clear() { for (; this.entities.length > 0; ) this.remove(this.entities[0].id); } /** * Checks if this set contains an entity with the given id. * @public * @param id An id. * @returns `true` if this set contains an entity with the given id, `false` otherwise. */ contains(t) { return this.entityMap[t] !== void 0; } /** * Counts the number of entities of this set following the given criteria. * @public * @returns The number of entities of this set following the given criteria. */ count(t) { return this.entities.filter(t).length; } /** * Gets all of the entities of this set filtered following given criteria. * @public * @returns An array containing the entities of this set that meet the given criteria. */ filter(t) { return this.entities.filter(t); } /** * Gets an entity of this set matching specific criteria. * @public * @returns An entity of this set. */ find(t) { return this.entities.find(t); } /** * Gets an entity from this set. * @public * @param id An id. * @returns An entity with the given id, or `undefined` if there are no entities with the given id. */ get(t) { return this.entityMap[t]; } /** * Gets all of the entities of this set mapped to the result of the given function applied to them. * @public * @returns An array containing the entities of this set that meet the given criteria. */ map(t) { return this.entities.map(t); } /** * Attempts to find and remove an entity with the given id. Has no effect if there are no entities with the given id. * @public * @param id An id. */ remove(t) { const e = this.get(t); e !== void 0 && (delete this.entityMap[t], j(this.entities, e)); } /** * Gets the number of entities in this set. * @public */ size() { return this.entities.length; } /** * Iterator to iterate over the entities of this set. * @public */ *[Symbol.iterator]() { for (const t of this.entities) yield t; } } const ye = (i) => i.replace(/([!"#$%&'()*+,\-./:;<=>?@[\\\]^`{|}])/g, "\\$1"), Vt = 0; class $t { constructor(t, e) { this.selfRemoved = !1, this.selfRemovedTimestamp = null, this.model = t, this._id = e; } /** * Identifier that uniquely identifies this element within its diagram model. Cannot be an empty string. * @public */ get id() { return this._id; } /** * Whether this diagram element is currently in the user highlight. * @private */ get highlighted() { var t, e; return ((e = (t = this.model.canvas) == null ? void 0 : t.userHighlight) == null ? void 0 : e.contains(this.id)) || !1; } /** * Whether this diagram element is currently in the user selection. */ get selected() { var t, e; return ((e = (t = this.model.canvas) == null ? void 0 : t.userSelection) == null ? void 0 : e.contains(this.id)) || !1; } /** * Obtain the selection of this element. * @private */ select() { var t, e; return (e = (t = this.model.canvas) == null ? void 0 : t.selectCanvasView()) == null ? void 0 : e.select(`[id='${ye(this.id)}']`); } } class vt extends te { all(t = !1) { return t ? super.all() : super.filter((e) => !e.removed); } contains(t, e = !1) { return e ? super.contains(t) : super.contains(t) && !this.entityMap[t].removed; } count(t, e = !1) { return e ? super.count(t) : super.count((s, a, l) => t(s, a, l) && !s.removed); } filter(t, e = !1) { return e ? super.filter(t) : super.filter((s, a, l) => t(s, a, l) && !s.removed); } find(t, e = !1) { return e ? super.find(t) : super.find((s, a, l) => t(s, a, l) && !s.removed); } get(t, e = !1) { return e ? super.get(t) : this.contains(t) ? super.get(t) : void 0; } map(t, e = !1) { return e ? super.map(t) : super.filter((s) => !s.removed).map(t); } remove(t) { const e = this.get(t, !0); e !== void 0 && (delete this.entityMap[t], j(this.entities, e)); } size(t = !1) { return t ? super.size() : super.filter((e) => !e.removed).length; } *[Symbol.iterator](t = !1) { if (t) for (const e of this.entities) yield e; else for (const e of this.entities.filter((s) => !s.removed)) yield e; } } class no { constructor(t, e, s, a, l, o) { this.name = t, this.type = e, this.defaultValue = s, this.basic = a, this.editable = l, this.rootAttribute = o, this.options = void 0, this.properties = void 0; } } var _ = /* @__PURE__ */ ((i) => (i.Boolean = "boolean", i.Color = "color", i.Date = "date", i.Datetime = "datetime", i.Number = "number", i.Object = "object", i.Option = "option", i.OptionList = "option-list", i.OptionSet = "option-set", i.Text = "text", i.TextArea = "text-area", i.TextList = "text-list", i.TextSet = "text-set", i.TextMap = "text-map", i.Time = "time", i.Url = "url", i))(_ || {}); class ee { constructor(t = []) { this.propertyList = t, this.propertyMap = {}; for (const e of this.propertyList) this.propertyMap[e.name] = e; } getProperty(t) { return this.propertyMap[t]; } hasProperty(t) { return this.propertyMap[t] !== void 0; } hasProperties() { return this.propertyList.length > 0; } } function At(i, t) { return !t || i[0] > t[0] ? !0 : i[0] === t[0] ? i[1] >= t[1] : !1; } const ai = (i) => i == null || i === "" || i instanceof Array && i.length === 0 || i instanceof Object && Object.keys(i).length === 0, Et = (i, t) => i === t || JSON.stringify(i) === JSON.stringify(t), bi = (i, t, e) => { const s = {}, a = {}; for (const l in e.propertySet.propertyMap) if (e.propertySet.propertyMap[l].type === _.Object) { const o = bi( i[l], t[l], e.getSubValueSet(l) ); Object.keys(o[0]).length > 0 && Object.keys(o[1]).length > 0 && (s[l] = o[0], a[l] = o[1]); } else Et(i[l], t[l]) || (s[l] = i[l], a[l] = t[l]); return [s, a]; }, ro = (i) => i != null && i.constructor === Object; class St { constructor(t, e) { this.displayedProperties = [], this.hiddenProperties = [], this.values = {}, this.valueSets = {}, this.ownTimestamps = {}, this.propertySet = t, this.rootElement = e, this.resetValues(); } /** * Gets the value of the root element attribute under the given keys. * If given an array of keys, the value is found under repeated lookups to enable obtaining nested values. * @public * @param rootAttribute A key or array of keys to look up in the root element. * @returns The value if it could be found, `undefined` if nothing could be found. */ getRootElementValue(t) { if (typeof t == "string") return this.rootElement[t]; if (Array.isArray(t) && t.length > 0) { let e = this.rootElement; for (const s of t) { if (e == null) return; e = e[s]; } return e; } } /** * Sets the value of the root element's attribute under the given keys. * If given an array of keys, the value is found under repeated lookups to enable setting nested values. * If the root element has a function `updateInView()`, it is called upon successful setting of the value. * If the root element's attribute doesn't exist, it does nothing. * @private * @param rootAttribute A key or array of keys to look up in the root element. * @param value The value to set the root element's attribute to. */ setRootElementValue(t, e) { if (typeof t == "string" && (this.rootElement[t] = e), Array.isArray(t) && t.length > 0) { let s = this.rootElement; for (let a = 0; a < t.length - 1; ++a) { const l = t[a]; if (s == null) return; s = s[l]; } if (s == null) return; s[t[t.length - 1]] = e; } typeof this.rootElement.updateInView == "function" && this.rootElement.updateInView(); } /** * Obtains the value under the given key. * @private * @param key A key. * @returns The value under the given key. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any getValue(t) { var a; const e = (a = this.propertySet.getProperty(t)) == null ? void 0 : a.rootAttribute; return e != null && (this.values[t] = this.getRootElementValue(e)), this.propertySet.getProperty(t).type === _.Object ? this.valueSets[t].getValues() : this.values[t]; } /** * Obtains all the values in the set. * @private * @returns An object containing all the values in the set. */ getValues() { const t = {}; for (const e in this.propertySet.propertyMap) this.propertySet.getProperty(e).type === _.Object ? t[e] = this.valueSets[e].getValues() : t[e] = this.getValue(e); return t; } /** * Returns the values for all keys present in the given object, including keys in sub-objects. * @private * @param values An object containing all values for keys present in the given object. */ getValuesForKeys(t) { const e = {}; for (const s in t) this.propertySet.getProperty(s).type === _.Object ? e[s] = this.valueSets[s].getValuesForKeys( t[s] ) : e[s] = this.getValue(s); return e; } /** * Obtains all CollabTimestamps in the set, including those corresponding to nested keys. * @private * @returns An object containing all the CollabTimestamps in the set. */ getTimestamps() { const t = {}; for (const e in this.propertySet.propertyMap) if (this.propertySet.getProperty(e).type === _.Object) t[e] = this.valueSets[e].getTimestamps(); else { const a = this.ownTimestamps[e]; a && (t[e] = a); } return t; } /** * Checks if the value under the key is not empty. * @private * @param key A key. * @returns `true` if the value under the key is empty, `false` otherwise. */ hasValue(t) { const e = this.getValue(t); return !ai(e); } /** * Checks if the value under the key is not empty or the default value. * @private * @param key A key. * @returns `true` if the value under the key is not empty or the default value, `false` otherwise. */ hasSetValue(t) { const e = this.getValue(t), s = this.propertySet.getProperty(t); return s && s.type === _.Object ? this.getSubValueSet(t).hasAnySetValue() : !ai(e) && !Et(e, s == null ? void 0 : s.defaultValue); } /** * Checks if any of the values in the set are not empty or the default value. * @private * @returns `true` if any of the values in the set are not empty or the default value, `false` otherwise. */ hasAnySetValue() { for (const t of this.propertySet.propertyList) if (this.hasSetValue(t.name)) return !0; return !1; } /** * Sets the value under the given key. * @private * @param key A key. * @param value A value. */ setValue(t, e) { const s = this.propertySet.getProperty(t); if (s) { s.type === _.Object ? this.valueSets[t].setValues(e) : (this.values[t] = e, Et(e, s.defaultValue) || this.displayProperty(s)); const a = s.rootAttribute; a != null && this.setRootElementValue(a, e); } } /** * Resets all values and then set them to the given values. * @private * @param values An object containing all values to set the values to. */ setValues(t) { this.resetValues(); for (const e in t) this.propertySet.getProperty(e).type === _.Object ? this.valueSets[e].setValues( t[e] ) : this.setValue(e, t[e]); } /** * Resets all timestamps and then set them to the given timestamps. * @private * @param values An object containing all the CollabTimestamps in the set. */ setTimestamps(t) { this.ownTimestamps = {}; for (const e in t) this.propertySet.getProperty(e).type === _.Object ? this.valueSets[e].setTimestamps( t[e] ) : this.ownTimestamps[e] = t[e]; } /** * Writes the given values over the value set's existing values without resetting the existing values. * @private * @param values An object containing all values to set the values to. */ overwriteValues(t) { for (const e in t) this.propertySet.getProperty(e).type === _.Object ? this.valueSets[e].overwriteValues( t[e] ) : this.setValue(e, t[e]); } /** * Variant of `overwriteValues` that applies last-writer-wins to each key, updating timestamps if appropriate. * @private * @param values An object containing all values to set the values to. */ overwriteValuesLww(t, e) { for (const s in t) this.propertySet.getProperty(s).type === _.Object ? this.valueSets[s].overwriteValuesLww( t[s], e ) : At(e, this.ownTimestamps[s]) && (this.setValue(s, t[s]), this.ownTimestamps[s] = e); } /** * Sets all the values of this set to the defaults. * If this set has a root element and any of its properties have root attributes, the root element's attributes are also set to the property's default value if one is provided. * @private */ resetValues() { this.displayedProperties = [], this.hiddenProperties = [], this.ownTimestamps = {}; for (const t in this.propertySet.propertyMap) { const e = this.propertySet.getProperty(t), s = e.rootAttribute; e.type === _.Object ? this.valueSets[t] = this.constructSubValueSet(t) : this.values[t] = structuredClone(e.defaultValue), s != null && e.defaultValue !== void 0 && !Et( this.getRootElementValue(s), e.defaultValue ) && this.setRootElementValue(s, this.values[t]), e.basic ? this.displayedProperties.push(e) : this.hiddenProperties.push(e); } } /** * Constructs a ValueSet with its corresponding PropertySet representing the values of the object. * @private * @param key Key that the ValueSet is under. * @returns The constructed ValueSet. */ constructSubValueSet(t) { const e = this.propertySet.getProperty(t), s = new ee(e.properties), a = new St(s, this.rootElement); return a.overwriteValues( structuredClone(e.defaultValue) ), a; } /** * Gets the ValueSet under the given key when there are nested ValueSets. * @private * @param key A key. * @returns A ValueSet. */ getSubValueSet(t) { return this.valueSets[t]; } /** * Moves the given property to the list of displayed properties. * @private * @param property A property. */ displayProperty(t) { this.displayedProperties.includes(t) || (this.displayedProperties.push(t), j(this.hiddenProperties, t)); } /** * Moves the given property to the list of hidden properties. * @private * @param property A property. */ hideProperty(t) { this.hiddenProperties.includes(t) || (this.hiddenProperties.push(t), j(this.displayedProperties, t)); } } const ao = { name: "", label: null, look: { lookType: "connection-look", color: "#000000", thickness: 1, shape: pi.Straight, style: yi.Solid, selected: { color: "#AA00AA" }, highlighted: { thickness: 2 } }, startMarkerLook: void 0, endMarkerLook: void 0, startTypes: [], endTypes: [], properties: [] }; class ki { constructor(t) { const e = { ...ao, ...t }; this.id = e.id, this.name = e.name, this.label = e.label; const s = rt(e.look); if (this.defaultLook = s.defaultLook, this.selectedLook = s.selectedLook, this.highlightedLook = s.highlightedLook, this.selectedAndHighlightedLook = s.selectedAndHighlightedLook, e.startMarkerLook !== void 0) { const a = rt( e.startMarkerLook ); this.defaultStartMarkerLook = a.defaultLook, this.selectedStartMarkerLook = a.selectedLook, this.highlightedStartMarkerLook = a.highlightedLook, this.selectedAndHighlightedStartMarkerLook = a.selectedAndHighlightedLook; } else this.defaultStartMarkerLook = null, this.selectedStartMarkerLook = null, this.highlightedStartMarkerLook = null, this.selectedAndHighlightedStartMarkerLook = null; if (e.endMarkerLook !== void 0) { const a = rt( e.endMarkerLook ); this.defaultEndMarkerLook = a.defaultLook, this.selectedEndMarkerLook = a.selectedLook, this.highlightedEndMarkerLook = a.highlightedLook, this.selectedAndHighlightedEndMarkerLook = a.selectedAndHighlightedLook; } else this.defaultEndMarkerLook = null, this.selectedEndMarkerLook = null, this.highlightedEndMarkerLook = null, this.selectedAndHighlightedEndMarkerLook = null; this.startTypes = e.startTypes, this.endTypes = e.endTypes, this.propertySet = new ee(e.properties); } canStartFromType(t) { return this.startTypes.indexOf(t) >= 0; } canFinishOnType(t) { return this.endTypes.indexOf(t) >= 0; } } class gt extends $t { constructor(t, e, s, a, l) { if (t.connections.get(l) !== void 0) throw new Error(`DiagramConnection with id "${l}" already exists`); if (!l) throw new Error("DiagramConnection cannot have an empty or null id"); super(t, l), this.startCoords = [0, 0], this.endCoords = [0, 0], this.startLabel = "", this.middleLabel = "", this.endLabel = "", this.points = [], this._type = e, this.valueSet = new St(e.propertySet, this), this.originalData = {}, this.setStart(s), this.setEnd(a); } get type() { return this._type; } set type(t) { var e, s; (s = (e = this.model.canvas) == null ? void 0 : e.userSelection) == null || s.openInPropertyEditor(void 0), this._type = t, this.valueSet && (this.valueSet = new St(t.propertySet, this)), this.updateInView(); } get typeString() { return this.type.id; } set typeString(t) { const e = this.model.connections.types.get(t); e && (this.type = e); } /** * Name of this connection. Alias for this connection's middle label. * @public */ get name() { return this.middleLabel; } set name(t) { this.middleLabel = t; } /** * Current look of the connection. * @private */ get look() { return this.selected ? this.highlighted ? this._selectedAndHighlightedLook !== void 0 ? this._selectedAndHighlightedLook : this.type.selectedAndHighlightedLook : this._selectedLook !== void 0 ? this._selectedLook : this.type.selectedLook : this.highlighted ? this._highlightedLook !== void 0 ? this._highlightedLook : this.type.highlightedLook : this._defaultLook !== void 0 ? this._defaultLook : this.type.defaultLook; } /** * Sets the look configuration of the connection to override the one determined by the type. * `undefined` resets it to the one determined by the type. * @private */ set look(t) { if (t) { const e = rt(t); this._defaultLook = { ...this._defaultLook, ...e.defaultLook }, this._selectedLook = { ...this._selectedLook, ...e.selectedLook }, this._highlightedLook = { ...this._highlightedLook, ...e.highlightedLook }, this._selectedAndHighlightedLook = { ...this._selectedAndHighlightedLook, ...e.selectedAndHighlightedLook }; } else this._defaultLook = t, this._selectedLook = t, this._highlightedLook = t, this._selectedAndHighlightedLook = t; } /** * Current look of the start marker. * @private */ get startMarkerLook() { return this.selected ? this.highlighted ? this._selectedAndHighlightedStartMarkerLook !== void 0 ? this._selectedAndHighlightedStartMarkerLook : this.type.selectedAndHighlightedStartMarkerLook : this._selectedStartMarkerLook !== void 0 ? this._selectedStartMarkerLook : this.type.selectedStartMarkerLook : this.highlighted ? this._highlightedStartMarkerLook !== void 0 ? this._highlightedStartMarkerLook : this.type.highlightedStartMarkerLook : this._defaultStartMarkerLook !== void 0 ? this._defaultStartMarkerLook : this.type.defaultStartMarkerLook; } /** * Sets the look configuration of the start marker to override the one determined by the type. * `null` stands for no marker and `undefined` resets it to the one determined by the type. * @private */ set startMarkerLook(t) { if (t) { const e = rt(t); this._defaultStartMarkerLook = { ...this._defaultStartMarkerLook, ...e.defaultLook }, this._selectedStartMarkerLook = { ...this._selectedStartMarkerLook, ...e.selectedLook }, this._highlightedStartMarkerLook = { ...this._highlightedStartMarkerLook, ...e.highlightedLook }, this._selectedAndHighlightedStartMarkerLook = { ...this._selectedAndHighlightedStartMarkerLook, ...e.selectedAndHighlightedLook }; } else this._defaultStartMarkerLook = t, this._selectedStartMarkerLook = t, this._highlightedStartMarkerLook = t, this._selectedAndHighlightedStartMarkerLook = t; } /** * Current look of the end marker. * @private */ get endMarkerLook() { return this.selected ? this.highlighted ? this._selectedAndHighlightedEndMarkerLook !== void 0 ? this._selectedAndHighlightedEndMarkerLook : this.type.selectedAndHighlightedEndMarkerLook : this._selectedEndMarkerLook !== void 0 ? this._selectedEndMarkerLook : this.type.selectedEndMarkerLook : this.highlighted ? this._highlightedEndMarkerLook !== void 0 ? this._highlightedEndMarkerLook : this.type.highlightedEndMarkerLook : this._defaultEndMarkerLook !== void 0 ? this._defaultEndMarkerLook : this.type.defaultEndMarkerLook; } /** * Sets the look configuration of the end marker to override the one determined by the type. * `null` stands for no marker and `undefined` resets it to the one determined by the type. * @private */ set endMarkerLook(t) { if (t) { const e = rt(t); this._defaultEndMarkerLook = { ...this._defaultEndMarkerLook, ...e.defaultLook }, this._selectedEndMarkerLook = { ...this._selectedEndMarkerLook, ...e.selectedLook }, this._highlightedEndMarkerLook = { ...this._highlightedEndMarkerLook, ...e.highlightedLook }, this._selectedAndHighlightedEndMarkerLook = { ...this._selectedAndHighlightedEndMarkerLook, ...e.selectedAndHighlightedLook }; } else this._defaultEndMarkerLook = t, this._selectedEndMarkerLook = t, this._highlightedEndMarkerLook = t, this._selectedAndHighlightedEndMarkerLook = t; } get removed() { return this.selfRemoved || this.start !== void 0 && this.start.removed || this.end !== void 0 && this.end.removed; } updateInView() { var t; (t = this.model.canvas) == null || t.updateConnectionsInView(this.id); } raise() { var t; (t = this.select()) == null || t.raise(); } /** * Set the start of this connection to the given port or reset this connection's starting port if `undefined`. * Add or remove this connection from the list of outgoing connections of ports correspondingly. * @public * @param start A port. */ setStart(t) { this.start !== t ? (this.start !== void 0 && j(this.start.outgoingConnections, this), this.start = t, t !== void 0 && (t.outgoingConnections.push(this), this.startDirection = t == null ? void 0 : t.direction, this.startCoords = (t == null ? void 0 : t.connectionPoint) || [0, 0])) : (this.startDirection = t == null ? void 0 : t.direction, this.startCoords = (t == null ? void 0 : t.connectionPoint) || [0, 0]), this.updateInView(); } /** * Set the end of this connection to the given port or reset this connection's ending port if `undefined`. * Add or remove this connection from the list of incoming connections of ports correspondingly. * @public * @param end A port. */ setEnd(t) { this.end !== t ? (this.end !== void 0 && j(this.end.incomingConnections, this), this.end = t, t !== void 0 && (t.incomingConnections.push(this), this.endDirection = t == null ? void 0 : t.direction, this.endCoords = (t == null ? void 0 : t.connectionPoint) || [0, 0])) : (this.endDirection = t == null ? void 0 : t.direction, this.endCoords = (t == null ? void 0 : t.connectionPoint) || [0, 0]), this.updateInView(); } /** * Reassign the start and end ports of this connection to ports with less distance between them that have the same root element. * If no ports with less distance between them are found, do nothing. * @public */ tighten() { var t, e; if ((t = this.start) != null && t.rootElement && this.end) { const s = this.start.rootElement.ports.map((a) => [ a, a.distanceTo(this.end.coords) ]).sort((a, l) => a[1] - l[1]).map((a) => a[0]); t: for (const a of s) { if (a === this.end || !a.allowsOutgoing) continue t; { for (const l of a.outgoingConnections) if (l !== this && l.end === this.end) continue t; for (const l of a.incomingConnections) if (l !== this && l.start === this.end) continue t; } if (a === this.start) break t; this.setStart(a); break t; } } if ((e = this.end) != null && e.rootElement && this.start) { const s = this.end.rootElement.ports.map((a) => [ a, a.distanceTo(this.start.coords) ]).sort((a, l) => a[1] - l[1]).map((a) => a[0]); t: for (const a of s) { if (a === this.start || !a.allowsIncoming) continue t; { for (const l of a.incomingConnections) if (l !== this && l.start === this.start) continue t; for (const l of a.outgoingConnections) if (l !== this && l.end === this.start) continue t; } if (a === this.end) break t; this.setEnd(a); break t; } } } getPriority() { return this.start ? this.end ? Math.min(this.start.getPriority(), this.end.getPriority()) : this.start.getPriority() : this.end ? this.end.getPriority() : Vt; } } class lo extends vt { /** * Instance a set of connections for the given model. This method is used internally. * @private */ constructor(t) { super(), this.types = new te(), this.model = t; } /** * Instance a new connection and add it to this set. * @public * @param type The type of the connection given as either the type itself or the id of the type. * @param start The start port of the connection. * @param end The end port of the connection. * @param id The id of the connection. Cannot be an empty string. * @returns The instanced connection. */ new(t, e, s, a) { let l; if (t instanceof ki) l = t; else { const n = this.types.get(t); if (n === void 0) throw new TypeError( `Connection type with id '${t}' could not be found.` ); l = n; } const o = new gt( this.model, l, e, s, a ); return super.add(o), o.updateInView(), o.valueSet.resetValues(), o; } remove(t) { var s, a; const e = this.get(t, !0); e && (j(((s = e.start) == null ? void 0 : s.outgoingConnections) || [], e), j(((a = e.end) == null ? void 0 : a.incomingConnections) || [], e), super.remove(t), e.updateInView()); } } const D = { editable: !0, fontSize: 0, margin: 0, padding: 0, fontFamily: "'Wonder Unit Sans', sans-serif", color: "#000000", selectedColor: "#000000", horizontalAlign: Pt.Center, verticalAlign: Kt.Center, orientation: v.Top, fit: !1 }; class pt extends $t { constructor(t, e, s, a, l, o, n, r, d, h, c, f, p, m, u) { const g = `${e == null ? void 0 : e.id}_field`; if (t.fields.get(g) !== void 0) throw new Error("DiagramField for rootElement already exists"); super(t, g), this.textTimestamp = null, this.rootElement = e, this.coords = s, this.width = a, this.height = l, this.fontSize = o, this.fontFamily = n, this.color = r, this.selectedColor = d, this.horizontalAlign = h, this.verticalAlign = c, this.orientation = f, this.defaultText = p, this._text = p, this.editable = m, this.fit = u; } /** * Text contents of this field. * @public */ get text() { return this._text; } set text(t) { var e; (t == null || (t == null ? void 0 : t.trim()) === "") && (t = this.defaultText), this._text = t, this.updateInView(), this.fit && ((e = this.model.canvas) == null || e.fitFieldRootInView(this.id)); } get removed() { return this.selfRemoved || this.rootElement !== void 0 && this.rootElement.removed; } updateInView() { var t; (t = this.model.canvas) == null || t.updateFieldsInView(this.id); } raise() { var t; (t = this.select()) == null || t.raise(); } /** * Change the coordinates of this field to the given coordinates. * @public * @param coords A point in the diagram. */ move(t) { this.coords = t, this.updateInView(); } getPriority() { var t; return ((t = this.rootElement) == null ? void 0 : t.getPriority()) || Vt; } } class co extends vt { /** * Instance a set of fields for the given model. This method is used internally. * @private */ constructor(t) { super(), this.model = t; } /** * Instance a new field and add it to this set. This method is normally called when instancing an element with a field and it is rarely called by itself. * @private */ new(t, e, s, a, l, o, n, r, d, h, c, f, p, m) { const u = new pt( this.model, t, e, n, r, s, a, l, o, d, h, c, f, p, m ); return super.add(u), u.updateInView(), t !== void 0 && (t.label = u), u; } remove(t) { var s; const e = this.get(t, !0); e && (((s = e.rootElement) == null ? void 0 : s.label) !== void 0 && e.rootElement.label === e && (e.rootElement.label = void 0), super.remove(t), e.updateInView()); } } const st = (i) => (i == null ? void 0 : i.margin) === null || (i == null ? void 0 : i.margin) === void 0 ? D.margin : typeof i.margin == "number" ? i.margin : i.margin.length === 0 ? D.margin : i.margin.length === 1 || i.margin.length === 2 ? i.margin[0] : (i.margin.length === 3, i.margin[2]), K = (i) => (i == null ? void 0 : i.margin) === null || (i == null ? void 0 : i.margin) === void 0 ? D.margin : typeof i.margin == "number" ? i.margin : i.margin.length === 0 ? D.margin : i.margin.length === 1 ? i.margin[0] : i.margin.length === 2 || i.margin.length === 3 ? i.margin[1] : i.margin[3], lt = (i) => (i == null ? void 0 : i.margin) === null || (i == null ? void 0 : i.margin) === void 0 ? D.margin : typeof i.margin == "number" ? i.margin : i.margin.length === 0 ? D.margin : i.margin.length === 1 ? i.margin[0] : (i.margin.length === 2 || i.margin.length === 3, i.margin[1]), X = (i) => (i == null ? void 0 : i.margin) === null || (i == null ? void 0 : i.margin) === void 0 ? D.margin : typeof i.margin == "number" ? i.margin : i.margin.length === 0 ? D.margin : (i.margin.length === 1 || i.margin.length === 2 || i.margin.length === 3, i.margin[0]), Dt = (i) => (i == null ? void 0 : i.padding) === null || (i == null ? void 0 : i.padding) === void 0 ? D.padding : typeof i.padding == "number" ? i.padding : i.padding.length === 0 ? D.padding : i.padding.length === 1 || i.padding.length === 2 ? i.padding[0] : (i.padding.length === 3, i.padding[2]), Ht = (i) => (i == null ? void 0 : i.padding) === null || (i == null ? void 0 : i.padding) === void 0 ? D.padding : typeof i.padding == "number" ? i.padding : i.padding.length === 0 ? D.padding : i.padding.length === 1 ? i.padding[0] : i.padding.length === 2 || i.padding.length === 3 ? i.padding[1] : i.padding[3], Gt = (i) => (i == null ? void 0 : i.padding) === null || (i == null ? void 0 : i.padding) === void 0 ? D.padding : typeof i.padding == "number" ? i.padding : i.padding.length === 0 ? D.padding : i.padding.length === 1 ? i.padding[0] : (i.padding.length === 2 || i.padding.length === 3, i.padding[1]), Ft = (i) => (i == null ? void 0 : i.padding) === null || (i == null ? void 0 : i.padding) === void 0 ? D.padding : typeof i.padding == "number" ? i.padding : i.padding.length === 0 ? D.padding : (i.padding.length === 1 || i.padding.length === 2 || i.padding.length === 3, i.padding[0]), li = 1, di = 1, ho = 1, go = 1; class uo { constructor(t) { this.margin = t.margin || 0, this.defaultWidths = t.defaultWidths || null, this.defaultHeights = t.defaultHeights || null, this.minWidths = t.minWidths || null, this.minHeights = t.minHeights || null, this.sections = []; for (const e of t.sections) { const s = []; this.sections.push(s); for (const a of e) s.push(new mo(a)); } } } class mo { constructor(t) { this.label = t.label || null, this.ports = t.ports || [], this.priority = t.priority || Vt; const e = rt(t.look || wi); this.defaultLook = e.defaultLook, this.selectedLook = e.selectedLook, this.highlightedLook = e.highlightedLook, this.selectedAndHighlightedLook = e.selectedAndHighlightedLook; } } class Y extends $t { constructor(t, e, s, a, l, o, n, r) { if (t.sections.get(r) !== void 0) throw new Error(`DiagramSection with id "${r}" already exists`); if (!r) throw new Error("DiagramSection cannot have an empty or null id"); super(t, r), this.ports = [], this.decorators = [], this.node = e, this.indexXInNode = s, this.indexYInNode = a, this.coords = l, this.width = o, this.height = n; } /** * Name of this section. Alias for this section's label's text. * @public */ get name() { var t; return ((t = this.label) == null ? void 0 : t.text) || ""; } set name(t) { this.label && (this.label.text = t); } /** * Current look of this port. * @private */ get look() { var t,