@metadev/daga 5.1.2 → 5.1.3

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.cjs.js CHANGED
@@ -122,6 +122,53 @@ exports.VerticalAlign = void 0;
122
122
  VerticalAlign["Bottom"] = "bottom";
123
123
  })(exports.VerticalAlign || (exports.VerticalAlign = {}));
124
124
 
125
+ /******************************************************************************
126
+ Copyright (c) Microsoft Corporation.
127
+
128
+ Permission to use, copy, modify, and/or distribute this software for any
129
+ purpose with or without fee is hereby granted.
130
+
131
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
132
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
133
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
134
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
135
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
136
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
137
+ PERFORMANCE OF THIS SOFTWARE.
138
+ ***************************************************************************** */
139
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
140
+
141
+
142
+ function __rest(s, e) {
143
+ var t = {};
144
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
145
+ t[p] = s[p];
146
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
147
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
148
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
149
+ t[p[i]] = s[p[i]];
150
+ }
151
+ return t;
152
+ }
153
+
154
+ function __classPrivateFieldGet(receiver, state, kind, f) {
155
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
156
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
157
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
158
+ }
159
+
160
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
161
+ if (kind === "m") throw new TypeError("Private method is not writable");
162
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
163
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
164
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
165
+ }
166
+
167
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
168
+ var e = new Error(message);
169
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
170
+ };
171
+
125
172
  /**
126
173
  * Round the coordinates of the given point to the nearest whole number.
127
174
  * @public
@@ -1214,40 +1261,6 @@ const clone = o => {
1214
1261
  return res;
1215
1262
  };
1216
1263
 
1217
- /******************************************************************************
1218
- Copyright (c) Microsoft Corporation.
1219
-
1220
- Permission to use, copy, modify, and/or distribute this software for any
1221
- purpose with or without fee is hereby granted.
1222
-
1223
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1224
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1225
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1226
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1227
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1228
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1229
- PERFORMANCE OF THIS SOFTWARE.
1230
- ***************************************************************************** */
1231
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1232
-
1233
-
1234
- function __rest(s, e) {
1235
- var t = {};
1236
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1237
- t[p] = s[p];
1238
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
1239
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1240
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1241
- t[p[i]] = s[p[i]];
1242
- }
1243
- return t;
1244
- }
1245
-
1246
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1247
- var e = new Error(message);
1248
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1249
- };
1250
-
1251
1264
  /**
1252
1265
  * Converts a configuration for a look into an easier to consult object of fully qualified looks for each case.
1253
1266
  *
@@ -1505,6 +1518,7 @@ const diffProperties = (a, b, valueSet) => {
1505
1518
  */
1506
1519
  const isObject = x => x !== undefined && x !== null && x.constructor === Object;
1507
1520
 
1521
+ var _ValueSet_instances, _a$1, _ValueSet_values, _ValueSet_valueSets, _ValueSet_ownTimestamps, _ValueSet_constructSubValueSet;
1508
1522
  /**
1509
1523
  * A set of values corresponding to a set of properties.
1510
1524
  * @public
@@ -1512,17 +1526,18 @@ const isObject = x => x !== undefined && x !== null && x.constructor === Object;
1512
1526
  */
1513
1527
  class ValueSet {
1514
1528
  constructor(propertySet, rootElement) {
1529
+ _ValueSet_instances.add(this);
1515
1530
  this.displayedProperties = [];
1516
1531
  this.hiddenProperties = [];
1517
- this.values = {};
1518
- this.valueSets = {};
1532
+ _ValueSet_values.set(this, {});
1533
+ _ValueSet_valueSets.set(this, {});
1519
1534
  /**
1520
1535
  * Collaborative timestamps for all keys in this.values that have ever been set,
1521
1536
  * even if since they've since been set to the default value.
1522
1537
  *
1523
1538
  * Object values (in this.valueSets) store their own timestamps separately.
1524
1539
  */
1525
- this.ownTimestamps = {};
1540
+ _ValueSet_ownTimestamps.set(this, {});
1526
1541
  this.propertySet = propertySet;
1527
1542
  this.rootElement = rootElement;
1528
1543
  this.resetValues();
@@ -1597,16 +1612,16 @@ class ValueSet {
1597
1612
  */
1598
1613
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1599
1614
  getValue(key) {
1600
- var _a;
1601
- const rootAttribute = (_a = this.propertySet.getProperty(key)) === null || _a === void 0 ? void 0 : _a.rootAttribute;
1615
+ var _b;
1616
+ const rootAttribute = (_b = this.propertySet.getProperty(key)) === null || _b === void 0 ? void 0 : _b.rootAttribute;
1602
1617
  if (rootAttribute !== undefined && rootAttribute !== null) {
1603
- this.values[key] = this.getRootElementValue(rootAttribute);
1618
+ __classPrivateFieldGet(this, _ValueSet_values, "f")[key] = this.getRootElementValue(rootAttribute);
1604
1619
  }
1605
1620
  const property = this.propertySet.getProperty(key);
1606
1621
  if (property.type === exports.Type.Object) {
1607
- return this.valueSets[key].getValues();
1622
+ return __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getValues();
1608
1623
  } else {
1609
- return this.values[key];
1624
+ return __classPrivateFieldGet(this, _ValueSet_values, "f")[key];
1610
1625
  }
1611
1626
  }
1612
1627
  /**
@@ -1619,7 +1634,7 @@ class ValueSet {
1619
1634
  for (const key in this.propertySet.propertyMap) {
1620
1635
  const property = this.propertySet.getProperty(key);
1621
1636
  if (property.type === exports.Type.Object) {
1622
- result[key] = this.valueSets[key].getValues();
1637
+ result[key] = __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getValues();
1623
1638
  } else {
1624
1639
  result[key] = this.getValue(key);
1625
1640
  }
@@ -1636,7 +1651,7 @@ class ValueSet {
1636
1651
  for (const key in keys) {
1637
1652
  const property = this.propertySet.getProperty(key);
1638
1653
  if (property.type === exports.Type.Object) {
1639
- result[key] = this.valueSets[key].getValuesForKeys(keys[key]);
1654
+ result[key] = __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getValuesForKeys(keys[key]);
1640
1655
  } else {
1641
1656
  result[key] = this.getValue(key);
1642
1657
  }
@@ -1653,9 +1668,9 @@ class ValueSet {
1653
1668
  for (const key in this.propertySet.propertyMap) {
1654
1669
  const property = this.propertySet.getProperty(key);
1655
1670
  if (property.type === exports.Type.Object) {
1656
- result[key] = this.valueSets[key].getTimestamps();
1671
+ result[key] = __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getTimestamps();
1657
1672
  } else {
1658
- const timestamp = this.ownTimestamps[key];
1673
+ const timestamp = __classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key];
1659
1674
  if (timestamp) result[key] = timestamp;
1660
1675
  }
1661
1676
  }
@@ -1708,9 +1723,9 @@ class ValueSet {
1708
1723
  const property = this.propertySet.getProperty(key);
1709
1724
  if (property) {
1710
1725
  if (property.type === exports.Type.Object) {
1711
- this.valueSets[key].setValues(value);
1726
+ __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].setValues(value);
1712
1727
  } else {
1713
- this.values[key] = value;
1728
+ __classPrivateFieldGet(this, _ValueSet_values, "f")[key] = value;
1714
1729
  if (!equals(value, property.defaultValue)) {
1715
1730
  this.displayProperty(property);
1716
1731
  }
@@ -1731,7 +1746,7 @@ class ValueSet {
1731
1746
  for (const key in values) {
1732
1747
  const property = this.propertySet.getProperty(key);
1733
1748
  if (property.type === exports.Type.Object) {
1734
- this.valueSets[key].setValues(values[key]);
1749
+ __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].setValues(values[key]);
1735
1750
  } else {
1736
1751
  this.setValue(key, values[key]);
1737
1752
  }
@@ -1743,13 +1758,13 @@ class ValueSet {
1743
1758
  * @param values An object containing all the CollabTimestamps in the set.
1744
1759
  */
1745
1760
  setTimestamps(timestamps) {
1746
- this.ownTimestamps = {};
1761
+ __classPrivateFieldSet(this, _ValueSet_ownTimestamps, {}, "f");
1747
1762
  for (const key in timestamps) {
1748
1763
  const property = this.propertySet.getProperty(key);
1749
1764
  if (property.type === exports.Type.Object) {
1750
- this.valueSets[key].setTimestamps(timestamps[key]);
1765
+ __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].setTimestamps(timestamps[key]);
1751
1766
  } else {
1752
- this.ownTimestamps[key] = timestamps[key];
1767
+ __classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key] = timestamps[key];
1753
1768
  }
1754
1769
  }
1755
1770
  }
@@ -1762,7 +1777,7 @@ class ValueSet {
1762
1777
  for (const key in values) {
1763
1778
  const property = this.propertySet.getProperty(key);
1764
1779
  if (property.type === exports.Type.Object) {
1765
- this.valueSets[key].overwriteValues(values[key]);
1780
+ __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].overwriteValues(values[key]);
1766
1781
  } else {
1767
1782
  this.setValue(key, values[key]);
1768
1783
  }
@@ -1777,11 +1792,11 @@ class ValueSet {
1777
1792
  for (const key in values) {
1778
1793
  const property = this.propertySet.getProperty(key);
1779
1794
  if (property.type === exports.Type.Object) {
1780
- this.valueSets[key].overwriteValuesLww(values[key], timestamp);
1795
+ __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].overwriteValuesLww(values[key], timestamp);
1781
1796
  } else {
1782
- if (timestampWins(timestamp, this.ownTimestamps[key])) {
1797
+ if (timestampWins(timestamp, __classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key])) {
1783
1798
  this.setValue(key, values[key]);
1784
- this.ownTimestamps[key] = timestamp;
1799
+ __classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key] = timestamp;
1785
1800
  }
1786
1801
  }
1787
1802
  }
@@ -1794,18 +1809,18 @@ class ValueSet {
1794
1809
  resetValues() {
1795
1810
  this.displayedProperties = [];
1796
1811
  this.hiddenProperties = [];
1797
- this.ownTimestamps = {};
1812
+ __classPrivateFieldSet(this, _ValueSet_ownTimestamps, {}, "f");
1798
1813
  for (const key in this.propertySet.propertyMap) {
1799
1814
  const property = this.propertySet.getProperty(key);
1800
1815
  const rootAttribute = property.rootAttribute;
1801
1816
  if (property.type === exports.Type.Object) {
1802
- this.valueSets[key] = this.constructSubValueSet(key);
1817
+ __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key] = __classPrivateFieldGet(this, _ValueSet_instances, "m", _ValueSet_constructSubValueSet).call(this, key);
1803
1818
  } else {
1804
- this.values[key] = clone(property.defaultValue);
1819
+ __classPrivateFieldGet(this, _ValueSet_values, "f")[key] = clone(property.defaultValue);
1805
1820
  }
1806
1821
  if (rootAttribute !== undefined && rootAttribute !== null) {
1807
1822
  if (property.defaultValue !== undefined && !equals(this.getRootElementValue(rootAttribute), property.defaultValue)) {
1808
- this.setRootElementValue(rootAttribute, this.values[key]);
1823
+ this.setRootElementValue(rootAttribute, __classPrivateFieldGet(this, _ValueSet_values, "f")[key]);
1809
1824
  }
1810
1825
  }
1811
1826
  if (property.basic !== false) {
@@ -1815,19 +1830,6 @@ class ValueSet {
1815
1830
  }
1816
1831
  }
1817
1832
  }
1818
- /**
1819
- * Constructs a ValueSet with its corresponding PropertySet representing the values of the object.
1820
- * @private
1821
- * @param key Key that the ValueSet is under.
1822
- * @returns The constructed ValueSet.
1823
- */
1824
- constructSubValueSet(key) {
1825
- const property = this.propertySet.getProperty(key);
1826
- const propertySet = new PropertySet(property.properties);
1827
- const valueSet = new ValueSet(propertySet, this.rootElement);
1828
- valueSet.overwriteValues(clone(property.defaultValue));
1829
- return valueSet;
1830
- }
1831
1833
  /**
1832
1834
  * Gets the ValueSet under the given key when there are nested ValueSets.
1833
1835
  * @private
@@ -1835,7 +1837,7 @@ class ValueSet {
1835
1837
  * @returns A ValueSet.
1836
1838
  */
1837
1839
  getSubValueSet(key) {
1838
- return this.valueSets[key];
1840
+ return __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key];
1839
1841
  }
1840
1842
  /**
1841
1843
  * Moves the given property to the list of displayed properties.
@@ -1860,6 +1862,13 @@ class ValueSet {
1860
1862
  }
1861
1863
  }
1862
1864
  }
1865
+ _a$1 = ValueSet, _ValueSet_values = new WeakMap(), _ValueSet_valueSets = new WeakMap(), _ValueSet_ownTimestamps = new WeakMap(), _ValueSet_instances = new WeakSet(), _ValueSet_constructSubValueSet = function _ValueSet_constructSubValueSet(key) {
1866
+ const property = this.propertySet.getProperty(key);
1867
+ const propertySet = new PropertySet(property.properties);
1868
+ const valueSet = new _a$1(propertySet, this.rootElement);
1869
+ valueSet.overwriteValues(clone(property.defaultValue));
1870
+ return valueSet;
1871
+ };
1863
1872
 
1864
1873
  /**
1865
1874
  * Represents a collection of diagram entities of a type that exists as part of a diagram model.
@@ -1997,6 +2006,7 @@ class DiagramEntitySet {
1997
2006
  }
1998
2007
  }
1999
2008
 
2009
+ var _DiagramElement_id;
2000
2010
  /**
2001
2011
  * Default priority value for diagram elements.
2002
2012
  * @private
@@ -2014,7 +2024,7 @@ class DiagramElement {
2014
2024
  * @public
2015
2025
  */
2016
2026
  get id() {
2017
- return this._id;
2027
+ return __classPrivateFieldGet(this, _DiagramElement_id, "f");
2018
2028
  }
2019
2029
  /**
2020
2030
  * Whether this diagram element is currently in the user highlight.
@@ -2032,6 +2042,7 @@ class DiagramElement {
2032
2042
  return ((_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userSelection) === null || _b === void 0 ? void 0 : _b.contains(this.id)) || false;
2033
2043
  }
2034
2044
  constructor(model, id) {
2045
+ _DiagramElement_id.set(this, void 0);
2035
2046
  /**
2036
2047
  * Whether this diagram element has itself been explicitly removed.
2037
2048
  *
@@ -2050,7 +2061,7 @@ class DiagramElement {
2050
2061
  */
2051
2062
  this.selfRemovedTimestamp = null;
2052
2063
  this.model = model;
2053
- this._id = id;
2064
+ __classPrivateFieldSet(this, _DiagramElement_id, id, "f");
2054
2065
  }
2055
2066
  /**
2056
2067
  * Obtain the selection of this element.
@@ -2061,6 +2072,7 @@ class DiagramElement {
2061
2072
  return (_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.selectCanvasView()) === null || _b === void 0 ? void 0 : _b.select(`[id='${escapeSelector(this.id)}']`);
2062
2073
  }
2063
2074
  }
2075
+ _DiagramElement_id = new WeakMap();
2064
2076
  class DiagramElementSet extends DiagramEntitySet {
2065
2077
  all(includeRemoved = false) {
2066
2078
  if (includeRemoved) {
@@ -2138,6 +2150,7 @@ class DiagramElementSet extends DiagramEntitySet {
2138
2150
  }
2139
2151
  }
2140
2152
 
2153
+ var _DiagramConnection_type, _DiagramConnectionSet_model;
2141
2154
  /**
2142
2155
  * Default values of the parameters of a diagram connection.
2143
2156
  * @private
@@ -2222,12 +2235,12 @@ class DiagramConnectionType {
2222
2235
  */
2223
2236
  class DiagramConnection extends DiagramElement {
2224
2237
  get type() {
2225
- return this._type;
2238
+ return __classPrivateFieldGet(this, _DiagramConnection_type, "f");
2226
2239
  }
2227
2240
  set type(type) {
2228
2241
  var _a, _b;
2229
- if (type !== this._type) {
2230
- this._type = type;
2242
+ if (type !== __classPrivateFieldGet(this, _DiagramConnection_type, "f")) {
2243
+ __classPrivateFieldSet(this, _DiagramConnection_type, type, "f");
2231
2244
  if (this.valueSet) {
2232
2245
  this.valueSet = new ValueSet(type.propertySet, this);
2233
2246
  }
@@ -2423,6 +2436,7 @@ class DiagramConnection extends DiagramElement {
2423
2436
  throw new Error(`DiagramConnection cannot have an empty or null id`);
2424
2437
  }
2425
2438
  super(model, id);
2439
+ _DiagramConnection_type.set(this, void 0);
2426
2440
  /**
2427
2441
  * Coordinates of the start point of this connection.
2428
2442
  * @public
@@ -2453,7 +2467,7 @@ class DiagramConnection extends DiagramElement {
2453
2467
  * @public
2454
2468
  */
2455
2469
  this.points = [];
2456
- this._type = type;
2470
+ __classPrivateFieldSet(this, _DiagramConnection_type, type, "f");
2457
2471
  this.valueSet = new ValueSet(type.propertySet, this);
2458
2472
  this.originalData = {};
2459
2473
  this.setStart(start);
@@ -2630,6 +2644,7 @@ class DiagramConnection extends DiagramElement {
2630
2644
  }
2631
2645
  }
2632
2646
  }
2647
+ _DiagramConnection_type = new WeakMap();
2633
2648
  class DiagramConnectionSet extends DiagramElementSet {
2634
2649
  /**
2635
2650
  * Instance a set of connections for the given model. This method is used internally.
@@ -2637,12 +2652,13 @@ class DiagramConnectionSet extends DiagramElementSet {
2637
2652
  */
2638
2653
  constructor(model) {
2639
2654
  super();
2655
+ _DiagramConnectionSet_model.set(this, void 0);
2640
2656
  /**
2641
2657
  * Set of the possible types of connection that the connections of this set can have.
2642
2658
  * @public
2643
2659
  */
2644
2660
  this.types = new DiagramEntitySet();
2645
- this.model = model;
2661
+ __classPrivateFieldSet(this, _DiagramConnectionSet_model, model, "f");
2646
2662
  }
2647
2663
  /**
2648
2664
  * Instance a new connection and add it to this set.
@@ -2665,7 +2681,7 @@ class DiagramConnectionSet extends DiagramElementSet {
2665
2681
  }
2666
2682
  connectionType = foundConnectionType;
2667
2683
  }
2668
- const connection = new DiagramConnection(this.model, connectionType, start, end, id);
2684
+ const connection = new DiagramConnection(__classPrivateFieldGet(this, _DiagramConnectionSet_model, "f"), connectionType, start, end, id);
2669
2685
  super.add(connection);
2670
2686
  connection.updateInView();
2671
2687
  connection.valueSet.resetValues();
@@ -2687,6 +2703,7 @@ class DiagramConnectionSet extends DiagramElementSet {
2687
2703
  }
2688
2704
  }
2689
2705
  }
2706
+ _DiagramConnectionSet_model = new WeakMap();
2690
2707
 
2691
2708
  /**
2692
2709
  * The different modes for when a node or section can be resized.
@@ -2710,6 +2727,7 @@ exports.ResizableMode = void 0;
2710
2727
  ResizableMode[ResizableMode["Never"] = 2] = "Never";
2711
2728
  })(exports.ResizableMode || (exports.ResizableMode = {}));
2712
2729
 
2730
+ var _DiagramField_text, _DiagramFieldSet_model;
2713
2731
  /**
2714
2732
  * Default values of the parameters of a diagram field.
2715
2733
  * @private
@@ -2746,14 +2764,14 @@ class DiagramField extends DiagramElement {
2746
2764
  * @public
2747
2765
  */
2748
2766
  get text() {
2749
- return this._text;
2767
+ return __classPrivateFieldGet(this, _DiagramField_text, "f");
2750
2768
  }
2751
2769
  set text(value) {
2752
2770
  var _a;
2753
2771
  if (value === null || value === undefined || (value === null || value === void 0 ? void 0 : value.trim()) === '') {
2754
2772
  value = this.defaultText;
2755
2773
  }
2756
- this._text = value;
2774
+ __classPrivateFieldSet(this, _DiagramField_text, value, "f");
2757
2775
  this.updateInView();
2758
2776
  if (this.fit) {
2759
2777
  (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.fitFieldRootInView(this.id, this.shrink);
@@ -2784,6 +2802,7 @@ class DiagramField extends DiagramElement {
2784
2802
  throw new Error('DiagramField for rootElement already exists');
2785
2803
  }
2786
2804
  super(model, id);
2805
+ _DiagramField_text.set(this, void 0);
2787
2806
  /**
2788
2807
  * Collaborative timestamp for text.
2789
2808
  * @public
@@ -2822,7 +2841,7 @@ class DiagramField extends DiagramElement {
2822
2841
  this.highlightedLook = looks.highlightedLook;
2823
2842
  this.selectedAndHighlightedLook = looks.selectedAndHighlightedLook;
2824
2843
  this.defaultText = text;
2825
- this._text = text;
2844
+ __classPrivateFieldSet(this, _DiagramField_text, text, "f");
2826
2845
  this.editable = editable;
2827
2846
  this.fit = fit;
2828
2847
  this.shrink = shrink;
@@ -2852,6 +2871,7 @@ class DiagramField extends DiagramElement {
2852
2871
  return ((_a = this.rootElement) === null || _a === void 0 ? void 0 : _a.getPriority()) || DEFAULT_PRIORITY;
2853
2872
  }
2854
2873
  }
2874
+ _DiagramField_text = new WeakMap();
2855
2875
  class DiagramFieldSet extends DiagramElementSet {
2856
2876
  /**
2857
2877
  * Instance a set of fields for the given model. This method is used internally.
@@ -2859,14 +2879,15 @@ class DiagramFieldSet extends DiagramElementSet {
2859
2879
  */
2860
2880
  constructor(model) {
2861
2881
  super();
2862
- this.model = model;
2882
+ _DiagramFieldSet_model.set(this, void 0);
2883
+ __classPrivateFieldSet(this, _DiagramFieldSet_model, model, "f");
2863
2884
  }
2864
2885
  /**
2865
2886
  * 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.
2866
2887
  * @private
2867
2888
  */
2868
2889
  new(rootElement, coords, width, height, horizontalAlign, verticalAlign, orientation, multiline, look, text, editable, fit, shrink) {
2869
- const field = new DiagramField(this.model, rootElement, coords, width, height, horizontalAlign, verticalAlign, orientation, multiline, look, text, editable, fit, shrink);
2890
+ const field = new DiagramField(__classPrivateFieldGet(this, _DiagramFieldSet_model, "f"), rootElement, coords, width, height, horizontalAlign, verticalAlign, orientation, multiline, look, text, editable, fit, shrink);
2870
2891
  super.add(field);
2871
2892
  field.updateInView();
2872
2893
  // add this field to its root element
@@ -2892,6 +2913,7 @@ class DiagramFieldSet extends DiagramElementSet {
2892
2913
  }
2893
2914
  }
2894
2915
  }
2916
+ _DiagramFieldSet_model = new WeakMap();
2895
2917
  const getBottomMargin = config => {
2896
2918
  if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
2897
2919
  return DIAGRAM_FIELD_DEFAULTS.margin;
@@ -3100,6 +3122,7 @@ class DiagramResizer {
3100
3122
  }
3101
3123
  const DIAGRAM_DEFAULT_RESIZER = new DiagramResizer(DIAGRAM_RESIZER_DEFAULTS);
3102
3124
 
3125
+ var _DiagramSectionSet_model;
3103
3126
  /**
3104
3127
  * Default value of the default width of a diagram section.
3105
3128
  * @private
@@ -3587,7 +3610,8 @@ class DiagramSectionSet extends DiagramElementSet {
3587
3610
  */
3588
3611
  constructor(model) {
3589
3612
  super();
3590
- this.model = model;
3613
+ _DiagramSectionSet_model.set(this, void 0);
3614
+ __classPrivateFieldSet(this, _DiagramSectionSet_model, model, "f");
3591
3615
  }
3592
3616
  /**
3593
3617
  * Instance a new section and add it to this set. This method is normally called when instancing an element with a section and it is rarely called by itself.
@@ -3595,7 +3619,7 @@ class DiagramSectionSet extends DiagramElementSet {
3595
3619
  */
3596
3620
  new(node, indexXInNode, indexYInNode, coords, width, height, id) {
3597
3621
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
3598
- const section = new DiagramSection(this.model, node, indexXInNode, indexYInNode, coords, width, height, id);
3622
+ const section = new DiagramSection(__classPrivateFieldGet(this, _DiagramSectionSet_model, "f"), node, indexXInNode, indexYInNode, coords, width, height, id);
3599
3623
  super.add(section);
3600
3624
  section.updateInView();
3601
3625
  // add this section to its node
@@ -3606,7 +3630,7 @@ class DiagramSectionSet extends DiagramElementSet {
3606
3630
  if (sectionPorts && sectionPorts.length > 0) {
3607
3631
  for (let i = 0; i < sectionPorts.length; ++i) {
3608
3632
  const portConfig = sectionPorts[i];
3609
- const port = this.model.ports.new(portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined, section, [section.coords[0] + (portConfig.coords[0] || 0), section.coords[1] + (portConfig.coords[1] || 0)], portConfig.connectionPoint !== undefined ? [section.coords[0] + (portConfig.connectionPoint[0] || 0), section.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig === null || portConfig === void 0 ? void 0 : portConfig.direction, `${section.id}_${i}`, portConfig.anchorPointX || 'floating', portConfig.anchorPointY || 'floating');
3633
+ const port = __classPrivateFieldGet(this, _DiagramSectionSet_model, "f").ports.new(portConfig.type !== undefined ? __classPrivateFieldGet(this, _DiagramSectionSet_model, "f").ports.types.get(portConfig.type) : undefined, section, [section.coords[0] + (portConfig.coords[0] || 0), section.coords[1] + (portConfig.coords[1] || 0)], portConfig.connectionPoint !== undefined ? [section.coords[0] + (portConfig.connectionPoint[0] || 0), section.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig === null || portConfig === void 0 ? void 0 : portConfig.direction, `${section.id}_${i}`, portConfig.anchorPointX || 'floating', portConfig.anchorPointY || 'floating');
3610
3634
  if ((_e = port.type) === null || _e === void 0 ? void 0 : _e.label) {
3611
3635
  const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === void 0 ? void 0 : _f.label);
3612
3636
  labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
@@ -3625,7 +3649,7 @@ class DiagramSectionSet extends DiagramElementSet {
3625
3649
  default:
3626
3650
  labelCoords = port.coords;
3627
3651
  }
3628
- this.model.fields.new(port, labelCoords, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
3652
+ __classPrivateFieldGet(this, _DiagramSectionSet_model, "f").fields.new(port, labelCoords, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
3629
3653
  }
3630
3654
  }
3631
3655
  }
@@ -3634,7 +3658,7 @@ class DiagramSectionSet extends DiagramElementSet {
3634
3658
  if (sectionLabel) {
3635
3659
  const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), sectionLabel);
3636
3660
  labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
3637
- this.model.fields.new(section, [section.coords[0] + getLeftMargin(labelConfiguration), section.coords[1] + getTopMargin(labelConfiguration)], section.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), section.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
3661
+ __classPrivateFieldGet(this, _DiagramSectionSet_model, "f").fields.new(section, [section.coords[0] + getLeftMargin(labelConfiguration), section.coords[1] + getTopMargin(labelConfiguration)], section.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), section.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
3638
3662
  }
3639
3663
  return section;
3640
3664
  }
@@ -3643,11 +3667,11 @@ class DiagramSectionSet extends DiagramElementSet {
3643
3667
  if (section) {
3644
3668
  // remove all ports
3645
3669
  while (section.ports.length > 0) {
3646
- this.model.ports.remove(section.ports[0].id);
3670
+ __classPrivateFieldGet(this, _DiagramSectionSet_model, "f").ports.remove(section.ports[0].id);
3647
3671
  }
3648
3672
  // remove label
3649
3673
  if (section.label) {
3650
- this.model.fields.remove(section.label.id);
3674
+ __classPrivateFieldGet(this, _DiagramSectionSet_model, "f").fields.remove(section.label.id);
3651
3675
  }
3652
3676
  // remove from root element
3653
3677
  if (section.node) {
@@ -3660,7 +3684,9 @@ class DiagramSectionSet extends DiagramElementSet {
3660
3684
  }
3661
3685
  }
3662
3686
  }
3687
+ _DiagramSectionSet_model = new WeakMap();
3663
3688
 
3689
+ var _DiagramNode_type, _DiagramNodeSet_model;
3664
3690
  /**
3665
3691
  * Default values of the look of a diagram node.
3666
3692
  * @private
@@ -3773,12 +3799,12 @@ class DiagramNodeType {
3773
3799
  */
3774
3800
  class DiagramNode extends DiagramElement {
3775
3801
  get type() {
3776
- return this._type;
3802
+ return __classPrivateFieldGet(this, _DiagramNode_type, "f");
3777
3803
  }
3778
3804
  set type(type) {
3779
3805
  var _a, _b;
3780
- if (type !== this._type) {
3781
- this._type = type;
3806
+ if (type !== __classPrivateFieldGet(this, _DiagramNode_type, "f")) {
3807
+ __classPrivateFieldSet(this, _DiagramNode_type, type, "f");
3782
3808
  if (this.valueSet) {
3783
3809
  this.valueSet = new ValueSet(type.propertySet, this);
3784
3810
  }
@@ -3871,6 +3897,7 @@ class DiagramNode extends DiagramElement {
3871
3897
  throw new Error(`DiagramNode cannot have an empty or null id`);
3872
3898
  }
3873
3899
  super(model, id);
3900
+ _DiagramNode_type.set(this, void 0);
3874
3901
  /**
3875
3902
  * Nodes contained within this node.
3876
3903
  * @public
@@ -3896,7 +3923,7 @@ class DiagramNode extends DiagramElement {
3896
3923
  * @public
3897
3924
  */
3898
3925
  this.geometryTimestamp = null;
3899
- this._type = type;
3926
+ __classPrivateFieldSet(this, _DiagramNode_type, type, "f");
3900
3927
  this.valueSet = new ValueSet(type.propertySet, this);
3901
3928
  this.originalData = {};
3902
3929
  this.coords = coords;
@@ -4561,6 +4588,7 @@ class DiagramNode extends DiagramElement {
4561
4588
  this.stretch(exports.Side.Bottom, margin + rowHeight);
4562
4589
  }
4563
4590
  }
4591
+ _DiagramNode_type = new WeakMap();
4564
4592
  class DiagramNodeSet extends DiagramElementSet {
4565
4593
  /**
4566
4594
  * Instance a set of nodes for the given model. This method is used internally.
@@ -4568,12 +4596,13 @@ class DiagramNodeSet extends DiagramElementSet {
4568
4596
  */
4569
4597
  constructor(model) {
4570
4598
  super();
4599
+ _DiagramNodeSet_model.set(this, void 0);
4571
4600
  /**
4572
4601
  * Set of the possible types of node that the nodes of this set can have.
4573
4602
  * @public
4574
4603
  */
4575
4604
  this.types = new DiagramEntitySet();
4576
- this.model = model;
4605
+ __classPrivateFieldSet(this, _DiagramNodeSet_model, model, "f");
4577
4606
  }
4578
4607
  /**
4579
4608
  * Instance a new node and add it to this set.
@@ -4595,7 +4624,7 @@ class DiagramNodeSet extends DiagramElementSet {
4595
4624
  }
4596
4625
  nodeType = foundNodeType;
4597
4626
  }
4598
- const node = new DiagramNode(this.model, nodeType, coords, id);
4627
+ const node = new DiagramNode(__classPrivateFieldGet(this, _DiagramNodeSet_model, "f"), nodeType, coords, id);
4599
4628
  super.add(node);
4600
4629
  node.updateInView();
4601
4630
  // add node sections
@@ -4605,7 +4634,7 @@ class DiagramNodeSet extends DiagramElementSet {
4605
4634
  for (let j = 0; j < nodeType.sectionGrid.sections.length; ++j) {
4606
4635
  let widthAccumulator = node.coords[0] + (nodeType.sectionGrid.margin || 0);
4607
4636
  for (let i = 0; i < nodeType.sectionGrid.sections[j].length; ++i) {
4608
- this.model.sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a === void 0 ? void 0 : _a[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH, ((_b = nodeType.sectionGrid.defaultHeights) === null || _b === void 0 ? void 0 : _b[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT, `${node.id}_${j}_${i}`);
4637
+ __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a === void 0 ? void 0 : _a[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH, ((_b = nodeType.sectionGrid.defaultHeights) === null || _b === void 0 ? void 0 : _b[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT, `${node.id}_${j}_${i}`);
4609
4638
  widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c === void 0 ? void 0 : _c[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH) + (nodeType.sectionGrid.margin || 0);
4610
4639
  }
4611
4640
  heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d === void 0 ? void 0 : _d[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT) + (nodeType.sectionGrid.margin || 0);
@@ -4615,8 +4644,8 @@ class DiagramNodeSet extends DiagramElementSet {
4615
4644
  if (nodeType.ports.length > 0) {
4616
4645
  for (let i = 0; i < nodeType.ports.length; ++i) {
4617
4646
  const portConfig = nodeType.ports[i];
4618
- const portType = portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined;
4619
- const port = this.model.ports.new(portType, node, [node.coords[0] + portConfig.coords[0], node.coords[1] + portConfig.coords[1]], portConfig.connectionPoint !== undefined ? [node.coords[0] + (portConfig.connectionPoint[0] || 0), node.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig.direction, `${node.id}_port_${i}`, portConfig.anchorPointX || 'floating', portConfig.anchorPointY || 'floating');
4647
+ const portType = portConfig.type !== undefined ? __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").ports.types.get(portConfig.type) : undefined;
4648
+ const port = __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").ports.new(portType, node, [node.coords[0] + portConfig.coords[0], node.coords[1] + portConfig.coords[1]], portConfig.connectionPoint !== undefined ? [node.coords[0] + (portConfig.connectionPoint[0] || 0), node.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig.direction, `${node.id}_port_${i}`, portConfig.anchorPointX || 'floating', portConfig.anchorPointY || 'floating');
4620
4649
  if ((_e = port.type) === null || _e === void 0 ? void 0 : _e.label) {
4621
4650
  const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === void 0 ? void 0 : _f.label);
4622
4651
  labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
@@ -4635,7 +4664,7 @@ class DiagramNodeSet extends DiagramElementSet {
4635
4664
  default:
4636
4665
  labelCoords = port.coords;
4637
4666
  }
4638
- this.model.fields.new(port, labelCoords, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4667
+ __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").fields.new(port, labelCoords, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4639
4668
  }
4640
4669
  }
4641
4670
  }
@@ -4643,13 +4672,13 @@ class DiagramNodeSet extends DiagramElementSet {
4643
4672
  if (nodeType.label) {
4644
4673
  const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), nodeType.label);
4645
4674
  labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
4646
- this.model.fields.new(node, [node.coords[0] + getLeftMargin(labelConfiguration), node.coords[1] + getTopMargin(labelConfiguration)], node.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), node.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4675
+ __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").fields.new(node, [node.coords[0] + getLeftMargin(labelConfiguration), node.coords[1] + getTopMargin(labelConfiguration)], node.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), node.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4647
4676
  }
4648
4677
  // add node decorators
4649
4678
  if (nodeType.decorators.length > 0) {
4650
4679
  for (let i = 0; i < nodeType.decorators.length; ++i) {
4651
4680
  const decoratorConfig = nodeType.decorators[i];
4652
- this.model.decorators.new(node, [node.coords[0] + decoratorConfig.coords[0], node.coords[1] + decoratorConfig.coords[1]], decoratorConfig.width, decoratorConfig.height, node.getPriority(), decoratorConfig.svg, `${node.id}_decorator_${i}`, decoratorConfig.anchorPointX || 'floating', decoratorConfig.anchorPointY || 'floating');
4681
+ __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").decorators.new(node, [node.coords[0] + decoratorConfig.coords[0], node.coords[1] + decoratorConfig.coords[1]], decoratorConfig.width, decoratorConfig.height, node.getPriority(), decoratorConfig.svg, `${node.id}_decorator_${i}`, decoratorConfig.anchorPointX || 'floating', decoratorConfig.anchorPointY || 'floating');
4653
4682
  }
4654
4683
  }
4655
4684
  node.valueSet.resetValues();
@@ -4665,23 +4694,23 @@ class DiagramNodeSet extends DiagramElementSet {
4665
4694
  }
4666
4695
  // remove all children
4667
4696
  while (node.children.length > 0) {
4668
- this.model.nodes.remove(node.children[0].id);
4697
+ __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").nodes.remove(node.children[0].id);
4669
4698
  }
4670
4699
  // remove all sections
4671
4700
  while (node.sections.length > 0) {
4672
- this.model.sections.remove(node.sections[0].id);
4701
+ __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").sections.remove(node.sections[0].id);
4673
4702
  }
4674
4703
  // remove all ports
4675
4704
  while (node.ports.length > 0) {
4676
- this.model.ports.remove(node.ports[0].id);
4705
+ __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").ports.remove(node.ports[0].id);
4677
4706
  }
4678
4707
  // remove all decorators
4679
4708
  while (node.decorators.length > 0) {
4680
- this.model.decorators.remove(node.decorators[0].id);
4709
+ __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").decorators.remove(node.decorators[0].id);
4681
4710
  }
4682
4711
  // remove label
4683
4712
  if (node.label) {
4684
- this.model.fields.remove(node.label.id);
4713
+ __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").fields.remove(node.label.id);
4685
4714
  }
4686
4715
  // remove from set of nodes
4687
4716
  super.remove(id);
@@ -4706,6 +4735,7 @@ class DiagramNodeSet extends DiagramElementSet {
4706
4735
  return nodesAtLocation;
4707
4736
  }
4708
4737
  }
4738
+ _DiagramNodeSet_model = new WeakMap();
4709
4739
  /**
4710
4740
  * Removes any nodes from the given list which are a descendant of another node in the list.
4711
4741
  * @param nodes A list of nodes.
@@ -4813,6 +4843,7 @@ const getTopPadding = config => {
4813
4843
  }
4814
4844
  };
4815
4845
 
4846
+ var _DiagramDecoratorSet_model;
4816
4847
  /**
4817
4848
  * A foreign object which is inserted with arbitrary SVG code into a diagram.
4818
4849
  * Similar to a diagram object, but it's part of a node or section and it moves and stretches as its geometry changes.
@@ -4871,7 +4902,8 @@ class DiagramDecoratorSet extends DiagramElementSet {
4871
4902
  */
4872
4903
  constructor(model) {
4873
4904
  super();
4874
- this.model = model;
4905
+ _DiagramDecoratorSet_model.set(this, void 0);
4906
+ __classPrivateFieldSet(this, _DiagramDecoratorSet_model, model, "f");
4875
4907
  }
4876
4908
  /**
4877
4909
  * Instance a new decorator and add it to this set.
@@ -4885,7 +4917,7 @@ class DiagramDecoratorSet extends DiagramElementSet {
4885
4917
  * @returns The instanced decorator.
4886
4918
  */
4887
4919
  new(rootElement, coords, width, height, priority, svg, id, anchorPointX = 'floating', anchorPointY = 'floating') {
4888
- const decorator = new DiagramDecorator(this.model, rootElement, coords, width, height, priority, svg, id, anchorPointX, anchorPointY);
4920
+ const decorator = new DiagramDecorator(__classPrivateFieldGet(this, _DiagramDecoratorSet_model, "f"), rootElement, coords, width, height, priority, svg, id, anchorPointX, anchorPointY);
4889
4921
  super.add(decorator);
4890
4922
  decorator.updateInView();
4891
4923
  // add this port to its root element
@@ -4908,7 +4940,9 @@ class DiagramDecoratorSet extends DiagramElementSet {
4908
4940
  }
4909
4941
  }
4910
4942
  }
4943
+ _DiagramDecoratorSet_model = new WeakMap();
4911
4944
 
4945
+ var _DiagramObjectSet_model;
4912
4946
  /**
4913
4947
  * A foreign object which is inserted with arbitrary SVG code into a diagram.
4914
4948
  * Diagram objects are not serialized with other diagram elements.
@@ -4960,7 +4994,8 @@ class DiagramObjectSet extends DiagramElementSet {
4960
4994
  */
4961
4995
  constructor(model) {
4962
4996
  super();
4963
- this.model = model;
4997
+ _DiagramObjectSet_model.set(this, void 0);
4998
+ __classPrivateFieldSet(this, _DiagramObjectSet_model, model, "f");
4964
4999
  }
4965
5000
  /**
4966
5001
  * Instance a new object and add it to this set.
@@ -4974,7 +5009,7 @@ class DiagramObjectSet extends DiagramElementSet {
4974
5009
  * @returns The instanced object.
4975
5010
  */
4976
5011
  new(coords, width, height, priority, svg, id) {
4977
- const object = new DiagramObject(this.model, coords, width, height, priority, svg, id);
5012
+ const object = new DiagramObject(__classPrivateFieldGet(this, _DiagramObjectSet_model, "f"), coords, width, height, priority, svg, id);
4978
5013
  super.add(object);
4979
5014
  object.updateInView();
4980
5015
  return object;
@@ -4989,7 +5024,9 @@ class DiagramObjectSet extends DiagramElementSet {
4989
5024
  }
4990
5025
  }
4991
5026
  }
5027
+ _DiagramObjectSet_model = new WeakMap();
4992
5028
 
5029
+ var _DiagramPort_type, _DiagramPortSet_model;
4993
5030
  /**
4994
5031
  * Default values of the look of a diagram port.
4995
5032
  * @private
@@ -5052,11 +5089,11 @@ class DiagramPortType {
5052
5089
  */
5053
5090
  class DiagramPort extends DiagramElement {
5054
5091
  get type() {
5055
- return this._type;
5092
+ return __classPrivateFieldGet(this, _DiagramPort_type, "f");
5056
5093
  }
5057
5094
  set type(type) {
5058
- if (type !== this._type) {
5059
- this._type = type;
5095
+ if (type !== __classPrivateFieldGet(this, _DiagramPort_type, "f")) {
5096
+ __classPrivateFieldSet(this, _DiagramPort_type, type, "f");
5060
5097
  this.updateInView();
5061
5098
  }
5062
5099
  }
@@ -5181,6 +5218,7 @@ class DiagramPort extends DiagramElement {
5181
5218
  throw new Error(`DiagramPort cannot have an empty or null id`);
5182
5219
  }
5183
5220
  super(model, id);
5221
+ _DiagramPort_type.set(this, void 0);
5184
5222
  /**
5185
5223
  * Connections that start at this port.
5186
5224
  * @public
@@ -5191,7 +5229,7 @@ class DiagramPort extends DiagramElement {
5191
5229
  * @public
5192
5230
  */
5193
5231
  this.incomingConnections = [];
5194
- this._type = type;
5232
+ __classPrivateFieldSet(this, _DiagramPort_type, type, "f");
5195
5233
  this.rootElement = rootElement;
5196
5234
  this.coords = coords;
5197
5235
  this.connectionPoint = connectionPoint || coords;
@@ -5279,6 +5317,7 @@ class DiagramPort extends DiagramElement {
5279
5317
  return distanceBetweenPoints(this.coords, coords);
5280
5318
  }
5281
5319
  }
5320
+ _DiagramPort_type = new WeakMap();
5282
5321
  class DiagramPortSet extends DiagramElementSet {
5283
5322
  /**
5284
5323
  * Instance a set of ports for the given model. This method is used internally.
@@ -5286,19 +5325,20 @@ class DiagramPortSet extends DiagramElementSet {
5286
5325
  */
5287
5326
  constructor(model) {
5288
5327
  super();
5328
+ _DiagramPortSet_model.set(this, void 0);
5289
5329
  /**
5290
5330
  * Set of the possible types of port that the ports of this set can have.
5291
5331
  * @public
5292
5332
  */
5293
5333
  this.types = new DiagramEntitySet();
5294
- this.model = model;
5334
+ __classPrivateFieldSet(this, _DiagramPortSet_model, model, "f");
5295
5335
  }
5296
5336
  /**
5297
5337
  * Instance a new port and add it to this set. This method is normally called when instancing an element with a port and it is rarely called by itself.
5298
5338
  * @private
5299
5339
  */
5300
5340
  new(type, rootElement, coords, connectionPoint, direction, id, anchorPointX = 'floating', anchorPointY = 'floating') {
5301
- const port = new DiagramPort(this.model, type, rootElement, coords, connectionPoint, direction, id, anchorPointX, anchorPointY);
5341
+ const port = new DiagramPort(__classPrivateFieldGet(this, _DiagramPortSet_model, "f"), type, rootElement, coords, connectionPoint, direction, id, anchorPointX, anchorPointY);
5302
5342
  super.add(port);
5303
5343
  port.updateInView();
5304
5344
  // add this port to its root element
@@ -5312,14 +5352,14 @@ class DiagramPortSet extends DiagramElementSet {
5312
5352
  if (port) {
5313
5353
  // remove all connections
5314
5354
  while (port.outgoingConnections.length > 0) {
5315
- this.model.connections.remove(port.outgoingConnections[0].id);
5355
+ __classPrivateFieldGet(this, _DiagramPortSet_model, "f").connections.remove(port.outgoingConnections[0].id);
5316
5356
  }
5317
5357
  while (port.incomingConnections.length > 0) {
5318
- this.model.connections.remove(port.incomingConnections[0].id);
5358
+ __classPrivateFieldGet(this, _DiagramPortSet_model, "f").connections.remove(port.incomingConnections[0].id);
5319
5359
  }
5320
5360
  // remove label
5321
5361
  if (port.label) {
5322
- this.model.fields.remove(port.label.id);
5362
+ __classPrivateFieldGet(this, _DiagramPortSet_model, "f").fields.remove(port.label.id);
5323
5363
  }
5324
5364
  // remove from root element
5325
5365
  if (port.rootElement instanceof DiagramNode || port.rootElement instanceof DiagramSection) {
@@ -5332,6 +5372,7 @@ class DiagramPortSet extends DiagramElementSet {
5332
5372
  }
5333
5373
  }
5334
5374
  }
5375
+ _DiagramPortSet_model = new WeakMap();
5335
5376
 
5336
5377
  /**
5337
5378
  * Importer which imports a diagram from its daga model representation.
@@ -5568,6 +5609,7 @@ class DagaImporter {
5568
5609
  }
5569
5610
  }
5570
5611
 
5612
+ var _SetSelfRemovedCollabAction_instances, _SetSelfRemovedCollabAction_doOne;
5571
5613
  /**
5572
5614
  * Collaborative action which consists of adding a node.
5573
5615
  * @private
@@ -5921,6 +5963,7 @@ class UpdateValuesCollabAction {
5921
5963
  */
5922
5964
  class SetSelfRemovedCollabAction {
5923
5965
  constructor(canvas, nodeIds, sectionIds, portIds, connectionIds, fieldIds, selfRemoved, timestamp) {
5966
+ _SetSelfRemovedCollabAction_instances.add(this);
5924
5967
  this.canvas = canvas;
5925
5968
  this.nodeIds = nodeIds;
5926
5969
  this.sectionIds = sectionIds;
@@ -5930,27 +5973,21 @@ class SetSelfRemovedCollabAction {
5930
5973
  this.selfRemoved = selfRemoved;
5931
5974
  this.timestamp = timestamp;
5932
5975
  }
5933
- doOne(elt) {
5934
- if (elt && timestampWins(this.timestamp, elt.selfRemovedTimestamp)) {
5935
- elt.selfRemoved = this.selfRemoved;
5936
- elt.selfRemovedTimestamp = this.timestamp;
5937
- }
5938
- }
5939
5976
  do() {
5940
5977
  for (const nodeId of this.nodeIds) {
5941
- this.doOne(this.canvas.model.nodes.get(nodeId, true));
5978
+ __classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.nodes.get(nodeId, true));
5942
5979
  }
5943
5980
  for (const sectionId of this.sectionIds) {
5944
- this.doOne(this.canvas.model.sections.get(sectionId, true));
5981
+ __classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.sections.get(sectionId, true));
5945
5982
  }
5946
5983
  for (const portId of this.portIds) {
5947
- this.doOne(this.canvas.model.ports.get(portId, true));
5984
+ __classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.ports.get(portId, true));
5948
5985
  }
5949
5986
  for (const connectionId of this.connectionIds) {
5950
- this.doOne(this.canvas.model.connections.get(connectionId, true));
5987
+ __classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.connections.get(connectionId, true));
5951
5988
  }
5952
5989
  for (const fieldId of this.fieldIds) {
5953
- this.doOne(this.canvas.model.fields.get(fieldId, true));
5990
+ __classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.fields.get(fieldId, true));
5954
5991
  }
5955
5992
  // update view
5956
5993
  this.canvas.updateNodesInView(...this.nodeIds);
@@ -5977,6 +6014,12 @@ class SetSelfRemovedCollabAction {
5977
6014
  return new SetSelfRemovedCollabAction(canvas, serialized.nodeIds, serialized.sectionIds, serialized.portIds, serialized.connectionIds, serialized.fieldIds, serialized.removed, serialized.timestamp);
5978
6015
  }
5979
6016
  }
6017
+ _SetSelfRemovedCollabAction_instances = new WeakSet(), _SetSelfRemovedCollabAction_doOne = function _SetSelfRemovedCollabAction_doOne(elt) {
6018
+ if (elt && timestampWins(this.timestamp, elt.selfRemovedTimestamp)) {
6019
+ elt.selfRemoved = this.selfRemoved;
6020
+ elt.selfRemovedTimestamp = this.timestamp;
6021
+ }
6022
+ };
5980
6023
  /**
5981
6024
  * Collaborative action which consists of pasting elements from an external source into a diagram.
5982
6025
  *
@@ -6148,13 +6191,19 @@ class CollabEngine {
6148
6191
  }
6149
6192
  }
6150
6193
 
6194
+ var _ActionStack_canvas;
6151
6195
  /**
6152
6196
  * A stack of recent actions taken by the user.
6153
6197
  * @private
6154
6198
  */
6155
6199
  class ActionStack {
6156
6200
  constructor(canvas, maximum) {
6157
- this.canvas = canvas;
6201
+ /**
6202
+ * Canvas that this action stack belongs to.
6203
+ * @private
6204
+ */
6205
+ _ActionStack_canvas.set(this, void 0);
6206
+ __classPrivateFieldSet(this, _ActionStack_canvas, canvas, "f");
6158
6207
  this.maximum = maximum;
6159
6208
  this.history = [];
6160
6209
  this.index = 0;
@@ -6174,7 +6223,7 @@ class ActionStack {
6174
6223
  this.history.push(action);
6175
6224
  ++this.index;
6176
6225
  }
6177
- this.canvas.diagramChange$.next({
6226
+ __classPrivateFieldGet(this, _ActionStack_canvas, "f").diagramChange$.next({
6178
6227
  action,
6179
6228
  method: exports.DiagramActionMethod.Do
6180
6229
  });
@@ -6193,7 +6242,7 @@ class ActionStack {
6193
6242
  hasEffect = action.undo();
6194
6243
  } while (!hasEffect && this.index > 0);
6195
6244
  }
6196
- this.canvas.diagramChange$.next({
6245
+ __classPrivateFieldGet(this, _ActionStack_canvas, "f").diagramChange$.next({
6197
6246
  action,
6198
6247
  method: exports.DiagramActionMethod.Undo
6199
6248
  });
@@ -6212,12 +6261,13 @@ class ActionStack {
6212
6261
  ++this.index;
6213
6262
  } while (!hasEffect && this.index < this.history.length);
6214
6263
  }
6215
- this.canvas.diagramChange$.next({
6264
+ __classPrivateFieldGet(this, _ActionStack_canvas, "f").diagramChange$.next({
6216
6265
  action,
6217
6266
  method: exports.DiagramActionMethod.Redo
6218
6267
  });
6219
6268
  }
6220
6269
  }
6270
+ _ActionStack_canvas = new WeakMap();
6221
6271
  /**
6222
6272
  * The different methods of an action.
6223
6273
  * @private
@@ -7215,6 +7265,7 @@ const getGridSpacingY = gridConfig => {
7215
7265
  return value;
7216
7266
  };
7217
7267
 
7268
+ var _DiagramContextMenu_canvas, _DiagramContextMenu_config, _DiagramContextMenu_contextMenuContainer;
7218
7269
  const CONTEXT_MENU_MENU_RADIUS = 96;
7219
7270
  const CONTEXT_MENU_BUTTON_RADIUS = 32;
7220
7271
  const CONTEXT_MENU_TOTAL_RADIUS = CONTEXT_MENU_MENU_RADIUS + CONTEXT_MENU_BUTTON_RADIUS;
@@ -7235,8 +7286,11 @@ class DiagramContextMenu {
7235
7286
  * @param canvas A canvas.
7236
7287
  */
7237
7288
  constructor(canvas, config) {
7238
- this.canvas = canvas;
7239
- this.config = config || CONTEXT_MENU_DEFAULTS;
7289
+ _DiagramContextMenu_canvas.set(this, void 0);
7290
+ _DiagramContextMenu_config.set(this, void 0);
7291
+ _DiagramContextMenu_contextMenuContainer.set(this, void 0);
7292
+ __classPrivateFieldSet(this, _DiagramContextMenu_canvas, canvas, "f");
7293
+ __classPrivateFieldSet(this, _DiagramContextMenu_config, config || CONTEXT_MENU_DEFAULTS, "f");
7240
7294
  }
7241
7295
  /**
7242
7296
  * Opens the context menu at the location determined by the given mouse event.
@@ -7245,11 +7299,11 @@ class DiagramContextMenu {
7245
7299
  */
7246
7300
  open(event) {
7247
7301
  this.close();
7248
- const coordsRelativeToRoot = this.canvas.getPointerLocationRelativeToRoot(event);
7249
- const coordsRelativeToCanvas = this.canvas.getPointerLocationRelativeToCanvas(event);
7302
+ const coordsRelativeToRoot = __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").getPointerLocationRelativeToRoot(event);
7303
+ const coordsRelativeToCanvas = __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").getPointerLocationRelativeToCanvas(event);
7250
7304
  // append to the root (svg) element so the context menu is not affected by zoom transforms on the canvas view
7251
- const contextMenuContainer = this.canvas.selectSVGElement().append('foreignObject').attr('class', 'daga-context-menu').attr('x', `${coordsRelativeToRoot[0] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('y', `${coordsRelativeToRoot[1] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('width', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).attr('height', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).style('pointer-events', 'none').on(exports.Events.ContextMenu, newEvent => {
7252
- if (this.canvas.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
7305
+ const contextMenuContainer = __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").selectSVGElement().append('foreignObject').attr('class', 'daga-context-menu').attr('x', `${coordsRelativeToRoot[0] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('y', `${coordsRelativeToRoot[1] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('width', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).attr('height', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).style('pointer-events', 'none').on(exports.Events.ContextMenu, newEvent => {
7306
+ if (__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.ContextMenu)) {
7253
7307
  event.preventDefault();
7254
7308
  this.open(newEvent);
7255
7309
  }
@@ -7257,9 +7311,9 @@ class DiagramContextMenu {
7257
7311
  event.preventDefault();
7258
7312
  this.close();
7259
7313
  });
7260
- this.contextMenuContainer = contextMenuContainer;
7314
+ __classPrivateFieldSet(this, _DiagramContextMenu_contextMenuContainer, contextMenuContainer, "f");
7261
7315
  const buttons = [];
7262
- if (!(this.canvas.userSelection.length === 0) && this.canvas.canUserPerformAction(exports.DiagramActions.Clipboard) && this.canvas.canUserPerformAction(exports.DiagramActions.Remove)) {
7316
+ if (!(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").userSelection.length === 0) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.Clipboard) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.Remove)) {
7263
7317
  buttons.push({
7264
7318
  name: 'CUT',
7265
7319
  imageClass: 'daga-cut',
@@ -7269,7 +7323,7 @@ class DiagramContextMenu {
7269
7323
  }
7270
7324
  });
7271
7325
  }
7272
- if (!(this.canvas.userSelection.length === 0) && this.canvas.canUserPerformAction(exports.DiagramActions.Clipboard)) {
7326
+ if (!(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").userSelection.length === 0) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.Clipboard)) {
7273
7327
  buttons.push({
7274
7328
  name: 'COPY',
7275
7329
  imageClass: 'daga-copy',
@@ -7279,7 +7333,7 @@ class DiagramContextMenu {
7279
7333
  }
7280
7334
  });
7281
7335
  }
7282
- if (this.canvas.canUserPerformAction(exports.DiagramActions.Paste)) {
7336
+ if (__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.Paste)) {
7283
7337
  buttons.push({
7284
7338
  name: 'PASTE',
7285
7339
  imageClass: 'daga-paste',
@@ -7289,7 +7343,7 @@ class DiagramContextMenu {
7289
7343
  }
7290
7344
  });
7291
7345
  }
7292
- if (!(this.canvas.userSelection.length === 0) && this.canvas.canUserPerformAction(exports.DiagramActions.Remove)) {
7346
+ if (!(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").userSelection.length === 0) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.Remove)) {
7293
7347
  buttons.push({
7294
7348
  name: 'DELETE',
7295
7349
  imageClass: 'daga-delete',
@@ -7299,8 +7353,8 @@ class DiagramContextMenu {
7299
7353
  }
7300
7354
  });
7301
7355
  }
7302
- for (const customButton of this.config.customButtons || CONTEXT_MENU_DEFAULTS.customButtons) {
7303
- if (customButton.condition !== undefined ? customButton.condition(this.canvas) : true) {
7356
+ for (const customButton of __classPrivateFieldGet(this, _DiagramContextMenu_config, "f").customButtons || CONTEXT_MENU_DEFAULTS.customButtons) {
7357
+ if (customButton.condition !== undefined ? customButton.condition(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f")) : true) {
7304
7358
  buttons.push(customButton);
7305
7359
  }
7306
7360
  }
@@ -7319,12 +7373,12 @@ class DiagramContextMenu {
7319
7373
  const buttonContainer = contextMenuContainer.append('xhtml:div').attr('class', `daga-context-menu-button ${button.onPress !== undefined ? ' daga-clickable' : ''}`).attr('tabindex', 0).style('position', 'absolute').style('box-sizing', 'border-box').style('width', `${2 * CONTEXT_MENU_BUTTON_RADIUS}px`).style('height', `${2 * CONTEXT_MENU_BUTTON_RADIUS}px`).style('border-radius', `${CONTEXT_MENU_BUTTON_RADIUS}px`).style('pointer-events', 'auto').on(exports.Events.Click, event => {
7320
7374
  if (buttonOnPress) {
7321
7375
  event.preventDefault();
7322
- buttonOnPress(this.canvas);
7376
+ buttonOnPress(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f"));
7323
7377
  }
7324
7378
  }).on(exports.Events.KeyDown, event => {
7325
7379
  if (buttonOnPress && event.key === exports.Keys.Enter) {
7326
7380
  event.preventDefault();
7327
- buttonOnPress(this.canvas);
7381
+ buttonOnPress(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f"));
7328
7382
  }
7329
7383
  });
7330
7384
  if (button.imageClass !== undefined) {
@@ -7347,11 +7401,13 @@ class DiagramContextMenu {
7347
7401
  */
7348
7402
  close() {
7349
7403
  var _a;
7350
- (_a = this.contextMenuContainer) === null || _a === void 0 ? void 0 : _a.remove();
7351
- this.contextMenuContainer = undefined;
7404
+ (_a = __classPrivateFieldGet(this, _DiagramContextMenu_contextMenuContainer, "f")) === null || _a === void 0 ? void 0 : _a.remove();
7405
+ __classPrivateFieldSet(this, _DiagramContextMenu_contextMenuContainer, undefined, "f");
7352
7406
  }
7353
7407
  }
7408
+ _DiagramContextMenu_canvas = new WeakMap(), _DiagramContextMenu_config = new WeakMap(), _DiagramContextMenu_contextMenuContainer = new WeakMap();
7354
7409
 
7410
+ var _DiagramUserHighlight_canvas, _DiagramUserHighlight_focus, _DiagramUserHighlight_highlightSections;
7355
7411
  /**
7356
7412
  * Stores the functionality regarding the user highlight of a diagram canvas.
7357
7413
  * @public
@@ -7365,9 +7421,14 @@ class DiagramUserHighlight extends DiagramElementSet {
7365
7421
  */
7366
7422
  constructor(canvas, highlightSections = true) {
7367
7423
  super();
7368
- this.focus = undefined;
7369
- this.canvas = canvas;
7370
- this.highlightSections = highlightSections;
7424
+ _DiagramUserHighlight_canvas.set(this, void 0);
7425
+ _DiagramUserHighlight_focus.set(this, undefined);
7426
+ /**
7427
+ * Whether sections can be highlighted individually or the whole node must be highlighted when highlighting a section.
7428
+ */
7429
+ _DiagramUserHighlight_highlightSections.set(this, void 0);
7430
+ __classPrivateFieldSet(this, _DiagramUserHighlight_canvas, canvas, "f");
7431
+ __classPrivateFieldSet(this, _DiagramUserHighlight_highlightSections, highlightSections, "f");
7371
7432
  }
7372
7433
  /**
7373
7434
  * Gets the focus of the user highlight, which is the element where the current user highlight started regardless of which other elements were highlighted as a consequence.
@@ -7375,7 +7436,7 @@ class DiagramUserHighlight extends DiagramElementSet {
7375
7436
  * @returns A diagram element.
7376
7437
  */
7377
7438
  getFocus() {
7378
- return this.focus;
7439
+ return __classPrivateFieldGet(this, _DiagramUserHighlight_focus, "f");
7379
7440
  }
7380
7441
  /**
7381
7442
  * Unhighlights all highlighted elements and highlights the given element as the main element of the user highlight.
@@ -7383,7 +7444,7 @@ class DiagramUserHighlight extends DiagramElementSet {
7383
7444
  */
7384
7445
  focusOn(element) {
7385
7446
  this.clear();
7386
- this.focus = element;
7447
+ __classPrivateFieldSet(this, _DiagramUserHighlight_focus, element, "f");
7387
7448
  if ((element instanceof DiagramField || element instanceof DiagramDecorator) && element.rootElement) {
7388
7449
  this.focusOn(element.rootElement);
7389
7450
  } else {
@@ -7393,51 +7454,51 @@ class DiagramUserHighlight extends DiagramElementSet {
7393
7454
  add(element) {
7394
7455
  super.add(element);
7395
7456
  if (element instanceof DiagramNode) {
7396
- if (!this.highlightSections) {
7457
+ if (!__classPrivateFieldGet(this, _DiagramUserHighlight_highlightSections, "f")) {
7397
7458
  for (const section of element.sections) {
7398
7459
  super.add(section);
7399
7460
  for (const port of section.ports) {
7400
7461
  super.add(port);
7401
- this.canvas.updatePortsInView(port.id);
7462
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(port.id);
7402
7463
  }
7403
7464
  if (section.label) {
7404
7465
  super.add(section.label);
7405
- this.canvas.updateFieldsInView(section.label.id);
7466
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(section.label.id);
7406
7467
  }
7407
- this.canvas.updateSectionsInView(section.id);
7468
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateSectionsInView(section.id);
7408
7469
  }
7409
7470
  }
7410
7471
  for (const port of element.ports) {
7411
7472
  super.add(port);
7412
- this.canvas.updatePortsInView(port.id);
7473
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(port.id);
7413
7474
  }
7414
7475
  if (element.label) {
7415
7476
  super.add(element.label);
7416
- this.canvas.updateFieldsInView(element.label.id);
7477
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(element.label.id);
7417
7478
  }
7418
- this.canvas.updateNodesInView(element.id);
7479
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateNodesInView(element.id);
7419
7480
  } else if (element instanceof DiagramSection) {
7420
- if (!this.highlightSections && element.node) {
7481
+ if (!__classPrivateFieldGet(this, _DiagramUserHighlight_highlightSections, "f") && element.node) {
7421
7482
  this.add(element.node);
7422
7483
  } else {
7423
7484
  for (const port of element.ports) {
7424
7485
  super.add(port);
7425
- this.canvas.updatePortsInView(port.id);
7486
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(port.id);
7426
7487
  }
7427
7488
  if (element.label) {
7428
7489
  super.add(element.label);
7429
- this.canvas.updateFieldsInView(element.label.id);
7490
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(element.label.id);
7430
7491
  }
7431
- this.canvas.updateSectionsInView(element.id);
7492
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateSectionsInView(element.id);
7432
7493
  }
7433
7494
  } else if (element instanceof DiagramPort) {
7434
7495
  if (element.label) {
7435
7496
  super.add(element.label);
7436
- this.canvas.updateFieldsInView(element.label.id);
7497
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(element.label.id);
7437
7498
  }
7438
- this.canvas.updatePortsInView(element.id);
7499
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(element.id);
7439
7500
  } else if (element instanceof DiagramConnection) {
7440
- this.canvas.updateConnectionsInView(element.id);
7501
+ __classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateConnectionsInView(element.id);
7441
7502
  }
7442
7503
  }
7443
7504
  clear() {
@@ -7446,9 +7507,10 @@ class DiagramUserHighlight extends DiagramElementSet {
7446
7507
  this.remove(entity.id);
7447
7508
  entity.updateInView();
7448
7509
  }
7449
- this.focus = undefined;
7510
+ __classPrivateFieldSet(this, _DiagramUserHighlight_focus, undefined, "f");
7450
7511
  }
7451
7512
  }
7513
+ _DiagramUserHighlight_canvas = new WeakMap(), _DiagramUserHighlight_focus = new WeakMap(), _DiagramUserHighlight_highlightSections = new WeakMap();
7452
7514
 
7453
7515
  const DAGA_FILE_VERSION = 1;
7454
7516
 
@@ -7660,6 +7722,7 @@ class DagaExporter {
7660
7722
  }
7661
7723
  }
7662
7724
 
7725
+ var _DiagramUserSelection_instances, _DiagramUserSelection_canvas, _DiagramUserSelection_diagramPropertiesText, _DiagramUserSelection_propertyEditorSelection, _DiagramUserSelection_propertyEditorValues, _DiagramUserSelection_makeUpdateValuesAction;
7663
7726
  /**
7664
7727
  * Text to display by default as the title of the property editor when editing the properties of a diagram's value set.
7665
7728
  * @private
@@ -7680,12 +7743,17 @@ class DiagramUserSelection extends DiagramElementSet {
7680
7743
  */
7681
7744
  constructor(canvas, diagramPropertiesText) {
7682
7745
  super();
7683
- this.canvas = canvas;
7746
+ _DiagramUserSelection_instances.add(this);
7747
+ _DiagramUserSelection_canvas.set(this, void 0);
7748
+ _DiagramUserSelection_diagramPropertiesText.set(this, void 0);
7749
+ _DiagramUserSelection_propertyEditorSelection.set(this, void 0);
7750
+ _DiagramUserSelection_propertyEditorValues.set(this, void 0);
7751
+ __classPrivateFieldSet(this, _DiagramUserSelection_canvas, canvas, "f");
7684
7752
  // TODO: would be a good idea to be able to configure how often this fires, or whether at all
7685
- this.canvas.propertyEditorChanges$.pipe(rxjs.debounceTime(2000)).subscribe(() => {
7686
- this.makeUpdateValuesAction();
7753
+ __classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").propertyEditorChanges$.pipe(rxjs.debounceTime(2000)).subscribe(() => {
7754
+ __classPrivateFieldGet(this, _DiagramUserSelection_instances, "m", _DiagramUserSelection_makeUpdateValuesAction).call(this);
7687
7755
  });
7688
- this.diagramPropertiesText = diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT;
7756
+ __classPrivateFieldSet(this, _DiagramUserSelection_diagramPropertiesText, diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT, "f");
7689
7757
  }
7690
7758
  add(element) {
7691
7759
  if (this.contains(element.id)) {
@@ -7694,9 +7762,9 @@ class DiagramUserSelection extends DiagramElementSet {
7694
7762
  }
7695
7763
  if (this.length === 0) {
7696
7764
  // if there is nothing else selected, open our selection in the property editor
7697
- if (this.propertyEditorSelection === undefined && (element instanceof DiagramNode || element instanceof DiagramConnection)) {
7765
+ if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === undefined && (element instanceof DiagramNode || element instanceof DiagramConnection)) {
7698
7766
  this.openInPropertyEditor(element);
7699
- } else if (this.propertyEditorSelection === undefined && element instanceof DiagramSection) {
7767
+ } else if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === undefined && element instanceof DiagramSection) {
7700
7768
  this.openInPropertyEditor(element.node);
7701
7769
  } else {
7702
7770
  this.openInPropertyEditor(undefined);
@@ -7718,7 +7786,7 @@ class DiagramUserSelection extends DiagramElementSet {
7718
7786
  remove(id) {
7719
7787
  const element = this.get(id);
7720
7788
  if (element) {
7721
- if (this.propertyEditorSelection === element) {
7789
+ if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === element) {
7722
7790
  this.openInPropertyEditor(undefined);
7723
7791
  }
7724
7792
  super.remove(id);
@@ -7789,9 +7857,9 @@ class DiagramUserSelection extends DiagramElementSet {
7789
7857
  fieldIdsToBeDeleted.push(userSelectionElement.id);
7790
7858
  }
7791
7859
  }
7792
- const removeAction = new RemoveAction(this.canvas, nodeIdsToBeDeleted, sectionIdsToBeDeleted, portIdsToBeDeleted, connectionIdsToBeDeleted, fieldIdsToBeDeleted);
7860
+ const removeAction = new RemoveAction(__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f"), nodeIdsToBeDeleted, sectionIdsToBeDeleted, portIdsToBeDeleted, connectionIdsToBeDeleted, fieldIdsToBeDeleted);
7793
7861
  removeAction.do();
7794
- this.canvas.actionStack.add(removeAction);
7862
+ __classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").actionStack.add(removeAction);
7795
7863
  }
7796
7864
  }
7797
7865
  /**
@@ -7834,8 +7902,8 @@ class DiagramUserSelection extends DiagramElementSet {
7834
7902
  if (userSelection.type !== 'daga-user-selection') {
7835
7903
  return;
7836
7904
  }
7837
- const action = new PasteAction(this.canvas, userSelection.nodes, userSelection.connections, coords);
7838
- this.canvas.actionStack.add(action);
7905
+ const action = new PasteAction(__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f"), userSelection.nodes, userSelection.connections, coords);
7906
+ __classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").actionStack.add(action);
7839
7907
  action.do();
7840
7908
  } catch (_a) {
7841
7909
  return;
@@ -7853,17 +7921,17 @@ class DiagramUserSelection extends DiagramElementSet {
7853
7921
  openInPropertyEditor(selection, makeUpdateValuesAction = true) {
7854
7922
  var _a;
7855
7923
  if (makeUpdateValuesAction) {
7856
- this.makeUpdateValuesAction();
7924
+ __classPrivateFieldGet(this, _DiagramUserSelection_instances, "m", _DiagramUserSelection_makeUpdateValuesAction).call(this);
7857
7925
  }
7858
- const propertyEditor = (_a = this.canvas.parentComponent) === null || _a === void 0 ? void 0 : _a.propertyEditor;
7926
+ const propertyEditor = (_a = __classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").parentComponent) === null || _a === void 0 ? void 0 : _a.propertyEditor;
7859
7927
  if (propertyEditor === undefined) {
7860
7928
  return;
7861
7929
  }
7862
7930
  const selectedValueSet = selection === null || selection === void 0 ? void 0 : selection.valueSet;
7863
7931
  if (selectedValueSet) {
7864
- this.propertyEditorSelection = selection;
7932
+ __classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorSelection, selection, "f");
7865
7933
  if (makeUpdateValuesAction) {
7866
- this.propertyEditorValues = clone(selectedValueSet.getValues());
7934
+ __classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorValues, clone(selectedValueSet.getValues()), "f");
7867
7935
  }
7868
7936
  if (propertyEditor) {
7869
7937
  if (selection instanceof DiagramNode || selection instanceof DiagramConnection) {
@@ -7880,42 +7948,43 @@ class DiagramUserSelection extends DiagramElementSet {
7880
7948
  propertyEditor.valueSet = undefined;
7881
7949
  propertyEditor.valueSet = selectedValueSet;
7882
7950
  } else {
7883
- propertyEditor.title = this.diagramPropertiesText;
7951
+ propertyEditor.title = __classPrivateFieldGet(this, _DiagramUserSelection_diagramPropertiesText, "f");
7884
7952
  // force the update of the valueSet
7885
7953
  propertyEditor.valueSet = undefined;
7886
7954
  propertyEditor.valueSet = selectedValueSet;
7887
7955
  }
7888
7956
  }
7889
7957
  } else {
7890
- this.propertyEditorSelection = undefined;
7891
- this.propertyEditorValues = undefined;
7958
+ __classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorSelection, undefined, "f");
7959
+ __classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorValues, undefined, "f");
7892
7960
  if (propertyEditor) {
7893
7961
  propertyEditor.title = '';
7894
7962
  propertyEditor.valueSet = undefined;
7895
7963
  }
7896
7964
  }
7897
7965
  }
7898
- makeUpdateValuesAction() {
7899
- var _a, _b, _c;
7900
- if (this.propertyEditorSelection === undefined || this.propertyEditorValues === undefined) {
7901
- return;
7902
- }
7903
- const previousSelectionId = this.propertyEditorSelection instanceof DiagramModel ? undefined : this.propertyEditorSelection.id;
7904
- // check if there have been changes in the previously selected ValueSet,
7905
- // and create an UpdateValuesAction if there have
7906
- if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a === void 0 ? void 0 : _a.valueSet.getValues())) {
7907
- return;
7908
- }
7909
- const from = this.propertyEditorValues;
7910
- const to = clone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
7911
- const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === void 0 ? void 0 : _c.valueSet);
7912
- const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
7913
- currentAction.do();
7914
- this.canvas.actionStack.add(currentAction);
7915
- this.propertyEditorValues = to;
7916
- }
7917
7966
  }
7967
+ _DiagramUserSelection_canvas = new WeakMap(), _DiagramUserSelection_diagramPropertiesText = new WeakMap(), _DiagramUserSelection_propertyEditorSelection = new WeakMap(), _DiagramUserSelection_propertyEditorValues = new WeakMap(), _DiagramUserSelection_instances = new WeakSet(), _DiagramUserSelection_makeUpdateValuesAction = function _DiagramUserSelection_makeUpdateValuesAction() {
7968
+ var _a, _b, _c;
7969
+ if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === undefined || __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorValues, "f") === undefined) {
7970
+ return;
7971
+ }
7972
+ const previousSelectionId = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") instanceof DiagramModel ? undefined : __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f").id;
7973
+ // check if there have been changes in the previously selected ValueSet,
7974
+ // and create an UpdateValuesAction if there have
7975
+ if (equals(__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorValues, "f"), (_a = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f")) === null || _a === void 0 ? void 0 : _a.valueSet.getValues())) {
7976
+ return;
7977
+ }
7978
+ const from = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorValues, "f");
7979
+ const to = clone((_b = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f")) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
7980
+ const [fromDiff, toDiff] = diffProperties(from, to, (_c = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f")) === null || _c === void 0 ? void 0 : _c.valueSet);
7981
+ const currentAction = new UpdateValuesAction(__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f"), previousSelectionId, fromDiff, toDiff);
7982
+ currentAction.do();
7983
+ __classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").actionStack.add(currentAction);
7984
+ __classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorValues, to, "f");
7985
+ };
7918
7986
 
7987
+ var _DiagramCanvas_instances, _a, _DiagramCanvas_canvasCount, _DiagramCanvas_diagramRoot, _DiagramCanvas_connectionType, _DiagramCanvas_gridPatternId, _DiagramCanvas_ancillaryGridPatternIds, _DiagramCanvas_zoomBehavior, _DiagramCanvas_zoomTransform, _DiagramCanvas_priorityThreshold, _DiagramCanvas_priorityThresholds, _DiagramCanvas_unfinishedConnection, _DiagramCanvas_unfinishedConnectionTracer, _DiagramCanvas_unfinishedConnectionPort, _DiagramCanvas_inputFieldContainer, _DiagramCanvas_multipleSelectionContainer, _DiagramCanvas_draggingFrom, _DiagramCanvas_dragging, _DiagramCanvas_secondaryButton, _DiagramCanvas_currentAction, _DiagramCanvas_updateConnectionLabelsInView, _DiagramCanvas_updateConnectionMarkersInView, _DiagramCanvas_startConnection, _DiagramCanvas_finishConnection, _DiagramCanvas_dropConnection, _DiagramCanvas_createInputField, _DiagramCanvas_removeInputField, _DiagramCanvas_minimumSizeOfField, _DiagramCanvas_setFieldTextAndWrap, _DiagramCanvas_setFieldText, _DiagramCanvas_startMovingNode, _DiagramCanvas_continueMovingNode, _DiagramCanvas_finishMovingNode, _DiagramCanvas_startMultipleSelection, _DiagramCanvas_continueMultipleSelection, _DiagramCanvas_finishMultipleSelection;
7919
7988
  /**
7920
7989
  * Thickness of the invisible path around a connection used to make it easier to click on, in diagram units.
7921
7990
  * @private
@@ -7930,13 +7999,13 @@ const ACTION_STACK_SIZE = 25;
7930
7999
  const UNFINISHED_CONNECTION_ID = 'diagram-connection-unfinished';
7931
8000
  class DiagramCanvas {
7932
8001
  get connectionType() {
7933
- return this._connectionType;
8002
+ return __classPrivateFieldGet(this, _DiagramCanvas_connectionType, "f");
7934
8003
  }
7935
8004
  set connectionType(value) {
7936
- var _a, _b;
7937
- this._connectionType = value;
8005
+ var _b, _c;
8006
+ __classPrivateFieldSet(this, _DiagramCanvas_connectionType, value, "f");
7938
8007
  // refresh the palette every time connectionType is set so that the palette keeps track of updates to the connectionType
7939
- (_b = (_a = this.parentComponent) === null || _a === void 0 ? void 0 : _a.palette) === null || _b === void 0 ? void 0 : _b.refreshPalette();
8008
+ (_c = (_b = this.parentComponent) === null || _b === void 0 ? void 0 : _b.palette) === null || _c === void 0 ? void 0 : _c.refreshPalette();
7940
8009
  }
7941
8010
  /**
7942
8011
  * Constructs a canvas object.
@@ -7945,45 +8014,62 @@ class DiagramCanvas {
7945
8014
  * @param config The configuration object used to set the parameters of this canvas.
7946
8015
  */
7947
8016
  constructor(parentComponent, config) {
7948
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
7949
- this.gridPatternId = `daga-grid-pattern-id-${++DiagramCanvas.canvasCount}`;
7950
- this.ancillaryGridPatternIds = [];
7951
- this.zoomTransform = d3__namespace.zoomIdentity;
8017
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
8018
+ var _z, _0;
8019
+ _DiagramCanvas_instances.add(this);
8020
+ _DiagramCanvas_diagramRoot.set(this, void 0);
8021
+ _DiagramCanvas_connectionType.set(this, void 0);
8022
+ _DiagramCanvas_gridPatternId.set(this, `daga-grid-pattern-id-${__classPrivateFieldSet(_z = _a, _a, (_0 = __classPrivateFieldGet(_z, _a, "f", _DiagramCanvas_canvasCount), ++_0), "f", _DiagramCanvas_canvasCount)}`);
8023
+ _DiagramCanvas_ancillaryGridPatternIds.set(this, []);
8024
+ _DiagramCanvas_zoomBehavior.set(this, void 0);
8025
+ _DiagramCanvas_zoomTransform.set(this, d3__namespace.zoomIdentity);
8026
+ _DiagramCanvas_priorityThreshold.set(this, void 0);
8027
+ _DiagramCanvas_priorityThresholds.set(this, void 0);
8028
+ _DiagramCanvas_unfinishedConnection.set(this, void 0);
8029
+ /**
8030
+ * Invisible path followed by an unfinished connection. Used for making unfinished connections stop before the cursor rather than stopping right at the cursor.
8031
+ */
8032
+ _DiagramCanvas_unfinishedConnectionTracer.set(this, void 0);
8033
+ _DiagramCanvas_unfinishedConnectionPort.set(this, void 0);
8034
+ _DiagramCanvas_inputFieldContainer.set(this, void 0);
8035
+ _DiagramCanvas_multipleSelectionContainer.set(this, void 0);
7952
8036
  // used to distinguish drags from clicks when dragging elements and during multiple selection
7953
- this.draggingFrom = [0, 0];
8037
+ _DiagramCanvas_draggingFrom.set(this, [0, 0]);
7954
8038
  // used to distinguish drags from clicks during multiple selection
7955
- this.dragging = false;
8039
+ _DiagramCanvas_dragging.set(this, false);
7956
8040
  // used to track whether a click is secondary or primary
7957
- this.secondaryButton = false;
8041
+ _DiagramCanvas_secondaryButton.set(this, false);
8042
+ // current action that started but hasn't finished yet
8043
+ _DiagramCanvas_currentAction.set(this, void 0);
7958
8044
  this.validatorChange$ = new rxjs.Subject();
7959
8045
  this.diagramChange$ = new rxjs.Subject();
7960
8046
  this.diagramEvent$ = new rxjs.Subject();
7961
8047
  this.propertyEditorChanges$ = new rxjs.Subject();
7962
8048
  this.parentComponent = parentComponent;
7963
8049
  this.model = new DiagramModel(this, undefined, config.name || 'unnamed', '', config.type || '', config.properties || []);
7964
- this.userSelection = new DiagramUserSelection(this, (_b = (_a = config.components) === null || _a === void 0 ? void 0 : _a.propertyEditor) === null || _b === void 0 ? void 0 : _b.title);
7965
- this.userHighlight = new DiagramUserHighlight(this, ((_c = config.canvas) === null || _c === void 0 ? void 0 : _c.highlightSections) !== false);
7966
- this.contextMenu = new DiagramContextMenu(this, (_d = config.canvas) === null || _d === void 0 ? void 0 : _d.contextMenu);
8050
+ this.userSelection = new DiagramUserSelection(this, (_c = (_b = config.components) === null || _b === void 0 ? void 0 : _b.propertyEditor) === null || _c === void 0 ? void 0 : _c.title);
8051
+ this.userHighlight = new DiagramUserHighlight(this, ((_d = config.canvas) === null || _d === void 0 ? void 0 : _d.highlightSections) !== false);
8052
+ this.contextMenu = new DiagramContextMenu(this, (_e = config.canvas) === null || _e === void 0 ? void 0 : _e.contextMenu);
7967
8053
  // TODO
7968
- this.backgroundConfig = (_f = (_e = config.canvas) === null || _e === void 0 ? void 0 : _e.background) !== null && _f !== void 0 ? _f : BACKGROUND_DEFAULTS;
7969
- this.gridConfig = applyGridDefaults((_g = config.canvas) === null || _g === void 0 ? void 0 : _g.grid);
8054
+ this.backgroundConfig = (_g = (_f = config.canvas) === null || _f === void 0 ? void 0 : _f.background) !== null && _g !== void 0 ? _g : BACKGROUND_DEFAULTS;
8055
+ this.gridConfig = applyGridDefaults((_h = config.canvas) === null || _h === void 0 ? void 0 : _h.grid);
7970
8056
  this.ancillaryGridsConfig = [];
7971
- for (let i = 0; i < (((_j = (_h = config.canvas) === null || _h === void 0 ? void 0 : _h.ancillaryGrids) === null || _j === void 0 ? void 0 : _j.length) || 0); ++i) {
7972
- this.ancillaryGridsConfig.push(applyGridDefaults((_l = (_k = config.canvas) === null || _k === void 0 ? void 0 : _k.ancillaryGrids) === null || _l === void 0 ? void 0 : _l[i]));
7973
- this.ancillaryGridPatternIds.push(`${this.gridPatternId}-ancillary-${i}`);
7974
- }
7975
- this.zoomFactor = ((_m = config.canvas) === null || _m === void 0 ? void 0 : _m.zoomFactor) || 2;
7976
- this.panRate = ((_o = config.canvas) === null || _o === void 0 ? void 0 : _o.panRate) || 100;
7977
- this.inferConnectionType = ((_p = config.connectionSettings) === null || _p === void 0 ? void 0 : _p.inferConnectionType) || false;
7978
- this.autoTightenConnections = ((_q = config.connectionSettings) === null || _q === void 0 ? void 0 : _q.autoTighten) !== false;
7979
- this.tightenConnectionsAcrossPortTypes = ((_r = config.connectionSettings) === null || _r === void 0 ? void 0 : _r.tightenAcrossPortTypes) || false;
7980
- this.allowConnectionLoops = ((_s = config.connectionSettings) === null || _s === void 0 ? void 0 : _s.allowLoops) || false;
7981
- this.allowSharingPorts = ((_t = config.connectionSettings) === null || _t === void 0 ? void 0 : _t.sharePorts) !== false;
7982
- this.allowSharingBothPorts = ((_u = config.connectionSettings) === null || _u === void 0 ? void 0 : _u.shareBothPorts) || false;
7983
- this.portHighlightRadius = ((_v = config.connectionSettings) === null || _v === void 0 ? void 0 : _v.portHighlightRadius) || 100;
8057
+ for (let i = 0; i < (((_k = (_j = config.canvas) === null || _j === void 0 ? void 0 : _j.ancillaryGrids) === null || _k === void 0 ? void 0 : _k.length) || 0); ++i) {
8058
+ this.ancillaryGridsConfig.push(applyGridDefaults((_m = (_l = config.canvas) === null || _l === void 0 ? void 0 : _l.ancillaryGrids) === null || _m === void 0 ? void 0 : _m[i]));
8059
+ __classPrivateFieldGet(this, _DiagramCanvas_ancillaryGridPatternIds, "f").push(`${__classPrivateFieldGet(this, _DiagramCanvas_gridPatternId, "f")}-ancillary-${i}`);
8060
+ }
8061
+ this.zoomFactor = ((_o = config.canvas) === null || _o === void 0 ? void 0 : _o.zoomFactor) || 2;
8062
+ this.panRate = ((_p = config.canvas) === null || _p === void 0 ? void 0 : _p.panRate) || 100;
8063
+ this.inferConnectionType = ((_q = config.connectionSettings) === null || _q === void 0 ? void 0 : _q.inferConnectionType) || false;
8064
+ this.autoTightenConnections = ((_r = config.connectionSettings) === null || _r === void 0 ? void 0 : _r.autoTighten) !== false;
8065
+ this.tightenConnectionsAcrossPortTypes = ((_s = config.connectionSettings) === null || _s === void 0 ? void 0 : _s.tightenAcrossPortTypes) || false;
8066
+ this.allowConnectionLoops = ((_t = config.connectionSettings) === null || _t === void 0 ? void 0 : _t.allowLoops) || false;
8067
+ this.allowSharingPorts = ((_u = config.connectionSettings) === null || _u === void 0 ? void 0 : _u.sharePorts) !== false;
8068
+ this.allowSharingBothPorts = ((_v = config.connectionSettings) === null || _v === void 0 ? void 0 : _v.shareBothPorts) || false;
8069
+ this.portHighlightRadius = ((_w = config.connectionSettings) === null || _w === void 0 ? void 0 : _w.portHighlightRadius) || 100;
7984
8070
  this.multipleSelectionOn = false;
7985
- this.priorityThresholds = ((_w = config.canvas) === null || _w === void 0 ? void 0 : _w.priorityThresholds) || [];
7986
- this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
8071
+ __classPrivateFieldSet(this, _DiagramCanvas_priorityThresholds, ((_x = config.canvas) === null || _x === void 0 ? void 0 : _x.priorityThresholds) || [], "f");
8072
+ __classPrivateFieldSet(this, _DiagramCanvas_priorityThreshold, __classPrivateFieldGet(this, _DiagramCanvas_priorityThresholds, "f") ? __classPrivateFieldGet(this, _DiagramCanvas_priorityThresholds, "f")[0] : undefined, "f");
7987
8073
  this.layoutFormat = config.layoutFormat;
7988
8074
  this.userActions = config.userActions || {};
7989
8075
  this.validators = [];
@@ -8009,7 +8095,7 @@ class DiagramCanvas {
8009
8095
  const connectionType = new DiagramConnectionType(Object.assign(Object.assign({}, config.connectionTypeDefaults), connectionTypeConfig));
8010
8096
  this.model.connections.types.add(connectionType);
8011
8097
  }
8012
- this._connectionType = ((_x = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _x === void 0 ? void 0 : _x.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined;
8098
+ __classPrivateFieldSet(this, _DiagramCanvas_connectionType, ((_y = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _y === void 0 ? void 0 : _y.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined, "f");
8013
8099
  }
8014
8100
  }
8015
8101
  addValidator(validator) {
@@ -8021,38 +8107,38 @@ class DiagramCanvas {
8021
8107
  this.validatorChange$.next();
8022
8108
  }
8023
8109
  getPriorityThresholdOptions() {
8024
- return this.priorityThresholds;
8110
+ return __classPrivateFieldGet(this, _DiagramCanvas_priorityThresholds, "f");
8025
8111
  }
8026
8112
  getPriorityThreshold() {
8027
- return this.priorityThreshold;
8113
+ return __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f");
8028
8114
  }
8029
8115
  setPriorityThreshold(priority) {
8030
- var _a, _b;
8031
- this.priorityThreshold = priority;
8116
+ var _b, _c;
8117
+ __classPrivateFieldSet(this, _DiagramCanvas_priorityThreshold, priority, "f");
8032
8118
  this.updateModelInView();
8033
8119
  for (const node of this.model.nodes) {
8034
8120
  this.fitNodeInView(node.id);
8035
8121
  }
8036
- (_b = (_a = this.parentComponent) === null || _a === void 0 ? void 0 : _a.palette) === null || _b === void 0 ? void 0 : _b.refreshPalette();
8122
+ (_c = (_b = this.parentComponent) === null || _b === void 0 ? void 0 : _b.palette) === null || _c === void 0 ? void 0 : _c.refreshPalette();
8037
8123
  }
8038
8124
  // View methods
8039
8125
  initView(appendTo) {
8040
8126
  const appendToSelection = d3__namespace.select(appendTo);
8041
8127
  // remove all children
8042
8128
  appendToSelection.html('');
8043
- this.diagramRoot = appendToSelection.append('div').node();
8129
+ __classPrivateFieldSet(this, _DiagramCanvas_diagramRoot, appendToSelection.append('div').node(), "f");
8044
8130
  this.selectRoot().attr('tabindex', 0) // make element focusable
8045
8131
  .style('width', '100%').style('height', '100%').append('svg').style('width', '100%').style('height', '100%');
8046
8132
  this.selectRoot().on(exports.Events.Click, () => {
8047
- var _a;
8133
+ var _b;
8048
8134
  // focus on the diagram when clicking so that we can focus on the diagram
8049
8135
  // keyboard events only work if we're focusing on the diagram
8050
- (_a = this.selectRoot().node()) === null || _a === void 0 ? void 0 : _a.focus();
8136
+ (_b = this.selectRoot().node()) === null || _b === void 0 ? void 0 : _b.focus();
8051
8137
  }).on(exports.Events.ContextMenu, event => {
8052
- if (this.dragging) {
8138
+ if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
8053
8139
  event.preventDefault();
8054
8140
  event.stopPropagation();
8055
- this.dragging = false;
8141
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
8056
8142
  return;
8057
8143
  }
8058
8144
  const diagramEvent = new DiagramSecondaryClickEvent(event, null);
@@ -8161,33 +8247,33 @@ class DiagramCanvas {
8161
8247
  if (this.canUserPerformAction(exports.DiagramActions.Zoom)) {
8162
8248
  event.preventDefault();
8163
8249
  // move left, faster if we're zoomed out and slower if we're zoomed in
8164
- this.translateBy(this.panRate / this.zoomTransform.k, 0);
8250
+ this.translateBy(this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, 0);
8165
8251
  }
8166
8252
  }
8167
8253
  if (event.key === exports.Keys.ArrowRight) {
8168
8254
  if (this.canUserPerformAction(exports.DiagramActions.Zoom)) {
8169
8255
  event.preventDefault();
8170
8256
  // move right, faster if we're zoomed out and slower if we're zoomed in
8171
- this.translateBy(-this.panRate / this.zoomTransform.k, 0);
8257
+ this.translateBy(-this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, 0);
8172
8258
  }
8173
8259
  }
8174
8260
  if (event.key === exports.Keys.ArrowDown) {
8175
8261
  if (this.canUserPerformAction(exports.DiagramActions.Zoom)) {
8176
8262
  event.preventDefault();
8177
8263
  // move down, faster if we're zoomed out and slower if we're zoomed in
8178
- this.translateBy(0, -this.panRate / this.zoomTransform.k);
8264
+ this.translateBy(0, -this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k);
8179
8265
  }
8180
8266
  }
8181
8267
  if (event.key === exports.Keys.ArrowUp) {
8182
8268
  if (this.canUserPerformAction(exports.DiagramActions.Zoom)) {
8183
8269
  event.preventDefault();
8184
8270
  // move up, faster if we're zoomed out and slower if we're zoomed in
8185
- this.translateBy(0, this.panRate / this.zoomTransform.k);
8271
+ this.translateBy(0, this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k);
8186
8272
  }
8187
8273
  }
8188
8274
  });
8189
8275
  const canvasView = this.selectSVGElement().append('g').attr('class', 'daga-canvas-view').attr('width', `100%`).attr('height', `100%`);
8190
- canvasView.call(this.zoomBehavior = d3__namespace.zoom().filter(event => {
8276
+ canvasView.call(__classPrivateFieldSet(this, _DiagramCanvas_zoomBehavior, d3__namespace.zoom().filter(event => {
8191
8277
  // Disable double-click zoom by filtering out dblclick events
8192
8278
  return event.type !== exports.Events.DoubleClick;
8193
8279
  }).on(exports.ZoomEvents.Zoom, event => {
@@ -8208,29 +8294,29 @@ class DiagramCanvas {
8208
8294
  setCursorStyle(exports.CursorStyle.AllScroll);
8209
8295
  }
8210
8296
  }
8211
- this.zoomTransform = event.transform;
8297
+ __classPrivateFieldSet(this, _DiagramCanvas_zoomTransform, event.transform, "f");
8212
8298
  const transformAttribute = event.transform.toString();
8213
8299
  this.selectCanvasElements().attr('transform', transformAttribute);
8214
- for (const gridPatternId of [this.gridPatternId, ...this.ancillaryGridPatternIds]) {
8300
+ for (const gridPatternId of [__classPrivateFieldGet(this, _DiagramCanvas_gridPatternId, "f"), ...__classPrivateFieldGet(this, _DiagramCanvas_ancillaryGridPatternIds, "f")]) {
8215
8301
  this.selectCanvasView().select(`#${gridPatternId}`).attr('patternTransform', transformAttribute);
8216
8302
  }
8217
8303
  this.contextMenu.close();
8218
- this.diagramEvent$.next(new DiagramZoomEvent([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
8304
+ this.diagramEvent$.next(new DiagramZoomEvent([__classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x, __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y], __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k));
8219
8305
  }).on(exports.ZoomEvents.End, () => {
8220
8306
  setCursorStyle();
8221
- }));
8307
+ }), "f"));
8222
8308
  const canvasDefs = canvasView.append('defs');
8223
8309
  const canvasBackground = [];
8224
8310
  canvasBackground.push(initializeBackground(canvasView, this.backgroundConfig).attr('class', 'daga-background'));
8225
8311
  for (let i = 0; i < this.ancillaryGridsConfig.length; ++i) {
8226
- canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, this.ancillaryGridPatternIds[i], this.ancillaryGridsConfig[i]));
8312
+ canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, __classPrivateFieldGet(this, _DiagramCanvas_ancillaryGridPatternIds, "f")[i], this.ancillaryGridsConfig[i]));
8227
8313
  }
8228
- canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, this.gridPatternId, this.gridConfig));
8314
+ canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, __classPrivateFieldGet(this, _DiagramCanvas_gridPatternId, "f"), this.gridConfig));
8229
8315
  for (const canvasBackgroundElement of canvasBackground) {
8230
8316
  canvasBackgroundElement.on(exports.Events.MouseMove, event => {
8231
- if (this.unfinishedConnection !== undefined) {
8317
+ if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") !== undefined) {
8232
8318
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8233
- this.unfinishedConnection.endCoords = pointerCoords;
8319
+ __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endCoords = pointerCoords;
8234
8320
  }
8235
8321
  });
8236
8322
  canvasBackgroundElement.on(exports.Events.MouseOver, () => {
@@ -8255,55 +8341,55 @@ class DiagramCanvas {
8255
8341
  canvasBackgroundElement.call(d3__namespace.drag().filter(event => {
8256
8342
  return this.multipleSelectionOn || isSecondaryButton(event);
8257
8343
  }).on(exports.DragEvents.Start, event => {
8258
- this.startMultipleSelection(event);
8344
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
8259
8345
  }).on(exports.DragEvents.Drag, event => {
8260
- this.continueMultipleSelection(event);
8346
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
8261
8347
  }).on(exports.DragEvents.End, event => {
8262
- this.finishMultipleSelection(event);
8348
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
8263
8349
  }));
8264
8350
  }
8265
8351
  canvasView.append('g').attr('class', 'daga-canvas-elements');
8266
8352
  }
8267
8353
  getZoomLevel() {
8268
- return this.zoomTransform.k;
8354
+ return __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k;
8269
8355
  }
8270
8356
  zoomBy(factor) {
8271
8357
  if (!isNaN(factor)) {
8272
- this.zoomBehavior.scaleBy(this.selectCanvasView(), factor);
8358
+ __classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleBy(this.selectCanvasView(), factor);
8273
8359
  }
8274
8360
  }
8275
8361
  zoomTo(level) {
8276
8362
  if (!isNaN(level)) {
8277
- this.zoomBehavior.scaleTo(this.selectCanvasView(), level);
8363
+ __classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleTo(this.selectCanvasView(), level);
8278
8364
  }
8279
8365
  }
8280
8366
  getViewCoordinates() {
8281
- var _a, _b, _c;
8282
- const canvasViewBoundingBox = (_c = (_b = (_a = this.selectCanvasView()) === null || _a === void 0 ? void 0 : _a.select('.daga-background')) === null || _b === void 0 ? void 0 : _b.node()) === null || _c === void 0 ? void 0 : _c.getBBox();
8367
+ var _b, _c, _d;
8368
+ const canvasViewBoundingBox = (_d = (_c = (_b = this.selectCanvasView()) === null || _b === void 0 ? void 0 : _b.select('.daga-background')) === null || _c === void 0 ? void 0 : _c.node()) === null || _d === void 0 ? void 0 : _d.getBBox();
8283
8369
  /*
8284
8370
  transform the coordinates of the zoomTransform to the coordinates
8285
8371
  needed to point the zoomTransfrom to the center of the screen to
8286
8372
  ensure that canvas.translateTo(getViewCoordinates()) has no effect
8287
8373
  */
8288
- return [((canvasViewBoundingBox.width + canvasViewBoundingBox.x) / 2 - this.zoomTransform.x) / this.zoomTransform.k, ((canvasViewBoundingBox.height + canvasViewBoundingBox.y) / 2 - this.zoomTransform.y) / this.zoomTransform.k];
8374
+ return [((canvasViewBoundingBox.width + canvasViewBoundingBox.x) / 2 - __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x) / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, ((canvasViewBoundingBox.height + canvasViewBoundingBox.y) / 2 - __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y) / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k];
8289
8375
  }
8290
8376
  translateBy(x, y) {
8291
8377
  if (!isNaN(x) && !isNaN(y)) {
8292
- this.zoomBehavior.translateBy(this.selectCanvasView(), x, y);
8378
+ __classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateBy(this.selectCanvasView(), x, y);
8293
8379
  }
8294
8380
  }
8295
8381
  translateTo(x, y) {
8296
8382
  if (!isNaN(x) && !isNaN(y)) {
8297
- this.zoomBehavior.translateTo(this.selectCanvasView(), x, y);
8383
+ __classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateTo(this.selectCanvasView(), x, y);
8298
8384
  }
8299
8385
  }
8300
8386
  zoomAndPanTo(x, y, z, duration) {
8301
8387
  if (!duration || duration <= 0) {
8302
- this.zoomBehavior.scaleTo(this.selectCanvasView(), z);
8303
- this.zoomBehavior.translateTo(this.selectCanvasView(), x, y);
8388
+ __classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleTo(this.selectCanvasView(), z);
8389
+ __classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateTo(this.selectCanvasView(), x, y);
8304
8390
  return;
8305
8391
  }
8306
- this.zoomBehavior.interpolate(d3__namespace.interpolate);
8392
+ __classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").interpolate(d3__namespace.interpolate);
8307
8393
  const [startingX, startingY] = this.getViewCoordinates();
8308
8394
  const startingZoom = this.getZoomLevel();
8309
8395
  const targetX = x,
@@ -8317,8 +8403,8 @@ class DiagramCanvas {
8317
8403
  const currentX = value * (targetX - startingX) + startingX;
8318
8404
  const currentY = value * (targetY - startingY) + startingY;
8319
8405
  const currentZoom = value * (targetZoom - startingZoom) + startingZoom;
8320
- this.zoomBehavior.scaleTo(this.selectCanvasView(), currentZoom);
8321
- this.zoomBehavior.translateTo(this.selectCanvasView(), currentX, currentY);
8406
+ __classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleTo(this.selectCanvasView(), currentZoom);
8407
+ __classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateTo(this.selectCanvasView(), currentX, currentY);
8322
8408
  }
8323
8409
  } catch (e) {
8324
8410
  console.warn('Animation has been interrupted.', e);
@@ -8328,10 +8414,10 @@ class DiagramCanvas {
8328
8414
  });
8329
8415
  }
8330
8416
  center(nodeIds, maxZoomLevel, duration) {
8331
- var _a;
8417
+ var _b;
8332
8418
  // if there are no nodes, we have nothing to do here
8333
8419
  if (this.model.nodes.length > 0) {
8334
- const canvasViewBoundingBox = (_a = this.selectCanvasView().select('.daga-background').node()) === null || _a === void 0 ? void 0 : _a.getBBox();
8420
+ const canvasViewBoundingBox = (_b = this.selectCanvasView().select('.daga-background').node()) === null || _b === void 0 ? void 0 : _b.getBBox();
8335
8421
  if (!canvasViewBoundingBox.width || !canvasViewBoundingBox.height) {
8336
8422
  // prevent errors if the width or height is invalid
8337
8423
  return;
@@ -8373,10 +8459,10 @@ class DiagramCanvas {
8373
8459
  return [pointX, pointY];
8374
8460
  }
8375
8461
  getCoordinatesOnScreen() {
8376
- var _a;
8377
- const rootBoundingClientRect = (_a = this.selectSVGElement().node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
8462
+ var _b;
8463
+ const rootBoundingClientRect = (_b = this.selectSVGElement().node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
8378
8464
  const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.height) || 0];
8379
- return [[-this.zoomTransform.x / this.zoomTransform.k, -this.zoomTransform.y / this.zoomTransform.k], [(rootDimensions[0] - this.zoomTransform.x) / this.zoomTransform.k, (rootDimensions[1] - this.zoomTransform.y) / this.zoomTransform.k]];
8465
+ return [[-__classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, -__classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k], [(rootDimensions[0] - __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x) / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, (rootDimensions[1] - __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y) / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k]];
8380
8466
  }
8381
8467
  getPointerLocationRelativeToCanvas(event) {
8382
8468
  return d3__namespace.pointer(getEventHoldingCoordinates(event), this.selectCanvasElements().node());
@@ -8401,7 +8487,7 @@ class DiagramCanvas {
8401
8487
  this.updateDecoratorsInView();
8402
8488
  }
8403
8489
  updateNodesInView(...ids) {
8404
- let updateSelection = this.selectCanvasElements().selectAll('g.diagram-node').data(this.model.nodes.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
8490
+ let updateSelection = this.selectCanvasElements().selectAll('g.diagram-node').data(this.model.nodes.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
8405
8491
  const exitSelection = updateSelection.exit();
8406
8492
  const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-node${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''}${needsResizerXY(d) ? ' resizable-xy' : ''} ${d.type.defaultLook.lookType}`);
8407
8493
  if (ids && ids.length > 0) {
@@ -8410,7 +8496,7 @@ class DiagramCanvas {
8410
8496
  const mergeSelection = enterSelection.merge(updateSelection);
8411
8497
  exitSelection.remove();
8412
8498
  enterSelection.on(exports.Events.MouseOver, (_event, d) => {
8413
- if (!this.dragging) {
8499
+ if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
8414
8500
  this.userHighlight.focusOn(d);
8415
8501
  this.diagramEvent$.next(new DiagramHighlightedEvent(d));
8416
8502
  }
@@ -8423,10 +8509,10 @@ class DiagramCanvas {
8423
8509
  this.userSelection.toggle(d);
8424
8510
  this.diagramEvent$.next(new DiagramSelectionEvent([d], d.selected));
8425
8511
  }).on(exports.Events.ContextMenu, (event, d) => {
8426
- if (this.dragging) {
8512
+ if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
8427
8513
  event.preventDefault();
8428
8514
  event.stopPropagation();
8429
- this.dragging = false;
8515
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
8430
8516
  return;
8431
8517
  }
8432
8518
  const diagramEvent = new DiagramSecondaryClickEvent(event, d);
@@ -8443,27 +8529,27 @@ class DiagramCanvas {
8443
8529
  const diagramEvent = new DiagramDoubleClickEvent(event, d);
8444
8530
  this.diagramEvent$.next(diagramEvent);
8445
8531
  }).call(d3__namespace.drag().filter(event => {
8446
- this.secondaryButton = isSecondaryButton(event);
8532
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
8447
8533
  return true;
8448
8534
  }).on(exports.DragEvents.Start, (event, d) => {
8449
- if (this.multipleSelectionOn || this.secondaryButton) {
8450
- this.startMultipleSelection(event);
8535
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
8536
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
8451
8537
  } else {
8452
- this.startMovingNode(event, d);
8538
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, d);
8453
8539
  }
8454
8540
  }).on(exports.DragEvents.Drag, (event, d) => {
8455
- if (this.multipleSelectionOn || this.secondaryButton) {
8456
- this.continueMultipleSelection(event);
8541
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
8542
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
8457
8543
  } else {
8458
- this.continueMovingNode(event, d);
8544
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, d);
8459
8545
  }
8460
8546
  }).on(exports.DragEvents.End, (event, d) => {
8461
- if (this.multipleSelectionOn || this.secondaryButton) {
8462
- this.finishMultipleSelection(event);
8547
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
8548
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
8463
8549
  } else {
8464
- this.finishMovingNode(event, d);
8550
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, d);
8465
8551
  }
8466
- this.secondaryButton = false;
8552
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
8467
8553
  }));
8468
8554
  initializeLook(enterSelection);
8469
8555
  enterSelection.filter('.resizable-x').append('rect').attr('class', 'left-resizer').on(exports.Events.MouseOver, (_event, d) => {
@@ -8477,7 +8563,7 @@ class DiagramCanvas {
8477
8563
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8478
8564
  if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8479
8565
  setCursorStyle(exports.CursorStyle.EWResize);
8480
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8566
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
8481
8567
  } else {
8482
8568
  setCursorStyle(exports.CursorStyle.NotAllowed);
8483
8569
  }
@@ -8487,7 +8573,7 @@ class DiagramCanvas {
8487
8573
  d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
8488
8574
  }
8489
8575
  }).on(exports.DragEvents.End, (event, d) => {
8490
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8576
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
8491
8577
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8492
8578
  if (this.gridConfig.snap) {
8493
8579
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
@@ -8495,10 +8581,10 @@ class DiagramCanvas {
8495
8581
  pointerCoords[1] += d.type.snapToGridOffset[1];
8496
8582
  }
8497
8583
  d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
8498
- this.currentAction.to = d.getGeometry();
8499
- this.currentAction.do();
8500
- this.actionStack.add(this.currentAction);
8501
- this.currentAction = undefined;
8584
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
8585
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
8586
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
8587
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8502
8588
  }
8503
8589
  setCursorStyle();
8504
8590
  }));
@@ -8513,7 +8599,7 @@ class DiagramCanvas {
8513
8599
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8514
8600
  if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8515
8601
  setCursorStyle(exports.CursorStyle.EWResize);
8516
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8602
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
8517
8603
  } else {
8518
8604
  setCursorStyle(exports.CursorStyle.NotAllowed);
8519
8605
  }
@@ -8523,7 +8609,7 @@ class DiagramCanvas {
8523
8609
  d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8524
8610
  }
8525
8611
  }).on(exports.DragEvents.End, (event, d) => {
8526
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8612
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
8527
8613
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8528
8614
  if (this.gridConfig.snap) {
8529
8615
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
@@ -8531,10 +8617,10 @@ class DiagramCanvas {
8531
8617
  pointerCoords[1] += d.type.snapToGridOffset[3];
8532
8618
  }
8533
8619
  d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8534
- this.currentAction.to = d.getGeometry();
8535
- this.currentAction.do();
8536
- this.actionStack.add(this.currentAction);
8537
- this.currentAction = undefined;
8620
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
8621
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
8622
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
8623
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8538
8624
  }
8539
8625
  setCursorStyle();
8540
8626
  }));
@@ -8549,7 +8635,7 @@ class DiagramCanvas {
8549
8635
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8550
8636
  if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8551
8637
  setCursorStyle(exports.CursorStyle.NSResize);
8552
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8638
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
8553
8639
  } else {
8554
8640
  setCursorStyle(exports.CursorStyle.NotAllowed);
8555
8641
  }
@@ -8559,7 +8645,7 @@ class DiagramCanvas {
8559
8645
  d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8560
8646
  }
8561
8647
  }).on(exports.DragEvents.End, (event, d) => {
8562
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8648
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
8563
8649
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8564
8650
  if (this.gridConfig.snap) {
8565
8651
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
@@ -8567,10 +8653,10 @@ class DiagramCanvas {
8567
8653
  pointerCoords[1] += d.type.snapToGridOffset[1];
8568
8654
  }
8569
8655
  d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8570
- this.currentAction.to = d.getGeometry();
8571
- this.currentAction.do();
8572
- this.actionStack.add(this.currentAction);
8573
- this.currentAction = undefined;
8656
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
8657
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
8658
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
8659
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8574
8660
  }
8575
8661
  setCursorStyle();
8576
8662
  }));
@@ -8585,7 +8671,7 @@ class DiagramCanvas {
8585
8671
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8586
8672
  if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8587
8673
  setCursorStyle(exports.CursorStyle.NSResize);
8588
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8674
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
8589
8675
  } else {
8590
8676
  setCursorStyle(exports.CursorStyle.NotAllowed);
8591
8677
  }
@@ -8595,7 +8681,7 @@ class DiagramCanvas {
8595
8681
  d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8596
8682
  }
8597
8683
  }).on(exports.DragEvents.End, (event, d) => {
8598
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8684
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
8599
8685
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8600
8686
  if (this.gridConfig.snap) {
8601
8687
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
@@ -8603,10 +8689,10 @@ class DiagramCanvas {
8603
8689
  pointerCoords[1] += d.type.snapToGridOffset[3];
8604
8690
  }
8605
8691
  d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8606
- this.currentAction.to = d.getGeometry();
8607
- this.currentAction.do();
8608
- this.actionStack.add(this.currentAction);
8609
- this.currentAction = undefined;
8692
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
8693
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
8694
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
8695
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8610
8696
  }
8611
8697
  setCursorStyle();
8612
8698
  }));
@@ -8621,7 +8707,7 @@ class DiagramCanvas {
8621
8707
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8622
8708
  if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8623
8709
  setCursorStyle(exports.CursorStyle.NWSEResize);
8624
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8710
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
8625
8711
  } else {
8626
8712
  setCursorStyle(exports.CursorStyle.NotAllowed);
8627
8713
  }
@@ -8632,7 +8718,7 @@ class DiagramCanvas {
8632
8718
  d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8633
8719
  }
8634
8720
  }).on(exports.DragEvents.End, (event, d) => {
8635
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8721
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
8636
8722
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8637
8723
  if (this.gridConfig.snap) {
8638
8724
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
@@ -8641,10 +8727,10 @@ class DiagramCanvas {
8641
8727
  }
8642
8728
  d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
8643
8729
  d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8644
- this.currentAction.to = d.getGeometry();
8645
- this.currentAction.do();
8646
- this.actionStack.add(this.currentAction);
8647
- this.currentAction = undefined;
8730
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
8731
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
8732
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
8733
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8648
8734
  }
8649
8735
  setCursorStyle();
8650
8736
  }));
@@ -8659,7 +8745,7 @@ class DiagramCanvas {
8659
8745
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8660
8746
  if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8661
8747
  setCursorStyle(exports.CursorStyle.NESWResize);
8662
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8748
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
8663
8749
  } else {
8664
8750
  setCursorStyle(exports.CursorStyle.NotAllowed);
8665
8751
  }
@@ -8670,7 +8756,7 @@ class DiagramCanvas {
8670
8756
  d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8671
8757
  }
8672
8758
  }).on(exports.DragEvents.End, (event, d) => {
8673
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8759
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
8674
8760
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8675
8761
  if (this.gridConfig.snap) {
8676
8762
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
@@ -8679,10 +8765,10 @@ class DiagramCanvas {
8679
8765
  }
8680
8766
  d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8681
8767
  d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8682
- this.currentAction.to = d.getGeometry();
8683
- this.currentAction.do();
8684
- this.actionStack.add(this.currentAction);
8685
- this.currentAction = undefined;
8768
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
8769
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
8770
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
8771
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8686
8772
  }
8687
8773
  setCursorStyle();
8688
8774
  }));
@@ -8697,7 +8783,7 @@ class DiagramCanvas {
8697
8783
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8698
8784
  if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8699
8785
  setCursorStyle(exports.CursorStyle.NESWResize);
8700
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8786
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
8701
8787
  } else {
8702
8788
  setCursorStyle(exports.CursorStyle.NotAllowed);
8703
8789
  }
@@ -8708,7 +8794,7 @@ class DiagramCanvas {
8708
8794
  d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8709
8795
  }
8710
8796
  }).on(exports.DragEvents.End, (event, d) => {
8711
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8797
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
8712
8798
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8713
8799
  if (this.gridConfig.snap) {
8714
8800
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
@@ -8717,10 +8803,10 @@ class DiagramCanvas {
8717
8803
  }
8718
8804
  d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
8719
8805
  d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8720
- this.currentAction.to = d.getGeometry();
8721
- this.currentAction.do();
8722
- this.actionStack.add(this.currentAction);
8723
- this.currentAction = undefined;
8806
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
8807
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
8808
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
8809
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8724
8810
  }
8725
8811
  setCursorStyle();
8726
8812
  }));
@@ -8735,7 +8821,7 @@ class DiagramCanvas {
8735
8821
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8736
8822
  if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8737
8823
  setCursorStyle(exports.CursorStyle.NWSEResize);
8738
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8824
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
8739
8825
  } else {
8740
8826
  setCursorStyle(exports.CursorStyle.NotAllowed);
8741
8827
  }
@@ -8746,7 +8832,7 @@ class DiagramCanvas {
8746
8832
  d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8747
8833
  }
8748
8834
  }).on(exports.DragEvents.End, (event, d) => {
8749
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8835
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
8750
8836
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8751
8837
  if (this.gridConfig.snap) {
8752
8838
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
@@ -8755,10 +8841,10 @@ class DiagramCanvas {
8755
8841
  }
8756
8842
  d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8757
8843
  d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8758
- this.currentAction.to = d.getGeometry();
8759
- this.currentAction.do();
8760
- this.actionStack.add(this.currentAction);
8761
- this.currentAction = undefined;
8844
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
8845
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
8846
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
8847
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8762
8848
  }
8763
8849
  setCursorStyle();
8764
8850
  }));
@@ -8774,11 +8860,11 @@ class DiagramCanvas {
8774
8860
  mergeSelection.filter('.resizable-xy').select('rect.bottom-right-resizer').style('pointer-events', d => d.getResizableXY() ? 'initial' : 'none').attr('x', d => d.width - d.getResizerXY().thickness + d.getResizerXY().outerMargin).attr('y', d => d.height - d.getResizerXY().thickness + d.getResizerXY().outerMargin).attr('width', d => d.getResizerXY().thickness).attr('height', d => d.getResizerXY().thickness).attr('fill', d => d.getResizerXY().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerXY().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerXY().getLook(d).borderThickness || 0);
8775
8861
  }
8776
8862
  updateSectionsInView(...ids) {
8777
- let updateSelection = this.selectCanvasElements().selectAll('g.diagram-section').data(this.model.sections.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
8863
+ let updateSelection = this.selectCanvasElements().selectAll('g.diagram-section').data(this.model.sections.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
8778
8864
  const exitSelection = updateSelection.exit();
8779
8865
  const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
8780
- var _a;
8781
- return `diagram-section${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''}${needsResizerXY(d) ? ' resizable-xy' : ''} ${(_a = d.look) === null || _a === void 0 ? void 0 : _a.lookType}`;
8866
+ var _b;
8867
+ return `diagram-section${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''}${needsResizerXY(d) ? ' resizable-xy' : ''} ${(_b = d.look) === null || _b === void 0 ? void 0 : _b.lookType}`;
8782
8868
  });
8783
8869
  if (ids && ids.length > 0) {
8784
8870
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
@@ -8786,7 +8872,7 @@ class DiagramCanvas {
8786
8872
  const mergeSelection = enterSelection.merge(updateSelection);
8787
8873
  exitSelection.remove();
8788
8874
  enterSelection.on(exports.Events.MouseOver, (_event, d) => {
8789
- if (!this.dragging) {
8875
+ if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
8790
8876
  this.userHighlight.focusOn(d);
8791
8877
  this.diagramEvent$.next(new DiagramHighlightedEvent(d));
8792
8878
  }
@@ -8800,10 +8886,10 @@ class DiagramCanvas {
8800
8886
  this.userSelection.toggle(elementToBeToggled);
8801
8887
  this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
8802
8888
  }).on(exports.Events.ContextMenu, (event, d) => {
8803
- if (this.dragging) {
8889
+ if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
8804
8890
  event.preventDefault();
8805
8891
  event.stopPropagation();
8806
- this.dragging = false;
8892
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
8807
8893
  return;
8808
8894
  }
8809
8895
  const diagramEvent = new DiagramSecondaryClickEvent(event, d);
@@ -8821,42 +8907,42 @@ class DiagramCanvas {
8821
8907
  const diagramEvent = new DiagramDoubleClickEvent(event, d);
8822
8908
  this.diagramEvent$.next(diagramEvent);
8823
8909
  }).call(d3__namespace.drag().filter(event => {
8824
- this.secondaryButton = isSecondaryButton(event);
8910
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
8825
8911
  return true;
8826
8912
  }).on(exports.DragEvents.Start, (event, d) => {
8827
- if (this.multipleSelectionOn || this.secondaryButton) {
8828
- this.startMultipleSelection(event);
8913
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
8914
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
8829
8915
  } else {
8830
8916
  const node = d === null || d === void 0 ? void 0 : d.node;
8831
8917
  if (node) {
8832
- this.startMovingNode(event, node);
8918
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, node);
8833
8919
  } else {
8834
8920
  setCursorStyle(exports.CursorStyle.NotAllowed);
8835
8921
  }
8836
8922
  }
8837
8923
  }).on(exports.DragEvents.Drag, (event, d) => {
8838
- if (this.multipleSelectionOn || this.secondaryButton) {
8839
- this.continueMultipleSelection(event);
8924
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
8925
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
8840
8926
  } else {
8841
8927
  const node = d === null || d === void 0 ? void 0 : d.node;
8842
8928
  if (node) {
8843
- this.continueMovingNode(event, node);
8929
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, node);
8844
8930
  } else {
8845
8931
  setCursorStyle(exports.CursorStyle.NotAllowed);
8846
8932
  }
8847
8933
  }
8848
8934
  }).on(exports.DragEvents.End, (event, d) => {
8849
- if (this.multipleSelectionOn || this.secondaryButton) {
8850
- this.finishMultipleSelection(event);
8935
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
8936
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
8851
8937
  } else {
8852
8938
  const node = d === null || d === void 0 ? void 0 : d.node;
8853
8939
  if (node) {
8854
- this.finishMovingNode(event, node);
8940
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, node);
8855
8941
  } else {
8856
8942
  setCursorStyle();
8857
8943
  }
8858
8944
  }
8859
- this.secondaryButton = false;
8945
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
8860
8946
  }));
8861
8947
  initializeLook(enterSelection);
8862
8948
  enterSelection.filter('.resizable-x').append('rect').attr('class', 'left-resizer').on(exports.Events.MouseOver, (_event, d) => {
@@ -8870,7 +8956,7 @@ class DiagramCanvas {
8870
8956
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8871
8957
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && d.node) {
8872
8958
  setCursorStyle(exports.CursorStyle.EWResize);
8873
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
8959
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
8874
8960
  } else {
8875
8961
  setCursorStyle(exports.CursorStyle.NotAllowed);
8876
8962
  }
@@ -8880,16 +8966,16 @@ class DiagramCanvas {
8880
8966
  d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
8881
8967
  }
8882
8968
  }).on(exports.DragEvents.End, (event, d) => {
8883
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
8969
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
8884
8970
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8885
8971
  if (this.gridConfig.snap) {
8886
8972
  pointerCoords = this.getClosestGridPoint(pointerCoords);
8887
8973
  }
8888
8974
  d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
8889
- this.currentAction.to = d.node.getGeometry();
8890
- this.currentAction.do();
8891
- this.actionStack.add(this.currentAction);
8892
- this.currentAction = undefined;
8975
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
8976
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
8977
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
8978
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8893
8979
  }
8894
8980
  setCursorStyle();
8895
8981
  }));
@@ -8904,7 +8990,7 @@ class DiagramCanvas {
8904
8990
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8905
8991
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && d.node) {
8906
8992
  setCursorStyle(exports.CursorStyle.EWResize);
8907
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
8993
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
8908
8994
  } else {
8909
8995
  setCursorStyle(exports.CursorStyle.NotAllowed);
8910
8996
  }
@@ -8914,16 +9000,16 @@ class DiagramCanvas {
8914
9000
  d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
8915
9001
  }
8916
9002
  }).on(exports.DragEvents.End, (event, d) => {
8917
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9003
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
8918
9004
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8919
9005
  if (this.gridConfig.snap) {
8920
9006
  pointerCoords = this.getClosestGridPoint(pointerCoords);
8921
9007
  }
8922
9008
  d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
8923
- this.currentAction.to = d.node.getGeometry();
8924
- this.currentAction.do();
8925
- this.actionStack.add(this.currentAction);
8926
- this.currentAction = undefined;
9009
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
9010
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
9011
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
9012
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8927
9013
  }
8928
9014
  setCursorStyle();
8929
9015
  }));
@@ -8938,7 +9024,7 @@ class DiagramCanvas {
8938
9024
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8939
9025
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && d.node) {
8940
9026
  setCursorStyle(exports.CursorStyle.NSResize);
8941
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
9027
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
8942
9028
  } else {
8943
9029
  setCursorStyle(exports.CursorStyle.NotAllowed);
8944
9030
  }
@@ -8948,16 +9034,16 @@ class DiagramCanvas {
8948
9034
  d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
8949
9035
  }
8950
9036
  }).on(exports.DragEvents.End, (event, d) => {
8951
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9037
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
8952
9038
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8953
9039
  if (this.gridConfig.snap) {
8954
9040
  pointerCoords = this.getClosestGridPoint(pointerCoords);
8955
9041
  }
8956
9042
  d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
8957
- this.currentAction.to = d.node.getGeometry();
8958
- this.currentAction.do();
8959
- this.actionStack.add(this.currentAction);
8960
- this.currentAction = undefined;
9043
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
9044
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
9045
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
9046
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8961
9047
  }
8962
9048
  setCursorStyle();
8963
9049
  }));
@@ -8972,7 +9058,7 @@ class DiagramCanvas {
8972
9058
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8973
9059
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && d.node) {
8974
9060
  setCursorStyle(exports.CursorStyle.NSResize);
8975
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
9061
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
8976
9062
  } else {
8977
9063
  setCursorStyle(exports.CursorStyle.NotAllowed);
8978
9064
  }
@@ -8982,16 +9068,16 @@ class DiagramCanvas {
8982
9068
  d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
8983
9069
  }
8984
9070
  }).on(exports.DragEvents.End, (event, d) => {
8985
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9071
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
8986
9072
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8987
9073
  if (this.gridConfig.snap) {
8988
9074
  pointerCoords = this.getClosestGridPoint(pointerCoords);
8989
9075
  }
8990
9076
  d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
8991
- this.currentAction.to = d.node.getGeometry();
8992
- this.currentAction.do();
8993
- this.actionStack.add(this.currentAction);
8994
- this.currentAction = undefined;
9077
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
9078
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
9079
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
9080
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
8995
9081
  }
8996
9082
  setCursorStyle();
8997
9083
  }));
@@ -9006,7 +9092,7 @@ class DiagramCanvas {
9006
9092
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
9007
9093
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
9008
9094
  setCursorStyle(exports.CursorStyle.NWSEResize);
9009
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
9095
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
9010
9096
  } else {
9011
9097
  setCursorStyle(exports.CursorStyle.NotAllowed);
9012
9098
  }
@@ -9017,17 +9103,17 @@ class DiagramCanvas {
9017
9103
  d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
9018
9104
  }
9019
9105
  }).on(exports.DragEvents.End, (event, d) => {
9020
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9106
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
9021
9107
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
9022
9108
  if (this.gridConfig.snap) {
9023
9109
  pointerCoords = this.getClosestGridPoint(pointerCoords);
9024
9110
  }
9025
9111
  d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
9026
9112
  d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
9027
- this.currentAction.to = d.node.getGeometry();
9028
- this.currentAction.do();
9029
- this.actionStack.add(this.currentAction);
9030
- this.currentAction = undefined;
9113
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
9114
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
9115
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
9116
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
9031
9117
  }
9032
9118
  setCursorStyle();
9033
9119
  }));
@@ -9042,7 +9128,7 @@ class DiagramCanvas {
9042
9128
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
9043
9129
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
9044
9130
  setCursorStyle(exports.CursorStyle.NESWResize);
9045
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
9131
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
9046
9132
  } else {
9047
9133
  setCursorStyle(exports.CursorStyle.NotAllowed);
9048
9134
  }
@@ -9053,17 +9139,17 @@ class DiagramCanvas {
9053
9139
  d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
9054
9140
  }
9055
9141
  }).on(exports.DragEvents.End, (event, d) => {
9056
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9142
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
9057
9143
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
9058
9144
  if (this.gridConfig.snap) {
9059
9145
  pointerCoords = this.getClosestGridPoint(pointerCoords);
9060
9146
  }
9061
9147
  d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
9062
9148
  d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
9063
- this.currentAction.to = d.node.getGeometry();
9064
- this.currentAction.do();
9065
- this.actionStack.add(this.currentAction);
9066
- this.currentAction = undefined;
9149
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
9150
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
9151
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
9152
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
9067
9153
  }
9068
9154
  setCursorStyle();
9069
9155
  }));
@@ -9078,7 +9164,7 @@ class DiagramCanvas {
9078
9164
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
9079
9165
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
9080
9166
  setCursorStyle(exports.CursorStyle.NESWResize);
9081
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
9167
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
9082
9168
  } else {
9083
9169
  setCursorStyle(exports.CursorStyle.NotAllowed);
9084
9170
  }
@@ -9089,17 +9175,17 @@ class DiagramCanvas {
9089
9175
  d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
9090
9176
  }
9091
9177
  }).on(exports.DragEvents.End, (event, d) => {
9092
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9178
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
9093
9179
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
9094
9180
  if (this.gridConfig.snap) {
9095
9181
  pointerCoords = this.getClosestGridPoint(pointerCoords);
9096
9182
  }
9097
9183
  d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
9098
9184
  d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
9099
- this.currentAction.to = d.node.getGeometry();
9100
- this.currentAction.do();
9101
- this.actionStack.add(this.currentAction);
9102
- this.currentAction = undefined;
9185
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
9186
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
9187
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
9188
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
9103
9189
  }
9104
9190
  setCursorStyle();
9105
9191
  }));
@@ -9114,7 +9200,7 @@ class DiagramCanvas {
9114
9200
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
9115
9201
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
9116
9202
  setCursorStyle(exports.CursorStyle.NWSEResize);
9117
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
9203
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
9118
9204
  } else {
9119
9205
  setCursorStyle(exports.CursorStyle.NotAllowed);
9120
9206
  }
@@ -9125,17 +9211,17 @@ class DiagramCanvas {
9125
9211
  d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
9126
9212
  }
9127
9213
  }).on(exports.DragEvents.End, (event, d) => {
9128
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9214
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
9129
9215
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
9130
9216
  if (this.gridConfig.snap) {
9131
9217
  pointerCoords = this.getClosestGridPoint(pointerCoords);
9132
9218
  }
9133
9219
  d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
9134
9220
  d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
9135
- this.currentAction.to = d.node.getGeometry();
9136
- this.currentAction.do();
9137
- this.actionStack.add(this.currentAction);
9138
- this.currentAction = undefined;
9221
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
9222
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
9223
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
9224
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
9139
9225
  }
9140
9226
  setCursorStyle();
9141
9227
  }));
@@ -9151,7 +9237,7 @@ class DiagramCanvas {
9151
9237
  mergeSelection.filter('.resizable-xy').select('rect.bottom-right-resizer').style('pointer-events', d => d.getResizableXY() ? 'initial' : 'none').attr('x', d => d.width - d.getResizerXY().thickness + d.getResizerXY().outerMargin).attr('y', d => d.height - d.getResizerXY().thickness + d.getResizerXY().outerMargin).attr('width', d => d.getResizerXY().thickness).attr('height', d => d.getResizerXY().thickness).attr('fill', d => d.getResizerXY().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerXY().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerXY().getLook(d).borderThickness || 0);
9152
9238
  }
9153
9239
  updatePortsInView(...ids) {
9154
- let updateSelection = this.selectCanvasElements().selectAll('g.diagram-port').data(this.model.ports.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
9240
+ let updateSelection = this.selectCanvasElements().selectAll('g.diagram-port').data(this.model.ports.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
9155
9241
  const exitSelection = updateSelection.exit();
9156
9242
  const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-port ${d.look.lookType}`);
9157
9243
  if (ids && ids.length > 0) {
@@ -9160,28 +9246,28 @@ class DiagramCanvas {
9160
9246
  const mergeSelection = enterSelection.merge(updateSelection);
9161
9247
  exitSelection.remove();
9162
9248
  enterSelection.on(exports.Events.MouseOver, (_event, d) => {
9163
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9164
- if (!this.unfinishedConnection && !this.dragging) {
9249
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
9250
+ if (!__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") && !__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
9165
9251
  // if there is an unfinished connection, the port will be highlighted automatically if the pointer is close
9166
9252
  this.userHighlight.focusOn(d);
9167
9253
  this.diagramEvent$.next(new DiagramHighlightedEvent(d));
9168
9254
  }
9169
- if (this.unfinishedConnection) {
9255
+ if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
9170
9256
  const canConnectionFinishAtThisPort =
9171
9257
  // can start at the starting port
9172
- this.unfinishedConnection.type.canStartFromType(((_c = (_b = (_a = this.unfinishedConnection.start) === null || _a === void 0 ? void 0 : _a.getNode()) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.id) || '') && ((_d = this.unfinishedConnection.start) === null || _d === void 0 ? void 0 : _d.allowsOutgoing) &&
9258
+ __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canStartFromType(((_d = (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_e = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _e === void 0 ? void 0 : _e.allowsOutgoing) &&
9173
9259
  // can end at the ending port
9174
- this.unfinishedConnection.type.canFinishOnType(((_f = (_e = d.getNode()) === null || _e === void 0 ? void 0 : _e.type) === null || _f === void 0 ? void 0 : _f.id) || '') && d.allowsIncoming ||
9260
+ __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canFinishOnType(((_g = (_f = d.getNode()) === null || _f === void 0 ? void 0 : _f.type) === null || _g === void 0 ? void 0 : _g.id) || '') && d.allowsIncoming ||
9175
9261
  // can start at the ending port
9176
- this.unfinishedConnection.type.canStartFromType(((_h = (_g = d.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && d.allowsOutgoing &&
9262
+ __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canStartFromType(((_j = (_h = d.getNode()) === null || _h === void 0 ? void 0 : _h.type) === null || _j === void 0 ? void 0 : _j.id) || '') && d.allowsOutgoing &&
9177
9263
  // can end at the starting port
9178
- this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = this.unfinishedConnection.start) === null || _j === void 0 ? void 0 : _j.getNode()) === null || _k === void 0 ? void 0 : _k.type) === null || _l === void 0 ? void 0 : _l.id) || '') && ((_m = this.unfinishedConnection.start) === null || _m === void 0 ? void 0 : _m.allowsIncoming);
9264
+ __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canFinishOnType(((_m = (_l = (_k = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _k === void 0 ? void 0 : _k.getNode()) === null || _l === void 0 ? void 0 : _l.type) === null || _m === void 0 ? void 0 : _m.id) || '') && ((_o = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _o === void 0 ? void 0 : _o.allowsIncoming);
9179
9265
  if (!canConnectionFinishAtThisPort) {
9180
9266
  setCursorStyle(exports.CursorStyle.NoDrop);
9181
9267
  }
9182
9268
  }
9183
9269
  }).on(exports.Events.MouseOut, () => {
9184
- if (this.unfinishedConnection) {
9270
+ if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
9185
9271
  setCursorStyle(exports.CursorStyle.Grabbing);
9186
9272
  }
9187
9273
  }).on(exports.Events.Click, (event, d) => {
@@ -9194,10 +9280,10 @@ class DiagramCanvas {
9194
9280
  this.userSelection.toggle(elementToBeToggled);
9195
9281
  this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
9196
9282
  }).on(exports.Events.ContextMenu, (event, d) => {
9197
- if (this.dragging) {
9283
+ if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
9198
9284
  event.preventDefault();
9199
9285
  event.stopPropagation();
9200
- this.dragging = false;
9286
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
9201
9287
  return;
9202
9288
  }
9203
9289
  const diagramEvent = new DiagramSecondaryClickEvent(event, d);
@@ -9215,33 +9301,33 @@ class DiagramCanvas {
9215
9301
  const diagramEvent = new DiagramDoubleClickEvent(event, d);
9216
9302
  this.diagramEvent$.next(diagramEvent);
9217
9303
  }).call(d3__namespace.drag().filter(event => {
9218
- this.secondaryButton = isSecondaryButton(event);
9304
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
9219
9305
  return true;
9220
9306
  }).on(exports.DragEvents.Start, (event, d) => {
9221
- if (this.multipleSelectionOn || this.secondaryButton) {
9222
- this.startMultipleSelection(event);
9307
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9308
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
9223
9309
  } else {
9224
9310
  if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.filter(c => !c.removed).length === 0 && d.outgoingConnections.filter(c => !c.removed).length === 0) && !d.removed) {
9225
9311
  setCursorStyle(exports.CursorStyle.Grabbing);
9226
- this.startConnection(d);
9312
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startConnection).call(this, d);
9227
9313
  // should be true after having called this.startConnection()
9228
- if (this.unfinishedConnection) {
9229
- this.unfinishedConnectionTracer = this.selectCanvasElements().append('path').attr('stroke', 'none').attr('fill', 'none');
9314
+ if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
9315
+ __classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionTracer, this.selectCanvasElements().append('path').attr('stroke', 'none').attr('fill', 'none'), "f");
9230
9316
  }
9231
9317
  } else {
9232
9318
  setCursorStyle(exports.CursorStyle.NotAllowed);
9233
9319
  }
9234
9320
  }
9235
9321
  }).on(exports.DragEvents.Drag, (event, d) => {
9236
- var _a, _b, _c, _d, _e;
9237
- if (this.multipleSelectionOn || this.secondaryButton) {
9238
- this.continueMultipleSelection(event);
9322
+ var _b, _c, _d, _e, _f;
9323
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9324
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
9239
9325
  } else {
9240
9326
  if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
9241
- if (this.unfinishedConnection !== undefined) {
9327
+ if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") !== undefined) {
9242
9328
  const endCoords = [event.x, event.y];
9243
- (_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.attr('d', getConnectionPath(this.unfinishedConnection.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.points, this.unfinishedConnection.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_b = this.unfinishedConnection.type.defaultStartMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = this.unfinishedConnection.type.defaultEndMarkerLook) === null || _c === void 0 ? void 0 : _c.width));
9244
- const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === void 0 ? void 0 : _d.node();
9329
+ (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionTracer, "f")) === null || _b === void 0 ? void 0 : _b.attr('d', getConnectionPath(__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").startCoords, endCoords, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").startDirection, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endDirection, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").points, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_c = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.defaultStartMarkerLook) === null || _c === void 0 ? void 0 : _c.width, (_d = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.defaultEndMarkerLook) === null || _d === void 0 ? void 0 : _d.width));
9330
+ const unfinishedConnectionGhostNode = (_e = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionTracer, "f")) === null || _e === void 0 ? void 0 : _e.node();
9245
9331
  if (unfinishedConnectionGhostNode) {
9246
9332
  let margin = 2;
9247
9333
  const unfinishedConnectionTotalLength = unfinishedConnectionGhostNode.getTotalLength();
@@ -9249,13 +9335,13 @@ class DiagramCanvas {
9249
9335
  margin = 0;
9250
9336
  }
9251
9337
  const beforeUnfinishedConnectionEnd = unfinishedConnectionGhostNode.getPointAtLength(unfinishedConnectionTotalLength - margin);
9252
- this.unfinishedConnection.endCoords = [beforeUnfinishedConnectionEnd.x, beforeUnfinishedConnectionEnd.y];
9338
+ __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endCoords = [beforeUnfinishedConnectionEnd.x, beforeUnfinishedConnectionEnd.y];
9253
9339
  } else {
9254
9340
  // if it fails, just use the event coordinates
9255
- this.unfinishedConnection.endCoords = endCoords;
9341
+ __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endCoords = endCoords;
9256
9342
  }
9257
9343
  this.updateConnectionsInView(UNFINISHED_CONNECTION_ID);
9258
- (_e = this.unfinishedConnectionPort) === null || _e === void 0 ? void 0 : _e.raise(false);
9344
+ (_f = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionPort, "f")) === null || _f === void 0 ? void 0 : _f.raise(false);
9259
9345
  // highlight closest target port
9260
9346
  if (this.model.ports.length > 0) {
9261
9347
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
@@ -9278,17 +9364,17 @@ class DiagramCanvas {
9278
9364
  }
9279
9365
  }
9280
9366
  }).on(exports.DragEvents.End, (event, d) => {
9281
- var _a;
9282
- if (this.multipleSelectionOn || this.secondaryButton) {
9283
- this.finishMultipleSelection(event);
9367
+ var _b;
9368
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9369
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
9284
9370
  } else {
9285
9371
  if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
9286
- (_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.remove();
9372
+ (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionTracer, "f")) === null || _b === void 0 ? void 0 : _b.remove();
9287
9373
  const userHighlight = this.userHighlight.getFocus();
9288
9374
  if (userHighlight instanceof DiagramPort) {
9289
- this.finishConnection(userHighlight);
9375
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishConnection).call(this, userHighlight);
9290
9376
  } else if (userHighlight instanceof DiagramField && userHighlight.rootElement instanceof DiagramPort) {
9291
- this.finishConnection(userHighlight.rootElement);
9377
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishConnection).call(this, userHighlight.rootElement);
9292
9378
  } else if (userHighlight instanceof DiagramNode || userHighlight instanceof DiagramSection || userHighlight instanceof DiagramField) {
9293
9379
  let targetRootElement;
9294
9380
  if (userHighlight instanceof DiagramNode || userHighlight instanceof DiagramSection) {
@@ -9296,22 +9382,22 @@ class DiagramCanvas {
9296
9382
  } else if (userHighlight.rootElement instanceof DiagramNode || userHighlight.rootElement instanceof DiagramSection) {
9297
9383
  targetRootElement = userHighlight.rootElement;
9298
9384
  } else {
9299
- this.dropConnection();
9385
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
9300
9386
  return;
9301
9387
  }
9302
9388
  const closestPort = targetRootElement.getClosestPortToPoint([event.x, event.y]);
9303
9389
  if (closestPort !== undefined) {
9304
- this.finishConnection(closestPort);
9390
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishConnection).call(this, closestPort);
9305
9391
  } else {
9306
- this.dropConnection();
9392
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
9307
9393
  }
9308
9394
  } else {
9309
- this.dropConnection();
9395
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
9310
9396
  }
9311
9397
  }
9312
9398
  setCursorStyle();
9313
9399
  }
9314
- this.secondaryButton = false;
9400
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
9315
9401
  }));
9316
9402
  enterSelection.filter('.image-look').append('image');
9317
9403
  initializeLook(enterSelection);
@@ -9319,9 +9405,9 @@ class DiagramCanvas {
9319
9405
  updateLook(mergeSelection);
9320
9406
  }
9321
9407
  updateConnectionsInView(...ids) {
9322
- const connectionList = this.model.connections.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true);
9323
- if (this.unfinishedConnection) {
9324
- connectionList.push(this.unfinishedConnection);
9408
+ const connectionList = this.model.connections.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true);
9409
+ if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
9410
+ connectionList.push(__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f"));
9325
9411
  }
9326
9412
  let updateSelection = this.selectCanvasElements().selectAll('g.diagram-connection').data(connectionList, d => d.id);
9327
9413
  const exitSelection = updateSelection.exit();
@@ -9332,7 +9418,7 @@ class DiagramCanvas {
9332
9418
  const mergeSelection = enterSelection.merge(updateSelection);
9333
9419
  exitSelection.remove();
9334
9420
  enterSelection.on(exports.Events.MouseOver, (_event, d) => {
9335
- if (d.end !== undefined && !this.dragging) {
9421
+ if (d.end !== undefined && !__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
9336
9422
  this.userHighlight.focusOn(d);
9337
9423
  this.diagramEvent$.next(new DiagramHighlightedEvent(d));
9338
9424
  }
@@ -9345,10 +9431,10 @@ class DiagramCanvas {
9345
9431
  this.userSelection.toggle(d);
9346
9432
  this.diagramEvent$.next(new DiagramSelectionEvent([d], d.selected));
9347
9433
  }).on(exports.Events.ContextMenu, (event, d) => {
9348
- if (this.dragging) {
9434
+ if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
9349
9435
  event.preventDefault();
9350
9436
  event.stopPropagation();
9351
- this.dragging = false;
9437
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
9352
9438
  return;
9353
9439
  }
9354
9440
  const diagramEvent = new DiagramSecondaryClickEvent(event, d);
@@ -9365,14 +9451,14 @@ class DiagramCanvas {
9365
9451
  const diagramEvent = new DiagramDoubleClickEvent(event, d);
9366
9452
  this.diagramEvent$.next(diagramEvent);
9367
9453
  }).call(d3__namespace.drag().filter(event => {
9368
- this.secondaryButton = isSecondaryButton(event);
9454
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
9369
9455
  return true;
9370
9456
  }).on(exports.DragEvents.Start, event => {
9371
- this.startMultipleSelection(event);
9457
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
9372
9458
  }).on(exports.DragEvents.Drag, event => {
9373
- this.continueMultipleSelection(event);
9459
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
9374
9460
  }).on(exports.DragEvents.End, event => {
9375
- this.finishMultipleSelection(event);
9461
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
9376
9462
  }));
9377
9463
  enterSelection.append('path').attr('class', 'diagram-connection-path');
9378
9464
  enterSelection.append('path').attr('class', 'diagram-connection-path-box');
@@ -9388,22 +9474,22 @@ class DiagramCanvas {
9388
9474
  enterSelection.select('g.diagram-connection-end-label').append('path');
9389
9475
  enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
9390
9476
  mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
9391
- var _a, _b;
9392
- return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.points, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_a = d.type.defaultStartMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.type.defaultEndMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
9477
+ var _b, _c;
9478
+ return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.points, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_b = d.type.defaultStartMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = d.type.defaultEndMarkerLook) === null || _c === void 0 ? void 0 : _c.width);
9393
9479
  }).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.look.color || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.color).attr('stroke-width', d => d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
9394
9480
  mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
9395
- var _a, _b;
9396
- return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.points, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_a = d.type.defaultStartMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.type.defaultEndMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
9481
+ var _b, _c;
9482
+ return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.points, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_b = d.type.defaultStartMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = d.type.defaultEndMarkerLook) === null || _c === void 0 ? void 0 : _c.width);
9397
9483
  }).attr('stroke', 'transparent')
9398
9484
  // allow generating pointer events even when it is transparent
9399
9485
  .attr('pointer-events', 'stroke').attr('stroke-width', d => (d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness) + CONNECTION_PATH_BOX_THICKNESS).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
9400
9486
  mergeSelection.data().forEach(connection => {
9401
- this.updateConnectionLabelsInView(connection);
9402
- this.updateConnectionMarkersInView(connection);
9487
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_updateConnectionLabelsInView).call(this, connection);
9488
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_updateConnectionMarkersInView).call(this, connection);
9403
9489
  });
9404
9490
  }
9405
9491
  updateFieldsInView(...ids) {
9406
- let updateSelection = this.selectCanvasElements().selectAll('g.diagram-field').data(this.model.fields.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
9492
+ let updateSelection = this.selectCanvasElements().selectAll('g.diagram-field').data(this.model.fields.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
9407
9493
  const exitSelection = updateSelection.exit();
9408
9494
  const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-field');
9409
9495
  if (ids && ids.length > 0) {
@@ -9412,7 +9498,7 @@ class DiagramCanvas {
9412
9498
  const mergeSelection = enterSelection.merge(updateSelection);
9413
9499
  exitSelection.remove();
9414
9500
  enterSelection.on(exports.Events.MouseOver, (_event, d) => {
9415
- if (!this.dragging) {
9501
+ if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
9416
9502
  this.userHighlight.focusOn(d);
9417
9503
  this.diagramEvent$.next(new DiagramHighlightedEvent(d));
9418
9504
  }
@@ -9426,10 +9512,10 @@ class DiagramCanvas {
9426
9512
  this.userSelection.toggle(elementToBeToggled);
9427
9513
  this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
9428
9514
  }).on(exports.Events.ContextMenu, (event, d) => {
9429
- if (this.dragging) {
9515
+ if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
9430
9516
  event.preventDefault();
9431
9517
  event.stopPropagation();
9432
- this.dragging = false;
9518
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
9433
9519
  return;
9434
9520
  }
9435
9521
  const diagramEvent = new DiagramSecondaryClickEvent(event, d);
@@ -9447,15 +9533,14 @@ class DiagramCanvas {
9447
9533
  const diagramEvent = new DiagramDoubleClickEvent(event, d);
9448
9534
  this.diagramEvent$.next(diagramEvent);
9449
9535
  if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.EditField) && d.editable && !d.removed) {
9450
- this.currentAction = new EditFieldAction(this, d.id, d.text, '');
9451
9536
  this.openTextInput(d.id);
9452
9537
  }
9453
9538
  }).call(d3__namespace.drag().filter(event => {
9454
- this.secondaryButton = isSecondaryButton(event);
9539
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
9455
9540
  return true;
9456
9541
  }).on(exports.DragEvents.Start, (event, d) => {
9457
- if (this.multipleSelectionOn || this.secondaryButton) {
9458
- this.startMultipleSelection(event);
9542
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9543
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
9459
9544
  } else {
9460
9545
  let node;
9461
9546
  if (d.rootElement instanceof DiagramNode) {
@@ -9464,14 +9549,14 @@ class DiagramCanvas {
9464
9549
  node = d.rootElement.node;
9465
9550
  }
9466
9551
  if (node) {
9467
- this.startMovingNode(event, node);
9552
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, node);
9468
9553
  } else {
9469
9554
  setCursorStyle(exports.CursorStyle.NotAllowed);
9470
9555
  }
9471
9556
  }
9472
9557
  }).on(exports.DragEvents.Drag, (event, d) => {
9473
- if (this.multipleSelectionOn || this.secondaryButton) {
9474
- this.continueMultipleSelection(event);
9558
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9559
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
9475
9560
  } else {
9476
9561
  let node;
9477
9562
  if (d.rootElement instanceof DiagramNode) {
@@ -9480,14 +9565,14 @@ class DiagramCanvas {
9480
9565
  node = d.rootElement.node;
9481
9566
  }
9482
9567
  if (node) {
9483
- this.continueMovingNode(event, node);
9568
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, node);
9484
9569
  } else {
9485
9570
  setCursorStyle(exports.CursorStyle.NotAllowed);
9486
9571
  }
9487
9572
  }
9488
9573
  }).on(exports.DragEvents.End, (event, d) => {
9489
- if (this.multipleSelectionOn || this.secondaryButton) {
9490
- this.finishMultipleSelection(event);
9574
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9575
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
9491
9576
  } else {
9492
9577
  let node;
9493
9578
  if (d.rootElement instanceof DiagramNode) {
@@ -9496,24 +9581,24 @@ class DiagramCanvas {
9496
9581
  node = d.rootElement.node;
9497
9582
  }
9498
9583
  if (node) {
9499
- this.finishMovingNode(event, node);
9584
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, node);
9500
9585
  } else {
9501
9586
  setCursorStyle();
9502
9587
  }
9503
9588
  }
9504
- this.secondaryButton = false;
9589
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
9505
9590
  }));
9506
9591
  enterSelection.append('text').style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
9507
9592
  enterSelection.append('rect');
9508
9593
  mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]}) rotate(${d.orientation} ${d.width / 2} ${d.height / 2})`).attr('opacity', d => d.removed ? 0.5 : 1).select('text').attr('x', d => d.horizontalAlign === exports.HorizontalAlign.Center ? d.width / 2 : d.horizontalAlign === exports.HorizontalAlign.Right ? d.width : 0).attr('text-anchor', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'middle' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'end' : 'start').attr('y', d => d.verticalAlign === exports.VerticalAlign.Center ? d.height / 2 : d.verticalAlign === exports.VerticalAlign.Bottom ? d.height : 0).attr('dominant-baseline', d => d.verticalAlign === exports.VerticalAlign.Center ? 'middle' : d.verticalAlign === exports.VerticalAlign.Bottom ? 'auto' : 'hanging').attr('font-size', d => d.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('font-family', d => d.look.fontFamily || "'Wonder Unit Sans', sans-serif").attr('font-weight', d => d.look.fontWeight || DIAGRAM_FIELD_DEFAULTS.look.fontWeight).attr('fill', d => d.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fontColor).style('font-kerning', 'none').each(d => {
9509
- this.setFieldTextAndWrap(d);
9594
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_setFieldTextAndWrap).call(this, d);
9510
9595
  });
9511
9596
  mergeSelection
9512
9597
  // add a transparent rectangle to capture pointer events on the text
9513
9598
  .select('rect').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('fill', 'transparent');
9514
9599
  }
9515
9600
  updateObjectsInView(...ids) {
9516
- let updateSelection = this.selectCanvasElements().selectAll('g.diagram-object').data(this.model.objects.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
9601
+ let updateSelection = this.selectCanvasElements().selectAll('g.diagram-object').data(this.model.objects.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
9517
9602
  const exitSelection = updateSelection.exit();
9518
9603
  const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-object');
9519
9604
  if (ids && ids.length > 0) {
@@ -9523,10 +9608,10 @@ class DiagramCanvas {
9523
9608
  mergeSelection.attr('width', d => d.width).attr('height', d => d.height).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.svg);
9524
9609
  exitSelection.remove();
9525
9610
  enterSelection.on(exports.Events.ContextMenu, (event, d) => {
9526
- if (this.dragging) {
9611
+ if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
9527
9612
  event.preventDefault();
9528
9613
  event.stopPropagation();
9529
- this.dragging = false;
9614
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
9530
9615
  return;
9531
9616
  }
9532
9617
  const diagramEvent = new DiagramSecondaryClickEvent(event, d);
@@ -9539,24 +9624,24 @@ class DiagramCanvas {
9539
9624
  const diagramEvent = new DiagramDoubleClickEvent(event, d);
9540
9625
  this.diagramEvent$.next(diagramEvent);
9541
9626
  }).call(d3__namespace.drag().filter(event => {
9542
- this.secondaryButton = isSecondaryButton(event);
9627
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
9543
9628
  return true;
9544
9629
  }).on(exports.DragEvents.Start, event => {
9545
- if (this.multipleSelectionOn || this.secondaryButton) {
9546
- this.startMultipleSelection(event);
9630
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9631
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
9547
9632
  }
9548
9633
  }).on(exports.DragEvents.Drag, event => {
9549
- if (this.multipleSelectionOn || this.secondaryButton) {
9550
- this.continueMultipleSelection(event);
9634
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9635
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
9551
9636
  }
9552
9637
  }).on(exports.DragEvents.End, event => {
9553
- if (this.multipleSelectionOn || this.secondaryButton) {
9554
- this.finishMultipleSelection(event);
9638
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9639
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
9555
9640
  }
9556
9641
  }));
9557
9642
  }
9558
9643
  updateDecoratorsInView(...ids) {
9559
- let updateSelection = this.selectCanvasElements().selectAll('g.diagram-decorator').data(this.model.decorators.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
9644
+ let updateSelection = this.selectCanvasElements().selectAll('g.diagram-decorator').data(this.model.decorators.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
9560
9645
  const exitSelection = updateSelection.exit();
9561
9646
  const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-decorator');
9562
9647
  if (ids && ids.length > 0) {
@@ -9566,7 +9651,7 @@ class DiagramCanvas {
9566
9651
  mergeSelection.attr('width', d => d.width).attr('height', d => d.height).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.svg);
9567
9652
  exitSelection.remove();
9568
9653
  enterSelection.on(exports.Events.MouseOver, (_event, d) => {
9569
- if (!this.dragging) {
9654
+ if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
9570
9655
  this.userHighlight.focusOn(d);
9571
9656
  this.diagramEvent$.next(new DiagramHighlightedEvent(d));
9572
9657
  }
@@ -9582,10 +9667,10 @@ class DiagramCanvas {
9582
9667
  this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
9583
9668
  }
9584
9669
  }).on(exports.Events.ContextMenu, (event, d) => {
9585
- if (this.dragging) {
9670
+ if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
9586
9671
  event.preventDefault();
9587
9672
  event.stopPropagation();
9588
- this.dragging = false;
9673
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
9589
9674
  return;
9590
9675
  }
9591
9676
  const diagramEvent = new DiagramSecondaryClickEvent(event, d);
@@ -9605,11 +9690,11 @@ class DiagramCanvas {
9605
9690
  const diagramEvent = new DiagramDoubleClickEvent(event, d);
9606
9691
  this.diagramEvent$.next(diagramEvent);
9607
9692
  }).call(d3__namespace.drag().filter(event => {
9608
- this.secondaryButton = isSecondaryButton(event);
9693
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
9609
9694
  return true;
9610
9695
  }).on(exports.DragEvents.Start, (event, d) => {
9611
- if (this.multipleSelectionOn || this.secondaryButton) {
9612
- this.startMultipleSelection(event);
9696
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9697
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
9613
9698
  } else {
9614
9699
  let node;
9615
9700
  if (d.rootElement instanceof DiagramNode) {
@@ -9618,14 +9703,14 @@ class DiagramCanvas {
9618
9703
  node = d.rootElement.node;
9619
9704
  }
9620
9705
  if (node) {
9621
- this.startMovingNode(event, node);
9706
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, node);
9622
9707
  } else {
9623
9708
  setCursorStyle(exports.CursorStyle.NotAllowed);
9624
9709
  }
9625
9710
  }
9626
9711
  }).on(exports.DragEvents.Drag, (event, d) => {
9627
- if (this.multipleSelectionOn || this.secondaryButton) {
9628
- this.continueMultipleSelection(event);
9712
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9713
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
9629
9714
  } else {
9630
9715
  let node;
9631
9716
  if (d.rootElement instanceof DiagramNode) {
@@ -9634,14 +9719,14 @@ class DiagramCanvas {
9634
9719
  node = d.rootElement.node;
9635
9720
  }
9636
9721
  if (node) {
9637
- this.continueMovingNode(event, node);
9722
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, node);
9638
9723
  } else {
9639
9724
  setCursorStyle(exports.CursorStyle.NotAllowed);
9640
9725
  }
9641
9726
  }
9642
9727
  }).on(exports.DragEvents.End, (event, d) => {
9643
- if (this.multipleSelectionOn || this.secondaryButton) {
9644
- this.finishMultipleSelection(event);
9728
+ if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
9729
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
9645
9730
  } else {
9646
9731
  let node;
9647
9732
  if (d.rootElement instanceof DiagramNode) {
@@ -9650,165 +9735,14 @@ class DiagramCanvas {
9650
9735
  node = d.rootElement.node;
9651
9736
  }
9652
9737
  if (node) {
9653
- this.finishMovingNode(event, node);
9738
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, node);
9654
9739
  } else {
9655
9740
  setCursorStyle();
9656
9741
  }
9657
9742
  }
9658
- this.secondaryButton = false;
9743
+ __classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
9659
9744
  }));
9660
9745
  }
9661
- updateConnectionLabelsInView(connection) {
9662
- var _a, _b, _c;
9663
- const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
9664
- const pathSelection = connectionSelection.select('path');
9665
- const pathNode = pathSelection.node();
9666
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), connection.type.label);
9667
- labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
9668
- if (pathNode) {
9669
- const pathLength = pathNode.getTotalLength();
9670
- let startLabelShiftX = 0;
9671
- let startLabelShiftY = 0;
9672
- let middleLabelShiftX = 0;
9673
- let middleLabelShiftY = 0;
9674
- let endLabelShiftX = 0;
9675
- let endLabelShiftY = 0;
9676
- if (labelConfiguration.look.fillColor === 'transparent') {
9677
- // background color is transparent / not set, so we find an alternative position for the label
9678
- const deltaX = connection.endCoords[0] - connection.startCoords[0];
9679
- const deltaY = connection.endCoords[1] - connection.startCoords[1];
9680
- switch (connection.startDirection) {
9681
- case exports.Side.Top:
9682
- startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
9683
- endLabelShiftX = startLabelShiftX;
9684
- break;
9685
- case exports.Side.Bottom:
9686
- startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
9687
- endLabelShiftX = startLabelShiftX;
9688
- break;
9689
- case exports.Side.Left:
9690
- startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
9691
- endLabelShiftY = startLabelShiftY;
9692
- break;
9693
- case exports.Side.Right:
9694
- startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
9695
- endLabelShiftY = startLabelShiftY;
9696
- break;
9697
- default:
9698
- startLabelShiftX = 0.5;
9699
- endLabelShiftX = startLabelShiftX;
9700
- startLabelShiftY = -0.5;
9701
- endLabelShiftY = startLabelShiftY;
9702
- }
9703
- switch (connection.endDirection) {
9704
- case exports.Side.Top:
9705
- endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
9706
- break;
9707
- case exports.Side.Bottom:
9708
- endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
9709
- break;
9710
- case exports.Side.Left:
9711
- endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
9712
- break;
9713
- case exports.Side.Right:
9714
- endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
9715
- break;
9716
- default:
9717
- endLabelShiftX = 0.5;
9718
- endLabelShiftY = -0.5;
9719
- }
9720
- if (Math.abs(deltaX) >= Math.abs(deltaY)) {
9721
- // horizontal quadrant
9722
- middleLabelShiftX = deltaX > 0 ? -0.5 : 0.5;
9723
- middleLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
9724
- } else {
9725
- // vertical quadrant
9726
- middleLabelShiftX = deltaX > 0 ? 0.5 : -0.5;
9727
- middleLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
9728
- }
9729
- }
9730
- // bind start labels
9731
- connectionSelection.select('g.diagram-connection-start-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fontColor).text(connection.startLabel);
9732
- const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
9733
- if (startLabelBoundingRect) {
9734
- // don't create space for the label if the label is empty
9735
- const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
9736
- const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
9737
- let pathStartLabelPoint;
9738
- switch (connection.startDirection) {
9739
- case exports.Side.Left:
9740
- pathStartLabelPoint = pathNode.getPointAtLength(getRightMargin(labelConfiguration) + boundingWidth / 2);
9741
- break;
9742
- case exports.Side.Right:
9743
- pathStartLabelPoint = pathNode.getPointAtLength(getLeftMargin(labelConfiguration) + boundingWidth / 2);
9744
- break;
9745
- case exports.Side.Top:
9746
- pathStartLabelPoint = pathNode.getPointAtLength(getBottomMargin(labelConfiguration) + boundingHeight / 2);
9747
- break;
9748
- case exports.Side.Bottom:
9749
- pathStartLabelPoint = pathNode.getPointAtLength(getTopMargin(labelConfiguration) + boundingHeight / 2);
9750
- break;
9751
- default:
9752
- pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
9753
- }
9754
- connectionSelection.select('g.diagram-connection-start-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
9755
- connectionSelection.select('g.diagram-connection-start-label').attr('transform', `translate(${pathStartLabelPoint.x + startLabelShiftX * boundingWidth},${pathStartLabelPoint.y + startLabelShiftY * boundingHeight})`);
9756
- }
9757
- // bind middle labels
9758
- connectionSelection.select('g.diagram-connection-middle-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).style('font-kerning', 'none').text(connection.middleLabel);
9759
- const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
9760
- if (middleLabelBoundingRect) {
9761
- // don't create space for the label if the label is empty
9762
- const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
9763
- const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
9764
- const pathMiddleLabelPoint = pathNode.getPointAtLength(pathLength / 2);
9765
- connectionSelection.select('g.diagram-connection-middle-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
9766
- connectionSelection.select('g.diagram-connection-middle-label').attr('transform', `translate(${pathMiddleLabelPoint.x + middleLabelShiftX * boundingWidth},${pathMiddleLabelPoint.y + middleLabelShiftY * boundingHeight})`);
9767
- }
9768
- // bind end labels
9769
- connectionSelection.select('g.diagram-connection-end-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fontColor).style('font-kerning', 'none').text(connection.endLabel);
9770
- const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
9771
- if (endLabelBoundingRect) {
9772
- // don't create space for the label if the label is empty
9773
- const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
9774
- const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
9775
- let pathEndLabelPoint;
9776
- switch (connection.endDirection) {
9777
- case exports.Side.Left:
9778
- pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getRightMargin(labelConfiguration) + boundingWidth / 2));
9779
- break;
9780
- case exports.Side.Right:
9781
- pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getLeftMargin(labelConfiguration) + boundingWidth / 2));
9782
- break;
9783
- case exports.Side.Top:
9784
- pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getBottomMargin(labelConfiguration) + boundingHeight / 2));
9785
- break;
9786
- case exports.Side.Bottom:
9787
- pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getTopMargin(labelConfiguration) + boundingHeight / 2));
9788
- break;
9789
- default:
9790
- pathEndLabelPoint = pathNode.getPointAtLength(pathLength - Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
9791
- }
9792
- connectionSelection.select('g.diagram-connection-end-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
9793
- connectionSelection.select('g.diagram-connection-end-label').attr('transform', `translate(${pathEndLabelPoint.x + endLabelShiftX * boundingWidth},${pathEndLabelPoint.y + endLabelShiftY * boundingHeight})`);
9794
- }
9795
- }
9796
- }
9797
- updateConnectionMarkersInView(connection) {
9798
- const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
9799
- const startMarkerSelection = connectionSelection.select('marker.diagram-connection-start-marker');
9800
- const endMarkerSelection = connectionSelection.select('marker.diagram-connection-end-marker');
9801
- if (connection.startMarkerLook !== null) {
9802
- startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.startMarkerLook.width).attr('markerHeight', connection.startMarkerLook.height).attr('refX', connection.startMarkerLook.refX).attr('refY', connection.startMarkerLook.refY).select('image').attr('href', connection.startMarkerLook.image).attr('width', connection.startMarkerLook.width).attr('height', connection.startMarkerLook.height);
9803
- } else {
9804
- startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
9805
- }
9806
- if (connection.endMarkerLook !== null) {
9807
- endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.endMarkerLook.width).attr('markerHeight', connection.endMarkerLook.height).attr('refX', connection.endMarkerLook.refX).attr('refY', connection.endMarkerLook.refY).select('image').attr('href', connection.endMarkerLook.image).attr('width', connection.endMarkerLook.width).attr('height', connection.endMarkerLook.height);
9808
- } else {
9809
- endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
9810
- }
9811
- }
9812
9746
  bringToFront(node) {
9813
9747
  const overlappingNodes = this.model.nodes.filter(n => n.id !== node.id && rectanglesIntersect([n.coords, [n.coords[0] + n.width, n.coords[1] + n.height]], [node.coords, [node.coords[0] + node.width, node.coords[1] + node.height]]));
9814
9748
  let maximumZ = node.z;
@@ -9824,10 +9758,10 @@ class DiagramCanvas {
9824
9758
  }));
9825
9759
  node.raiseWithZ();
9826
9760
  action.to = node.getGeometry();
9827
- this.currentAction = action;
9828
- this.currentAction.do();
9829
- this.actionStack.add(this.currentAction);
9830
- this.currentAction = undefined;
9761
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, action, "f");
9762
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
9763
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
9764
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
9831
9765
  }
9832
9766
  sendToBack(node) {
9833
9767
  const overlappingNodes = this.model.nodes.filter(n => n.id !== node.id && rectanglesIntersect([n.coords, [n.coords[0] + n.width, n.coords[1] + n.height]], [node.coords, [node.coords[0] + node.width, node.coords[1] + node.height]]));
@@ -9844,33 +9778,33 @@ class DiagramCanvas {
9844
9778
  }));
9845
9779
  node.raiseWithZ();
9846
9780
  action.to = node.getGeometry();
9847
- this.currentAction = action;
9848
- this.currentAction.do();
9849
- this.actionStack.add(this.currentAction);
9850
- this.currentAction = undefined;
9781
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, action, "f");
9782
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
9783
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
9784
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
9851
9785
  }
9852
9786
  fieldRootFitsInView(id) {
9853
- var _a, _b, _c, _d;
9787
+ var _b, _c, _d, _e;
9854
9788
  const field = this.model.fields.get(id);
9855
9789
  if (!field) {
9856
9790
  return false;
9857
9791
  }
9858
9792
  if (field.rootElement instanceof DiagramNode || field.rootElement instanceof DiagramSection) {
9859
- const fieldDimensions = this.minimumSizeOfField(field);
9860
- const stretchX = fieldDimensions[0] + getLeftMargin((_a = field.rootElement.type) === null || _a === void 0 ? void 0 : _a.label) + getRightMargin((_b = field.rootElement.type) === null || _b === void 0 ? void 0 : _b.label) - field.rootElement.width;
9861
- const stretchY = fieldDimensions[1] + getTopMargin((_c = field.rootElement.type) === null || _c === void 0 ? void 0 : _c.label) + getBottomMargin((_d = field.rootElement.type) === null || _d === void 0 ? void 0 : _d.label) - field.rootElement.height;
9793
+ const fieldDimensions = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
9794
+ const stretchX = fieldDimensions[0] + getLeftMargin((_b = field.rootElement.type) === null || _b === void 0 ? void 0 : _b.label) + getRightMargin((_c = field.rootElement.type) === null || _c === void 0 ? void 0 : _c.label) - field.rootElement.width;
9795
+ const stretchY = fieldDimensions[1] + getTopMargin((_d = field.rootElement.type) === null || _d === void 0 ? void 0 : _d.label) + getBottomMargin((_e = field.rootElement.type) === null || _e === void 0 ? void 0 : _e.label) - field.rootElement.height;
9862
9796
  return stretchX <= 0 && stretchY <= 0;
9863
9797
  }
9864
9798
  return true;
9865
9799
  }
9866
9800
  fitFieldRootInView(id, shrink = true) {
9867
- var _a, _b, _c;
9801
+ var _b, _c, _d;
9868
9802
  const field = this.model.fields.get(id);
9869
9803
  if (!field) {
9870
9804
  return;
9871
9805
  }
9872
9806
  if (field.rootElement instanceof DiagramNode) {
9873
- const fieldDimensions = this.minimumSizeOfField(field);
9807
+ const fieldDimensions = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
9874
9808
  let stretchX = fieldDimensions[0] + getLeftMargin(field.rootElement.type.label) + getRightMargin(field.rootElement.type.label) - field.rootElement.width;
9875
9809
  let stretchY = fieldDimensions[1] + getTopMargin(field.rootElement.type.label) + getBottomMargin(field.rootElement.type.label) - field.rootElement.height;
9876
9810
  const spacingX = getGridSpacingX(this.gridConfig);
@@ -9896,15 +9830,15 @@ class DiagramCanvas {
9896
9830
  }
9897
9831
  }
9898
9832
  if (field.rootElement instanceof DiagramSection) {
9899
- const fieldDimensions = this.minimumSizeOfField(field);
9833
+ const fieldDimensions = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
9900
9834
  let minimumFieldWidth = fieldDimensions[0];
9901
9835
  let minimumFieldHeight = fieldDimensions[1];
9902
- for (const section of ((_a = field.rootElement.node) === null || _a === void 0 ? void 0 : _a.sections) || []) {
9836
+ for (const section of ((_b = field.rootElement.node) === null || _b === void 0 ? void 0 : _b.sections) || []) {
9903
9837
  if (section.label) {
9904
9838
  if (section.indexXInNode === field.rootElement.indexXInNode && section.indexYInNode !== field.rootElement.indexYInNode) {
9905
- minimumFieldWidth = Math.max(minimumFieldWidth, this.minimumSizeOfField(section.label)[0]);
9839
+ minimumFieldWidth = Math.max(minimumFieldWidth, __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, section.label)[0]);
9906
9840
  } else if (section.indexXInNode !== field.rootElement.indexXInNode && section.indexYInNode === field.rootElement.indexYInNode) {
9907
- minimumFieldHeight = Math.max(minimumFieldHeight, this.minimumSizeOfField(section.label)[1]);
9841
+ minimumFieldHeight = Math.max(minimumFieldHeight, __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, section.label)[1]);
9908
9842
  }
9909
9843
  }
9910
9844
  }
@@ -9933,25 +9867,25 @@ class DiagramCanvas {
9933
9867
  stretchY = (field.rootElement.getMinHeight() || 0) - field.rootElement.height;
9934
9868
  }
9935
9869
  if (shrink || stretchX > 0) {
9936
- (_b = field.rootElement.node) === null || _b === void 0 ? void 0 : _b.stretchSections(exports.Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
9870
+ (_c = field.rootElement.node) === null || _c === void 0 ? void 0 : _c.stretchSections(exports.Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
9937
9871
  }
9938
9872
  if (shrink || stretchY > 0) {
9939
- (_c = field.rootElement.node) === null || _c === void 0 ? void 0 : _c.stretchSections(exports.Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
9873
+ (_d = field.rootElement.node) === null || _d === void 0 ? void 0 : _d.stretchSections(exports.Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
9940
9874
  }
9941
9875
  }
9942
9876
  }
9943
9877
  fitNodeInView(id, shrink = true) {
9944
- var _a, _b;
9878
+ var _b, _c;
9945
9879
  const node = this.model.nodes.get(id);
9946
9880
  if (!node) {
9947
9881
  return;
9948
9882
  }
9949
- if (node.sections.length > 0 && this.priorityThreshold) {
9883
+ if (node.sections.length > 0 && __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f")) {
9950
9884
  let newNodeWidth = 0;
9951
9885
  let newNodeHeight = 0;
9952
9886
  // calculate newNodeWidth, newNodeHeight as the rightmost and bottommost points of any of the sections of the node
9953
9887
  for (const section of node.sections) {
9954
- if (section.getPriority() >= this.priorityThreshold) {
9888
+ if (section.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f")) {
9955
9889
  const sectionLastXCoordRelativeToNode = section.coords[0] + section.width - node.coords[0];
9956
9890
  const sectionLastYCoordRelativeToNode = section.coords[1] + section.height - node.coords[1];
9957
9891
  newNodeWidth = Math.max(newNodeWidth, sectionLastXCoordRelativeToNode);
@@ -9959,8 +9893,8 @@ class DiagramCanvas {
9959
9893
  }
9960
9894
  }
9961
9895
  // add the margin that goes between the rightmost and bottommost points of the sections and the edge of the node
9962
- newNodeWidth += ((_a = node.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
9963
- newNodeHeight += ((_b = node.type.sectionGrid) === null || _b === void 0 ? void 0 : _b.margin) || 0;
9896
+ newNodeWidth += ((_b = node.type.sectionGrid) === null || _b === void 0 ? void 0 : _b.margin) || 0;
9897
+ newNodeHeight += ((_c = node.type.sectionGrid) === null || _c === void 0 ? void 0 : _c.margin) || 0;
9964
9898
  if (shrink || newNodeWidth > node.width) {
9965
9899
  node.stretch(exports.Side.Right, newNodeWidth - node.width);
9966
9900
  }
@@ -9970,7 +9904,7 @@ class DiagramCanvas {
9970
9904
  }
9971
9905
  }
9972
9906
  selectRoot() {
9973
- return d3__namespace.select(this.diagramRoot);
9907
+ return d3__namespace.select(__classPrivateFieldGet(this, _DiagramCanvas_diagramRoot, "f"));
9974
9908
  }
9975
9909
  selectSVGElement() {
9976
9910
  return this.selectRoot().select('svg');
@@ -9981,107 +9915,10 @@ class DiagramCanvas {
9981
9915
  selectCanvasElements() {
9982
9916
  return this.selectCanvasView().select(`.daga-canvas-elements`);
9983
9917
  }
9984
- // User actions
9985
- startConnection(port) {
9986
- var _a, _b, _c, _d;
9987
- if (port.allowsOutgoing || port.allowsIncoming) {
9988
- if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '') && port.allowsOutgoing || this.connectionType.canFinishOnType(((_d = (_c = port.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && port.allowsIncoming)) {
9989
- this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
9990
- this.unfinishedConnectionPort = port;
9991
- } else {
9992
- if (this.inferConnectionType) {
9993
- let differentConnectionType = this.model.connections.types.all().find(t => {
9994
- var _a, _b;
9995
- return port.allowsOutgoing && t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '');
9996
- });
9997
- if (differentConnectionType === undefined) {
9998
- differentConnectionType = this.model.connections.types.all().find(t => {
9999
- var _a, _b;
10000
- return port.allowsIncoming && t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '');
10001
- });
10002
- }
10003
- if (differentConnectionType !== undefined) {
10004
- this.unfinishedConnection = new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID);
10005
- this.unfinishedConnectionPort = port;
10006
- }
10007
- }
10008
- }
10009
- }
10010
- }
10011
- finishConnection(port) {
10012
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
10013
- this.userHighlight.clear();
10014
- if (this.unfinishedConnection !== undefined) {
10015
- if (!this.allowConnectionLoops && this.unfinishedConnection.start === port) {
10016
- this.dropConnection();
10017
- return;
10018
- }
10019
- if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
10020
- this.dropConnection();
10021
- return;
10022
- }
10023
- if (!this.allowSharingBothPorts && this.model.connections.find(c => {
10024
- var _a, _b;
10025
- return !c.removed && (c.start === ((_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) && c.end === port || c.end === ((_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.start) && c.start === port);
10026
- }) !== undefined) {
10027
- this.dropConnection();
10028
- return;
10029
- }
10030
- if (this.unfinishedConnection.type.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsOutgoing) && this.unfinishedConnection.type.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsIncoming) {
10031
- const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_j = this.unfinishedConnection.start) === null || _j === void 0 ? void 0 : _j.id, port.id);
10032
- // clean up the previous unfinished connection
10033
- this.dropConnection();
10034
- addConnectionAction.do();
10035
- this.actionStack.add(addConnectionAction);
10036
- } else if (this.unfinishedConnection.type.canFinishOnType(((_o = (_m = (_l = (_k = this.unfinishedConnection) === null || _k === void 0 ? void 0 : _k.start) === null || _l === void 0 ? void 0 : _l.getNode()) === null || _m === void 0 ? void 0 : _m.type) === null || _o === void 0 ? void 0 : _o.id) || '') && ((_q = (_p = this.unfinishedConnection) === null || _p === void 0 ? void 0 : _p.start) === null || _q === void 0 ? void 0 : _q.allowsIncoming) && this.unfinishedConnection.type.canStartFromType(((_s = (_r = port.getNode()) === null || _r === void 0 ? void 0 : _r.type) === null || _s === void 0 ? void 0 : _s.id) || '') && port.allowsOutgoing) {
10037
- const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_t = this.unfinishedConnection.start) === null || _t === void 0 ? void 0 : _t.id);
10038
- // clean up the previous unfinished connection
10039
- this.dropConnection();
10040
- addConnectionAction.do();
10041
- this.actionStack.add(addConnectionAction);
10042
- } else {
10043
- if (this.inferConnectionType) {
10044
- let differentConnectionType = this.model.connections.types.all().find(t => {
10045
- var _a, _b, _c, _d, _e, _f, _g, _h;
10046
- return t.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsOutgoing) && t.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsIncoming;
10047
- });
10048
- let invertConnection = false;
10049
- if (differentConnectionType === undefined) {
10050
- differentConnectionType = this.model.connections.types.all().find(t => {
10051
- var _a, _b, _c, _d, _e, _f, _g, _h;
10052
- return t.canFinishOnType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsIncoming) && t.canStartFromType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsOutgoing;
10053
- });
10054
- invertConnection = true;
10055
- }
10056
- if (differentConnectionType !== undefined) {
10057
- const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_u = this.unfinishedConnection.start) === null || _u === void 0 ? void 0 : _u.id, invertConnection ? (_v = this.unfinishedConnection.start) === null || _v === void 0 ? void 0 : _v.id : port.id);
10058
- // clean up the previous unfinished connection
10059
- this.dropConnection();
10060
- addConnectionAction.do();
10061
- this.actionStack.add(addConnectionAction);
10062
- } else {
10063
- // error: connection target of wrong type and no allowed type can be found
10064
- this.dropConnection();
10065
- }
10066
- } else {
10067
- // error: connection target of wrong type and can't guess for a different type
10068
- this.dropConnection();
10069
- }
10070
- }
10071
- }
10072
- }
10073
- dropConnection() {
10074
- var _a, _b, _c, _d;
10075
- (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.setStart(undefined);
10076
- (_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.setEnd(undefined);
10077
- (_d = (_c = this.unfinishedConnection) === null || _c === void 0 ? void 0 : _c.select()) === null || _d === void 0 ? void 0 : _d.remove();
10078
- this.unfinishedConnection = undefined;
10079
- this.unfinishedConnectionPort = undefined;
10080
- }
10081
9918
  cancelAllUserActions() {
10082
- this.currentAction = undefined;
10083
- this.dropConnection();
10084
- this.removeInputField();
9919
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
9920
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
9921
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
10085
9922
  this.contextMenu.close();
10086
9923
  this.userSelection.clear();
10087
9924
  }
@@ -10091,7 +9928,8 @@ class DiagramCanvas {
10091
9928
  openTextInput(id) {
10092
9929
  const field = this.model.fields.get(id);
10093
9930
  if (field) {
10094
- this.createInputField(field.text, field.coords, field.width, field.height, field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize, field.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily, field.orientation, field.multiline, () => {
9931
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new EditFieldAction(this, field.id, field.text, ''), "f");
9932
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_createInputField).call(this, field.text, field.coords, field.width, field.height, field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize, field.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily, field.orientation, field.multiline, () => {
10095
9933
  // (_text)
10096
9934
  /*
10097
9935
  Empty for now
@@ -10100,257 +9938,483 @@ class DiagramCanvas {
10100
9938
  */
10101
9939
  }, text => {
10102
9940
  field.text = text;
10103
- if (this.currentAction instanceof EditFieldAction) {
10104
- this.currentAction.to = text;
10105
- this.currentAction.do();
10106
- this.actionStack.add(this.currentAction);
10107
- this.currentAction = undefined;
9941
+ if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof EditFieldAction) {
9942
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = text;
9943
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
9944
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
9945
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
10108
9946
  }
10109
9947
  });
10110
9948
  }
10111
9949
  }
10112
- createInputField(text, coords, width, height, fontSize, fontFamily, orientation, multiline, changeCallback, finishCallback) {
10113
- // if we have a text input open, close it before creating a new one
10114
- this.removeInputField();
10115
- const inputFieldContainer = this.selectCanvasElements().append('foreignObject').attr('x', `${coords[0]}px`).attr('y', `${coords[1]}px`).attr('width', `${width}px`).attr('height', `${height}px`).style('box-sizing', 'border-box').style('border', '1px solid');
10116
- this.inputFieldContainer = inputFieldContainer;
10117
- const inputField = inputFieldContainer.append('xhtml:textarea');
10118
- let inputFieldWidth;
10119
- let inputFieldHeight;
10120
- inputField.text(text).style('box-sizing', 'border-box').style('width', `${width}px`).style('height', `${height}px`).style('font-size', `${fontSize}px`).style('font-family', fontFamily).style('resize', 'none').style('outline', 0).style('border', 0).style('margin', 0).style('padding', 0).on(exports.Events.KeyDown, event => {
10121
- event.stopPropagation();
10122
- if (event.key === exports.Keys.Escape || event.key === exports.Keys.Enter && !multiline) {
10123
- const value = inputField.property('value') || '';
10124
- this.removeInputField();
10125
- if (finishCallback) {
10126
- finishCallback(value);
10127
- }
10128
- }
10129
- }).on(exports.Events.KeyUp, event => {
10130
- event.stopPropagation();
10131
- }).on(exports.Events.Input, () => {
10132
- const value = inputField.property('value');
10133
- inputField.attr('cols', numberOfColumns(value) + 1);
10134
- inputField.attr('rows', numberOfRows(value) + 1);
10135
- // reset width and height so that later the scrollWidth and scrollHeight are fit to the size of the text
10136
- inputField.style('width', '');
10137
- inputField.style('height', '');
10138
- // add one diagram unit of margin of error
10139
- inputFieldWidth = inputField.property('scrollWidth') + 1;
10140
- inputFieldHeight = inputField.property('scrollHeight') + 1;
10141
- // keep the field from shrinking below its original size
10142
- const newWidth = Math.max(inputFieldWidth, width);
10143
- const newHeight = Math.max(inputFieldHeight, height);
10144
- inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('width', `${newWidth}px`);
10145
- inputField.style('width', `${newWidth}px`);
10146
- inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('height', `${newHeight}px`);
10147
- inputField.style('height', `${newHeight}px`);
10148
- if (changeCallback) {
10149
- changeCallback(value);
9950
+ }
9951
+ _a = DiagramCanvas, _DiagramCanvas_diagramRoot = new WeakMap(), _DiagramCanvas_connectionType = new WeakMap(), _DiagramCanvas_gridPatternId = new WeakMap(), _DiagramCanvas_ancillaryGridPatternIds = new WeakMap(), _DiagramCanvas_zoomBehavior = new WeakMap(), _DiagramCanvas_zoomTransform = new WeakMap(), _DiagramCanvas_priorityThreshold = new WeakMap(), _DiagramCanvas_priorityThresholds = new WeakMap(), _DiagramCanvas_unfinishedConnection = new WeakMap(), _DiagramCanvas_unfinishedConnectionTracer = new WeakMap(), _DiagramCanvas_unfinishedConnectionPort = new WeakMap(), _DiagramCanvas_inputFieldContainer = new WeakMap(), _DiagramCanvas_multipleSelectionContainer = new WeakMap(), _DiagramCanvas_draggingFrom = new WeakMap(), _DiagramCanvas_dragging = new WeakMap(), _DiagramCanvas_secondaryButton = new WeakMap(), _DiagramCanvas_currentAction = new WeakMap(), _DiagramCanvas_instances = new WeakSet(), _DiagramCanvas_updateConnectionLabelsInView = function _DiagramCanvas_updateConnectionLabelsInView(connection) {
9952
+ var _b, _c, _d;
9953
+ const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
9954
+ const pathSelection = connectionSelection.select('path');
9955
+ const pathNode = pathSelection.node();
9956
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), connection.type.label);
9957
+ labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
9958
+ if (pathNode) {
9959
+ const pathLength = pathNode.getTotalLength();
9960
+ let startLabelShiftX = 0;
9961
+ let startLabelShiftY = 0;
9962
+ let middleLabelShiftX = 0;
9963
+ let middleLabelShiftY = 0;
9964
+ let endLabelShiftX = 0;
9965
+ let endLabelShiftY = 0;
9966
+ if (labelConfiguration.look.fillColor === 'transparent') {
9967
+ // background color is transparent / not set, so we find an alternative position for the label
9968
+ const deltaX = connection.endCoords[0] - connection.startCoords[0];
9969
+ const deltaY = connection.endCoords[1] - connection.startCoords[1];
9970
+ switch (connection.startDirection) {
9971
+ case exports.Side.Top:
9972
+ startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
9973
+ endLabelShiftX = startLabelShiftX;
9974
+ break;
9975
+ case exports.Side.Bottom:
9976
+ startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
9977
+ endLabelShiftX = startLabelShiftX;
9978
+ break;
9979
+ case exports.Side.Left:
9980
+ startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
9981
+ endLabelShiftY = startLabelShiftY;
9982
+ break;
9983
+ case exports.Side.Right:
9984
+ startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
9985
+ endLabelShiftY = startLabelShiftY;
9986
+ break;
9987
+ default:
9988
+ startLabelShiftX = 0.5;
9989
+ endLabelShiftX = startLabelShiftX;
9990
+ startLabelShiftY = -0.5;
9991
+ endLabelShiftY = startLabelShiftY;
10150
9992
  }
10151
- }).on(exports.Events.Click, event => {
10152
- event.stopPropagation();
10153
- }).on(exports.Events.FocusOut, () => {
10154
- const value = inputField.property('value');
10155
- this.removeInputField();
10156
- if (finishCallback) {
10157
- finishCallback(value);
9993
+ switch (connection.endDirection) {
9994
+ case exports.Side.Top:
9995
+ endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
9996
+ break;
9997
+ case exports.Side.Bottom:
9998
+ endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
9999
+ break;
10000
+ case exports.Side.Left:
10001
+ endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
10002
+ break;
10003
+ case exports.Side.Right:
10004
+ endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
10005
+ break;
10006
+ default:
10007
+ endLabelShiftX = 0.5;
10008
+ endLabelShiftY = -0.5;
10158
10009
  }
10159
- });
10160
- const htmlInput = inputField.node();
10161
- htmlInput.focus();
10162
- htmlInput.select();
10010
+ if (Math.abs(deltaX) >= Math.abs(deltaY)) {
10011
+ // horizontal quadrant
10012
+ middleLabelShiftX = deltaX > 0 ? -0.5 : 0.5;
10013
+ middleLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
10014
+ } else {
10015
+ // vertical quadrant
10016
+ middleLabelShiftX = deltaX > 0 ? 0.5 : -0.5;
10017
+ middleLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
10018
+ }
10019
+ }
10020
+ // bind start labels
10021
+ connectionSelection.select('g.diagram-connection-start-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fontColor).text(connection.startLabel);
10022
+ const startLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
10023
+ if (startLabelBoundingRect) {
10024
+ // don't create space for the label if the label is empty
10025
+ const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
10026
+ const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
10027
+ let pathStartLabelPoint;
10028
+ switch (connection.startDirection) {
10029
+ case exports.Side.Left:
10030
+ pathStartLabelPoint = pathNode.getPointAtLength(getRightMargin(labelConfiguration) + boundingWidth / 2);
10031
+ break;
10032
+ case exports.Side.Right:
10033
+ pathStartLabelPoint = pathNode.getPointAtLength(getLeftMargin(labelConfiguration) + boundingWidth / 2);
10034
+ break;
10035
+ case exports.Side.Top:
10036
+ pathStartLabelPoint = pathNode.getPointAtLength(getBottomMargin(labelConfiguration) + boundingHeight / 2);
10037
+ break;
10038
+ case exports.Side.Bottom:
10039
+ pathStartLabelPoint = pathNode.getPointAtLength(getTopMargin(labelConfiguration) + boundingHeight / 2);
10040
+ break;
10041
+ default:
10042
+ pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
10043
+ }
10044
+ connectionSelection.select('g.diagram-connection-start-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
10045
+ connectionSelection.select('g.diagram-connection-start-label').attr('transform', `translate(${pathStartLabelPoint.x + startLabelShiftX * boundingWidth},${pathStartLabelPoint.y + startLabelShiftY * boundingHeight})`);
10046
+ }
10047
+ // bind middle labels
10048
+ connectionSelection.select('g.diagram-connection-middle-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).style('font-kerning', 'none').text(connection.middleLabel);
10049
+ const middleLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
10050
+ if (middleLabelBoundingRect) {
10051
+ // don't create space for the label if the label is empty
10052
+ const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
10053
+ const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
10054
+ const pathMiddleLabelPoint = pathNode.getPointAtLength(pathLength / 2);
10055
+ connectionSelection.select('g.diagram-connection-middle-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
10056
+ connectionSelection.select('g.diagram-connection-middle-label').attr('transform', `translate(${pathMiddleLabelPoint.x + middleLabelShiftX * boundingWidth},${pathMiddleLabelPoint.y + middleLabelShiftY * boundingHeight})`);
10057
+ }
10058
+ // bind end labels
10059
+ connectionSelection.select('g.diagram-connection-end-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fontColor).style('font-kerning', 'none').text(connection.endLabel);
10060
+ const endLabelBoundingRect = (_d = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _d === void 0 ? void 0 : _d.getBoundingClientRect();
10061
+ if (endLabelBoundingRect) {
10062
+ // don't create space for the label if the label is empty
10063
+ const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
10064
+ const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
10065
+ let pathEndLabelPoint;
10066
+ switch (connection.endDirection) {
10067
+ case exports.Side.Left:
10068
+ pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getRightMargin(labelConfiguration) + boundingWidth / 2));
10069
+ break;
10070
+ case exports.Side.Right:
10071
+ pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getLeftMargin(labelConfiguration) + boundingWidth / 2));
10072
+ break;
10073
+ case exports.Side.Top:
10074
+ pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getBottomMargin(labelConfiguration) + boundingHeight / 2));
10075
+ break;
10076
+ case exports.Side.Bottom:
10077
+ pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getTopMargin(labelConfiguration) + boundingHeight / 2));
10078
+ break;
10079
+ default:
10080
+ pathEndLabelPoint = pathNode.getPointAtLength(pathLength - Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
10081
+ }
10082
+ connectionSelection.select('g.diagram-connection-end-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
10083
+ connectionSelection.select('g.diagram-connection-end-label').attr('transform', `translate(${pathEndLabelPoint.x + endLabelShiftX * boundingWidth},${pathEndLabelPoint.y + endLabelShiftY * boundingHeight})`);
10084
+ }
10163
10085
  }
10164
- removeInputField() {
10165
- var _a, _b, _c;
10166
- // when removing an element, a blur event is emitted
10167
- // we remove the listener for blur so that it doesn't shoot again on element removal
10168
- (_b = (_a = this.inputFieldContainer) === null || _a === void 0 ? void 0 : _a.select('input')) === null || _b === void 0 ? void 0 : _b.on(exports.Events.Blur, null);
10169
- (_c = this.inputFieldContainer) === null || _c === void 0 ? void 0 : _c.remove();
10170
- this.inputFieldContainer = undefined;
10086
+ }, _DiagramCanvas_updateConnectionMarkersInView = function _DiagramCanvas_updateConnectionMarkersInView(connection) {
10087
+ const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
10088
+ const startMarkerSelection = connectionSelection.select('marker.diagram-connection-start-marker');
10089
+ const endMarkerSelection = connectionSelection.select('marker.diagram-connection-end-marker');
10090
+ if (connection.startMarkerLook !== null) {
10091
+ startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.startMarkerLook.width).attr('markerHeight', connection.startMarkerLook.height).attr('refX', connection.startMarkerLook.refX).attr('refY', connection.startMarkerLook.refY).select('image').attr('href', connection.startMarkerLook.image).attr('width', connection.startMarkerLook.width).attr('height', connection.startMarkerLook.height);
10092
+ } else {
10093
+ startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
10171
10094
  }
10172
- minimumSizeOfField(field) {
10173
- var _a, _b;
10174
- const textNode = (_b = (_a = field.select()) === null || _a === void 0 ? void 0 : _a.select('text')) === null || _b === void 0 ? void 0 : _b.node();
10175
- if (!textNode) {
10176
- // happens when a field has been created but not updated in view yet
10177
- return [0, 0];
10095
+ if (connection.endMarkerLook !== null) {
10096
+ endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.endMarkerLook.width).attr('markerHeight', connection.endMarkerLook.height).attr('refX', connection.endMarkerLook.refX).attr('refY', connection.endMarkerLook.refY).select('image').attr('href', connection.endMarkerLook.image).attr('width', connection.endMarkerLook.width).attr('height', connection.endMarkerLook.height);
10097
+ } else {
10098
+ endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
10099
+ }
10100
+ }, _DiagramCanvas_startConnection = function _DiagramCanvas_startConnection(port) {
10101
+ var _b, _c, _d, _e;
10102
+ if (port.allowsOutgoing || port.allowsIncoming) {
10103
+ if (this.connectionType && (this.connectionType.canStartFromType(((_c = (_b = port.getNode()) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.id) || '') && port.allowsOutgoing || this.connectionType.canFinishOnType(((_e = (_d = port.getNode()) === null || _d === void 0 ? void 0 : _d.type) === null || _e === void 0 ? void 0 : _e.id) || '') && port.allowsIncoming)) {
10104
+ __classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnection, new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID), "f");
10105
+ __classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionPort, port, "f");
10106
+ } else {
10107
+ if (this.inferConnectionType) {
10108
+ let differentConnectionType = this.model.connections.types.all().find(t => {
10109
+ var _b, _c;
10110
+ return port.allowsOutgoing && t.canStartFromType(((_c = (_b = port.getNode()) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.id) || '');
10111
+ });
10112
+ if (differentConnectionType === undefined) {
10113
+ differentConnectionType = this.model.connections.types.all().find(t => {
10114
+ var _b, _c;
10115
+ return port.allowsIncoming && t.canFinishOnType(((_c = (_b = port.getNode()) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.id) || '');
10116
+ });
10117
+ }
10118
+ if (differentConnectionType !== undefined) {
10119
+ __classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnection, new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID), "f");
10120
+ __classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionPort, port, "f");
10121
+ }
10122
+ }
10178
10123
  }
10179
- const textBoundingBox = textNode.getBoundingClientRect();
10180
- return [textBoundingBox.width / this.zoomTransform.k, textBoundingBox.height / this.zoomTransform.k];
10181
10124
  }
10182
- setFieldTextAndWrap(field) {
10183
- var _a, _b, _c, _d;
10184
- const textSelection = (_a = field.select()) === null || _a === void 0 ? void 0 : _a.select('text');
10185
- const textNode = textSelection === null || textSelection === void 0 ? void 0 : textSelection.node();
10186
- if (textSelection && textNode) {
10187
- this.setFieldText(field, textSelection, field.text);
10188
- } else {
10189
- // can happen if a field has been created but not updated in view yet
10190
- // not sure if this still happens but should check just in case
10125
+ }, _DiagramCanvas_finishConnection = function _DiagramCanvas_finishConnection(port) {
10126
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
10127
+ this.userHighlight.clear();
10128
+ if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") !== undefined) {
10129
+ if (!this.allowConnectionLoops && __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start === port) {
10130
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
10131
+ return;
10132
+ }
10133
+ if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
10134
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
10191
10135
  return;
10192
10136
  }
10193
- if (field.fit) {
10194
- // no need to wrap
10137
+ if (!this.allowSharingBothPorts && this.model.connections.find(c => {
10138
+ var _b, _c;
10139
+ return !c.removed && (c.start === ((_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.start) && c.end === port || c.end === ((_c = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _c === void 0 ? void 0 : _c.start) && c.start === port);
10140
+ }) !== undefined) {
10141
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
10195
10142
  return;
10196
10143
  }
10197
- let minimumSize = this.minimumSizeOfField(field);
10198
- while (minimumSize[0] > field.width || minimumSize[1] > field.height) {
10199
- const textString = ((_d = (_c = (_b = textSelection === null || textSelection === void 0 ? void 0 : textSelection.html()) === null || _b === void 0 ? void 0 : _b.replace(/<\/tspan>/g, '\n')) === null || _c === void 0 ? void 0 : _c.replace(/<tspan[^>]*>/g, '')) === null || _d === void 0 ? void 0 : _d.slice(0, -1)) || '';
10200
- let newTextString = '...';
10201
- if (textString.endsWith('...')) {
10202
- newTextString = textString.slice(0, -4) + '...';
10144
+ if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canStartFromType(((_e = (_d = (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.getNode()) === null || _d === void 0 ? void 0 : _d.type) === null || _e === void 0 ? void 0 : _e.id) || '') && ((_g = (_f = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _f === void 0 ? void 0 : _f.start) === null || _g === void 0 ? void 0 : _g.allowsOutgoing) && __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canFinishOnType(((_j = (_h = port.getNode()) === null || _h === void 0 ? void 0 : _h.type) === null || _j === void 0 ? void 0 : _j.id) || '') && port.allowsIncoming) {
10145
+ const addConnectionAction = new AddConnectionAction(this, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type, (_k = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _k === void 0 ? void 0 : _k.id, port.id);
10146
+ // clean up the previous unfinished connection
10147
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
10148
+ addConnectionAction.do();
10149
+ this.actionStack.add(addConnectionAction);
10150
+ } else if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canFinishOnType(((_p = (_o = (_m = (_l = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _l === void 0 ? void 0 : _l.start) === null || _m === void 0 ? void 0 : _m.getNode()) === null || _o === void 0 ? void 0 : _o.type) === null || _p === void 0 ? void 0 : _p.id) || '') && ((_r = (_q = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _q === void 0 ? void 0 : _q.start) === null || _r === void 0 ? void 0 : _r.allowsIncoming) && __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canStartFromType(((_t = (_s = port.getNode()) === null || _s === void 0 ? void 0 : _s.type) === null || _t === void 0 ? void 0 : _t.id) || '') && port.allowsOutgoing) {
10151
+ const addConnectionAction = new AddConnectionAction(this, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type, port.id, (_u = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _u === void 0 ? void 0 : _u.id);
10152
+ // clean up the previous unfinished connection
10153
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
10154
+ addConnectionAction.do();
10155
+ this.actionStack.add(addConnectionAction);
10156
+ } else {
10157
+ if (this.inferConnectionType) {
10158
+ let differentConnectionType = this.model.connections.types.all().find(t => {
10159
+ var _b, _c, _d, _e, _f, _g, _h, _j;
10160
+ return t.canStartFromType(((_e = (_d = (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.getNode()) === null || _d === void 0 ? void 0 : _d.type) === null || _e === void 0 ? void 0 : _e.id) || '') && ((_g = (_f = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _f === void 0 ? void 0 : _f.start) === null || _g === void 0 ? void 0 : _g.allowsOutgoing) && t.canFinishOnType(((_j = (_h = port.getNode()) === null || _h === void 0 ? void 0 : _h.type) === null || _j === void 0 ? void 0 : _j.id) || '') && port.allowsIncoming;
10161
+ });
10162
+ let invertConnection = false;
10163
+ if (differentConnectionType === undefined) {
10164
+ differentConnectionType = this.model.connections.types.all().find(t => {
10165
+ var _b, _c, _d, _e, _f, _g, _h, _j;
10166
+ return t.canFinishOnType(((_e = (_d = (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.getNode()) === null || _d === void 0 ? void 0 : _d.type) === null || _e === void 0 ? void 0 : _e.id) || '') && ((_g = (_f = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _f === void 0 ? void 0 : _f.start) === null || _g === void 0 ? void 0 : _g.allowsIncoming) && t.canStartFromType(((_j = (_h = port.getNode()) === null || _h === void 0 ? void 0 : _h.type) === null || _j === void 0 ? void 0 : _j.id) || '') && port.allowsOutgoing;
10167
+ });
10168
+ invertConnection = true;
10169
+ }
10170
+ if (differentConnectionType !== undefined) {
10171
+ const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_v = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _v === void 0 ? void 0 : _v.id, invertConnection ? (_w = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _w === void 0 ? void 0 : _w.id : port.id);
10172
+ // clean up the previous unfinished connection
10173
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
10174
+ addConnectionAction.do();
10175
+ this.actionStack.add(addConnectionAction);
10176
+ } else {
10177
+ // error: connection target of wrong type and no allowed type can be found
10178
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
10179
+ }
10203
10180
  } else {
10204
- newTextString = textString.slice(0, -1) + '...';
10205
- }
10206
- if (textSelection) {
10207
- this.setFieldText(field, textSelection, newTextString);
10208
- }
10209
- if (newTextString === '...') {
10210
- // if no more characters can be removed and the new text is a bare ellipsis, stop the execution
10211
- return;
10181
+ // error: connection target of wrong type and can't guess for a different type
10182
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
10183
+ }
10184
+ }
10185
+ }
10186
+ }, _DiagramCanvas_dropConnection = function _DiagramCanvas_dropConnection() {
10187
+ var _b, _c, _d, _e;
10188
+ (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.setStart(undefined);
10189
+ (_c = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _c === void 0 ? void 0 : _c.setEnd(undefined);
10190
+ (_e = (_d = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _d === void 0 ? void 0 : _d.select()) === null || _e === void 0 ? void 0 : _e.remove();
10191
+ __classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnection, undefined, "f");
10192
+ __classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionPort, undefined, "f");
10193
+ }, _DiagramCanvas_createInputField = function _DiagramCanvas_createInputField(text, coords, width, height, fontSize, fontFamily, orientation, multiline, changeCallback, finishCallback) {
10194
+ // if we have a text input open, close it before creating a new one
10195
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
10196
+ const inputFieldContainer = this.selectCanvasElements().append('foreignObject').attr('x', `${coords[0]}px`).attr('y', `${coords[1]}px`).attr('width', `${width}px`).attr('height', `${height}px`).style('box-sizing', 'border-box').style('border', '1px solid');
10197
+ __classPrivateFieldSet(this, _DiagramCanvas_inputFieldContainer, inputFieldContainer, "f");
10198
+ const inputField = inputFieldContainer.append('xhtml:textarea');
10199
+ let inputFieldWidth;
10200
+ let inputFieldHeight;
10201
+ inputField.text(text).style('box-sizing', 'border-box').style('width', `${width}px`).style('height', `${height}px`).style('font-size', `${fontSize}px`).style('font-family', fontFamily).style('resize', 'none').style('outline', 0).style('border', 0).style('margin', 0).style('padding', 0).on(exports.Events.KeyDown, event => {
10202
+ event.stopPropagation();
10203
+ if (event.key === exports.Keys.Escape || event.key === exports.Keys.Enter && !multiline) {
10204
+ const value = inputField.property('value') || '';
10205
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
10206
+ if (finishCallback) {
10207
+ finishCallback(value);
10212
10208
  }
10213
- minimumSize = this.minimumSizeOfField(field);
10214
10209
  }
10215
- }
10216
- setFieldText(field, textSelection, text) {
10217
- const lines = text.split('\n');
10218
- textSelection.html('');
10219
- for (let i = 0; i < lines.length; ++i) {
10220
- textSelection.append('tspan').attr('x', field.horizontalAlign === exports.HorizontalAlign.Center ? field.width / 2 : field.horizontalAlign === exports.HorizontalAlign.Right ? field.width : 0).attr('y', field.verticalAlign === exports.VerticalAlign.Center ? (i + 0.5 - lines.length / 2) * (field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) + field.height / 2 : field.verticalAlign === exports.VerticalAlign.Bottom ? field.height - (lines.length - i - 1) * (field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) : i * (field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize)).text(lines[i]);
10210
+ }).on(exports.Events.KeyUp, event => {
10211
+ event.stopPropagation();
10212
+ }).on(exports.Events.Input, () => {
10213
+ const value = inputField.property('value');
10214
+ inputField.attr('cols', numberOfColumns(value) + 1);
10215
+ inputField.attr('rows', numberOfRows(value) + 1);
10216
+ // reset width and height so that later the scrollWidth and scrollHeight are fit to the size of the text
10217
+ inputField.style('width', '');
10218
+ inputField.style('height', '');
10219
+ // add one diagram unit of margin of error
10220
+ inputFieldWidth = inputField.property('scrollWidth') + 1;
10221
+ inputFieldHeight = inputField.property('scrollHeight') + 1;
10222
+ // keep the field from shrinking below its original size
10223
+ const newWidth = Math.max(inputFieldWidth, width);
10224
+ const newHeight = Math.max(inputFieldHeight, height);
10225
+ inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('width', `${newWidth}px`);
10226
+ inputField.style('width', `${newWidth}px`);
10227
+ inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('height', `${newHeight}px`);
10228
+ inputField.style('height', `${newHeight}px`);
10229
+ if (changeCallback) {
10230
+ changeCallback(value);
10231
+ }
10232
+ }).on(exports.Events.Click, event => {
10233
+ event.stopPropagation();
10234
+ }).on(exports.Events.FocusOut, () => {
10235
+ const value = inputField.property('value');
10236
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
10237
+ if (finishCallback) {
10238
+ finishCallback(value);
10221
10239
  }
10222
- }
10223
- /**
10224
- * Method to call to start the moving of a node triggered by a user drag event.
10225
- */
10226
- startMovingNode(event, d) {
10227
- if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && !d.removed) {
10228
- setCursorStyle(exports.CursorStyle.Grabbing);
10229
- this.draggingFrom = [event.x, event.y];
10230
- if (d.selected && this.userSelection.count(e => e instanceof DiagramNode) > 1) {
10231
- this.currentAction = new MoveAction(this, this.userSelection.filter(e => e instanceof DiagramNode).map(n => n.id), d.coords);
10232
- } else {
10233
- const ancestorOfNode = d.getLastAncestor();
10234
- this.currentAction = new SetGeometryAction(this, exports.DiagramActions.MoveNode, d.id, d.getGeometry(), d.getGeometry(), ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id, ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id), ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id));
10235
- }
10240
+ });
10241
+ const htmlInput = inputField.node();
10242
+ htmlInput.focus();
10243
+ htmlInput.select();
10244
+ }, _DiagramCanvas_removeInputField = function _DiagramCanvas_removeInputField() {
10245
+ var _b, _c, _d;
10246
+ // when removing an element, a blur event is emitted
10247
+ // we remove the listener for blur so that it does not emit again on element removal
10248
+ (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_inputFieldContainer, "f")) === null || _b === void 0 ? void 0 : _b.select('input')) === null || _c === void 0 ? void 0 : _c.on(exports.Events.Blur, null);
10249
+ (_d = __classPrivateFieldGet(this, _DiagramCanvas_inputFieldContainer, "f")) === null || _d === void 0 ? void 0 : _d.remove();
10250
+ __classPrivateFieldSet(this, _DiagramCanvas_inputFieldContainer, undefined, "f");
10251
+ }, _DiagramCanvas_minimumSizeOfField = function _DiagramCanvas_minimumSizeOfField(field) {
10252
+ var _b, _c;
10253
+ const textNode = (_c = (_b = field.select()) === null || _b === void 0 ? void 0 : _b.select('text')) === null || _c === void 0 ? void 0 : _c.node();
10254
+ if (!textNode) {
10255
+ // happens when a field has been created but not updated in view yet
10256
+ return [0, 0];
10257
+ }
10258
+ const textBoundingBox = textNode.getBoundingClientRect();
10259
+ return [textBoundingBox.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, textBoundingBox.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k];
10260
+ }, _DiagramCanvas_setFieldTextAndWrap = function _DiagramCanvas_setFieldTextAndWrap(field) {
10261
+ var _b, _c, _d, _e;
10262
+ const textSelection = (_b = field.select()) === null || _b === void 0 ? void 0 : _b.select('text');
10263
+ const textNode = textSelection === null || textSelection === void 0 ? void 0 : textSelection.node();
10264
+ if (textSelection && textNode) {
10265
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_setFieldText).call(this, field, textSelection, field.text);
10266
+ } else {
10267
+ // can happen if a field has been created but not updated in view yet
10268
+ // not sure if this still happens but should check just in case
10269
+ return;
10270
+ }
10271
+ if (field.fit) {
10272
+ // no need to wrap
10273
+ return;
10274
+ }
10275
+ let minimumSize = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
10276
+ while (minimumSize[0] > field.width || minimumSize[1] > field.height) {
10277
+ const textString = ((_e = (_d = (_c = textSelection === null || textSelection === void 0 ? void 0 : textSelection.html()) === null || _c === void 0 ? void 0 : _c.replace(/<\/tspan>/g, '\n')) === null || _d === void 0 ? void 0 : _d.replace(/<tspan[^>]*>/g, '')) === null || _e === void 0 ? void 0 : _e.slice(0, -1)) || '';
10278
+ let newTextString = '...';
10279
+ if (textString.endsWith('...')) {
10280
+ newTextString = textString.slice(0, -4) + '...';
10236
10281
  } else {
10237
- setCursorStyle(exports.CursorStyle.NotAllowed);
10282
+ newTextString = textString.slice(0, -1) + '...';
10238
10283
  }
10239
- }
10240
- /**
10241
- * Method to call to continue the moving of a node triggered by a user drag event.
10242
- */
10243
- continueMovingNode(event, d) {
10244
- if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && (this.currentAction instanceof MoveAction || this.currentAction instanceof SetGeometryAction) && !d.removed) {
10245
- const newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
10246
- if (d.selected) {
10247
- this.userSelection.move([newNodeCoords[0] - d.coords[0], newNodeCoords[1] - d.coords[1]]);
10248
- } else {
10249
- d.move(newNodeCoords);
10250
- }
10251
- this.userHighlight.clear();
10252
- this.dragging = true;
10253
- this.diagramEvent$.next(new DiagramDraggingNodeEvent(d));
10284
+ if (textSelection) {
10285
+ __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_setFieldText).call(this, field, textSelection, newTextString);
10254
10286
  }
10255
- }
10256
- /**
10257
- * Method to call to finish the moving of a node triggered by a user drag event.
10258
- */
10259
- finishMovingNode(event, d) {
10260
- var _a, _b, _c, _d;
10261
- if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && !d.removed) {
10262
- // prevent drag behavior if mouse hasn't moved
10263
- if (this.draggingFrom[0] !== event.x || this.draggingFrom[1] !== event.y) {
10264
- let newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
10265
- if ((_a = this.gridConfig) === null || _a === void 0 ? void 0 : _a.snap) {
10266
- newNodeCoords = this.getClosestGridPoint([newNodeCoords[0] - d.type.snapToGridOffset[0], newNodeCoords[1] - d.type.snapToGridOffset[1]]);
10267
- newNodeCoords[0] += d.type.snapToGridOffset[0];
10268
- newNodeCoords[1] += d.type.snapToGridOffset[1];
10269
- }
10270
- if (this.currentAction instanceof MoveAction) {
10271
- const movingFrom = this.currentAction.delta;
10272
- this.currentAction.delta = [newNodeCoords[0] - movingFrom[0], newNodeCoords[1] - movingFrom[1]];
10273
- // reset position of node prior to moving it again
10274
- if (d.selected) {
10275
- this.userSelection.move([movingFrom[0] - d.coords[0], movingFrom[1] - d.coords[1]]);
10276
- } else {
10277
- d.move(movingFrom);
10278
- }
10279
- } else if (this.currentAction instanceof SetGeometryAction) {
10280
- d.move(newNodeCoords);
10281
- // if moving a single node, we can change the node's parent,
10282
- // so we check whether we dropped this node on a potential parent
10283
- const nodesAtLocation = this.model.nodes.getAtCoordinates(event.x, event.y).filter(n => n.id !== d.id && !n.isDescendantOf(d));
10284
- // filter by which nodes can have this node as a child
10285
- const nodesAtLocationWhichCanHaveNodeAsAChild = nodesAtLocation.filter(n => n.type.childrenTypes.includes(d.type.id));
10286
- // filter by which nodes don't have descendants in this collection
10287
- const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
10288
- const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
10289
- if (droppedOn !== d.parent && (d.type.canBeParentless || droppedOn !== undefined)) {
10290
- const ancestorOfDroppedOn = droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.getLastAncestor();
10291
- const fromChildGeometry = this.currentAction.from;
10292
- const setParentAction = new SetParentAction(this, d.id, (_b = d.parent) === null || _b === void 0 ? void 0 : _b.id, droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.id, fromChildGeometry, d.getGeometry(), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.id, ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id));
10293
- (_c = d.parent) === null || _c === void 0 ? void 0 : _c.removeChild(d);
10294
- if (droppedOn !== undefined) {
10295
- droppedOn.addChild(d);
10296
- }
10297
- setParentAction.toChildGeometry = d.getGeometry(d.id);
10298
- setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id);
10299
- this.currentAction = setParentAction;
10300
- } else {
10301
- const ancestorOfNode = d === null || d === void 0 ? void 0 : d.getLastAncestor();
10302
- this.currentAction.ancestorId = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id;
10303
- this.currentAction.fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
10304
- (_d = d.parent) === null || _d === void 0 ? void 0 : _d.fitToChild(d);
10305
- this.currentAction.to = d.getGeometry(d.id);
10306
- this.currentAction.toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
10307
- }
10308
- }
10309
- if (this.currentAction !== undefined) {
10310
- this.currentAction.do();
10311
- this.actionStack.add(this.currentAction);
10312
- this.currentAction = undefined;
10313
- }
10314
- }
10287
+ if (newTextString === '...') {
10288
+ // if no more characters can be removed and the new text is a bare ellipsis, stop the execution
10289
+ return;
10315
10290
  }
10316
- setCursorStyle();
10317
- this.dragging = false;
10291
+ minimumSize = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
10318
10292
  }
10319
- startMultipleSelection(event) {
10320
- this.draggingFrom = this.getPointerLocationRelativeToCanvas(event);
10321
- // we put the multiple selection rectangle in the diagram svg element
10322
- // so it's not affected by the zoom level in the diagram elements
10323
- this.multipleSelectionContainer = this.selectSVGElement().append('rect').attr('stroke', '#0E74B6').attr('fill', 'rgba(14, 116, 182, 0.06)');
10293
+ }, _DiagramCanvas_setFieldText = function _DiagramCanvas_setFieldText(field, textSelection, text) {
10294
+ const lines = text.split('\n');
10295
+ textSelection.html('');
10296
+ for (let i = 0; i < lines.length; ++i) {
10297
+ textSelection.append('tspan').attr('x', field.horizontalAlign === exports.HorizontalAlign.Center ? field.width / 2 : field.horizontalAlign === exports.HorizontalAlign.Right ? field.width : 0).attr('y', field.verticalAlign === exports.VerticalAlign.Center ? (i + 0.5 - lines.length / 2) * (field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) + field.height / 2 : field.verticalAlign === exports.VerticalAlign.Bottom ? field.height - (lines.length - i - 1) * (field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) : i * (field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize)).text(lines[i]);
10324
10298
  }
10325
- continueMultipleSelection(event) {
10326
- var _a, _b, _c, _d;
10327
- const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
10328
- if (this.draggingFrom[0] !== pointerCoords[0] || this.draggingFrom[1] !== pointerCoords[1]) {
10329
- setCursorStyle(exports.CursorStyle.Crosshair);
10330
- // since the multiple selection rectangle is not affected by zoom,
10331
- // we compensate its coordinates based in the zoom transform to draw it
10332
- (_d = (_c = (_b = (_a = this.multipleSelectionContainer) === null || _a === void 0 ? void 0 : _a.attr('x', Math.min(this.draggingFrom[0], pointerCoords[0]) * this.zoomTransform.k + this.zoomTransform.x)) === null || _b === void 0 ? void 0 : _b.attr('y', Math.min(this.draggingFrom[1], pointerCoords[1]) * this.zoomTransform.k + this.zoomTransform.y)) === null || _c === void 0 ? void 0 : _c.attr('width', Math.abs(this.draggingFrom[0] - pointerCoords[0]) * this.zoomTransform.k)) === null || _d === void 0 ? void 0 : _d.attr('height', Math.abs(this.draggingFrom[1] - pointerCoords[1]) * this.zoomTransform.k);
10333
- this.dragging = true;
10299
+ }, _DiagramCanvas_startMovingNode = function _DiagramCanvas_startMovingNode(event, d) {
10300
+ if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && !d.removed) {
10301
+ setCursorStyle(exports.CursorStyle.Grabbing);
10302
+ __classPrivateFieldSet(this, _DiagramCanvas_draggingFrom, [event.x, event.y], "f");
10303
+ if (d.selected && this.userSelection.count(e => e instanceof DiagramNode) > 1) {
10304
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new MoveAction(this, this.userSelection.filter(e => e instanceof DiagramNode).map(n => n.id), d.coords), "f");
10305
+ } else {
10306
+ const ancestorOfNode = d.getLastAncestor();
10307
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.MoveNode, d.id, d.getGeometry(), d.getGeometry(), ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id, ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id), ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id)), "f");
10334
10308
  }
10309
+ } else {
10310
+ setCursorStyle(exports.CursorStyle.NotAllowed);
10335
10311
  }
10336
- finishMultipleSelection(event) {
10337
- var _a;
10338
- const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
10339
- (_a = this.multipleSelectionContainer) === null || _a === void 0 ? void 0 : _a.remove();
10340
- this.multipleSelectionContainer = undefined;
10341
- this.userSelection.clear();
10342
- for (const node of this.model.nodes) {
10343
- if (rectanglesIntersect([node.coords, [node.coords[0] + node.width, node.coords[1] + node.height]], [this.draggingFrom, pointerCoords])) {
10344
- this.userSelection.add(node);
10345
- }
10312
+ }, _DiagramCanvas_continueMovingNode = function _DiagramCanvas_continueMovingNode(event, d) {
10313
+ if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof MoveAction || __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction) && !d.removed) {
10314
+ const newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
10315
+ if (d.selected) {
10316
+ this.userSelection.move([newNodeCoords[0] - d.coords[0], newNodeCoords[1] - d.coords[1]]);
10317
+ } else {
10318
+ d.move(newNodeCoords);
10346
10319
  }
10347
- this.multipleSelectionOn = false;
10348
- this.diagramEvent$.next(new DiagramSelectionEvent(this.userSelection.all(), true));
10349
- setCursorStyle();
10350
- }
10351
- }
10352
- DiagramCanvas.canvasCount = 0;
10320
+ this.userHighlight.clear();
10321
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, true, "f");
10322
+ this.diagramEvent$.next(new DiagramDraggingNodeEvent(d));
10323
+ }
10324
+ }, _DiagramCanvas_finishMovingNode = function _DiagramCanvas_finishMovingNode(event, d) {
10325
+ var _b, _c, _d, _e;
10326
+ if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && !d.removed) {
10327
+ // prevent drag behavior if mouse hasn't moved
10328
+ if (__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[0] !== event.x || __classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[1] !== event.y) {
10329
+ let newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
10330
+ if ((_b = this.gridConfig) === null || _b === void 0 ? void 0 : _b.snap) {
10331
+ newNodeCoords = this.getClosestGridPoint([newNodeCoords[0] - d.type.snapToGridOffset[0], newNodeCoords[1] - d.type.snapToGridOffset[1]]);
10332
+ newNodeCoords[0] += d.type.snapToGridOffset[0];
10333
+ newNodeCoords[1] += d.type.snapToGridOffset[1];
10334
+ }
10335
+ if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof MoveAction) {
10336
+ const movingFrom = __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").delta;
10337
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").delta = [newNodeCoords[0] - movingFrom[0], newNodeCoords[1] - movingFrom[1]];
10338
+ // reset position of node prior to moving it again
10339
+ if (d.selected) {
10340
+ this.userSelection.move([movingFrom[0] - d.coords[0], movingFrom[1] - d.coords[1]]);
10341
+ } else {
10342
+ d.move(movingFrom);
10343
+ }
10344
+ } else if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction) {
10345
+ d.move(newNodeCoords);
10346
+ // if moving a single node, we can change the node's parent,
10347
+ // so we check whether we dropped this node on a potential parent
10348
+ const nodesAtLocation = this.model.nodes.getAtCoordinates(event.x, event.y).filter(n => n.id !== d.id && !n.isDescendantOf(d));
10349
+ // filter by which nodes can have this node as a child
10350
+ const nodesAtLocationWhichCanHaveNodeAsAChild = nodesAtLocation.filter(n => n.type.childrenTypes.includes(d.type.id));
10351
+ // filter by which nodes don't have descendants in this collection
10352
+ const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
10353
+ const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
10354
+ if (droppedOn !== d.parent && (d.type.canBeParentless || droppedOn !== undefined)) {
10355
+ const ancestorOfDroppedOn = droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.getLastAncestor();
10356
+ const fromChildGeometry = __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").from;
10357
+ const setParentAction = new SetParentAction(this, d.id, (_c = d.parent) === null || _c === void 0 ? void 0 : _c.id, droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.id, fromChildGeometry, d.getGeometry(), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.id, ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id));
10358
+ (_d = d.parent) === null || _d === void 0 ? void 0 : _d.removeChild(d);
10359
+ if (droppedOn !== undefined) {
10360
+ droppedOn.addChild(d);
10361
+ }
10362
+ setParentAction.toChildGeometry = d.getGeometry(d.id);
10363
+ setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id);
10364
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, setParentAction, "f");
10365
+ } else {
10366
+ const ancestorOfNode = d === null || d === void 0 ? void 0 : d.getLastAncestor();
10367
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").ancestorId = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id;
10368
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
10369
+ (_e = d.parent) === null || _e === void 0 ? void 0 : _e.fitToChild(d);
10370
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry(d.id);
10371
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
10372
+ }
10373
+ }
10374
+ if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") !== undefined) {
10375
+ __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
10376
+ this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
10377
+ __classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
10378
+ }
10379
+ }
10380
+ }
10381
+ setCursorStyle();
10382
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
10383
+ }, _DiagramCanvas_startMultipleSelection = function _DiagramCanvas_startMultipleSelection(event) {
10384
+ __classPrivateFieldSet(this, _DiagramCanvas_draggingFrom, this.getPointerLocationRelativeToCanvas(event), "f");
10385
+ // we put the multiple selection rectangle in the diagram svg element
10386
+ // so it's not affected by the zoom level in the diagram elements
10387
+ __classPrivateFieldSet(this, _DiagramCanvas_multipleSelectionContainer, this.selectSVGElement().append('rect').attr('stroke', '#0E74B6').attr('fill', 'rgba(14, 116, 182, 0.06)'), "f");
10388
+ }, _DiagramCanvas_continueMultipleSelection = function _DiagramCanvas_continueMultipleSelection(event) {
10389
+ var _b, _c, _d, _e;
10390
+ const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
10391
+ if (__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[0] !== pointerCoords[0] || __classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[1] !== pointerCoords[1]) {
10392
+ setCursorStyle(exports.CursorStyle.Crosshair);
10393
+ // since the multiple selection rectangle is not affected by zoom,
10394
+ // we compensate its coordinates based in the zoom transform to draw it
10395
+ (_e = (_d = (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_multipleSelectionContainer, "f")) === null || _b === void 0 ? void 0 : _b.attr('x', Math.min(__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[0], pointerCoords[0]) * __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x)) === null || _c === void 0 ? void 0 : _c.attr('y', Math.min(__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[1], pointerCoords[1]) * __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y)) === null || _d === void 0 ? void 0 : _d.attr('width', Math.abs(__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[0] - pointerCoords[0]) * __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k)) === null || _e === void 0 ? void 0 : _e.attr('height', Math.abs(__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[1] - pointerCoords[1]) * __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k);
10396
+ __classPrivateFieldSet(this, _DiagramCanvas_dragging, true, "f");
10397
+ }
10398
+ }, _DiagramCanvas_finishMultipleSelection = function _DiagramCanvas_finishMultipleSelection(event) {
10399
+ var _b;
10400
+ const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
10401
+ (_b = __classPrivateFieldGet(this, _DiagramCanvas_multipleSelectionContainer, "f")) === null || _b === void 0 ? void 0 : _b.remove();
10402
+ __classPrivateFieldSet(this, _DiagramCanvas_multipleSelectionContainer, undefined, "f");
10403
+ this.userSelection.clear();
10404
+ for (const node of this.model.nodes) {
10405
+ if (rectanglesIntersect([node.coords, [node.coords[0] + node.width, node.coords[1] + node.height]], [__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f"), pointerCoords])) {
10406
+ this.userSelection.add(node);
10407
+ }
10408
+ }
10409
+ this.multipleSelectionOn = false;
10410
+ this.diagramEvent$.next(new DiagramSelectionEvent(this.userSelection.all(), true));
10411
+ setCursorStyle();
10412
+ };
10413
+ _DiagramCanvas_canvasCount = {
10414
+ value: 0
10415
+ };
10353
10416
 
10417
+ var _CollabClient_instances, _CollabClient_webSocket, _CollabClient_sendQueue, _CollabClient_sessions, _CollabClient_pendingSessions, _CollabClient_onOpen, _CollabClient_onMessage, _CollabClient_onClose, _CollabClient_onError, _CollabClient_send, _CollabClient_receive, _CollabClient_startSyncing;
10354
10418
  const VERSION = '0.0.1';
10355
10419
  /**
10356
10420
  * The client that communicates with the daga-server over WebSockets.
@@ -10360,24 +10424,26 @@ const VERSION = '0.0.1';
10360
10424
  */
10361
10425
  class CollabClient {
10362
10426
  constructor(dagaServer, userId) {
10363
- this.sendQueue = [];
10427
+ _CollabClient_instances.add(this);
10428
+ _CollabClient_webSocket.set(this, void 0);
10429
+ _CollabClient_sendQueue.set(this, []);
10364
10430
  /**
10365
10431
  * Joined sessions by locator.
10366
10432
  */
10367
- this.sessions = new Map();
10433
+ _CollabClient_sessions.set(this, new Map());
10368
10434
  /**
10369
10435
  * Created but unacked sessions by refId.
10370
10436
  */
10371
- this.pendingSessions = new Map();
10437
+ _CollabClient_pendingSessions.set(this, new Map());
10372
10438
  this.dagaServer = dagaServer;
10373
10439
  this.userId = userId;
10374
10440
  this.clientId = uuid.v4();
10375
- this.ws = new WebSocket(this.dagaServer, 'esgrima');
10376
- this.ws.addEventListener('open', this.onOpen.bind(this));
10377
- this.ws.addEventListener('message', this.onMessage.bind(this));
10378
- this.ws.addEventListener('close', this.onClose.bind(this));
10379
- this.ws.addEventListener('error', this.onError.bind(this));
10380
- this.send({
10441
+ __classPrivateFieldSet(this, _CollabClient_webSocket, new WebSocket(this.dagaServer, 'esgrima'), "f");
10442
+ __classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('open', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onOpen).bind(this));
10443
+ __classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('message', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onMessage).bind(this));
10444
+ __classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('close', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onClose).bind(this));
10445
+ __classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('error', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onError).bind(this));
10446
+ __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
10381
10447
  type: 'HELO',
10382
10448
  clientId: this.clientId,
10383
10449
  userId: this.userId,
@@ -10385,86 +10451,6 @@ class CollabClient {
10385
10451
  ts: now()
10386
10452
  });
10387
10453
  }
10388
- onOpen() {
10389
- // Send queued messages.
10390
- for (const serialized of this.sendQueue) {
10391
- this.ws.send(serialized);
10392
- }
10393
- this.sendQueue = [];
10394
- }
10395
- onMessage(e) {
10396
- const serialized = e.data;
10397
- const message = JSON.parse(serialized);
10398
- this.receive(message);
10399
- }
10400
- onClose(e) {
10401
- console.error('WebSocket closed', e);
10402
- }
10403
- onError(e) {
10404
- console.error('WebSocket error', e);
10405
- }
10406
- /**
10407
- * Internal send method. Use instead of calling ws.send directly.
10408
- */
10409
- send(message) {
10410
- const serialized = JSON.stringify(message);
10411
- if (this.ws.readyState === WebSocket.OPEN) {
10412
- this.ws.send(serialized);
10413
- } else {
10414
- // Queue until after we connect.
10415
- this.sendQueue.push(serialized);
10416
- }
10417
- }
10418
- /**
10419
- * Internal receive method. Use instead of handling ws receive events directly.
10420
- */
10421
- receive(message) {
10422
- var _a, _b;
10423
- switch (message.type) {
10424
- case 'EACK':
10425
- {
10426
- const session = this.sessions.get(message.locator);
10427
- if (session === undefined) {
10428
- throw new Error(`EACK for unknown locator: "${message.locator}"`);
10429
- }
10430
- const initialModel = message.initialModel;
10431
- new DagaImporter().import(session.canvas.model, initialModel);
10432
- this.startSyncing(session);
10433
- (_a = session.joinRoomResolve) === null || _a === void 0 ? void 0 : _a.call(session);
10434
- session.joinRoomResolve = undefined;
10435
- break;
10436
- }
10437
- case 'ADD':
10438
- {
10439
- const session = this.sessions.get(message.locator);
10440
- if (session === undefined) {
10441
- throw new Error(`ADD for unknown locator: "${message.locator}"`);
10442
- }
10443
- const action = message.payload;
10444
- session.canvas.collabEngine.receive(action);
10445
- break;
10446
- }
10447
- case 'CACK':
10448
- {
10449
- const session = this.pendingSessions.get(message.refId);
10450
- if (session === undefined) {
10451
- throw new Error(`CACK for unknown refId: "${message.refId}"`);
10452
- }
10453
- session.locator = message.locator;
10454
- this.pendingSessions.delete(message.refId);
10455
- this.sessions.set(session.locator, session);
10456
- (_b = session.createRoomResolve) === null || _b === void 0 ? void 0 : _b.call(session, session.locator);
10457
- session.createRoomResolve = undefined;
10458
- // Deliver queued AddMessages now that we have a locator.
10459
- for (const message of session.addQueue) {
10460
- this.send(Object.assign(Object.assign({}, message), {
10461
- locator: session.locator
10462
- }));
10463
- }
10464
- session.addQueue = [];
10465
- }
10466
- }
10467
- }
10468
10454
  /**
10469
10455
  * Creates and joins a room. The given canvas becomes collaborative, starting
10470
10456
  * with its current model.
@@ -10479,7 +10465,7 @@ class CollabClient {
10479
10465
  canvas.collabEngine.isInRoom = true;
10480
10466
  const refId = uuid.v4();
10481
10467
  const initialModel = new DagaExporter().export(canvas.model, true);
10482
- this.send({
10468
+ __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
10483
10469
  type: 'CREA',
10484
10470
  clientId: this.clientId,
10485
10471
  userId: this.userId,
@@ -10492,10 +10478,10 @@ class CollabClient {
10492
10478
  locator: null,
10493
10479
  addQueue: []
10494
10480
  };
10495
- this.pendingSessions.set(refId, session);
10481
+ __classPrivateFieldGet(this, _CollabClient_pendingSessions, "f").set(refId, session);
10496
10482
  // We need to start queuing local AddMessages immediately, in case the user edits
10497
10483
  // the diagram while the CREA message is in-flight.
10498
- this.startSyncing(session);
10484
+ __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_startSyncing).call(this, session);
10499
10485
  return new Promise(resolve => {
10500
10486
  session.createRoomResolve = resolve;
10501
10487
  });
@@ -10514,7 +10500,7 @@ class CollabClient {
10514
10500
  throw new Error('Canvas is already in a room');
10515
10501
  }
10516
10502
  canvas.collabEngine.isInRoom = true;
10517
- this.send({
10503
+ __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
10518
10504
  type: 'ENRO',
10519
10505
  clientId: this.clientId,
10520
10506
  userId: this.userId,
@@ -10526,36 +10512,104 @@ class CollabClient {
10526
10512
  locator,
10527
10513
  addQueue: []
10528
10514
  };
10529
- this.sessions.set(locator, session);
10515
+ __classPrivateFieldGet(this, _CollabClient_sessions, "f").set(locator, session);
10530
10516
  return new Promise(resolve => {
10531
10517
  session.joinRoomResolve = resolve;
10532
10518
  });
10533
10519
  }
10534
- startSyncing(session) {
10535
- // Sync AddMessages from us to the server.
10536
- session.canvas.collabEngine.onSend = action => {
10537
- if (session.locator === null) {
10538
- // Queue until we receive the locator in the CACK message.
10539
- session.addQueue.push({
10540
- type: 'ADD',
10541
- clientId: this.clientId,
10542
- userId: this.userId,
10543
- payload: action,
10544
- ts: now()
10545
- });
10546
- } else {
10547
- this.send({
10548
- type: 'ADD',
10549
- clientId: this.clientId,
10550
- userId: this.userId,
10551
- locator: session.locator,
10552
- payload: action,
10553
- ts: now()
10554
- });
10555
- }
10556
- };
10557
- }
10558
10520
  }
10521
+ _CollabClient_webSocket = new WeakMap(), _CollabClient_sendQueue = new WeakMap(), _CollabClient_sessions = new WeakMap(), _CollabClient_pendingSessions = new WeakMap(), _CollabClient_instances = new WeakSet(), _CollabClient_onOpen = function _CollabClient_onOpen() {
10522
+ // Send queued messages.
10523
+ for (const serialized of __classPrivateFieldGet(this, _CollabClient_sendQueue, "f")) {
10524
+ __classPrivateFieldGet(this, _CollabClient_webSocket, "f").send(serialized);
10525
+ }
10526
+ __classPrivateFieldSet(this, _CollabClient_sendQueue, [], "f");
10527
+ }, _CollabClient_onMessage = function _CollabClient_onMessage(e) {
10528
+ const serialized = e.data;
10529
+ const message = JSON.parse(serialized);
10530
+ __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_receive).call(this, message);
10531
+ }, _CollabClient_onClose = function _CollabClient_onClose(e) {
10532
+ console.error('WebSocket closed', e);
10533
+ }, _CollabClient_onError = function _CollabClient_onError(e) {
10534
+ console.error('WebSocket error', e);
10535
+ }, _CollabClient_send = function _CollabClient_send(message) {
10536
+ const serialized = JSON.stringify(message);
10537
+ if (__classPrivateFieldGet(this, _CollabClient_webSocket, "f").readyState === WebSocket.OPEN) {
10538
+ __classPrivateFieldGet(this, _CollabClient_webSocket, "f").send(serialized);
10539
+ } else {
10540
+ // Queue until after we connect.
10541
+ __classPrivateFieldGet(this, _CollabClient_sendQueue, "f").push(serialized);
10542
+ }
10543
+ }, _CollabClient_receive = function _CollabClient_receive(message) {
10544
+ var _a, _b;
10545
+ switch (message.type) {
10546
+ case 'EACK':
10547
+ {
10548
+ const session = __classPrivateFieldGet(this, _CollabClient_sessions, "f").get(message.locator);
10549
+ if (session === undefined) {
10550
+ throw new Error(`EACK for unknown locator: "${message.locator}"`);
10551
+ }
10552
+ const initialModel = message.initialModel;
10553
+ new DagaImporter().import(session.canvas.model, initialModel);
10554
+ __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_startSyncing).call(this, session);
10555
+ (_a = session.joinRoomResolve) === null || _a === void 0 ? void 0 : _a.call(session);
10556
+ session.joinRoomResolve = undefined;
10557
+ break;
10558
+ }
10559
+ case 'ADD':
10560
+ {
10561
+ const session = __classPrivateFieldGet(this, _CollabClient_sessions, "f").get(message.locator);
10562
+ if (session === undefined) {
10563
+ throw new Error(`ADD for unknown locator: "${message.locator}"`);
10564
+ }
10565
+ const action = message.payload;
10566
+ session.canvas.collabEngine.receive(action);
10567
+ break;
10568
+ }
10569
+ case 'CACK':
10570
+ {
10571
+ const session = __classPrivateFieldGet(this, _CollabClient_pendingSessions, "f").get(message.refId);
10572
+ if (session === undefined) {
10573
+ throw new Error(`CACK for unknown refId: "${message.refId}"`);
10574
+ }
10575
+ session.locator = message.locator;
10576
+ __classPrivateFieldGet(this, _CollabClient_pendingSessions, "f").delete(message.refId);
10577
+ __classPrivateFieldGet(this, _CollabClient_sessions, "f").set(session.locator, session);
10578
+ (_b = session.createRoomResolve) === null || _b === void 0 ? void 0 : _b.call(session, session.locator);
10579
+ session.createRoomResolve = undefined;
10580
+ // Deliver queued AddMessages now that we have a locator.
10581
+ for (const message of session.addQueue) {
10582
+ __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, Object.assign(Object.assign({}, message), {
10583
+ locator: session.locator
10584
+ }));
10585
+ }
10586
+ session.addQueue = [];
10587
+ }
10588
+ }
10589
+ }, _CollabClient_startSyncing = function _CollabClient_startSyncing(session) {
10590
+ // Sync AddMessages from us to the server.
10591
+ session.canvas.collabEngine.onSend = action => {
10592
+ if (session.locator === null) {
10593
+ // Queue until we receive the locator in the CACK message.
10594
+ session.addQueue.push({
10595
+ type: 'ADD',
10596
+ clientId: this.clientId,
10597
+ userId: this.userId,
10598
+ payload: action,
10599
+ ts: now()
10600
+ });
10601
+ } else {
10602
+ __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
10603
+ type: 'ADD',
10604
+ clientId: this.clientId,
10605
+ userId: this.userId,
10606
+ locator: session.locator,
10607
+ payload: action,
10608
+ ts: now()
10609
+ });
10610
+ }
10611
+ };
10612
+ };
10559
10613
  /**
10560
10614
  * Returns the current timestamp for a message's ts field.
10561
10615
  */
@@ -10563,66 +10617,67 @@ function now() {
10563
10617
  return new Date().toISOString();
10564
10618
  }
10565
10619
 
10620
+ var _Grid_grid, _Grid_offsetX, _Grid_offsetY;
10566
10621
  /**
10567
10622
  * A two dimensional array of elements of the given class that can extend infinitely in any direction, both positive and negative.
10568
10623
  * @private
10569
10624
  */
10570
10625
  class Grid {
10571
10626
  constructor() {
10572
- this.grid = [[undefined]];
10573
- this.offsetX = 0;
10574
- this.offsetY = 0;
10627
+ _Grid_grid.set(this, [[undefined]]);
10628
+ _Grid_offsetX.set(this, 0);
10629
+ _Grid_offsetY.set(this, 0);
10575
10630
  }
10576
10631
  /**
10577
10632
  * Get the minimum x coordinate among the elements in the grid.
10578
10633
  */
10579
10634
  minX() {
10580
- return -this.offsetX;
10635
+ return -__classPrivateFieldGet(this, _Grid_offsetX, "f");
10581
10636
  }
10582
10637
  /**
10583
10638
  * Get the maximum x coordinate among the elements in the grid.
10584
10639
  */
10585
10640
  maxX() {
10586
- return this.width() - 1 - this.offsetX;
10641
+ return this.width() - 1 - __classPrivateFieldGet(this, _Grid_offsetX, "f");
10587
10642
  }
10588
10643
  /**
10589
10644
  * Get the minimum y coordinate among the elements in the grid.
10590
10645
  */
10591
10646
  minY() {
10592
- return -this.offsetY;
10647
+ return -__classPrivateFieldGet(this, _Grid_offsetY, "f");
10593
10648
  }
10594
10649
  /**
10595
10650
  * Get the maximum y coordinate among the elements in the grid.
10596
10651
  */
10597
10652
  maxY() {
10598
- return this.height() - 1 - this.offsetY;
10653
+ return this.height() - 1 - __classPrivateFieldGet(this, _Grid_offsetY, "f");
10599
10654
  }
10600
10655
  /**
10601
10656
  * Get the total extension of the grid along the x axis.
10602
10657
  */
10603
10658
  width() {
10604
- return this.grid[0].length;
10659
+ return __classPrivateFieldGet(this, _Grid_grid, "f")[0].length;
10605
10660
  }
10606
10661
  /**
10607
10662
  * Get the total extension of the grid along the y axis.
10608
10663
  */
10609
10664
  height() {
10610
- return this.grid.length;
10665
+ return __classPrivateFieldGet(this, _Grid_grid, "f").length;
10611
10666
  }
10612
10667
  /**
10613
10668
  * Add a new column at the start of the x axis.
10614
10669
  */
10615
10670
  addColumnLeft() {
10616
- for (const row of this.grid) {
10671
+ for (const row of __classPrivateFieldGet(this, _Grid_grid, "f")) {
10617
10672
  row.splice(0, 0, undefined);
10618
10673
  }
10619
- this.offsetX = this.offsetX + 1;
10674
+ __classPrivateFieldSet(this, _Grid_offsetX, __classPrivateFieldGet(this, _Grid_offsetX, "f") + 1, "f");
10620
10675
  }
10621
10676
  /**
10622
10677
  * Add a new column at the end of the x axis.
10623
10678
  */
10624
10679
  addColumnRight() {
10625
- for (const row of this.grid) {
10680
+ for (const row of __classPrivateFieldGet(this, _Grid_grid, "f")) {
10626
10681
  row.push(undefined);
10627
10682
  }
10628
10683
  }
@@ -10631,28 +10686,28 @@ class Grid {
10631
10686
  */
10632
10687
  addRowTop() {
10633
10688
  const newRow = [];
10634
- for (let i = 0; i < this.grid[0].length; ++i) {
10689
+ for (let i = 0; i < __classPrivateFieldGet(this, _Grid_grid, "f")[0].length; ++i) {
10635
10690
  newRow.push(undefined);
10636
10691
  }
10637
- this.grid.splice(0, 0, newRow);
10638
- this.offsetY = this.offsetY + 1;
10692
+ __classPrivateFieldGet(this, _Grid_grid, "f").splice(0, 0, newRow);
10693
+ __classPrivateFieldSet(this, _Grid_offsetY, __classPrivateFieldGet(this, _Grid_offsetY, "f") + 1, "f");
10639
10694
  }
10640
10695
  /**
10641
10696
  * Add a new row at the end of the y axis.
10642
10697
  */
10643
10698
  addRowBottom() {
10644
10699
  const newRow = [];
10645
- for (let i = 0; i < this.grid[0].length; ++i) {
10700
+ for (let i = 0; i < __classPrivateFieldGet(this, _Grid_grid, "f")[0].length; ++i) {
10646
10701
  newRow.push(undefined);
10647
10702
  }
10648
- this.grid.push(newRow);
10703
+ __classPrivateFieldGet(this, _Grid_grid, "f").push(newRow);
10649
10704
  }
10650
10705
  /**
10651
10706
  * Get the element at the given coordinates or undefined if there is no element at the given coordinates.
10652
10707
  */
10653
10708
  get(coords) {
10654
- if (this.grid[coords[1] + this.offsetY]) {
10655
- return this.grid[coords[1] + this.offsetY][coords[0] + this.offsetX];
10709
+ if (__classPrivateFieldGet(this, _Grid_grid, "f")[coords[1] + __classPrivateFieldGet(this, _Grid_offsetY, "f")]) {
10710
+ return __classPrivateFieldGet(this, _Grid_grid, "f")[coords[1] + __classPrivateFieldGet(this, _Grid_offsetY, "f")][coords[0] + __classPrivateFieldGet(this, _Grid_offsetX, "f")];
10656
10711
  }
10657
10712
  return undefined;
10658
10713
  }
@@ -10660,19 +10715,19 @@ class Grid {
10660
10715
  * Set the element at the given coordinates to the given element.
10661
10716
  */
10662
10717
  set(coords, value) {
10663
- while (coords[0] < -this.offsetX) {
10718
+ while (coords[0] < -__classPrivateFieldGet(this, _Grid_offsetX, "f")) {
10664
10719
  this.addColumnLeft();
10665
10720
  }
10666
- while (coords[0] >= this.width() - this.offsetX) {
10721
+ while (coords[0] >= this.width() - __classPrivateFieldGet(this, _Grid_offsetX, "f")) {
10667
10722
  this.addColumnRight();
10668
10723
  }
10669
- while (coords[1] < -this.offsetY) {
10724
+ while (coords[1] < -__classPrivateFieldGet(this, _Grid_offsetY, "f")) {
10670
10725
  this.addRowTop();
10671
10726
  }
10672
- while (coords[1] >= this.height() - this.offsetY) {
10727
+ while (coords[1] >= this.height() - __classPrivateFieldGet(this, _Grid_offsetY, "f")) {
10673
10728
  this.addRowBottom();
10674
10729
  }
10675
- this.grid[coords[1] + this.offsetY][coords[0] + this.offsetX] = value;
10730
+ __classPrivateFieldGet(this, _Grid_grid, "f")[coords[1] + __classPrivateFieldGet(this, _Grid_offsetY, "f")][coords[0] + __classPrivateFieldGet(this, _Grid_offsetX, "f")] = value;
10676
10731
  }
10677
10732
  /**
10678
10733
  * Get the closest coordinates to the given coordinates that are not set to an element.
@@ -10702,6 +10757,7 @@ class Grid {
10702
10757
  }
10703
10758
  }
10704
10759
  }
10760
+ _Grid_grid = new WeakMap(), _Grid_offsetX = new WeakMap(), _Grid_offsetY = new WeakMap();
10705
10761
 
10706
10762
  /**
10707
10763
  * A layout which places adjacent nodes close by, placing nodes in order according to depth first search.