bpmn-js 9.0.2 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-navigated-viewer v9.0.2
2
+ * bpmn-js - bpmn-navigated-viewer v9.1.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2022-02-23
11
+ * Date: 2022-05-18
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -58,29 +58,29 @@
58
58
  * @return {Array<?>}
59
59
  */
60
60
 
61
- var nativeToString = Object.prototype.toString;
62
- var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
63
- function isUndefined$1(obj) {
61
+ var nativeToString$2 = Object.prototype.toString;
62
+ var nativeHasOwnProperty$2 = Object.prototype.hasOwnProperty;
63
+ function isUndefined$3(obj) {
64
64
  return obj === undefined;
65
65
  }
66
66
  function isDefined(obj) {
67
67
  return obj !== undefined;
68
68
  }
69
- function isArray$1(obj) {
70
- return nativeToString.call(obj) === '[object Array]';
69
+ function isArray$3(obj) {
70
+ return nativeToString$2.call(obj) === '[object Array]';
71
71
  }
72
72
  function isObject(obj) {
73
- return nativeToString.call(obj) === '[object Object]';
73
+ return nativeToString$2.call(obj) === '[object Object]';
74
74
  }
75
75
  function isNumber(obj) {
76
- return nativeToString.call(obj) === '[object Number]';
76
+ return nativeToString$2.call(obj) === '[object Number]';
77
77
  }
78
78
  function isFunction(obj) {
79
- var tag = nativeToString.call(obj);
79
+ var tag = nativeToString$2.call(obj);
80
80
  return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object AsyncGeneratorFunction]' || tag === '[object Proxy]';
81
81
  }
82
82
  function isString(obj) {
83
- return nativeToString.call(obj) === '[object String]';
83
+ return nativeToString$2.call(obj) === '[object String]';
84
84
  }
85
85
  /**
86
86
  * Return true, if target owns a property with the given key.
@@ -91,8 +91,8 @@
91
91
  * @return {Boolean}
92
92
  */
93
93
 
94
- function has(target, key) {
95
- return nativeHasOwnProperty.call(target, key);
94
+ function has$2(target, key) {
95
+ return nativeHasOwnProperty$2.call(target, key);
96
96
  }
97
97
 
98
98
  /**
@@ -107,7 +107,7 @@
107
107
  function find(collection, matcher) {
108
108
  matcher = toMatcher(matcher);
109
109
  var match;
110
- forEach(collection, function (val, key) {
110
+ forEach$2(collection, function (val, key) {
111
111
  if (matcher(val, key)) {
112
112
  match = val;
113
113
  return false;
@@ -126,7 +126,7 @@
126
126
 
127
127
  function filter(collection, matcher) {
128
128
  var result = [];
129
- forEach(collection, function (val, key) {
129
+ forEach$2(collection, function (val, key) {
130
130
  if (matcher(val, key)) {
131
131
  result.push(val);
132
132
  }
@@ -143,17 +143,17 @@
143
143
  * @return {Object} return result that stopped the iteration
144
144
  */
145
145
 
146
- function forEach(collection, iterator) {
146
+ function forEach$2(collection, iterator) {
147
147
  var val, result;
148
148
 
149
- if (isUndefined$1(collection)) {
149
+ if (isUndefined$3(collection)) {
150
150
  return;
151
151
  }
152
152
 
153
- var convertKey = isArray$1(collection) ? toNum : identity;
153
+ var convertKey = isArray$3(collection) ? toNum$2 : identity$2;
154
154
 
155
155
  for (var key in collection) {
156
- if (has(collection, key)) {
156
+ if (has$2(collection, key)) {
157
157
  val = collection[key];
158
158
  result = iterator(val, convertKey(key));
159
159
 
@@ -174,7 +174,7 @@
174
174
  */
175
175
 
176
176
  function reduce(collection, iterator, result) {
177
- forEach(collection, function (value, idx) {
177
+ forEach$2(collection, function (value, idx) {
178
178
  result = iterator(result, value, idx);
179
179
  });
180
180
  return result;
@@ -217,9 +217,9 @@
217
217
  * @return {Array} transformed collection
218
218
  */
219
219
 
220
- function map$1(collection, fn) {
220
+ function map(collection, fn) {
221
221
  var result = [];
222
- forEach(collection, function (val, key) {
222
+ forEach$2(collection, function (val, key) {
223
223
  result.push(fn(val, key));
224
224
  });
225
225
  return result;
@@ -252,11 +252,11 @@
252
252
  };
253
253
  }
254
254
 
255
- function identity(arg) {
255
+ function identity$2(arg) {
256
256
  return arg;
257
257
  }
258
258
 
259
- function toNum(arg) {
259
+ function toNum$2(arg) {
260
260
  return Number(arg);
261
261
  }
262
262
 
@@ -338,7 +338,7 @@
338
338
  * @return {Function} bound function
339
339
  */
340
340
 
341
- function bind$2(fn, target) {
341
+ function bind(fn, target) {
342
342
  return fn.bind(target);
343
343
  }
344
344
 
@@ -388,7 +388,7 @@
388
388
  function pick(target, properties) {
389
389
  var result = {};
390
390
  var obj = Object(target);
391
- forEach(properties, function (prop) {
391
+ forEach$2(properties, function (prop) {
392
392
  if (prop in obj) {
393
393
  result[prop] = target[prop];
394
394
  }
@@ -407,7 +407,7 @@
407
407
  function omit(target, properties) {
408
408
  var result = {};
409
409
  var obj = Object(target);
410
- forEach(obj, function (prop, key) {
410
+ forEach$2(obj, function (prop, key) {
411
411
  if (properties.indexOf(key) === -1) {
412
412
  result[key] = prop;
413
413
  }
@@ -443,7 +443,7 @@
443
443
  }
444
444
  });
445
445
 
446
- eventBus.on([ 'render.getShapePath', 'render.getConnectionPath'], renderPriority, function(evt, element) {
446
+ eventBus.on([ 'render.getShapePath', 'render.getConnectionPath' ], renderPriority, function(evt, element) {
447
447
  if (self.canRender(element)) {
448
448
  if (evt.type === 'render.getShapePath') {
449
449
  return self.getShapePath(element);
@@ -516,6 +516,21 @@
516
516
  return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
517
517
  }
518
518
 
519
+
520
+ /**
521
+ * Return true if element has any of the given types.
522
+ *
523
+ * @param {djs.model.Base} element
524
+ * @param {Array<string>} types
525
+ *
526
+ * @return {boolean}
527
+ */
528
+ function isAny(element, types) {
529
+ return some(types, function(t) {
530
+ return is$1(element, t);
531
+ });
532
+ }
533
+
519
534
  /**
520
535
  * Return the business object for a given element.
521
536
  *
@@ -807,9 +822,9 @@
807
822
  return -1;
808
823
  }
809
824
 
810
- var re$1 = /\s+/;
825
+ var re$2 = /\s+/;
811
826
 
812
- var toString$1 = Object.prototype.toString;
827
+ var toString$2 = Object.prototype.toString;
813
828
 
814
829
  function defined(o) {
815
830
  return typeof o !== 'undefined';
@@ -823,11 +838,11 @@
823
838
  * @api public
824
839
  */
825
840
 
826
- function classes$1(el) {
827
- return new ClassList$1(el);
841
+ function classes$2(el) {
842
+ return new ClassList$2(el);
828
843
  }
829
844
 
830
- function ClassList$1(el) {
845
+ function ClassList$2(el) {
831
846
  if (!el || !el.nodeType) {
832
847
  throw new Error('A DOM element reference is required');
833
848
  }
@@ -843,7 +858,7 @@
843
858
  * @api public
844
859
  */
845
860
 
846
- ClassList$1.prototype.add = function(name) {
861
+ ClassList$2.prototype.add = function(name) {
847
862
 
848
863
  // classList
849
864
  if (this.list) {
@@ -877,8 +892,8 @@
877
892
  * @api public
878
893
  */
879
894
 
880
- ClassList$1.prototype.remove = function(name) {
881
- if ('[object RegExp]' === toString$1.call(name)) {
895
+ ClassList$2.prototype.remove = function(name) {
896
+ if ('[object RegExp]' === toString$2.call(name)) {
882
897
  return this.removeMatching(name);
883
898
  }
884
899
 
@@ -906,7 +921,7 @@
906
921
  * @api private
907
922
  */
908
923
 
909
- ClassList$1.prototype.removeMatching = function(re) {
924
+ ClassList$2.prototype.removeMatching = function(re) {
910
925
  var arr = this.array();
911
926
  for (var i = 0; i < arr.length; i++) {
912
927
  if (re.test(arr[i])) {
@@ -928,7 +943,7 @@
928
943
  * @api public
929
944
  */
930
945
 
931
- ClassList$1.prototype.toggle = function(name, force) {
946
+ ClassList$2.prototype.toggle = function(name, force) {
932
947
  // classList
933
948
  if (this.list) {
934
949
  if (defined(force)) {
@@ -966,10 +981,10 @@
966
981
  * @api public
967
982
  */
968
983
 
969
- ClassList$1.prototype.array = function() {
984
+ ClassList$2.prototype.array = function() {
970
985
  var className = this.el.getAttribute('class') || '';
971
986
  var str = className.replace(/^\s+|\s+$/g, '');
972
- var arr = str.split(re$1);
987
+ var arr = str.split(re$2);
973
988
  if ('' === arr[0]) {
974
989
  arr.shift();
975
990
  }
@@ -984,8 +999,8 @@
984
999
  * @api public
985
1000
  */
986
1001
 
987
- ClassList$1.prototype.has =
988
- ClassList$1.prototype.contains = function(name) {
1002
+ ClassList$2.prototype.has =
1003
+ ClassList$2.prototype.contains = function(name) {
989
1004
  return (
990
1005
  this.list ?
991
1006
  this.list.contains(name) :
@@ -993,7 +1008,7 @@
993
1008
  );
994
1009
  };
995
1010
 
996
- function remove$2(element) {
1011
+ function remove$3(element) {
997
1012
  var parent = element.parentNode;
998
1013
 
999
1014
  if (parent) {
@@ -1017,7 +1032,7 @@
1017
1032
  var child;
1018
1033
 
1019
1034
  while ((child = element.firstChild)) {
1020
- remove$2(child);
1035
+ remove$3(child);
1021
1036
  }
1022
1037
 
1023
1038
  return element;
@@ -1033,7 +1048,7 @@
1033
1048
 
1034
1049
  var SVG_START = '<svg xmlns="' + ns.svg + '"';
1035
1050
 
1036
- function parse$1(svg) {
1051
+ function parse$2(svg) {
1037
1052
 
1038
1053
  var unwrap = false;
1039
1054
 
@@ -1093,7 +1108,7 @@
1093
1108
  var element;
1094
1109
 
1095
1110
  if (name.charAt(0) === '<') {
1096
- element = parse$1(name).firstChild;
1111
+ element = parse$2(name).firstChild;
1097
1112
  element = document.importNode(element, true);
1098
1113
  } else {
1099
1114
  element = document.createElementNS(ns.svg, name);
@@ -1245,7 +1260,7 @@
1245
1260
 
1246
1261
  function set$1(element, svg) {
1247
1262
 
1248
- var parsed = parse$1(svg);
1263
+ var parsed = parse$2(svg);
1249
1264
 
1250
1265
  // clear element contents
1251
1266
  clear$1(element);
@@ -1524,34 +1539,104 @@
1524
1539
  }
1525
1540
 
1526
1541
  /**
1527
- * Set attribute `name` to `val`, or get attr `name`.
1542
+ * Flatten array, one level deep.
1528
1543
  *
1529
- * @param {Element} el
1530
- * @param {String} name
1531
- * @param {String} [val]
1532
- * @api public
1544
+ * @param {Array<?>} arr
1545
+ *
1546
+ * @return {Array<?>}
1533
1547
  */
1534
- function attr(el, name, val) {
1535
- // get
1536
- if (arguments.length == 2) {
1537
- return el.getAttribute(name);
1548
+
1549
+ var nativeToString$1 = Object.prototype.toString;
1550
+ var nativeHasOwnProperty$1 = Object.prototype.hasOwnProperty;
1551
+ function isUndefined$2(obj) {
1552
+ return obj === undefined;
1553
+ }
1554
+ function isArray$2(obj) {
1555
+ return nativeToString$1.call(obj) === '[object Array]';
1556
+ }
1557
+ /**
1558
+ * Return true, if target owns a property with the given key.
1559
+ *
1560
+ * @param {Object} target
1561
+ * @param {String} key
1562
+ *
1563
+ * @return {Boolean}
1564
+ */
1565
+
1566
+ function has$1(target, key) {
1567
+ return nativeHasOwnProperty$1.call(target, key);
1568
+ }
1569
+ /**
1570
+ * Iterate over collection; returning something
1571
+ * (non-undefined) will stop iteration.
1572
+ *
1573
+ * @param {Array|Object} collection
1574
+ * @param {Function} iterator
1575
+ *
1576
+ * @return {Object} return result that stopped the iteration
1577
+ */
1578
+
1579
+ function forEach$1(collection, iterator) {
1580
+ var val, result;
1581
+
1582
+ if (isUndefined$2(collection)) {
1583
+ return;
1538
1584
  }
1539
1585
 
1540
- // remove
1541
- if (val === null) {
1542
- return el.removeAttribute(name);
1586
+ var convertKey = isArray$2(collection) ? toNum$1 : identity$1;
1587
+
1588
+ for (var key in collection) {
1589
+ if (has$1(collection, key)) {
1590
+ val = collection[key];
1591
+ result = iterator(val, convertKey(key));
1592
+
1593
+ if (result === false) {
1594
+ return val;
1595
+ }
1596
+ }
1543
1597
  }
1598
+ }
1544
1599
 
1545
- // set
1546
- el.setAttribute(name, val);
1600
+ function identity$1(arg) {
1601
+ return arg;
1602
+ }
1547
1603
 
1548
- return el;
1604
+ function toNum$1(arg) {
1605
+ return Number(arg);
1549
1606
  }
1550
1607
 
1551
- var indexOf = [].indexOf;
1608
+ /**
1609
+ * Assigns style attributes in a style-src compliant way.
1610
+ *
1611
+ * @param {Element} element
1612
+ * @param {...Object} styleSources
1613
+ *
1614
+ * @return {Element} the element
1615
+ */
1616
+ function assign$1$1(element) {
1617
+ var target = element.style;
1552
1618
 
1553
- var indexof = function(arr, obj){
1554
- if (indexOf) return arr.indexOf(obj);
1619
+ for (var _len = arguments.length, styleSources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1620
+ styleSources[_key - 1] = arguments[_key];
1621
+ }
1622
+
1623
+ forEach$1(styleSources, function (style) {
1624
+ if (!style) {
1625
+ return;
1626
+ }
1627
+
1628
+ forEach$1(style, function (value, key) {
1629
+ target[key] = value;
1630
+ });
1631
+ });
1632
+
1633
+ return element;
1634
+ }
1635
+
1636
+ var indexOf$1 = [].indexOf;
1637
+
1638
+ var indexof$1 = function(arr, obj){
1639
+ if (indexOf$1) return arr.indexOf(obj);
1555
1640
  for (var i = 0; i < arr.length; ++i) {
1556
1641
  if (arr[i] === obj) return i;
1557
1642
  }
@@ -1568,13 +1653,13 @@
1568
1653
  * Whitespace regexp.
1569
1654
  */
1570
1655
 
1571
- var re = /\s+/;
1656
+ var re$1 = /\s+/;
1572
1657
 
1573
1658
  /**
1574
1659
  * toString reference.
1575
1660
  */
1576
1661
 
1577
- var toString = Object.prototype.toString;
1662
+ var toString$1 = Object.prototype.toString;
1578
1663
 
1579
1664
  /**
1580
1665
  * Wrap `el` in a `ClassList`.
@@ -1584,8 +1669,8 @@
1584
1669
  * @api public
1585
1670
  */
1586
1671
 
1587
- function classes(el) {
1588
- return new ClassList(el);
1672
+ function classes$1(el) {
1673
+ return new ClassList$1(el);
1589
1674
  }
1590
1675
 
1591
1676
  /**
@@ -1595,7 +1680,7 @@
1595
1680
  * @api private
1596
1681
  */
1597
1682
 
1598
- function ClassList(el) {
1683
+ function ClassList$1(el) {
1599
1684
  if (!el || !el.nodeType) {
1600
1685
  throw new Error('A DOM element reference is required');
1601
1686
  }
@@ -1611,7 +1696,7 @@
1611
1696
  * @api public
1612
1697
  */
1613
1698
 
1614
- ClassList.prototype.add = function (name) {
1699
+ ClassList$1.prototype.add = function (name) {
1615
1700
  // classList
1616
1701
  if (this.list) {
1617
1702
  this.list.add(name);
@@ -1620,7 +1705,7 @@
1620
1705
 
1621
1706
  // fallback
1622
1707
  var arr = this.array();
1623
- var i = indexof(arr, name);
1708
+ var i = indexof$1(arr, name);
1624
1709
  if (!~i) arr.push(name);
1625
1710
  this.el.className = arr.join(' ');
1626
1711
  return this;
@@ -1636,8 +1721,8 @@
1636
1721
  * @api public
1637
1722
  */
1638
1723
 
1639
- ClassList.prototype.remove = function (name) {
1640
- if ('[object RegExp]' == toString.call(name)) {
1724
+ ClassList$1.prototype.remove = function (name) {
1725
+ if ('[object RegExp]' == toString$1.call(name)) {
1641
1726
  return this.removeMatching(name);
1642
1727
  }
1643
1728
 
@@ -1649,7 +1734,7 @@
1649
1734
 
1650
1735
  // fallback
1651
1736
  var arr = this.array();
1652
- var i = indexof(arr, name);
1737
+ var i = indexof$1(arr, name);
1653
1738
  if (~i) arr.splice(i, 1);
1654
1739
  this.el.className = arr.join(' ');
1655
1740
  return this;
@@ -1663,7 +1748,7 @@
1663
1748
  * @api private
1664
1749
  */
1665
1750
 
1666
- ClassList.prototype.removeMatching = function (re) {
1751
+ ClassList$1.prototype.removeMatching = function (re) {
1667
1752
  var arr = this.array();
1668
1753
  for (var i = 0; i < arr.length; i++) {
1669
1754
  if (re.test(arr[i])) {
@@ -1685,7 +1770,7 @@
1685
1770
  * @api public
1686
1771
  */
1687
1772
 
1688
- ClassList.prototype.toggle = function (name, force) {
1773
+ ClassList$1.prototype.toggle = function (name, force) {
1689
1774
  // classList
1690
1775
  if (this.list) {
1691
1776
  if ('undefined' !== typeof force) {
@@ -1723,10 +1808,10 @@
1723
1808
  * @api public
1724
1809
  */
1725
1810
 
1726
- ClassList.prototype.array = function () {
1811
+ ClassList$1.prototype.array = function () {
1727
1812
  var className = this.el.getAttribute('class') || '';
1728
1813
  var str = className.replace(/^\s+|\s+$/g, '');
1729
- var arr = str.split(re);
1814
+ var arr = str.split(re$1);
1730
1815
  if ('' === arr[0]) arr.shift();
1731
1816
  return arr;
1732
1817
  };
@@ -1739,34 +1824,19 @@
1739
1824
  * @api public
1740
1825
  */
1741
1826
 
1742
- ClassList.prototype.has = ClassList.prototype.contains = function (name) {
1743
- return this.list ? this.list.contains(name) : !!~indexof(this.array(), name);
1827
+ ClassList$1.prototype.has = ClassList$1.prototype.contains = function (name) {
1828
+ return this.list ? this.list.contains(name) : !!~indexof$1(this.array(), name);
1744
1829
  };
1745
1830
 
1746
- /**
1747
- * Remove all children from the given element.
1748
- */
1749
- function clear(el) {
1750
-
1751
- var c;
1752
-
1753
- while (el.childNodes.length) {
1754
- c = el.childNodes[0];
1755
- el.removeChild(c);
1756
- }
1757
-
1758
- return el;
1759
- }
1760
-
1761
- var proto = typeof Element !== 'undefined' ? Element.prototype : {};
1762
- var vendor = proto.matches
1763
- || proto.matchesSelector
1764
- || proto.webkitMatchesSelector
1765
- || proto.mozMatchesSelector
1766
- || proto.msMatchesSelector
1767
- || proto.oMatchesSelector;
1831
+ var proto$1 = typeof Element !== 'undefined' ? Element.prototype : {};
1832
+ var vendor$1 = proto$1.matches
1833
+ || proto$1.matchesSelector
1834
+ || proto$1.webkitMatchesSelector
1835
+ || proto$1.mozMatchesSelector
1836
+ || proto$1.msMatchesSelector
1837
+ || proto$1.oMatchesSelector;
1768
1838
 
1769
- var matchesSelector = match;
1839
+ var matchesSelector$1 = match$1;
1770
1840
 
1771
1841
  /**
1772
1842
  * Match `el` to `selector`.
@@ -1777,9 +1847,9 @@
1777
1847
  * @api public
1778
1848
  */
1779
1849
 
1780
- function match(el, selector) {
1850
+ function match$1(el, selector) {
1781
1851
  if (!el || el.nodeType !== 1) return false;
1782
- if (vendor) return vendor.call(el, selector);
1852
+ if (vendor$1) return vendor$1.call(el, selector);
1783
1853
  var nodes = el.parentNode.querySelectorAll(selector);
1784
1854
  for (var i = 0; i < nodes.length; i++) {
1785
1855
  if (nodes[i] == el) return true;
@@ -1794,24 +1864,24 @@
1794
1864
  * @param {String} selector
1795
1865
  * @param {Boolean} checkYourSelf (optional)
1796
1866
  */
1797
- function closest (element, selector, checkYourSelf) {
1867
+ function closest$1 (element, selector, checkYourSelf) {
1798
1868
  var currentElem = checkYourSelf ? element : element.parentNode;
1799
1869
 
1800
1870
  while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
1801
1871
 
1802
- if (matchesSelector(currentElem, selector)) {
1872
+ if (matchesSelector$1(currentElem, selector)) {
1803
1873
  return currentElem;
1804
1874
  }
1805
1875
 
1806
1876
  currentElem = currentElem.parentNode;
1807
1877
  }
1808
1878
 
1809
- return matchesSelector(currentElem, selector) ? currentElem : null;
1879
+ return matchesSelector$1(currentElem, selector) ? currentElem : null;
1810
1880
  }
1811
1881
 
1812
- var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
1813
- unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
1814
- prefix$6 = bind !== 'addEventListener' ? 'on' : '';
1882
+ var bind$1$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
1883
+ unbind$2 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
1884
+ prefix$7 = bind$1$1 !== 'addEventListener' ? 'on' : '';
1815
1885
 
1816
1886
  /**
1817
1887
  * Bind `el` event `type` to `fn`.
@@ -1824,8 +1894,8 @@
1824
1894
  * @api public
1825
1895
  */
1826
1896
 
1827
- var bind_1 = function(el, type, fn, capture){
1828
- el[bind](prefix$6 + type, fn, capture || false);
1897
+ var bind_1$1 = function(el, type, fn, capture){
1898
+ el[bind$1$1](prefix$7 + type, fn, capture || false);
1829
1899
  return fn;
1830
1900
  };
1831
1901
 
@@ -1840,14 +1910,14 @@
1840
1910
  * @api public
1841
1911
  */
1842
1912
 
1843
- var unbind_1 = function(el, type, fn, capture){
1844
- el[unbind](prefix$6 + type, fn, capture || false);
1913
+ var unbind_1$1 = function(el, type, fn, capture){
1914
+ el[unbind$2](prefix$7 + type, fn, capture || false);
1845
1915
  return fn;
1846
1916
  };
1847
1917
 
1848
- var componentEvent = {
1849
- bind: bind_1,
1850
- unbind: unbind_1
1918
+ var componentEvent$1 = {
1919
+ bind: bind_1$1,
1920
+ unbind: unbind_1$1
1851
1921
  };
1852
1922
 
1853
1923
  /**
@@ -1870,16 +1940,16 @@
1870
1940
 
1871
1941
  // Some events don't bubble, so we want to bind to the capture phase instead
1872
1942
  // when delegating.
1873
- var forceCaptureEvents = ['focus', 'blur'];
1943
+ var forceCaptureEvents$1 = ['focus', 'blur'];
1874
1944
 
1875
- function bind$1(el, selector, type, fn, capture) {
1876
- if (forceCaptureEvents.indexOf(type) !== -1) {
1945
+ function bind$2$1(el, selector, type, fn, capture) {
1946
+ if (forceCaptureEvents$1.indexOf(type) !== -1) {
1877
1947
  capture = true;
1878
1948
  }
1879
1949
 
1880
- return componentEvent.bind(el, type, function (e) {
1950
+ return componentEvent$1.bind(el, type, function (e) {
1881
1951
  var target = e.target || e.srcElement;
1882
- e.delegateTarget = closest(target, selector, true);
1952
+ e.delegateTarget = closest$1(target, selector, true);
1883
1953
  if (e.delegateTarget) {
1884
1954
  fn.call(el, e);
1885
1955
  }
@@ -1895,75 +1965,75 @@
1895
1965
  * @param {Boolean} capture
1896
1966
  * @api public
1897
1967
  */
1898
- function unbind$1(el, type, fn, capture) {
1899
- if (forceCaptureEvents.indexOf(type) !== -1) {
1968
+ function unbind$1$1(el, type, fn, capture) {
1969
+ if (forceCaptureEvents$1.indexOf(type) !== -1) {
1900
1970
  capture = true;
1901
1971
  }
1902
1972
 
1903
- return componentEvent.unbind(el, type, fn, capture);
1973
+ return componentEvent$1.unbind(el, type, fn, capture);
1904
1974
  }
1905
1975
 
1906
- var delegate = {
1907
- bind: bind$1,
1908
- unbind: unbind$1
1976
+ var delegate$1 = {
1977
+ bind: bind$2$1,
1978
+ unbind: unbind$1$1
1909
1979
  };
1910
1980
 
1911
1981
  /**
1912
1982
  * Expose `parse`.
1913
1983
  */
1914
1984
 
1915
- var domify = parse;
1985
+ var domify$1 = parse$1;
1916
1986
 
1917
1987
  /**
1918
1988
  * Tests for browser support.
1919
1989
  */
1920
1990
 
1921
- var innerHTMLBug = false;
1922
- var bugTestDiv;
1991
+ var innerHTMLBug$1 = false;
1992
+ var bugTestDiv$1;
1923
1993
  if (typeof document !== 'undefined') {
1924
- bugTestDiv = document.createElement('div');
1994
+ bugTestDiv$1 = document.createElement('div');
1925
1995
  // Setup
1926
- bugTestDiv.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
1996
+ bugTestDiv$1.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
1927
1997
  // Make sure that link elements get serialized correctly by innerHTML
1928
1998
  // This requires a wrapper element in IE
1929
- innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;
1930
- bugTestDiv = undefined;
1999
+ innerHTMLBug$1 = !bugTestDiv$1.getElementsByTagName('link').length;
2000
+ bugTestDiv$1 = undefined;
1931
2001
  }
1932
2002
 
1933
2003
  /**
1934
2004
  * Wrap map from jquery.
1935
2005
  */
1936
2006
 
1937
- var map = {
2007
+ var map$1$1 = {
1938
2008
  legend: [1, '<fieldset>', '</fieldset>'],
1939
2009
  tr: [2, '<table><tbody>', '</tbody></table>'],
1940
2010
  col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
1941
2011
  // for script/link/style tags to work in IE6-8, you have to wrap
1942
2012
  // in a div with a non-whitespace character in front, ha!
1943
- _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
2013
+ _default: innerHTMLBug$1 ? [1, 'X<div>', '</div>'] : [0, '', '']
1944
2014
  };
1945
2015
 
1946
- map.td =
1947
- map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
2016
+ map$1$1.td =
2017
+ map$1$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
1948
2018
 
1949
- map.option =
1950
- map.optgroup = [1, '<select multiple="multiple">', '</select>'];
2019
+ map$1$1.option =
2020
+ map$1$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
1951
2021
 
1952
- map.thead =
1953
- map.tbody =
1954
- map.colgroup =
1955
- map.caption =
1956
- map.tfoot = [1, '<table>', '</table>'];
2022
+ map$1$1.thead =
2023
+ map$1$1.tbody =
2024
+ map$1$1.colgroup =
2025
+ map$1$1.caption =
2026
+ map$1$1.tfoot = [1, '<table>', '</table>'];
1957
2027
 
1958
- map.polyline =
1959
- map.ellipse =
1960
- map.polygon =
1961
- map.circle =
1962
- map.text =
1963
- map.line =
1964
- map.path =
1965
- map.rect =
1966
- map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
2028
+ map$1$1.polyline =
2029
+ map$1$1.ellipse =
2030
+ map$1$1.polygon =
2031
+ map$1$1.circle =
2032
+ map$1$1.text =
2033
+ map$1$1.line =
2034
+ map$1$1.path =
2035
+ map$1$1.rect =
2036
+ map$1$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
1967
2037
 
1968
2038
  /**
1969
2039
  * Parse `html` and return a DOM Node instance, which could be a TextNode,
@@ -1976,7 +2046,7 @@
1976
2046
  * @api private
1977
2047
  */
1978
2048
 
1979
- function parse(html, doc) {
2049
+ function parse$1(html, doc) {
1980
2050
  if ('string' != typeof html) throw new TypeError('String expected');
1981
2051
 
1982
2052
  // default to the global `document` object
@@ -1998,7 +2068,7 @@
1998
2068
  }
1999
2069
 
2000
2070
  // wrap map
2001
- var wrap = map[tag] || map._default;
2071
+ var wrap = map$1$1[tag] || map$1$1._default;
2002
2072
  var depth = wrap[0];
2003
2073
  var prefix = wrap[1];
2004
2074
  var suffix = wrap[2];
@@ -2020,19 +2090,13 @@
2020
2090
  return fragment;
2021
2091
  }
2022
2092
 
2023
- function query(selector, el) {
2093
+ function query$1(selector, el) {
2024
2094
  el = el || document;
2025
2095
 
2026
2096
  return el.querySelector(selector);
2027
2097
  }
2028
2098
 
2029
- function all(selector, el) {
2030
- el = el || document;
2031
-
2032
- return el.querySelectorAll(selector);
2033
- }
2034
-
2035
- function remove$1(el) {
2099
+ function remove$2(el) {
2036
2100
  el.parentNode && el.parentNode.removeChild(el);
2037
2101
  }
2038
2102
 
@@ -2304,7 +2368,7 @@
2304
2368
  orient: 'auto'
2305
2369
  });
2306
2370
 
2307
- var defs = query('defs', canvas._svg);
2371
+ var defs = query$1('defs', canvas._svg);
2308
2372
 
2309
2373
  if (!defs) {
2310
2374
  defs = create$1('defs');
@@ -2646,7 +2710,7 @@
2646
2710
 
2647
2711
  var text = textRenderer.createText(label || '', options);
2648
2712
 
2649
- classes$1(text).add('djs-label');
2713
+ classes$2(text).add('djs-label');
2650
2714
 
2651
2715
  append(parentGfx, text);
2652
2716
 
@@ -4004,7 +4068,7 @@
4004
4068
  };
4005
4069
  }
4006
4070
 
4007
- forEach(taskMarkers, function(marker) {
4071
+ forEach$2(taskMarkers, function(marker) {
4008
4072
  renderer(marker)(parentGfx, element, position);
4009
4073
  });
4010
4074
 
@@ -4297,7 +4361,8 @@
4297
4361
  id: 'helper-svg',
4298
4362
  width: 0,
4299
4363
  height: 0,
4300
- style: 'visibility: hidden; position: fixed'
4364
+ visibility: 'hidden',
4365
+ position: 'fixed'
4301
4366
  });
4302
4367
 
4303
4368
  document.body.appendChild(helperSvg);
@@ -4424,7 +4489,7 @@
4424
4489
 
4425
4490
  // layout each line taking into account that parent
4426
4491
  // shape might resize to fit text size
4427
- forEach(layouted, function(line) {
4492
+ forEach$2(layouted, function(line) {
4428
4493
 
4429
4494
  var x;
4430
4495
 
@@ -4455,7 +4520,7 @@
4455
4520
  append(textElement, tspan);
4456
4521
  });
4457
4522
 
4458
- remove$2(helperText);
4523
+ remove$3(helperText);
4459
4524
 
4460
4525
  var dimensions = {
4461
4526
  width: maxLineWidth,
@@ -5521,123 +5586,731 @@
5521
5586
 
5522
5587
 
5523
5588
  /**
5524
- * add label for an element
5589
+ * add label for an element
5590
+ */
5591
+ BpmnImporter.prototype.addLabel = function(semantic, di, element) {
5592
+ var bounds,
5593
+ text,
5594
+ label;
5595
+
5596
+ bounds = getExternalLabelBounds(di, element);
5597
+
5598
+ text = getLabel(element);
5599
+
5600
+ if (text) {
5601
+
5602
+ // get corrected bounds from actual layouted text
5603
+ bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
5604
+ }
5605
+
5606
+ label = this._elementFactory.createLabel(elementData(semantic, di, {
5607
+ id: semantic.id + '_label',
5608
+ labelTarget: element,
5609
+ type: 'label',
5610
+ hidden: element.hidden || !getLabel(element),
5611
+ x: Math.round(bounds.x),
5612
+ y: Math.round(bounds.y),
5613
+ width: Math.round(bounds.width),
5614
+ height: Math.round(bounds.height)
5615
+ }));
5616
+
5617
+ return this._canvas.addShape(label, element.parent);
5618
+ };
5619
+
5620
+ /**
5621
+ * Return the drawn connection end based on the given side.
5622
+ *
5623
+ * @throws {Error} if the end is not yet drawn
5624
+ */
5625
+ BpmnImporter.prototype._getEnd = function(semantic, side) {
5626
+
5627
+ var element,
5628
+ refSemantic,
5629
+ type = semantic.$type,
5630
+ translate = this._translate;
5631
+
5632
+ refSemantic = semantic[side + 'Ref'];
5633
+
5634
+ // handle mysterious isMany DataAssociation#sourceRef
5635
+ if (side === 'source' && type === 'bpmn:DataInputAssociation') {
5636
+ refSemantic = refSemantic && refSemantic[0];
5637
+ }
5638
+
5639
+ // fix source / target for DataInputAssociation / DataOutputAssociation
5640
+ if (side === 'source' && type === 'bpmn:DataOutputAssociation' ||
5641
+ side === 'target' && type === 'bpmn:DataInputAssociation') {
5642
+
5643
+ refSemantic = semantic.$parent;
5644
+ }
5645
+
5646
+ element = refSemantic && this._getElement(refSemantic);
5647
+
5648
+ if (element) {
5649
+ return element;
5650
+ }
5651
+
5652
+ if (refSemantic) {
5653
+ throw notYetDrawn(translate, semantic, refSemantic, side + 'Ref');
5654
+ } else {
5655
+ throw new Error(translate('{semantic}#{side} Ref not specified', {
5656
+ semantic: elementToString(semantic),
5657
+ side: side
5658
+ }));
5659
+ }
5660
+ };
5661
+
5662
+ BpmnImporter.prototype._getSource = function(semantic) {
5663
+ return this._getEnd(semantic, 'source');
5664
+ };
5665
+
5666
+ BpmnImporter.prototype._getTarget = function(semantic) {
5667
+ return this._getEnd(semantic, 'target');
5668
+ };
5669
+
5670
+
5671
+ BpmnImporter.prototype._getElement = function(semantic) {
5672
+ return this._elementRegistry.get(semantic.id);
5673
+ };
5674
+
5675
+
5676
+ // helpers ////////////////////
5677
+
5678
+ function isPointInsideBBox(bbox, point) {
5679
+ var x = point.x,
5680
+ y = point.y;
5681
+
5682
+ return x >= bbox.x &&
5683
+ x <= bbox.x + bbox.width &&
5684
+ y >= bbox.y &&
5685
+ y <= bbox.y + bbox.height;
5686
+ }
5687
+
5688
+ function isFrameElement$1(semantic) {
5689
+ return is$1(semantic, 'bpmn:Group');
5690
+ }
5691
+
5692
+ var ImportModule = {
5693
+ __depends__: [
5694
+ TranslateModule
5695
+ ],
5696
+ bpmnImporter: [ 'type', BpmnImporter ]
5697
+ };
5698
+
5699
+ var CoreModule$1 = {
5700
+ __depends__: [
5701
+ DrawModule$1,
5702
+ ImportModule
5703
+ ]
5704
+ };
5705
+
5706
+ /**
5707
+ * Flatten array, one level deep.
5708
+ *
5709
+ * @param {Array<?>} arr
5710
+ *
5711
+ * @return {Array<?>}
5712
+ */
5713
+
5714
+ var nativeToString = Object.prototype.toString;
5715
+ var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
5716
+ function isUndefined$1(obj) {
5717
+ return obj === undefined;
5718
+ }
5719
+ function isArray$1(obj) {
5720
+ return nativeToString.call(obj) === '[object Array]';
5721
+ }
5722
+ /**
5723
+ * Return true, if target owns a property with the given key.
5724
+ *
5725
+ * @param {Object} target
5726
+ * @param {String} key
5727
+ *
5728
+ * @return {Boolean}
5729
+ */
5730
+
5731
+ function has(target, key) {
5732
+ return nativeHasOwnProperty.call(target, key);
5733
+ }
5734
+ /**
5735
+ * Iterate over collection; returning something
5736
+ * (non-undefined) will stop iteration.
5737
+ *
5738
+ * @param {Array|Object} collection
5739
+ * @param {Function} iterator
5740
+ *
5741
+ * @return {Object} return result that stopped the iteration
5742
+ */
5743
+
5744
+ function forEach(collection, iterator) {
5745
+ var val, result;
5746
+
5747
+ if (isUndefined$1(collection)) {
5748
+ return;
5749
+ }
5750
+
5751
+ var convertKey = isArray$1(collection) ? toNum : identity;
5752
+
5753
+ for (var key in collection) {
5754
+ if (has(collection, key)) {
5755
+ val = collection[key];
5756
+ result = iterator(val, convertKey(key));
5757
+
5758
+ if (result === false) {
5759
+ return val;
5760
+ }
5761
+ }
5762
+ }
5763
+ }
5764
+
5765
+ function identity(arg) {
5766
+ return arg;
5767
+ }
5768
+
5769
+ function toNum(arg) {
5770
+ return Number(arg);
5771
+ }
5772
+
5773
+ /**
5774
+ * Assigns style attributes in a style-src compliant way.
5775
+ *
5776
+ * @param {Element} element
5777
+ * @param {...Object} styleSources
5778
+ *
5779
+ * @return {Element} the element
5780
+ */
5781
+ function assign$1(element) {
5782
+ var target = element.style;
5783
+
5784
+ for (var _len = arguments.length, styleSources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5785
+ styleSources[_key - 1] = arguments[_key];
5786
+ }
5787
+
5788
+ forEach(styleSources, function (style) {
5789
+ if (!style) {
5790
+ return;
5791
+ }
5792
+
5793
+ forEach(style, function (value, key) {
5794
+ target[key] = value;
5795
+ });
5796
+ });
5797
+
5798
+ return element;
5799
+ }
5800
+
5801
+ /**
5802
+ * Set attribute `name` to `val`, or get attr `name`.
5803
+ *
5804
+ * @param {Element} el
5805
+ * @param {String} name
5806
+ * @param {String} [val]
5807
+ * @api public
5808
+ */
5809
+ function attr(el, name, val) {
5810
+ // get
5811
+ if (arguments.length == 2) {
5812
+ return el.getAttribute(name);
5813
+ }
5814
+
5815
+ // remove
5816
+ if (val === null) {
5817
+ return el.removeAttribute(name);
5818
+ }
5819
+
5820
+ // set
5821
+ el.setAttribute(name, val);
5822
+
5823
+ return el;
5824
+ }
5825
+
5826
+ var indexOf = [].indexOf;
5827
+
5828
+ var indexof = function(arr, obj){
5829
+ if (indexOf) return arr.indexOf(obj);
5830
+ for (var i = 0; i < arr.length; ++i) {
5831
+ if (arr[i] === obj) return i;
5832
+ }
5833
+ return -1;
5834
+ };
5835
+
5836
+ /**
5837
+ * Taken from https://github.com/component/classes
5838
+ *
5839
+ * Without the component bits.
5840
+ */
5841
+
5842
+ /**
5843
+ * Whitespace regexp.
5844
+ */
5845
+
5846
+ var re = /\s+/;
5847
+
5848
+ /**
5849
+ * toString reference.
5850
+ */
5851
+
5852
+ var toString = Object.prototype.toString;
5853
+
5854
+ /**
5855
+ * Wrap `el` in a `ClassList`.
5856
+ *
5857
+ * @param {Element} el
5858
+ * @return {ClassList}
5859
+ * @api public
5860
+ */
5861
+
5862
+ function classes(el) {
5863
+ return new ClassList(el);
5864
+ }
5865
+
5866
+ /**
5867
+ * Initialize a new ClassList for `el`.
5868
+ *
5869
+ * @param {Element} el
5870
+ * @api private
5871
+ */
5872
+
5873
+ function ClassList(el) {
5874
+ if (!el || !el.nodeType) {
5875
+ throw new Error('A DOM element reference is required');
5876
+ }
5877
+ this.el = el;
5878
+ this.list = el.classList;
5879
+ }
5880
+
5881
+ /**
5882
+ * Add class `name` if not already present.
5883
+ *
5884
+ * @param {String} name
5885
+ * @return {ClassList}
5886
+ * @api public
5887
+ */
5888
+
5889
+ ClassList.prototype.add = function (name) {
5890
+ // classList
5891
+ if (this.list) {
5892
+ this.list.add(name);
5893
+ return this;
5894
+ }
5895
+
5896
+ // fallback
5897
+ var arr = this.array();
5898
+ var i = indexof(arr, name);
5899
+ if (!~i) arr.push(name);
5900
+ this.el.className = arr.join(' ');
5901
+ return this;
5902
+ };
5903
+
5904
+ /**
5905
+ * Remove class `name` when present, or
5906
+ * pass a regular expression to remove
5907
+ * any which match.
5908
+ *
5909
+ * @param {String|RegExp} name
5910
+ * @return {ClassList}
5911
+ * @api public
5912
+ */
5913
+
5914
+ ClassList.prototype.remove = function (name) {
5915
+ if ('[object RegExp]' == toString.call(name)) {
5916
+ return this.removeMatching(name);
5917
+ }
5918
+
5919
+ // classList
5920
+ if (this.list) {
5921
+ this.list.remove(name);
5922
+ return this;
5923
+ }
5924
+
5925
+ // fallback
5926
+ var arr = this.array();
5927
+ var i = indexof(arr, name);
5928
+ if (~i) arr.splice(i, 1);
5929
+ this.el.className = arr.join(' ');
5930
+ return this;
5931
+ };
5932
+
5933
+ /**
5934
+ * Remove all classes matching `re`.
5935
+ *
5936
+ * @param {RegExp} re
5937
+ * @return {ClassList}
5938
+ * @api private
5939
+ */
5940
+
5941
+ ClassList.prototype.removeMatching = function (re) {
5942
+ var arr = this.array();
5943
+ for (var i = 0; i < arr.length; i++) {
5944
+ if (re.test(arr[i])) {
5945
+ this.remove(arr[i]);
5946
+ }
5947
+ }
5948
+ return this;
5949
+ };
5950
+
5951
+ /**
5952
+ * Toggle class `name`, can force state via `force`.
5953
+ *
5954
+ * For browsers that support classList, but do not support `force` yet,
5955
+ * the mistake will be detected and corrected.
5956
+ *
5957
+ * @param {String} name
5958
+ * @param {Boolean} force
5959
+ * @return {ClassList}
5960
+ * @api public
5961
+ */
5962
+
5963
+ ClassList.prototype.toggle = function (name, force) {
5964
+ // classList
5965
+ if (this.list) {
5966
+ if ('undefined' !== typeof force) {
5967
+ if (force !== this.list.toggle(name, force)) {
5968
+ this.list.toggle(name); // toggle again to correct
5969
+ }
5970
+ } else {
5971
+ this.list.toggle(name);
5972
+ }
5973
+ return this;
5974
+ }
5975
+
5976
+ // fallback
5977
+ if ('undefined' !== typeof force) {
5978
+ if (!force) {
5979
+ this.remove(name);
5980
+ } else {
5981
+ this.add(name);
5982
+ }
5983
+ } else {
5984
+ if (this.has(name)) {
5985
+ this.remove(name);
5986
+ } else {
5987
+ this.add(name);
5988
+ }
5989
+ }
5990
+
5991
+ return this;
5992
+ };
5993
+
5994
+ /**
5995
+ * Return an array of classes.
5996
+ *
5997
+ * @return {Array}
5998
+ * @api public
5999
+ */
6000
+
6001
+ ClassList.prototype.array = function () {
6002
+ var className = this.el.getAttribute('class') || '';
6003
+ var str = className.replace(/^\s+|\s+$/g, '');
6004
+ var arr = str.split(re);
6005
+ if ('' === arr[0]) arr.shift();
6006
+ return arr;
6007
+ };
6008
+
6009
+ /**
6010
+ * Check if class `name` is present.
6011
+ *
6012
+ * @param {String} name
6013
+ * @return {ClassList}
6014
+ * @api public
6015
+ */
6016
+
6017
+ ClassList.prototype.has = ClassList.prototype.contains = function (name) {
6018
+ return this.list ? this.list.contains(name) : !!~indexof(this.array(), name);
6019
+ };
6020
+
6021
+ /**
6022
+ * Remove all children from the given element.
6023
+ */
6024
+ function clear(el) {
6025
+
6026
+ var c;
6027
+
6028
+ while (el.childNodes.length) {
6029
+ c = el.childNodes[0];
6030
+ el.removeChild(c);
6031
+ }
6032
+
6033
+ return el;
6034
+ }
6035
+
6036
+ var proto = typeof Element !== 'undefined' ? Element.prototype : {};
6037
+ var vendor = proto.matches
6038
+ || proto.matchesSelector
6039
+ || proto.webkitMatchesSelector
6040
+ || proto.mozMatchesSelector
6041
+ || proto.msMatchesSelector
6042
+ || proto.oMatchesSelector;
6043
+
6044
+ var matchesSelector = match;
6045
+
6046
+ /**
6047
+ * Match `el` to `selector`.
6048
+ *
6049
+ * @param {Element} el
6050
+ * @param {String} selector
6051
+ * @return {Boolean}
6052
+ * @api public
6053
+ */
6054
+
6055
+ function match(el, selector) {
6056
+ if (!el || el.nodeType !== 1) return false;
6057
+ if (vendor) return vendor.call(el, selector);
6058
+ var nodes = el.parentNode.querySelectorAll(selector);
6059
+ for (var i = 0; i < nodes.length; i++) {
6060
+ if (nodes[i] == el) return true;
6061
+ }
6062
+ return false;
6063
+ }
6064
+
6065
+ /**
6066
+ * Closest
6067
+ *
6068
+ * @param {Element} el
6069
+ * @param {String} selector
6070
+ * @param {Boolean} checkYourSelf (optional)
6071
+ */
6072
+ function closest (element, selector, checkYourSelf) {
6073
+ var currentElem = checkYourSelf ? element : element.parentNode;
6074
+
6075
+ while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
6076
+
6077
+ if (matchesSelector(currentElem, selector)) {
6078
+ return currentElem;
6079
+ }
6080
+
6081
+ currentElem = currentElem.parentNode;
6082
+ }
6083
+
6084
+ return matchesSelector(currentElem, selector) ? currentElem : null;
6085
+ }
6086
+
6087
+ var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
6088
+ unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
6089
+ prefix$6 = bind$1 !== 'addEventListener' ? 'on' : '';
6090
+
6091
+ /**
6092
+ * Bind `el` event `type` to `fn`.
6093
+ *
6094
+ * @param {Element} el
6095
+ * @param {String} type
6096
+ * @param {Function} fn
6097
+ * @param {Boolean} capture
6098
+ * @return {Function}
6099
+ * @api public
6100
+ */
6101
+
6102
+ var bind_1 = function(el, type, fn, capture){
6103
+ el[bind$1](prefix$6 + type, fn, capture || false);
6104
+ return fn;
6105
+ };
6106
+
6107
+ /**
6108
+ * Unbind `el` event `type`'s callback `fn`.
6109
+ *
6110
+ * @param {Element} el
6111
+ * @param {String} type
6112
+ * @param {Function} fn
6113
+ * @param {Boolean} capture
6114
+ * @return {Function}
6115
+ * @api public
6116
+ */
6117
+
6118
+ var unbind_1 = function(el, type, fn, capture){
6119
+ el[unbind](prefix$6 + type, fn, capture || false);
6120
+ return fn;
6121
+ };
6122
+
6123
+ var componentEvent = {
6124
+ bind: bind_1,
6125
+ unbind: unbind_1
6126
+ };
6127
+
6128
+ /**
6129
+ * Module dependencies.
6130
+ */
6131
+
6132
+ /**
6133
+ * Delegate event `type` to `selector`
6134
+ * and invoke `fn(e)`. A callback function
6135
+ * is returned which may be passed to `.unbind()`.
6136
+ *
6137
+ * @param {Element} el
6138
+ * @param {String} selector
6139
+ * @param {String} type
6140
+ * @param {Function} fn
6141
+ * @param {Boolean} capture
6142
+ * @return {Function}
6143
+ * @api public
6144
+ */
6145
+
6146
+ // Some events don't bubble, so we want to bind to the capture phase instead
6147
+ // when delegating.
6148
+ var forceCaptureEvents = ['focus', 'blur'];
6149
+
6150
+ function bind$2(el, selector, type, fn, capture) {
6151
+ if (forceCaptureEvents.indexOf(type) !== -1) {
6152
+ capture = true;
6153
+ }
6154
+
6155
+ return componentEvent.bind(el, type, function (e) {
6156
+ var target = e.target || e.srcElement;
6157
+ e.delegateTarget = closest(target, selector, true);
6158
+ if (e.delegateTarget) {
6159
+ fn.call(el, e);
6160
+ }
6161
+ }, capture);
6162
+ }
6163
+
6164
+ /**
6165
+ * Unbind event `type`'s callback `fn`.
6166
+ *
6167
+ * @param {Element} el
6168
+ * @param {String} type
6169
+ * @param {Function} fn
6170
+ * @param {Boolean} capture
6171
+ * @api public
6172
+ */
6173
+ function unbind$1(el, type, fn, capture) {
6174
+ if (forceCaptureEvents.indexOf(type) !== -1) {
6175
+ capture = true;
6176
+ }
6177
+
6178
+ return componentEvent.unbind(el, type, fn, capture);
6179
+ }
6180
+
6181
+ var delegate = {
6182
+ bind: bind$2,
6183
+ unbind: unbind$1
6184
+ };
6185
+
6186
+ /**
6187
+ * Expose `parse`.
6188
+ */
6189
+
6190
+ var domify = parse;
6191
+
6192
+ /**
6193
+ * Tests for browser support.
5525
6194
  */
5526
- BpmnImporter.prototype.addLabel = function(semantic, di, element) {
5527
- var bounds,
5528
- text,
5529
- label;
5530
6195
 
5531
- bounds = getExternalLabelBounds(di, element);
6196
+ var innerHTMLBug = false;
6197
+ var bugTestDiv;
6198
+ if (typeof document !== 'undefined') {
6199
+ bugTestDiv = document.createElement('div');
6200
+ // Setup
6201
+ bugTestDiv.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
6202
+ // Make sure that link elements get serialized correctly by innerHTML
6203
+ // This requires a wrapper element in IE
6204
+ innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;
6205
+ bugTestDiv = undefined;
6206
+ }
5532
6207
 
5533
- text = getLabel(element);
6208
+ /**
6209
+ * Wrap map from jquery.
6210
+ */
5534
6211
 
5535
- if (text) {
6212
+ var map$1 = {
6213
+ legend: [1, '<fieldset>', '</fieldset>'],
6214
+ tr: [2, '<table><tbody>', '</tbody></table>'],
6215
+ col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
6216
+ // for script/link/style tags to work in IE6-8, you have to wrap
6217
+ // in a div with a non-whitespace character in front, ha!
6218
+ _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
6219
+ };
5536
6220
 
5537
- // get corrected bounds from actual layouted text
5538
- bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
5539
- }
6221
+ map$1.td =
6222
+ map$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
5540
6223
 
5541
- label = this._elementFactory.createLabel(elementData(semantic, di, {
5542
- id: semantic.id + '_label',
5543
- labelTarget: element,
5544
- type: 'label',
5545
- hidden: element.hidden || !getLabel(element),
5546
- x: Math.round(bounds.x),
5547
- y: Math.round(bounds.y),
5548
- width: Math.round(bounds.width),
5549
- height: Math.round(bounds.height)
5550
- }));
6224
+ map$1.option =
6225
+ map$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
5551
6226
 
5552
- return this._canvas.addShape(label, element.parent);
5553
- };
6227
+ map$1.thead =
6228
+ map$1.tbody =
6229
+ map$1.colgroup =
6230
+ map$1.caption =
6231
+ map$1.tfoot = [1, '<table>', '</table>'];
6232
+
6233
+ map$1.polyline =
6234
+ map$1.ellipse =
6235
+ map$1.polygon =
6236
+ map$1.circle =
6237
+ map$1.text =
6238
+ map$1.line =
6239
+ map$1.path =
6240
+ map$1.rect =
6241
+ map$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
5554
6242
 
5555
6243
  /**
5556
- * Return the drawn connection end based on the given side.
6244
+ * Parse `html` and return a DOM Node instance, which could be a TextNode,
6245
+ * HTML DOM Node of some kind (<div> for example), or a DocumentFragment
6246
+ * instance, depending on the contents of the `html` string.
5557
6247
  *
5558
- * @throws {Error} if the end is not yet drawn
6248
+ * @param {String} html - HTML string to "domify"
6249
+ * @param {Document} doc - The `document` instance to create the Node for
6250
+ * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance
6251
+ * @api private
5559
6252
  */
5560
- BpmnImporter.prototype._getEnd = function(semantic, side) {
5561
6253
 
5562
- var element,
5563
- refSemantic,
5564
- type = semantic.$type,
5565
- translate = this._translate;
6254
+ function parse(html, doc) {
6255
+ if ('string' != typeof html) throw new TypeError('String expected');
5566
6256
 
5567
- refSemantic = semantic[side + 'Ref'];
6257
+ // default to the global `document` object
6258
+ if (!doc) doc = document;
5568
6259
 
5569
- // handle mysterious isMany DataAssociation#sourceRef
5570
- if (side === 'source' && type === 'bpmn:DataInputAssociation') {
5571
- refSemantic = refSemantic && refSemantic[0];
5572
- }
6260
+ // tag name
6261
+ var m = /<([\w:]+)/.exec(html);
6262
+ if (!m) return doc.createTextNode(html);
5573
6263
 
5574
- // fix source / target for DataInputAssociation / DataOutputAssociation
5575
- if (side === 'source' && type === 'bpmn:DataOutputAssociation' ||
5576
- side === 'target' && type === 'bpmn:DataInputAssociation') {
6264
+ html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
5577
6265
 
5578
- refSemantic = semantic.$parent;
6266
+ var tag = m[1];
6267
+
6268
+ // body support
6269
+ if (tag == 'body') {
6270
+ var el = doc.createElement('html');
6271
+ el.innerHTML = html;
6272
+ return el.removeChild(el.lastChild);
5579
6273
  }
5580
6274
 
5581
- element = refSemantic && this._getElement(refSemantic);
6275
+ // wrap map
6276
+ var wrap = map$1[tag] || map$1._default;
6277
+ var depth = wrap[0];
6278
+ var prefix = wrap[1];
6279
+ var suffix = wrap[2];
6280
+ var el = doc.createElement('div');
6281
+ el.innerHTML = prefix + html + suffix;
6282
+ while (depth--) el = el.lastChild;
5582
6283
 
5583
- if (element) {
5584
- return element;
6284
+ // one element
6285
+ if (el.firstChild == el.lastChild) {
6286
+ return el.removeChild(el.firstChild);
5585
6287
  }
5586
6288
 
5587
- if (refSemantic) {
5588
- throw notYetDrawn(translate, semantic, refSemantic, side + 'Ref');
5589
- } else {
5590
- throw new Error(translate('{semantic}#{side} Ref not specified', {
5591
- semantic: elementToString(semantic),
5592
- side: side
5593
- }));
6289
+ // several elements
6290
+ var fragment = doc.createDocumentFragment();
6291
+ while (el.firstChild) {
6292
+ fragment.appendChild(el.removeChild(el.firstChild));
5594
6293
  }
5595
- };
5596
6294
 
5597
- BpmnImporter.prototype._getSource = function(semantic) {
5598
- return this._getEnd(semantic, 'source');
5599
- };
5600
-
5601
- BpmnImporter.prototype._getTarget = function(semantic) {
5602
- return this._getEnd(semantic, 'target');
5603
- };
5604
-
5605
-
5606
- BpmnImporter.prototype._getElement = function(semantic) {
5607
- return this._elementRegistry.get(semantic.id);
5608
- };
6295
+ return fragment;
6296
+ }
5609
6297
 
6298
+ function query(selector, el) {
6299
+ el = el || document;
5610
6300
 
5611
- // helpers ////////////////////
6301
+ return el.querySelector(selector);
6302
+ }
5612
6303
 
5613
- function isPointInsideBBox(bbox, point) {
5614
- var x = point.x,
5615
- y = point.y;
6304
+ function all(selector, el) {
6305
+ el = el || document;
5616
6306
 
5617
- return x >= bbox.x &&
5618
- x <= bbox.x + bbox.width &&
5619
- y >= bbox.y &&
5620
- y <= bbox.y + bbox.height;
6307
+ return el.querySelectorAll(selector);
5621
6308
  }
5622
6309
 
5623
- function isFrameElement$1(semantic) {
5624
- return is$1(semantic, 'bpmn:Group');
6310
+ function remove$1(el) {
6311
+ el.parentNode && el.parentNode.removeChild(el);
5625
6312
  }
5626
6313
 
5627
- var ImportModule = {
5628
- __depends__: [
5629
- TranslateModule
5630
- ],
5631
- bpmnImporter: [ 'type', BpmnImporter ]
5632
- };
5633
-
5634
- var CoreModule$1 = {
5635
- __depends__: [
5636
- DrawModule$1,
5637
- ImportModule
5638
- ]
5639
- };
5640
-
5641
6314
  function getOriginal(event) {
5642
6315
  return event.originalEvent || event.srcEvent;
5643
6316
  }
@@ -5867,13 +6540,13 @@
5867
6540
  }
5868
6541
 
5869
6542
  function registerEvents(svg) {
5870
- forEach(bindings, function(val, key) {
6543
+ forEach$2(bindings, function(val, key) {
5871
6544
  registerEvent(svg, key, val);
5872
6545
  });
5873
6546
  }
5874
6547
 
5875
6548
  function unregisterEvents(svg) {
5876
- forEach(bindings, function(val, key) {
6549
+ forEach$2(bindings, function(val, key) {
5877
6550
  unregisterEvent(svg, key, val);
5878
6551
  });
5879
6552
  }
@@ -5933,10 +6606,13 @@
5933
6606
 
5934
6607
  var ALL_HIT_STYLE = createHitStyle('djs-hit djs-hit-all');
5935
6608
 
6609
+ var NO_MOVE_HIT_STYLE = createHitStyle('djs-hit djs-hit-no-move');
6610
+
5936
6611
  var HIT_TYPES = {
5937
6612
  'all': ALL_HIT_STYLE,
5938
6613
  'click-stroke': CLICK_STROKE_HIT_STYLE,
5939
- 'stroke': STROKE_HIT_STYLE
6614
+ 'stroke': STROKE_HIT_STYLE,
6615
+ 'no-move': NO_MOVE_HIT_STYLE
5940
6616
  };
5941
6617
 
5942
6618
  function createHitStyle(classNames, attrs) {
@@ -5980,7 +6656,7 @@
5980
6656
  this.removeHits = function(gfx) {
5981
6657
  var hits = all('.djs-hit', gfx);
5982
6658
 
5983
- forEach(hits, remove$2);
6659
+ forEach$2(hits, remove$3);
5984
6660
  };
5985
6661
 
5986
6662
  /**
@@ -6194,8 +6870,8 @@
6194
6870
  function getBBox(elements, stopRecursion) {
6195
6871
 
6196
6872
  stopRecursion = !!stopRecursion;
6197
- if (!isArray$1(elements)) {
6198
- elements = [elements];
6873
+ if (!isArray$3(elements)) {
6874
+ elements = [ elements ];
6199
6875
  }
6200
6876
 
6201
6877
  var minX,
@@ -6203,7 +6879,7 @@
6203
6879
  maxX,
6204
6880
  maxY;
6205
6881
 
6206
- forEach(elements, function(element) {
6882
+ forEach$2(elements, function(element) {
6207
6883
 
6208
6884
  // If element is a connection the bbox must be computed first
6209
6885
  var bbox = element;
@@ -6364,7 +7040,7 @@
6364
7040
  };
6365
7041
 
6366
7042
 
6367
- Outline.$inject = ['eventBus', 'styles', 'elementRegistry'];
7043
+ Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
6368
7044
 
6369
7045
  var OutlineModule = {
6370
7046
  __init__: [ 'outline' ],
@@ -6440,7 +7116,7 @@
6440
7116
  var selectedElements = this._selectedElements,
6441
7117
  oldSelection = selectedElements.slice();
6442
7118
 
6443
- if (!isArray$1(elements)) {
7119
+ if (!isArray$3(elements)) {
6444
7120
  elements = elements ? [ elements ] : [];
6445
7121
  }
6446
7122
 
@@ -6457,7 +7133,7 @@
6457
7133
  // selection may be cleared by passing an empty array or null
6458
7134
  // to the method
6459
7135
  if (add) {
6460
- forEach(elements, function(element) {
7136
+ forEach$2(elements, function(element) {
6461
7137
  if (selectedElements.indexOf(element) !== -1) {
6462
7138
 
6463
7139
  // already selected
@@ -6522,13 +7198,13 @@
6522
7198
  var oldSelection = event.oldSelection,
6523
7199
  newSelection = event.newSelection;
6524
7200
 
6525
- forEach(oldSelection, function(e) {
7201
+ forEach$2(oldSelection, function(e) {
6526
7202
  if (newSelection.indexOf(e) === -1) {
6527
7203
  deselect(e);
6528
7204
  }
6529
7205
  });
6530
7206
 
6531
- forEach(newSelection, function(e) {
7207
+ forEach$2(newSelection, function(e) {
6532
7208
  if (oldSelection.indexOf(e) === -1) {
6533
7209
  select(e);
6534
7210
  }
@@ -6560,7 +7236,7 @@
6560
7236
  return;
6561
7237
  }
6562
7238
 
6563
- if (isArray$1(autoSelect)) {
7239
+ if (isArray$3(autoSelect)) {
6564
7240
  selection.select(autoSelect);
6565
7241
  } else {
6566
7242
 
@@ -6928,13 +7604,13 @@
6928
7604
 
6929
7605
  var overlays = this.get(filter) || [];
6930
7606
 
6931
- if (!isArray$1(overlays)) {
7607
+ if (!isArray$3(overlays)) {
6932
7608
  overlays = [ overlays ];
6933
7609
  }
6934
7610
 
6935
7611
  var self = this;
6936
7612
 
6937
- forEach(overlays, function(overlay) {
7613
+ forEach$2(overlays, function(overlay) {
6938
7614
 
6939
7615
  var container = self._getOverlayContainer(overlay.element, true);
6940
7616
 
@@ -7043,7 +7719,8 @@
7043
7719
 
7044
7720
 
7045
7721
  Overlays.prototype._createOverlayContainer = function(element) {
7046
- var html = domify('<div class="djs-overlays" style="position: absolute" />');
7722
+ var html = domify('<div class="djs-overlays" />');
7723
+ assign$1(html, { position: 'absolute' });
7047
7724
 
7048
7725
  this._overlayRoot.appendChild(html);
7049
7726
 
@@ -7114,7 +7791,8 @@
7114
7791
 
7115
7792
  overlayContainer = this._getOverlayContainer(element);
7116
7793
 
7117
- htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '" style="position: absolute">');
7794
+ htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '">');
7795
+ assign$1(htmlContainer, { position: 'absolute' });
7118
7796
 
7119
7797
  htmlContainer.appendChild(html);
7120
7798
 
@@ -7204,7 +7882,7 @@
7204
7882
 
7205
7883
  var self = this;
7206
7884
 
7207
- forEach(this._overlays, function(overlay) {
7885
+ forEach$2(this._overlays, function(overlay) {
7208
7886
  self._updateOverlayVisibilty(overlay, viewbox);
7209
7887
  });
7210
7888
  };
@@ -7241,7 +7919,7 @@
7241
7919
  var element = e.element;
7242
7920
  var overlays = self.get({ element: element });
7243
7921
 
7244
- forEach(overlays, function(o) {
7922
+ forEach$2(overlays, function(o) {
7245
7923
  self.remove(o.id);
7246
7924
  });
7247
7925
 
@@ -7265,7 +7943,7 @@
7265
7943
  var container = self._getOverlayContainer(element, true);
7266
7944
 
7267
7945
  if (container) {
7268
- forEach(container.overlays, function(overlay) {
7946
+ forEach$2(container.overlays, function(overlay) {
7269
7947
  self._updateOverlay(overlay);
7270
7948
  });
7271
7949
 
@@ -7299,16 +7977,22 @@
7299
7977
 
7300
7978
  function createRoot(parentNode) {
7301
7979
  var root = domify(
7302
- '<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'
7980
+ '<div class="djs-overlay-container" />'
7303
7981
  );
7304
7982
 
7983
+ assign$1(root, {
7984
+ position: 'absolute',
7985
+ width: 0,
7986
+ height: 0
7987
+ });
7988
+
7305
7989
  parentNode.insertBefore(root, parentNode.firstChild);
7306
7990
 
7307
7991
  return root;
7308
7992
  }
7309
7993
 
7310
7994
  function setPosition(el, x, y) {
7311
- assign(el.style, { left: x + 'px', top: y + 'px' });
7995
+ assign$1(el, { left: x + 'px', top: y + 'px' });
7312
7996
  }
7313
7997
 
7314
7998
  function setVisible(el, visible) {
@@ -7394,7 +8078,7 @@
7394
8078
  ];
7395
8079
 
7396
8080
  var ChangeSupportModule = {
7397
- __init__: [ 'changeSupport'],
8081
+ __init__: [ 'changeSupport' ],
7398
8082
  changeSupport: [ 'type', ChangeSupport ]
7399
8083
  };
7400
8084
 
@@ -7472,13 +8156,13 @@
7472
8156
  throw new Error('handlerFn must be a function');
7473
8157
  }
7474
8158
 
7475
- if (!isArray$1(events)) {
8159
+ if (!isArray$3(events)) {
7476
8160
  events = [ events ];
7477
8161
  }
7478
8162
 
7479
8163
  var eventBus = this._eventBus;
7480
8164
 
7481
- forEach(events, function(event) {
8165
+ forEach$2(events, function(event) {
7482
8166
 
7483
8167
  // concat commandStack(.event)?(.hook)?
7484
8168
  var fullEvent = [ 'commandStack', event, hook ].filter(function(e) { return e; }).join('.');
@@ -7506,7 +8190,7 @@
7506
8190
  * This will generate the CommandInterceptor#(preExecute|...|reverted) methods
7507
8191
  * which will in term forward to CommandInterceptor#on.
7508
8192
  */
7509
- forEach(hooks, function(hook) {
8193
+ forEach$2(hooks, function(hook) {
7510
8194
 
7511
8195
  /**
7512
8196
  * {canExecute|preExecute|preExecuted|execute|executed|postExecute|postExecuted|revert|reverted}
@@ -7566,7 +8250,7 @@
7566
8250
 
7567
8251
  inherits$1(RootElementsBehavior, CommandInterceptor);
7568
8252
 
7569
- RootElementsBehavior.$inject = [ 'canvas', 'injector'];
8253
+ RootElementsBehavior.$inject = [ 'canvas', 'injector' ];
7570
8254
 
7571
8255
  var RootElementsModule = {
7572
8256
  __init__: [ 'rootElementsBehavior' ],
@@ -7730,9 +8414,9 @@
7730
8414
  * @param {canvas} canvas
7731
8415
  */
7732
8416
  function DrilldownBreadcrumbs(eventBus, elementRegistry, overlays, canvas) {
7733
- var breadcrumbs = domify('<ul class="bjs-breadcrumbs"></ul>');
8417
+ var breadcrumbs = domify$1('<ul class="bjs-breadcrumbs"></ul>');
7734
8418
  var container = canvas.getContainer();
7735
- var containerClasses = classes(container);
8419
+ var containerClasses = classes$1(container);
7736
8420
  container.appendChild(breadcrumbs);
7737
8421
 
7738
8422
  var boParents = [];
@@ -7766,7 +8450,7 @@
7766
8450
 
7767
8451
  var path = boParents.map(function(parent) {
7768
8452
  var title = escapeHTML(parent.name || parent.id);
7769
- var link = domify('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
8453
+ var link = domify$1('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
7770
8454
 
7771
8455
  var parentPlane = canvas.findRoot(getPlaneIdFromShape(parent)) || canvas.findRoot(parent.id);
7772
8456
 
@@ -8026,7 +8710,7 @@
8026
8710
  collapsedElements.push(bo);
8027
8711
  }
8028
8712
 
8029
- if (is$1(parent, 'bpmn:SubProcess') && parent !== plane.bpmnElement) {
8713
+ if (shouldMoveToPlane(bo, plane)) {
8030
8714
 
8031
8715
  // don't change the array while we iterate over it
8032
8716
  elementsToMove.push({ diElement: diElement, parent: parent });
@@ -8115,7 +8799,7 @@
8115
8799
  SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
8116
8800
 
8117
8801
 
8118
- // helpers
8802
+ // helpers //////////////////////////
8119
8803
 
8120
8804
  function findRootDiagram(element) {
8121
8805
  if (is$1(element, 'bpmndi:BPMNDiagram')) {
@@ -8147,6 +8831,23 @@
8147
8831
  return asBounds(planeTrbl);
8148
8832
  }
8149
8833
 
8834
+ function shouldMoveToPlane(bo, plane) {
8835
+ var parent = bo.$parent;
8836
+
8837
+ // don't move elements that are already on the plane
8838
+ if (!is$1(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
8839
+ return false;
8840
+ }
8841
+
8842
+ // dataAssociations are children of the subprocess but rendered on process level
8843
+ // cf. https://github.com/bpmn-io/bpmn-js/issues/1619
8844
+ if (isAny(bo, ['bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation'])) {
8845
+ return false;
8846
+ }
8847
+
8848
+ return true;
8849
+ }
8850
+
8150
8851
  var LOW_PRIORITY$1 = 250;
8151
8852
  var ARROW_DOWN_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>';
8152
8853
 
@@ -8222,7 +8923,7 @@
8222
8923
  }, true);
8223
8924
 
8224
8925
 
8225
- eventBus.on('import.done', function() {
8926
+ eventBus.on('import.render.complete', function() {
8226
8927
  elementRegistry.filter(function(e) {
8227
8928
  return self.canDrillDown(e);
8228
8929
  }).map(function(el) {
@@ -8271,7 +8972,7 @@
8271
8972
  }
8272
8973
 
8273
8974
  var hasContent = bo && bo.flowElements && bo.flowElements.length;
8274
- classes(overlay.html).toggle(EMPTY_MARKER, !hasContent);
8975
+ classes$1(overlay.html).toggle(EMPTY_MARKER, !hasContent);
8275
8976
  };
8276
8977
 
8277
8978
  /**
@@ -8289,7 +8990,7 @@
8289
8990
  this.removeOverlay(element);
8290
8991
  }
8291
8992
 
8292
- var button = domify('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
8993
+ var button = domify$1('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
8293
8994
 
8294
8995
  button.addEventListener('click', function() {
8295
8996
  canvas.setRootElement(canvas.findRoot(getPlaneIdFromShape(element)));
@@ -8730,11 +9431,11 @@
8730
9431
  height = shape.height;
8731
9432
 
8732
9433
  var shapePath = [
8733
- ['M', x, y],
8734
- ['l', width, 0],
8735
- ['l', 0, height],
8736
- ['l', -width, 0],
8737
- ['z']
9434
+ [ 'M', x, y ],
9435
+ [ 'l', width, 0 ],
9436
+ [ 'l', 0, height ],
9437
+ [ 'l', -width, 0 ],
9438
+ [ 'z' ]
8738
9439
  ];
8739
9440
 
8740
9441
  return componentsToPath(shapePath);
@@ -8805,7 +9506,7 @@
8805
9506
  */
8806
9507
  this.style = function(traits, additionalAttrs) {
8807
9508
 
8808
- if (!isArray$1(traits) && !additionalAttrs) {
9509
+ if (!isArray$3(traits) && !additionalAttrs) {
8809
9510
  additionalAttrs = traits;
8810
9511
  traits = [];
8811
9512
  }
@@ -8818,7 +9519,7 @@
8818
9519
  };
8819
9520
 
8820
9521
  this.computeStyle = function(custom, traits, defaultStyles) {
8821
- if (!isArray$1(traits)) {
9522
+ if (!isArray$3(traits)) {
8822
9523
  defaultStyles = traits;
8823
9524
  traits = [];
8824
9525
  }
@@ -8942,7 +9643,7 @@
8942
9643
  var parent = document.createElement('div');
8943
9644
  parent.setAttribute('class', 'djs-container');
8944
9645
 
8945
- assign(parent.style, {
9646
+ assign$1(parent, {
8946
9647
  position: 'relative',
8947
9648
  overflow: 'hidden',
8948
9649
  width: ensurePx(options.width),
@@ -8956,7 +9657,7 @@
8956
9657
 
8957
9658
  function createGroup(parent, cls, childIndex) {
8958
9659
  var group = create$1('g');
8959
- classes$1(group).add(cls);
9660
+ classes$2(group).add(cls);
8960
9661
 
8961
9662
  var index = childIndex !== undefined ? childIndex : parent.childNodes.length - 1;
8962
9663
 
@@ -9044,7 +9745,7 @@
9044
9745
  // debounce canvas.viewbox.changed events
9045
9746
  // for smoother diagram interaction
9046
9747
  if (config.deferUpdate !== false) {
9047
- this._viewboxChanged = debounce(bind$2(this._viewboxChanged, this), 300);
9748
+ this._viewboxChanged = debounce(bind(this._viewboxChanged, this), 300);
9048
9749
  }
9049
9750
 
9050
9751
  eventBus.on('diagram.init', function() {
@@ -9175,6 +9876,25 @@
9175
9876
  return layer.group;
9176
9877
  };
9177
9878
 
9879
+ /**
9880
+ * For a given index, return the number of layers that have a higher index and
9881
+ * are visible.
9882
+ *
9883
+ * This is used to determine the node a layer should be inserted at.
9884
+ *
9885
+ * @param {Number} index
9886
+ * @returns {Number}
9887
+ */
9888
+ Canvas.prototype._getChildIndex = function(index) {
9889
+ return reduce(this._layers, function(childIndex, layer) {
9890
+ if (layer.visible && index >= layer.index) {
9891
+ childIndex++;
9892
+ }
9893
+
9894
+ return childIndex;
9895
+ }, 0);
9896
+ };
9897
+
9178
9898
  /**
9179
9899
  * Creates a given layer and returns it.
9180
9900
  *
@@ -9189,19 +9909,80 @@
9189
9909
  index = UTILITY_LAYER_INDEX;
9190
9910
  }
9191
9911
 
9192
- var childIndex = reduce(this._layers, function(childIndex, layer) {
9193
- if (index >= layer.index) {
9194
- childIndex++;
9195
- }
9196
-
9197
- return childIndex;
9198
- }, 0);
9912
+ var childIndex = this._getChildIndex(index);
9199
9913
 
9200
9914
  return {
9201
9915
  group: createGroup(this._viewport, 'layer-' + name, childIndex),
9202
- index: index
9916
+ index: index,
9917
+ visible: true
9203
9918
  };
9919
+ };
9920
+
9921
+
9922
+ /**
9923
+ * Shows a given layer.
9924
+ *
9925
+ * @param {String} layer
9926
+ * @returns {SVGElement}
9927
+ */
9928
+ Canvas.prototype.showLayer = function(name) {
9929
+
9930
+ if (!name) {
9931
+ throw new Error('must specify a name');
9932
+ }
9933
+
9934
+ var layer = this._layers[name];
9935
+
9936
+ if (!layer) {
9937
+ throw new Error('layer <' + name + '> does not exist');
9938
+ }
9939
+
9940
+ var viewport = this._viewport;
9941
+ var group = layer.group;
9942
+ var index = layer.index;
9943
+
9944
+ if (layer.visible) {
9945
+ return group;
9946
+ }
9947
+
9948
+ var childIndex = this._getChildIndex(index);
9949
+
9950
+ viewport.insertBefore(group, viewport.childNodes[childIndex] || null);
9951
+
9952
+ layer.visible = true;
9953
+
9954
+ return group;
9955
+ };
9956
+
9957
+ /**
9958
+ * Hides a given layer.
9959
+ *
9960
+ * @param {String} layer
9961
+ * @returns {SVGElement}
9962
+ */
9963
+ Canvas.prototype.hideLayer = function(name) {
9204
9964
 
9965
+ if (!name) {
9966
+ throw new Error('must specify a name');
9967
+ }
9968
+
9969
+ var layer = this._layers[name];
9970
+
9971
+ if (!layer) {
9972
+ throw new Error('layer <' + name + '> does not exist');
9973
+ }
9974
+
9975
+ var group = layer.group;
9976
+
9977
+ if (!layer.visible) {
9978
+ return group;
9979
+ }
9980
+
9981
+ remove$3(group);
9982
+
9983
+ layer.visible = false;
9984
+
9985
+ return group;
9205
9986
  };
9206
9987
 
9207
9988
 
@@ -9212,7 +9993,7 @@
9212
9993
  if (layer) {
9213
9994
  delete this._layers[name];
9214
9995
 
9215
- remove$2(layer.group);
9996
+ remove$3(layer.group);
9216
9997
  }
9217
9998
  };
9218
9999
 
@@ -9300,14 +10081,14 @@
9300
10081
  return;
9301
10082
  }
9302
10083
 
9303
- forEach([ container.gfx, container.secondaryGfx ], function(gfx) {
10084
+ forEach$2([ container.gfx, container.secondaryGfx ], function(gfx) {
9304
10085
  if (gfx) {
9305
10086
 
9306
10087
  // invoke either addClass or removeClass based on mode
9307
10088
  if (add) {
9308
- classes$1(gfx).add(marker);
10089
+ classes$2(gfx).add(marker);
9309
10090
  } else {
9310
- classes$1(gfx).remove(marker);
10091
+ classes$2(gfx).remove(marker);
9311
10092
  }
9312
10093
  }
9313
10094
  });
@@ -9373,7 +10154,7 @@
9373
10154
 
9374
10155
  var gfx = this.getGraphics(element);
9375
10156
 
9376
- return classes$1(gfx).has(marker);
10157
+ return classes$2(gfx).has(marker);
9377
10158
  };
9378
10159
 
9379
10160
  /**
@@ -9444,7 +10225,7 @@
9444
10225
 
9445
10226
  var layer = this.getLayer(layerName, PLANE_LAYER_INDEX);
9446
10227
 
9447
- attr$1(layer, 'display', 'none');
10228
+ this.hideLayer(layerName);
9448
10229
 
9449
10230
  this._addRoot(rootElement, layer);
9450
10231
 
@@ -9563,17 +10344,13 @@
9563
10344
 
9564
10345
  var currentRoot = this._rootElement;
9565
10346
 
9566
- var currentLayer;
9567
-
9568
10347
  if (currentRoot) {
9569
10348
 
9570
10349
  // un-associate previous root element <svg>
9571
10350
  this._elementRegistry.updateGraphics(currentRoot, null, true);
9572
10351
 
9573
10352
  // hide previous layer
9574
- currentLayer = this._findPlaneForRoot(currentRoot).layer;
9575
-
9576
- attr$1(currentLayer, 'display', 'none');
10353
+ this.hideLayer(currentRoot.layer);
9577
10354
  }
9578
10355
 
9579
10356
  if (rootElement) {
@@ -9586,7 +10363,7 @@
9586
10363
  this._elementRegistry.updateGraphics(rootElement, this._svg, true);
9587
10364
 
9588
10365
  // show root layer
9589
- attr$1(layer, 'display', null);
10366
+ this.showLayer(rootElement.layer);
9590
10367
  }
9591
10368
 
9592
10369
  this._rootElement = rootElement;
@@ -11211,7 +11988,7 @@
11211
11988
  */
11212
11989
  EventBus.prototype.on = function(events, priority, callback, that) {
11213
11990
 
11214
- events = isArray$1(events) ? events : [ events ];
11991
+ events = isArray$3(events) ? events : [ events ];
11215
11992
 
11216
11993
  if (isFunction(priority)) {
11217
11994
  that = callback;
@@ -11226,7 +12003,7 @@
11226
12003
  var actualCallback = callback;
11227
12004
 
11228
12005
  if (that) {
11229
- actualCallback = bind$2(callback, that);
12006
+ actualCallback = bind(callback, that);
11230
12007
 
11231
12008
  // make sure we remember and are able to remove
11232
12009
  // bound callbacks via {@link #off} using the original
@@ -11296,7 +12073,7 @@
11296
12073
  */
11297
12074
  EventBus.prototype.off = function(events, callback) {
11298
12075
 
11299
- events = isArray$1(events) ? events : [ events ];
12076
+ events = isArray$3(events) ? events : [ events ];
11300
12077
 
11301
12078
  var self = this;
11302
12079
 
@@ -11662,7 +12439,7 @@
11662
12439
  childrenGfx = getChildren(gfx);
11663
12440
  if (!childrenGfx) {
11664
12441
  childrenGfx = create$1('g');
11665
- classes$1(childrenGfx).add('djs-children');
12442
+ classes$2(childrenGfx).add('djs-children');
11666
12443
 
11667
12444
  append(gfx.parentNode, childrenGfx);
11668
12445
  }
@@ -11714,7 +12491,7 @@
11714
12491
  type, childrenGfx, parentIndex, isFrame
11715
12492
  ) {
11716
12493
  var outerGfx = create$1('g');
11717
- classes$1(outerGfx).add('djs-group');
12494
+ classes$2(outerGfx).add('djs-group');
11718
12495
 
11719
12496
  // insert node at position
11720
12497
  if (typeof parentIndex !== 'undefined') {
@@ -11724,18 +12501,18 @@
11724
12501
  }
11725
12502
 
11726
12503
  var gfx = create$1('g');
11727
- classes$1(gfx).add('djs-element');
11728
- classes$1(gfx).add('djs-' + type);
12504
+ classes$2(gfx).add('djs-element');
12505
+ classes$2(gfx).add('djs-' + type);
11729
12506
 
11730
12507
  if (isFrame) {
11731
- classes$1(gfx).add('djs-frame');
12508
+ classes$2(gfx).add('djs-frame');
11732
12509
  }
11733
12510
 
11734
12511
  append(outerGfx, gfx);
11735
12512
 
11736
12513
  // create visual
11737
12514
  var visual = create$1('g');
11738
- classes$1(visual).add('djs-visual');
12515
+ classes$2(visual).add('djs-visual');
11739
12516
 
11740
12517
  append(gfx, visual);
11741
12518
 
@@ -11764,7 +12541,7 @@
11764
12541
 
11765
12542
  // update all parents of changed and reorganized their children
11766
12543
  // in the correct order (as indicated in our model)
11767
- forEach(parents, function(parent) {
12544
+ forEach$2(parents, function(parent) {
11768
12545
 
11769
12546
  var children = parent.children;
11770
12547
 
@@ -11774,7 +12551,7 @@
11774
12551
 
11775
12552
  var childrenGfx = self._getChildrenContainer(parent);
11776
12553
 
11777
- forEach(children.slice().reverse(), function(child) {
12554
+ forEach$2(children.slice().reverse(), function(child) {
11778
12555
  var childGfx = elementRegistry.getGraphics(child);
11779
12556
 
11780
12557
  prependTo(childGfx.parentNode, childrenGfx);
@@ -11839,7 +12616,7 @@
11839
12616
  var gfx = this._elementRegistry.getGraphics(element);
11840
12617
 
11841
12618
  // remove
11842
- remove$2(gfx.parentNode);
12619
+ remove$3(gfx.parentNode);
11843
12620
  };
11844
12621
 
11845
12622
 
@@ -11939,7 +12716,7 @@
11939
12716
  options = options || {};
11940
12717
 
11941
12718
  var configModule = {
11942
- 'config': ['value', options]
12719
+ 'config': [ 'value', options ]
11943
12720
  };
11944
12721
 
11945
12722
  var modules = [ configModule, CoreModule ].concat(options.modules || []);
@@ -12099,7 +12876,7 @@
12099
12876
  prototype = Object.create(Base.prototype);
12100
12877
 
12101
12878
  // initialize default values
12102
- forEach(descriptor.properties, function(p) {
12879
+ forEach$2(descriptor.properties, function(p) {
12103
12880
  if (!p.isMany && p.default !== undefined) {
12104
12881
  prototype[p.name] = p.default;
12105
12882
  }
@@ -12118,7 +12895,7 @@
12118
12895
  props.define(this, '$attrs', { value: {} });
12119
12896
  props.define(this, '$parent', { writable: true });
12120
12897
 
12121
- forEach(attrs, bind$2(function(val, key) {
12898
+ forEach$2(attrs, bind(function(val, key) {
12122
12899
  this.set(key, val);
12123
12900
  }, this));
12124
12901
  }
@@ -12407,7 +13184,7 @@
12407
13184
  return;
12408
13185
  }
12409
13186
 
12410
- forEach(t.properties, bind$2(function(p) {
13187
+ forEach$2(t.properties, bind(function(p) {
12411
13188
 
12412
13189
  // clone property to allow extensions
12413
13190
  p = assign({}, p, {
@@ -12454,7 +13231,7 @@
12454
13231
 
12455
13232
  this.properties = properties;
12456
13233
 
12457
- forEach(packages, bind$2(this.registerPackage, this));
13234
+ forEach$2(packages, bind(this.registerPackage, this));
12458
13235
  }
12459
13236
 
12460
13237
 
@@ -12478,7 +13255,7 @@
12478
13255
  ensureAvailable(pkgMap, pkg, 'uri');
12479
13256
 
12480
13257
  // register types
12481
- forEach(pkg.types, bind$2(function(descriptor) {
13258
+ forEach$2(pkg.types, bind(function(descriptor) {
12482
13259
  this.registerType(descriptor, pkg);
12483
13260
  }, this));
12484
13261
 
@@ -12504,7 +13281,7 @@
12504
13281
  propertiesByName = {};
12505
13282
 
12506
13283
  // parse properties
12507
- forEach(type.properties, bind$2(function(p) {
13284
+ forEach$2(type.properties, bind(function(p) {
12508
13285
 
12509
13286
  // namespace property names
12510
13287
  var propertyNs = parseName(p.name, ns.prefix),
@@ -12530,7 +13307,7 @@
12530
13307
  propertiesByName: propertiesByName
12531
13308
  });
12532
13309
 
12533
- forEach(type.extends, bind$2(function(extendsName) {
13310
+ forEach$2(type.extends, bind(function(extendsName) {
12534
13311
  var extended = this.typeMap[extendsName];
12535
13312
 
12536
13313
  extended.traits = extended.traits || [];
@@ -12584,12 +13361,12 @@
12584
13361
  throw new Error('unknown type <' + nsName.name + '>');
12585
13362
  }
12586
13363
 
12587
- forEach(type.superClass, trait ? traverseTrait : traverseSuper);
13364
+ forEach$2(type.superClass, trait ? traverseTrait : traverseSuper);
12588
13365
 
12589
13366
  // call iterator with (type, inherited=!trait)
12590
13367
  iterator(type, !trait);
12591
13368
 
12592
- forEach(type.traits, traverseTrait);
13369
+ forEach$2(type.traits, traverseTrait);
12593
13370
  };
12594
13371
 
12595
13372
 
@@ -12892,7 +13669,7 @@
12892
13669
  this.properties.define(element, '$parent', { enumerable: false, writable: true });
12893
13670
  this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
12894
13671
 
12895
- forEach(properties, function(a, key) {
13672
+ forEach$2(properties, function(a, key) {
12896
13673
  if (isObject(a) && a.value !== undefined) {
12897
13674
  element[a.name] = a.value;
12898
13675
  } else {
@@ -14354,7 +15131,7 @@
14354
15131
  model = this.model,
14355
15132
  propNameNs;
14356
15133
 
14357
- forEach(attributes, function(value, name) {
15134
+ forEach$2(attributes, function(value, name) {
14358
15135
 
14359
15136
  var prop = descriptor.propertiesByName[name],
14360
15137
  values;
@@ -14372,7 +15149,7 @@
14372
15149
  // IDREFS: parse references as whitespace-separated list
14373
15150
  values = value.split(' ');
14374
15151
 
14375
- forEach(values, function(v) {
15152
+ forEach$2(values, function(v) {
14376
15153
  context.addReference({
14377
15154
  element: instance,
14378
15155
  property: prop.ns.name,
@@ -15116,7 +15893,7 @@
15116
15893
  }
15117
15894
 
15118
15895
  // do not serialize defaults
15119
- if (!has(element, name)) {
15896
+ if (!has$2(element, name)) {
15120
15897
  return false;
15121
15898
  }
15122
15899
 
@@ -15345,7 +16122,7 @@
15345
16122
 
15346
16123
  var attributes = [];
15347
16124
 
15348
- forEach(element, function(val, key) {
16125
+ forEach$2(element, function(val, key) {
15349
16126
 
15350
16127
  var nonNsAttr;
15351
16128
 
@@ -15353,7 +16130,7 @@
15353
16130
  body.push(new BodySerializer().build({ type: 'String' }, val));
15354
16131
  } else
15355
16132
  if (key === '$children') {
15356
- forEach(val, function(child) {
16133
+ forEach$2(val, function(child) {
15357
16134
  body.push(new ElementSerializer(self).build(child));
15358
16135
  });
15359
16136
  } else
@@ -15423,7 +16200,7 @@
15423
16200
  // parse namespace attributes first
15424
16201
  // and log them. push non namespace attributes to a list
15425
16202
  // and process them later
15426
- forEach(genericAttrs, function(value, name) {
16203
+ forEach$2(genericAttrs, function(value, name) {
15427
16204
 
15428
16205
  var nonNsAttr = self.parseNsAttribute(element, name, value);
15429
16206
 
@@ -15439,7 +16216,7 @@
15439
16216
 
15440
16217
  var self = this;
15441
16218
 
15442
- forEach(attributes, function(attr) {
16219
+ forEach$2(attributes, function(attr) {
15443
16220
 
15444
16221
  // do not serialize xsi:type attribute
15445
16222
  // it is set manually based on the actual implementation type
@@ -15464,7 +16241,7 @@
15464
16241
  body = this.body,
15465
16242
  element = this.element;
15466
16243
 
15467
- forEach(properties, function(p) {
16244
+ forEach$2(properties, function(p) {
15468
16245
  var value = element.get(p.name),
15469
16246
  isReference = p.isReference,
15470
16247
  isMany = p.isMany;
@@ -15477,12 +16254,12 @@
15477
16254
  body.push(new BodySerializer().build(p, value[0]));
15478
16255
  } else
15479
16256
  if (isSimple(p.type)) {
15480
- forEach(value, function(v) {
16257
+ forEach$2(value, function(v) {
15481
16258
  body.push(new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v));
15482
16259
  });
15483
16260
  } else
15484
16261
  if (isReference) {
15485
- forEach(value, function(v) {
16262
+ forEach$2(value, function(v) {
15486
16263
  body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v));
15487
16264
  });
15488
16265
  } else {
@@ -15492,7 +16269,7 @@
15492
16269
  var asType = serializeAsType(p),
15493
16270
  asProperty = serializeAsProperty(p);
15494
16271
 
15495
- forEach(value, function(v) {
16272
+ forEach$2(value, function(v) {
15496
16273
  var serializer;
15497
16274
 
15498
16275
  if (asType) {
@@ -15600,7 +16377,7 @@
15600
16377
  var self = this,
15601
16378
  element = this.element;
15602
16379
 
15603
- forEach(properties, function(p) {
16380
+ forEach$2(properties, function(p) {
15604
16381
 
15605
16382
  var value = element.get(p.name);
15606
16383
 
@@ -15611,7 +16388,7 @@
15611
16388
  }
15612
16389
  else {
15613
16390
  var values = [];
15614
- forEach(value, function(v) {
16391
+ forEach$2(value, function(v) {
15615
16392
  values.push(v.id);
15616
16393
  });
15617
16394
 
@@ -15651,7 +16428,7 @@
15651
16428
  attrs = getNsAttrs(namespaces).concat(attrs);
15652
16429
  }
15653
16430
 
15654
- forEach(attrs, function(a) {
16431
+ forEach$2(attrs, function(a) {
15655
16432
  writer
15656
16433
  .append(' ')
15657
16434
  .append(nsName(a.name)).append('="').append(a.value).append('"');
@@ -15678,7 +16455,7 @@
15678
16455
  .indent();
15679
16456
  }
15680
16457
 
15681
- forEach(this.body, function(b) {
16458
+ forEach$2(this.body, function(b) {
15682
16459
  b.serializeTo(writer);
15683
16460
  });
15684
16461
 
@@ -19612,7 +20389,7 @@
19612
20389
  function ensureCompatDiRef(businessObject) {
19613
20390
 
19614
20391
  // bpmnElement can have multiple independent DIs
19615
- if (!has(businessObject, 'di')) {
20392
+ if (!has$2(businessObject, 'di')) {
19616
20393
  Object.defineProperty(businessObject, 'di', {
19617
20394
  get: function() {
19618
20395
  throw new Error(DI_ERROR_MESSAGE);
@@ -19746,7 +20523,7 @@
19746
20523
  function handlePlane(plane) {
19747
20524
  registerDi(plane);
19748
20525
 
19749
- forEach(plane.planeElement, handlePlaneElement);
20526
+ forEach$2(plane.planeElement, handlePlaneElement);
19750
20527
  }
19751
20528
 
19752
20529
  function handlePlaneElement(planeElement) {
@@ -19883,7 +20660,7 @@
19883
20660
  }
19884
20661
 
19885
20662
  function handleMessageFlows(messageFlows, context) {
19886
- forEach(messageFlows, contextual(handleMessageFlow, context));
20663
+ forEach$2(messageFlows, contextual(handleMessageFlow, context));
19887
20664
  }
19888
20665
 
19889
20666
  function handleDataAssociation(association, context) {
@@ -19909,7 +20686,7 @@
19909
20686
 
19910
20687
  function handleArtifacts(artifacts, context) {
19911
20688
 
19912
- forEach(artifacts, function(e) {
20689
+ forEach$2(artifacts, function(e) {
19913
20690
  if (is(e, 'bpmn:Association')) {
19914
20691
  deferred.push(function() {
19915
20692
  handleArtifact(e, context);
@@ -19926,8 +20703,8 @@
19926
20703
  return;
19927
20704
  }
19928
20705
 
19929
- forEach(ioSpecification.dataInputs, contextual(handleDataInput, context));
19930
- forEach(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
20706
+ forEach$2(ioSpecification.dataInputs, contextual(handleDataInput, context));
20707
+ forEach$2(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
19931
20708
  }
19932
20709
 
19933
20710
  function handleSubProcess(subProcess, context) {
@@ -19954,8 +20731,8 @@
19954
20731
  // * bpmn:CatchEvent
19955
20732
  //
19956
20733
  deferred.push(function() {
19957
- forEach(flowNode.dataInputAssociations, contextual(handleDataAssociation, context));
19958
- forEach(flowNode.dataOutputAssociations, contextual(handleDataAssociation, context));
20734
+ forEach$2(flowNode.dataInputAssociations, contextual(handleDataAssociation, context));
20735
+ forEach$2(flowNode.dataOutputAssociations, contextual(handleDataAssociation, context));
19959
20736
  });
19960
20737
  }
19961
20738
 
@@ -19982,11 +20759,11 @@
19982
20759
  }
19983
20760
 
19984
20761
  function handleLaneSet(laneSet, context) {
19985
- forEach(laneSet.lanes, contextual(handleLane, context));
20762
+ forEach$2(laneSet.lanes, contextual(handleLane, context));
19986
20763
  }
19987
20764
 
19988
20765
  function handleLaneSets(laneSets, context) {
19989
- forEach(laneSets, contextual(handleLaneSet, context));
20766
+ forEach$2(laneSets, contextual(handleLaneSet, context));
19990
20767
  }
19991
20768
 
19992
20769
  function handleFlowElementsContainer(container, context) {
@@ -19998,7 +20775,7 @@
19998
20775
  }
19999
20776
 
20000
20777
  function handleFlowElements(flowElements, context) {
20001
- forEach(flowElements, function(e) {
20778
+ forEach$2(flowElements, function(e) {
20002
20779
  if (is(e, 'bpmn:SequenceFlow')) {
20003
20780
  deferred.push(function() {
20004
20781
  handleSequenceFlow(e, context);
@@ -20036,7 +20813,7 @@
20036
20813
 
20037
20814
  function handleCollaboration(collaboration, context) {
20038
20815
 
20039
- forEach(collaboration.participants, contextual(handleParticipant, context));
20816
+ forEach$2(collaboration.participants, contextual(handleParticipant, context));
20040
20817
 
20041
20818
  handleArtifacts(collaboration.artifacts, context);
20042
20819
 
@@ -20050,7 +20827,7 @@
20050
20827
  function wireFlowNodeRefs(lane) {
20051
20828
 
20052
20829
  // wire the virtual flowNodeRefs <-> relationship
20053
- forEach(lane.flowNodeRef, function(flowNode) {
20830
+ forEach$2(lane.flowNodeRef, function(flowNode) {
20054
20831
  var lanes = flowNode.get('lanes');
20055
20832
 
20056
20833
  if (lanes) {
@@ -20144,7 +20921,7 @@
20144
20921
 
20145
20922
  // traverse BPMN 2.0 document model,
20146
20923
  // starting at definitions
20147
- forEach(diagramsToImport, function(diagram) {
20924
+ forEach$2(diagramsToImport, function(diagram) {
20148
20925
  walker.handleDefinitions(definitions, diagram);
20149
20926
  });
20150
20927
 
@@ -20184,7 +20961,7 @@
20184
20961
  }
20185
20962
 
20186
20963
  /**
20187
- * Returns all diagrams in the same hirarchy as the requested diagram.
20964
+ * Returns all diagrams in the same hierarchy as the requested diagram.
20188
20965
  * Includes all parent and sub process diagrams.
20189
20966
  *
20190
20967
  * @param {Array} definitions
@@ -20226,7 +21003,7 @@
20226
21003
 
20227
21004
  // all collaboration processes can contain sub-diagrams
20228
21005
  if (collaboration) {
20229
- rootElements = map$1(collaboration.participants, function(participant) {
21006
+ rootElements = map(collaboration.participants, function(participant) {
20230
21007
  return participant.processRef;
20231
21008
  });
20232
21009
 
@@ -20240,7 +21017,7 @@
20240
21017
  var diagramsToImport = [ bpmnDiagram ];
20241
21018
  var handledElements = [ bpmnElement ];
20242
21019
 
20243
- forEach(definitions.diagrams, function(diagram) {
21020
+ forEach$2(definitions.diagrams, function(diagram) {
20244
21021
  var businessObject = diagram.plane.bpmnElement;
20245
21022
 
20246
21023
  if (
@@ -20259,7 +21036,7 @@
20259
21036
  function selfAndAllFlowElements(elements) {
20260
21037
  var result = [];
20261
21038
 
20262
- forEach(elements, function(element) {
21039
+ forEach$2(elements, function(element) {
20263
21040
  if (!element) {
20264
21041
  return;
20265
21042
  }
@@ -20292,53 +21069,53 @@
20292
21069
 
20293
21070
 
20294
21071
  // inlined ../../resources/logo.svg
20295
- var BPMNIO_LOGO_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21" style="vertical-align:middle"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>';
21072
+ var BPMNIO_LOGO_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>';
20296
21073
 
20297
21074
  var BPMNIO_IMG = BPMNIO_LOGO_SVG;
20298
21075
 
20299
- function css(attrs) {
20300
- return attrs.join(';');
20301
- }
20302
-
20303
- var LINK_STYLES = css([
20304
- 'color: #404040'
20305
- ]);
20306
-
20307
- var LIGHTBOX_STYLES = css([
20308
- 'z-index: 1001',
20309
- 'position: fixed',
20310
- 'top: 0',
20311
- 'left: 0',
20312
- 'right: 0',
20313
- 'bottom: 0'
20314
- ]);
20315
-
20316
- var BACKDROP_STYLES = css([
20317
- 'width: 100%',
20318
- 'height: 100%',
20319
- 'background: rgba(40,40,40,0.2)'
20320
- ]);
20321
-
20322
- var NOTICE_STYLES = css([
20323
- 'position: absolute',
20324
- 'left: 50%',
20325
- 'top: 40%',
20326
- 'transform: translate(-50%)',
20327
- 'width: 260px',
20328
- 'padding: 10px',
20329
- 'background: white',
20330
- 'box-shadow: 0 1px 4px rgba(0,0,0,0.3)',
20331
- 'font-family: Helvetica, Arial, sans-serif',
20332
- 'font-size: 14px',
20333
- 'display: flex',
20334
- 'line-height: 1.3'
20335
- ]);
21076
+ var LOGO_STYLES = {
21077
+ verticalAlign: 'middle'
21078
+ };
21079
+
21080
+ var LINK_STYLES = {
21081
+ 'color': '#404040'
21082
+ };
21083
+
21084
+ var LIGHTBOX_STYLES = {
21085
+ 'zIndex': '1001',
21086
+ 'position': 'fixed',
21087
+ 'top': '0',
21088
+ 'left': '0',
21089
+ 'right': '0',
21090
+ 'bottom': '0'
21091
+ };
21092
+
21093
+ var BACKDROP_STYLES = {
21094
+ 'width': '100%',
21095
+ 'height': '100%',
21096
+ 'background': 'rgba(40,40,40,0.2)'
21097
+ };
21098
+
21099
+ var NOTICE_STYLES = {
21100
+ 'position': 'absolute',
21101
+ 'left': '50%',
21102
+ 'top': '40%',
21103
+ 'transform': 'translate(-50%)',
21104
+ 'width': '260px',
21105
+ 'padding': '10px',
21106
+ 'background': 'white',
21107
+ 'boxShadow': '0 1px 4px rgba(0,0,0,0.3)',
21108
+ 'fontFamily': 'Helvetica, Arial, sans-serif',
21109
+ 'fontSize': '14px',
21110
+ 'display': 'flex',
21111
+ 'lineHeight': '1.3'
21112
+ };
20336
21113
 
20337
21114
  var LIGHTBOX_MARKUP =
20338
- '<div class="bjs-powered-by-lightbox" style="' + LIGHTBOX_STYLES + '">' +
20339
- '<div class="backdrop" style="' + BACKDROP_STYLES + '"></div>' +
20340
- '<div class="notice" style="' + NOTICE_STYLES + '">' +
20341
- '<a href="https://bpmn.io" target="_blank" rel="noopener" style="margin: 15px 20px 15px 10px; align-self: center;' + LINK_STYLES + '">' +
21115
+ '<div class="bjs-powered-by-lightbox">' +
21116
+ '<div class="backdrop"></div>' +
21117
+ '<div class="notice">' +
21118
+ '<a href="https://bpmn.io" target="_blank" rel="noopener" class="link">' +
20342
21119
  BPMNIO_IMG +
20343
21120
  '</a>' +
20344
21121
  '<span>' +
@@ -20351,12 +21128,25 @@
20351
21128
 
20352
21129
  var lightbox;
20353
21130
 
21131
+ function createLightbox() {
21132
+ lightbox = domify$1(LIGHTBOX_MARKUP);
21133
+
21134
+ assign$1$1(lightbox, LIGHTBOX_STYLES);
21135
+ assign$1$1(query$1('svg', lightbox), LOGO_STYLES);
21136
+ assign$1$1(query$1('.backdrop', lightbox), BACKDROP_STYLES);
21137
+ assign$1$1(query$1('.notice', lightbox), NOTICE_STYLES);
21138
+ assign$1$1(query$1('.link', lightbox), LINK_STYLES, {
21139
+ 'margin': '15px 20px 15px 10px',
21140
+ 'alignSelf': 'center'
21141
+ });
21142
+ }
21143
+
20354
21144
  function open() {
20355
21145
 
20356
21146
  if (!lightbox) {
20357
- lightbox = domify(LIGHTBOX_MARKUP);
21147
+ createLightbox();
20358
21148
 
20359
- delegate.bind(lightbox, '.backdrop', 'click', function(event) {
21149
+ delegate$1.bind(lightbox, '.backdrop', 'click', function(event) {
20360
21150
  document.body.removeChild(lightbox);
20361
21151
  });
20362
21152
  }
@@ -20775,7 +21565,7 @@
20775
21565
  var canvas = self.get('canvas');
20776
21566
 
20777
21567
  var contentNode = canvas.getActiveLayer(),
20778
- defsNode = query('defs', canvas._svg);
21568
+ defsNode = query$1('defs', canvas._svg);
20779
21569
 
20780
21570
  var contents = innerSVG(contentNode),
20781
21571
  defs = defsNode ? '<defs>' + innerSVG(defsNode) + '</defs>' : '';
@@ -20877,7 +21667,7 @@
20877
21667
  Diagram.prototype.destroy.call(this);
20878
21668
 
20879
21669
  // dom detach
20880
- remove$1(this._container);
21670
+ remove$2(this._container);
20881
21671
  };
20882
21672
 
20883
21673
  /**
@@ -20920,7 +21710,7 @@
20920
21710
  }
20921
21711
 
20922
21712
  if (typeof parentNode === 'string') {
20923
- parentNode = query(parentNode);
21713
+ parentNode = query$1(parentNode);
20924
21714
  }
20925
21715
 
20926
21716
  parentNode.appendChild(this._container);
@@ -20988,9 +21778,9 @@
20988
21778
 
20989
21779
  BaseViewer.prototype._createContainer = function(options) {
20990
21780
 
20991
- var container = domify('<div class="bjs-container"></div>');
21781
+ var container = domify$1('<div class="bjs-container"></div>');
20992
21782
 
20993
- assign(container.style, {
21783
+ assign$1$1(container, {
20994
21784
  width: ensureUnit(options.width),
20995
21785
  height: ensureUnit(options.height),
20996
21786
  position: options.position
@@ -21080,15 +21870,23 @@
21080
21870
  'target="_blank" ' +
21081
21871
  'class="bjs-powered-by" ' +
21082
21872
  'title="Powered by bpmn.io" ' +
21083
- 'style="position: absolute; bottom: 15px; right: 15px; z-index: 100; ' + LINK_STYLES + '">' +
21873
+ '>' +
21084
21874
  img +
21085
21875
  '</a>';
21086
21876
 
21087
- var linkElement = domify(linkMarkup);
21877
+ var linkElement = domify$1(linkMarkup);
21878
+
21879
+ assign$1$1(query$1('svg', linkElement), LOGO_STYLES);
21880
+ assign$1$1(linkElement, LINK_STYLES, {
21881
+ position: 'absolute',
21882
+ bottom: '15px',
21883
+ right: '15px',
21884
+ zIndex: '100'
21885
+ });
21088
21886
 
21089
21887
  container.appendChild(linkElement);
21090
21888
 
21091
- componentEvent.bind(linkElement, 'click', function(event) {
21889
+ componentEvent$1.bind(linkElement, 'click', function(event) {
21092
21890
  open();
21093
21891
 
21094
21892
  event.preventDefault();
@@ -21191,7 +21989,7 @@
21191
21989
  * @param {KeyboardEvent} event
21192
21990
  */
21193
21991
  function isKey(keys, event) {
21194
- keys = isArray$1(keys) ? keys : [ keys ];
21992
+ keys = isArray$3(keys) ? keys : [ keys ];
21195
21993
 
21196
21994
  return keys.indexOf(event.key) !== -1 || keys.indexOf(event.keyCode) !== -1;
21197
21995
  }
@@ -21398,7 +22196,7 @@
21398
22196
  var KEYCODE_Y = 89;
21399
22197
  var KEYCODE_Z = 90;
21400
22198
 
21401
- var KEYS_COPY = ['c', 'C', KEYCODE_C ];
22199
+ var KEYS_COPY = [ 'c', 'C', KEYCODE_C ];
21402
22200
  var KEYS_PASTE = [ 'v', 'V', KEYCODE_V ];
21403
22201
  var KEYS_REDO = [ 'y', 'Y', KEYCODE_Y ];
21404
22202
  var KEYS_UNDO = [ 'z', 'Z', KEYCODE_Z ];
@@ -21554,7 +22352,7 @@
21554
22352
 
21555
22353
  var event = context.keyEvent;
21556
22354
 
21557
- if (isKey(['Backspace', 'Delete', 'Del' ], event)) {
22355
+ if (isKey([ 'Backspace', 'Delete', 'Del' ], event)) {
21558
22356
  editorActions.trigger('removeSelection');
21559
22357
 
21560
22358
  return true;
@@ -21920,7 +22718,7 @@
21920
22718
  this._canvas = canvas;
21921
22719
  this._container = canvas._container;
21922
22720
 
21923
- this._handleWheel = bind$2(this._handleWheel, this);
22721
+ this._handleWheel = bind(this._handleWheel, this);
21924
22722
 
21925
22723
  this._totalDelta = 0;
21926
22724
  this._scale = config.scale || DEFAULT_SCALE;